/* Monk V2 operator console — hand-written, no build step.
   One stylesheet for every GUI page; light and dark follow the operating system. */

:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-sunken: #f8fafc;
    --border: #dde2e8;
    --border-strong: #c4ccd6;
    --text: #15181d;
    --muted: #5b6472;
    --accent: #0b5fcb;
    --accent-text: #ffffff;
    --good: #1a6f45;
    --good-bg: #e7f5ed;
    --bad: #a8201a;
    --bad-bg: #fdeceb;
    --warn: #8a5300;
    --warn-bg: #fdf3e2;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #101418;
        --surface: #181d23;
        --surface-sunken: #141a20;
        --border: #2a323c;
        --border-strong: #3a444f;
        --text: #e7ebf0;
        --muted: #9aa5b4;
        --accent: #5ba2ff;
        --accent-text: #06121f;
        --good: #6ad39a;
        --good-bg: #122a1e;
        --bad: #ff9a92;
        --bad-bg: #2d1514;
        --warn: #e8bd72;
        --warn-bg: #2a2012;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--sans);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--accent); }

code { font-family: var(--mono); font-size: .92em; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
    position: absolute; left: -9999px; top: 0; background: var(--surface);
    padding: .5rem .75rem; z-index: 10;
}
.skip:focus { left: .5rem; top: .5rem; }

/* ---- chrome ---- */

.chrome {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
}

