/* Kelela Care parent portal — Phase 04c design system (docs/ui/design-system.md).
   Source of truth for the approved mockups in docs/ui/mockups/.
   Plain CSS, mobile first (360 px), system fonts only, no external assets. */
:root {
  color-scheme: light dark;
  --c-bg: #f6f4ef;
  --c-surface: #ffffff;
  --c-surface-2: #efebe2;
  --c-text: #1b2725;
  --c-muted: #525f5c;
  --c-primary: #0f5e5a;
  --c-primary-ink: #ffffff;
  --c-primary-soft: #e1efec;
  --c-accent: #875700;
  --c-accent-fill: #f2b544;
  --c-accent-ink: #2b1d00;
  --c-accent-bg: #fff2d4;
  --c-danger: #b3261e;
  --c-danger-ink: #ffffff;
  --c-danger-bg: #fcebe8;
  --c-ok: #1f6b36;
  --c-ok-bg: #e5f3e8;
  --c-border: #ddd7ca;
  --c-field-border: #7c8784;
  --c-focus: #0b57d0;
  --c-header: #0c4c49;
  --c-header-ink: #ffffff;
  --c-tab-ink: #525f5c;
  --c-tab-active: #0f5e5a;
  --c-shadow: #1b2725;
  --c-switch-on: #2e7d32;
  --c-switch-off: #d32f2f;
  --c-switch-ink: #ffffff;
    --font-ethiopic: "Noto Sans Ethiopic", "Nyala", "Ebrima", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-latin: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Ethiopic", "Nyala", "Ebrima", sans-serif;
  --font: var(--font-latin);
  --fs-0: 0.875rem;
  --fs-1: 1rem;
  --fs-2: 1.1875rem;
  --fs-3: 1.4375rem;
  --fs-4: 1.75rem;
  --lh: 1.6;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 20px;
  --radius-pill: 999px;
  --e-1: 0 1px 2px rgb(27 39 37 / 8%), 0 1px 1px rgb(27 39 37 / 4%);
  --e-2: 0 8px 28px rgb(27 39 37 / 18%);
  --tap: 44px;
  --tabbar-h: 64px;
}

