/* Reporting prototype: see the reports a party runs. Self-contained: no import
 * and no build step, so the page opens straight from file://.
 *
 * The design tokens are the application's own, copied from
 * projects/ores.web/packages/web/src/styles.css, so the screen reads in the
 * colours the real one uses. The prototype's own chrome -- the banner and the
 * variant bar -- is deliberately unlike the design on trial. */

:root {
    --bg: #121214;
    --panel: #1a1a1e;
    --panel-2: #26262b;
    --line: #30363d;
    --line-soft: #21262d;
    --line-strong: #4a5568;
    --ink: #e3e3e6;
    --ink-dim: #a1a1aa;
    --ink-faint: #71717a;
    --accent: #58a6ff;
    --accent-bright: #8ab4f8;
    --accent-dim: #21262d;
    --ok: #3fb950;
    --warn: #d29922;
    --bad: #f85149;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    --radius: 0.5rem;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.5 var(--sans);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; text-wrap: balance; letter-spacing: -0.01em; font-weight: 600; }
p { margin: 0; }

.mono { font-family: var(--mono); }
.dim { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }
.hint { color: var(--ink-faint); font-size: 12px; }

/* -------------------------------------------------------------- chrome */
/* The prototype's own chrome, deliberately unlike the design on trial. */

.proto-note {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    padding: 6px 14px;
    background: repeating-linear-gradient(45deg, #2a2113, #2a2113 10px, #241d11 10px, #241d11 20px);
    border-bottom: 1px solid #4a3a17;
    color: var(--warn);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.proto-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: #0b0e13;
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.55);
    font-size: 12px;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
}

.proto-bar .bar-line {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.proto-bar button {
    background: none;
    border: 1px solid transparent;
    color: var(--ink-dim);
    font-size: 12px;
    line-height: 1;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 999px;
}

.proto-bar button:hover { background: var(--panel-2); color: var(--ink); }
.proto-bar button.on { background: var(--accent-dim); color: var(--ink); border-color: var(--line); }
.proto-bar .label { padding: 0 6px; color: var(--ink-dim); white-space: nowrap; }
.proto-bar .label b { color: var(--accent); }
.proto-bar .sep { color: var(--line); padding: 0 2px; }
.proto-bar .tag-prototype {
    border: 1px solid #4a3a17;
    color: var(--warn);
    background: #2a2113;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.proto-bar .gist {
    flex: 1 1 220px;
    min-width: 0;
    color: var(--ink-dim);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 6px;
}
.proto-bar .state-panel {
    border-top: 1px solid var(--line-soft);
    overflow-y: auto;
    max-height: 45vh;
    padding: 10px 14px 14px;
}
.proto-bar .state-panel .state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 2px 24px;
    font-size: 12px;
    color: var(--ink-dim);
}
.proto-bar .state-panel .state-grid b { color: var(--ink); font-family: var(--mono); font-weight: 400; }
.proto-bar .state-panel .state-note { color: var(--ink-faint); margin-top: 6px; font-size: 12px; }
.proto-bar .state-panel ol {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-dim);
}

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

.shell { padding-top: 28px; padding-bottom: 12rem; min-height: 100vh; display: flex; flex-direction: column; }

