/* Seven Cares web app: "warm journal". Cream paper, sage and terracotta accents, serif display headings, sans body.
   Big tap targets (48 px+), text contrast >= 4.5:1, visible focus, motion only when the person allows it.
   Spacing on a 4/8 px scale; type scale 32/26/20/17/15/13. */
:root {
  --bg: #f5eee3; --surface: #fcf8f1; --surface-2: #efe6d8; --surface-3: #e3d7c5;
  --text: #2a241d; --muted: #675b4e; --faint: #8a7d6e; --line: #e3d7c5;
  --accent: #4a6848; --accent-strong: #3a5538; --accent-soft: #e2e8d8; --on-accent: #ffffff;
  --terra: #9f4726; --terra-strong: #873a1d; --terra-soft: #f4e0d2; --on-terra: #fff8f0;
  --gold: #a87422;
  --danger: #a3271b; --danger-soft: #f7dcd5; --on-danger: #ffffff;
  --warn: #7f5614; --warn-soft: #f4e6c6; --ok: #3d6a3b; --ok-soft: #e2ebd9;
  --focus: #2b5f8e;
  --hill1: #c9d5bc; --hill2: #a9bc9c; --sun: #e8a877; --moon: #e7cf9d; --line-art: #8f8170;
  --shadow-1: 0 1px 0 rgba(120, 90, 50, .08), 0 4px 14px rgba(90, 60, 30, .06);
  --shadow-2: 0 2px 6px rgba(90, 60, 30, .10), 0 12px 32px rgba(90, 60, 30, .14);
  --scrim: rgba(42, 30, 18, .42);
  --r-s: 12px; --r-m: 18px; --r-l: 22px; --r-xl: 26px; --r-pill: 999px;
  --tap: 48px; --nav-h: 72px; --bar-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1); --dur: 180ms;
  --font: "FiraGO", Roboto, "Noto Sans", "Noto Sans Georgian", system-ui, -apple-system, "Segoe UI", "DejaVu Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: "Noto Serif", "Noto Serif Georgian", Georgia, "DejaVu Serif", serif;
  color-scheme: light dark;
  /* log type tones: foreground on soft background (each pair >= 7:1) */
  --t-seizure: #7a2e12; --tb-seizure: #f6dccf;
  --t-sleep: #3e3560; --tb-sleep: #e5e0ee;
  --t-feeding: #6a4410; --tb-feeding: #f7e3c6;
  --t-bowel: #5a4520; --tb-bowel: #ece1cc;
  --t-medication: #2f4a2d; --tb-medication: #dde6d2;
  --t-symptom: #7a2620; --tb-symptom: #f4d8d3;
  --t-mood: #574507; --tb-mood: #f2e6b4;
  --t-growth: #3d5418; --tb-growth: #e0e9cf;
  --t-therapy: #24504a; --tb-therapy: #d9e8e2;
  --t-milestone: #6b4e10; --tb-milestone: #f3e3bf;
  --t-appointment: #2a4a63; --tb-appointment: #dce5ec;
  --t-note: #4f4538; --tb-note: #e9e1d4;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1814; --surface: #26211b; --surface-2: #2f2922; --surface-3: #3b342b;
    --text: #f1e9dd; --muted: #bcae9d; --line: #3b342b;
    --faint: #928574;
    --accent: #a8c4a0; --accent-strong: #c0d8b8; --accent-soft: #2c3528; --on-accent: #16210f;
    --terra: #e9a385; --terra-strong: #f2b89f; --terra-soft: #3a261d; --on-terra: #2a140a;
    --gold: #d9b26a;
    --danger: #f39b8b; --danger-soft: #42201a; --on-danger: #2b0703;
    --warn: #e3be78; --warn-soft: #3a2e17; --ok: #a8c4a0; --ok-soft: #2c3528;
    --focus: #9cc7f0;
    --hill1: #33402f; --hill2: #3e4d39; --sun: #c98e5a; --moon: #d8c08a; --line-art: #8c8070;
    --shadow-1: 0 1px 0 rgba(0, 0, 0, .25), 0 4px 14px rgba(0, 0, 0, .22);
    --shadow-2: 0 8px 28px rgba(0, 0, 0, .5);
    --scrim: rgba(0, 0, 0, .6);
    --t-seizure: #f2b9a0; --tb-seizure: #43271c;
    --t-sleep: #d2c9ef; --tb-sleep: #2e2a3c;
    --t-feeding: #efc994; --tb-feeding: #41311c;
    --t-bowel: #e2cba0; --tb-bowel: #3a3022;
    --t-medication: #b9d3b0; --tb-medication: #2c3528;
    --t-symptom: #f0b0a5; --tb-symptom: #45241f;
    --t-mood: #ebd584; --tb-mood: #3e3618;
    --t-growth: #c6dc9e; --tb-growth: #2f3820;
    --t-therapy: #a7d3c8; --tb-therapy: #213531;
    --t-milestone: #e9c77e; --tb-milestone: #3e3218;
    --t-appointment: #afc9de; --tb-appointment: #22303b;
    --t-note: #d4c7b4; --tb-note: #332d25;
  }
}
:root[data-theme="dark"] { color-scheme: dark;
    --bg: #1b1814; --surface: #26211b; --surface-2: #2f2922; --surface-3: #3b342b;
    --text: #f1e9dd; --muted: #bcae9d; --line: #3b342b;
    --faint: #928574;
    --accent: #a8c4a0; --accent-strong: #c0d8b8; --accent-soft: #2c3528; --on-accent: #16210f;
    --terra: #e9a385; --terra-strong: #f2b89f; --terra-soft: #3a261d; --on-terra: #2a140a;
    --gold: #d9b26a;
    --danger: #f39b8b; --danger-soft: #42201a; --on-danger: #2b0703;
    --warn: #e3be78; --warn-soft: #3a2e17; --ok: #a8c4a0; --ok-soft: #2c3528;
    --focus: #9cc7f0;
    --hill1: #33402f; --hill2: #3e4d39; --sun: #c98e5a; --moon: #d8c08a; --line-art: #8c8070;
    --shadow-1: 0 1px 0 rgba(0, 0, 0, .25), 0 4px 14px rgba(0, 0, 0, .22);
    --shadow-2: 0 8px 28px rgba(0, 0, 0, .5);
    --scrim: rgba(0, 0, 0, .6);
    --t-seizure: #f2b9a0; --tb-seizure: #43271c;
    --t-sleep: #d2c9ef; --tb-sleep: #2e2a3c;
    --t-feeding: #efc994; --tb-feeding: #41311c;
    --t-bowel: #e2cba0; --tb-bowel: #3a3022;
    --t-medication: #b9d3b0; --tb-medication: #2c3528;
    --t-symptom: #f0b0a5; --tb-symptom: #45241f;
    --t-mood: #ebd584; --tb-mood: #3e3618;
    --t-growth: #c6dc9e; --tb-growth: #2f3820;
    --t-therapy: #a7d3c8; --tb-therapy: #213531;
    --t-milestone: #e9c77e; --tb-milestone: #3e3218;
    --t-appointment: #afc9de; --tb-appointment: #22303b;
    --t-note: #d4c7b4; --tb-note: #332d25;
}
:root[data-theme="light"] { color-scheme: light; }

@font-face { font-family: "FiraGO"; src: url("fonts/FiraGO-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "FiraGO"; src: url("fonts/FiraGO-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "FiraGO"; src: url("fonts/FiraGO-SemiBold.woff2") format("woff2"); font-weight: 600 700; font-style: normal; font-display: swap; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16.5px/1.5 var(--font); overflow-wrap: break-word; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-feature-settings: "kern", "calt"; }
#app { min-height: 100dvh; display: flex; flex-direction: column; }
main:focus, main:focus-visible { outline: none; }
main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 8px 16px calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)); outline: none; }
main.solo { padding: calc(24px + env(safe-area-inset-top)) 20px 32px; max-width: 520px; }
h1, h2, h3, h4 { line-height: 1.22; margin: 0 0 8px; font-weight: 600; }
h1, h2, .serif { font-family: var(--serif); font-weight: 500; letter-spacing: -.015em; }
/* Georgian display text: FiraGO Medium (Noto Serif Georgian is not on every Android phone). */
:lang(ka) :is(h1, h2, .serif, .section-title, .part, .day, .qsec > .ql, .iv-q, .attn-head, .alldone, .quick > label, .dlg-title, .year h3, .modgroup .gl h3, .condcard h3, .sumcard > h3, .claimhead h3, .storycard strong, .md h3) { font-family: var(--font); font-weight: 500; letter-spacing: -.01em; }
:lang(ka) :is(h1, h2, .pagetitle, .iv-q, .claimhead h3, .year h3, .day) { font-weight: 400; }
h3, h4 { letter-spacing: -.005em; }
h1 { font-size: 30px; } h2 { font-size: 24px; } h3 { font-size: 17px; } h4 { font-size: 15px; margin: 12px 0 4px; }
p { margin: 0 0 12px; }
a { color: var(--accent-strong); text-underline-offset: 3px; }
ul, ol { margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; } .num, time { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex: none; display: block; }
.pre { white-space: pre-wrap; }
.eyebrow { font-size: 14px; font-weight: 500; letter-spacing: 0; color: var(--muted); margin: 0 0 4px; }


/* ---------- illustrations ---------- */
.art { flex: none; display: block; }
.il-sun { fill: var(--sun); opacity: .92; }
.il-moon { fill: var(--moon); }
.il-star { fill: var(--moon); opacity: .8; }
.il-hill1 { fill: var(--hill1); } .il-hill2 { fill: var(--hill2); }
.il-sprout { fill: var(--accent); stroke: var(--accent); stroke-width: 1.2; stroke-linejoin: round; }
.il-line { fill: none; stroke: var(--line-art); stroke-width: 1.6; stroke-linecap: round; opacity: .6; }
.il-path { fill: none; stroke: var(--surface); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 1 9; opacity: .95; }
.il-page { fill: var(--surface); stroke: var(--line-art); stroke-width: 1.2; }
.il-page2 { fill: var(--surface-2); stroke: var(--line-art); stroke-width: 1.2; }