/* Dark: forced by the parent (data-theme="dark"), or automatic when the device is dark.
   A forced light theme wins over a dark device. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg: #0e1615;
    --c-surface: #16211f;
    --c-surface-2: #1e2c2a;
    --c-text: #e7eeec;
    --c-muted: #a5b3b0;
    --c-primary: #62c7bd;
    --c-primary-ink: #05201e;
    --c-primary-soft: #15393a;
    --c-accent: #f2b544;
    --c-accent-fill: #f2b544;
    --c-accent-ink: #2b1d00;
    --c-accent-bg: #3a2b0b;
    --c-danger: #ff8f85;
    --c-danger-ink: #3a0805;
    --c-danger-bg: #3d1613;
    --c-ok: #7fd39f;
    --c-ok-bg: #11301d;
    --c-border: #2b3b38;
    --c-field-border: #71817e;
    --c-focus: #8ab4f8;
    --c-header: #0a2523;
    --c-header-ink: #e7eeec;
    --c-tab-ink: #a5b3b0;
    --c-tab-active: #62c7bd;
    --c-shadow: #000000;
    --c-switch-on: #2e7d32;
    --c-switch-off: #d32f2f;
    --c-switch-ink: #ffffff;
    --e-1: 0 0 0 1px var(--c-border);
    --e-2: 0 8px 28px rgb(0 0 0 / 50%);
  }
}
:root[data-theme="dark"] {
  --c-bg: #0e1615;
  --c-surface: #16211f;
  --c-surface-2: #1e2c2a;
  --c-text: #e7eeec;
  --c-muted: #a5b3b0;
  --c-primary: #62c7bd;
  --c-primary-ink: #05201e;
  --c-primary-soft: #15393a;
  --c-accent: #f2b544;
  --c-accent-fill: #f2b544;
  --c-accent-ink: #2b1d00;
  --c-accent-bg: #3a2b0b;
  --c-danger: #ff8f85;
  --c-danger-ink: #3a0805;
  --c-danger-bg: #3d1613;
  --c-ok: #7fd39f;
  --c-ok-bg: #11301d;
  --c-border: #2b3b38;
  --c-field-border: #71817e;
  --c-focus: #8ab4f8;
  --c-header: #0a2523;
  --c-header-ink: #e7eeec;
  --c-tab-ink: #a5b3b0;
  --c-tab-active: #62c7bd;
  --c-shadow: #000000;
  --c-switch-on: #2e7d32;
  --c-switch-off: #d32f2f;
  --c-switch-ink: #ffffff;
  --e-1: 0 0 0 1px var(--c-border);
  --e-2: 0 8px 28px rgb(0 0 0 / 50%);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 106.25%; } body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font: var(--fs-1)/var(--lh) var(--font);
}
:lang(am) { --lh: 1.7; --font: var(--font-ethiopic); font-family: var(--font); }
h1, h2, h3 { line-height: 1.3; margin: 0 0 var(--sp-3); }
h1 { font-size: var(--fs-4); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-3); }
h3 { font-size: var(--fs-2); }
:lang(am) h1, :lang(am) h2, :lang(am) h3 { letter-spacing: 0; line-height: 1.4; }
p { margin: 0 0 var(--sp-3); }
a { color: var(--c-primary); text-underline-offset: 3px; }
img, svg { max-width: 100%; }
ul { padding: 0; margin: 0; list-style: none; }

:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--sp-4); top: var(--sp-2); background: var(--c-surface); color: var(--c-text); padding: var(--sp-2) var(--sp-3); z-index: 50; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted, .help { color: var(--c-muted); }
.help { font-size: var(--fs-0); }
:lang(am) .help { font-size: 0.9375rem; }
.ic { width: 24px; height: 24px; flex: none; vertical-align: middle; }
.ic-s { width: 18px; height: 18px; }

.topbar { background: var(--c-header); color: var(--c-header-ink); }
.topbar-in { display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-2) var(--sp-4); max-width: 1120px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: var(--sp-2); color: inherit; text-decoration: none; font-weight: 700; font-size: var(--fs-2); min-height: var(--tap); }
.brand .logo { width: 34px; height: 34px; }
.home-name { margin-left: auto; font-size: var(--fs-0); opacity: 0.92; max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Original tibeb-inspired band (design-system.md §6): amber diamonds, white steps. */
.tibeb { height: 10px; background: var(--c-header) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='10'%3E%3Cpath d='M12 1l5 4-5 4-5-4z' fill='%23f2b544'/%3E%3Cpath d='M0 0h3L0 3zM24 0h-3l3 3zM0 10h3L0 7zM24 10h-3l3-3z' fill='%23fff' opacity='.7'/%3E%3Cpath d='M3 5h2M19 5h2' stroke='%23fff' stroke-width='1.4' opacity='.7'/%3E%3C/svg%3E") repeat-x; }

.shell { max-width: 1120px; margin: 0 auto; }
.main { padding: var(--sp-4) var(--sp-4) var(--sp-6); max-width: 760px; }
.has-nav .main { padding-bottom: calc(var(--tabbar-h) + var(--sp-6) + env(safe-area-inset-bottom, 0px)); }
.page-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.page-head h1 { margin: 0; }
.page-head .btn { margin-left: auto; }
.back { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--tap); text-decoration: none; font-weight: 600; }
.grid { display: grid; gap: var(--sp-4); }
.grid > * { min-width: 0; }
.section { margin-top: var(--sp-6); scroll-margin-top: 72px; }
.section > h2 { display: flex; align-items: center; gap: var(--sp-2); }
.section-h-ic { color: var(--c-primary); }

