/* ==========================================================================
   Pitlane — design system (v2: warm minimal)
   Flat, warm off-white, thin borders, one blue accent. Colour is used only
   for meaning: green = fine, amber = due soon, red = overdue.
   Written with logical properties (start/end) so Arabic (RTL) and English
   (LTR) share every rule. Hover effects only where a mouse can hover.
   ========================================================================== */

@font-face { font-family: "Plex Arabic"; font-style: normal; font-display: swap; font-weight: 400; src: url(fonts/plex-arabic-arabic-400.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-display: swap; font-weight: 400; src: url(fonts/plex-arabic-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-display: swap; font-weight: 500; src: url(fonts/plex-arabic-arabic-500.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-display: swap; font-weight: 500; src: url(fonts/plex-arabic-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-display: swap; font-weight: 600; src: url(fonts/plex-arabic-arabic-600.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-display: swap; font-weight: 600; src: url(fonts/plex-arabic-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-display: swap; font-weight: 700; src: url(fonts/plex-arabic-arabic-700.woff2) format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "Plex Arabic"; font-style: normal; font-display: swap; font-weight: 700; src: url(fonts/plex-arabic-latin-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Tokens ---------- */

:root {
  --font: "Plex Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;

  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f2f1ed;
  --surface-3: #e9e7e2;
  --line: #e7e5e0;
  --line-2: #d6d3cc;
  --text: #1c1c1a;
  --text-2: #55534e;
  --text-3: #6c6961;
  --ink: #1c1c1a;
  --on-ink: #ffffff;
  --accent: #2457d6;
  --accent-soft: #e8eefc;
  --ok: #2e7a4d;
  --ok-soft: #e7f1ea;
  --soon: #9a5d00;
  --soon-soft: #faf0da;
  --over: #c0352e;
  --over-soft: #fbeae9;
  --wa: #128c4a;
  --scrim: rgba(28, 28, 26, 0.32);
  --shadow: 0 1px 2px rgba(28, 28, 26, 0.04);
  --shadow-pop: 0 12px 32px rgba(28, 28, 26, 0.14), 0 2px 6px rgba(28, 28, 26, 0.06);

  --r-card: 16px;
  --r-ctl: 12px;
  --r-sm: 9px;
  --tabbar-h: 64px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  /* Writing direction helpers: --dir flips horizontal motion, --start is the reading-start edge. */
  --dir: 1;
  --start: left;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121211;
  --surface: #1b1b19;
  --surface-2: #242421;
  --surface-3: #2f2f2c;
  --line: #2c2c29;
  --line-2: #3d3d39;
  --text: #edebe6;
  --text-2: #b8b5ad;
  --text-3: #8f8c84;
  --ink: #edebe6;
  --on-ink: #121211;
  --accent: #86a6ff;
  --accent-soft: rgba(134, 166, 255, 0.14);
  --ok: #63c18c;
  --ok-soft: rgba(99, 193, 140, 0.14);
  --soon: #e6a740;
  --soon-soft: rgba(230, 167, 64, 0.15);
  --over: #f2776f;
  --over-soft: rgba(242, 119, 111, 0.15);
  --wa: #25a35e;
  --scrim: rgba(0, 0, 0, 0.55);
  --shadow: none;
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #121211;
    --surface: #1b1b19;
    --surface-2: #242421;
    --surface-3: #2f2f2c;
    --line: #2c2c29;
    --line-2: #3d3d39;
    --text: #edebe6;
    --text-2: #b8b5ad;
    --text-3: #8f8c84;
    --ink: #edebe6;
    --on-ink: #121211;
    --accent: #86a6ff;
    --accent-soft: rgba(134, 166, 255, 0.14);
    --ok: #63c18c;
    --ok-soft: rgba(99, 193, 140, 0.14);
    --soon: #e6a740;
    --soon-soft: rgba(230, 167, 64, 0.15);
    --over: #f2776f;
    --over-soft: rgba(242, 119, 111, 0.15);
    --wa: #25a35e;
    --scrim: rgba(0, 0, 0, 0.55);
    --shadow: none;
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
[dir="rtl"] { --dir: -1; --start: right; }

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
html.locked { overflow: hidden; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
[lang="ar"] body { line-height: 1.7; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button, a, [role="button"], label.chip-toggle, label.swatch, label.icon-opt, label.radio-card, .switch {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p, dl, dd { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
/* The hidden attribute always hides, whatever display a class sets. */
[hidden] { display: none !important; }

.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .ic.flip { transform: scaleX(-1); }
.mono { font-variant-numeric: tabular-nums; }
/* Numbers, plates and usernames read left-to-right inside Arabic text. */
.mono, .odo-value, .tile-value, .log-cost, .cc-odo { unicode-bidi: isolate; }
.muted { color: var(--text-3); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; display: inline-block; }

/* Arabic letters join; any letter-spacing breaks the joins. */
[lang="ar"] body, [lang="ar"] body * { letter-spacing: 0 !important; }

/* ---------- App shell and navigation ---------- */

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 40px);
  outline: none;
}
body[data-auth="out"] .app { padding-bottom: 40px; }
body[data-auth="out"] .island { display: none; }

/* Phones: a native tab bar at the bottom and a round "log service" button above it. */
.island {
  position: fixed;
  z-index: 30;
  inset-inline: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  align-items: stretch;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid var(--line);
}
.island .brand { display: none; }
.nav-links { flex: 1; display: flex; }
.nav-link {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 500;
  transition: color 0.15s ease;
}
.nav-link .ic { width: 24px; height: 24px; stroke-width: 1.7; }
.nav-link[aria-current="page"] { color: var(--text); }
.nav-link[aria-current="page"] .ic { stroke-width: 2.1; }
.nav-link:active .ic { transform: scale(0.9); transition: transform 0.1s var(--ease-out); }
.nav-badge {
  position: absolute;
  top: 7px;
  inset-inline-start: calc(50% + 6px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--over);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  line-height: 1;
}
.nav-cta {
  position: fixed;
  z-index: 31;
  inset-inline-end: 16px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px);
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--on-ink);
  box-shadow: var(--shadow-pop);
  transition: transform 0.16s var(--ease-out);
}
.nav-cta:active { transform: scale(0.94); }
.nav-cta-label { display: none; }
.nav-cta-ic { display: grid; place-items: center; }
.nav-cta .ic { width: 26px; height: 26px; stroke-width: 2; }

/* Wide screens: a quiet top bar instead. */
@media (min-width: 900px) {
  .app { padding: 32px 32px 80px; }
  .island {
    position: sticky;
    top: 0;
    bottom: auto;
    height: 64px;
    padding: 0 max(32px, calc((100vw - 1080px) / 2 + 32px));
    border-top: 0;
    border-bottom: 1px solid var(--line);
    align-items: center;
    gap: 24px;
  }
  .island .brand { display: flex; }
  .nav-links { flex: 1; gap: 4px; }
  .nav-link { flex: none; flex-direction: row; gap: 8px; height: 40px; padding: 0 14px; border-radius: 10px; font-size: 15px; color: var(--text-2); }
  .nav-link .ic { width: 20px; height: 20px; }
  .nav-link[aria-current="page"] { background: var(--surface-2); color: var(--text); }
  .nav-badge { position: static; margin-inline-start: 2px; }
  .nav-cta { position: static; width: auto; height: 40px; padding: 0 16px; gap: 8px; border-radius: 10px; display: inline-flex; align-items: center; box-shadow: none; font-weight: 500; font-size: 15px; }
  .nav-cta-label { display: inline; }
  .nav-cta .ic { width: 18px; height: 18px; }
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; flex: none; background: url(icons/icon.svg) center / cover no-repeat; }
.brand-word { direction: ltr; }

/* ---------- Typography ---------- */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 24px; }
.stack { display: grid; gap: 6px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13.5px; font-weight: 500; }
.eyebrow .dot { width: 6px; height: 6px; background: var(--ok); }
.display { font-size: clamp(2rem, 6vw, 3.25rem); line-height: 1.1; font-weight: 600; letter-spacing: -0.03em; text-wrap: balance; }
.display em { font-style: normal; color: var(--text-3); }
.h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); line-height: 1.2; font-weight: 600; letter-spacing: -0.025em; text-wrap: balance; }
.h2 { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
[lang="ar"] .display { line-height: 1.35; }
[lang="ar"] .h1 { line-height: 1.4; }
.lede { color: var(--text-2); font-size: 16px; max-width: 60ch; }
.hint { font-size: 13.5px; color: var(--text-3); line-height: 1.5; }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12.5px; font-weight: 600; }

/* ---------- Surfaces ---------- */

.bz { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); }
.bz > .core { padding: 18px; }
.bz.flush > .core { padding: 0; }
.bz.tight > .core { padding: 14px 16px; }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 12px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px;
  border-radius: var(--r-ctl);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: transform 0.16s var(--ease-out), background-color 0.15s ease, color 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary .btn-ic { display: grid; place-items: center; }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line-2); }
.btn-soft { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--over-soft); color: var(--over); }
.btn-whatsapp { background: var(--wa); color: #fff; }
.btn-sm { height: 40px; padding: 0 13px; font-size: 14px; gap: 6px; border-radius: 10px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ib {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-grid;
  place-items: center;
  color: var(--text-2);
  transition: background-color 0.15s ease, transform 0.16s var(--ease-out);
}
.ib:active { transform: scale(0.92); background: var(--surface-2); }
.ib .ic { width: 19px; height: 19px; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 14.5px; font-weight: 500; min-height: 40px; }
.link-btn .ic { width: 16px; height: 16px; }
.link-btn.back { color: var(--text-2); margin-bottom: 8px; }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
  .btn-ghost:hover, .btn-soft:hover { background: var(--surface-3); }
  .btn-danger:hover { background: color-mix(in srgb, var(--over) 18%, transparent); }
  .btn-whatsapp:hover { background: color-mix(in srgb, var(--wa) 88%, #000); }
  .ib:hover { background: var(--surface-2); color: var(--text); }
  .link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
  .nav-link:hover { color: var(--text); }
  .car-card:hover { border-color: var(--line-2); }
}

/* ---------- Chips, pills, tags ---------- */

.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap; }
.chip .ic { width: 14px; height: 14px; }
.chip-issue { background: var(--over-soft); color: var(--over); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-3); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill-state { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-state.s-overdue { background: var(--over-soft); color: var(--over); }
.pill-state.s-soon { background: var(--soon-soft); color: var(--soon); }
.pill-state.s-ok { background: var(--ok-soft); color: var(--ok); }
.dot.s-overdue, .s-overdue > .dot, .cc-item.s-overdue .dot, .part-group-head.s-overdue .dot { background: var(--over); }
.s-soon > .dot, .cc-item.s-soon .dot, .part-group-head.s-soon .dot { background: var(--soon); }
.s-ok > .dot, .cc-item.s-ok .dot, .part-group-head.s-ok .dot { background: var(--ok); }
.tile-value.s-overdue { color: var(--over); }
.tile-value.s-soon { color: var(--soon); }
.s-soon-text { color: var(--soon); }

/* ---------- Health ring ---------- */

.ring { display: block; flex: none; }
.ring-track { fill: none; stroke: var(--surface-3); }
.ring-val { fill: none; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transform-box: fill-box; animation: ringIn 0.9s var(--ease-out) both; }
[dir="rtl"] .ring-val { transform: rotate(-90deg) scaleY(-1); }
.ring-score { font-family: var(--font); font-weight: 600; fill: var(--text); }
.ring-cap { font-size: 10px; fill: var(--text-3); font-family: var(--font); font-weight: 500; }
@keyframes ringIn { from { stroke-dashoffset: var(--c); } }
.g-ok, .g-good { stroke: var(--ok); }
.g-soon { stroke: var(--soon); }
.g-over { stroke: var(--over); }

/* ---------- Progress bars ---------- */

.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--ok); transform-origin: var(--start); transform: scaleX(var(--p, 0)); animation: barIn 0.8s var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 10) * 30ms); }
.s-soon .bar > i { background: var(--soon); }
.s-overdue .bar > i { background: var(--over); }
@keyframes barIn { from { transform: scaleX(0); } }

/* ---------- Garage ---------- */

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats > :last-child { grid-column: 1 / -1; }
@media (min-width: 760px) { .stats { grid-template-columns: 1fr 1fr 2fr; } .stats > :last-child { grid-column: auto; } }
.tile-label { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13.5px; font-weight: 500; }
.tile-label .ic { width: 16px; height: 16px; }
.tile-value { font-size: 1.75rem; font-weight: 600; line-height: 1.2; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile-value small { font-size: 0.5em; color: var(--text-3); font-weight: 500; margin-inline-start: 4px; }
.tile-foot { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.stat-next { display: grid; gap: 12px; height: 100%; align-content: space-between; }
.stat-next-name { font-weight: 600; font-size: 1.05rem; margin-top: 6px; }
.stat-next-sub { color: var(--text-2); font-size: 14px; }

.cars { display: grid; gap: 12px; }
@media (min-width: 700px) { .cars { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .cars { grid-template-columns: repeat(3, 1fr); } }
.car-card { cursor: pointer; transition: border-color 0.15s ease, transform 0.16s var(--ease-out); position: relative; overflow: hidden; }
.car-card:active { transform: scale(0.99); }
.car-card > .core { display: grid; gap: 14px; height: 100%; }
.cc-glow, .car-hero-glow { display: none; }
.cc-head { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-swatch { width: 8px; height: 8px; border-radius: 50%; background: var(--car, var(--text-3)); }
.cc-body { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cc-name { font-size: 1.2rem; font-weight: 600; line-height: 1.3; }
.cc-sub { color: var(--text-3); font-size: 14px; margin-top: 2px; }
.cc-odo { color: var(--text-2); }
.cc-list { display: grid; gap: 8px; }
.cc-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cc-item-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-item-meta { color: var(--text-3); font-size: 13px; white-space: nowrap; }
.cc-item.s-overdue .cc-item-meta { color: var(--over); }
.cc-item.s-soon .cc-item-meta { color: var(--soon); }
.cc-allgood { display: flex; align-items: center; gap: 8px; color: var(--ok); font-size: 14px; font-weight: 500; }
.cc-allgood .ic { width: 18px; height: 18px; }
.cc-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; }
.add-car {
  min-height: 160px;
  border-radius: var(--r-card);
  border: 1.5px dashed var(--line-2);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
  color: var(--text-2);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.add-car:active { background: var(--surface-2); }
.add-car-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin: 0 auto 10px; background: var(--surface-2); color: var(--text); }

/* Rows (attention lists, alerts, admin) */
.rows > * + * { border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; }
.row-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.row-ic .ic { width: 20px; height: 20px; }
.row.s-overdue .row-ic { background: var(--over-soft); color: var(--over); }
.row.s-soon .row-ic { background: var(--soon-soft); color: var(--soon); }
.row-main { min-width: 0; }
.row-title { font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.row-sub { color: var(--text-3); font-size: 13.5px; margin-top: 2px; }
.row-sub b { font-weight: 500; color: var(--text-2); }
.row.s-overdue .row-sub b { color: var(--over); }
.row.s-soon .row-sub b { color: var(--soon); }
.row-act { display: flex; align-items: center; gap: 4px; }
@media (max-width: 520px) {
  .row { padding: 12px 14px; gap: 10px; }
  .row-act .lbl { display: none; }
  .row-act .btn-sm:has(.lbl) { width: 44px; padding: 0; }
}

.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 36px 20px; color: var(--text-2); }
.empty > .ic { width: 32px; height: 32px; color: var(--text-3); margin-bottom: 4px; }
.empty h3 { font-size: 1.05rem; font-weight: 600; color: var(--text); }
.empty p { font-size: 14.5px; max-width: 42ch; }

.notice { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 14px 16px; border-radius: var(--r-card); background: var(--accent-soft); }
.notice > .ic { color: var(--accent); width: 22px; height: 22px; }
.notice > div { flex: 1; min-width: 200px; }
.notice b { font-weight: 600; }
.notice p { color: var(--text-2); font-size: 14px; }
.notice.warn { background: var(--soon-soft); }
.notice.warn > .ic { color: var(--soon); }
.offline-note { margin-bottom: 16px; }

.footer { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; color: var(--text-3); font-size: 13px; }

/* ---------- Welcome (no cars yet) ---------- */

.hero { display: grid; gap: 32px; align-items: center; padding: 12px 0 8px; }
@media (min-width: 900px) { .hero { grid-template-columns: 1.1fr 1fr; gap: 48px; } }
.hero-copy { display: grid; gap: 18px; justify-items: start; }
.hero-note { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 14px; }
.hero-note .ic { width: 16px; height: 16px; }
.preview { display: grid; gap: 12px; }
.preview-car { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.preview-parts { display: grid; gap: 12px; margin-top: 18px; }
.pv-row { display: grid; gap: 6px; font-size: 14px; }
.pv-row-top { display: flex; justify-content: space-between; gap: 12px; }
.pv-row-top span:last-child { color: var(--text-3); font-size: 13px; }
.pv-row.s-overdue .pv-row-top span:last-child { color: var(--over); }
.pv-row.s-soon .pv-row-top span:last-child { color: var(--soon); }
.feature-grid { display: grid; gap: 12px; margin-top: 40px; }
@media (min-width: 700px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
.feature .core { display: grid; gap: 8px; }
.feature h3, .tool h3 { font-size: 1.02rem; font-weight: 600; }
.feature p, .tool p { color: var(--text-2); font-size: 14.5px; }
.feature-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--text); }

/* ---------- Car page ---------- */

.car-hero > .core { padding: 20px; }
.car-hero-grid { display: grid; gap: 16px 20px; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.car-hero .h1 { font-size: clamp(1.6rem, 5vw, 2.25rem); }
.car-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.odo-block { margin-top: 18px; }
.odo-label { color: var(--text-3); font-size: 13.5px; font-weight: 500; }
.odo-value { font-size: clamp(2rem, 7vw, 2.6rem); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.odo-value small { font-size: 0.42em; color: var(--text-3); margin-inline-start: 6px; font-weight: 500; }
.odo-when { color: var(--text-3); font-size: 13.5px; margin-top: 2px; }
.specs { display: flex; flex-wrap: wrap; gap: 8px; grid-column: 1 / -1; }
.specs > div { display: grid; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); }
.specs dt { color: var(--text-3); font-size: 12px; }
.specs dd { font-weight: 500; font-size: 14px; }
.car-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; grid-column: 1 / -1; }
.car-actions .btn { min-width: 0; padding: 0 12px; }
.hero-ring-wrap { display: grid; justify-items: center; gap: 6px; }
.hero-ring-wrap .ring { width: 96px; height: 96px; }
.hero-ring-label { font-size: 13.5px; color: var(--text-2); font-weight: 500; }
@media (min-width: 700px) {
  .car-hero > .core { padding: 28px; }
  .hero-ring-wrap .ring { width: 140px; height: 140px; }
  .car-actions { display: flex; }
  .car-actions .btn { padding: 0 18px; }
}
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.mini-stats .core { padding: 14px; }
.mini-stats .tile-value { font-size: 1.35rem; }

.tabs-bar { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 8px); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 24px 0 14px; }
@media (min-width: 900px) { .tabs-bar { top: 72px; } }
.tabs-bar .seg { background: color-mix(in srgb, var(--surface-2) 92%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
@media (max-width: 560px) { .tabs-bar .seg { width: 100%; } .tabs-bar .seg button { flex: 1; padding: 0 6px; } }
.tab-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-inline-start: 5px; border-radius: 999px; background: var(--over); color: #fff; font-size: 11px; font-weight: 600; line-height: 1; }

.part-group + .part-group { margin-top: 24px; }
.part-group-head { display: flex; align-items: center; gap: 8px; margin: 0 2px 10px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.parts { display: grid; gap: 8px; }
.part { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); }
.part-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.part.s-overdue .part-ic { background: var(--over-soft); color: var(--over); }
.part.s-soon .part-ic { background: var(--soon-soft); color: var(--soon); }
.part.s-ok .part-ic { background: var(--ok-soft); color: var(--ok); }
.part.s-off { opacity: 0.6; }
.part-main { min-width: 0; display: grid; gap: 7px; }
.part-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.part-name { font-weight: 500; }
.part-meta { font-size: 13.5px; color: var(--text-3); line-height: 1.5; }
.part-meta b { font-weight: 500; color: var(--text-2); }
.part.s-overdue .part-meta b { color: var(--over); }
.part.s-soon .part-meta b { color: var(--soon); }
.part-act { display: flex; align-items: center; gap: 2px; }
@media (max-width: 560px) {
  .part { grid-template-columns: 1fr auto; padding: 12px 12px 12px 14px; }
  .part-ic { display: none; }
  .part-act { flex-direction: column; }
  .part-act .lbl { display: none; }
  .part-act .btn-sm { width: 44px; padding: 0; }
}

/* History */
.timeline { display: grid; gap: 8px; }
.log { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; padding: 14px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); }
.log-date { display: grid; align-content: start; text-align: center; color: var(--text-3); font-size: 12.5px; line-height: 1.3; }
.log-date b { color: var(--text); font-weight: 600; font-size: 14px; }
.log-main { min-width: 0; display: grid; gap: 8px; align-content: start; }
.log-parts { display: flex; flex-wrap: wrap; gap: 6px; }
.log-info { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-3); font-size: 13.5px; }
.log-info > span { display: inline-flex; align-items: center; gap: 5px; }
.log-info .ic { width: 15px; height: 15px; }
.log-notes { color: var(--text-2); font-size: 14px; white-space: pre-line; }
.log-fixed { display: flex; gap: 6px; align-items: flex-start; font-size: 13.5px; color: var(--ok); }
.log-fixed .ic { width: 16px; height: 16px; flex: none; margin-top: 3px; }
.log-side { display: grid; justify-items: end; align-content: space-between; gap: 8px; }
.log-cost { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-side > div { display: flex; }
@media (max-width: 520px) {
  .log { grid-template-columns: 44px 1fr; }
  .log-side { grid-column: 1 / -1; grid-auto-flow: column; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 8px; }
}

/* Costs */
.cost-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cost-grid .span-8, .cost-grid .span-4 { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .cost-grid { grid-template-columns: repeat(12, 1fr); }
  .cost-grid .span-3 { grid-column: span 3; }
  .cost-grid .span-8 { grid-column: span 8; }
  .cost-grid .span-4 { grid-column: span 4; }
}
.chart { width: 100%; height: auto; margin-top: 14px; overflow: visible; }
.chart .gl { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .ax { fill: var(--text-3); font-size: 12px; font-family: var(--font); }
.bar-r { fill: var(--ink); transform-box: fill-box; transform-origin: bottom; animation: growY 0.7s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 25ms); }
.bar-r.zero { fill: var(--surface-3); }
@keyframes growY { from { transform: scaleY(0); } }
.cats { display: grid; gap: 12px; margin-top: 14px; }
.cat-row { display: grid; gap: 6px; font-size: 14px; }
.cat-top { display: flex; justify-content: space-between; gap: 12px; }
.cat-top span:last-child { color: var(--text-2); font-variant-numeric: tabular-nums; }
.cat-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.cat-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: var(--start); transform: scaleX(var(--p)); animation: barIn 0.8s var(--ease-out) both; animation-delay: calc(var(--i) * 40ms); }

.danger-zone { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }

/* ---------- Issues ---------- */

.issues-intro { display: grid; gap: 12px; margin: 0 2px 14px; }
.issues-intro .hint { max-width: 60ch; font-size: 14px; }
.issues { display: grid; gap: 8px; }
.issue { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; padding: 14px; padding-inline-start: 16px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--soon); }
.issue.is-urgent { border-inline-start-color: var(--over); }
.issue.is-fixed { border-inline-start-color: var(--ok); }
.issue.is-fixed .issue-title { color: var(--text-2); }
.issue-title { font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.issue-title .ic { width: 18px; height: 18px; color: var(--ok); }
.issue-note { color: var(--text-2); font-size: 14px; margin-top: 4px; white-space: pre-line; }
.issue-meta { color: var(--text-3); font-size: 13px; margin-top: 8px; }
.issue-act { display: flex; align-items: center; gap: 2px; }
@media (max-width: 560px) { .issue-act .lbl { display: none; } .issue-act .btn-sm { width: 44px; padding: 0; } }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-chip { display: grid; place-items: center; gap: 2px; color: var(--text-2); font-size: 11px; font-weight: 600; }
.file-chip .ic { width: 22px; height: 22px; }

/* ---------- Alerts ---------- */

.alert-tools { display: grid; gap: 10px; }
@media (min-width: 900px) { .alert-tools { grid-template-columns: repeat(3, 1fr); } }
.tool .core { display: grid; gap: 10px; align-content: start; height: 100%; }
.tool .btn { justify-self: start; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.status-line .dot.s-ok { background: var(--ok); }

/* ---------- Settings ---------- */

.settings { display: grid; gap: 14px; max-width: 760px; }
.set-title { color: var(--text-3); font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.set-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.set-row > div { flex: 1; min-width: 200px; }
.set-row h4 { font-weight: 500; font-size: 15.5px; }
.set-row p { color: var(--text-3); font-size: 13.5px; margin-top: 2px; }
.set-row > .ic { color: var(--text-3); }
.set-user { font-size: 15px; color: var(--text-2) !important; }

.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); gap: 2px; max-width: 100%; }
.seg button { height: 38px; padding: 0 14px; border-radius: 9px; font-size: 14.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; transition: background-color 0.15s ease, color 0.15s ease; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--line); }
.seg-sm button { height: 32px; padding: 0 12px; font-size: 13.5px; }

/* ---------- Forms ---------- */

.form { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; }
.field > span, .field-label { font-size: 14px; font-weight: 500; color: var(--text); }
.field > span em, .field-label em { font-style: normal; color: var(--text-3); font-weight: 400; font-size: 13px; }
.grid-2 { display: grid; gap: 12px; }
@media (min-width: 520px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-2.keep { grid-template-columns: 1fr 1fr; }
.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: 16px; /* 16px keeps iOS from zooming into the field */
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.textarea { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2375726a' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-inline-end: 40px;
}
[dir="rtl"] .select { background-position: left 12px center; }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; inset-inline-end: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 14px; pointer-events: none; }
.input-wrap .input { padding-inline-end: 56px; }
.input-wrap .suffix-btn { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); height: 36px; padding: 0 12px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--text-2); background: var(--surface-2); }
.input-wrap:has(.suffix-btn) .input { padding-inline-end: 84px; }
.input.big { min-height: 72px; font-size: 2rem; font-weight: 600; text-align: center; padding: 0 64px; font-variant-numeric: tabular-nums; }
.field-error { color: var(--over); font-size: 14px; font-weight: 500; }

.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle { position: relative; cursor: pointer; }
.chip-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.chip-toggle span { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: 14.5px; transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; }
.chip-toggle span .dot { width: 7px; height: 7px; }
.chip-toggle span.s-overdue .dot { background: var(--over); }
.chip-toggle span.s-soon .dot { background: var(--soon); }
.chip-toggle input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip-toggle input:checked + span .dot { background: var(--on-ink); }
.chip-toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.parts-pick { display: grid; gap: 14px; max-height: 300px; overflow-y: auto; padding: 2px; margin: -2px; overscroll-behavior: contain; }
.parts-pick-group h5 { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: var(--text-3); }

.radio-cards { display: grid; gap: 8px; }
.radio-card { position: relative; cursor: pointer; }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card > span { display: grid; gap: 2px; padding: 14px 16px; padding-inline-start: 46px; border-radius: var(--r-ctl); border: 1px solid var(--line-2); background: var(--surface); position: relative; }
.radio-card > span::before { content: ""; position: absolute; inset-inline-start: 16px; top: 17px; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-2); transition: box-shadow 0.15s ease; }
.radio-card b { font-weight: 500; }
.radio-card small { color: var(--text-3); font-size: 13.5px; }
.radio-card input:checked + span { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.radio-card input:checked + span::before { box-shadow: inset 0 0 0 5.5px var(--ink); }
.radio-card input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); transition: box-shadow 0.15s ease, transform 0.16s var(--ease-out); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 4px; }

