/* Kartavya family dashboard, simple view: a calm, traditional health-app layout.
   White panels on a soft grey page, a side menu, plain tables and charts, large readable type. */

:root {
  --bg: #f2f5f7;
  --surface: #ffffff;
  --sunk: #f7f9fa;
  --text: #1a2730;
  --muted: #55636d;
  --line: #dde4e9;
  --line-2: #c8d2d9;
  --pri: #1f7a6f;
  --pri-bg: #1f7a6f;
  --pri-h: #176359;
  --pri-soft: #e4f2ef;
  --acc: #b4501a;
  --focus: #0b6bcb;
  --l0: #23825a; --l0s: #e7f4ec;
  --l1: #a3630d; --l1s: #fbf1e0;
  --l2: #b4501a; --l2s: #fbebe1;
  --l3: #b3261e; --l3s: #fbe8e6;
  --shadow: 0 1px 2px rgba(16, 32, 44, .06), 0 2px 10px rgba(16, 32, 44, .05);
  --on-l: #fff; --bar: #9fcfc8; --bar-hi: #1f7a6f;
  --r: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c151b; --surface: #131f27; --sunk: #0f1a21; --text: #e6edf1; --muted: #9db0bb; --line: #22333e; --line-2: #2f4351;
    --pri: #4cbfae; --pri-soft: #12302c; --acc: #f08a4c; --focus: #f2c879;
    --l0: #4cc58e; --l0s: #11291e; --l1: #e5a530; --l1s: #2c2210; --l2: #f08a4c; --l2s: #2f1c12; --l3: #f26b64; --l3s: #331515;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
    --on-l: #0c151b; --bar: #2c5d57; --bar-hi: #4cbfae;
  }
}
:root[data-theme="dark"] {
  --bg: #0c151b; --surface: #131f27; --sunk: #0f1a21; --text: #e6edf1; --muted: #9db0bb; --line: #22333e; --line-2: #2f4351;
  --pri: #4cbfae; --pri-soft: #12302c; --acc: #f08a4c; --focus: #f2c879;
  --l0: #4cc58e; --l0s: #11291e; --l1: #e5a530; --l1s: #2c2210; --l2: #f08a4c; --l2s: #2f1c12; --l3: #f26b64; --l3s: #331515;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  --on-l: #0c151b; --bar: #2c5d57; --bar-hi: #4cbfae;
}
html { font-size: 16px; }
html[data-fs="-1"] { font-size: 14px; }
html[data-fs="1"] { font-size: 18px; }
html[data-fs="2"] { font-size: 20px; }
*, *::before, *::after { box-sizing: border-box; }
body.sd { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.55 "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.sd :is(h1, h2, h3, p, ul, ol, dl, dd, figure) { margin: 0; padding: 0; }
.sd :is(ul, ol) { list-style: none; }
:where(.sd) a { color: var(--pri); }
:where(.sd) button { font: inherit; color: inherit; cursor: pointer; }
.sd [hidden] { display: none !important; }
.sd :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 300; padding: 10px 16px; border-radius: 8px; background: #fff; color: #000; font-weight: 700; transition: top .2s; }
.skip:focus { top: 12px; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.sm { font-size: .875rem; }
.nw { white-space: nowrap; }

/* ---------- buttons, chips, avatars ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1.5px solid transparent; border-radius: 8px; font-weight: 600; font-size: .95rem; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn-pri { background: var(--pri-bg); color: #fff; }
.btn-pri:hover { background: var(--pri-h); }
.btn-ghost { background: var(--surface); border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover { border-color: var(--pri); color: var(--pri); }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: .875rem; }
.tool { display: inline-grid; place-items: center; position: relative; min-width: 40px; height: 40px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; font-weight: 700; font-size: .9rem; color: var(--text); text-decoration: none; }
.tool:hover { background: var(--sunk); }
.av { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--pri-soft); color: var(--pri); font-weight: 700; font-size: .85rem; }
.av-s { width: 32px; height: 32px; font-size: .75rem; }
.av-l { width: 60px; height: 60px; font-size: 1.15rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; background: var(--sunk); color: var(--muted); border: 1px solid var(--line); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-ok { background: var(--l0s); color: var(--l0); border-color: transparent; }
.chip-warn { background: var(--l1s); color: var(--l1); border-color: transparent; }
.chip-bad, .chip-told { background: var(--l2s); color: var(--l2); border-color: transparent; }
.chip-seen { background: var(--pri-soft); color: var(--pri); border-color: transparent; }
.chip-go { background: var(--l0s); color: var(--l0); border-color: transparent; }
.lv { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.lv-0 { background: var(--l0s); color: var(--l0); }
.lv-1 { background: var(--l1s); color: var(--l1); }
.lv-2 { background: var(--l2s); color: var(--l2); }
.lv-3 { background: var(--l3s); color: var(--l3); }
.yes { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--l0s); color: var(--l0); }
.yes .ic { width: 16px; height: 16px; stroke-width: 2.4; }
.no { color: var(--muted); }
.ok-dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; background: var(--l0); vertical-align: middle; }

/* ---------- header ---------- */
.hd { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 18px; height: 64px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.hd-logo { display: flex; }
.hd-logo img { height: 36px; width: auto; }
.lg-d { display: none; }
:root[data-theme="dark"] .lg-l { display: none; }
:root[data-theme="dark"] .lg-d { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lg-l { display: none; } :root:not([data-theme="light"]) .lg-d { display: block; } }
.hd-app { padding-left: 18px; border-left: 1px solid var(--line); font-weight: 700; color: var(--muted); font-size: .95rem; white-space: nowrap; }
.hd-who { display: flex; align-items: center; gap: 10px; margin-left: 8px; padding: 6px 14px 6px 6px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); font-size: .92rem; white-space: nowrap; }
.hd-who small { color: var(--muted); }
.hd-r { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--sunk); border: 1px solid var(--line); }
.seg a { padding: 6px 14px; border-radius: 7px; font-size: .85rem; font-weight: 700; color: var(--muted); text-decoration: none; }
.seg a[aria-current] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.hd-tools { display: flex; gap: 2px; padding-right: 8px; border-right: 1px solid var(--line); }
.hd-bell .dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--l3); box-shadow: 0 0 0 2px var(--surface); }
.me { position: relative; }
.me-btn { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border: 0; border-radius: 999px; background: transparent; font-weight: 600; }
.me-btn:hover { background: var(--sunk); }
.me-btn .ic { width: 16px; height: 16px; }
.me-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 240px; padding: 8px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0, 0, 0, .14); }
.me-pop p { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.me-pop p small { display: block; color: var(--muted); font-size: .8rem; }
.me-pop a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .92rem; }
.me-pop a:hover { background: var(--sunk); }
.me-tools { display: none; align-items: center; gap: 4px; padding: 6px 10px; border-top: 1px solid var(--line); margin-top: 6px; }
.me-tools span { margin-right: auto; font-size: .85rem; color: var(--muted); }
@media (max-width: 640px) { .me-tools { display: flex; } }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.side { position: sticky; top: 64px; align-self: start; display: flex; flex-direction: column; gap: 2px; height: calc(100vh - 64px); overflow-y: auto; padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--line); }
.side a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.side a:hover { background: var(--sunk); }
.side a[aria-current] { background: var(--pri-soft); color: var(--pri); font-weight: 700; box-shadow: inset 3px 0 0 var(--pri); }
.side a .ic { color: var(--muted); }
.side a[aria-current] .ic { color: var(--pri); }
.badge { margin-left: auto; padding: 1px 8px; border-radius: 6px; font-size: .72rem; font-weight: 800; }
.side-note { display: flex; gap: 8px; margin-top: auto; padding: 12px; border-radius: 8px; background: var(--sunk); font-size: .8rem; color: var(--muted); }
.side-note .ic { width: 16px; height: 16px; margin-top: 2px; }
main { min-width: 0; padding: 18px 28px 40px; }
.sd #main:focus { outline: none; }
.demo { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--surface); font-size: .85rem; }
.demo-l { margin-right: 4px; color: var(--muted); }
.demo-l b { margin-right: 6px; padding: 2px 7px; border-radius: 5px; background: var(--text); color: var(--surface); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.demo button { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600; }
.demo button i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.demo button[aria-pressed="true"] { border-color: var(--text); background: var(--text); color: var(--surface); }
.pg-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.crumb { display: flex; gap: 8px; font-size: .85rem; color: var(--muted); }
.crumb a { color: var(--muted); }
.pg-h h1 { font-size: 1.6rem; font-weight: 700; line-height: 1.25; }
.pg-d { text-align: right; font-weight: 600; }
.pg-d small { display: block; color: var(--muted); font-weight: 400; font-size: .85rem; }
.foot-note { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }

.g { display: grid; gap: 18px; margin-bottom: 18px; }
.g-11 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-13 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-31 { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); }
.stack { display: grid; gap: 18px; align-content: start; }
#view > .pn { margin-bottom: 18px; }