.card { background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--e-1); padding: var(--sp-4); }
.card + .card { margin-top: var(--sp-4); }
.grid > .card + .card { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card-head h2, .card-head h3 { margin: 0; font-size: var(--fs-2); }
.card-head a { color: inherit; text-decoration: none; }
.card-head .chev { margin-left: auto; color: var(--c-muted); }

.avatar { width: 48px; height: 48px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 1.25rem; flex: none; background: var(--c-primary-soft); color: var(--c-primary); }
.avatar.av-2 { background: var(--c-accent-bg); color: var(--c-accent); }
.avatar-l { width: 64px; height: 64px; font-size: 1.6rem; }

.state { display: flex; align-items: flex-start; gap: var(--sp-2); font-weight: 600; margin-bottom: var(--sp-3); }
.state .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-ok); margin-top: 0.6em; flex: none; }
.state.is-paused .dot { background: var(--c-danger); }
.state.is-off .dot { background: var(--c-accent); }
.child-card.is-paused { box-shadow: inset 4px 0 0 var(--c-danger), var(--e-1); }

.child-page .child-card .card-head { display: none; }
.quick { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--c-border); }
.quick a { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--tap); padding: 0 var(--sp-3); border-radius: var(--radius-pill); background: var(--c-surface-2); color: var(--c-text); text-decoration: none; font-size: var(--fs-0); font-weight: 600; }
.quick a .ic { color: var(--c-primary); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: var(--tap); padding: 0 var(--sp-4); border-radius: var(--radius-pill); border: 2px solid transparent; font: inherit; font-weight: 700; line-height: 1.25; text-align: center; text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--c-primary); color: var(--c-primary-ink); }
.btn-accent { background: var(--c-accent-fill); color: var(--c-accent-ink); }
.btn-danger { background: var(--c-danger); color: var(--c-danger-ink); }
.btn-secondary { background: var(--c-surface); color: var(--c-primary); border-color: var(--c-primary); }
.btn-quiet { background: var(--c-surface-2); color: var(--c-text); }
.btn-danger-outline { background: transparent; color: var(--c-danger); border-color: var(--c-danger); }
.btn-big { width: 100%; min-height: 56px; font-size: var(--fs-2); border-radius: var(--radius); }
.btn-label { display: flex; flex-direction: column; align-items: flex-start; text-align: start; }
.btn-sub { font-size: var(--fs-0); font-weight: 600; opacity: 0.9; }
.btn-block { width: 100%; }
.btn-small { min-height: var(--tap); padding: 0 var(--sp-3); font-size: var(--fs-0); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.link-button { background: none; border: 0; padding: 0 var(--sp-1); min-height: var(--tap); font: inherit; color: var(--c-primary); text-decoration: underline; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.chip { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--sp-3); border-radius: var(--radius-pill); border: 1px solid var(--c-field-border); background: var(--c-surface); color: var(--c-text); font: inherit; font-size: var(--fs-0); font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"], .chip:has(input:checked) { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary); }
.chip input { margin: 0 var(--sp-2) 0 0; accent-color: var(--c-primary); width: 18px; height: 18px; }

.status { display: flex; gap: var(--sp-3); align-items: flex-start; border-radius: var(--radius-l); padding: var(--sp-4); background: var(--c-ok-bg); color: var(--c-text); margin-bottom: var(--sp-5); }
.status .status-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--c-surface); color: var(--c-ok); flex: none; }
.status strong { display: block; font-size: var(--fs-3); line-height: 1.3; }
.status p { margin: var(--sp-1) 0 0; }
.status a { font-weight: 700; }
.status-warn { background: var(--c-accent-bg); }
.status-warn .status-ic { color: var(--c-accent); }
.status-error { background: var(--c-danger-bg); }
.status-error .status-ic { color: var(--c-danger); }