.switch { position: relative; display: inline-flex; cursor: pointer; flex: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { width: 50px; height: 30px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background-color 0.2s ease; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.25s var(--ease-out); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(calc(20px * var(--dir))); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; }
.icon-opt { position: relative; }
.icon-opt input { position: absolute; opacity: 0; pointer-events: none; }
.icon-opt span { display: grid; place-items: center; height: 46px; border-radius: 11px; background: var(--surface-2); color: var(--text-2); cursor: pointer; transition: box-shadow 0.15s ease, color 0.15s ease; }
.icon-opt input:checked + span { box-shadow: 0 0 0 2px var(--ink); color: var(--text); background: var(--surface); }
.icon-opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-ic { color: var(--cat); background: color-mix(in srgb, var(--cat) 12%, transparent); }

.photo-field { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-item, .pf-add { position: relative; width: 80px; height: 80px; border-radius: 12px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; }
.pf-item img { width: 100%; height: 100%; object-fit: cover; }
.pf-item.removed { opacity: 0.35; }
.pf-item.removed img { filter: grayscale(1); }
.pf-x { position: absolute; top: 4px; inset-inline-end: 4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.6); color: #fff; }
.pf-x .ic { width: 14px; height: 14px; }
.pf-add { cursor: pointer; color: var(--text-2); font-size: 13px; gap: 2px; align-content: center; background: transparent; border: 1.5px dashed var(--line-2); }
.pf-add .ic { width: 22px; height: 22px; }

/* ---------- Sheets: bottom sheet on phones, dialog on wide screens ---------- */

.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity 0.3s ease; }
.sheet {
  position: relative;
  width: 100%;
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 24px);
  display: flex;
  flex-direction: column;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-drawer);
  overflow: hidden;
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-wrap.closing .sheet { transition-duration: 0.25s; }
.sheet-grab { width: 40px; height: 5px; border-radius: 999px; background: var(--line-2); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 12px 4px 20px; padding-inline: 20px 12px; }
.sheet-head h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.35; }
.sheet-head p { color: var(--text-3); font-size: 14px; margin-top: 2px; }
.sheet-body { padding: 14px 20px 0; overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.sheet-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  padding: 14px 0 calc(16px + env(safe-area-inset-bottom, 0px));
  margin-top: 6px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.sheet-foot .btn { flex: 1; }
.sheet-foot .btn-primary { flex: 2; }
.sheet-note { font-size: 15px; color: var(--text-2); line-height: 1.6; }
.viewer { display: grid; place-items: center; background: var(--surface-2); border-radius: 12px; overflow: hidden; }
.viewer img { max-width: 100%; max-height: 65dvh; object-fit: contain; }
@media (min-width: 640px) {
  .sheet-wrap { align-items: center; padding: 24px; }
  .sheet { width: min(560px, 100%); border-radius: 20px; transform: translateY(16px) scale(0.98); opacity: 0; transition: transform 0.3s var(--ease-out), opacity 0.2s ease; }
  .sheet-wrap.open .sheet { opacity: 1; }
  .sheet.sm { width: min(440px, 100%); }
  .sheet.photo { width: min(820px, 100%); }
  .sheet-grab { display: none; }
  .sheet-head { padding-top: 20px; padding-inline: 24px 14px; }
  .sheet-body { padding-inline: 24px; }
  .sheet-foot { padding-bottom: 20px; }
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  z-index: 70;
  inset-inline: 16px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 84px);
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
}
body[data-auth="out"] .toasts { bottom: calc(env(safe-area-inset-bottom, 0px) + 20px); }
@media (min-width: 900px) { .toasts { bottom: 28px; } }
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(460px, 100%);
  min-height: 50px;
  padding: 8px 8px 8px 16px;
  padding-inline: 16px 8px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 14.5px;
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  animation: toastIn 0.3s var(--ease-out) both;
}
.toast.out { animation: toastOut 0.2s ease both; }
.toast .ic { width: 18px; height: 18px; opacity: 0.85; }
.toast span { flex: 1; }
.toast button { height: 36px; padding: 0 12px; border-radius: 10px; background: color-mix(in srgb, var(--on-ink) 14%, transparent); font-size: 14px; font-weight: 600; }
.toast:not(:has(button)) { padding-inline-end: 16px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Entrance ---------- */

.rise { animation: rise 0.4s var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 10) * 35ms); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.loading { min-height: 50vh; display: grid; place-items: center; color: var(--text-3); }