/* ---------- app bar ---------- */
.appbar { position: sticky; top: 0; z-index: 20; background: var(--bg); padding-top: env(safe-area-inset-top); transition: box-shadow var(--dur); }
.appbar-inner { max-width: 640px; margin: 0 auto; min-height: var(--bar-h); display: flex; align-items: center; gap: 8px; padding: 8px 16px 8px 12px; }
.appbar.scrolled { box-shadow: 0 1px 0 var(--line); }
.identity { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 4px 8px 4px 4px; border-radius: var(--r-m); border: 0; background: transparent; color: inherit; font: inherit; text-align: start; text-decoration: none; }
button.identity { cursor: pointer; } button.identity:active { background: var(--surface-2); }
.identity .who-text { display: flex; flex-direction: column; min-width: 0; }
.childname { font-size: 17px; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.childage { font-size: 14px; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.identity .icon { color: var(--muted); }
.avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font: 600 15px var(--serif); letter-spacing: .02em; background: var(--av-bg, var(--accent-soft)); color: var(--av-fg, var(--accent-strong)); }
.avatar.lg { width: 68px; height: 68px; font-size: 24px; }
.avatar.c1 { --av-bg: var(--tb-sleep); --av-fg: var(--t-sleep); } .avatar.c2 { --av-bg: var(--terra-soft); --av-fg: var(--terra-strong); }
.avatar.c3 { --av-bg: var(--tb-therapy); --av-fg: var(--t-therapy); } .avatar.c4 { --av-bg: var(--tb-mood); --av-fg: var(--t-mood); }
.avatar.c5 { --av-bg: var(--tb-feeding); --av-fg: var(--t-feeding); }
.iconbtn { flex: none; width: var(--tap); height: var(--tap); display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: var(--text); cursor: pointer; text-decoration: none; }
.iconbtn:active { background: var(--surface-2); }
.iconbtn.tonal { background: var(--surface); box-shadow: var(--shadow-1); }
.sos { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 16px 0 12px; border-radius: var(--r-pill); color: var(--terra); background: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--terra) 45%, transparent); font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.sos:active { background: var(--terra-soft); }
.sos .icon { width: 20px; height: 20px; }
.pill { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 12px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }

/* ---------- bottom navigation ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; background: var(--surface); box-shadow: 0 -1px 0 var(--line); padding: 0 4px env(safe-area-inset-bottom); }
.tabs a { flex: 1; max-width: 128px; min-width: 0; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500; line-height: 1.15; text-align: center; }
.tabs .ind { width: 60px; height: 32px; border-radius: var(--r-pill); display: grid; place-items: center; transition: background-color var(--dur) var(--ease); }
.tabs .lbl { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.tabs a[aria-current="page"] { color: var(--text); font-weight: 600; }
.tabs a[aria-current="page"] .ind { background: var(--accent-soft); color: var(--accent-strong); }
body.typing .tabs { display: none; }
body.typing main { padding-bottom: 32px; }
body.em-full .appbar, body.em-full .tabs, body.em-full #banner { display: none; }
body.em-full main { padding-bottom: 16px; }
body.em-full .pagehead { margin-bottom: 0; }
body.focus-mode .appbar, body.focus-mode .tabs, body.focus-mode #banner { display: none; }
body.focus-mode main { padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: calc(120px + env(safe-area-inset-bottom)); }

/* ---------- buttons ---------- */
/* Buttons: 48 default, 56 primary full width, radius 16, padding 20/24, 20 px icon with an 8 px gap, label 500-600 at line-height 1. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 2px 20px 0; border-radius: 16px; border: 0; background: var(--surface-2); color: var(--text); font: 500 16px/1 var(--font); letter-spacing: .005em; text-decoration: none; cursor: pointer; text-align: center; white-space: normal; transition: transform 90ms ease-out, filter 90ms ease-out, background-color var(--dur); }
.btn .icon { margin-top: -2px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.terra { background: var(--terra); color: var(--on-terra); }
.btn.secondary, .btn.tonal { background: var(--accent-soft); color: var(--accent-strong); }
.btn.outline { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; color: var(--accent-strong); padding: 2px 12px 0; }
.btn.primary, .btn.terra { font-weight: 600; }
.btn.big { min-height: 56px; padding: 2px 24px 0; font-size: 17px; border-radius: 16px; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn .icon { width: 20px; height: 20px; }
.small-btn { min-height: var(--tap); font-size: 15px; padding: 2px 10px 0; margin: 4px -10px -6px; }
.row { display: flex; gap: 8px; align-items: center; margin: 12px 0; } .row.wrap { flex-wrap: wrap; } .row.end { justify-content: flex-end; }
.row.split > * { flex: 1; }
.row.split > .btn { padding-left: 12px; padding-right: 12px; font-size: 15px; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* ---------- page header ---------- */
.pagetitle { margin: 8px 4px 16px; font-size: 32px; letter-spacing: -.02em; }
.pagehead { display: flex; align-items: center; gap: 4px; margin: 0 -8px 12px; min-height: var(--tap); }
.pagehead h2 { flex: 1; min-width: 0; margin: 0; font-size: 24px; overflow-wrap: anywhere; }
.pagehead .actions { display: flex; gap: 4px; align-items: center; }
.back { flex: none; width: var(--tap); height: var(--tap); display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; }
.back:active { background: var(--surface-2); }
.lead { color: var(--muted); font-size: 15.5px; margin: -6px 4px 16px; }
.section-title { font: 500 20px/1.25 var(--serif); color: var(--text); margin: 28px 4px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.section-title > span { display: inline-flex; align-items: center; gap: 10px; }
.section-title > span .icon { color: var(--gold); }
.section-title a, .section-title .linkbtn { font: 600 15px var(--font); text-decoration: none; min-height: var(--tap); display: inline-flex; align-items: center; gap: 6px; margin: -12px 0; color: var(--accent-strong); background: none; border: 0; cursor: pointer; padding: 0 4px; }
.section-title .linkbtn .icon { width: 18px; height: 18px; color: inherit; }
.sublabel { font-size: 14px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }


/* page hero: serif title, intro, small illustration */
.pagehero { display: flex; align-items: flex-end; gap: 8px; margin: 4px 4px 16px; }
.pagehero .ph-text { flex: 1; min-width: 0; }
.pagehero h1 { margin: 2px 0 6px; font-size: 30px; }
.pagehero p { color: var(--muted); font-size: 15.5px; margin: 0; }
.pagehero .art { width: 96px; height: 72px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border-radius: var(--r-l); padding: 16px 20px; margin: 0 0 12px; box-shadow: var(--shadow-1); }
.card.flat { box-shadow: none; background: var(--surface-2); }
.card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 8px; margin: -4px -8px 8px 0; min-height: 40px; }
.card-head h3 { flex: 1; margin: 0; }
.notice { border-radius: var(--r-m); padding: 12px 16px; margin: 8px 0 12px; background: var(--accent-soft); color: var(--text); font-size: 15px; display: flex; gap: 12px; align-items: flex-start; }
.notice > .icon { color: var(--accent-strong); margin-top: 1px; }
.notice > div, .notice > span { flex: 1; min-width: 0; }
.notice > div > :last-child, .notice > :last-child { margin-bottom: 0; }
.notice.error { background: var(--danger-soft); } .notice.error > .icon { color: var(--danger); }
.notice.warn { background: var(--warn-soft); } .notice.warn > .icon { color: var(--warn); }
.notice.ok { background: var(--ok-soft); } .notice.ok > .icon { color: var(--ok); }
.notice.terra { background: var(--terra-soft); } .notice.terra > .icon { color: var(--terra); }
.empty { color: var(--muted); padding: 8px 4px; margin: 0; font-size: 15px; }
.empty-line { display: flex; align-items: center; justify-content: space-between; gap: 4px 8px; flex-wrap: wrap; padding: 4px; color: var(--muted); font-size: 15px; }
.empty-line > span { padding: 8px 0; }
.emptyart { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 20px 16px; color: var(--muted); }
.emptyart p { margin: 0; max-width: 32ch; }