.notice { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-s); background: var(--c-primary-soft); color: var(--c-text); margin: 0 0 var(--sp-3); }
.notice .ic { margin-top: 2px; color: var(--c-primary); }
.notice-ok { background: var(--c-ok-bg); }
.notice-ok .ic { color: var(--c-ok); }
.notice-warn { background: var(--c-accent-bg); }
.notice-warn .ic { color: var(--c-accent); }
.notice-error { background: var(--c-danger-bg); }
.notice-error .ic { color: var(--c-danger); }

.todo { display: flex; align-items: center; gap: var(--sp-3); min-height: 64px; padding: var(--sp-3) var(--sp-4); background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--e-1); color: var(--c-text); text-decoration: none; }
.todo + .todo { margin-top: var(--sp-2); }
.todo .todo-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--c-accent-bg); color: var(--c-accent); flex: none; }
.todo strong { display: block; }
.todo .chev { margin-left: auto; color: var(--c-muted); }

.badge { display: inline-flex; align-items: center; gap: var(--sp-1); padding: 2px 10px; border-radius: var(--radius-pill); background: var(--c-surface-2); color: var(--c-text); font-size: var(--fs-0); font-weight: 600; line-height: 1.5; }
.badge-new { background: var(--c-accent-bg); color: var(--c-accent); }
.badge-warn { background: var(--c-accent-bg); color: var(--c-text); }
.badge-ok { background: var(--c-ok-bg); color: var(--c-ok); }
.badge-danger { background: var(--c-danger-bg); color: var(--c-danger); }
.badge-level { background: var(--c-primary-soft); color: var(--c-primary); }

.switcher { position: sticky; top: 0; z-index: 5; display: flex; gap: var(--sp-1); overflow-x: auto; margin: 0 calc(-1 * var(--sp-4)); padding: var(--sp-2) var(--sp-4); background: var(--c-bg); border-bottom: 1px solid var(--c-border); scrollbar-width: none; }
.switcher a { flex: none; display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--sp-3); border-radius: var(--radius-pill); color: var(--c-text); text-decoration: none; font-weight: 600; font-size: var(--fs-0); }
.switcher a[aria-current="true"] { background: var(--c-primary); color: var(--c-primary-ink); }

.rows { background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--e-1); overflow: hidden; }
.row { display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-3) var(--sp-4); color: var(--c-text); text-decoration: none; }
.row + .row { border-top: 1px solid var(--c-border); }
.row .row-main { flex: 1; min-width: 0; }
.row .row-main strong { display: block; overflow-wrap: anywhere; }
.row .chev { color: var(--c-muted); }
.row .ic:first-child { color: var(--c-primary); }
.row form { margin: 0; }
button.row { width: 100%; border: 0; background: none; font: inherit; text-align: start; cursor: pointer; }

.app-group { margin-top: var(--sp-4); }
.app-group > summary { display: flex; align-items: center; gap: var(--sp-2); min-height: var(--tap); cursor: pointer; font-weight: 700; font-size: var(--fs-2); list-style: none; }
.app-group > summary::-webkit-details-marker { display: none; }
.app-group > summary::after { content: ""; width: 10px; height: 10px; border: solid var(--c-muted); border-width: 0 2px 2px 0; transform: rotate(45deg); margin-left: auto; margin-right: var(--sp-2); }
.app-group[open] > summary::after { transform: rotate(-135deg); }
.app-row { background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--e-1); padding: var(--sp-3) var(--sp-4); }
.app-row + .app-row { margin-top: var(--sp-2); }
.app-head { display: flex; align-items: center; gap: var(--sp-3); }
.app-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--c-surface-2); color: var(--c-text); font-weight: 700; flex: none; }
.app-name { font-weight: 700; }
.effective { display: block; font-size: var(--fs-0); color: var(--c-muted); font-weight: 400; }
.effective.is-block { color: var(--c-danger); font-weight: 600; }
.effective.is-allow { color: var(--c-ok); font-weight: 600; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin-top: var(--sp-3); padding: 3px; border-radius: var(--radius-pill); background: var(--c-surface-2); border: 1px solid var(--c-border); }
.seg button, .seg label { display: flex; align-items: center; justify-content: center; gap: var(--sp-1); min-height: var(--tap); padding: 0 var(--sp-2); border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--c-text); font: inherit; font-size: var(--fs-0); font-weight: 600; cursor: pointer; text-align: center; line-height: 1.25; }
.seg [aria-pressed="true"], .seg label:has(input:checked) { background: var(--c-surface); color: var(--c-primary); box-shadow: var(--e-1); }
.seg [aria-pressed="true"][value="block"] { color: var(--c-danger); }
.seg [aria-pressed="true"][value="allow"] { color: var(--c-ok); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.app-times { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--tap); margin-top: var(--sp-1); font-size: var(--fs-0); font-weight: 600; }
.app-row .help { margin: 0; }

