/* Shared by the launcher, Car and Budget. Each app sets its own --sign colour. */
:root {
  --ground: #D9DDDF;
  --surface: #F7F8F6;
  --ink: #14181B;
  --muted: #59636B;
  --line: #C3C9CD;
  --sign: #0B5D3B;
  --sign-ink: #F7F8F6;
  --accent-text: var(--sign);
  --amber: #F2A900;
  --amber-text: #8A5A00;
  --alert: #C8312B;
  --focus: #0B57D0;
  --drum: #101416;
  --drum-ink: #F7F8F6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #151A1D;
    --surface: #20272B;
    --ink: #EDF0EE;
    --muted: #9BA5AC;
    --line: #364046;
    --sign: #0F6F48;
    --accent-text: #7fd3a8;
    --amber-text: #F2B93B;
    --alert: #FF6F63;
    --focus: #8AB4F8;
    --drum: #0A0D0E;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 17px/1.45 'Barlow', system-ui, sans-serif;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ----- header: overhead guide sign ----- */
.sign {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--sign);
  color: var(--sign-ink);
}
.sign::after {                       /* the white inset border every highway sign has */
  content: ''; position: absolute; inset: calc(4px + env(safe-area-inset-top)) 5px 4px;
  border: 2px solid color-mix(in srgb, var(--sign-ink) 85%, transparent);
  border-radius: 10px; pointer-events: none;
}
.sign :focus-visible { outline-color: var(--sign-ink); }
.name {
  flex: 1; min-width: 0; text-align: left;
  background: none; border: 0; padding: 6px 8px; color: inherit;
}
.car-name {
  display: block; font: 700 32px/1.05 'Barlow Condensed', sans-serif;
  letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.car-sub { display: block; font-size: 15px; opacity: .85; }
.pill {
  position: relative; z-index: 1;
  background: none; border: 2px solid color-mix(in srgb, var(--sign-ink) 70%, transparent);
  color: var(--sign-ink); border-radius: 999px; padding: 4px 14px; margin-right: 6px;
  font-weight: 600;
}

main { max-width: 600px; margin: 0 auto; padding: 16px 14px calc(120px + env(safe-area-inset-bottom)); }

/* ----- sections ----- */
h2 { margin: 26px 2px 8px; font: 700 24px/1.1 'Barlow Condensed', sans-serif; letter-spacing: .01em; }
.panel { background: var(--surface); border-radius: 14px; padding: 4px 16px; }
.empty { margin: 4px 2px; color: var(--muted); }

/* ----- reminders as gauges ----- */
.gauge { padding: 14px 0; }
.gauge + .gauge { border-top: 1px solid var(--line); }
.g-top { display: flex; align-items: center; gap: 10px; }
.ico { display: inline-flex; flex: none; width: 26px; height: 26px; }
.ico svg { width: 100%; height: 100%; }
.gauge .ico { color: var(--sign); width: 30px; height: 30px; }   /* the icon doubles as the dashboard warning lamp */
.gauge.soon .ico { color: var(--amber-text); }
.gauge.overdue .ico { color: var(--alert); }
.g-task { flex: 1; min-width: 0; font-weight: 600; font-size: 19px; }
.track { position: relative; height: 10px; border-radius: 3px; background: var(--line); margin: 9px 0 6px; overflow: hidden; }
.fill { height: 100%; background: var(--sign); border-radius: 3px; }
.soon .fill { background: var(--amber); }
.overdue .fill { background: var(--alert); }
.track::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 2px), var(--surface) calc(25% - 2px) 25%);
}
.g-text { margin: 0; color: var(--muted); }
.soon .g-text { color: var(--amber-text); font-weight: 600; }
.overdue .g-text { color: var(--alert); font-weight: 600; }
.x {
  background: none; border: 0; color: var(--muted); font-size: 18px;
  min-width: 40px; height: 40px; margin: -8px -10px -8px 0; border-radius: 50%;
}

