@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');
:root {
  color-scheme: dark;
  --bg: #0b1018;
  --panel: #121a26;
  --line: #253143;
  --muted: #a3b0c3;
  --text: #f0f5fd;
  --green: #a8f56a;
  --blue: #8cbaff;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    16px 'DM Sans',
    sans-serif;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}
input:focus,
select:focus {
  outline: 2px solid var(--green);
}
[hidden] {
  display: none !important;
}
.app {
  max-width: 1120px;
  margin: auto;
  padding: 0 32px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 32px 0 26px;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  font-family: Manrope, sans-serif;
  font-size: 23px;
  letter-spacing: -0.6px;
}
.brand b {
  font-weight: 800;
}
.brand small {
  display: block;
  letter-spacing: 1.6px;
  font-size: 9px;
  margin-top: 3px;
  color: var(--muted);
}
.logo {
  background: var(--green);
  color: #15280c;
  border-radius: 13px;
  padding: 9px;
  font-weight: 800;
  font-size: 25px;
}
.logo span {
  font-size: 18px;
}
.car {
  color: var(--muted);
  font-size: 14px;
}
.car-separator {
  margin: 0 9px;
  color: var(--green);
}
nav {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--line);
}
nav button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  padding: 18px 0;
  min-height: 48px;
}
nav button.active {
  border-color: var(--green);
  color: var(--green);
}
nav button span {
  margin-left: 7px;
}
.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 34px 0 24px;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 0 0 9px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-family: Manrope, sans-serif;
  font-size: 28px;
  letter-spacing: -1px;
  margin-bottom: 0;
}
h2 {
  font-family: Manrope, sans-serif;
  font-size: 18px;
  margin: 0;
  font-weight: 700;
}
.badge {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.layout {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 22px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 24px;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.step {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.2px;
}
.gauge {
  width: 216px;
  height: 216px;
  border-radius: 50%;
  margin: 28px auto;
  background: conic-gradient(
    from 220deg,
    var(--green) 0deg 273.6deg,
    #263247 273.6deg 288deg,
    transparent 288deg
  );
  display: grid;
  place-items: center;
  transform: rotate(-4deg);
}
.gauge > div {
  width: 190px;
  height: 190px;
  background: var(--panel);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transform: rotate(4deg);
}
.gauge strong {
  font:
    700 56px Manrope,
    sans-serif;
  letter-spacing: -3px;
}
.gauge strong span {
  font-size: 25px;
  color: var(--muted);
  letter-spacing: 0;
  margin-left: 3px;
}
.gauge small {
  font-size: 10px;
  letter-spacing: 1.7px;
  color: var(--muted);
  margin-top: 6px;
}
.tank-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  text-align: center;
  margin-bottom: 25px;
}
.tank-stats > div + div {
  border-left: 1px solid var(--line);
}
.tank-stats span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.tank-stats b {
  font-size: 21px;
  font-weight: 600;
}
.subtle {
  background: #1a2535;
  color: #bccadb;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  padding: 13px 15px;
  margin: 0;
}
.helper {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 9px 0 20px;
}
label {
  display: block;
  font-size: 14px;
  margin-bottom: 10px;
  color: #dce5f3;
}
input,
select {
  display: block;
  width: 100%;
  background: #0e1520;
  border: 1px solid #33425a;
  border-radius: 10px;
  padding: 13px;
  color: var(--text);
  margin-top: 9px;
  min-height: 48px;
}
.big-input {
  display: flex;
  border: 1px solid #40516a;
  border-radius: 12px;
  padding: 4px 16px;
  align-items: center;
}
.big-input input {
  border: 0;
  background: transparent;
  font-size: 30px;
  font-weight: 600;
  padding: 8px 0;
  margin: 0;
  min-width: 0;
}
.big-input span {
  font-size: 23px;
  color: var(--muted);
}
.mix-choices {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.mix-choices button {
  flex: 1;
  min-width: 0;
  border: 1px solid #34435a;
  background: #182231;
  color: #b9c6d9;
  padding: 12px 3px;
  border-radius: 10px;
  font-weight: 600;
}
.mix-choices button.selected {
  color: var(--green);
  background: #223322;
  border-color: #587344;
}
.result-title {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin: 20px 0 12px;
  gap: 10px;
}
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.result-grid > div {
  background: #1c2b29;
  border: 1px solid #314a3b;
  padding: 17px;
  border-radius: 12px;
}
.result-grid > div + div {
  background: #1b273c;
  border-color: #304363;
}
.result-grid span {
  display: block;
  color: var(--green);
  font-size: 13px;
}
.result-grid > div + div span {
  color: var(--blue);
}
.result-grid strong {
  display: block;
  font:
    700 29px Manrope,
    sans-serif;
  margin-top: 8px;
  letter-spacing: -1px;
}
.result-grid small {
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
}
.primary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 15px 18px;
  background: var(--green);
  color: #162510;
  font-weight: 700;
  border: 0;
  border-radius: 11px;
  min-height: 50px;
}
.primary span {
  font-size: 22px;
  line-height: 18px;
}
.calculator > .helper:last-child {
  margin: 12px 0 0;
  font-size: 12px;
}
.recent {
  margin-top: 22px;
}
.text-button {
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 13px;
  padding: 8px 0;
}
.empty {
  padding: 17px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.empty strong {
  display: block;
  color: var(--text);
  font-weight: 500;
}
.fineprint {
  color: #94a3b9;
  font-size: 12px;
  line-height: 1.7;
  margin: 20px 0;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 22px;
}
.summary-grid span {
  font-size: 13px;
  color: var(--muted);
}
.summary-grid strong {
  display: block;
  font:
    700 30px Manrope,
    sans-serif;
  margin-top: 12px;
}
.record-list {
  display: grid;
  gap: 12px;
}
.record {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}
.record-date {
  font-size: 13px;
  color: var(--muted);
  margin-top: 5px;
}
.record-mix {
  color: var(--green);
  font-size: 24px;
  font-weight: 600;
  white-space: nowrap;
}
.record-detail {
  font-size: 14px;
  line-height: 1.6;
}
.record-note {
  font-size: 13px;
  color: var(--muted);
  margin: 9px 0 0;
  overflow-wrap: anywhere;
}
.settings {
  max-width: 740px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
}
.settings .primary {
  max-width: 260px;
  margin-top: 22px;
}
.settings .helper {
  margin-top: 15px;
}
.settings .subtle {
  margin: 14px 0;
}
.error {
  color: #ffb1a6;
  font-size: 14px;
  line-height: 1.5;
  margin-top: 12px;
}
.error:empty {
  display: none;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 25px 0 30px;
  border-top: 1px solid var(--line);
  margin-top: 34px;
  color: var(--muted);
  font-size: 12px;
}
footer > span:first-child {
  font-weight: 700;
  color: #d8e2ef;
}
footer b {
  font-weight: 500;
  color: var(--text);
}
dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  width: 440px;
  max-width: calc(100% - 28px);
  max-height: 90dvh;
  overflow: auto;
}
dialog::backdrop {
  background: #000a;
  backdrop-filter: blur(5px);
}
.close {
  background: none;
  color: var(--muted);
  border: 0;
  font-size: 30px;
  min-width: 44px;
  min-height: 44px;
}
dialog .primary {
  margin-top: 18px;
}
#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: #14210e;
  border-radius: 12px;
  padding: 14px 22px;
  box-shadow: 0 8px 30px #0005;
  max-width: 90%;
  z-index: 20;
  text-align: center;
  font-size: 14px;
}
@media (max-width: 700px) {
  .app {
    padding: 0 18px;
  }
  header {
    padding: 23px 0 16px;
  }
  .brand {
    font-size: 21px;
  }
  .brand small {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .car {
    font-size: 12px;
    max-width: 82px;
    text-align: right;
    line-height: 1.7;
  }
  nav {
    gap: 0;
    justify-content: space-between;
  }
  nav button {
    font-size: 14px;
    padding: 15px 5px;
  }
  .page-title {
    margin: 26px 0 20px;
  }
  .page-title .badge {
    display: none;
  }
  h1 {
    font-size: 23px;
    letter-spacing: -0.7px;
  }
  .layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .calculator {
    order: 0;
  }
  .tank {
    order: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
  }
  .tank .section-head {
    grid-column: 1/-1;
    margin-bottom: 0;
  }
  .gauge {
    width: 150px;
    height: 150px;
    margin: 14px auto;
  }
  .gauge > div {
    width: 130px;
    height: 130px;
  }
  .gauge strong {
    font-size: 39px;
  }
  .gauge small {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .tank-stats {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: left;
    margin: 0;
    gap: 15px;
  }
  .tank-stats > div + div {
    border: 0;
  }
  .tank-stats b {
    font-size: 19px;
  }
  .tank-stats span {
    margin-bottom: 4px;
  }
  .tank .subtle {
    grid-column: 1/-1;
  }
  .panel {
    padding: 21px;
    border-radius: 16px;
  }
  .section-head {
    margin-bottom: 20px;
  }
  .step {
    font-size: 9px;
  }
  .summary-grid {
    gap: 8px;
  }
  .summary-grid .panel {
    padding: 15px 10px;
  }
  .summary-grid strong {
    font-size: 21px;
  }
  .summary-grid span {
    font-size: 12px;
  }
  .record {
    flex-wrap: wrap;
    gap: 12px;
  }
  .record-detail {
    flex-basis: 100%;
    order: 2;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .recent {
    margin-top: 16px;
  }
  footer {
    font-size: 11px;
  }
  .result-grid strong {
    font-size: 28px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition:
      background 0.15s,
      opacity 0.15s;
  }
  button:hover:not(:disabled) {
    filter: brightness(1.08);
  }
}

.brand-logo {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex: none;
}
.brand > span:last-child {
  min-width: 0;
}
.car {
  max-width: 230px;
  overflow-wrap: anywhere;
}
footer a {
  color: var(--text);
  font-weight: 600;
  text-underline-offset: 3px;
}
footer a:hover {
  color: var(--green);
}
.history-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin: 0 0 18px;
}
.select-all,
.record-selection {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin: 0;
  min-height: 44px;
  font-size: 14px;
}
.select-all input,
.record-selection input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  flex: none;
  accent-color: var(--green);
}
.selection-count {
  font-size: 13px;
  color: var(--muted);
}
.history-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}
.secondary {
  border: 1px solid #40516a;
  background: #1a2535;
  border-radius: 10px;
  color: var(--text);
  padding: 12px 16px;
  min-height: 46px;
}
.danger {
  color: #ffb1a6;
  border-color: #744840;
  background: #312023;
}
.record-selection {
  color: var(--muted);
  margin-bottom: 15px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.dialog-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 22px;
}
#delete-title {
  margin-bottom: 14px;
}
@media (max-width: 700px) {
  .brand-logo {
    width: 44px;
    height: 44px;
  }
  .car {
    max-width: 105px;
  }
  .history-buttons {
    margin-left: 0;
    width: 100%;
  }
  .history-buttons button {
    flex: 1;
    font-size: 13px;
    padding: 12px 10px;
  }
  .dialog-actions button {
    flex: 1;
  }
}

input, select, textarea {
  font-size: max(16px, 1rem);
}
.big-input input {
  font-size: 30px;
}
.brand-logo {
  border-radius: 14px;
  overflow: hidden;
}

.tank-history { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 14px; }
.tank-history th, .tank-history td { padding: 11px 6px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tank-history th:first-child { text-align: left; }
.tank-history thead th { color: var(--muted); font-size: 12px; font-weight: 500; }
.tank-history tbody th { font-weight: 400; color: var(--muted); }
.tank-history td:last-child { color: var(--green); }