.why { margin: var(--sp-2) 0 0; font-size: var(--fs-0); }
.why > summary { display: inline-flex; align-items: center; gap: var(--sp-1); min-height: var(--tap); cursor: pointer; color: var(--c-primary); font-weight: 600; list-style: none; }
.why > summary::-webkit-details-marker { display: none; }
.why > div { padding: var(--sp-3); border-radius: var(--radius-s); background: var(--c-surface-2); color: var(--c-text); }

.field { margin-bottom: var(--sp-4); }
.field > label, .field legend { display: block; font-weight: 700; margin-bottom: var(--sp-1); }
.field fieldset { border: 0; padding: 0; margin: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="time"], input[type="url"], input[type="number"], select, textarea {
  display: block; width: 100%; min-height: 48px; padding: var(--sp-2) var(--sp-3);
  border: 1.5px solid var(--c-field-border); border-radius: var(--radius-s);
  background: var(--c-surface); color: var(--c-text); font: inherit;
}
input[type="time"] { max-width: 11rem; font-size: var(--fs-2); font-variant-numeric: tabular-nums; }
.field .help { margin: 0 0 var(--sp-2); }
.field .error { color: var(--c-danger); font-weight: 600; font-size: var(--fs-0); margin: var(--sp-1) 0 0; display: flex; gap: var(--sp-1); }
.field.has-error input, .field.has-error select { border-color: var(--c-danger); border-width: 2px; }
.eth-hint { display: block; margin-top: var(--sp-1); font-size: var(--fs-0); color: var(--c-accent); font-weight: 600; }
.field fieldset > div { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.field fieldset > div label { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 var(--sp-3); border: 1px solid var(--c-field-border); border-radius: var(--radius-pill); background: var(--c-surface); font-weight: 600; font-size: var(--fs-0); cursor: pointer; }
.field fieldset > div label:has(input:checked) { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary); }
.field input[type="checkbox"], .field input[type="radio"] { width: 18px; height: 18px; accent-color: var(--c-primary); margin: 0; }
.form-errors { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-s); background: var(--c-danger-bg); margin-bottom: var(--sp-4); }

.field > 
.device-head { display: flex; gap: var(--sp-3); align-items: center; }
.device-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--c-surface-2); color: var(--c-primary); flex: none; }
.who { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: var(--sp-2); margin-top: var(--sp-2); }
.who button { display: flex; align-items: center; gap: var(--sp-2); min-height: 52px; padding: var(--sp-1) var(--sp-3); border-radius: var(--radius); border: 1.5px solid var(--c-field-border); background: var(--c-surface); color: var(--c-text); font: inherit; font-weight: 600; cursor: pointer; text-align: start; }
.who button .avatar { width: 32px; height: 32px; font-size: 0.95rem; }
.who button[aria-pressed="true"] { border-color: var(--c-primary); background: var(--c-primary-soft); color: var(--c-primary); }
.tabs { display: flex; gap: var(--sp-1); padding: 3px; border-radius: var(--radius-pill); background: var(--c-surface-2); margin-bottom: var(--sp-4); }
.tabs a { flex: 1; display: flex; justify-content: center; align-items: center; min-height: var(--tap); border-radius: var(--radius-pill); color: var(--c-text); text-decoration: none; font-weight: 600; }
.tabs a[aria-current="page"] { background: var(--c-surface); color: var(--c-primary); box-shadow: var(--e-1); }
dl.meta { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-1) var(--sp-3); margin: 0; font-size: var(--fs-0); }
dl.meta dt { color: var(--c-muted); }
dl.meta dd { margin: 0; overflow-wrap: anywhere; }

