/*
   Kinly (working name) - care product stylesheet.

   Two audiences, one system. The older person's screen is a READING screen: serif, large, one
   decision at a time. The family and responder screens are OPERATING screens: humanist sans,
   dense, with state encoded in shape as well as colour so it reads at a glance.

   Semantic colour carries meaning (covered / due / missed) and the accent stays quiet so it never
   competes with it.
*/

:root {
    --ground: #F4F6F7;
    --surface: #FFFFFF;
    --surface-sunk: #F0F3F5;
    --ink: #1A2430;
    --ink-muted: #5C6B78;
    --ink-faint: #8695A1;
    --rule: #D5DDE3;
    --rule-strong: #B9C5CD;
    --accent: #334E68;
    --accent-ink: #FFFFFF;
    --accent-soft: #E4EBF1;
    --ok: #2E6F4E;
    --ok-soft: #E1F0E7;
    --due: #8A5C05;
    --due-soft: #FBEFD6;
    --miss: #B3402F;
    --miss-soft: #FBE6E2;
    --sim: #5B3E8C;
    --sim-soft: #EDE7F6;
    --shadow: 0 1px 2px rgba(26, 36, 48, .07), 0 8px 24px rgba(26, 36, 48, .07);
    --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ground: #11171D;
        --surface: #1A222B;
        --surface-sunk: #141B22;
        --ink: #E4EAEF;
        --ink-muted: #9DABB7;
        --ink-faint: #74838F;
        --rule: #2B3641;
        --rule-strong: #3C4954;
        --accent: #8FB4D6;
        --accent-ink: #10161C;
        --accent-soft: #21303E;
        --ok: #7FCB9F;
        --ok-soft: #1A2E24;
        --due: #E0B155;
        --due-soft: #2F2716;
        --miss: #EF9184;
        --miss-soft: #331C19;
        --sim: #BBA4E4;
        --sim-soft: #241C33;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    }
}

* { box-sizing: border-box; }

/*
   ⛔ THIS RULE IS LOAD-BEARING, NOT TIDINESS.

   The browser hides [hidden] with `display: none` from its USER-AGENT stylesheet, which any
   author-level `display` declaration outranks. `.offline-fallback` sets `display: flex` below, so
   without this the offline panel - "No connection. Nothing you have just tapped has been sent to
   anybody." - is visible ALL THE TIME, on a perfectly healthy connection.

   That is worse than not having the panel. A warning that is always on is a warning people learn
   to read past, and the one evening it is true is the evening it needs to be believed.
*/
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- simulation banner */

.sim-banner {
    background: var(--sim);
    color: #fff;
    padding: 10px 20px;
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    justify-content: center;
    text-align: center;
}

.sim-banner b {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: 12.5px;
}

.sim-banner--broken { background: var(--miss); }

/* ---------------------------------------------------------------------------- shell */

.shell { max-width: 960px; margin: 0 auto; padding-inline: 20px; padding-block: 0 64px; }

.shell-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding-block: 20px 16px;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 24px;
}

.wordmark {
    font-family: var(--serif);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.015em;
    color: var(--ink);
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
}

.working-name {
    font-family: var(--sans);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .09em;
    font-weight: 600;
    color: var(--sim);
    background: var(--sim-soft);
    border: 1px solid color-mix(in srgb, var(--sim) 30%, transparent);
    padding: 3px 7px;
    border-radius: 3px;
}

main { display: block; }

h1 { font-size: 27px; font-weight: 700; letter-spacing: -.018em; margin: 0 0 10px; text-wrap: balance; }

h2.sec-h, .sec-h {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--ink-faint);
    margin: 0 0 10px;
}

.hint { font-size: 14px; color: var(--ink-muted); line-height: 1.55; max-width: 62ch; }
.small { font-size: 13px; }
.empty { color: var(--ink-faint); font-style: italic; }

.pane { display: flex; flex-direction: column; gap: 20px; }
.pane--narrow { max-width: 34rem; }
.pane--denied { max-width: 34rem; }

section { display: flex; flex-direction: column; gap: 12px; }

/* -------------------------------------------------------------------------- controls */

.btn, .bigbtn {
    font: inherit;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
    padding: 11px 16px;
    align-self: flex-start;
}

.btn.small { padding: 6px 10px; font-size: 13.5px; }
.btn.ghost, .btn.link { background: transparent; color: var(--accent); }
.btn:hover, .bigbtn:hover { filter: brightness(1.07); }
.btn:disabled, .bigbtn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn:focus-visible, .bigbtn:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

.link-btn {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--rule-strong);
    border-radius: 4px;
    color: var(--accent);
    padding: 6px 11px;
    cursor: pointer;
    text-decoration: none;
    align-self: flex-start;
    display: inline-block;
}
.link-btn:hover { border-color: var(--accent); }

