/* Cartella demo — components. Colours and font come from ../assets/styles.css (site tokens). */
:root {
  --ok: var(--chart-3);
  --warn: oklch(70% .15 65);
  --warn-bg: oklch(96% .04 80);
  --bad: var(--destructive);
  --bad-bg: oklch(96% .03 20);
  --ok-bg: oklch(96% .03 220);
  --shadow: 0 1px 2px color-mix(in oklab, var(--foreground) 8%, transparent);
}
body { font-family: var(--font-sans); background: var(--surface); color: var(--foreground); font-size: 15px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
h2 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.main { padding-top: 24px; padding-bottom: 64px; }
.muted { color: var(--muted-foreground); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; color: var(--foreground); }
.center { text-align: center; }
.num { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.eyebrow { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-foreground); margin-bottom: 6px; font-weight: 500; }
.unit { font-size: 11px; font-weight: 500; color: var(--muted-foreground); margin-left: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pad { padding: 16px; }

/* top bar */
.topbar { background: var(--background); border-bottom: 1px solid var(--hairline); position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: center; gap: 28px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.demo-tag { font-size: 11px; font-weight: 600; color: var(--accent-foreground); background: var(--accent); border-radius: 999px; padding: 2px 8px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-link { color: var(--muted-foreground); padding: 6px 12px; border-radius: 8px; font-size: 14px; }
.nav-link:hover { color: var(--foreground); background: var(--muted); text-decoration: none; }
.nav-link.active { color: var(--foreground); background: var(--secondary); font-weight: 600; }
.who { display: flex; align-items: center; gap: 8px; }
.demo-banner { background: var(--secondary); color: var(--secondary-foreground); font-size: 12.5px; padding: 6px 0; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: var(--radius); font-size: 14px; font-weight: 500; border: 1px solid transparent; cursor: pointer; white-space: nowrap; background: none; color: var(--foreground); }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { opacity: .9; }
.btn-outline { border-color: var(--input); background: var(--background); }
.btn-outline:hover, .btn-ghost:hover { background: var(--muted); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.icon-btn { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted-foreground); padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--muted); color: var(--foreground); }
.input, .select { height: 38px; border: 1px solid var(--input); border-radius: var(--radius); padding: 0 10px; font: inherit; font-size: 14px; background: var(--background); color: var(--foreground); width: 100%; }
textarea.input { height: auto; padding: 8px 10px; line-height: 1.5; resize: vertical; }
input[type=file].input { padding: 7px 10px; }
.input:focus, .select:focus, .btn:focus-visible, .chip:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.who .select { width: auto; height: 34px; }
.check { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 140px 1fr 80px; gap: 12px; }

/* cards & layout */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-flush { padding: 0; overflow-x: auto; }
.card-title { font-size: 15px; margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-good { background: var(--ok-bg); border-color: color-mix(in oklab, var(--ok) 25%, var(--border)); }
.card-focus { background: var(--accent); border-color: color-mix(in oklab, var(--primary) 25%, var(--border)); }
.card-alert { border-color: color-mix(in oklab, var(--warn) 45%, var(--border)); }
.card.empty { text-align: center; padding: 48px; }
.card.empty .btn { margin-top: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.page-head p.muted { margin-top: 4px; }
.page-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.hero-row { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-bottom: 16px; }
.hero-row h2 { margin-bottom: 14px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.cols-3 { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 16px; align-items: start; }
.cols-2 > .card, .cols-3 > .card, .hero-row > .card, .stack > .card { margin-bottom: 0; }
.cols-2, .cols-3 { margin-bottom: 16px; }
.cols-2 > *, .cols-3 > *, .hero-row > *, .notes-layout > *, .stack > * { min-width: 0; }

/* kpis, chips, toolbar */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; display: flex; flex-direction: column; text-align: left; font: inherit; color: inherit; }
.kpi b { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.kpi span { font-size: 13px; color: var(--muted-foreground); }
.kpi-alert { cursor: pointer; border-color: color-mix(in oklab, var(--warn) 50%, var(--border)); background: var(--warn-bg); }
.kpi-alert:hover { border-color: var(--warn); }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--foreground); }
.chip:hover { border-color: var(--input); }
.chip-on { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.chip-n { font-size: 11.5px; opacity: .75; margin-left: 2px; }
.search { max-width: 280px; }

/* tables & lists */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-foreground); font-weight: 500; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--muted); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th.num, .table td.num { text-align: right; }
.table th.center, .table td.center { text-align: center; }
.rows-link tbody tr { cursor: pointer; }
.rows-link tbody tr:hover td { background: var(--accent); }
.card > .table th:first-child { border-top-left-radius: 12px; }
.list { list-style: none; }
.list > li { padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.list > li:last-child { border-bottom: 0; }
.mrow, .supp, .appt { display: flex; align-items: center; gap: 14px; }
.mrow a:hover { text-decoration: none; }
.mrow a:hover .strong { color: var(--primary); }
.val { font-weight: 700; font-size: 17px; text-align: right; min-width: 70px; font-variant-numeric: tabular-nums; }
.val .unit { display: block; margin: 0; font-weight: 500; }
.delta { min-width: 52px; text-align: right; }
.flag { display: inline-block; min-width: 24px; text-align: center; font-weight: 700; color: var(--bad); background: var(--bad-bg); border-radius: 999px; padding: 1px 8px; }
.appt-date { display: flex; flex-direction: column; min-width: 64px; }
.appt-date span { font-size: 12.5px; color: var(--muted-foreground); }
.meal { display: grid; grid-template-columns: 76px 1fr; gap: 8px; font-size: 14px; }
.sub { font-size: 13px; font-weight: 600; margin: 14px 0 4px; }

/* badges, avatars, status colours */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-unclear { background: var(--secondary); color: var(--muted-foreground); } /* a limit ("< 25") on both sides of a boundary, or a unit not recognised */
.badge-low, .badge-high { background: var(--bad-bg); color: var(--bad); }
.badge-watch { background: var(--warn-bg); color: oklch(52% .13 60); }
.badge-info { background: var(--accent); color: var(--accent-foreground); }
.badge-neutral { background: var(--muted); color: var(--muted-foreground); }
.st-ok { color: var(--ok); } .st-low, .st-high, .st-bad { color: var(--bad); } .st-watch { color: oklch(58% .14 60); } .st-unclear { color: var(--muted-foreground); }
.bg-ok { background: var(--ok); fill: var(--ok); } .bg-low, .bg-high { background: var(--bad); fill: var(--bad); } .bg-watch { background: var(--warn); fill: var(--warn); } .bg-unclear { background: var(--muted-foreground); fill: var(--muted-foreground); }
.stroke-ok { stroke: var(--ok); } .stroke-low, .stroke-high { stroke: var(--bad); } .stroke-watch { stroke: var(--warn); }
.stance { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; vertical-align: 1px; }
.stance-act { background: var(--bad-bg); color: var(--bad); } .stance-watch { background: var(--warn-bg); color: oklch(52% .13 60); }
.stance-monitor { background: var(--accent); color: var(--accent-foreground); } .stance-ok { background: var(--ok-bg); color: var(--ok); }
.avatars { display: flex; gap: 4px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--secondary); color: var(--secondary-foreground); font-size: 11.5px; font-weight: 700; flex: none; }
.avatar-admin { background: var(--foreground); color: var(--background); }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; vertical-align: middle; }
.presence { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted-foreground); }
.live { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 0 var(--signal); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.feed { list-style: none; display: flex; flex-direction: column; gap: 12px; font-size: 13.5px; }
.feed li { display: flex; gap: 10px; align-items: flex-start; }

/* patient record */
.patient-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.patient-head h1 { margin-top: 6px; }
.patient-meta { display: flex; align-items: center; gap: 14px; font-size: 13.5px; flex-wrap: wrap; }
.back { font-size: 13px; color: var(--muted-foreground); display: inline-block; margin-bottom: 8px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 14px; color: var(--muted-foreground); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--foreground); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.mini-cards { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 12px; }
.mini { background: var(--card); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 2px; color: var(--foreground); border: 1px solid var(--border); }
.mini:hover { text-decoration: none; border-color: var(--ok); }
.mini b { font-size: 22px; color: var(--ok); }
.card-focus h2 { font-size: 21px; }
.card-focus p { margin-bottom: 10px; }
.rings { display: flex; gap: 18px; align-items: center; }
.rings svg { flex: none; width: 132px; height: 132px; }
.ring-legend { min-width: 0; }
.ring-track { fill: none; stroke: var(--muted); stroke-width: 7; }
.ring-fill { fill: none; stroke-width: 7; stroke-linecap: round; }
.ring-ok { stroke: var(--ok); background: var(--ok); } .ring-watch { stroke: var(--warn); background: var(--warn); } .ring-bad { stroke: var(--bad); background: var(--bad); }
.ring-legend { list-style: none; flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.ring-legend li { display: flex; align-items: center; gap: 8px; }
.ring-legend b { min-width: 28px; text-align: right; }
.ring-legend .small { min-width: 74px; text-align: right; white-space: nowrap; }
.ring-legend .grow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dash-cols { display: grid; grid-template-columns: 1.15fr 1fr .85fr; gap: 16px; align-items: start; margin-bottom: 16px; }
.dash-cols-2 { grid-template-columns: 1.15fr .85fr; } /* working system: no wearable / diary column */
.dash-cols > * { min-width: 0; }
.theme-read { margin-top: 14px; line-height: 1.55; }
.card-toggle { width: 100%; border: 0; background: none; font: inherit; color: inherit; padding: 0; cursor: pointer; text-align: left; }
.card-toggle .card-title { margin-bottom: 8px; }
.chev { display: inline-block; margin-left: 4px; }
.no-next { margin-bottom: 4px; }
.up, .todo { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.up .dot, .todo .dot { margin-top: 7px; }
.progress { height: 4px; background: var(--muted); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--primary); }
.spark { display: block; }

/* trends */
.trend-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.trend-hint { max-width: 320px; text-align: right; line-height: 1.45; }
.seg { display: inline-flex; background: var(--muted); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: none; font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 999px; cursor: pointer; color: var(--muted-foreground); }
.seg-btn:focus-visible { outline: 2px solid var(--ring); }
.seg-on { background: var(--card); color: var(--foreground); font-weight: 600; box-shadow: var(--shadow); }
.trend-tools { margin: 12px 0 16px; justify-content: flex-start; }
.mtiles { display: grid; gap: 12px; }
.mtiles-bars { grid-template-columns: repeat(4, 1fr); }
.mtiles-rings { grid-template-columns: repeat(6, 1fr); }
.mtile { background: var(--muted); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; color: var(--foreground); border: 1px solid transparent; min-width: 0; }
.mtile:hover { text-decoration: none; border-color: var(--input); }
.mtile-name { font-size: 13.5px; font-weight: 500; }
.mtile-val { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 6px; }
.mtile-ring { align-items: center; padding: 16px 10px; }
.ring-box { position: relative; width: 104px; height: 104px; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; }
.ring-center .unit { margin: 0; }
.ring-10 { stroke-width: 10; }
.mtile .ring-track { stroke: color-mix(in oklab, var(--foreground) 10%, transparent); }
.tbar { opacity: .9; }
.tguide { stroke: var(--primary); stroke-width: 1.4; stroke-dasharray: 4 5; opacity: .7; }

/* marker page */
.marker-layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.marker-layout > * { min-width: 0; }
.marker-layout > .card, .marker-layout .stack > .card { margin-bottom: 0; }
.what { margin: 14px 0 0; max-width: 68ch; }
.what p:last-child { font-size: 14.5px; }
.track { position: relative; height: 32px; margin: 24px 0 6px; }
.track-line { position: absolute; left: 0; right: 0; top: 13px; height: 6px; border-radius: 999px; background: var(--muted); }
.track-zone { position: absolute; top: 13px; height: 6px; border-radius: 999px; background: color-mix(in oklab, var(--ok) 45%, var(--muted)); }
.track-prev, .track-now { position: absolute; border-radius: 50%; transform: translateX(-50%); }
.track-prev { top: 8px; width: 16px; height: 16px; opacity: .55; }
.track-now { top: 2px; width: 28px; height: 28px; box-shadow: 0 0 0 4px var(--card); }
.track-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted-foreground); }
.chart-box { margin-top: 20px; background: var(--surface); border-radius: 12px; padding: 16px 18px 12px; }
.chart-value { font-size: 11.5px; font-weight: 600; fill: var(--foreground); }
.chart-event { stroke: var(--warn); stroke-width: 1.4; stroke-dasharray: 3 4; }
.sw-event { border-left: 2px dashed var(--warn); width: 0; height: 12px; margin-left: 10px; border-radius: 0; }
.events { list-style: none; margin-top: 6px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.events li { display: flex; gap: 12px; }
.events .small { min-width: 96px; }
.reading { margin-top: 20px; border-top: 1px solid var(--hairline); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; max-width: 70ch; }
.reading-status { font-weight: 600; }
.reading-next { background: var(--accent); border-radius: 10px; padding: 10px 14px; }
.reading-next .eyebrow { margin-bottom: 2px; }
.pad-title { padding: 18px 16px 0; }

/* marker page chart */
.marker-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 8px; }
.h-xl { font-size: 26px; margin-bottom: 6px; }
.marker-value { font-size: 40px; font-weight: 700; text-align: right; letter-spacing: -.02em; line-height: 1; }
.marker-value .unit { font-size: 14px; }
.chart { width: 100%; height: auto; margin-top: 12px; }
.chart-band { fill: var(--ok-bg); }
.chart-grid { stroke: var(--hairline); }
.chart-axis { font-size: 11px; fill: var(--muted-foreground); }
.chart-label { font-size: 11px; fill: var(--primary); }
.chart-target { stroke: var(--primary); stroke-dasharray: 4 4; opacity: .6; }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 2.2; stroke-linejoin: round; }
.chart-dot { stroke: var(--card); stroke-width: 2; }
.dot-ok { fill: var(--ok); } .dot-low, .dot-high { fill: var(--bad); } .dot-watch { fill: var(--warn); } .dot-unclear { fill: var(--muted-foreground); }
.dot-limit { fill: var(--card); stroke-width: 2; } .dot-limit.dot-ok { stroke: var(--ok); } .dot-limit.dot-low, .dot-limit.dot-high { stroke: var(--bad); } .dot-limit.dot-watch { stroke: var(--warn); } .dot-limit.dot-unclear { stroke: var(--muted-foreground); } /* only a limit: hollow */
.legend { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.sw { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.sw-band { background: var(--ok-bg); border: 1px solid color-mix(in oklab, var(--ok) 30%, transparent); }
.sw-target { border-top: 2px dashed var(--primary); height: 0; margin-left: 10px; }

/* notes */
.notes-layout { display: grid; grid-template-columns: 250px 1fr 250px; gap: 16px; align-items: start; }
.notes-layout > .card { margin-bottom: 0; }
.note-list { list-style: none; }
.note-list a { display: flex; flex-direction: column; padding: 12px 16px; border-bottom: 1px solid var(--hairline); color: inherit; }
.note-list a:hover { background: var(--muted); text-decoration: none; }
.note-list a.active { background: var(--accent); box-shadow: inset 3px 0 0 var(--primary); }
.note h2 { font-size: 22px; margin-bottom: 14px; }
.note-body p { margin-bottom: 14px; max-width: 68ch; }
.doc-chip { display: inline-block; background: var(--accent); color: var(--accent-foreground); border-radius: 6px; padding: 0 7px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.doc-chip:hover { text-decoration: none; background: var(--secondary); }
.doc-missing { background: var(--bad-bg); color: var(--bad); }

/* lifestyle */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--muted); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.tile b { font-size: 20px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 40px; }
.bar { flex: 1; border-radius: 4px; }
.bar-good { background: var(--primary); } .bar-low { background: var(--input); }
.dots-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.dots { display: flex; gap: 3px; }
.sdot { width: 11px; height: 18px; border-radius: 4px; }
.s1 { background: var(--bad); } .s2 { background: color-mix(in oklab, var(--bad) 45%, var(--muted)); } .s3 { background: var(--input); } .s4 { background: color-mix(in oklab, var(--primary) 45%, var(--muted)); } .s5 { background: var(--primary); }

/* report */
.report { max-width: 820px; padding: 36px 44px; }
.report-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 20px; }
.report h2 { font-size: 24px; }
.report h3 { font-size: 15px; margin: 22px 0 8px; }
.report ul { padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.report-foot { margin-top: 28px; border-top: 1px solid var(--border); padding-top: 12px; }

/* modal */
.modal-root { position: fixed; inset: 0; background: color-mix(in oklab, var(--foreground) 35%, transparent); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 620px; box-shadow: 0 20px 60px color-mix(in oklab, var(--foreground) 25%, transparent); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 0; }
.modal-body { padding: 16px 22px 4px; }
.modal-body .table th, .modal-body .table td { padding: 8px 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 18px; }
.form-error { color: var(--bad); font-size: 13.5px; padding: 0 22px; }
.lab-row { display: grid; grid-template-columns: 1.6fr 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
/* Lab stand and the "Add results" window: source line under a row read from a file, upload zone, manual choices, sign-out form, login card */
.lab-src { grid-column: 1 / -1; margin: -2px 0 6px; }
.lab-warn { color: var(--bad); font-weight: 500; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 16px; margin-bottom: 12px; border: 1.5px dashed var(--border); border-radius: 12px; cursor: pointer; text-align: center; }
.drop:hover, .drop-on { border-color: var(--primary); background: var(--ok-bg); }
.inline-form { display: inline; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); text-align: left; cursor: pointer; font: inherit; }
.choice:hover { border-color: var(--primary); }
.up-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 4px 0 22px; } /* hint left, "Read file" right */
.up-row p { margin: 0; max-width: 62ch; }
.up-row .btn { flex: none; }
.up-error { padding: 0; margin: -12px 0 18px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 560px) { .up-row { flex-direction: column; align-items: stretch; } }
.stand-login { max-width: 380px; margin: 48px auto; display: flex; flex-direction: column; gap: 6px; }
.stand-login .form-error { padding: 0; }
.stand-login .lang-switch { margin-top: 12px; }

/* responsive */
@media (max-width: 1100px) {
  .mtiles-bars { grid-template-columns: repeat(3, 1fr); }
  .mtiles-rings { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1000px) {
  .cols-3, .hero-row, .notes-layout, .dash-cols, .dash-cols-2, .marker-layout { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .trend-hint { text-align: left; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 14px; }
  .topbar-in { gap: 12px; height: auto; padding: 10px 0; flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  .cols-2, .mini-cards, .grid2, .grid3 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .table td, .table th { padding: 10px; }
  .report { padding: 22px; }
  .mrow { gap: 8px; }
  .mrow .spark { width: 56px; }
  .mtiles-bars, .mtiles-rings { grid-template-columns: 1fr 1fr; }
  .rings { flex-direction: column; align-items: stretch; }
  .rings svg { width: 120px; height: 120px; align-self: center; }
  .mrow .delta { display: none; }
}

/* print: the visit summary only */
@media print {
  body { background: #fff; }
  .no-print, .patient-head, .demo-banner { display: none !important; }
  .main { padding: 0; }
  .card { box-shadow: none; border: 0; }
  .report { padding: 0; max-width: none; }
}

/* Working system (/app/, accounts app): sign-in cards, forms, notices */
.app-auth { max-width: 460px; padding: 32px 36px; gap: 0; }
.app-auth > img { margin-bottom: 20px; }
.app-auth h1 { font-size: 26px; line-height: 1.2; margin: 0 0 10px; }
.app-auth > p { margin: 0 0 16px; }
.app-auth > form:not(.app-form) { margin: 4px 0 0; }
.app-auth .lang-switch { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.app-auth > form.app-signout { margin-top: 20px; }  /* beats the form rule above */
.app-auth > p.small { margin: 14px 0 0; }  /* "Forgot your password?" under the form */
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }
.app-form { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.app-form .btn-primary { align-self: flex-start; margin-top: 8px; }
.app-form fieldset { border: 0; padding: 0; margin: 0 0 14px; }
.app-form legend { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.radios { display: flex; gap: 18px; flex-wrap: wrap; }
.app-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; margin-bottom: 10px; } /* not .check: the demo's checkbox class */
.app-check input { width: auto; flex: none; margin-top: 3px; accent-color: var(--primary); }
.radios .app-check { margin-bottom: 0; white-space: nowrap; }
.notice { background: var(--ok-bg); color: var(--ok); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; margin-bottom: 14px; }
.app-card { max-width: 640px; }
.app-photo { width: 72px; height: 72px; object-fit: cover; border-radius: 50%; margin-bottom: 8px; }
.app-invite { align-items: flex-end; margin-top: 12px; }
.app-invite .field { margin-bottom: 0; }
.app-open { margin-top: 16px; } /* "Open patients" under the card text (home.html) */
.app-danger { background: var(--bad); } /* "Delete my account" (delete_account.html) */
.app-plan { margin: 0 0 16px; padding-left: 18px; display: grid; gap: 6px; }
.app-plan .form-error { padding: 0; }
.form-error.app-inline { padding: 0; }
.field .form-error, .app-auth .form-error { padding: 0; }

/* Working system: while a change is being saved nothing can be clicked (06_app.js appSave) */
body.app-saving { cursor: progress; }
body.app-saving #app { pointer-events: none; opacity: .8; }

/* Date fields typed as dd/mm/yyyy, the browser's calendar behind the button (02_app.js dayMonthDates) */
.date-field { position: relative; display: flex; gap: 6px; align-items: center; }
.date-field .input { flex: 1; min-width: 12ch; font-variant-numeric: tabular-nums; }  /* dd/mm/yyyy fits whole */
.date-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Plans page (accounts/plans.html) and the plan notices in the workspace (06_app.js) */
.app-plans-page h1 { margin-bottom: 8px; }
.app-plans-page > p { margin: 0 0 8px; }
.app-interval { margin: 18px 0 24px; border: 0; padding: 0; display: inline-flex; }
.app-interval input { position: absolute; opacity: 0; }
.app-interval .seg-btn:has(input:checked) { background: var(--card); box-shadow: var(--shadow); }
.app-plan-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-bottom: 24px; align-items: stretch; }
.app-plan-card { cursor: pointer; display: flex; flex-direction: column; gap: 10px; padding: 26px 26px 20px; margin: 0; border: 2px solid transparent; }
.app-plan-card input { position: absolute; opacity: 0; }
.app-plan-card.chosen { border-color: var(--primary); }
.app-plan-now { margin: 0 0 4px; font-size: 15px; }
.app-plan-mine { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--primary); color: #fff; letter-spacing: .04em; }
.app-price { margin-bottom: 8px; }
.app-price b { font-size: 34px; margin-right: 6px; }
.app-features { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.app-features li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); line-height: 1.35; }
.app-features .mark { flex: none; width: 16px; font-weight: 700; color: var(--ok); }
.app-features li.off { color: var(--muted-foreground, #8a93a6); }
.app-features li.off .mark { color: var(--muted-foreground, #8a93a6); }
.app-banner { background: var(--warn-bg); padding: 8px 0; font-size: 14px; }
.app-upgrade { display: grid; grid-template-columns: 1fr auto; column-gap: 24px; row-gap: 4px; align-items: center;
  background: color-mix(in oklab, var(--primary) 6%, var(--card, #fff)); border: 1px solid color-mix(in oklab, var(--primary) 18%, transparent);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.app-upgrade p { margin: 0; grid-column: 1; }
.app-upgrade .btn { grid-column: 2; grid-row: 1 / span 2; white-space: nowrap; }
@media (max-width: 560px) { .app-upgrade { grid-template-columns: 1fr; } .app-upgrade .btn { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 10px; } }
@media (max-width: 720px) { .app-plan-cards { grid-template-columns: 1fr; } }