.empty { text-align: center; padding: var(--sp-5) var(--sp-4); }
.empty .art { width: 120px; height: 96px; margin: 0 auto var(--sp-3); display: block; }
.empty p { color: var(--c-muted); max-width: 28rem; margin-left: auto; margin-right: auto; }

.tabbar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--c-surface); border-top: 1px solid var(--c-border); box-shadow: 0 -2px 10px rgb(27 39 37 / 6%); }
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--tap); color: var(--c-tab-ink); text-decoration: none; font-size: 0.8125rem; font-weight: 600; line-height: 1.2; }
.tabbar a[aria-current="page"] { color: var(--c-tab-active); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--c-tab-active); }
.tabbar .count { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--c-accent-fill); color: var(--c-accent-ink); font-size: 0.75rem; display: grid; place-items: center; }

.sheet { position: fixed; inset: 0; z-index: 40; display: none; }
.sheet:target, .sheet.is-open { display: block; }
.sheet-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / 45%); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto; background: var(--c-bg); border-radius: var(--radius-l) var(--radius-l) 0 0; padding: var(--sp-3) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom, 0px)); box-shadow: var(--e-2); }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--c-field-border); margin: 0 auto var(--sp-3); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.sheet-head h2 { margin: 0; }
.icon-btn { display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%; color: var(--c-text); background: var(--c-surface-2); border: 0; text-decoration: none; cursor: pointer; }
.sheet .rows + .rows { margin-top: var(--sp-3); }
.lang-switch { display: flex; gap: var(--sp-2); }
.lang-switch button { flex: 1; }
.lang-switch button[aria-current="true"] { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary); }
.confirm-panel { text-align: center; }
.confirm-panel .confirm-ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto var(--sp-3); background: var(--c-danger-bg); color: var(--c-danger); }
.confirm-panel .btn + .btn { margin-top: var(--sp-2); }
dialog.sheet-dialog { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100%; height: 100%; margin: 0; }
dialog.sheet-dialog::backdrop { background: rgb(0 0 0 / 45%); }

.site-footer { padding: var(--sp-5) 0 0; color: var(--c-muted); font-size: var(--fs-0); max-width: 760px; }
.site-footer a { color: var(--c-muted); }

