/* Family Docs – the app's own screens. Colours come from the shared Gins tokens (core/gins-core.css);
 * the slate accent #475569 is used only on the icon tile and avatar. */
:root {
  --fd-accent: #475569;
  --ok-bg: #E3ECE7; --ok-fg: #0B6B4E; --warn-bg: #FDF1DC; --warn-fg: #8A4B00; --ren-bg: #FDE7DA; --ren-fg: #9A3412;
  --n-bg: #EAEFEC; --n-fg: #45544E; --info-bg: #E4EDF8; --info-fg: #1E4E8C; --sos: #B42318;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --ok-bg: #17302A; --ok-fg: #7FD8B2; --warn-bg: #3A2A0E; --warn-fg: #F7C97A; --ren-bg: #3B2015; --ren-fg: #F9B98F;
  --n-bg: #1C2B25; --n-fg: #B4C6BE; --info-bg: #17263A; --info-fg: #A9C7F0; color-scheme: dark } }
:root[data-theme="dark"] {
  --ok-bg: #17302A; --ok-fg: #7FD8B2; --warn-bg: #3A2A0E; --warn-fg: #F7C97A; --ren-bg: #3B2015; --ren-fg: #F9B98F;
  --n-bg: #1C2B25; --n-fg: #B4C6BE; --info-bg: #17263A; --info-fg: #A9C7F0; color-scheme: dark }

* { box-sizing: border-box }
html, body { margin: 0 }
body { background: var(--g-bg); color: var(--g-fg); font: 400 15px/1.45 var(--g-font); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden }
button, input, select { font: inherit; color: inherit }
a { color: var(--g-brand) }
h1, h2 { margin: 0; line-height: 1.2 }
.muted { color: var(--g-muted) }
.small { font-size: 12.5px }
.empty { color: var(--g-muted); text-align: center; padding: 18px 8px; margin: 0 }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none }
:focus-visible { outline: 3px solid var(--g-brand); outline-offset: 2px }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--g-soft); border-top-color: var(--g-brand); animation: g-spin .8s linear infinite; display: inline-block; flex: none }

/* ---------- lock-screen Emergency button (shown only while the lock pad is on screen) */
.sos-float { display: none; position: fixed; z-index: 900; top: calc(var(--safe-t) + 14px); right: 14px; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border: 0; border-radius: 99px; background: var(--sos); color: #fff; font: 800 14px var(--g-font); cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.25) }
body:has(#g-lockpad) .sos-float { display: inline-flex }
.emer-over { position: fixed; inset: 0; z-index: 1200; overflow-y: auto; background: var(--g-bg); padding: calc(var(--safe-t) + 16px) 16px calc(var(--safe-b) + 24px) }

/* ---------- shell */
.shell { min-height: 100vh; min-height: 100dvh; display: flex }
.side { display: none }
.main { flex: 1; min-width: 0; padding: calc(14px + var(--safe-t)) 16px calc(92px + var(--safe-b)) }
.pane { display: none }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--g-card);
  border-top: 1px solid var(--g-line); padding: 6px 4px calc(8px + var(--safe-b)) }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; justify-content: center; font-size: 11px; font-weight: 700; color: var(--g-muted); text-decoration: none }
.tabbar a svg.i { width: 22px; height: 22px }
.tabbar a[aria-current="page"] { color: var(--g-brand) }
.side a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; color: var(--g-fg); text-decoration: none; font-weight: 700; font-size: 14.5px }
.side a[aria-current="page"] { background: var(--g-soft); color: var(--g-brand) }
.side a.nav-sos:not([aria-current]) { color: var(--g-bad) }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px }
.side .brand .bt { display: flex; flex-direction: column } .side .brand small { color: var(--g-muted); font-size: 12px }
.tile { width: 36px; height: 36px; border-radius: 11px; background: var(--fd-accent); color: #fff; display: grid; place-items: center; flex: none }
@media (min-width: 768px) {
  .tabbar { display: none }
  .side { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; width: 88px; flex: none; background: var(--g-card); border-right: 1px solid var(--g-line); padding: 16px 8px; overflow-y: auto; align-items: center }
  .side .brand { padding: 0 0 12px } .side .brand .bt { display: none }
  .side a { flex-direction: column; justify-content: center; gap: 4px; width: 72px; min-height: 60px; padding: 0; font-size: 10.5px; text-align: center }
  .main { padding: 22px 28px 32px }
  .avatar-btn { display: none !important }
  .pane.show { display: block; width: 380px; flex: none; border-left: 1px solid var(--g-line); background: var(--g-bg); height: 100vh; position: sticky; top: 0; overflow-y: auto; padding: 22px 22px 32px }
}
@media (min-width: 1100px) {
  .side { width: 248px; padding: 18px 12px; align-items: stretch }
  .side .brand { padding: 4px 10px 16px } .side .brand .bt { display: flex }
  .side a { flex-direction: row; justify-content: flex-start; width: auto; min-height: 44px; padding: 0 12px; font-size: 14.5px; gap: 12px; text-align: left }
  .pane.show { width: 420px }
}
.page { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px }
.page-head { display: flex; align-items: center; gap: 10px }
.ph-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 }
.ph-t h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em }
@media (min-width: 768px) { .ph-t h1 { font-size: 28px } }
.ph-t .sub { font-size: 12.5px; color: var(--g-muted); font-weight: 600 }
.sos-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 99px; background: var(--sos); color: #fff; font-weight: 800; font-size: 13px; text-decoration: none; flex: none }
.sos-btn svg.i { width: 16px; height: 16px }
.avatar-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--fd-accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; text-decoration: none; flex: none }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; background: var(--g-soft); color: var(--g-fg); display: grid; place-items: center; flex: none }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; background: var(--info-bg); color: var(--info-fg) }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg) }