.appheader { border-bottom: 1px solid var(--line); background: var(--bg); }
.appheader-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    max-width: 1200px;
    margin: 0 auto;
    min-width: 0;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand .mark {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: linear-gradient(140deg, var(--accent), #2f6fbf);
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
    color: #06121f;
}
.brand .name { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.appnav { display: flex; align-items: center; gap: 2px; margin-left: 8px; min-width: 0; overflow-x: auto; }
.appnav a {
    color: var(--ink-dim);
    font-size: 13px;
    padding: 6px 10px;
    border-radius: var(--radius);
    white-space: nowrap;
}
.appnav a:hover { background: var(--panel-2); color: var(--ink); }
.appnav a.here { background: var(--panel-2); color: var(--ink); }
.modechip {
    margin-left: auto;
    font-size: 11px;
    letter-spacing: 0.04em;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 10px;
    color: var(--ink-dim);
    white-space: nowrap;
}

main { flex: 1; max-width: 1200px; width: 100%; margin: 0 auto; padding: 22px 20px 0; display: grid; gap: 18px; align-content: start; }

/* --------------------------------------------------------------- page */

.pagehead { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
.pagehead h1 { font-size: 22px; }
.pagehead .lede { color: var(--ink-dim); margin-top: 4px; max-width: 68ch; font-size: 14px; }
.pagehead .actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pagehead .updated { color: var(--ink-faint); font-size: 12px; }

.crumbs { font-size: 12px; color: var(--ink-faint); display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }

.contextbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: var(--radius);
    padding: 9px 16px;
    font-size: 13px;
}
.contextbar .who { color: var(--ink); font-weight: 600; white-space: nowrap; }
.contextbar .hint { flex: 1 1 24rem; color: var(--ink-faint); font-size: 12px; }
.contextbar .tag { margin-left: auto; }

.sectionhead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.sectionhead h2 { font-size: 17px; }
.sectionhead .meta { display: flex; align-items: center; gap: 8px; color: var(--ink-faint); font-size: 12px; flex-wrap: wrap; }

.notice {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    background: var(--bg);
    color: var(--ink-dim);
}
.notice.warn { border-color: #6b4e12; background: #2a2008; color: #f2cc60; }
.notice.err { border-color: #7a2a28; background: #2a1414; color: #ffb4ad; }
.notice b { color: #ffe08a; }

.tag {
    display: inline-block;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--ink-dim);
    padding: 1px 8px;
    font-size: 11px;
    line-height: 1.5;
    white-space: nowrap;
}
.tag.accent { border-color: rgba(88, 166, 255, 0.5); background: rgba(88, 166, 255, 0.1); color: var(--accent-bright); }
.tag.warn { border-color: rgba(210, 153, 34, 0.5); background: rgba(210, 153, 34, 0.1); color: var(--warn); }
.tag.bad { border-color: rgba(248, 81, 73, 0.5); background: rgba(248, 81, 73, 0.1); color: var(--bad); }
.tag.ok { border-color: rgba(63, 185, 80, 0.5); background: rgba(63, 185, 80, 0.1); color: var(--ok); }
.tag.muted { border-color: var(--line-soft); color: var(--ink-faint); }
.tag.dashed { border: 1px dashed var(--line-strong); color: var(--ink-faint); }
.tag.scope { border-color: var(--line); color: var(--ink-dim); font-family: var(--mono); font-size: 10px; }

.btn {
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--ink);
    border-radius: 6px;
    padding: 7px 14px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { border-color: var(--line-strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 600; }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-dim); }
.btn.ghost:hover { color: var(--ink); background: var(--panel-2); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn.linklike { background: none; border-color: var(--line); text-decoration: none; display: inline-block; }

select {
    background: var(--panel-2);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 10px;
    font: inherit;
    font-size: 13px;
}

/* -------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
    text-align: left;
    font-weight: 500;
    color: var(--ink-faint);
    font-size: 12px;
    padding: 6px 12px 6px 0;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
td {
    padding: 9px 12px 9px 0;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}
td:last-child, th:last-child { padding-right: 0; }
td.code { font-family: var(--mono); font-size: 12px; }
td.wrap { white-space: normal; }
td.nowrap { white-space: nowrap; }
td.num { text-align: right; font-family: var(--mono); }
th.num { text-align: right; }
.groupline td { border-bottom: 1px solid var(--line-soft); }
.cellgroup { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rowfoot { color: var(--ink-faint); font-size: 12px; margin-top: 14px; }

tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel-2); }
tr.row-attn td { background: rgba(210, 153, 34, 0.055); }
tr.row-attn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
tr.row-fail td { background: rgba(248, 81, 73, 0.06); }
tr.row-fail td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
tr.row-open td { background: var(--accent-dim); }

.reportname { display: flex; flex-direction: column; gap: 1px; min-width: 11rem; }
.reportname .nm { color: var(--ink); }
.reportname .rf { color: var(--ink-faint); font-size: 12px; }

.errcell { display: flex; align-items: baseline; gap: 6px; flex-wrap: nowrap; white-space: nowrap; }
.errcell .n-err { color: var(--bad); font-family: var(--mono); font-weight: 600; }
.errcell .n-warn { color: var(--warn); font-family: var(--mono); font-weight: 600; }
.errcell .unit { color: var(--ink-dim); }
.errcell .none { color: var(--ink-faint); }

.scopes { display: flex; gap: 4px; flex-wrap: wrap; }
.scopes .s { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-soft); border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--ink-dim); }
.scopes .s b { font-family: var(--mono); font-weight: 600; color: var(--ink); }
.scopes .s .se { color: var(--bad); }
.scopes .s .sw { color: var(--warn); }

/* --------------------------------------------------------------- grid */

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 12px 32px; }
.statgrid .lbl { display: block; color: var(--ink-faint); font-size: 12px; margin-bottom: 4px; }
.statgrid .val { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }

.gaps dl { margin: 0; display: grid; gap: 14px; font-size: 13px; }
.gaps dt { color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.gaps dd { margin: 0; color: var(--ink-dim); }

/* A definition list in the state panel and anywhere else that needs labels. */
.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv td { padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.kv tr:last-child td { border-bottom: none; }
.kv td:first-child { color: var(--ink-faint); width: 42%; }

/* ------------------------------------------------------- reporting parts */

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.filters .grp { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filters .glbl { color: var(--ink-faint); font-size: 12px; }
.chip {
    border: 1px solid var(--line);
    background: none;
    color: var(--ink-dim);
    border-radius: 999px;
    padding: 3px 10px;
    font: inherit;
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
    white-space: nowrap;
}
.chip:hover { background: var(--panel-2); color: var(--ink); }
.chip.on { background: var(--accent-dim); border-color: var(--line-strong); color: var(--ink); }
.chip .n { font-family: var(--mono); color: var(--ink-faint); margin-left: 5px; }
.chip.on .n { color: var(--accent-bright); }

.healthsum { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 10px; }
.hcard {
    border: 1px solid var(--line-soft);
    background: var(--bg);
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
}
.hcard:hover { border-color: var(--line-strong); }
.hcard.on { border-color: var(--accent); background: var(--accent-dim); }
.hcard .hn { font-size: 20px; font-family: var(--mono); }
.hcard .hl { font-size: 12px; color: var(--ink-dim); }
.hcard.attn .hn { color: var(--warn); }
.hcard.fail .hn { color: var(--bad); }
.hcard.clean .hn { color: var(--ok); }
.hcard.run .hn { color: var(--accent-bright); }
.hcard.never .hn { color: var(--ink-faint); }

.defbar { display: flex; flex-wrap: wrap; gap: 18px; align-items: baseline; }
.defbar .item { font-size: 13px; }
.defbar .item .k { color: var(--ink-faint); font-size: 12px; display: block; }

.detailhead { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.detailhead .back { font-size: 13px; }

.errlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.errlist li {
    border: 1px solid var(--line-soft);
    border-left: 3px solid var(--line-strong);
    border-radius: 4px;
    padding: 8px 12px;
    background: var(--bg);
    font-size: 13px;
}
.errlist li.sev-error { border-left-color: var(--bad); }
.errlist li.sev-warning { border-left-color: var(--warn); }
.errlist .eline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 3px; }
.errlist .msg { color: var(--ink-dim); }
.errlist .subj { color: var(--ink); font-family: var(--mono); font-size: 12px; }

.why { color: var(--ink-dim); font-size: 12px; max-width: 46ch; }
.why .lbl { color: var(--warn); }

.hiddenrow { border: 1px dashed var(--line); border-radius: 6px; padding: 10px 14px; color: var(--ink-dim); font-size: 13px; background: var(--bg); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }

.runmeta { color: var(--ink-faint); font-size: 12px; font-family: var(--mono); }

.legend { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--ink-faint); font-size: 12px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend .sw.warn { background: var(--warn); }
.legend .sw.bad { background: var(--bad); }
.legend .sw.ok { background: var(--ok); }

@media (max-width: 820px) {
    .appheader-inner { padding: 12px 14px; }
    .appnav { display: none; }
}