/* ---------- urgent banner (real urgency: red) ---------- */
#banner:empty { display: none; }
#banner { max-width: 640px; margin: 0 auto; width: 100%; padding: 4px 16px 0; }
.urgent { background: var(--danger); color: #fff; border-radius: var(--r-l); padding: 16px; box-shadow: var(--shadow-2); }
.urgent .urgent-head { display: flex; gap: 8px; align-items: center; font-size: 17px; }
.urgent p { margin: 8px 0 0; } .urgent .call { font-weight: 600; }
.urgent .row { margin-bottom: 0; }
.urgent .btn { background: #fff; color: #7a1009; }
.urgent .btn.ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .7); padding: 10px 16px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .urgent { background: #8f2419; } }
:root[data-theme="dark"] .urgent { background: #8f2419; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; }
.field { margin: 0 0 16px; display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; min-width: 0; }
.field label, .field .lbl, legend { font-weight: 600; font-size: 15px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; } legend { padding: 0; margin-bottom: 8px; }
.field.check { flex-direction: row; align-items: center; gap: 12px; min-height: var(--tap); }
.field.check input { width: 24px; height: 24px; accent-color: var(--accent); }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=date], input[type=time], input[type=month], input[type=datetime-local], input:not([type]), select, textarea {
  width: 100%; min-height: 52px; padding: 12px 16px; font: inherit; font-size: 17px; color: var(--text); background: var(--surface); border: 1.5px solid var(--surface-3); border-radius: var(--r-m); transition: border-color var(--dur), background-color var(--dur); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: none; line-height: 1.45; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.hint { color: var(--muted); font-size: 13.5px; }
.form > .btn.primary { margin-top: 8px; }
.timerow { margin: 0 0 8px; } .timerow input { flex: 1; }
.repeat { background: var(--surface-2); box-shadow: none; padding: 12px; }
.form-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 12px; padding: 2px 16px; scroll-padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin: 4px 0; padding: 1px 16px 0; border-radius: var(--r-pill); border: 0; background: var(--surface); box-shadow: inset 0 0 0 1px var(--surface-3); color: var(--text); font: 500 15px/1 var(--font); cursor: pointer; white-space: nowrap; transition: transform 90ms ease-out, filter 90ms ease-out; }
.chip::after { content: ""; position: absolute; inset: -4px 0; }
.chip .icon { width: 18px; height: 18px; color: var(--chip-ic, var(--muted)); }
.chip.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent-strong); }
.chip.on .icon { color: var(--accent-strong); }
.chip.soft { background: var(--surface-2); box-shadow: none; }
.chip.toggle[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.chip.toggle[aria-pressed="true"] .icon { color: var(--on-accent); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r-pill); padding: 4px; gap: 4px; }
.seg button { min-height: 44px; padding: 1px 16px 0; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--muted); font: 500 15px/1 var(--font); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.chiprow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* evidence chips and badges */
a.docref, button.cite, .evchip { display: inline-flex; align-items: center; gap: 4px; font: 600 13px/1 var(--font); padding: 0 9px; min-height: 26px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-strong); text-decoration: none; vertical-align: 1px; border: 0; cursor: pointer; white-space: nowrap; position: relative; }
button.cite { background: var(--terra-soft); color: var(--terra-strong); }
a.docref::after, button.cite::after { content: ""; position: absolute; inset: -11px -2px; }
.evchip { background: var(--surface-2); color: var(--muted); font-weight: 600; cursor: default; }
.evchip.against { background: var(--warn-soft); color: var(--warn); }
.evchip .icon { width: 14px; height: 14px; }
.chiprow a.docref, .chiprow button.cite { min-height: 32px; padding: 0 12px; font-size: 14px; }
.chiprow a.docref::after, .chiprow button.cite::after { inset: -8px -2px; }
.conf { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 2px 10px 2px 8px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; white-space: nowrap; }
.conf .icon { width: 15px; height: 15px; }
.conf-documented { background: var(--ok-soft); color: var(--ok); }
.conf-parent_reported { background: var(--tb-sleep); color: var(--t-sleep); }
.conf-inferred { background: var(--surface-2); color: var(--muted); }
.conf-conflicting { background: var(--warn-soft); color: var(--warn); }
.certchip { display: inline-flex; min-height: 26px; align-items: center; padding: 2px 10px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.certchip.c-sure { background: var(--ok-soft); color: var(--ok); }
.certchip.c-not_sure { background: var(--warn-soft); color: var(--warn); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0 0 12px; padding: 4px 0; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); }
.list:empty { display: none; }
.list > li + li { box-shadow: inset 0 1px 0 var(--line); }
.list.compact { background: transparent; box-shadow: none; padding: 0; }
.rowlink { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 12px 16px 12px 20px; color: inherit; text-decoration: none; width: 100%; border: 0; background: transparent; font: inherit; text-align: start; cursor: pointer; border-radius: inherit; }
a.rowlink:active, button.rowlink:active { background: var(--surface-2); }
.rowlink.big { min-height: 66px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 500; font-size: 16.5px; line-height: 1.3; letter-spacing: -.003em; }
.row-sub { color: var(--muted); font-size: 14.8px; line-height: 1.4; margin-top: 3px; }
.row-icon { flex: none; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); }
.row-icon.danger { background: var(--terra-soft); color: var(--terra); }
.row-icon.plain { background: var(--surface-2); color: var(--muted); }
.row-icon.gold { background: var(--tb-milestone); color: var(--t-milestone); }
.chev { color: var(--faint); width: 20px; height: 20px; }
.rowlink.signout .row-title { color: var(--danger); }
.doc-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.snippet { color: var(--muted); font-size: 15px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 6px; }
.row-end { flex: none; display: flex; align-items: center; gap: 4px; }
.count { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: var(--r-pill); background: var(--terra); color: var(--on-terra); font-size: 13px; font-weight: 600; }
.plainlist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.plainlist li { display: flex; flex-direction: column; }

/* status pills */
.status { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--ok-soft); color: var(--ok); }
.status.waiting, .status.undone, .status.rejected { background: var(--surface-2); color: var(--muted); }
.status.pending, .status.running { background: var(--accent-soft); color: var(--accent-strong); }
.status.warn, .status.proposed { background: var(--terra-soft); color: var(--terra-strong); }
.status.failed { background: var(--danger-soft); color: var(--danger); }

/* ---------- type badges and tones ---------- */
.tbadge { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--tb, var(--surface-2)); color: var(--tc, var(--muted)); }
.tbadge .icon { width: 20px; height: 20px; }
.tbadge.lg { width: 52px; height: 52px; border-radius: 18px; } .tbadge.lg .icon { width: 26px; height: 26px; }
.ty-seizure { --tc: var(--t-seizure); --tb: var(--tb-seizure); --chip-ic: var(--t-seizure); }
.ty-sleep { --tc: var(--t-sleep); --tb: var(--tb-sleep); --chip-ic: var(--t-sleep); }
.ty-feeding { --tc: var(--t-feeding); --tb: var(--tb-feeding); --chip-ic: var(--t-feeding); }
.ty-bowel { --tc: var(--t-bowel); --tb: var(--tb-bowel); --chip-ic: var(--t-bowel); }
.ty-medication { --tc: var(--t-medication); --tb: var(--tb-medication); --chip-ic: var(--t-medication); }
.ty-symptom { --tc: var(--t-symptom); --tb: var(--tb-symptom); --chip-ic: var(--t-symptom); }
.ty-mood { --tc: var(--t-mood); --tb: var(--tb-mood); --chip-ic: var(--t-mood); }
.ty-growth { --tc: var(--t-growth); --tb: var(--tb-growth); --chip-ic: var(--t-growth); }
.ty-therapy { --tc: var(--t-therapy); --tb: var(--tb-therapy); --chip-ic: var(--t-therapy); }
.ty-milestone { --tc: var(--t-milestone); --tb: var(--tb-milestone); --chip-ic: var(--t-milestone); }
.ty-appointment { --tc: var(--t-appointment); --tb: var(--tb-appointment); --chip-ic: var(--t-appointment); }
.ty-note { --tc: var(--t-note); --tb: var(--tb-note); --chip-ic: var(--t-note); }

/* ---------- journal timeline (Log, Today latest) ---------- */
.daygroup { margin-bottom: 8px; }
.day { position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top)); z-index: 5; margin: 0 -16px; padding: 14px 20px 6px; background: var(--bg); font: 500 22px/1.2 var(--serif); }
.part { display: flex; align-items: center; gap: 10px; margin: 10px 4px 4px; font: 500 18px var(--serif); color: var(--text); }
.part .icon { color: var(--gold); width: 20px; height: 20px; }
.journal { list-style: none; margin: 0; padding: 0 0 4px; }
.jrow { position: relative; }
.jlink { display: grid; grid-template-columns: 66px 26px minmax(0, 1fr); align-items: start; min-height: 56px; padding: 8px 4px 10px; color: inherit; text-decoration: none; border-radius: var(--r-m); }
a.jlink:active { background: var(--surface-2); }
.jtime { font-size: 13.5px; white-space: nowrap; color: var(--muted); padding-top: 2px; font-variant-numeric: tabular-nums; }
.jdot { position: relative; align-self: stretch; }
.jdot::before { content: ""; position: absolute; left: 6px; top: -8px; bottom: -10px; width: 1.5px; background: var(--line); }
.jrow:first-child .jdot::before { top: 8px; }
.jrow:last-child .jdot::before { bottom: auto; height: 12px; }
.jdot i { position: absolute; left: 0; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--tc, var(--accent)); box-shadow: 0 0 0 3px var(--bg); }
.jbody { min-width: 0; display: flex; flex-direction: column; }
.jtitle { font-size: 16.5px; font-weight: 600; line-height: 1.35; }
.jtitle .jkv { font-weight: 450; }
.jdetail { font-size: 14.5px; color: var(--muted); line-height: 1.4; margin-top: 1px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.jnote { font: italic 16.5px/1.4 var(--serif); color: var(--text); }
:lang(ka) .jnote { font-style: normal; }
.jmeta { font-size: 13.5px; color: var(--muted); margin-top: 1px; }
.journal.card-ish { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); padding: 6px 8px; }
.journal.card-ish .jdot i { box-shadow: 0 0 0 3px var(--surface); }