.chrome-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: .6rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand { display: flex; flex-direction: column; line-height: 1.15; }
.brand-mark { font-weight: 700; letter-spacing: -.01em; }
.brand-mark span { color: var(--accent); }
.brand-sub { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.brand-stacked { align-items: center; margin-bottom: 1rem; }

.nav { display: flex; gap: .25rem; flex: 1 1 auto; flex-wrap: wrap; }

.nav-item {
    padding: .35rem .6rem;
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
    color: var(--muted);
}
.nav-item:hover { background: var(--surface-sunken); color: var(--text); }
.nav-item.is-current { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.nav-item.is-soon { opacity: .45; cursor: not-allowed; }
.nav-item.is-soon:hover { background: none; color: var(--muted); }

.who { display: flex; align-items: center; gap: .5rem; font-size: 13px; }
.tenant, .country-static, .user {
    padding: .2rem .45rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    white-space: nowrap;
}
.tenant { color: var(--text); font-weight: 600; }
.country-form { margin: 0; }
.country-form select {
    font: inherit; padding: .2rem .3rem; border: 1px solid var(--border);
    border-radius: 6px; background: var(--surface); color: var(--text);
}

/* ---- layout ---- */

.page { max-width: 1180px; margin: 0 auto; padding: 1.25rem 1rem 2.5rem; width: 100%; flex: 1 0 auto; }
.page-centred { display: flex; align-items: center; justify-content: center; }

.foot {
    border-top: 1px solid var(--border);
    padding: .75rem 1rem;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}
.card-narrow { width: 100%; max-width: 380px; }

.h1 { font-size: 22px; margin: 0 0 .35rem; letter-spacing: -.01em; }
.lede { margin: 0 0 .75rem; color: var(--muted); }
.scope { font-family: var(--mono); font-size: 12px; margin-left: .35rem; }
.fine { color: var(--muted); font-size: 12.5px; }
.boundary { margin-top: 1.5rem; }
.head { margin-bottom: 1rem; }

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

.button {
    display: inline-block;
    font: inherit;
    font-size: 14px;
    padding: .4rem .75rem;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
}
.button:hover { border-color: var(--accent); }
.button-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.button-primary:disabled { opacity: .45; cursor: default; }
.button-quiet { background: none; border-color: transparent; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: .25rem; }
.field label { font-size: 13px; font-weight: 600; }
.field input {
    font: inherit; padding: .5rem .6rem; border: 1px solid var(--border-strong);
    border-radius: 6px; background: var(--surface); color: var(--text);
}
.field input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field-error { color: var(--bad); font-size: 12.5px; }
.stack { display: flex; flex-direction: column; gap: .85rem; }

/* ---- flashes ---- */

.flash {
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: 6px;
    padding: .55rem .75rem;
    margin: 0 0 1rem;
    font-size: 14px;
}
.flash-good { background: var(--good-bg); border-left-color: var(--good); color: var(--good); }
.flash-bad { background: var(--bad-bg); border-left-color: var(--bad); color: var(--bad); }
.flash-warn { background: var(--warn-bg); border-left-color: var(--warn); color: var(--warn); }
.flash-info { background: var(--surface); border-left-color: var(--accent); }

.note {
    background: var(--surface-sunken);
    border: 1px dashed var(--border-strong);
    border-radius: 6px;
    padding: .5rem .75rem;
    color: var(--muted);
    font-size: 13px;
    margin: 0 0 1rem;
}

/* ---- toolbar: days and search ---- */

.toolbar {
    display: flex;
    gap: .75rem;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.days { display: flex; gap: .35rem; }
.day {
    display: flex; flex-direction: column; gap: .1rem;
    padding: .4rem .7rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    min-width: 92px;
}
.day:hover { border-color: var(--accent); }
.day.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.day-label { font-size: 13px; font-weight: 600; }
.day-date { font-size: 11.5px; opacity: .8; font-family: var(--mono); }

.search { display: flex; gap: .35rem; align-items: center; }
.search input {
    font: inherit; padding: .4rem .6rem; min-width: 240px;
    border: 1px solid var(--border-strong); border-radius: 6px;
    background: var(--surface); color: var(--text);
}

/* ---- summary ---- */

.summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .75rem 1rem;
    margin-bottom: 1rem;
}
.summary-numbers { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; }
.n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.n-good { color: var(--good); }
.n-bad { color: var(--bad); }
.n-label { color: var(--muted); font-size: 13px; margin-right: .6rem; }
.n-of { color: var(--muted); font-size: 13px; }
.bar { height: 6px; background: var(--surface-sunken); border-radius: 999px; overflow: hidden; margin-top: .6rem; }
.bar span { display: block; height: 100%; background: var(--good); }

.count-line { color: var(--muted); font-size: 13px; margin: 0 0 .5rem; }

/* ---- channel rows ---- */

.group { margin-bottom: 1.25rem; }
.group-head {
    font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted); margin: 0 0 .4rem; display: flex; align-items: center; gap: .4rem;
}
.group-count {
    font-size: 11px; background: var(--surface-sunken); border: 1px solid var(--border);
    border-radius: 999px; padding: 0 .4rem; letter-spacing: 0;
}

.rows { display: grid; gap: .5rem; }

.row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .6rem .75rem;
    display: grid;
    gap: .4rem;
}
.row.is-failed { border-color: var(--bad); }
.row.is-dirty { border-color: var(--accent); }

.row-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.keyword { font-family: var(--mono); font-weight: 700; }
.schedule { color: var(--muted); font-size: 12px; margin-left: auto; text-align: right; }

.badge {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    padding: .1rem .4rem; border-radius: 999px; border: 1px solid transparent;
}
.badge-loaded { background: var(--good-bg); color: var(--good); }
.badge-missing { background: var(--bad-bg); color: var(--bad); }

textarea {
    font: inherit;
    width: 100%;
    resize: vertical;
    padding: .5rem .6rem;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--surface-sunken);
    color: var(--text);
}

/* Read-only: an operator who may look but not load content. */
textarea[readonly] {
    background: var(--surface);
    color: var(--muted);
    border-style: dashed;
    cursor: default;
}

.row-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.count { font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.is-near { color: var(--warn); }
.count.is-full { color: var(--bad); font-weight: 700; }
.row-error { margin: 0; color: var(--bad); font-size: 13px; }

.empty { text-align: center; }

@media (max-width: 720px) {
    .chrome-inner { gap: .5rem; }
    .nav { order: 3; width: 100%; }
    .who { order: 2; margin-left: auto; }
    .toolbar { align-items: stretch; }
    .search input { min-width: 0; flex: 1 1 auto; }
    .days { overflow-x: auto; }
    .schedule { margin-left: 0; width: 100%; text-align: left; }
}