/* ---------- bits */
.h2 { margin: 0 0 8px 4px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--g-muted) }
.card { background: var(--g-card); border: 1px solid var(--g-line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px }
.label { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--g-muted) }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; flex-wrap: nowrap }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--g-line); background: var(--g-card);
  font: 700 13px var(--g-font); color: var(--g-fg); cursor: pointer; white-space: nowrap; flex: none; text-decoration: none }
.chip svg.i { width: 16px; height: 16px }
.chip[aria-pressed="true"] { background: var(--g-brand); border-color: var(--g-brand); color: var(--g-brand-fg) }
.chip.on { background: var(--g-soft); border-color: transparent; color: var(--g-brand) }
.st { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 800; white-space: nowrap; flex: none }
.st-valid, .st-paid { background: var(--ok-bg); color: var(--ok-fg) }
.st-due { background: var(--warn-bg); color: var(--warn-fg) }
.st-renew, .st-grace { background: var(--ren-bg); color: var(--ren-fg) }
.st-expired, .st-overdue { background: var(--g-bad-bg); color: var(--g-bad) }
.st-needed, .st-none, .st-unknown { background: var(--n-bg); color: var(--n-fg) }
.st-linked { background: var(--info-bg); color: var(--info-fg) }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ok-fg) }
.dot-due { background: var(--warn-fg) } .dot-renew { background: var(--ren-fg) } .dot-expired { background: var(--g-bad) }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--g-line);
  background: transparent; color: var(--g-fg); font: 700 15px var(--g-font); cursor: pointer; text-decoration: none; flex: 1 1 140px }
.btn.primary { background: var(--g-brand); border-color: var(--g-brand); color: var(--g-brand-fg) }
.btn[aria-disabled="true"] { color: var(--g-muted); cursor: default }
.acts { display: flex; gap: 10px; flex-wrap: wrap }
.search { display: flex; align-items: center; gap: 10px; background: var(--g-card); border: 1px solid var(--g-line); border-radius: 14px; padding: 0 14px; min-height: 46px; color: var(--g-muted) }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--g-fg) }
.seg { display: flex; padding: 4px; gap: 4px; background: var(--g-card); border: 1px solid var(--g-line); border-radius: 14px }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--g-fg) }
.seg button[aria-pressed="true"] { background: var(--g-brand); color: var(--g-brand-fg) }

