/* Colors. Dark mode picks its own steps rather than flipping these. */
:root {
    color-scheme: light dark;
    --bg: #f4f6fb; --panel: #fff; --text: #131c2e; --muted: #556077; --line: #e0e5ef; --field-line: #c3cbdb;
    --accent: #2457d6; --accent-hover: #1c46b0; --accent-text: #fff; --ring: rgb(36 87 214 / .28);
    --red: #b3261e; --red-bg: #fdecea; --red-fill: #d03b3b;
    --yellow: #8a5a00; --yellow-bg: #fff4d6; --yellow-fill: #e8a317;
    --green: #1c6b3a; --green-bg: #e6f4ea; --green-fill: #1e8a4c;
    --grey: #556077; --grey-bg: #ebeef4; --grey-fill: #a9b2c3;
    --navy: #0e1a33; --navy-2: #1b3161; --on-navy: #fff; --on-navy-muted: #b4c0dc;
    --shadow: 0 1px 2px rgb(19 28 46 / .06), 0 6px 20px rgb(19 28 46 / .06);
    --radius: 10px; --control: 2.875rem;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23556077' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    --tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0c1220; --panel: #151d2f; --text: #e8edf7; --muted: #9ba8c2; --line: #27324a; --field-line: #3a4764;
        --accent: #7ea6ff; --accent-hover: #9dbbff; --accent-text: #0a1430; --ring: rgb(126 166 255 / .35);
        --red: #ff8a80; --red-bg: #361c20; --red-fill: #e66767;
        --yellow: #f5c35c; --yellow-bg: #33290f; --yellow-fill: #d99a1e;
        --green: #7fd39c; --green-bg: #12301f; --green-fill: #2f9e66;
        --grey: #9ba8c2; --grey-bg: #222c42; --grey-fill: #55617c;
        --navy: #0a1022; --navy-2: #141f40;
        --shadow: 0 1px 2px rgb(0 0 0 / .4);
        --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ba8c2' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
        --tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a1430' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
    }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -.015em; margin: 0 0 .75rem; }