/*
   Specificity note: `.stack label` below is (0,1,1) and uppercases its label, which is right for a
   field caption and wrong for a sentence somebody has to read and agree to. `.stack label.checkbox`
   matches that specificity and wins on order, so a consent choice reads as a sentence rather than
   shouting at the person being asked.
*/
.checkbox, .stack label.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 15px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
    line-height: 1.45;
}

.checkbox input { width: auto; flex: none; margin-top: 3px; }

.your-data section { border-top: 1px solid var(--rule); padding-top: 18px; }

.stack { display: flex; flex-direction: column; gap: 9px; align-items: stretch; max-width: 34rem; }
.stack label, .field {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ink-faint);
}

input, select, textarea {
    font: inherit;
    font-size: 15px;
    width: 100%;
    border: 1px solid var(--rule-strong);
    border-radius: 5px;
    padding: 10px 11px;
    background: var(--surface);
    color: var(--ink);
}

textarea { resize: vertical; line-height: 1.5; }

.form-error {
    background: var(--miss-soft);
    border: 1px solid color-mix(in srgb, var(--miss) 40%, transparent);
    border-radius: 5px;
    padding: 11px 13px;
    color: var(--ink);
    font-size: 14.5px;
}

.form-note, .ok-line {
    background: var(--ok-soft);
    border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
    border-radius: 5px;
    padding: 11px 13px;
    font-size: 14.5px;
}

/* ------------------------------------------------------------------------- the pills */

.pill {
    display: inline-flex;
    align-items: center;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 3px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 32%, transparent); }
.pill.due { background: var(--due-soft); color: var(--due); border-color: color-mix(in srgb, var(--due) 34%, transparent); }
.pill.miss { background: var(--miss-soft); color: var(--miss); border-color: color-mix(in srgb, var(--miss) 34%, transparent); }
.pill.flat { background: var(--surface-sunk); color: var(--ink-muted); border-color: var(--rule); }
.pill.sim { background: var(--sim-soft); color: var(--sim); border-color: color-mix(in srgb, var(--sim) 32%, transparent); }

/* ---------------------------------------------------- the older person's Today screen */

.today { font-family: var(--serif); display: flex; flex-direction: column; gap: 18px; max-width: 34rem; }
.today-head h1 { font-family: var(--serif); font-size: 30px; }
.today-date { font-family: var(--sans); font-size: 14.5px; color: var(--ink-muted); margin: 4px 0 0; }

.bigcard {
    border: 1px solid var(--rule);
    border-radius: 8px;
    padding: 20px 18px;
    background: var(--surface-sunk);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bigcard.now { border-color: var(--accent); border-width: 2px; background: var(--surface); }
.bigcard.settled { border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: var(--ok-soft); }

.bigcard .kicker {
    font-family: var(--sans);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--ink-muted);
}

.bigcard.settled .kicker { color: var(--ok); }
.bigcard h2 { font-family: var(--serif); font-size: 25px; font-weight: 700; margin: 0; line-height: 1.25; }
.bigcard .when { font-family: var(--sans); font-size: 16px; color: var(--ink-muted); margin: 0; }
.bigcard .when.next { color: var(--ink); }

.bigbtns { display: flex; flex-direction: column; gap: 10px; }

/* Large targets: an older person's finger, not a designer's cursor. */
.bigbtn { font-family: var(--sans); font-size: 19px; min-height: 60px; align-self: stretch; }
.bigbtn.help { border-color: var(--miss); background: transparent; color: var(--miss); }

.help { display: flex; flex-direction: column; gap: 8px; }
.help-note { font-family: var(--sans); font-size: 13.5px; color: var(--ink-muted); margin: 0; }
.selfline { font-family: var(--sans); font-size: 14.5px; color: var(--ink-muted); margin: 0; }
.selfline .stamp { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.who-sees { font-family: var(--sans); font-size: 13px; color: var(--ink-faint); line-height: 1.55; margin: 0; }

.pending, .offline-fallback {
    font-family: var(--sans);
    border: 1px dashed var(--miss);
    background: var(--miss-soft);
    border-radius: 6px;
    padding: 13px 14px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.pending .hd, .offline-fallback b { font-weight: 700; font-size: 15px; color: var(--miss); }
.pending p, .offline-fallback p { margin: 0; font-size: 14.5px; line-height: 1.5; }

.pending .fallback, .offline-fallback .plan {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 5px;
    padding: 10px 11px;
    font-size: 14.5px;
    line-height: 1.5;
}

.pending .fallback b {
    display: block;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ink-muted);
    margin-bottom: 3px;
}

/* ------------------------------------------------------------- family coverage screen */

.coverage { display: flex; flex-direction: column; gap: 22px; }

.coverage-head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    align-items: flex-end;
    justify-content: space-between;
}