/* ---------- lists */
.list { background: var(--g-card); border: 1px solid var(--g-line); border-radius: 16px; overflow: hidden }
.list > .empty { padding: 16px }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--g-line); text-decoration: none; color: inherit; min-height: 56px }
.list > .row:first-child { border-top: 0 }
.row.sel { background: var(--g-soft) }
.row.top { align-items: flex-start } .row.tight { min-height: 44px; padding: 10px 16px }
.row.done .t b { text-decoration: line-through; color: var(--g-muted) }
.row .t { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 }
.row .t b { font-size: 15px; font-weight: 700; overflow-wrap: anywhere }
.row .t span { font-size: 12.5px; color: var(--g-muted); overflow-wrap: anywhere }
.row .t .mono { letter-spacing: .04em }
.row .r { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; text-align: right }
.row .r b { font-size: 15px } .row .r span { font-size: 12px; color: var(--g-muted) }
.ric { width: 38px; height: 38px; border-radius: 11px; background: var(--g-soft); display: grid; place-items: center; flex: none }
.ric.sos { background: var(--sos); color: #fff }
.row.step { align-items: flex-start }
.sn { width: 26px; height: 26px; border-radius: 50%; background: var(--g-soft); color: var(--g-brand); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none }

/* ---------- renewals */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px }
.tile-n { border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; text-decoration: none }
.tile-n b { font-size: 24px; font-weight: 800 } .tile-n span { font-size: 12px; font-weight: 700 }
.t-bad { background: var(--g-bad-bg); color: var(--g-bad) } .t-warn { background: var(--warn-bg); color: var(--warn-fg) } .t-n { background: var(--n-bg); color: var(--n-fg) }
.ok-card { flex-direction: row; align-items: center; gap: 12px }
.ok-card > span:last-child { display: flex; flex-direction: column; gap: 2px }
.okic { width: 40px; height: 40px; border-radius: 12px; background: var(--g-soft); color: var(--g-brand); display: grid; place-items: center; flex: none }

/* ---------- details */
.detail { display: flex; flex-direction: column; gap: 14px }
.dh { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap }
.dh .t { display: flex; flex-direction: column; gap: 2px }
.dt { font-size: 20px; font-weight: 800; letter-spacing: -.01em }
.detail p { margin: 0 }
.numrow { display: flex; flex-direction: column; gap: 4px; background: var(--g-soft); border-radius: 12px; padding: 10px 12px; min-width: 0 }
.numrow .lab { font-size: 12px; color: var(--g-muted); font-weight: 700 }
.numbox { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap }
.numv { font-size: 18px; font-weight: 800; letter-spacing: .06em; overflow-wrap: anywhere }
.numv.masked { color: var(--g-muted) }
.kvs { padding: 0; gap: 0; overflow: hidden }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--g-line) }
.kvs > .kv:first-child { border-top: 0 }
.kv > span { font-size: 13px; color: var(--g-muted); font-weight: 600 }
.kv > b { font-size: 14px; text-align: right; min-width: 0; overflow-wrap: anywhere }
.kv.head .t { display: flex; flex-direction: column; gap: 2px } .kv.head .t b { font-size: 15px; color: var(--g-fg) }
.hc .numbox { justify-content: flex-end }
.warnline { display: flex; gap: 6px; align-items: center; color: var(--warn-fg) }
.okt { color: var(--g-brand); font-weight: 700 }
.two { display: flex; gap: 10px; flex-wrap: wrap } .two > * { flex: 1 1 150px; min-width: 0 }
.pane-empty { padding-top: 80px; display: flex; flex-direction: column; align-items: center; gap: 8px }
.pane-empty svg.i { width: 32px; height: 32px; opacity: .5 }
.stats { flex-direction: row; flex-wrap: wrap; gap: 16px }
.stats > span { display: flex; flex-direction: column; gap: 2px; flex: 1 1 120px }
.stats small { font-size: 12px; font-weight: 700; color: var(--g-muted) } .stats b { font-size: 20px; font-weight: 800 }

/* ---------- health */
.hero { background: linear-gradient(160deg, var(--g-hero), var(--g-hero-2)); color: #fff; border: 0; gap: 10px }
.hero .label { color: var(--g-hero-sub) } .hero .hs { font-size: 13.5px; color: var(--g-hero-sub) }
.hero .big { font-size: 30px; font-weight: 800; letter-spacing: -.02em }
.bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: rgba(255,255,255,.15) }
.bar i { background: #fff } .bar i.gap { background: rgba(255,255,255,.25) } .bar i.top { background: #7FD8B2 }
.note { flex-direction: row; align-items: center; gap: 10px; font-size: 13.5px }

/* ---------- emergency */
.offl { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 700 }
.calls { display: flex; flex-wrap: wrap; gap: 10px }
.call { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px; border-radius: 14px; text-decoration: none; flex: 1 1 260px; color: #fff; background: var(--g-hero) }
.call-sos { background: var(--sos) } .call-brand { background: var(--g-brand); color: var(--g-brand-fg) }
.call .cic { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none }
.call .t { display: flex; flex-direction: column; gap: 1px; min-width: 0 } .call .t b { font-size: 15px } .call .t span { font-size: 13px; opacity: .9 }

/* ---------- sheets */
.fd-form { display: flex; flex-direction: column; gap: 10px; text-align: left }
.fd-form .two { gap: 10px }
.hint { background: var(--g-soft); border-radius: 10px; padding: 8px 10px; color: var(--g-muted); margin: 0 }
