/*
    Colour roles come from the validated reference palette. Momentum is a *status* scale, not a
    set of series identities, so it uses the reserved status steps -- and the colour is only ever
    carried by a dot next to the word. Two of those steps sit below 3:1 on a light surface, and
    more to the point a coach should never have to read hue alone to know a client is stuck.
*/
:root {
    color-scheme: light dark;

    --page: #f9f9f7;
    --surface: #fcfcfb;
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --ink-muted: #898781;
    --hairline: #e1e0d9;
    --border: rgba(11, 11, 11, 0.10);

    --good: #0ca30c;
    --warning: #fab219;
    --serious: #ec835a;
    --critical: #d03b3b;
    --steady: #2a78d6;
    --neutral: #898781;

    --radius: 8px;
    --font: system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --page: #0d0d0d;
        --surface: #1a1a19;
        --ink: #ffffff;
        --ink-2: #c3c2b7;
        --ink-muted: #898781;
        --hairline: #2c2c2a;
        --border: rgba(255, 255, 255, 0.10);
        --steady: #3987e5;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
}

.shell { max-width: 1160px; margin: 0 auto; padding: 0 24px 96px; }

/* ---------------------------------------------------------------- masthead */

.masthead {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 20px 0 28px;
    border-bottom: 1px solid var(--hairline);
    margin-bottom: 28px;
}

.brand {
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-decoration: none;
}

.brand-accent { color: var(--steady); }

.masthead-note { color: var(--ink-muted); font-size: 13px; }

h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin: 0 0 4px; }

/* FocusOnNavigate parks focus on the h1 for screen readers; the visible ring around a heading
   nobody clicked just reads as a rendering bug. Keyboard focus rings elsewhere are untouched. */
h1:focus, h1:focus-visible { outline: none; }
h2 { font-size: 15px; font-weight: 650; margin: 0 0 10px; }
h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 18px 0 6px; }

a { color: var(--steady); }

code {
    font-family: var(--mono);
    font-size: 0.9em;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}

pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    overflow-x: auto;
}

pre code { background: none; border: none; padding: 0; }

.loading { color: var(--ink-muted); }

/* ------------------------------------------------------------- meta + tiles */

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    color: var(--ink-2);
    font-size: 13px;
    margin-bottom: 20px;
}

.tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 24px;
}

/* 2px surface gaps rather than borders between tiles: the row reads as one object. */
.tile {
    flex: 1 1 110px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}

.tile-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }

.tile-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-2);
    font-size: 12px;
}

/* -------------------------------------------------------------- the notices */

.notice {
    border: 1px solid var(--border);
    border-left: 3px solid var(--warning);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--ink-2);
}

.notice strong { color: var(--ink); }
.notice-gap { border-left-color: var(--serious); margin: 0 0 16px; }

/* --------------------------------------------------------------- the badges */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--ink-2);
    white-space: nowrap;
}

.badge-dot, .tile-label .badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neutral);
    flex: none;
}

.badge-thriving .badge-dot, .dot-thriving { background: var(--good); }
.badge-steady   .badge-dot, .dot-steady   { background: var(--steady); }
.badge-stalling .badge-dot, .dot-stalling { background: var(--warning); }
.badge-silent   .badge-dot, .dot-silent   { background: var(--serious); }
.badge-stuck    .badge-dot, .dot-stuck    { background: var(--critical); }
.badge-unknown  .badge-dot, .dot-unknown  { background: var(--neutral); }

.pill {
    display: inline-block;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0 7px;
    color: var(--ink-2);
    margin-left: 8px;
    vertical-align: middle;
}

.pill-done { border-color: var(--good); color: var(--good); }

.week { color: var(--ink-muted); font-size: 12px; margin-left: 8px; }

/* ---------------------------------------------------------------- the table */

table.clients {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.clients th, .clients td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--hairline);
    vertical-align: top;
}

.clients thead th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    border-bottom: 1px solid var(--border);
}

.clients tbody tr:last-child th, .clients tbody tr:last-child td { border-bottom: none; }
.clients tbody tr:hover { background: color-mix(in srgb, var(--steady) 5%, transparent); }

.clients tbody th { font-weight: 550; }