/* week strip (one type, last 8 weeks) */
.weekcard { padding: 16px; }
.weekcard h3 { font-size: 15px; color: var(--muted); font-weight: 600; margin: 0 0 12px; }
.weekstrip { display: flex; align-items: flex-end; gap: 16px; }
.weekstrip .ws-text { flex: none; min-width: 72px; }
.weekstrip .ws-num { font: 500 30px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.weekstrip .ws-lbl { font-size: 13px; color: var(--muted); }
.bars { flex: 1; display: flex; align-items: flex-end; gap: 6px; height: 56px; list-style: none; margin: 0; padding: 0; }
.bars li { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bars li span { display: block; width: 100%; min-height: 4px; border-radius: 6px 6px 3px 3px; background: var(--tc, var(--accent)); }
.bars li.zero span { background: var(--surface-3); }
.ws-axis { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin: 6px 0 0 88px; }

/* floating action button */
.fab { position: fixed; z-index: 25; right: max(16px, calc(50vw - 304px)); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 22px 0 18px; border-radius: 18px; border: 0; background: var(--terra); color: var(--on-terra); font: inherit; font-size: 16px; font-weight: 600; box-shadow: 0 8px 22px rgba(120, 50, 20, .28); cursor: pointer; text-decoration: none; }
body.typing .fab, body.sheet-open .fab { display: none; }

/* type tiles (add entry, Today) */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 10px; min-height: 88px; padding: 12px 12px 11px 14px; border-radius: var(--r-xl); border: 0; background: var(--tb, var(--surface-2)); color: var(--tc, var(--text)); font: inherit; font-size: 15.5px; font-weight: 500; cursor: pointer; text-align: start; line-height: 1.25; letter-spacing: -.003em; text-decoration: none; overflow-wrap: break-word; hyphens: manual; transition: transform 90ms ease-out, filter 90ms ease-out; }
.tile .icon { width: 28px; height: 28px; }
.tile .tl { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
:lang(ka) .tile { font-size: 15px; min-height: 64px; flex-direction: row; align-items: center; justify-content: flex-start; padding: 12px 14px; }
:lang(ka) .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
:lang(ka) .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile.ty-seizure { border-bottom-left-radius: 40px; }
.tiles.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.typehead { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.typehead h2 { margin: 0; }

/* ---------- Today ---------- */
.dayhead { display: flex; align-items: flex-end; gap: 4px; margin: 0 4px 4px; }
.dayhead .dh-text { flex: 1; min-width: 0; }
.dayhead h1 { margin: 2px 0 4px; font-size: 32px; line-height: 1.1; letter-spacing: -.02em; }
.dayhead .hi { font-size: 15.5px; color: var(--muted); margin: 0; }
.dayhead .art { width: 92px; height: 69px; margin-right: -4px; }
[data-view=today] > .section-title:first-of-type { margin-top: 14px; }
[data-view=today] .tiles { margin-bottom: 12px; }
.more-tile { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--text); }
.plan-toggle { margin-left: auto; }
.plan-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.next-actions:has(.plan-toggle) { justify-content: space-between; }
:lang(ka) .dayhead h1 { font-size: 28px; }
.attn { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px; }
.attn .rowlink { min-height: 56px; padding: 8px 12px; border-radius: var(--r-m); }
.attn .row-title { font-size: 16px; }
.attn .row-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.attn-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px 2px; font: 500 18px var(--serif); }
.attn-head .icon { color: var(--gold); }
.storycard { display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-decoration: none; color: inherit; }
.storycard .art { width: 72px; height: 54px; }
.storycard .sc-text { flex: 1; min-width: 0; }
.storycard strong { display: block; font: 500 18px/1.25 var(--serif); }
.storycard span { color: var(--muted); font-size: 14.5px; }

.next { padding: 16px 16px 16px 20px; border-radius: var(--r-xl); }
.next-main { display: flex; align-items: center; gap: 12px; }
.next .nt { flex: none; font: 500 24px/1 var(--serif); color: var(--terra); padding-right: 14px; border-right: 1.5px solid var(--line); font-variant-numeric: tabular-nums; }
.next .nt small { display: block; font: 500 13px/1 var(--font); color: var(--muted); margin-bottom: 8px; }

.next .nt.notime { font-size: 22px; }
.next .tick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.next-title { font-size: 17px; font-weight: 600; line-height: 1.25; overflow-wrap: normal; hyphens: manual; }
.next-sub { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.givenwrap { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--accent-strong); }
.bigcheck { flex: none; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: background-color var(--dur), color var(--dur); box-shadow: 0 4px 12px rgba(60, 90, 50, .25); }
.bigcheck .icon { width: 28px; height: 28px; }
.bigcheck[disabled] { cursor: default; background: var(--surface-2); color: var(--faint); box-shadow: none; }
.next-actions { display: flex; justify-content: flex-start; margin: 6px -12px -10px; }
.alldone { display: flex; align-items: center; gap: 12px; font: 500 18px var(--serif); }
.alldone .tbadge { background: var(--ok-soft); color: var(--ok); }
.later { list-style: none; margin: 8px -16px -10px -20px; padding: 0; box-shadow: inset 0 1px 0 var(--line); }
.later li + li { box-shadow: inset 0 1px 0 var(--line); }
.tick { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 16px 8px 20px; background: transparent; border: 0; color: inherit; font: inherit; text-align: start; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.tick[disabled] { cursor: default; color: inherit; }
.tick .box { flex: none; width: 30px; height: 30px; border: 2px solid var(--accent); border-radius: 50%; display: grid; place-items: center; color: var(--on-accent); }
.tick .box .icon { width: 18px; height: 18px; }
.tick[disabled] .box { border-color: var(--line); }
.tick.done .box { background: var(--accent); border-color: var(--accent); }
.tick.done .tick-title { text-decoration: line-through; color: var(--muted); }
.tick.skipped .box { border-style: dashed; border-color: var(--faint); color: var(--muted); }
.tick.skipped .tick-title { color: var(--muted); }
.tick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tick-title { font-size: 16.5px; font-weight: 500; line-height: 1.3; }
.tick-sub { font-size: 13.5px; color: var(--muted); }
.timechip { display: inline-flex; align-items: center; gap: 4px; min-height: 26px; padding: 2px 10px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tick .timechip { min-width: 56px; justify-content: center; align-self: center; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.stat { background: var(--surface); border-radius: var(--r-l); padding: 12px 14px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 2px; min-width: 0; text-decoration: none; color: inherit; min-height: var(--tap); }
.stat .n { white-space: nowrap; font: 500 30px/1.1 var(--serif); font-variant-numeric: tabular-nums; color: var(--tc, var(--text)); }
.stat .n small { font: 600 15px var(--font); color: var(--muted); margin-left: 2px; }
.stat .l { font-size: 13.5px; color: var(--muted); line-height: 1.3; }
.stat .s { font-size: 12.5px; color: var(--muted); }
.quick { padding: 14px 16px 12px; }
.quick > label { display: flex; align-items: center; gap: 10px; font: 500 18px var(--serif); margin: 0 0 10px; }
.quick > label .icon { color: var(--gold); }
.inputwrap { position: relative; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 24px; border: 1.5px solid transparent; transition: border-color var(--dur), background-color var(--dur); }
.inputwrap:focus-within { border-color: var(--accent); background: var(--surface); }
.inputwrap textarea { flex: 1; min-height: 56px; max-height: 40vh; border: 0; background: transparent; padding: 15px 4px 15px 18px; }
.inputwrap textarea:focus { background: transparent; }
.inputwrap textarea:focus-visible { outline: none; }
.inputwrap:has(textarea:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }
.sendbtn { flex: none; width: 46px; height: 46px; margin: 5px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--terra); color: var(--on-terra); cursor: pointer; }
#quickbox { min-height: 84px; }
.sendbtn[disabled] { opacity: .45; cursor: default; }
.sendbtn .icon { width: 20px; height: 20px; }
.quick .chips { margin: 12px -16px 0; padding: 2px 16px 4px; }
.quick-out:empty { display: none; }
.quick-out { margin-top: 12px; }
.quick-out .notice { margin: 0; }
.quick-out ul { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.quick-out li { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.quick-out li .tbadge { width: 28px; height: 28px; } .quick-out li .tbadge .icon { width: 16px; height: 16px; }

/* ---------- quick form (one screen, tap first) ---------- */
.qf-head { display: flex; align-items: center; gap: 8px; margin: 0 -8px 10px; min-height: 56px; }
.qf-head h1 { flex: 1; min-width: 0; margin: 0; font-size: 30px; }
.qf-head .tbadge.lg { margin-right: 4px; }
.whenrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.whenrow .chip { min-height: 48px; font-size: 16px; }
.whenpick { margin: 8px 0 0; }
.qsec { margin: 22px 0 0; }
.qsec > .ql { display: block; font: 500 19px/1.3 var(--serif); margin: 0 4px 10px; }
.durgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dur { min-height: 76px; border-radius: 24px; border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--text); font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; padding: 6px 4px; }
.dur b { font: 500 26px/1.05 var(--serif); font-variant-numeric: tabular-nums; }
.dur span { font-size: 13.5px; color: var(--muted); }
.dur.long b { color: var(--terra); }
.dur[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.dur[aria-pressed="true"] span, .dur[aria-pressed="true"] b { color: var(--on-accent); }
.durother { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.durother input { max-width: 140px; }
.choicegrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ctile { position: relative; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 14px; border-radius: 20px; border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--text); font: inherit; font-size: 15.5px; font-weight: 600; text-align: start; line-height: 1.25; cursor: pointer; }
:lang(ka) .ctile { font-size: 14.5px; }
.ctile .ck { margin-left: auto; flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); visibility: hidden; }
.ctile .ck .icon { width: 16px; height: 16px; }
.ctile[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent-strong); }
.ctile[aria-pressed="true"] .ck { visibility: visible; }
.yesno { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 20px; box-shadow: inset 0 0 0 1.5px var(--line); background: var(--surface); overflow: hidden; }
.yesno.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.yesno button { min-height: 58px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; padding: 6px; }
.yesno button + button { box-shadow: inset 1.5px 0 0 var(--line); }
.yesno button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); box-shadow: inset 0 0 0 2px var(--accent); }
.yesno button .icon { width: 20px; height: 20px; }
.boolrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.boolrow .ql { margin: 0 4px; flex: 1 1 160px; }
.boolrow .yesno { flex: 0 1 200px; }
.scale { display: flex; gap: 6px; justify-content: space-between; }
.scale button { flex: 1; min-width: 0; height: 56px; border-radius: 18px; border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--text); font: 500 20px var(--serif); cursor: pointer; display: grid; place-items: center; }
.scale button .icon { width: 28px; height: 28px; }
.scale button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.scale-ends { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); margin: 6px 4px 0; gap: 8px; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { flex: none; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.stepper .sv { flex: 1; min-width: 0; display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.stepper input { width: 100%; max-width: 150px; text-align: center; font: 500 28px var(--serif); padding: 6px 8px; min-height: 56px; border-radius: 18px; }
.stepper .unit { font-size: 16px; color: var(--muted); }
details.more { margin: 22px 0 0; border-radius: var(--r-l); background: var(--surface); box-shadow: var(--shadow-1); padding: 0 16px; }
details.more summary { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; cursor: pointer; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary .icon { color: var(--muted); transition: transform var(--dur) var(--ease); }
details.more[open] summary .icon { transform: rotate(90deg); }
details.more[open] { padding-bottom: 16px; }
details.more .qsec:first-of-type { margin-top: 4px; }
.lined { width: 100%; min-height: 104px; border-radius: var(--r-m); background: var(--surface) repeating-linear-gradient(transparent 0 31px, var(--line) 31px 32px); background-position: 0 10px; background-attachment: local; padding: 10px 18px; font: 17px/32px var(--serif); color: var(--text); border: 1.5px solid var(--line); }
.lined::placeholder { font-style: italic; color: var(--muted); }
:lang(ka) .lined::placeholder { font-style: normal; }
.voicehint { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--muted); margin: 6px 4px 0; }
.voicehint .icon { width: 16px; height: 16px; }
.flaghint { display: flex; align-items: center; gap: 12px; min-height: 56px; margin: 18px 0 0; padding: 12px 16px; border-radius: var(--r-m); background: var(--terra-soft); color: var(--terra-strong); text-decoration: none; font-weight: 600; font-size: 15.5px; }
.flaghint .icon { color: var(--terra); }
.flaghint .fh-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.flaghint .fh-text small { font-weight: 500; color: var(--text); font-size: 14px; }
.flaghint.hot { background: var(--danger); color: #fff; }
.flaghint.hot .icon, .flaghint.hot small { color: #fff; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 26; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.savebar > div { max-width: 608px; margin: 0 auto; display: flex; gap: 8px; }
.savebar .btn.big { flex: 1; min-height: 58px; font-size: 17.5px; box-shadow: 0 6px 18px rgba(60, 80, 50, .22); }
body.typing .savebar { position: static; padding: 16px 0 0; background: none; }

/* ---------- Ask ---------- */
.convs .row-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 500; }
.msgs { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; }
.msg { display: flex; flex-direction: column; max-width: 100%; }
.msg .who { font-size: 13px; color: var(--muted); margin: 0 12px 4px; }
.bubble { border-radius: 22px; padding: 12px 16px; background: var(--surface); box-shadow: var(--shadow-1); font-size: 17px; line-height: 1.55; }
.msg.user { align-self: flex-end; align-items: flex-end; max-width: 86%; }
.msg.user .bubble { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; white-space: pre-wrap; box-shadow: none; }
.msg.assistant { align-self: flex-start; max-width: 100%; }
.msg.assistant .bubble { border-bottom-left-radius: 6px; }
.msg.assistant .meta { font-size: 13px; color: var(--muted); margin: 6px 12px 0; display: flex; align-items: center; gap: 4px; }
.msg.assistant .meta .icon { width: 14px; height: 14px; }
.msg.error .bubble { background: var(--danger-soft); box-shadow: none; }
.starters { padding: 8px 0; }
.hello { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 12px 8px 16px; }
.hello h2 { margin: 10px 0 4px; }
.hello p { color: var(--muted); font-size: 15px; margin: 4px 0 0; max-width: 34ch; }
.starters .chips { flex-direction: column; align-items: stretch; }
.starter { white-space: normal; text-align: start; justify-content: flex-start; min-height: 54px; line-height: 1.35; border-radius: var(--r-m); }
.composer { position: fixed; z-index: 24; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--bg); padding: 8px 12px 10px; box-shadow: 0 -1px 0 var(--line); }
.composer-inner { max-width: 616px; margin: 0 auto; }
.composer .chips { margin: 0 0 8px; }
.composer .chip { min-height: 44px; padding: 6px 14px; font-size: 13.5px; }
.composer .inputwrap { background: var(--surface); box-shadow: var(--shadow-1); }
body.typing .composer { bottom: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
body.view-ask-detail main { padding-bottom: calc(var(--nav-h) + 150px + env(safe-area-inset-bottom)); }
body.view-ask-detail.typing main { padding-bottom: 150px; }
.chat-status:empty { display: none; }
.busy { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); }
.busy .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1s ease-in-out infinite; box-shadow: 14px 0 0 var(--accent), 28px 0 0 var(--accent); margin-right: 30px; }
@keyframes pulse { 50% { opacity: .3; } }

/* markdown */
.md { font-size: 17px; line-height: 1.6; overflow-x: auto; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md h3, .md h4, .md h5, .md h6 { margin: 20px 0 6px; font-size: 17px; } .md h3 { font: 500 21px/1.25 var(--serif); }
.md p { margin: 0 0 12px; }
.md ul, .md ol { padding-inline-start: 22px; margin: 0 0 12px; } .md li { margin: 4px 0; } .md li::marker { color: var(--muted); }
.md hr { border: 0; height: 1px; background: var(--line); margin: 16px 0; }
.md table, .facts table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 4px 0 12px; font-variant-numeric: tabular-nums; }
.md th, .md td, .facts th, .facts td { padding: 8px 10px; text-align: start; vertical-align: top; box-shadow: inset 0 -1px 0 var(--line); }
.md th, .facts th { font-size: 13px; color: var(--muted); font-weight: 600; }
.md code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.tablewrap { overflow-x: auto; }
.msg.user a.docref { background: rgba(255, 255, 255, .22); color: inherit; }

/* ---------- Records ---------- */
.upload { padding: 16px; }
.upload .up-head { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.upload .up-head p { margin: 0; color: var(--muted); font-size: 15px; }
.upload .row { margin: 0; }
.upload .btn { flex: 1; min-height: 56px; border-radius: var(--r-m); }
.uploads { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.uploads:empty { display: none; }
.uploads li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 10px 12px; border-radius: var(--r-m); background: var(--surface-2); font-size: 15px; }
.uploads .fname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.uploads .small { color: var(--muted); text-align: end; }
.uploads .prog { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.uploads .prog span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.uploads li.ok .prog span { background: var(--ok); } .uploads li.bad .prog { display: none; }
.uploads li.bad .small { grid-column: 1 / -1; text-align: start; color: var(--danger); font-weight: 600; } .uploads li.ok .small { color: var(--ok); font-weight: 600; }
.docs { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.docs > li { background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); }
.docs .rowlink { align-items: flex-start; padding: 14px 16px; border-radius: var(--r-l); }
.docs .row-icon { margin-top: 2px; }
.docs .row-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.docs .doc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; }
.docs .doc-meta .row-sub { margin: 0; }
.dochead { margin: 0 0 16px; padding: 0 4px; }
.dochead h2 { margin: 0 0 8px; overflow-wrap: anywhere; }
.dochead .meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; color: var(--muted); font-size: 15px; }
.factgroup { padding: 12px 0; } .factgroup + .factgroup { box-shadow: inset 0 1px 0 var(--line); }
.factgroup:first-of-type { padding-top: 4px; }
.factgroup h4 { margin: 0 0 6px; font-size: 14px; color: var(--muted); font-weight: 600; }

.factgroup ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.factgroup li { font-size: 17px; line-height: 1.4; padding-inline-start: 16px; position: relative; }
.factgroup li::before { content: ""; position: absolute; inset-inline-start: 2px; top: .58em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.facts .flag { font-weight: 600; color: var(--warn); }
details.card { padding: 4px 16px; }
details.card summary { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; cursor: pointer; list-style: none; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary .icon { transition: transform var(--dur) var(--ease); color: var(--muted); }
details.card[open] summary .icon { transform: rotate(90deg); }
details.card[open] { padding-bottom: 16px; }
.actionbar { display: flex; flex-direction: column; gap: 8px; margin: 16px 0; }
.actionbar .row { margin: 0; flex-wrap: wrap; }
.actionbar .row .btn { flex: 1; }

/* ---------- More / profile ---------- */
.group-label { font-size: 14px; font-weight: 600; color: var(--muted); margin: 24px 20px 8px; }

.langrow { display: flex; align-items: center; gap: 8px 14px; min-height: 64px; padding: 12px 16px 14px 20px; flex-wrap: wrap; }
.langrow > .seg, .langrow > div:last-child { margin-left: 56px; }
.langrow .row-main { min-width: 96px; flex: 1; }
.who { margin: 20px 4px; text-align: center; }
.hero { display: flex; align-items: center; gap: 16px; margin: 0 4px 16px; }
.hero h2 { margin: 0; font-size: 26px; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }
.psec { padding: 12px 16px 16px; }
.psec ul.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.psec ul.plain li { padding: 8px 0; font-size: 17px; line-height: 1.4; }
.psec ul.plain li + li { box-shadow: inset 0 1px 0 var(--line); }
.psec .sub { display: block; font-size: 15px; color: var(--muted); }
.psec p { margin: 0; }
.psec .empty { padding: 4px 0; }
.psec.alert-sec ul.plain li { font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 17px; }
.kv dt { color: var(--muted); font-size: 15px; } .kv dd { margin: 0; font-weight: 500; }
.sumcard { padding: 20px; }
.sumcard > h3 { font: 500 21px var(--serif); }
.sumfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; box-shadow: inset 0 1px 0 var(--line); }
.sumfoot p { margin: 0; }

/* people */
.member { display: flex; align-items: center; gap: 12px; padding: 10px 4px 10px 16px; min-height: 68px; }
.member .row-sub.pending { color: var(--warn); }
.spend .bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 10px 0 8px; }
.spend .bar span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.spend .bar.high span { background: var(--warn); }
.spend .line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.spend .big { font: 500 26px var(--serif); font-variant-numeric: tabular-nums; }
.choices { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-m); border: 0; background: var(--surface-2); color: var(--text); font: inherit; text-align: start; cursor: pointer; min-height: 72px; width: 100%; }
.choice[aria-checked="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.choice .row-icon { background: var(--surface); }
.choice .radio { flex: none; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--faint); }
.choice[aria-checked="true"] .radio { background: var(--accent); box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 5px var(--surface); }
.codebox { text-align: center; padding: 4px 0 8px; }
.code { font-size: 40px; font-weight: 600; letter-spacing: .08em; font-variant-numeric: tabular-nums; font-family: "Roboto Mono", "Noto Sans Mono", "DejaVu Sans Mono", ui-monospace, monospace; margin: 8px 0; color: var(--text); user-select: all; overflow-wrap: anywhere; }
.codebox .muted { font-size: 15px; }
.code-note { text-align: center; margin: 16px 8px 0; }