.coverage-head .sub { font-size: 14px; color: var(--ink-muted); margin: 4px 0 0; }
.coverage-nav { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14.5px; }

.lastcontact {
    border: 1px solid var(--rule);
    border-left: 3px solid var(--ok);
    border-radius: 5px;
    padding: 13px 15px;
    background: var(--surface-sunk);
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    align-items: baseline;
}

.lastcontact.stale { border-left-color: var(--due); }
.lastcontact .lab {
    width: 100%;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ink-faint);
    font-weight: 600;
}
.lastcontact .val { font-size: 16px; font-weight: 600; }
.lastcontact .src { font-size: 13.5px; color: var(--ink-muted); }

.roster-wrap { overflow-x: auto; }

table.roster { width: 100%; border-collapse: collapse; font-size: 14.5px; }

table.roster th[scope="col"] {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--ink-faint);
    font-weight: 600;
    padding: 0 10px 8px 0;
    border-bottom: 1px solid var(--rule);
}

table.roster td, table.roster th[scope="row"] {
    padding: 11px 10px 11px 0;
    border-bottom: 1px solid var(--rule);
    vertical-align: top;
    text-align: left;
}

table.roster th[scope="row"] { font-weight: 600; }
table.roster .win { font-family: var(--mono); font-size: 13px; color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.roster .owner .bk { display: block; font-size: 13px; color: var(--ink-muted); }
table.roster .owner .unaccepted { color: var(--due); font-weight: 600; }

.gap {
    border: 1px solid color-mix(in srgb, var(--due) 40%, transparent);
    background: var(--due-soft);
    border-radius: 5px;
    padding: 12px 14px;
    font-size: 14.5px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gap b {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--due);
}

.gap ul, .gaps, .plain, .circle-list, .journal { margin: 0; padding-left: 18px; }
.plain, .circle-list, .journal { list-style: none; padding-left: 0; }

.incident-strip {
    border: 1px solid var(--rule);
    border-left: 4px solid var(--miss);
    border-radius: 5px;
    background: var(--surface);
    padding: 13px 15px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.incident-strip.resolved { border-left-color: var(--ok); }
.incident-strip .row1 { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.incident-strip .ttl { font-weight: 700; font-size: 15.5px; }
.incident-strip .ref, .ref { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }
.incident-strip .who { font-size: 14px; color: var(--ink-muted); }
.incident-strip .who.small { font-size: 12.5px; }

.bedtime {
    border: 1px solid var(--rule);
    border-radius: 5px;
    padding: 14px 16px;
    background: var(--surface-sunk);
}

.bedtime ul { margin: 0; padding-left: 18px; font-size: 14.5px; line-height: 1.6; }
.bedtime .disclaim {
    font-size: 13px;
    color: var(--ink-muted);
    border-top: 1px dashed var(--rule-strong);
    padding-top: 9px;
    margin: 10px 0 0;
    line-height: 1.5;
}

/* ------------------------------------------------------------------ alert response */

.alert-page { display: flex; flex-direction: column; gap: 20px; max-width: 42rem; }
.alert-head { display: flex; flex-direction: column; gap: 6px; }
.alert-head .lede { font-size: 15px; color: var(--ink-muted); margin: 0; line-height: 1.55; }

.facts { display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: 5px; overflow: hidden; margin: 0; }
.fact { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 12px; padding: 10px 13px; border-bottom: 1px solid var(--rule); font-size: 14.5px; }
.fact:last-child { border-bottom: 0; }
.fact dt { color: var(--ink-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; padding-top: 2px; }
.fact dd { margin: 0; }
.fact .nobody { color: var(--miss); font-weight: 600; }

.stamp { font-family: var(--mono); font-size: 13.5px; font-variant-numeric: tabular-nums; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.tl {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
    padding: 9px 0 9px 14px;
    border-left: 2px solid var(--rule);
    margin-left: 5px;
    position: relative;
    font-size: 14.5px;
}

.tl::before {
    content: "";
    position: absolute;
    left: -5px;
    top: 15px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--rule-strong);
}

.tl.evt-ok::before { background: var(--ok); }
.tl.evt-miss::before { background: var(--miss); }
.tl.evt-due::before { background: var(--due); }
.tl .stamp { color: var(--ink-faint); padding-top: 1px; }
.tl .body { line-height: 1.5; }
.tl .body .meta { display: block; color: var(--ink-muted); font-size: 13px; margin-top: 3px; }

.actions { border-top: 1px solid var(--rule); padding-top: 16px; gap: 10px; max-width: 34rem; }
.action-note { font-size: 13.5px; color: var(--ink-muted); margin: 0; line-height: 1.5; }

.banner-note {
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid var(--rule);
    border-left: 3px solid var(--sim);
    background: var(--sim-soft);
    border-radius: 4px;
    padding: 11px 13px;
}

.banner-note.resolved-note { border-left-color: var(--ok); background: var(--ok-soft); }

.conflict {
    font-size: 14.5px;
    line-height: 1.5;
    border: 1px solid color-mix(in srgb, var(--due) 45%, transparent);
    background: var(--due-soft);
    border-radius: 5px;
    padding: 12px 13px;
}

.conflict b {
    display: block;
    color: var(--due);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 3px;
}

/* -------------------------------------------------------------------- lists and ops */

.circle-list li {
    border: 1px solid var(--rule);
    border-radius: 5px;
    padding: 14px 16px;
    background: var(--surface);
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    justify-content: space-between;
}

.circle-list a { text-decoration: none; color: inherit; }
.circle-list .name { font-size: 17px; font-weight: 600; display: block; }
.circle-list .meta { font-size: 13.5px; color: var(--ink-muted); }

.journal li {
    border-bottom: 1px solid var(--rule);
    padding: 12px 0;
}

.journal .stamp { color: var(--ink-faint); margin-right: 10px; }
.journal p { margin: 6px 0 0; line-height: 1.55; }

.ops-head { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
.blockers code { font-family: var(--mono); font-size: 12.5px; color: var(--miss); }
.inline-form { border-top: 1px dashed var(--rule-strong); padding-top: 14px; }

@media (max-width: 640px) {
    .fact { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .tl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    h1 { font-size: 24px; }
    .today-head h1 { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/*
   Blazor's own reconnect UI. Replaced with care-specific wording, because the default is a
   spinner that says nothing about whether what you just tapped reached anybody - and on this
   product that is the only question that matters.
*/
#components-reconnect-modal { display: none; }

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: block;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1000;
    background: var(--miss);
    color: #fff;
    padding: 14px 20px;
    font-size: 15px;
    text-align: center;
}

/* ---------------------------------------------------------------- summary (Care Wave 5)

   The certainty of a line is carried by its WORDS, not by this colour. The border is a second,
   redundant cue for a sighted reader skimming; a reader who cannot see it loses nothing, because
   every line already says "Recorded by the app", "Reported by Nomsa" or "Nobody knows" in text. */

.summary .disclaim {
    font-size: 13.5px;
    color: var(--ink-muted);
    line-height: 1.55;
    background: var(--surface-sunk);
    border-left: 3px solid var(--rule-strong);
    padding: 10px 12px;
    margin: 0 0 14px;
    max-width: 66ch;
}

.summary-lines { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }

.summary-line {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid var(--rule);
    border-left-width: 4px;
    border-radius: 4px;
    background: var(--surface);
}

.summary-line .stmt { font-size: 15px; line-height: 1.5; }
.summary-line .who { font-size: 13px; color: var(--ink-muted); font-weight: 600; }
.summary-line .src { font-size: 12.5px; color: var(--ink-muted); }

.summary-line.recorded { border-left-color: var(--rule-strong); }
.summary-line.reported { border-left-color: var(--accent, #3b6ea5); }

/* Not a warning colour. "Nobody knows" is an honest state of the record, not a fault - colouring
   it like an alarm would push a family to treat missing information as bad news. */
.summary-line.unknown { border-left-color: #8a7a55; background: var(--surface-sunk); }

.supply ul { margin: 0; padding-left: 18px; font-size: 14.5px; line-height: 1.6; }
.supply .disclaim {
    font-size: 13px;
    color: var(--ink-muted);
    border-top: 1px dashed var(--rule-strong);
    padding-top: 9px;
    margin: 10px 0 0;
    line-height: 1.5;
    max-width: 66ch;
}

/* ------------------------------------------------- professional response (Care Wave 6)

   "None arranged" is NOT styled as an error. It is the honest and expected state of a product that
   has contracted nobody, and colouring it red would train a family to read the normal case as a
   fault - and then to read the absence of red as a promise. Both states are plain panels; what
   differs is the words. */

.response-arrangement {
    margin: 16px 0 0;
    padding: 12px 14px;
    border: 1px solid var(--rule);
    border-left-width: 4px;
    border-radius: 4px;
    background: var(--surface-sunk);
    display: grid;
    gap: 5px;
    max-width: 66ch;
}

.response-arrangement .hd { font-weight: 700; font-size: 14.5px; }
.response-arrangement p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink); }

.response-arrangement.none { border-left-color: var(--rule-strong); }
.response-arrangement.arranged { border-left-color: var(--accent, #3b6ea5); }
