:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --card-2: #f0f2f5;
  --ink: #14171c;
  --ink-2: #4a5160;
  --ink-3: #7c8495;
  --line: #e2e5ea;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --good: #11875a;
  --good-bg: #e3f5ec;
  --bad: #c9372c;
  --bad-bg: #fbe7e5;
  --warn: #b5650d;
  --warn-bg: #fdf0dc;
  --fuel: #b5650d;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 18px;
  --tabs-h: 64px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Arabic", "Noto Sans", Tahoma, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1013;
    --card: #181b20;
    --card-2: #20242b;
    --ink: #eef0f3;
    --ink-2: #b4bac5;
    --ink-3: #7d8594;
    --line: #2a2f37;
    --accent: #4b8ef5;
    --good: #3ccf8e;
    --good-bg: #12301f;
    --bad: #ff6b5e;
    --bad-bg: #3a1714;
    --warn: #f0a443;
    --warn-bg: #3a2810;
    --fuel: #f0a443;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1013;
  --card: #181b20;
  --card-2: #20242b;
  --ink: #eef0f3;
  --ink-2: #b4bac5;
  --ink-3: #7d8594;
  --line: #2a2f37;
  --accent: #4b8ef5;
  --good: #3ccf8e;
  --good-bg: #12301f;
  --bad: #ff6b5e;
  --bad-bg: #3a1714;
  --warn: #f0a443;
  --warn-bg: #3a2810;
  --fuel: #f0a443;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  min-height: 100vh;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px);
  overscroll-behavior-y: contain;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