/* Client names are the way into the full briefing, and they used to be styled as plain text with
   only a hover underline -- so the detail pages went unnoticed entirely. They look like links
   now, because that is what they are. */
.clients tbody th a {
    color: var(--steady);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--steady) 35%, transparent);
    text-underline-offset: 2px;
}

.clients tbody th a:hover { text-decoration-color: currentColor; }

/* Handled clients stay visible and readable, just clearly demoted. */
.clients tr.handled { opacity: 0.5; }

.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.situation { color: var(--ink-2); font-size: 13px; max-width: 42ch; padding: 0; }

/* The whole summary is the hit target -- it is the thing you are reading when you decide to
   open a row. A real button, so it is keyboard reachable and announces its expanded state. */
.situation-toggle {
    display: block;
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    border-radius: 0;
    padding: 10px 12px;
    cursor: pointer;
}

.situation-toggle:hover { color: var(--ink); }
.situation-toggle:focus-visible { outline: 2px solid var(--steady); outline-offset: -2px; }

.chevron { color: var(--ink-muted); margin-right: 6px; font-size: 10px; }

/* ------------------------------------------------------------- the expanded row */

.row-detail > td {
    padding: 4px 12px 18px 30px;
    background: color-mix(in srgb, var(--steady) 4%, transparent);
}

.row-detail.handled > td { opacity: 0.5; }

.summary-full {
    margin: 0 0 14px;
    font-size: 14px;
    max-width: 90ch;
}

/* Drafts sit side by side when there is room: on a wide screen you can compare the three tones
   at a glance, which is how you pick one. */
.row-drafts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px;
}

.row-drafts .draft { margin-bottom: 0; background: var(--surface); }

.row-more { margin: 14px 0 0; font-size: 12px; }
.row-more a { color: var(--ink-muted); }
.row-more a:hover { color: var(--steady); }

.actions { text-align: right; }

/* ------------------------------------------------------------- the age cell */

.age { font-size: 13px; }
.age-unit { color: var(--ink-muted); font-size: 11px; margin-left: 1px; }
.age-ok { color: var(--ink-2); }
.age-warning { color: var(--ink); }
.age-serious { color: var(--ink); font-weight: 550; }
.age-critical { color: var(--critical); font-weight: 600; }

/* "unread" and "never" mean different things and must never look the same as each other, or as
   a number. Silence is a finding; an unreadable source is a hole in the data. */
.age-never { color: var(--ink-muted); font-size: 12px; font-style: italic; }

.age-unreadable {
    color: var(--serious);
    font-size: 12px;
    border-bottom: 1px dashed currentColor;
    cursor: help;
}

/* --------------------------------------------------------------- the panels */

.crumbs { margin-bottom: 12px; font-size: 13px; }
.crumbs a { color: var(--ink-muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }

.client-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 16px;
}

.panel-note { color: var(--ink-muted); font-size: 12px; margin: -4px 0 12px; }
.panel-actions { display: flex; gap: 10px; margin-bottom: 16px; }

.summary { margin: 0; font-size: 15px; }

ul.plain { margin: 0; padding-left: 18px; }
ul.plain li { margin-bottom: 6px; color: var(--ink-2); }

.gap-source {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--serious);
    margin-right: 6px;
}

/* --------------------------------------------------------------- the drafts */

.draft {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
}

.draft-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tone {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
}

textarea {
    width: 100%;
    font: inherit;
    line-height: 1.55;
    color: var(--ink);
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    resize: vertical;
}

textarea:focus { outline: 2px solid var(--steady); outline-offset: -1px; }

details { margin-top: 8px; }
details summary { cursor: pointer; color: var(--ink-muted); font-size: 12px; }
details summary:hover { color: var(--ink-2); }
details p { color: var(--ink-2); font-size: 13px; margin: 8px 0 0; }

/* -------------------------------------------------------------- the buttons */

button {
    font: inherit;
    cursor: pointer;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    padding: 5px 12px;
}

button:hover { border-color: var(--ink-muted); }