h2 { font-size: 1.15rem; line-height: 1.3; letter-spacing: -.005em; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
main.page { max-width: 68rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.icon { width: 1.15rem; height: 1.15rem; flex: none; }

/* The header: name and organization, then the menu. */
.brand { display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; font-weight: 700; font-size: 1.2rem; letter-spacing: -.01em; color: inherit; text-decoration: none; }
.brand img { display: block; }
.top { background: linear-gradient(120deg, var(--navy), var(--navy-2)); color: var(--on-navy); }
.top-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1rem; max-width: 68rem; margin: 0 auto; padding: .6rem 1rem 0; }
.sign-out { display: flex; align-items: center; gap: .75rem; margin: 0; color: var(--on-navy-muted); font-size: .9rem; }
.top .sign-out button { min-height: 44px; background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .22); color: var(--on-navy); }
.top .sign-out button:hover { background: rgb(255 255 255 / .16); }
.top nav { display: flex; flex-wrap: wrap; gap: .15rem; flex: 1 0 100%; margin-top: .35rem; }
.top nav a { display: inline-flex; align-items: center; gap: .4rem; min-height: 46px; padding: 0 .7rem; text-decoration: none; color: var(--on-navy-muted); font-size: .95rem; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; }
.top nav a:hover { color: var(--on-navy); background: rgb(255 255 255 / .07); }
.top nav a.on { color: var(--on-navy); border-bottom-color: #7ea6ff; background: rgb(255 255 255 / .1); font-weight: 600; }
.top :focus-visible { outline-color: #9dbbff; }

/* One set of form controls: the same height, border, corners, type and focus. */
input, select, textarea, button, .button { font: inherit; min-height: var(--control); border-radius: var(--radius); }
input, select, textarea { width: 100%; padding: .5rem .8rem; border: 1px solid var(--field-line); background-color: var(--panel); color: var(--text); line-height: 1.4; transition: border-color .12s, box-shadow .12s; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { height: var(--control); }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
select { -webkit-appearance: none; appearance: none; padding-right: 2.5rem; background-image: var(--chevron); background-repeat: no-repeat; background-position: right .75rem center; background-size: 1.1rem; text-overflow: ellipsis; cursor: pointer; }
select[multiple] { height: auto; padding-right: .8rem; background-image: none; }
input[type=file] { padding: .3rem; cursor: pointer; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; height: 2.15rem; margin-right: .75rem; padding: 0 .8rem; border: 0; border-radius: 7px; background: var(--grey-bg); color: var(--text); cursor: pointer; }
input[type=checkbox], input[type=radio] { -webkit-appearance: none; appearance: none; width: 1.35rem; min-width: 1.35rem; height: 1.35rem; min-height: 1.35rem; margin: 0; padding: 0; border-width: 1.5px; border-radius: 6px; background-position: center; background-repeat: no-repeat; background-size: 1rem; cursor: pointer; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:checked { background-color: var(--accent); border-color: var(--accent); background-image: var(--tick); }
input[type=radio]:checked { border: 6px solid var(--accent); }
input[type=checkbox]:focus, input[type=radio]:focus { box-shadow: none; }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { box-shadow: 0 0 0 4px var(--ring); }
input.code { font-size: 1.5rem; letter-spacing: .35em; text-align: center; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: 0 1.15rem; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); font-weight: 600; cursor: pointer; text-decoration: none; transition: background-color .12s, border-color .12s; }
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.secondary, .button.secondary { background: var(--panel); border-color: var(--field-line); color: var(--accent); }
button.secondary:hover, .button.secondary:hover { background: var(--grey-bg); border-color: var(--accent); }
button.quiet { background: transparent; border-color: transparent; color: var(--accent); }
button.quiet:hover { background: var(--grey-bg); border-color: transparent; }
button.danger { background: var(--panel); border-color: var(--red); color: var(--red); }
button.danger:hover { background: var(--red-bg); border-color: var(--red); }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
@media (forced-colors: active) {
    input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid; }
    input[type=checkbox], input[type=radio] { -webkit-appearance: auto; appearance: auto; }
}
label { display: block; font-weight: 600; font-size: .95rem; }
label input, label select, label textarea { margin-top: .35rem; font-weight: 400; font-size: 1rem; }
label.check { display: flex; align-items: center; gap: .6rem; min-height: 44px; font-weight: 400; font-size: 1rem; cursor: pointer; }
label.check input { margin: 0; flex: none; }
.stack > * { margin-bottom: 1rem; }
.stack > button { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.row > label { flex: 1 1 11rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.15rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.notice { border: 1px solid var(--line); border-left-width: 5px; border-radius: var(--radius); padding: .75rem 1rem .05rem; margin-bottom: 1rem; background: var(--panel); }
.notice.bad { border-color: var(--red); background: var(--red-bg); }
.notice.good { border-color: var(--green); background: var(--green-bg); }
.notice.warn { border-color: var(--yellow); background: var(--yellow-bg); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; overflow-wrap: anywhere; }
pre { background: var(--grey-bg); padding: .75rem; border-radius: 8px; overflow-x: auto; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
th.actions-cell, td.actions-cell { text-align: right; }
td.actions-cell button { white-space: nowrap; }

/* Status is always an icon and words as well as a color. */
.red { --status: var(--red); --status-bg: var(--red-bg); --status-fill: var(--red-fill); }
.yellow { --status: var(--yellow); --status-bg: var(--yellow-bg); --status-fill: var(--yellow-fill); }
.green { --status: var(--green); --status-bg: var(--green-bg); --status-fill: var(--green-fill); }
.unknown { --status: var(--grey); --status-bg: var(--grey-bg); --status-fill: var(--grey-fill); }
.status-icon { width: 1.5rem; height: 1.5rem; flex: none; color: var(--status); }
.badge { display: grid; place-items: center; flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; background: var(--status-bg); }

.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .75rem; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 1rem; margin: 1.5rem 0 .5rem; }
.section-head h2 { margin: 0; }

/* The top of the status page: one sentence, the counts, and their proportions. */
.overview { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--status-fill); border-radius: 14px; padding: 1.15rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.overview-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.overview-head .badge { width: 3.5rem; height: 3.5rem; }
.overview-head .status-icon { width: 2.1rem; height: 2.1rem; }
.overview-head h2 { font-size: 1.5rem; margin: 0; }
.overview-head p { margin: 0; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: .6rem; }
.count { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 .5rem; padding: .7rem .85rem; border-radius: 12px; background: var(--status-bg); }
.count strong { font-size: 1.9rem; line-height: 1.15; }
.count span { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; }
.count.zero { background: transparent; border: 1px solid var(--line); }
.count.zero .status-icon { color: var(--grey-fill); }
.count.zero strong { color: var(--muted); }
.mix { display: flex; gap: 2px; height: .6rem; margin-top: .9rem; border-radius: 4px; overflow: hidden; }
.mix span { flex: 1 1 0; min-width: .5rem; background: var(--status-fill); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
@media (max-width: 52rem) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { display: flex; align-items: center; gap: .75rem; min-height: 5.5rem; padding: .85rem; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; overflow-wrap: anywhere; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.tile:hover { border-color: var(--status-fill); transform: translateY(-2px); }
.tile.red, .tile.yellow { border-color: var(--status-fill); background: var(--status-bg); }
.tile.red .badge, .tile.yellow .badge { background: var(--panel); }
.tile-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tile .name { font-weight: 700; line-height: 1.3; }
.tile .line { color: var(--muted); font-size: .9rem; }
.tile.red .line, .tile.yellow .line { color: var(--status); font-weight: 600; }
.tile > .icon { color: var(--muted); }
.all-clear { grid-column: 1 / -1; }
/* On a phone the counts are one line each, and tiles put the icon above the name. */
@media (max-width: 34rem) {
    .count { display: flex; gap: .45rem; padding: .55rem .7rem; }
    .count strong { font-size: 1.35rem; }
    .overview-head h2 { font-size: 1.3rem; }
    .tile { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .tile-text { flex: none; width: 100%; }
    .tile > .icon { display: none; }
}

.empty { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); align-items: center; gap: 1.5rem; }
.empty-art { background: linear-gradient(150deg, var(--navy), var(--navy-2)); border-radius: 12px; padding: 1rem; }
.art { display: block; width: 100%; height: auto; }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding: .35rem 0 .35rem 2.75rem; min-height: 2.75rem; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: .2rem; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 700; }
@media (max-width: 44rem) { .empty { grid-template-columns: minmax(0, 1fr); } }

/* Signed-out pages: what NetHerald is on one side, the form on the other. */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.pitch { display: flex; flex-direction: column; gap: 1.5rem; padding: 2rem clamp(1.25rem, 4vw, 3.5rem); background: radial-gradient(circle at 20% 15%, #2a4a94 0, transparent 55%), linear-gradient(160deg, var(--navy-2), var(--navy)); color: var(--on-navy); }
.pitch .brand { align-self: flex-start; font-size: 1.35rem; }
.pitch-body { margin: auto 0; max-width: 32rem; }
.pitch-title { font-size: clamp(1.5rem, 2.6vw, 2.15rem); line-height: 1.2; font-weight: 700; letter-spacing: -.02em; margin-bottom: 2rem; }
.pitch .art { margin-bottom: 2rem; }
.pitch ul { list-style: none; padding: 0; margin: 0; color: var(--on-navy-muted); }
.pitch li { display: flex; align-items: center; gap: .65rem; padding: .3rem 0; }
.pitch li .icon { width: 1.35rem; height: 1.35rem; color: #9dbbff; }
.form-side { display: grid; place-items: center; padding: 2rem 1rem; }
.card { width: 100%; max-width: 26rem; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 2rem; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.card .actions .button { flex: 1 1 100%; }
@media (max-width: 52rem) {
    .split { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .pitch { padding: .6rem 1.25rem; }
    .pitch-body { display: none; }
    .form-side { align-items: start; padding: 1.25rem .75rem; }
    .card { padding: 1.25rem; }
}
.hero { display: flex; gap: .9rem; align-items: flex-start; padding: 1rem; margin-bottom: 1rem; border-radius: 12px; border: 1px solid var(--status); border-left-width: 6px; background: var(--status-bg); }
.hero .status-icon { width: 2.5rem; height: 2.5rem; }
.hero p { margin: 0; }
.strip { display: grid; grid-template-columns: repeat(96, 1fr); height: 2rem; border-radius: 6px; overflow: hidden; background: var(--grey-bg); }
.strip span.up { background: var(--green); }
.strip span.down { background: var(--red); }
.strip-labels { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.tag { display: inline-block; padding: 0 .5rem; border-radius: 8px; border: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.tag.good { border-color: var(--green); color: var(--green); }
.tag.warn { border-color: var(--yellow); color: var(--yellow); }
.tag.bad { border-color: var(--red); color: var(--red); }

td.mono { white-space: nowrap; }
td select { min-width: 11rem; }
.row + .table-wrap { margin-top: 1rem; }

@media (max-width: 52rem) {
    .top .icon { display: none; }
    .top nav { gap: 0; }
    .top nav a { min-height: 44px; padding: 0 .45rem; font-size: .875rem; }
    .sign-out { font-size: .875rem; }
    .sign-out .org { display: none; }
}

.update + .update { border-top: 1px solid var(--line); padding-top: .75rem; }
.update p { overflow-wrap: anywhere; }
textarea { resize: vertical; }
details.extra summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; gap: .4rem; }
fieldset { min-width: 0; margin: 0 0 1rem; padding: .5rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); }
fieldset legend { font-weight: 600; padding: 0 .35rem; }

/* Page and panel titles carry the menu's icons. */
.page-title { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.25rem; }
.page-title h1 { margin: 0; }
.page-title p { margin: .25rem 0 0; max-width: 46rem; }
.icon-badge { display: grid; place-items: center; flex: none; width: 3rem; height: 3rem; border-radius: 14px; background: linear-gradient(140deg, #3f6fe8, #2045b0); color: #fff; box-shadow: var(--shadow); }
.icon-badge .icon { width: 1.6rem; height: 1.6rem; }
h2.titled { display: flex; align-items: center; gap: .55rem; }
h2.titled .icon { width: 1.35rem; height: 1.35rem; color: var(--accent); }
.actions > h2 { margin: 0; }
.none { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 1.25rem .5rem .5rem; text-align: center; color: var(--muted); }
.none .icon-badge { background: var(--grey-bg); color: var(--accent); box-shadow: none; border-radius: 50%; width: 3.5rem; height: 3.5rem; }
.none p { margin: 0; max-width: 26rem; }
.back { display: inline-flex; align-items: center; gap: .3rem; min-height: 44px; text-decoration: none; font-weight: 600; }
.back .icon { transform: rotate(180deg); }

/* Longer forms: related fields side by side where there is room. */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; align-items: end; }
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0 1rem; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 0 1rem; align-items: start; }
.columns > * { min-width: 0; }
.suffix { max-width: 12rem; }
.sights { list-style: none; margin: 0; padding: 0; }
.sights li { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.sights li:last-child { border-bottom: 0; }
.steps-card { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.card .icon-badge { margin-bottom: 1rem; }

/* On a phone each row of a list becomes a small card, so nothing scrolls sideways. */
@media (max-width: 40rem) {
    table.stacks, table.stacks tbody, table.stacks tr, table.stacks td { display: block; width: 100%; }
    table.stacks thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    table.stacks tr { padding: .6rem 0; border-bottom: 1px solid var(--line); }
    table.stacks tr:last-child { border-bottom: 0; }
    table.stacks td { border: 0; padding: .2rem 0; white-space: normal; overflow-wrap: anywhere; }
    table.stacks td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
    table.stacks td.actions-cell { display: flex; flex-wrap: wrap; gap: .4rem; text-align: left; padding-top: .45rem; }
    table.stacks select { min-width: 0; width: 100%; }
    .columns, .fields, .options { grid-template-columns: minmax(0, 1fr); }
    .row > label { flex-basis: 100%; }
    .page-title .icon-badge { width: 2.5rem; height: 2.5rem; border-radius: 12px; }
    .page-title .icon-badge .icon { width: 1.35rem; height: 1.35rem; }
}
input.suffix { display: block; }
details.extra summary { list-style: none; color: var(--accent); }
details.extra summary::-webkit-details-marker { display: none; }
details.extra summary::before { content: ""; width: .5rem; height: .5rem; margin-right: .2rem; border-right: 2px solid; border-bottom: 2px solid; transform: rotate(-45deg); transition: transform .12s; }
details.extra[open] summary::before { transform: rotate(45deg); }