/* ---------- Top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; min-width: 0; }
.brand svg { flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.pill-btn {
  min-width: 40px; height: 36px; padding: 0 12px; border-radius: 999px;
  background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--line);
  font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.sync-dot.ok { background: var(--good); }
.sync-dot.busy { background: var(--warn); }
.sync-dot.err { background: var(--bad); }

main { max-width: 560px; margin: 0 auto; padding: 4px 16px 16px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line); padding: 16px; margin-bottom: 12px;
}
.card h3 { margin: 0 0 10px; font-size: 15px; color: var(--ink-2); font-weight: 650; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.muted { color: var(--ink-3); font-size: 13px; }
.small { font-size: 13px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }

/* ---------- Date nav ---------- */
.datenav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 12px; }
.datenav .label { text-align: center; flex: 1; }
.datenav .label b { display: block; font-size: 18px; }
.datenav .label small { color: var(--ink-3); font-size: 13px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow); display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn:disabled { opacity: .35; }
[dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------- Hero ---------- */
.hero { padding: 18px 16px 16px; }
.hero .k { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.hero .big { font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; margin: 4px 0 2px; }
.hero .big small { font-size: 16px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; margin-inline-start: 6px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat { background: var(--card-2); border-radius: 12px; padding: 10px; min-width: 0; }
.stat .v { font-weight: 750; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .l { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

.bar { height: 8px; border-radius: 99px; background: var(--card-2); overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar.good > i { background: var(--good); }
.bar.warn > i { background: var(--warn); }
.bar.bad > i { background: var(--bad); }

/* ---------- Quick add ---------- */
.quick { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.qbtn {
  height: 76px; border-radius: 18px; font-weight: 750; font-size: 15px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow);
  transition: transform .08s ease;
}
.qbtn:active { transform: scale(.97); }
.qbtn.earn { background: var(--good); color: #fff; border-color: transparent; font-size: 17px; }
.qbtn svg { width: 24px; height: 24px; }

/* ---------- Odometer ---------- */
.odo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 4px; font-weight: 600; }
.input, .select, textarea.input {
  width: 100%; height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card-2);
  padding: 0 12px; font-size: 17px; outline: none;
}
textarea.input { height: 72px; padding: 10px 12px; resize: vertical; font-size: 16px; }
.input:focus, .select:focus { border-color: var(--accent); background: var(--card); }
.input.num { text-align: start; }
[dir="rtl"] .input.num { text-align: right; }
.suggest { margin-top: 6px; font-size: 13px; color: var(--accent); font-weight: 600; }
.km-out { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Breakdown ---------- */
.lines { display: flex; flex-direction: column; }
.line { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1px dashed var(--line); gap: 12px; }
.line:last-child { border-bottom: 0; }
.line .lab { color: var(--ink-2); }
.line .lab small { display: block; color: var(--ink-3); font-size: 12px; }
.line.total { font-weight: 800; font-size: 18px; border-top: 2px solid var(--ink); border-bottom: 0; margin-top: 4px; padding-top: 10px; }
.line.total .lab { color: var(--ink); }

/* ---------- Entries ---------- */
.entry { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: start; }
.entry:last-child { border-bottom: 0; }
.entry .ico { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.entry .ico svg { width: 20px; height: 20px; }
.ico.earn { background: var(--good-bg); color: var(--good); }
.ico.fuel { background: var(--warn-bg); color: var(--fuel); }
.ico.exp { background: var(--bad-bg); color: var(--bad); }
.ico.maint { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.entry .t { font-weight: 650; }
.entry .s { font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .amt { font-weight: 750; white-space: nowrap; }
.empty { text-align: center; color: var(--ink-3); padding: 18px 8px; font-size: 14px; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; margin-bottom: 12px; font-size: 14px; width: 100%; text-align: start; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.info { background: var(--card-2); color: var(--ink-2); }
.alert b { display: block; }
.alert svg { flex: none; margin-top: 2px; }

/* ---------- Segmented ---------- */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card-2); border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 12px; border: 1px solid var(--line); }
.seg button { height: 38px; border-radius: 10px; font-weight: 650; color: var(--ink-2); font-size: 14px; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 16px; padding: 12px 14px; min-width: 0; }
.kpi .v { font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .l { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.kpi.wide { grid-column: span 2; }

/* ---------- Chart ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 170px; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--ink-3); stroke-width: 1; }
.chart .axis { fill: var(--ink-3); font-size: 10px; }
.chart .be { stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .b { fill: var(--good); }
.chart .b.n { fill: var(--bad); }
.chart .b.acc { fill: var(--accent); }
.chart.has-sel .b:not(.sel) { opacity: .45; }
.chart .ln { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: var(--accent); opacity: .12; }
.chart .mk { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .mk-t { fill: var(--warn); font-weight: 700; }
.chart .dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.tip { position: absolute; top: -6px; transform: translate(-50%, -100%); background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 10px; font-size: 12.5px; white-space: nowrap; pointer-events: none; z-index: 2; }
.tip b { font-size: 14px; }

/* ---------- Day list ---------- */
.dayrow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 0; border-bottom: 1px solid var(--line); text-align: start; }
.dayrow:last-child { border-bottom: 0; }
.dayrow .d { width: 46px; text-align: center; flex: none; }
.dayrow .d b { display: block; font-size: 20px; line-height: 1; }
.dayrow .d small { font-size: 11px; color: var(--ink-3); text-transform: uppercase; }

/* ---------- Maintenance ---------- */
.mitem { padding: 12px 0; border-bottom: 1px solid var(--line); }
.mitem:last-child { border-bottom: 0; }
.mitem .row b { font-size: 16px; }
.btn {
  height: 48px; border-radius: 14px; padding: 0 18px; font-weight: 700; font-size: 16px;
  background: var(--card-2); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.sm { height: 36px; font-size: 14px; padding: 0 12px; border-radius: 10px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.good { background: var(--good); color: #fff; border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Settings ---------- */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .lab { flex: 1; min-width: 0; }
.set-row .lab small { display: block; color: var(--ink-3); font-size: 12.5px; }
.set-row .input { width: 120px; height: 42px; font-size: 16px; flex: none; }
.set-row .select { width: auto; height: 42px; font-size: 16px; flex: none; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 24px; height: 24px; top: 3px; inset-inline-start: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(20px); }
[dir="rtl"] .switch input:checked + span::after { transform: translateX(-20px); }
.mi-edit { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.mi-edit .input { height: 42px; font-size: 16px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 17px; letter-spacing: 1px; background: var(--card-2); padding: 10px 12px; border-radius: 10px; word-break: break-all; direction: ltr; text-align: center; }

/* ---------- Tabs ---------- */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: 11.5px; font-weight: 650; position: relative; }
.tabs button svg { width: 24px; height: 24px; }
.tabs button.on { color: var(--accent); }
.tabs .dot { position: absolute; top: 9px; inset-inline-end: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--card); }

/* ---------- Sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; opacity: 0; transition: opacity .2s; }
.scrim.show { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 560px; margin: 0 auto;
  background: var(--card); border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  max-height: 92vh; overflow-y: auto;
  transform: translateY(100%); transition: transform .24s cubic-bezier(.2,.8,.2,1);
}
.sheet.show { transform: none; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 10px; }
.sheet h2 { margin: 0 0 12px; font-size: 20px; display: flex; align-items: center; justify-content: space-between; }
.amount-wrap { position: relative; margin-bottom: 12px; }
.amount {
  width: 100%; height: 72px; border-radius: 16px; border: 2px solid var(--line); background: var(--card-2);
  font-size: 38px; font-weight: 800; padding: 0 70px 0 16px; outline: none; direction: ltr; text-align: left;
}
.amount:focus { border-color: var(--accent); background: var(--card); }
.amount-wrap .cur { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card-2); font-weight: 650; font-size: 14.5px; }
.chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--card)); color: var(--accent); }
.form-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; margin-bottom: 12px; }
.form-grid .full { grid-column: span 2; }
.stepper { display: flex; align-items: center; gap: 0; height: 48px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card-2); overflow: hidden; }
.stepper button { width: 48px; height: 100%; font-size: 22px; font-weight: 700; color: var(--accent); }
.stepper input { flex: 1; min-width: 0; border: 0; background: none; text-align: center; font-size: 17px; font-weight: 700; outline: none; height: 100%; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 12px; gap: 12px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 4px; }
.sheet-actions .btn { flex: 1; height: 54px; font-size: 17px; }
.hint { font-size: 12.5px; color: var(--ink-3); margin: -4px 0 12px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 14px);
  transform: translate(-50%, 20px); opacity: 0; z-index: 60;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 650; font-size: 14px;
  transition: all .2s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast button { color: var(--accent); font-weight: 800; margin-inline-start: 10px; pointer-events: auto; }

.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mt { margin-top: 12px; }
.center { text-align: center; }
a { color: var(--accent); }

/* ---------- Sliders ---------- */
.slider-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.slider-row .row b { font-size: 16px; }
input[type=range] { width: 100%; height: 32px; margin: 4px 0 0; background: transparent; -webkit-appearance: none; appearance: none; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 9px; background: var(--card-2); border: 1px solid var(--line); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 9px; background: var(--card-2); border: 1px solid var(--line); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); margin-top: -11px; border: 3px solid var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid var(--card); }
[dir="rtl"] input[type=range] { direction: rtl; }
.datenav .label { background: none; color: inherit; }
.form-grid > *, .odo-grid > *, .mi-edit > * { min-width: 0; }
input[type=date].input { min-width: 0; -webkit-appearance: none; appearance: none; font-size: 16px; display: flex; align-items: center; }

/* ---------- Date overlay (native picker on tap, works on iPhone) ---------- */
.datenav .label { position: relative; }
.date-overlay { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; margin: 0; -webkit-appearance: none; appearance: none; }
.date-overlay::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.banner { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; box-shadow: var(--shadow); }
.banner .x { margin-inline-start: auto; color: var(--ink-3); font-size: 20px; width: 32px; height: 32px; flex: none; }

/* ---------- Desktop layout ---------- */
@media (hover: hover) {
  .qbtn:hover, .btn:hover, .icon-btn:hover:not(:disabled), .chip:hover { filter: brightness(1.06); }
  .entry:hover, .dayrow:hover { background: var(--card-2); border-radius: 10px; }
}
@media (min-width: 900px) {
  :root { --side: 232px; }
  body { padding-bottom: 32px; }
  .top { padding: 14px 28px; border-bottom: 1px solid var(--line); }
  .brand { font-size: 19px; }
  main {
    max-width: none; margin: 0; margin-inline-start: var(--side);
    padding: 20px max(28px, calc((100vw - var(--side) - 1120px) / 2)) 32px;
    columns: 2; column-gap: 20px;
  }
  main > * { break-inside: avoid; -webkit-column-break-inside: avoid; }
  main > .datenav, main > .seg, main > .alert, main > .banner, main > .span { column-span: all; -webkit-column-span: all; }
  main > .datenav { max-width: 520px; margin-inline: auto; margin-bottom: 18px; }
  main > .seg { max-width: 520px; margin-inline: auto; margin-bottom: 18px; }
  main > .btn.block { display: none; }
  .hero .big { font-size: 52px; }
  .tabs {
    top: 63px; bottom: 0; left: 0; right: auto; width: var(--side); height: auto;
    display: flex; flex-direction: column; gap: 4px; padding: 18px 14px;
    border-top: 0; border-inline-end: 1px solid var(--line); background: var(--bg);
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  [dir="rtl"] .tabs { left: auto; right: 0; }
  .tabs button { flex-direction: row; justify-content: flex-start; gap: 12px; height: 48px; padding: 0 14px; border-radius: 12px; font-size: 15px; }
  .tabs button svg { width: 22px; height: 22px; }
  .tabs button:hover { background: var(--card-2); color: var(--ink); }
  .tabs button.on { background: color-mix(in srgb, var(--accent) 14%, transparent); }
  .tabs .dot { top: 50%; transform: translateY(-50%); inset-inline-end: 14px; }
  .toast { bottom: 28px; left: calc(50% + var(--side) / 2); }
  [dir="rtl"] .toast { left: calc(50% - var(--side) / 2); }
  .scrim { backdrop-filter: blur(2px); }
  .sheet {
    top: 50%; bottom: auto; left: 50%; right: auto; margin: 0; width: 520px; max-width: calc(100vw - 48px);
    border-radius: 24px; max-height: 88vh; padding: 22px 24px 22px;
    transform: translate(-50%, -46%); opacity: 0; transition: transform .2s ease, opacity .2s ease;
  }
  .sheet.show { transform: translate(-50%, -50%); opacity: 1; }
  .sheet .grab { display: none; }
}
@media (min-width: 1500px) {
  main { columns: 3; }
}
