@import url('https://fonts.googleapis.com/css?family=Lato:400,400italic,700,700italic');
:root {
  --bg: #f4f4f4;
  --card: #ffffff;
  --border: #e4e4e4;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #4acaa8;
  --accent-dark: #37ad8c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
header h1 { font-size: 20px; margin: 0; }
#lang-switch { display: flex; gap: 4px; }
.back-link {
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  font-weight: 400;
}
.back-link:hover { color: var(--accent-dark); }
.lang-btn {
  border: 1px solid var(--muted);
  background: var(--bg);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-weight: 600;
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent); }
.lang-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.lang-btn.active:hover { color: #fff; }

section { max-width: 1100px; margin: 20px auto; padding: 0 24px; }
#prices {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
}
.price-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.price-row label { color: var(--muted); font-size: 14px; }
.lbl { display: inline-flex; align-items: center; gap: 2px; }
.price-row input {
  width: 100px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}
#fuel-source { color: var(--muted); font-size: 13px; }
#auto-calc { color: var(--muted); font-size: 12px; }
#refresh-fuel {
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
}
#refresh-fuel:hover { color: var(--accent-dark); border-color: var(--accent); background: none; }
.btn-secondary { background: none; color: var(--muted); border: 1px solid var(--border); }
.btn-secondary:hover { color: var(--accent-dark); border-color: var(--accent); background: none; }
#custom { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
#custom-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
#custom-form input, #custom-form select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--card);
}
#custom-form input[type="text"] { width: 180px; }
button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--accent-dark); }
button:disabled { opacity: 0.5; cursor: default; }

#selector { display: flex; gap: 12px; flex-wrap: wrap; }
#selector select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  flex: 1;
  min-width: 160px;
  background: var(--card);
}
#selected { display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #d6f4ec;
  border: 1px solid #aee8d8;
  color: #157a60;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
}
.chip button { background: none; color: inherit; padding: 0 2px; font-size: 12px; }

.info {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 50%;
  background: var(--muted);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
}
.info:hover { background: var(--accent); }
#info-tip {
  position: fixed;
  display: none;
  max-width: 260px;
  background: #333;
  color: #fff;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.cell-val { white-space: nowrap; }
.cell-display { cursor: text; }
.cell-val .cell-edit {
  display: none;
  background: none;
  border: none;
  padding: 0 2px;
  margin-left: 2px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  vertical-align: middle;
}
.cell-val:hover .cell-edit { display: inline; }
.cell-edit:hover { color: var(--accent); }
.cell-input {
  width: 100px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  font-size: 14px;
  text-align: right;
  color: inherit;
  font-family: inherit;
}
.cell-input:hover, .cell-input:focus {
  border-color: var(--border);
  background: #fff;
  outline: none;
}

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.table-wrap h2 { font-size: 16px; margin: 8px 12px 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; font-weight: 500; color: var(--muted); }
thead th { font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
}
.chart-card h2 { font-size: 16px; margin: 0 0 12px; }
.chart-box { position: relative; height: 320px; }
#payback-text { margin-top: 10px; font-size: 13px; color: var(--muted); }

@media (max-width: 800px) {
  .charts { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .price-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 12px; }
  .price-row input { width: 110px; }
  header { flex-wrap: wrap; row-gap: 8px; }
}

.footer {
  text-align: center;
  padding: 16px;
  font-size: 13px;
  color: var(--muted);
}
.footer a { color: var(--accent-dark); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