.narrow { max-width: 540px; margin-left: auto; margin-right: auto; }
.step { color: var(--c-muted); font-weight: 600; margin: 0 0 var(--sp-2); }
.progress { display: flex; gap: var(--sp-1); margin-bottom: var(--sp-3); }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--c-surface-2); }
.progress span.done { background: var(--c-primary); }
form.inline { display: inline; }
.inline-form { margin-top: var(--sp-3); }
.plain-list li { padding: var(--sp-2) 0; min-height: var(--tap); }
.plain-list li + li { border-top: 1px solid var(--c-border); }
.steps { padding-left: var(--sp-5); margin: 0 0 var(--sp-4); }
.steps li { margin-bottom: var(--sp-2); }
dl.stacked dt { font-weight: 700; margin-top: var(--sp-3); }
dl.stacked dd { margin: 0; }
.prose { max-width: 680px; }
.prose h2 { margin-top: var(--sp-5); }
.preview { background: var(--c-accent-bg); border-radius: var(--radius-s); padding: var(--sp-3); margin: var(--sp-3) 0; }
.preview .btn { margin: var(--sp-1) var(--sp-1) var(--sp-1) 0; }
.tier-help { background: var(--c-surface-2); border-radius: var(--radius-s); padding: var(--sp-3); margin-bottom: var(--sp-4); font-size: var(--fs-0); }
.tier-help h3 { font-size: var(--fs-1); }
.tier-help dt { font-weight: 700; margin-top: var(--sp-2); }
.tier-help dd { margin: 0; }
.rule-note { display: block; }
.messages { margin-bottom: var(--sp-3); }
.undo { display: inline; margin-left: var(--sp-2); }
.undo button { min-height: 36px; padding: 0 var(--sp-3); border-radius: var(--radius-pill); border: 1.5px solid var(--c-primary); background: var(--c-surface); color: var(--c-primary); font: inherit; font-weight: 700; cursor: pointer; }
.notice > span { flex: 1; }
.row .lang-switch { flex: 1; }
.lang-switch .link-button { flex: 1; padding: 0 var(--sp-3); min-height: var(--tap); border: 1.5px solid var(--c-primary); border-radius: var(--radius-pill); text-decoration: none; font-weight: 700; background: var(--c-surface); }
.lang-switch .link-button[aria-current="true"] { background: var(--c-primary-soft); }
.topbar .lang-switch .link-button { flex: none; border-color: var(--c-header-ink); color: var(--c-header-ink); background: transparent; padding: 0 var(--sp-3); }
.topbar .lang-switch .link-button[aria-current="true"] { display: none; }
.topbar .lang-switch { margin-left: auto; }
.invoice-lines { width: 100%; border-collapse: collapse; margin-top: var(--sp-4); }
.invoice-lines th, .invoice-lines td { text-align: start; padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--c-border); }
.invoice-lines td:last-child, .invoice-lines th:last-child { text-align: end; }
.eth { white-space: nowrap; }

