:root {
  color-scheme: light;
  --ink: #28213f;
  --green: #5b2fc9;
  --green-2: #6846e8;
  --green-soft: #eeeaff;
  --cream: #f4f1ff;
  --paper: #fffeff;
  --line: #d9d2ef;
  --accent: #9b87f5;
  --danger: #a42f25;
  font-family: Inter, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0; color: var(--ink); min-height: 100vh; line-height: 1.7;
  background:
    radial-gradient(circle at 8% 5%, rgba(128,87,236,.19), transparent 27rem),
    radial-gradient(circle at 92% 88%, rgba(74,221,201,.13), transparent 24rem),
    linear-gradient(145deg, #fbfaff 0%, var(--cream) 62%, #eeeaff 100%);
}
button, input { font: inherit; }
button { cursor: pointer; min-height: 52px; transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }

.brand-group { display: flex; align-items: center; gap: 18px; }
.menu-button {
  display: grid; place-content: center; gap: 6px; flex: 0 0 auto; width: 58px; height: 58px;
  padding: 0; color: white; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.62);
  border-radius: 15px;
}
.menu-button span { display: block; width: 27px; height: 3px; background: currentColor; border-radius: 10px; }
.menu-button:hover { background: rgba(255,255,255,.22); }
.menu-overlay { position: fixed; z-index: 40; inset: 0; background: rgba(22,10,52,.58); backdrop-filter: blur(3px); }
.side-menu {
  position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(360px, 86vw); padding: 24px 24px 118px;
  color: #28213f; background: linear-gradient(160deg, #fff 0%, #f4f0ff 100%);
  box-shadow: 20px 0 60px rgba(31,13,72,.3); transform: translateX(-105%); visibility: hidden;
  transition: transform .22s ease, visibility .22s;
}
.side-menu.open { transform: translateX(0); visibility: visible; }
.menu-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; padding: 4px 4px 20px; border-bottom: 2px solid #e2dbf4; }
.menu-heading b { font-size: 1.35rem; }
.menu-heading button { width: 50px; padding: 0; color: #4d3b78; background: #eee9fb; border: 0; border-radius: 12px; font-size: 2rem; line-height: 1; }
.nav-item {
  display: flex; align-items: center; gap: 15px; width: 100%; min-height: 68px; margin: 8px 0; padding: 12px 16px;
  color: #443663; background: transparent; border: 2px solid transparent; border-radius: 14px;
  text-align: left; font-size: 1.08rem; font-weight: 850;
}
.nav-item span { display: grid; place-items: center; width: 38px; height: 38px; color: #5b35bd; background: #ebe5ff; border-radius: 11px; font-size: 1.2rem; }
.nav-item:hover { background: #f0ebff; }
.nav-item.active { color: white; background: linear-gradient(135deg, #4a20ad, #7958eb); box-shadow: 0 9px 22px rgba(83,45,177,.22); }
.nav-item.active span { color: #3b247e; background: #cafff7; }
.install-nav {
  position: absolute; inset: auto 24px 28px; display: flex; align-items: center; justify-content: center; gap: 11px;
  min-height: 62px; padding: 12px; color: white; background: linear-gradient(135deg, #4a20ad, #7958eb);
  border: 0; border-radius: 14px; box-shadow: 0 9px 22px rgba(83,45,177,.24); font-weight: 850;
}
.install-nav span { font-size: 1.35rem; }

.header-actions { align-self: flex-start; display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.theme-toggle {
  display: inline-grid; place-items: center; width: 56px; height: 56px; padding: 0;
  color: white; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.58);
  border-radius: 12px; font-weight: 800;
}
.theme-toggle:hover { background: rgba(255,255,255,.18); }
.theme-icon { color: #d9d1ff; font-size: 1.45rem; line-height: 1; text-shadow: 0 0 10px rgba(217,209,255,.7); }

.hero {
  display: flex; justify-content: space-between; align-items: end; gap: 24px;
  padding: 54px max(24px, calc((100vw - 1040px) / 2));
  color: white;
  background:
    radial-gradient(circle at 78% -80%, rgba(165,139,255,.75), transparent 45%),
    linear-gradient(125deg, #27105f 0%, #4c24ae 48%, #7658e8 100%);
  border-bottom: 5px solid #8ce8dc;
}
.hero h1 { margin: 4px 0 8px; font-size: clamp(2.3rem, 6vw, 4.2rem); line-height: 1.2; letter-spacing: .04em; }
.title-button {
  min-height: 0; padding: 0; color: inherit; background: none; border: 0;
  font: inherit; letter-spacing: inherit; line-height: inherit; text-align: left;
}
.title-button:focus-visible { outline-color: #c9fff7; outline-width: 3px; }
.hero p { margin: 0; font-size: 1.05rem; opacity: .92; }
.eyebrow { font-size: .78rem !important; letter-spacing: .22em; font-weight: 800; color: #c9fff7; }

main { width: min(1040px, calc(100% - 32px)); margin: 36px auto; display: grid; gap: 26px; }
.view:not(.active) { display: none !important; }
.view.active { animation: view-in .18s ease-out; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.card {
  padding: clamp(24px, 4vw, 44px); background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(251,249,255,.95));
  border: 1px solid rgba(197,187,228,.78); border-radius: 22px;
  box-shadow: 0 18px 50px rgba(72,39,148,.11), 0 2px 6px rgba(72,39,148,.05);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.section-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 30px; }
.section-heading h2 { margin: 2px 0 0; font-size: 1.65rem; line-height: 1.35; }
.step { margin: 0; color: var(--green-2); font-size: .82rem; font-weight: 900; letter-spacing: .18em; }
.status { padding: 8px 14px; border-radius: 99px; color: #3c247e; background: #e8e0ff; font-size: .88rem; font-weight: 800; }
.status.offline { color: #6d5413; background: #f7e8bb; }

fieldset { padding: 0; border: 0; margin: 0 0 30px; }
legend, label { font-weight: 800; font-size: 1rem; }
.vehicle-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 13px; }
.vehicle-option input { position: absolute; opacity: 0; pointer-events: none; }
.vehicle-option span {
  display: grid; place-items: center; min-height: 72px; padding: 18px 10px;
  color: #3b315c; background: #faf8ff; border: 2px solid var(--line);
  border-radius: 14px; text-align: center; font-size: 1.1rem; font-weight: 800; transition: .15s;
}
.vehicle-option span:hover { border-color: #9a86df; background: #f2edff; }
.vehicle-option input:checked + span { color: white; border-color: #6c49df; background: linear-gradient(145deg, #4d25b0, #7655e6); box-shadow: 0 7px 18px rgba(83,45,177,.25); }
.vehicle-option input:focus-visible + span { outline: 4px solid rgba(104,70,232,.25); outline-offset: 3px; }
.time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.time-section { margin-bottom: 18px; }
.quick-times { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 10px; }
.quick-times button {
  min-height: 52px; padding: 8px; color: #493978; background: #f5f2ff;
  border: 2px solid #d7cfee; border-radius: 11px; font-weight: 850;
}
.quick-times button:hover { background: #ece6ff; border-color: #9f8be4; }
.quick-times button.selected {
  color: white; background: linear-gradient(145deg, #4d25b0, #7655e6); border-color: #6c49df;
  box-shadow: 0 5px 14px rgba(83,45,177,.2);
}
input[type="datetime-local"], input[type="number"] {
  width: 100%; min-height: 58px; margin-top: 9px; padding: 13px 15px;
  color: var(--ink); background: white; border: 2px solid var(--line); border-radius: 12px;
  font-size: 1.05rem; font-weight: 650;
}
input:focus { outline: 4px solid rgba(104,70,232,.17); outline-offset: 2px; border-color: var(--green-2); }
input[readonly] { color: #46386e; background: #f0edfa; border-color: #c8bee4; cursor: default; }
.auto-label { display: inline-block; margin-left: 6px; padding: 2px 8px; color: #4d2a9c; background: #ebe4ff; border-radius: 999px; font-size: .76rem; font-weight: 800; }
.current-time-panel {
  display: grid; grid-template-columns: auto minmax(240px, 1fr); align-items: center; gap: 16px;
  margin: 4px 0 8px; padding: 13px 16px; color: #35275f;
  background: linear-gradient(135deg, #f0ecff, #e9f9f6); border: 1px solid #d3c9ef; border-radius: 13px;
}
.current-time-panel span, .current-time-panel small { display: block; }
.current-time-panel span { font-weight: 900; }
.current-time-panel small { color: #665c7f; font-size: .72rem; }
.exit-time-controls { display: flex; align-items: center; gap: 8px; }
.exit-time-controls input { width: 100%; margin: 0; }
.exit-time-controls button { flex: 0 0 auto; min-height: 48px; padding: 8px 12px; }
.primary, .secondary { border: 0; border-radius: 12px; font-weight: 900; }
.primary {
  width: 100%; min-height: 64px; padding: 15px; margin-top: 26px; color: white;
  background: linear-gradient(135deg, #4a20ad, #7958eb); font-size: 1.15rem;
  box-shadow: 0 10px 24px rgba(83,45,177,.28);
}
.primary:hover { background: linear-gradient(135deg, #3e1899, #6846df); }
.primary:hover, .secondary:hover { transform: translateY(-1px); }
.secondary { padding: 12px 18px; color: #281b55; background: #bfb0ff; font-size: 1rem; }
.text-button { padding: 6px 10px; color: #5632bd; background: none; border: 0; font-size: .98rem; font-weight: 800; text-decoration: underline; text-underline-offset: 4px; }
.section-heading .text-button { min-height: 44px; padding: 7px 12px; background: #f1edff; border: 1px solid #d4c9f1; border-radius: 10px; text-decoration: none; }
.section-heading .text-button:hover { background: #e8e1ff; }
.section-heading .text-button.danger { color: #8b2f3b; background: #fff0f1; border-color: #ebc9cd; }
.danger { color: var(--danger); }
.error { min-height: 1.4em; margin: 14px 0 -8px; color: var(--danger); font-size: 1rem; font-weight: 700; }
.hidden { display: none !important; }

.result { margin-top: 32px; padding: 34px; text-align: center; color: white; background: radial-gradient(circle at 85% 5%, rgba(143,119,255,.7), transparent 44%), linear-gradient(145deg, #291064, #5d33cb); border: 3px solid #8e76ed; border-radius: 18px; box-shadow: 0 14px 32px rgba(74,32,173,.26); }
.result.result-empty { color: #4a3b73; background: linear-gradient(145deg, #f3efff, #e9e4fa); border-color: #d0c4ee; box-shadow: none; }
.result.result-empty strong { color: #68568e; text-shadow: none; font-size: clamp(2rem, 7vw, 3rem); }
.result-guide { margin: -8px auto 0 !important; max-width: 34em; color: #62587b; font-size: .86rem !important; opacity: 1 !important; }
.result p { margin: 0; font-size: 1.08rem; opacity: .9; }
.result strong { display: block; margin: 8px 0 18px; color: #fff; text-shadow: 0 2px 18px rgba(255,255,255,.18); font-size: clamp(3rem, 9vw, 4.7rem); font-weight: 900; line-height: 1.25; }
.result strong small { margin-left: .28em; font-size: .32em; font-weight: 800; vertical-align: .18em; letter-spacing: .04em; }
.result-details { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; font-size: 1rem; font-weight: 700; opacity: .94; }
.muted { margin: -12px 0 24px; color: #625a78; font-size: .98rem; }
.rates-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.rate-summary { padding: 18px; border-left: 5px solid var(--green-2); background: var(--green-soft); border-radius: 6px 12px 12px 6px; }
.rate-summary b, .rate-summary span { display: block; }
.rate-summary b { font-size: 1.08rem; }
.rate-summary span { margin-top: 6px; color: #584e72; font-size: .9rem; line-height: 1.65; }
.rates-form { display: grid; gap: 18px; }
.billing-unit-settings { margin: 0; padding: 16px; border: 2px solid #d9d0f2; border-radius: 13px; }
.billing-unit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.rate-edit-row { display: grid; grid-template-columns: 80px 1fr 1fr; gap: 12px; align-items: end; }
.rate-edit-row > b { padding-bottom: 13px; }
.rates-actions { display: flex; gap: 10px; justify-content: flex-end; }
.rates-actions button { padding: 10px 18px; }
.password-gate { width: min(480px, 100%); margin: 5vh auto 0; padding: 34px; background: #f5f2ff; border: 2px solid #d9d0f2; border-radius: 20px; text-align: center; }
.password-gate h3 { margin: 10px 0 4px; font-size: 1.35rem; }
.password-gate > p { margin: 0 0 22px; color: #625a78; }
.password-gate form { text-align: left; }
.lock-icon { position: relative; display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto; color: #cafff7; background: linear-gradient(145deg, #4d25b0, #7958eb); border-radius: 20px; box-shadow: 0 9px 22px rgba(83,45,177,.22); font-size: 0; }
.lock-icon::after { content: ""; width: 19px; height: 15px; border: 4px solid currentColor; border-top: 0; border-radius: 3px; }
.lock-icon::before { content: ""; position: absolute; width: 14px; height: 13px; margin-top: -18px; border: 4px solid currentColor; border-bottom: 0; border-radius: 10px 10px 0 0; }
.unlock-button { margin-top: 4px; }

.history-list { display: grid; gap: 12px; }
.history-item { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 18px 0; border-bottom: 2px solid #e7e1f4; }
.history-item:last-child { border-bottom: 0; }
.history-item p { margin: 4px 0 0; color: #625a78; font-size: .9rem; }
.history-item strong { font-size: 1.4rem; color: #5831bf; }
.empty { padding: 32px; color: #625a78; background: #f1edfb; border-radius: 12px; text-align: center; font-size: 1rem; }
.history-toolbar { display: grid; grid-template-columns: auto minmax(170px, 1fr) auto auto; gap: 10px; align-items: end; margin-bottom: 12px; }
.history-toolbar button { padding: 8px 14px; color: #4c3593; background: #f1edff; border: 2px solid #d4c9f1; border-radius: 11px; font-weight: 850; }
.history-toolbar .export-button { color: white; background: linear-gradient(135deg, #4a20ad, #7958eb); border-color: #6846d7; }
.history-toolbar button:disabled { color: #8f879e; background: #ece9f0; border-color: #ddd8e3; cursor: not-allowed; box-shadow: none; }
.history-toolbar input { min-height: 52px; }
.history-safety { margin: 0 0 10px; color: #554879; font-size: .82rem; }
.history-safety span { display: inline-grid; place-items: center; width: 22px; height: 22px; color: #2b4560; background: #cafff7; border-radius: 50%; font-weight: 900; }
footer { padding: 8px 24px 42px; color: #625a78; text-align: center; font-size: .9rem; }

button:focus-visible { outline: 4px solid rgba(104,70,232,.32); outline-offset: 3px; }
button:active { transform: translateY(1px); }

@media (max-width: 650px) {
  .hero { align-items: start; flex-direction: column; padding-top: 34px; padding-bottom: 34px; }
  .brand-group { width: 100%; }
  .menu-button { width: 54px; height: 54px; }
  .vehicle-grid, .rates-summary { grid-template-columns: 1fr 1fr; }
  .time-grid { grid-template-columns: 1fr; }
  .rate-edit-row { grid-template-columns: 1fr 1fr; }
  .rate-edit-row > b { grid-column: 1 / -1; padding: 0; }
  .history-toolbar { grid-template-columns: 1fr 1fr; }
  .history-toolbar label { grid-column: 1 / -1; grid-row: 1; }
  .history-toolbar .export-button { grid-column: 1 / -1; }
}

/* Keep the header compact on wide landscape monitors without changing portrait layouts. */
@media (min-width: 1367px) and (orientation: landscape) {
  .hero {
    align-items: center;
    min-height: 86px;
    padding-top: 13px;
    padding-bottom: 13px;
    border-bottom-width: 4px;
  }
  .hero h1 { margin: 0; font-size: 1.8rem; line-height: 1.2; }
  .brand-group > div > p:not(.eyebrow) { display: none; }
  .eyebrow { margin-bottom: 2px !important; font-size: .68rem !important; }
  .hero .theme-toggle { width: 50px; height: 50px; min-height: 50px; }
  .hero .menu-button { width: 50px; height: 50px; min-height: 50px; }
}

/* iPad: primary controls, result, rates and recent history fit in one viewport. */
@media (min-width: 700px) and (max-width: 1366px) {
  :root { font-size: 16px; }
  html, body { height: 100%; overflow: hidden; }
  body { display: grid; grid-template-rows: auto minmax(0, 1fr); }

  .hero {
    align-items: center; min-height: 86px;
    padding: 13px max(18px, calc((100vw - 1240px) / 2));
    border-bottom-width: 4px;
  }
  .hero h1 { margin: 0; font-size: 1.8rem; line-height: 1.2; }
  .brand-group > div > p:not(.eyebrow) { display: none; }
  .eyebrow { margin-bottom: 2px !important; font-size: .68rem !important; }
  .hero .theme-toggle { width: 50px; height: 50px; min-height: 50px; }

  main {
    width: min(100% - 24px, 1240px); height: calc(100dvh - 106px);
    margin: 10px auto; display: block;
  }
  .card { min-height: 0; padding: 16px 18px; border-radius: 16px; box-shadow: 0 8px 26px rgba(72,39,148,.1); }
  .view.active { width: min(100%, 980px); height: 100%; margin: 0 auto; }
  .calculator { display: flex; flex-direction: column; }
  .rates-card, .history-card { display: flex; flex-direction: column; overflow-y: auto; }
  footer { display: none; }

  .section-heading { align-items: center; margin-bottom: 12px; }
  .section-heading h2 { font-size: 1.28rem; }
  .step { font-size: .66rem; }
  .status { padding: 5px 10px; font-size: .72rem; }

  .calculator form { display: flex; flex-direction: column; }
  fieldset { margin-bottom: 14px; }
  legend, label { font-size: .88rem; }
  .vehicle-grid { gap: 8px; margin-top: 7px; }
  .vehicle-option span { min-height: 52px; padding: 8px; border-radius: 10px; font-size: 1rem; }
  .time-grid { gap: 10px; }
  .time-section { margin-bottom: 7px; }
  .quick-times { gap: 5px; margin: 5px 0 6px; }
  .quick-times button { min-height: 42px; padding: 5px 3px; border-radius: 8px; font-size: .78rem; }
  input[type="datetime-local"], input[type="number"] {
    min-height: 48px; margin-top: 4px; padding: 7px 10px; border-radius: 9px; font-size: .92rem;
  }
  .auto-label { margin-left: 3px; padding: 1px 6px; font-size: .62rem; }
  .current-time-panel { margin: 1px 0 3px; padding: 7px 10px; border-radius: 9px; }
  .current-time-panel span { font-size: .78rem; }
  .current-time-panel small { font-size: .58rem; }
  .exit-time-controls button { min-height: 44px; font-size: .76rem; }
  .error { min-height: 1.2em; margin: 5px 0 -4px; font-size: .82rem; }
  .primary { min-height: 52px; margin-top: 10px; padding: 8px; font-size: 1rem; }

  .result { flex: 1; min-height: 0; margin-top: 12px; padding: 15px; display: flex; flex-direction: column; justify-content: center; border-radius: 13px; }
  .result strong { margin: 2px 0 7px; font-size: clamp(2.35rem, 5.4vh, 3.4rem); }
  .result p { font-size: .88rem; }
  .result-details { gap: 3px 15px; font-size: .84rem; }

  .rates-card .section-heading, .history-card .section-heading { margin-bottom: 8px; }
  .muted { margin: -4px 0 8px; font-size: .73rem; line-height: 1.4; }
  .rates-summary { grid-template-columns: 1fr 1fr; gap: 6px; }
  .rate-summary { padding: 8px 9px; border-left-width: 3px; border-radius: 4px 8px 8px 4px; }
  .rate-summary b { font-size: .9rem; }
  .rate-summary span { margin-top: 1px; font-size: .67rem; line-height: 1.35; }
  .text-button { min-height: 40px; padding: 3px 6px; font-size: .78rem; }
  .section-heading .text-button { padding: 4px 8px; }

  .history-list { flex: 1; min-height: 0; overflow: auto; gap: 0; padding-right: 4px; }
  .history-item { gap: 8px; padding: 8px 0; }
  .history-item b { font-size: .8rem; }
  .history-item p { margin-top: 1px; font-size: .66rem; line-height: 1.35; }
  .history-item strong { align-self: center; font-size: 1rem; }
  .history-item:nth-child(n+4) { display: grid; }
  .empty { padding: 16px 8px; font-size: .8rem; }

  /* Rate editing becomes a viewport-contained panel instead of expanding the grid. */
  .rates-card:not(.view):has(.rates-form:not(.hidden)) {
    position: fixed; z-index: 10; inset: 22px; width: min(700px, calc(100% - 44px));
    height: fit-content; max-height: calc(100dvh - 44px); margin: auto; padding: 24px;
    overflow: hidden;
    box-shadow: 0 0 0 100vmax rgba(25,12,57,.62), 0 24px 70px rgba(42,18,94,.38);
  }
  .rates-card:not(.view):has(.rates-form:not(.hidden)) .rates-form { gap: 7px; }
  .rates-card:not(.view):has(.rates-form:not(.hidden)) .rate-edit-row { grid-template-columns: 70px 1fr 1fr; gap: 10px; }
  .rates-card:not(.view):has(.rates-form:not(.hidden)) .rate-edit-row > b { padding-bottom: 10px; }
  .rates-card:not(.view):has(.rates-form:not(.hidden)) input[type="number"] { min-height: 44px; }
  .rates-card:not(.view):has(.rates-form:not(.hidden)) .rates-actions { margin-top: 4px; }
}

@media (min-width: 700px) and (max-width: 820px) {
  main { grid-template-columns: minmax(420px, 1.55fr) minmax(250px, .9fr); }
  .time-grid { grid-template-columns: 1fr; gap: 6px; }
  .calculator .section-heading { margin-bottom: 8px; }
  .calculator fieldset { margin-bottom: 8px; }
  .calculator .result { margin-top: 9px; }
}

@media (min-width: 700px) and (max-width: 1366px) and (max-height: 760px) {
  .hero { min-height: 70px; padding-top: 8px; padding-bottom: 8px; }
  main { height: calc(100dvh - 88px); margin-top: 8px; margin-bottom: 8px; }
  .card { padding-top: 12px; padding-bottom: 12px; }
  .vehicle-option span { min-height: 46px; }
  .result { padding-top: 10px; padding-bottom: 10px; }
}

@media (max-width: 420px) {
  :root { font-size: 17px; }
  main { width: min(100% - 20px, 1040px); margin-top: 18px; }
  .card { padding: 22px 18px; border-radius: 17px; }
  .section-heading { align-items: center; }
  .vehicle-option span { min-height: 68px; }
  .history-item { grid-template-columns: 1fr; }
  .history-item strong { justify-self: end; }
  .current-time-panel { grid-template-columns: 1fr; gap: 8px; }
  .exit-time-controls { align-items: stretch; flex-direction: column; }
  .billing-unit-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* High-contrast dark palette; activated by the header button or system setting. */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f6f2ff;
  --green: #6e47e8;
  --green-2: #baa8ff;
  --green-soft: #2a2146;
  --cream: #100c1d;
  --paper: #191329;
  --line: #50456c;
  --accent: #aa96ff;
  --danger: #ff9a8d;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 8% 5%, rgba(113,74,222,.22), transparent 26rem),
    radial-gradient(circle at 92% 88%, rgba(68,201,191,.08), transparent 22rem),
    linear-gradient(145deg, #140e25 0%, #0e0a18 62%, #18102c 100%);
}
html[data-theme="dark"] .hero {
  background: radial-gradient(circle at 78% -80%, rgba(146,113,255,.6), transparent 45%), linear-gradient(125deg, #160833 0%, #351574 52%, #5934c0 100%);
}
html[data-theme="dark"] .card { background: linear-gradient(145deg, rgba(29,22,47,.98), rgba(23,17,39,.97)); border-color: #473b64; box-shadow: 0 16px 44px rgba(0,0,0,.3); }
html[data-theme="dark"] .status { color: #e1d8ff; background: #3a2b68; }
html[data-theme="dark"] .status.offline { color: #ffe7a8; background: #55471f; }
html[data-theme="dark"] .vehicle-option span { color: #eee9ff; background: #241c38; border-color: #51466c; }
html[data-theme="dark"] .vehicle-option span:hover { border-color: #8f7ac9; background: #30244c; }
html[data-theme="dark"] .vehicle-option input:checked + span { color: white; border-color: #a690ff; background: linear-gradient(145deg, #4a27a7, #704de0); }
html[data-theme="dark"] .quick-times button { color: #ded5f8; background: #241c38; border-color: #51466c; }
html[data-theme="dark"] .quick-times button:hover { background: #30244c; border-color: #8f7ac9; }
html[data-theme="dark"] .quick-times button.selected { color: white; background: linear-gradient(145deg, #4a27a7, #704de0); border-color: #a690ff; }
html[data-theme="dark"] input[type="datetime-local"],
html[data-theme="dark"] input[type="number"] { color: #f8f5ff; background: #100b1c; border-color: #584c74; }
html[data-theme="dark"] input[readonly] { color: #e3dcf8; background: #28213a; border-color: #5e5278; }
html[data-theme="dark"] .auto-label { color: #e5dcff; background: #3b2d66; }
html[data-theme="dark"] .current-time-panel { color: #eee9ff; background: linear-gradient(135deg, #2b2147, #202f39); border-color: #574a75; }
html[data-theme="dark"] .current-time-panel small { color: #c5bcd7; }
html[data-theme="dark"] .billing-unit-settings { border-color: #51446d; }
html[data-theme="dark"] .muted,
html[data-theme="dark"] .history-item p { color: #c3bad7; }
html[data-theme="dark"] .rate-summary { background: #2a2146; }
html[data-theme="dark"] .rate-summary span { color: #cec5e3; }
html[data-theme="dark"] .history-item { border-bottom-color: #403653; }
html[data-theme="dark"] .history-item strong,
html[data-theme="dark"] .text-button { color: #c0afff; }
html[data-theme="dark"] .text-button.danger { color: #ff9a8d; }
html[data-theme="dark"] .section-heading .text-button { background: #2b2147; border-color: #51446d; }
html[data-theme="dark"] .section-heading .text-button.danger { background: #3a202c; border-color: #75404b; }
html[data-theme="dark"] .result.result-empty { color: #ddd4f4; background: linear-gradient(145deg, #29203f, #211a34); border-color: #50436c; }
html[data-theme="dark"] .result.result-empty strong { color: #c5b8e3; }
html[data-theme="dark"] .result-guide { color: #bdb3d0; }
html[data-theme="dark"] .empty { color: #c9c0dc; background: #251d39; }
html[data-theme="dark"] footer { color: #b9afce; }
html[data-theme="dark"] .theme-toggle { color: #22164b; background: #b7a6ff; border-color: #b7a6ff; }
html[data-theme="dark"] .theme-toggle:hover { background: #c9bdff; }
html[data-theme="dark"] .theme-icon { color: #3b247e; text-shadow: none; }
html[data-theme="dark"] .side-menu { color: #f6f2ff; background: linear-gradient(160deg, #201731 0%, #171024 100%); }
html[data-theme="dark"] .menu-heading { border-color: #403453; }
html[data-theme="dark"] .menu-heading button { color: #ddd3f6; background: #2c2141; }
html[data-theme="dark"] .nav-item { color: #ddd4f1; }
html[data-theme="dark"] .nav-item span { color: #c0afff; background: #30234d; }
html[data-theme="dark"] .nav-item:hover { background: #2b2147; }
html[data-theme="dark"] .nav-item.active { color: white; background: linear-gradient(135deg, #4a27a7, #704de0); }
html[data-theme="dark"] .nav-item.active span { color: #3b247e; background: #cafff7; }
html[data-theme="dark"] .install-nav { color: white; background: linear-gradient(135deg, #4a27a7, #704de0); }
html[data-theme="dark"] .password-gate { background: #241c38; border-color: #51446d; }
html[data-theme="dark"] .password-gate > p { color: #c3bad7; }
html[data-theme="dark"] .history-toolbar button { color: #ded5f8; background: #2b2147; border-color: #51446d; }
html[data-theme="dark"] .history-toolbar .export-button { color: white; background: linear-gradient(135deg, #4a27a7, #704de0); border-color: #8569e8; }
html[data-theme="dark"] .history-toolbar button:disabled { color: #777080; background: #211b2b; border-color: #393141; }
html[data-theme="dark"] .history-safety { color: #c3bad7; }

/* Settings is a dedicated screen: favor legibility over the old compact card layout. */
.rates-card.view .section-heading h2 { font-size: 1.75rem; }
.rates-card.view .step { font-size: .9rem; }
.rates-card.view #toggleRates { min-height: 54px; padding: 10px 18px; font-size: 1.05rem; }
.rates-card.view .password-gate { width: min(560px, 100%); padding: 40px; }
.rates-card.view .password-gate h3 { margin-top: 14px; font-size: 1.65rem; }
.rates-card.view .password-gate > p { font-size: 1.05rem; line-height: 1.75; }
.rates-card.view .password-gate label { font-size: 1.08rem; }
.rates-card.view #settingsPassword { min-height: 64px; padding: 14px 16px; font-size: 1.3rem; letter-spacing: .16em; }
.rates-card.view .unlock-button { min-height: 64px; font-size: 1.12rem; }
.rates-card.view #settingsContent .muted { margin-bottom: 26px; font-size: 1.03rem; line-height: 1.7; }
.rates-card.view #settingsContent .rates-summary { gap: 14px; }
.rates-card.view #settingsContent .rate-summary { padding: 18px; border-left-width: 5px; border-radius: 7px 13px 13px 7px; }
.rates-card.view #settingsContent .rate-summary b { font-size: 1.18rem; }
.rates-card.view #settingsContent .rate-summary span { margin-top: 6px; font-size: .98rem; line-height: 1.7; }
.rates-card.view #settingsContent .rates-form { gap: 16px; }
.rates-card.view #settingsContent .rate-edit-row { grid-template-columns: 105px 1fr 1fr; gap: 16px; }
.rates-card.view #settingsContent .rate-edit-row > b { padding-bottom: 15px; font-size: 1.15rem; }
.rates-card.view #settingsContent .rate-edit-row label { font-size: 1rem; }
.rates-card.view #settingsContent input[type="number"] { min-height: 60px; padding: 12px 14px; font-size: 1.18rem; }
.rates-card.view #settingsContent .rates-actions button { min-height: 58px; padding: 11px 22px; font-size: 1.05rem; }

@media (min-width: 700px) and (max-width: 1366px) {
  .rates-card.view .section-heading { margin-bottom: 18px; }
  .rates-card.view .section-heading h2 { font-size: 1.55rem; }
  .rates-card.view .password-gate { margin-top: 3vh; padding: 32px 38px; }
  .rates-card.view #settingsContent .rates-summary { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .rates-card.view #settingsContent .rate-summary { padding: 14px; }
  .rates-card.view #settingsContent .rate-summary b { font-size: 1.15rem; }
  .rates-card.view #settingsContent .rate-summary span { font-size: 1rem; line-height: 1.6; }
  .rates-card.view #settingsContent .rates-form { gap: 10px; }
  .rates-card.view #settingsContent input[type="number"] { min-height: 54px; font-size: 1.08rem; }
}

@media (max-width: 650px) {
  .rates-card.view .password-gate { padding: 28px 20px; }
  .rates-card.view #settingsContent .rates-summary { grid-template-columns: 1fr 1fr; }
  .rates-card.view #settingsContent .rate-edit-row { grid-template-columns: 1fr 1fr; }
  .rates-card.view #settingsContent .rate-edit-row > b { grid-column: 1 / -1; padding: 0; }
}