/* ---------- panels ---------- */
.pn { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.pn-h { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.pn-h h2 { display: flex; align-items: center; gap: 10px; font-size: 1.02rem; font-weight: 700; }
.pn-h h2 .ic { color: var(--pri); }
.pn-l { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; font-size: .875rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.pn-l:hover { text-decoration: underline; }
.pn-l .ic { width: 16px; height: 16px; }
.pn-h .tabs, .pn-h > .btn { margin-left: auto; }
.pn-b { padding: 16px 18px; }
.pn-b > * + * { margin-top: 12px; }

/* status banner */
.st { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: start; margin-bottom: 18px; padding: 20px 22px; border-radius: var(--r); border: 1px solid var(--line); border-left: 6px solid var(--lc); background: var(--ls); }
.st-0 { --lc: var(--l0); --ls: var(--l0s); }
.st-1 { --lc: var(--l1); --ls: var(--l1s); }
.st-2 { --lc: var(--l2); --ls: var(--l2s); }
.st-3 { --lc: var(--l3); --ls: var(--l3s); }
.st-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--lc); color: var(--on-l); }
.st-ic .ic { width: 24px; height: 24px; stroke-width: 2.2; }
.lvs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.lvs li { padding: 2px 10px; border-radius: 5px; font-size: .75rem; font-weight: 700; color: var(--muted); background: var(--surface); border: 1px solid var(--line); }
.lvs li.on { background: var(--lc); color: var(--on-l); border-color: var(--lc); }
.st h2 { font-size: 1.35rem; line-height: 1.3; }
.st-p { margin-top: 4px; max-width: 70ch; }
.st-told { display: flex; gap: 8px; margin-top: 10px; font-size: .92rem; }
.st-told .ic { margin-top: 2px; color: var(--lc); }
.st-a { display: flex; flex-direction: column; gap: 8px; min-width: 200px; }
.inc { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.inc li { padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); font-size: .8rem; }
.inc li b { display: block; line-height: 1.3; }
.inc li small { color: var(--muted); }
.inc-d { display: grid; place-items: center; width: 20px; height: 20px; margin-bottom: 4px; border-radius: 50%; border: 2px dashed var(--line-2); }
.inc li.done .inc-d { border: 0; background: var(--lc); color: var(--on-l); }
.inc-d .ic { width: 13px; height: 13px; stroke-width: 3; }
.cd { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-weight: 600; font-size: .92rem; color: var(--lc); }

/* person + glance */
.pc { display: flex; align-items: center; gap: 14px; }
.pc-n { font-size: 1.15rem; font-weight: 700; }
.pc-n small { font-weight: 500; color: var(--muted); }
.pc-m { color: var(--muted); }
.dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.dl dt { color: var(--muted); }
.dl dd { text-align: right; font-weight: 600; }
.dl-2 { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; }
.gl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gl li { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; border-radius: 8px; background: var(--sunk); border: 1px solid var(--line); }
.gl-l { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.gl-l .ic { width: 18px; height: 18px; color: var(--pri); }
.gl-v { margin-top: 4px; font-size: 1.55rem; font-weight: 700; line-height: 1.2; }
.gl-s { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.gl .chip { margin-top: auto; }

/* tables */
.tw { overflow-x: auto; }
.tb { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tb th, .tb td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.tb thead th { background: var(--sunk); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
.tb td small { display: block; color: var(--muted); font-size: .8rem; }
.tb .r { text-align: right; }
.tb tbody tr:last-child td { border-bottom: 0; }
.tb tbody tr:hover { background: var(--sunk); }
.tb tr.tn-watch td:first-child { box-shadow: inset 4px 0 0 var(--l1); }
.tb tr.tn-chk td:first-child { box-shadow: inset 4px 0 0 var(--l2); }
.tb tr.tn-resp td:first-child { box-shadow: inset 4px 0 0 var(--l3); }
.tb tr.tn-resp { background: var(--l3s); }
.tb tr.tn-ai td:first-child { box-shadow: inset 4px 0 0 var(--pri); }
.tb tr.cur { background: var(--pri-soft); }
.mx th[scope="row"] { font-weight: 600; }
.mx td { text-align: center; }
.mx thead th:not(:first-child) { text-align: center; }

/* AI, tips, appointments, people, devices */
.pn-ai { border-top: 3px solid var(--pri); }
.ai-t { font-size: .98rem; }
.tips li { display: flex; gap: 6px; padding: 4px 0; font-size: .92rem; }
.tips .ic { width: 16px; height: 16px; margin-top: 4px; color: var(--pri); }
.aps { display: grid; gap: 12px; }
.ap { display: flex; gap: 14px; }
.ap-d { display: grid; place-items: center; align-content: center; width: 58px; height: 62px; flex: none; border-radius: 8px; background: var(--pri-soft); color: var(--pri); }
.ap-d small { font-size: .7rem; font-weight: 800; letter-spacing: .1em; }
.ap-d b { font-size: 1.4rem; line-height: 1; }
.ap-w { font-weight: 700; }
.ap-s { font-size: .85rem; color: var(--muted); }
.ppl li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ppl li:first-child { border-top: 0; padding-top: 0; }
.ppl li > div { flex: 1; min-width: 0; }
.ppl .chip { margin-left: auto; }
.dv-sum { display: flex; align-items: center; flex-wrap: wrap; }
.dvl li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.dvl small { display: block; color: var(--muted); font-size: .8rem; }
.dv-c { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 4px; border-radius: 50%; font-size: .66rem; font-weight: 800; vertical-align: middle; }
.dv-w { background: var(--sunk); color: var(--text); border: 1.5px solid var(--line-2); }
.dv-t { background: var(--pri-soft); color: var(--pri); }
.dv-o { background: var(--l2s); color: var(--l2); }

/* activity, sleep */
.tabs { display: inline-flex; padding: 3px; border-radius: 8px; background: var(--sunk); border: 1px solid var(--line); }
.tabs button { padding: 4px 12px; border: 0; border-radius: 6px; background: transparent; font-size: .85rem; font-weight: 600; color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.kpi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kpi > div { padding: 10px 14px; border-left: 3px solid var(--line); }
.kpi > div:first-child { border-color: var(--pri); }
.kpi-v { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.kpi .muted { font-size: .82rem; }
.rm li { display: grid; grid-template-columns: 150px 1fr 64px; gap: 10px; align-items: center; padding: 6px 0; font-size: .9rem; }
.rm li span:first-child { display: flex; align-items: center; gap: 8px; }
.rm .ic { width: 16px; height: 16px; color: var(--pri); }
.rm-bar { height: 8px; border-radius: 4px; background: var(--sunk); border: 1px solid var(--line); overflow: hidden; }
.rm-bar i { display: block; width: var(--w); height: 100%; background: var(--pri); }
.rm b { text-align: right; font-size: .85rem; }
.trend { font-size: 1.3rem; font-weight: 700; }
.ml li { display: grid; grid-template-columns: 90px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.ml li:first-child { border-top: 0; }
.ml span { color: var(--muted); }
.nb-key { display: flex; gap: 16px; font-size: .82rem; color: var(--muted); }
.nb-key li { display: flex; align-items: center; gap: 6px; }
.nb-key i { width: 14px; height: 10px; border-radius: 3px; }
.k-settle { background: #9cc9c2; }
.k-asleep { background: var(--pri); }
.k-up { background: var(--acc); }
.note { display: flex; gap: 12px; margin-bottom: 18px; padding: 14px 16px; border-radius: var(--r); background: var(--l1s); border: 1px solid var(--line); font-size: .92rem; }
.note .ic { margin-top: 2px; color: var(--l1); }

/* chat */
.chat { display: flex; flex-direction: column; gap: 10px; height: 300px; overflow-y: auto; padding: 14px; border-radius: 8px; background: var(--sunk); border: 1px solid var(--line); }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 12px 12px 12px 4px; background: var(--surface); border: 1px solid var(--line); font-size: .92rem; }
.msg.me { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: var(--pri-bg); border-color: var(--pri-bg); color: #fff; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: tp 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes tp { 50% { opacity: .25; transform: translateY(-3px); } }
.sug { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-b { padding: 5px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); font-size: .82rem; font-weight: 600; }
.chip-b:hover { border-color: var(--pri); color: var(--pri); }
.ask { display: flex; gap: 8px; }
.ask input, .nf input[type="text"] { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1.5px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.ask input:focus, .nf input:focus { border-color: var(--pri); outline: none; box-shadow: 0 0 0 3px var(--pri-soft); }
.ck li { display: flex; gap: 8px; padding: 4px 0; font-size: .92rem; }
.ck .ic { width: 18px; height: 18px; margin-top: 2px; color: var(--l0); stroke-width: 2.4; }
.ck li.x .ic { color: var(--l3); }

/* floor plan, light version */
.pl-wrap { padding: 8px; border-radius: 8px; background: var(--sunk); border: 1px solid var(--line); }
.pl { display: block; width: 100%; height: auto; }
.pl-out { fill: var(--surface); stroke: var(--line-2); stroke-width: 2; }
.pl-room { fill: transparent; transition: fill .3s; }
.pl-room.is-here { fill: var(--pri-soft); }
.pl-room.is-alert { fill: var(--l3s); }
.pl-wall { fill: none; stroke: var(--line-2); stroke-width: 2; }
.pl-lbl text { font: 800 10.5px "Noto Sans", sans-serif; letter-spacing: 1.2px; fill: var(--muted); }
.pl-trail { fill: none; stroke: var(--pri); stroke-width: 2; stroke-dasharray: 4 5; opacity: .6; }
.pl-dev circle { stroke-width: 1.5; }
.pl-dev text { font: 800 8.5px "Noto Sans", sans-serif; }
.pl-w circle { fill: var(--surface); stroke: var(--text); }
.pl-w text { fill: var(--text); }
.pl-t circle { fill: #1f7a6f; stroke: #fff; }
.pl-t text, .pl-o text { fill: #fff; }
.pl-o circle { fill: #c65d1e; stroke: #fff; }
.pl-dot { fill: #e2a63b; stroke: #fff; stroke-width: 2; }
.pl-me.is-alert .pl-dot { fill: var(--l3); }
.pl-pulse { fill: #e2a63b; transform-box: fill-box; transform-origin: center; animation: plp 2s ease-out infinite; }
.pl-pulse.p2 { animation-delay: 1s; }
.pl-me.is-alert .pl-pulse { fill: var(--l3); }
@keyframes plp { from { transform: scale(1); opacity: .6; } to { transform: scale(3.4); opacity: 0; } }

/* notes */
.nt li { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.nt li:first-child { border-top: 0; padding-top: 0; }
.nt-d { font-weight: 700; color: var(--acc); }
.nf { display: grid; gap: 12px; }
.nf label { display: grid; gap: 4px; font-size: .9rem; font-weight: 600; }
.nf .chk { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.nf .chk input { width: 18px; height: 18px; accent-color: var(--pri-bg); }

/* charts */
.ch { display: block; width: 100%; height: auto; overflow: visible; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-ax, .ch-x { font: 500 14px "Noto Sans", sans-serif; fill: var(--muted); }
.ch-x.is-hi { font-weight: 800; fill: var(--text); }
.ch-bar { fill: var(--bar); transform-box: fill-box; transform-origin: bottom; animation: chg .7s calc(var(--i) * 45ms) cubic-bezier(.2, .7, .2, 1) both; }
.ch-bar.is-hi { fill: var(--bar-hi); }
@keyframes chg { from { transform: scaleY(0); } }
.ch-avg { stroke: var(--acc); stroke-width: 2; stroke-dasharray: 6 5; }
.ch-avg-t { font: 700 14px "Noto Sans", sans-serif; fill: var(--acc); }
.ch-mark { stroke: var(--l1); stroke-width: 1.5; stroke-dasharray: 3 4; }
.ch-mark-t { font: 700 13px "Noto Sans", sans-serif; fill: var(--l1); }
.nb { display: block; width: 100%; height: auto; }
.nb-track { fill: var(--sunk); stroke: var(--line); }
.nb-settle { fill: #9cc9c2; }
.nb-asleep { fill: var(--pri-bg); }
.nb-up { fill: var(--acc); }
.nb-t { font: 500 14px "Noto Sans", sans-serif; fill: var(--muted); }

/* doctor summary dialog */
.dlg { width: min(100% - 32px, 760px); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.dlg::backdrop { background: rgba(12, 21, 27, .55); }
.dlg-bar { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.dlg-bar h2 { font-size: 1.05rem; }
.dlg-bar > div { display: flex; gap: 6px; }
.dlg-body { padding: 22px; }
.ds { display: grid; gap: 18px; font-size: .92rem; }
.ds-h { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 2px solid var(--text); }
.ds-h h2 { font-size: 1.4rem; }
.ds-k { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--pri); }
.ds-badge { align-self: start; padding: 4px 10px; border-radius: 6px; background: var(--pri-soft); color: var(--pri); font-weight: 700; font-size: .8rem; white-space: nowrap; }
.ds h3 { margin-bottom: 6px; font-size: .95rem; }
.ds ul, .ds ol { padding-left: 20px; list-style: disc; }
.ds ol { list-style: decimal; }
.kv-table { width: 100%; border-collapse: collapse; }
.kv-table th, .kv-table td { padding: 7px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.kv-table th { width: 46%; font-weight: 500; color: var(--muted); }
.ds-f { padding-top: 10px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }

/* toast */
.kv-toast { position: fixed; left: 50%; bottom: 24px; z-index: 400; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 10px; background: #1a2730; color: #fff; font-weight: 600; font-size: .92rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.kv-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- smaller screens ---------- */
@media (max-width: 1180px) {
  .hd-app, .me-n { display: none; }
  .g-13 { grid-template-columns: 1fr; }
  .inc { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 64px; z-index: 40; flex-direction: row; height: auto; padding: 8px 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .side a { flex: none; padding: 8px 12px; white-space: nowrap; }
  .side a[aria-current] { box-shadow: inset 0 -3px 0 var(--pri); }
  .side-note { display: none; }
  .g-11, .g-21, .g-31 { grid-template-columns: 1fr; }
  .hd-who { display: none; }
}
@media (max-width: 640px) {
  .hd { gap: 8px; padding: 0 12px; }
  .hd-tools, .me-btn > .ic { display: none; }
  .seg a { padding: 6px 11px; }
  main { padding: 14px 14px 32px; }
  .pg-h { flex-direction: column; align-items: flex-start; }
  .pg-d { text-align: left; }
  .st { grid-template-columns: 1fr; padding: 16px; }
  .st-ic { width: 40px; height: 40px; }
  .st-a { min-width: 0; }
  .gl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { grid-template-columns: 1fr; }
  .inc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl-2 { grid-template-columns: 1fr; }
  .rm li { grid-template-columns: 120px 1fr 54px; }
  .nt li { grid-template-columns: 1fr; gap: 4px; }
  .tb th, .tb td { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  body.sd > :not(.dlg) { display: none !important; }
  .dlg { position: static; display: block; width: auto; max-height: none; box-shadow: none; }
  .dlg-bar { display: none; }
}