button.primary { background: var(--steady); border-color: var(--steady); color: #fff; }
button.primary:hover { filter: brightness(1.08); }

button.copy { font-size: 12px; padding: 3px 10px; }

button.link {
    border: none;
    background: none;
    color: var(--ink-muted);
    font-size: 12px;
    padding: 2px 4px;
}

button.link:hover { color: var(--steady); text-decoration: underline; }

/* --------------------------------------------------------- the raw evidence */

.raw { border-top: 1px solid var(--hairline); padding-top: 10px; margin-top: 10px; }
.raw > summary { font-size: 13px; color: var(--ink-2); font-weight: 550; }
.raw .count { color: var(--ink-muted); font-weight: 400; margin-left: 8px; font-size: 12px; }
.unreadable { color: var(--ink-muted); font-size: 13px; font-style: italic; }

.transcript { list-style: none; margin: 12px 0 0; padding: 0; }

.transcript li {
    border-left: 2px solid var(--hairline);
    padding: 6px 0 6px 12px;
    margin-bottom: 8px;
}

.transcript .from-client { border-left-color: var(--steady); }

.msg-head { display: flex; gap: 10px; font-size: 11px; color: var(--ink-muted); }
.msg-head .who { font-weight: 600; color: var(--ink-2); }
.msg-body { white-space: pre-wrap; font-size: 13px; }

blockquote {
    margin: 4px 0;
    padding-left: 8px;
    border-left: 2px solid var(--hairline);
    color: var(--ink-muted);
    font-size: 12px;
}

ul.commits, ul.comments, ul.evidence { list-style: none; margin: 10px 0 0; padding: 0; }

.commits li, .comments li {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 4px 0;
    border-bottom: 1px solid var(--hairline);
    font-size: 13px;
}

.commits li:last-child, .comments li:last-child { border-bottom: none; }

.sha { font-family: var(--mono); font-size: 12px; flex: none; }
.repo { color: var(--ink-muted); font-size: 12px; flex: none; }
.subject { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat { flex: none; font-variant-numeric: tabular-nums; font-size: 12px; }
.add { color: var(--good); }
.del { color: var(--critical); margin-left: 6px; }
.when { color: var(--ink-muted); font-size: 12px; flex: none; white-space: nowrap; }
.comments .who { color: var(--ink-2); font-size: 12px; flex: none; }
.comments .text { flex: 1; min-width: 0; }

.evidence li { padding: 6px 0; border-bottom: 1px solid var(--hairline); font-size: 13px; }
.evidence li:last-child { border-bottom: none; }
.evidence .claim { color: var(--ink-2); }
.evidence .source { color: var(--ink-muted); font-size: 12px; margin-left: 8px; }

/* ----------------------------------------------------------------- the void */

.empty { max-width: 60ch; padding: 40px 0; }
.empty p { color: var(--ink-2); }
.empty-note { font-size: 13px; color: var(--ink-muted); }

/* ---------------------------------------------------- blazor's own error bar */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--warning);
    color: #0b0b0b;
    padding: 10px 16px;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* -------------------------------------------------- the group-project cohort */

/* A second list rather than a badge on the first: these clients are read from a different chat,
   so the Message column means something else for them and the two should not sit in one column. */
.cohort { margin-top: 34px; }

.cohort h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.cohort-chat {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 400;
    color: var(--ink-muted);
}

.cohort-note {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--ink-muted);
    max-width: 76ch;
}

/* Teammates keep the neutral hairline: their work is context, never this client's activity, and
   the transcript and commit list have to show that at a glance. */
.transcript .from-teammate { border-left-color: var(--hairline); }
.transcript .from-teammate .msg-body { color: var(--ink-2); }

.commits li.theirs .subject { font-weight: 550; }
.commits li:not(.theirs) .subject { color: var(--ink-muted); }

.pill-group { border-color: var(--steady); color: var(--steady); }

/* Blank for everyone not on the project, so the column reads as "not applicable" rather than
   as a missing measurement. */
.group-col { border-left: 1px solid var(--hairline); }

.cohort-members {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 2fr);
    gap: 4px 14px;
    align-items: baseline;
    font-size: 13px;
}

.cohort-members li {
    display: contents;
}

.cohort-members .member-age { justify-self: end; }

.cohort-members .member-why {
    color: var(--ink-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