/* ---------- care setup, module page, changes ---------- */
.condcard { padding: 18px; }
.condcard h3 { font: 500 22px/1.25 var(--serif); margin: 2px 0 6px; }
.condcard p { color: var(--muted); font-size: 15px; margin: 0 0 10px; }
.modgroup { margin-top: 8px; }
.modgroup .gl { display: flex; align-items: baseline; gap: 8px; margin: 22px 4px 8px; }
.modgroup .gl h3 { font: 500 20px var(--serif); margin: 0; }
.modgroup .gl span { color: var(--muted); font-size: 14px; }
.modrow .rowlink { align-items: flex-start; padding: 14px 16px; }
.modrow .row-icon { margin-top: 2px; }
.modrow .row-sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.modrow .chiprow { margin-top: 8px; }
.freq { display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.freq.nearly_all, .freq.common { background: var(--tb-milestone); color: var(--t-milestone); }
.statuschoices .choice { min-height: 64px; align-items: flex-start; }
.statuschoices .row-title { font-size: 16.5px; }
.statuschoices .radio { margin-top: 4px; }
.flagcard { border-left: 4px solid var(--terra); }
.flagcard h4 { font-size: 16.5px; margin: 0 0 4px; }
.flagcard .act { font-weight: 600; color: var(--terra-strong); margin: 6px 0 0; }
.flagcard + .flagcard { margin-top: 8px; }
.watchrow { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; }
.watchrow .wi { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); margin-top: 2px; }
.watchrow .wi.done { background: var(--ok-soft); color: var(--ok); }
.watchrow .wi .icon { width: 18px; height: 18px; }
.qdoc { padding: 10px 16px; }
.qdoc .spec { font-size: 13px; color: var(--muted); font-weight: 600; }
.change { padding: 14px 16px; }
.change .ch-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.change .ch-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.change .ch-who strong { font-size: 15px; }
.change .ch-who span { font-size: 13px; color: var(--muted); }
.change .ch-sum { font-size: 16.5px; line-height: 1.45; margin: 0 0 8px; }
.change .why { font-size: 14.5px; color: var(--muted); margin: 0 0 8px; }
.change .crit { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--terra-strong); margin: 0 0 8px; font-weight: 600; }
.change .crit .icon { width: 18px; height: 18px; color: var(--terra); }
.change .ch-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.change .ch-actions .btn { flex: 1; }
.change .ch-actions.undo { justify-content: flex-end; margin-top: 0; }
.change .ch-actions.undo .btn { flex: none; }
.change .ch-sum:last-child { margin-bottom: 0; }
.change.proposed { box-shadow: var(--shadow-1), inset 0 0 0 2px var(--terra-soft); }
.aiav { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--tb-mood); color: var(--t-mood); }
.cites { display: flex; flex-direction: column; gap: 8px; }
.websrc { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: var(--r-m); background: var(--surface-2); color: inherit; text-decoration: none; }
.websrc .ws-title { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 15px; color: var(--accent-strong); }
.websrc .ws-host { font-size: 13px; color: var(--muted); }
.websrc .ws-quote { font: italic 15px/1.45 var(--serif); color: var(--text); }
:lang(ka) .websrc .ws-quote { font-style: normal; }
.reviewcard { display: flex; flex-direction: column; gap: 10px; }
.reviewcard p { margin: 0; color: var(--muted); font-size: 15px; }