@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  .has-nav .main { padding-bottom: var(--sp-6); }
  .shell.has-nav { display: grid; grid-template-columns: 248px 1fr; gap: var(--sp-5); padding: 0 var(--sp-4); }
  .has-nav .main { padding-top: var(--sp-5); padding-left: 0; padding-right: 0; }
  .shell:not(.has-nav) .main { margin: 0 auto; }
  .sidenav { position: sticky; top: 0; align-self: start; padding-top: var(--sp-5); }
  .tabbar { position: static; display: flex; flex-direction: column; height: auto; padding: 0; background: none; border: 0; box-shadow: none; }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: var(--sp-3); min-height: 48px; padding: 0 var(--sp-3); border-radius: var(--radius-s); font-size: var(--fs-1); }
  .tabbar a[aria-current="page"] { background: var(--c-primary-soft); }
  .tabbar a[aria-current="page"]::before { display: none; }
  .tabbar .count { position: static; margin-left: auto; }
  .tabbar .tab-more { display: none; }
  .sidenav .sheet { position: static; display: block; margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--c-border); }
  .sidenav .sheet-backdrop, .sidenav .sheet-grip, .sidenav .sheet-head { display: none; }
  .sidenav .sheet-panel { position: static; transform: none; width: auto; max-height: none; overflow: visible; padding: 0; background: none; box-shadow: none; border-radius: 0; }
  .sidenav .rows { background: none; box-shadow: none; overflow: visible; }
  .sidenav .rows + .rows { margin-top: var(--sp-2); }
  .sidenav .row { min-height: 44px; padding: 0 var(--sp-3); border: 0; border-radius: var(--radius-s); font-size: var(--fs-0); font-weight: 600; }
  .sidenav .row .chev { display: none; }
  .sidenav .row .ic:first-child { color: var(--c-muted); }
  .sheet-panel { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(480px, 92vw); border-radius: var(--radius-l); }
  .sheet-grip { display: none; }
  .switcher { margin: 0; padding: var(--sp-2) 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .btn, .chip, .seg button { transition: background-color 0.15s, color 0.15s; }
}
@media print {
  .topbar, .tibeb, .sidenav, .tabbar, .sheet, .site-footer, .no-print, .skip, .messages { display: none !important; }
  body { background: #ffffff; color: #000000; padding: 0; }
  .card { box-shadow: none; border: 1px solid #cccccc; }
}

/* Appearance: one "Dark mode" ON/OFF switch (owner request after 06c). Red OFF with the knob
   on the left, green ON with the knob on the right. aria-checked carries the state; the text is
   decoration. Before the parent chooses (theme "auto") the page follows the device, so the
   switch is rendered in both states and CSS shows the one matching the device. */
.row .theme-switches { flex: 1; }
.theme-switches { display: flex; flex-direction: column; gap: var(--sp-3); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.switch-label { flex: 1; min-width: 0; font-weight: 600; }
.switch {
  position: relative; flex: none; display: inline-flex; align-items: center; justify-content: flex-end;
  min-width: 96px; height: 44px; padding: 0 14px 0 48px; border-radius: 999px;
  border: 3px solid var(--c-surface); box-shadow: 0 0 0 1px var(--c-border), inset 0 2px 5px rgb(0 0 0 / 28%);
  background: var(--c-switch-off); color: var(--c-switch-ink);
  font: inherit; font-weight: 800; font-size: var(--fs-1); letter-spacing: .04em; cursor: pointer;
  transition: background-color .25s ease, padding .25s ease;
}
.switch[aria-checked="true"] { background: var(--c-switch-on); justify-content: flex-start; padding: 0 48px 0 14px; }
.switch .switch-on { display: none; }
.switch[aria-checked="true"] .switch-on { display: inline; }
.switch[aria-checked="true"] .switch-off { display: none; }
.switch-knob {
  position: absolute; top: 3px; left: 3px; width: 32px; height: 32px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #e9e9e9 55%, #c9c9c9 100%);
  box-shadow: 0 2px 5px rgb(0 0 0 / 40%), inset 0 -1px 2px rgb(0 0 0 / 15%);
  transition: left .25s cubic-bezier(.3, .7, .3, 1);
}
.switch-knob::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px;
  border-radius: 50%; background: #b5b5b5; box-shadow: inset 0 1px 1px rgb(0 0 0 / 30%);
}
.switch[aria-checked="true"] .switch-knob { left: calc(100% - 35px); }
.switch:hover { filter: brightness(1.06); }
.switch:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 3px; }
.switch.device-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .switch.device-light { display: none; }
  .switch.device-dark { display: inline-flex; }
}
@media (prefers-reduced-motion: reduce) { .switch, .switch-knob { transition: none; } }
/* Phase 04d: Activity section (ADR-030). Charts are server-rendered SVG. */
.act-range { margin: 0 0 var(--sp-3); }
.act-total { display: flex; flex-direction: column; margin: 0 0 var(--sp-2); }
.act-total strong { font-size: var(--fs-3); }
.act-chart, .act-hours { display: block; width: 100%; height: auto; }
.act-chart { max-width: 520px; } .act-hours { max-width: 480px; }
.act-bar { fill: var(--c-primary); }
.act-axis { stroke: var(--c-border); }
.act-label { fill: var(--c-muted); font-size: 10px; }
.act-h0 { fill: var(--c-surface-2); } .act-h1, .act-h2, .act-h3, .act-h4 { fill: var(--c-primary); }
.act-h1 { opacity: .3; } .act-h2 { opacity: .5; } .act-h3 { opacity: .75; }
.act-h { display: flex; gap: var(--sp-2); align-items: baseline; margin: var(--sp-5) 0 var(--sp-2); font-size: var(--fs-1); }
.act-list { list-style: none; margin: 0; padding: 0; } .act-list .row { flex-wrap: wrap; }
.act-list form { margin-inline-start: auto; }
.act-blocked { margin: 0; padding-inline-start: var(--sp-5); }
.act-line { margin: var(--sp-2) 0 0; font-size: var(--fs-0); }