/* ---------- Account screens ---------- */

.auth { max-width: 420px; margin: 0 auto; padding-top: 12px; display: grid; gap: 20px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-card > .core { padding: 24px 20px; display: grid; gap: 18px; }
.auth-card .h1 { font-size: 1.75rem; }
.auth-card .lede { margin-top: -10px; font-size: 15px; }
.auth-switch { color: var(--text-2); font-size: 14.5px; display: flex; justify-content: center; align-items: center; gap: 4px; flex-wrap: wrap; }
.auth-note { display: flex; gap: 8px; align-items: flex-start; }
.auth-note .ic { width: 16px; height: 16px; flex: none; margin-top: 3px; }

/* ---------- Admin ---------- */

.admin-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .admin-stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .admin-stats { grid-template-columns: repeat(5, 1fr); } }
.admin-search { margin-bottom: 10px; }
.avatar { font-weight: 600; color: var(--accent); background: var(--accent-soft); }
.row.is-disabled .row-main { opacity: 0.55; }
.viewas { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; padding: 12px 14px; border-radius: var(--r-card); background: var(--accent-soft); font-size: 14.5px; }
.viewas > .ic { color: var(--accent); }
.viewas > span { flex: 1; min-width: 180px; }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}

/* The tab bar's + button (phones) and the top bar (desktop) already log a service. */
.page-head .btn-primary[data-act="log"] { display: none; }