/* ----- bottom action bar ----- */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  display: flex; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--ground) 92%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.bar button { height: 56px; border-radius: 12px; font: 700 21px/1 'Barlow Condensed', sans-serif; letter-spacing: .02em; white-space: nowrap; }
.go { flex: 1.25; background: var(--amber); color: #14181B; border: 0; box-shadow: inset 0 0 0 3px #14181B; }
.alt-go { flex: 1; background: none; border: 2px solid var(--ink); }
@media (min-width: 640px) { .bar { justify-content: center; } .bar button { max-width: 280px; } }

/* ----- dialogs ----- */
dialog { width: min(92vw, 420px); border: 0; border-radius: 16px; padding: 18px; background: var(--surface); color: var(--ink); }
dialog::backdrop { background: #0009; }
dialog h3 { margin: 0 0 6px; font: 700 26px/1.1 'Barlow Condensed', sans-serif; }
dialog p { margin: 8px 0; }
label { display: block; margin: 12px 0 3px; font-size: 15px; font-weight: 600; }
input, textarea {
  width: 100%; font: inherit; padding: 11px 12px; border-radius: 8px;
  border: 2px solid var(--line); background: var(--ground); color: var(--ink);
}
input:focus, textarea:focus { border-color: var(--sign); outline: none; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.btns { display: flex; gap: 8px; }.btns .btn { flex: 1; }
.btn { padding: 10px 18px; border-radius: 10px; border: 2px solid var(--sign); background: var(--sign); color: var(--sign-ink); font-weight: 600; }
.btn.alt { background: none; color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--alert); border-color: var(--alert); color: #fff; }
.overdue.form-error, .form-error { color: var(--alert); font-weight: 600; margin: 10px 0 0; }
.muted { color: var(--muted); font-size: 15px; }


/* ----- type picker ----- */
dialog { max-height: 90dvh; overflow-y: auto; }
.types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 10px 0 4px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px 6px;
  background: var(--ground); border: 2px solid transparent; border-radius: 10px;
  font-size: 12.5px; line-height: 1.15; text-align: center; min-height: 64px;
}
.tile .ico { width: 26px; height: 26px; }
.tile.on { border-color: var(--sign); background: color-mix(in srgb, var(--sign) 14%, var(--surface)); font-weight: 600; }
.t-type .ico { width: 18px; height: 18px; vertical-align: -3px; margin-right: 6px; color: var(--muted); }

/* ----- in-page add buttons (backup for the bottom bar) ----- */
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 26px; }
.sec-head h2 { margin: 0 2px 8px; }
.chip {
  margin-bottom: 6px; padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 16px;
  background: none; border: 2px solid var(--accent-text); color: var(--accent-text);
}

.grow { flex: 1; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 14px 0 12px; border-bottom: 1px solid var(--line); }
.stat-n { font: 700 28px/1.05 'Barlow Condensed', sans-serif; white-space: nowrap; }
.stat-l { font-size: 14px; color: var(--muted); line-height: 1.2; margin-top: 2px; }
.hint { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.more { display: block; width: 100%; background: none; border: 0; border-top: 1px solid var(--line); padding: 12px 0; font-weight: 600; color: var(--accent-text); }
label.check { display: flex; align-items: center; gap: 12px; margin: 16px 0 0; font-size: 17px; color: var(--ink); }
label.check input { width: 24px; height: 24px; accent-color: var(--sign); }

dialog h4 { margin: 20px 0 0; font: 700 20px/1.1 'Barlow Condensed', sans-serif; }

/* ----- loading / sign-in / offline screens ----- */
.gated .bar, .gated .pill { display: none; }
.gate { padding: 28px 4px; max-width: 420px; }
.gate h2 { margin: 0 0 8px; font-size: 30px; }
.gate input { margin: 14px 0 0; }
.gate .actions { justify-content: flex-start; }
.gate .btn { margin-top: 14px; }
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 20;
  max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 12px;
  background: var(--ink); color: var(--surface); font-weight: 600; text-align: center;
}