/* ---------- evidence sheet ---------- */
.claimhead h3 { font-size: 24px; margin: 0 0 10px; }
.evlist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.ev { background: var(--surface-2); border-radius: var(--r-m); padding: 12px 14px; }
.ev.against { box-shadow: inset 3px 0 0 var(--warn); }
.ev-head { display: flex; align-items: flex-start; gap: 10px; }
.ev-ic { flex: none; width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--accent-strong); }
.ev-ic .icon { width: 18px; height: 18px; }
.ev-ht { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ev blockquote { margin: 10px 0 6px; padding: 2px 0 2px 12px; border-left: 3px solid var(--surface-3); font: 16px/1.45 var(--serif); }
.ev blockquote.said { font-style: italic; } :lang(ka) .ev blockquote.said { font-style: normal; }
.ev p { margin: 8px 0 0; font-size: 15px; }
.ev .chiprow { margin-top: 8px; }

/* ---------- medical history ---------- */
.gapcard { padding: 14px 16px; }
.gapcard .g-top { display: flex; gap: 12px; align-items: flex-start; }
.gapcard .g-top > .icon { color: var(--terra); margin-top: 2px; }
.gapcard p { margin: 0 0 4px; font-size: 16px; line-height: 1.45; }
.gapcard .sides { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 0; }
.gapcard .side { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; font-size: 14.5px; color: var(--muted); }
.gapcard .row { margin: 10px 0 0; }
.year { margin: 22px 4px 6px; display: flex; align-items: baseline; gap: 10px; }
.year h3 { font: 500 24px var(--serif); margin: 0; }
.year span { color: var(--muted); font-size: 14.5px; }
.claims { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.claimrow { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); border: 0; width: 100%; text-align: start; font: inherit; color: inherit; cursor: pointer; }
.claimrow .cr-top { display: flex; flex-direction: column; gap: 1px; }
.claimrow .cr-subj { font-size: 16.5px; font-weight: 600; line-height: 1.3; }
.claimrow .cr-when { font-size: 13.5px; color: var(--muted); }
.claimrow .cr-kind { font-size: 13.5px; color: var(--muted); }

/* ---------- interview ---------- */
.iv-welcome { text-align: center; padding: 8px 4px 0; }
.iv-welcome .art { width: 180px; height: 135px; margin: 0 auto 8px; }
.iv-welcome h1 { font-size: 32px; margin: 0 0 10px; }
.iv-welcome p { color: var(--muted); margin: 0 auto 12px; max-width: 34ch; }
.iv-time { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--shadow-1); font-size: 14.5px; font-weight: 600; margin-bottom: 18px; }
.iv-sections { list-style: none; padding: 6px 0; margin: 0 0 18px; text-align: start; }
.iv-sections li { display: flex; align-items: center; gap: 12px; padding: 8px 16px; font-size: 15.5px; }
.iv-sections .n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 600; }
.iv-sections .done .n { background: var(--accent); color: var(--on-accent); }
.iv-sections .skipped { color: var(--muted); }
.iv-sections .st { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.iv-top { display: flex; align-items: center; gap: 6px; margin: 0 -8px 6px; }
.iv-top .sec { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.iv-top .sec strong { font-size: 15px; line-height: 1.3; }
.iv-top .sec span { font-size: 13px; color: var(--muted); }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin: 2px 0 18px; }
.progress span { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width var(--dur) var(--ease); }
.iv-q { font: 500 27px/1.25 var(--serif); margin: 6px 4px 18px; }
:lang(ka) .iv-q { font-size: 24px; }
.prefill { padding: 14px 16px; margin: 0 0 16px; background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); }
.prefill p { margin: 0 0 8px; font: 16.5px/1.45 var(--serif); }
.understood { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--r-l); background: var(--accent-soft); }
.understood > p { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 14px; font-weight: 600; color: var(--accent-strong); }
.understood ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.understood li { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 15px; }
.understood li .u-text { flex: 1 1 140px; min-width: 0; }
.understood li .btn { min-height: var(--tap); padding: 6px 14px; font-size: 14px; position: relative; }
.understood li .btn::after { content: ""; position: absolute; inset: -4px 0; }
.ownwords { margin: 18px 0 0; }
.ownwords summary { min-height: var(--tap); display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--accent-strong); cursor: pointer; list-style: none; padding: 0 4px; }
.ownwords summary::-webkit-details-marker { display: none; }
.certrow { margin: 18px 0 0; }
.certrow .ql { display: block; font-size: 15px; font-weight: 600; margin: 0 4px 8px; }
.datebox { display: flex; flex-direction: column; gap: 10px; }
.datebox .chips { margin: 0; }
.ivdone { text-align: center; }
.ivdone .art { width: 170px; height: 128px; margin: 0 auto; }
.ivdone h1 { margin: 8px 0; }
.ivnext { text-align: start; }

/* ---------- emergency card (full screen, high contrast) ---------- */
.emergency, body.em-full { --em-bg: #ffffff; --em-fg: #111111; --em-muted: #4a4a4a; --em-red: #a3001b; --em-red-bg: #fdeceb; --em-act-bg: #fbf3ef; --em-line: #dddddd; --em-chip: #f0f0f0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .emergency, :root:not([data-theme="light"]) body.em-full { --em-bg: #000000; --em-fg: #ffffff; --em-muted: #cfcfcf; --em-red: #ff9a9a; --em-red-bg: #2a0c0c; --em-act-bg: #1a1212; --em-line: #333333; --em-chip: #222222; } }
:root[data-theme="dark"] .emergency, :root[data-theme="dark"] body.em-full { --em-bg: #000000; --em-fg: #ffffff; --em-muted: #cfcfcf; --em-red: #ff9a9a; --em-red-bg: #2a0c0c; --em-act-bg: #1a1212; --em-line: #333333; --em-chip: #222222; }
body.em-full { background: var(--em-bg); }
.emergency .pagehead h2 { font-size: 17px; color: var(--em-fg); font-family: var(--font); font-weight: 600; }
.emergency .back, .emergency .iconbtn { color: var(--em-fg); }
.ecard { background: var(--em-bg); color: var(--em-fg); padding: 0 4px 12px; font-size: 15.5px; line-height: 1.36; }
.ecard p { margin: 0; }
.ecard section { padding: 6px 0; border-top: 1px solid var(--em-line); }
.ecard .ehead { padding: 0 0 6px; }
.ecard .ename { font: 600 28px/1.12 var(--font); margin: 0; letter-spacing: -.015em; color: var(--em-fg); }
.ecard .ebirth { font-size: 15px; color: var(--em-muted); margin: 2px 0 0; }
.ecard .elabel { font: 600 13px/1.2 var(--font); color: var(--em-muted); margin: 0 0 3px; letter-spacing: 0; }
.ecard .ecore { border-top: 0; padding-top: 0; }
.ecard .econd { font-size: 17px; font-weight: 600; }
.ecard .edx { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.ecard .edx li { font-size: 13.5px; padding: 1px 8px; border-radius: 999px; background: var(--em-chip); }
.ecard .eallergy.has { border-top: 0; background: var(--em-red-bg); border-radius: 12px; padding: 7px 12px; margin: 6px 0 4px; }
.ecard .eallergy.has .elabel { color: var(--em-red); }
.ecard .eallergy .ebig { font-size: 18px; font-weight: 600; color: var(--em-red); }
.ecard .erunin { font-weight: 600; }
.ecard .elabel .eaddfam { display: inline-flex; float: right; min-height: 0; font-size: 13px; position: relative; color: var(--em-fg); }
.ecard .elabel .eaddfam::after { content: ""; position: absolute; inset: -14px -4px; }
.ecard .elabel::after { content: ""; display: block; clear: both; }
.ecard .eallergy.has + section { border-top: 0; }
.ecard .eplan { margin: 4px 0 0; padding: 6px 12px; border-radius: 10px; background: var(--em-act-bg); border-left: 5px solid var(--em-red); }
.ecard .eplan p + p { margin-top: 2px; }
.ecard .etrig { font-weight: 600; color: var(--em-red); }
.ecard .elines { list-style: none; margin: 0; padding: 0; }
.ecard .elines li { padding: 1px 0; }
.ecard .econtacts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ecard .econtacts li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.ecard .econtacts .cname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ecard .tel::after { content: ""; position: absolute; inset: -4px 0; }
.ecard .tel { flex: none; position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; white-space: nowrap; font-weight: 600; color: var(--em-fg); text-decoration: underline; text-underline-offset: 3px; font-variant-numeric: tabular-nums; }
.ecard .eaddfam, .ecard .esigns { display: flex; align-items: center; gap: 8px; min-height: 46px; color: var(--em-fg); font-weight: 600; text-decoration: none; }
.ecard .esigns.back { justify-content: flex-start; }
.ecard .esigns { justify-content: space-between; border-top: 1px solid var(--em-line); border-bottom: 1px solid var(--em-line); margin-top: 2px; }
.ecard .emark { font-size: 10px; vertical-align: super; margin-left: 3px; color: var(--em-muted); }
.ecard .updated { font-size: 13px; color: var(--em-muted); padding-top: 8px; }
.ecard .earea { border-top: 1px solid var(--em-line); }
.ecard .earea summary { display: flex; align-items: center; gap: 10px; min-height: 56px; font-weight: 600; cursor: pointer; list-style: none; }
.ecard .earea summary::-webkit-details-marker { display: none; }
.ecard .earea .atitle { flex: 1; }
.ecard .earea .ecount { min-width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; background: var(--em-chip); font-size: 14px; }
.ecard .earea[open] summary .icon { transform: rotate(90deg); }
.ecard .earea ul { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ecard .earea li { display: flex; flex-direction: column; padding-left: 12px; border-left: 4px solid var(--em-red); }
.ecard .notice { font-size: 16px; }

/* ---------- sheets, dialogs, toast ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); opacity: 0; transition: opacity var(--dur) var(--ease); display: flex; align-items: flex-end; justify-content: center; }
.scrim.open { opacity: 1; }
.sheet { width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; background: var(--bg); border-radius: 28px 28px 0 0; padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-2); transform: translateY(32px); transition: transform var(--dur) var(--ease); }
.scrim.open .sheet { transform: none; }
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--surface-3); margin: 4px auto 8px; }
.sheet-head { display: flex; align-items: center; gap: 8px; margin: 0 -12px 12px 0; min-height: var(--tap); }
.sheet-head h2 { flex: 1; margin: 0; font-size: 24px; }
.sheet .lead { margin: -4px 0 16px; }
.sheet .card { background: var(--surface); }
body.sheet-open { overflow: hidden; }
.scrim.center { align-items: center; padding: 24px; }
.dialog { background: var(--surface); border-radius: 28px; padding: 24px; max-width: 400px; width: 100%; box-shadow: var(--shadow-2); transform: scale(.96); transition: transform var(--dur) var(--ease); }
.scrim.open .dialog { transform: none; }
.dialog p { font-size: 17px; margin: 0 0 20px; }
.dialog .dlg-title { font: 500 22px/1.25 var(--serif); margin: 0 0 10px; }
.dialog .row { margin: 0; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 60; background: var(--text); color: var(--bg); padding: 14px 20px; border-radius: var(--r-m); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity var(--dur), transform var(--dur); max-width: 560px; margin: 0 auto; font-size: 15px; font-weight: 500; box-shadow: var(--shadow-2); }
.toast.show { opacity: 1; transform: none; } .toast.error { background: var(--danger); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast.error { color: var(--on-danger); } }
:root[data-theme="dark"] .toast.error { color: var(--on-danger); }
body.focus-mode .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

/* tile editor */
.tedit { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 6px; }
.tedit li { display: flex; align-items: center; gap: 10px; padding: 6px 4px 6px 10px; background: var(--surface); border-radius: var(--r-m); box-shadow: var(--shadow-1); }
.tedit .tbadge { width: 36px; height: 36px; }
.tedit .row-main .row-sub { font-size: 13px; }
.iconpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.iconpick button { height: 52px; border-radius: 16px; border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.iconpick button[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent-strong); }

/* ---------- solo screens (join, consent, add child, offline) ---------- */
.brand { display: flex; align-items: center; gap: 12px; margin: 8px 0 28px; font: 500 24px var(--serif); }
.brand .mark { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.solo h2 { font-size: 30px; margin-bottom: 8px; }
.solo .intro { color: var(--muted); margin-bottom: 24px; }
.solo .card { padding: 20px; }
.solo .art.top { width: 150px; height: 112px; margin: -8px 0 4px auto; display: block; }
.consent-list { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 16px; }
.consent-list li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.5; }
.consent-list li .row-icon { width: 38px; height: 38px; }
.langswitch { margin-top: 24px; text-align: center; }
.loading { display: grid; place-items: center; min-height: 50vh; }


/* ---------- photos, proposals, issues, differential ---------- */
.thumb { position: relative; flex: none; width: 76px; height: 76px; padding: 0; border: 0; border-radius: 16px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; display: block; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb img.broken { visibility: hidden; }
.thumb.big { width: 112px; height: 112px; border-radius: 18px; }
.thumb .tcap { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px; font-size: 13px; font-weight: 500; color: #fff; background: linear-gradient(transparent, rgba(20, 14, 8, .7)); text-align: start; }
.thumb.hero-photo { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 16px; margin-bottom: 12px; }
.msgphotos { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin: 0 0 6px; }
.msgphotos.left { justify-content: flex-start; margin: 10px 0 4px; }
.phototray { display: flex; gap: 8px; margin: 0 0 8px; overflow-x: auto; }
.pthumb { position: relative; flex: none; width: 64px; height: 64px; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pthumb .prog { position: absolute; left: 6px; right: 6px; bottom: 6px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .55); overflow: hidden; }
.pthumb .prog span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.pthumb.ok .prog { opacity: 0; transition: opacity .3s .3s; }
.pthumb.bad { outline: 2px solid var(--danger); outline-offset: -2px; }
.pthumb.pfile { width: 132px; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 30px 12px 10px; }
.pthumb.pfile .icon { width: 20px; height: 20px; color: var(--muted); }
.pthumb.pfile .pname { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pthumb.pfile .psize { font-size: 12px; color: var(--muted); }
.filechip { display: inline-flex; align-items: center; gap: 8px; max-width: 240px; min-height: 48px; padding: 6px 14px 6px 10px; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--surface-3); color: var(--text); text-decoration: none; }
.filechip .icon { flex: none; width: 22px; height: 22px; color: var(--accent-strong); }
.filechip .fc-text { display: flex; flex-direction: column; min-width: 0; text-align: start; }
.filechip .fc-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filechip .fc-meta { font-size: 12px; color: var(--muted); }
.premove { position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(20, 14, 8, .6); color: #fff; cursor: pointer; }
.premove::after { content: ""; position: absolute; inset: -9px; }
.premove .icon { width: 15px; height: 15px; }
.scrim.full { align-items: stretch; background: #120d09; }
.viewer { width: 100%; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; color: #f5eee3; overflow-y: auto; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.viewer .vtop { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; }
.viewer .vtop .iconbtn { color: #f5eee3; }
.viewer .vtitle { flex: 1; font-weight: 500; }
.viewer .vcount { display: flex; }
.viewer .vimg { flex: none; display: grid; place-items: center; touch-action: pinch-zoom; max-height: 62vh; }
.viewer .vimg img { max-width: 100%; max-height: 62vh; object-fit: contain; border-radius: 8px; }
.viewer .vmeta { padding: 12px 20px 24px; }
.viewer .vmeta p { margin: 0 0 8px; }
.viewer .sublabel { color: #cdbfae; margin-top: 8px; }
.viewer .obs dt { color: #cdbfae; }
.viewer.compare .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 8px 20px; }
.viewer.compare figure { margin: 0; }
.viewer.compare .vimg, .viewer.compare .vimg img { max-height: 70vh; }
.viewer.compare figcaption { display: flex; flex-direction: column; gap: 2px; padding: 8px 4px; font-size: 14px; color: #e8dccb; }
.obs { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 15.5px; }
.obs .obsrow { display: contents; }
.obs dt { color: var(--muted); }
.obs dd { margin: 0; }
.proposal { margin-top: 10px; border: 0; box-shadow: var(--shadow-1), inset 0 0 0 1.5px var(--accent-soft); }
.proposal h3 { font-size: 21px; margin: 0; }
.proposal .prow { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.proposal .pquote { margin: 6px 0 4px; padding: 0 0 0 12px; border-left: 3px solid var(--surface-3); font: italic 16px/1.45 var(--serif); }
:lang(ka) .proposal .pquote { font-style: normal; font-family: var(--font); }
.proposal .choices { margin-bottom: 6px; }
.proposal .choice { min-height: 52px; padding: 10px 14px; }
.proposal .ch-actions { margin-top: 14px; display: flex; gap: 8px; }
.proposal .ch-actions .btn { flex: 1; padding-left: 12px; padding-right: 12px; }
.proposal .ch-actions .btn.primary { flex: 1.4; }
.possbox { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--r-m); background: var(--surface-2); border: 1.5px dashed var(--surface-3); }
.possbox .posshead { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 600; color: var(--muted); }
.possbox .possrow { display: flex; flex-direction: column; gap: 2px; }
.possbox .field.check { margin: 10px 0 0; }
.pchips { margin-top: 6px; }
.pchips .plabel { font-size: 13px; color: var(--muted); }
.evchip.pfor, a.docref.pfor { background: var(--ok-soft); color: var(--ok); }
.evchip.pagainst, a.docref.pagainst { background: var(--warn-soft); color: var(--warn); }
.evchip.change { background: var(--tb-mood); color: var(--t-mood); white-space: normal; line-height: 1.3; padding: 5px 10px; font-weight: 500; }
.possrow .ch-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.possrow .ch-actions .btn { flex: 1 1 140px; }
.possrow .ch-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.saved-card { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 10px 10px 10px 16px; flex-wrap: wrap; }
.saved-card .savedok { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: var(--on-accent); }
.saved-card .savedok .icon { width: 20px; height: 20px; }
.timeline-strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -16px; padding-left: 16px; scroll-snap-type: x proximity; }
.timeline-strip .tl-item { scroll-snap-align: start; flex: none; }
.timeline-strip .tl-item.picked .thumb { outline: 3px solid var(--accent); outline-offset: 2px; }
.digest { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0; }
.digest li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 10px 0; box-shadow: inset 0 -1px 0 var(--line); }
.digest .dg-date { font-weight: 600; color: var(--terra); font-variant-numeric: tabular-nums; }
.digest .dg-body { display: flex; flex-direction: column; gap: 6px; }
.digest .dg-words { font: italic 15.5px/1.4 var(--serif); color: var(--muted); quotes: "“" "”"; }
:lang(ka) .digest .dg-words { font-style: normal; font-family: var(--font); }
.possibilities { gap: 10px; }
.possibilities .possrow { margin: 0; }
.possibilities .ch-top { justify-content: space-between; }
.possibilities .ptitle { font-size: 17px; font-weight: 600; }
.possibilities .status-ruled_out .ptitle { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.possibilities .pnote { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 0; font-size: 15px; color: var(--muted); }
.phist { margin-top: 8px; font-size: 14px; }
.phist summary { min-height: 40px; display: inline-flex; align-items: center; cursor: pointer; color: var(--accent-strong); font-weight: 500; }
.row-icon.photo-badge { background: var(--tb-symptom); color: var(--t-symptom); }
.issue-name { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-strong); }


/* ---------- guided tour, help, demo bar ---------- */
.tour { position: fixed; inset: 0; z-index: 70; pointer-events: auto; }
.tour-spot { position: fixed; border-radius: 22px; box-shadow: 0 0 0 200vmax rgba(24, 16, 10, .58); outline: 2px solid rgba(255, 248, 240, .85); outline-offset: 0; transition: left 260ms var(--ease), top 260ms var(--ease), width 260ms var(--ease), height 260ms var(--ease); pointer-events: none; }
.tour.moving .tour-spot { opacity: .85; }
.tour-card { position: fixed; left: 16px; right: 16px; max-width: 420px; margin: 0 auto; background: var(--surface); color: var(--text); border-radius: 22px; padding: 18px 20px 12px; box-shadow: var(--shadow-2); transition: top 260ms var(--ease), opacity 200ms; }
.tour.moving .tour-card { opacity: 0; }
.tour-title { font-size: 22px; margin: 0 0 6px; }
.tour-text { margin: 0 0 12px; color: var(--muted); font-size: 16px; }
.tour-foot { display: flex; align-items: center; gap: 4px; }
.tour-dots { flex: 1; display: flex; gap: 6px; }
.tour-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--surface-3); }
.tour-dots span.on { background: var(--accent); width: 18px; border-radius: 4px; }
.tour-offer { text-align: center; }
.tour-offer .art { margin: 0 auto 6px; }
.tour-offer .row { justify-content: center; }
.helptour { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.helptour .row-main { flex: 1 1 180px; }
.helpsec .hs-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.helpsec .hs-art .art { width: 72px; height: 54px; }
.helpsec .hs-title { display: flex; align-items: center; gap: 8px; font-size: 20px; margin: 0; }
.helpsec .hs-title .icon { color: var(--gold); }
.helpsec p { margin: 0 0 6px; }
.helpnot { background: var(--terra-soft); box-shadow: none; }
.demobar { background: var(--tb-mood); color: var(--t-mood); }
.demobar-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 16px; font-size: 14.5px; font-weight: 500; }
.demobar-inner span { flex: 1; }
.demoinfo { min-height: 40px; padding: 1px 12px 0; border: 0; border-radius: 12px; background: transparent; color: inherit; font: 600 14.5px/1 var(--font); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; position: relative; }
.demoinfo::after { content: ""; position: absolute; inset: -4px 0; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-card { transition: none; } }


/* ---------- records library ---------- */
.upload.compact { margin: 0 0 14px; }
.upload.compact .row { margin: 0; }
.upload.compact .btn { min-height: 52px; }
.upload .up-hint { margin: 8px 4px 0; }
.libtop { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.searchbox { display: flex; align-items: center; gap: 4px; background: var(--surface); border-radius: 16px; box-shadow: inset 0 0 0 1px var(--surface-3); padding: 0 4px 0 14px; }
.searchbox:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.searchbox > .icon { color: var(--muted); }
.searchbox input { border: 0; background: transparent; min-height: 50px; padding: 10px 6px; box-shadow: none; }
.searchbox input:focus, .searchbox input:focus-visible { border: 0; outline: none; }
.searchbox:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.searchbox input::-webkit-search-cancel-button { display: none; }
.filterchips { margin-bottom: 0; }
.filterchips .chip .icon:last-child { width: 14px; height: 14px; margin-left: -2px; }
.activefilters:empty { display: none; }
.activefilters { margin: 2px 0; }
.evchip.removable { min-height: 32px; padding: 0 8px 0 12px; cursor: pointer; background: var(--accent-soft); color: var(--accent-strong); border: 0; font: 500 14px/1 var(--font); position: relative; }
.evchip.removable::after { content: ""; position: absolute; inset: -8px 0; }
.libviews { display: flex; flex-direction: column; gap: 0; }
.libviews .chips { margin-bottom: 0; }
.libactions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.libactions .small-btn { margin: 0; }
.libcount { margin-left: auto; color: var(--muted); font-size: 14px; padding-right: 4px; }
.libgroup { margin-bottom: 8px; }
.libhead { position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top)); z-index: 4; display: flex; align-items: baseline; gap: 10px; margin: 0 -16px; padding: 12px 20px 8px; background: var(--bg); font: 500 22px/1.2 var(--serif); letter-spacing: -.01em; }
:lang(ka) .libhead { font-family: var(--font); font-size: 19px; }
.count-soft { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font: 600 13px/1 var(--font); }
.libcard { align-items: flex-start; }
.libcard .snippet.one { -webkit-line-clamp: 1; }
.libcard .snippet.hit { -webkit-line-clamp: 3; }
.libcard mark { background: var(--tb-mood); color: var(--t-mood); border-radius: 4px; padding: 0 2px; }
.libchips { margin-top: 8px; }
.evchip.facts { background: var(--ok-soft); color: var(--ok); }
.libthumb { flex: none; width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: var(--surface-2); margin-top: 2px; }
.libthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.selbox { flex: none; width: 26px; height: 26px; border-radius: 8px; box-shadow: inset 0 0 0 2px var(--faint); display: grid; place-items: center; margin-top: 4px; color: var(--on-accent); }
.selbox.on { background: var(--accent); box-shadow: none; }
.docs > li:has(.libcard.selected) { box-shadow: var(--shadow-1), inset 0 0 0 2px var(--accent); }
.selbar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 27; background: var(--surface); box-shadow: 0 -1px 0 var(--line), 0 -6px 18px rgba(60, 40, 20, .08); }
.selbar-inner { max-width: 640px; margin: 0 auto; display: flex; gap: 6px; align-items: center; padding: 8px 12px; flex-wrap: wrap; }
.selbar .selcount { flex: 1 1 100%; font-weight: 600; font-size: 15px; padding: 0 4px; }
.selbar .btn { flex: 1; padding-left: 10px; padding-right: 10px; font-size: 15px; }
.selecting main { padding-bottom: calc(var(--nav-h) + 150px); }
.choice.facet { min-height: 56px; }
.choice .checkbox { flex: none; width: 22px; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 2px var(--faint); }
.choice[aria-checked="true"] .checkbox { background: var(--accent); box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 5px var(--surface); }

/* ---------- pressed state and confirmations ---------- */
:is(.btn, .chip, .tile, .thumb, .ctile, .dur, .scale button, .stepper button, .yesno button, .seg button, .rowlink, .jlink, .claimrow, .choice, .iconbtn, .back, .sos, .bigcheck, .tick, .sendbtn, .fab, .stat, .storycard, .linkbtn):active:not([disabled]) { transform: scale(.97); filter: brightness(.95); transition: transform 90ms ease-out, filter 90ms ease-out; }
:is(.rowlink, .jlink, .tick, .choice, .claimrow):active:not([disabled]) { transform: scale(.985); }
.icon.draw path { stroke-dasharray: 26; animation: draw 260ms ease-out both; }
@keyframes draw { from { stroke-dashoffset: 26; } }
.pop { animation: pop 260ms cubic-bezier(.3, .7, .4, 1.4); }
@keyframes pop { 50% { transform: scale(1.12); } }
.btn.is-done { background: var(--ok); color: var(--on-accent); }
.toast .tact { margin-left: auto; min-height: 48px; padding: 1px 14px 0; border: 0; border-radius: 12px; background: transparent; color: inherit; font: 600 15px/1 var(--font); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.toast.has-action { display: flex; align-items: center; gap: 12px; pointer-events: auto; padding: 4px 6px 4px 20px; }
.uploads .small .icon { display: inline-block; vertical-align: -3px; width: 16px; height: 16px; margin-right: 4px; }

/* ---------- view transitions ---------- */
.view { animation: viewin var(--dur) var(--ease); }
@keyframes viewin { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  :is(.btn, .chip, .tile, .ctile, .dur, .scale button, .stepper button, .yesno button, .seg button, .rowlink, .jlink, .claimrow, .choice, .iconbtn, .back, .sos, .bigcheck, .tick, .sendbtn, .fab, .stat, .storycard, .linkbtn):active { transform: none !important; }
}

@media (max-width: 359px) {
  .sos span { display: none; }
  .sos { padding: 0 12px; }
  .durgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media print {
  body, body.em-full { background: #fff; color: #000; font-size: 12pt; }
  .tabs, .appbar, #banner, .pagehead, .back, .noprint, .toast, .btn, .chips, .fab, .composer, .savebar { display: none !important; }
  main { max-width: none; padding: 0; }
  .card, .list, .docs > li, .stat { box-shadow: none; border: 1px solid #999; }
  .ecard { --em-bg: #fff; --em-fg: #000; --em-muted: #333; --em-red: #000; --em-red-bg: #fff; --em-act-bg: #fff; --em-chip: #fff; font-size: 11.5pt; line-height: 1.35; }
  .ecard .ename { font-size: 20pt; }
  .ecard section { padding: 6px 0; }
  .ecard .eplan, .ecard .eallergy.has { border: 1.5px solid #000; }
  .ecard .tel { min-height: 0; }
  .md table, .md th, .md td { box-shadow: none; border: 1px solid #000; }
  a { color: #000; text-decoration: none; }
  a.docref, button.cite { border: 1px solid #000; background: none; color: #000; }
}
