/* Miscited — an operations console, not a marketing dashboard.
   Numbers are the interface: every rate is set beside its interval and its sample size. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:        #0b0e12;
  --ink-2:      #12161d;
  --panel:      #161b24;
  --panel-2:    #1c222d;
  --line:       #262e3b;
  --line-soft:  #1f2631;
  --text:       #e6e9ef;
  --text-dim:   #9aa4b5;
  --text-faint: #6b7688;
  --amber:      #e8a33d;
  --amber-dim:  #8a6524;
  --red:        #e0574c;
  --red-dim:    #6e2a25;
  --green:      #4bb98a;
  --green-dim:  #235a45;
  --blue:       #6aa6e8;
  --violet:     #a98be0;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  font-family: var(--sans);
  background: var(--ink);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px;
  background: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.brandmark { display: flex; align-items: center; gap: 9px; text-decoration: none; flex: 0 0 auto; }
.mark { color: var(--amber); font-size: 19px; line-height: 1; }
.wordmark { font-weight: 650; letter-spacing: -0.015em; font-size: 16px; }
.promise { color: var(--text-dim); font-size: 12.5px; flex: 1 1 auto; letter-spacing: 0.01em; }
.whoami { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-dim); }
.whoami .tenant { color: var(--text); font-weight: 550; }
.sep { color: var(--line); }
.linkbtn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font: inherit; text-decoration: underline; text-underline-offset: 3px; padding: 0;
}
.linkbtn:hover { color: var(--amber); }

/* --------------------------------------------------------------------- nav */
.mainnav {
  display: flex; gap: 2px; padding: 0 20px;
  background: var(--ink-2); border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.navlink {
  padding: 9px 12px; font-size: 13px; color: var(--text-dim);
  text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap;
}
.navlink:hover { color: var(--text); }
.navlink.active { color: var(--amber); border-bottom-color: var(--amber); }

main { max-width: 1180px; margin: 0 auto; padding: 30px 28px 70px; }

/* ------------------------------------------------------------------ typography */
h1 { font-size: 25px; font-weight: 640; letter-spacing: -0.02em; margin-bottom: 6px; }
h2 { font-size: 17px; font-weight: 620; letter-spacing: -0.01em; }
h3 { font-size: 14.5px; font-weight: 600; }
.lede { color: var(--text-dim); font-size: 14px; max-width: 76ch; margin-bottom: 26px; }
.eyebrow {
  font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600;
}

/* ---------------------------------------------------------------- sections */
.section { margin-bottom: 38px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding-bottom: 10px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.section-head .count { font-family: var(--mono); font-size: 12px; color: var(--text-faint); }
.section-note { color: var(--text-dim); font-size: 12.5px; margin: -6px 0 14px; max-width: 82ch; }

/* ------------------------------------------------------------------- cards */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 7px; padding: 16px 18px; margin-bottom: 10px;
  display: block; text-decoration: none; color: inherit;
}
a.card:hover { border-color: var(--amber-dim); background: var(--panel-2); }
.card-top { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.card-headline { font-size: 15px; font-weight: 560; line-height: 1.45; letter-spacing: -0.005em; }
.card-meta {
  display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px;
  font-size: 12px; color: var(--text-dim); font-family: var(--mono);
}
.card-meta b { color: var(--text); font-weight: 550; }

.severity {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 3px; font-weight: 700; white-space: nowrap;
}
.severity.critical { background: var(--red-dim); color: #ffd8d4; }
.severity.high     { background: #5c3f18; color: #ffdca8; }
.severity.medium   { background: #2c3a4d; color: #bcd4f0; }
.severity.low      { background: var(--line); color: var(--text-dim); }

.pill {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px;
  border: 1px solid var(--line); color: var(--text-dim); font-family: var(--mono);
}
.pill.amber { border-color: var(--amber-dim); color: var(--amber); }
.pill.green { border-color: var(--green-dim); color: var(--green); }
.pill.red   { border-color: var(--red-dim); color: var(--red); }
.pill.sim   { border-color: var(--violet); color: var(--violet); }

/* ------------------------------------------------------------- measurement */
.measure { font-family: var(--mono); font-size: 13px; }
.measure .point { color: var(--text); font-weight: 600; }
.measure .ci { color: var(--text-dim); }
.measure .n { color: var(--text-faint); }
.measure.insufficient { color: var(--text-faint); font-style: italic; }

.metric-row { display: flex; gap: 26px; flex-wrap: wrap; margin: 14px 0; }
.metric { min-width: 130px; }
.metric .label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.09em; }
.metric .value { font-family: var(--mono); font-size: 21px; font-weight: 600; margin-top: 2px; }
.metric .sub { font-size: 11.5px; color: var(--text-dim); font-family: var(--mono); }

/* ------------------------------------------------------------------ tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:hover td { background: var(--panel-2); }
td.mono, th.mono { font-family: var(--mono); font-size: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }

/* ------------------------------------------------------------------- forms */
form.stack { display: flex; flex-direction: column; gap: 12px; max-width: 620px; }
label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; background: var(--ink); border: 1px solid var(--line); border-radius: 5px;
  color: var(--text); padding: 8px 10px; font: inherit; font-size: 13.5px;
}
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 130px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber-dim); }
button.primary {
  background: var(--amber); color: #1a1206; border: none; border-radius: 5px;
  padding: 9px 16px; font: inherit; font-weight: 620; font-size: 13.5px; cursor: pointer;
}
button.primary:hover { filter: brightness(1.08); }
button.secondary {
  background: transparent; color: var(--text); border: 1px solid var(--line);
  border-radius: 5px; padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer;
}
button.secondary:hover { border-color: var(--amber-dim); color: var(--amber); }
button.danger { background: transparent; color: var(--red); border: 1px solid var(--red-dim); border-radius: 5px; padding: 8px 14px; font: inherit; font-size: 13px; cursor: pointer; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 14px; }
legend { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.1em; padding: 0 6px; }

/* ------------------------------------------------------------------- flash */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 18px; font-size: 13.5px; }
.flash.ok { background: var(--green-dim); color: #d5f5e6; }
.flash.error { background: var(--red-dim); color: #ffd8d4; }

/* ------------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 30px; }
.login-card .mark { font-size: 26px; }
.login-card h1 { font-size: 21px; margin: 12px 0 4px; }
.login-card .lede { font-size: 13px; margin-bottom: 22px; }
.hint { font-size: 12px; color: var(--text-faint); margin-top: 16px; font-family: var(--mono); }

/* ------------------------------------------------------------------ detail */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 22px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 16px 18px; margin-bottom: 14px; }
.panel h3 { margin-bottom: 10px; }
.answer {
  font-size: 13px; line-height: 1.6; background: var(--ink); border: 1px solid var(--line-soft);
  border-left: 2px solid var(--amber-dim); border-radius: 5px; padding: 12px 14px; margin-bottom: 10px;
  white-space: pre-wrap;
}
.answer mark { background: rgba(224,87,76,0.24); color: #ffd8d4; padding: 0 2px; border-radius: 2px; }
.provenance {
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px;
}
.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--text-faint); font-size: 12px; }
.kv dd { font-family: var(--mono); font-size: 12.5px; }
ul.reasons, ul.plain { list-style: none; }
ul.reasons li, ul.plain li { padding: 5px 0 5px 16px; position: relative; font-size: 13px; color: var(--text-dim); }
ul.reasons li::before, ul.plain li::before { content: '—'; position: absolute; left: 0; color: var(--text-faint); }
.formula { font-family: var(--mono); font-size: 12px; color: var(--text-dim); background: var(--ink); border: 1px solid var(--line-soft); border-radius: 5px; padding: 10px 12px; overflow-x: auto; }
.empty { color: var(--text-faint); font-size: 13.5px; padding: 22px; text-align: center; border: 1px dashed var(--line); border-radius: 7px; }
.bar { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--amber); }
.bar.green > i { background: var(--green); }
.bar.red > i { background: var(--red); }

.footer {
  border-top: 1px solid var(--line); padding: 18px 28px; color: var(--text-faint); font-size: 12px;
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; max-width: 1180px; margin: 0 auto;
}
.footer a { color: var(--text-dim); }

.state-track { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; font-family: var(--mono); font-size: 11px; }
.state-track .step { padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--text-faint); }
.state-track .step.done { border-color: var(--green-dim); color: var(--green); }
.state-track .step.current { border-color: var(--amber); color: var(--amber); background: rgba(232,163,61,0.08); }
.state-track .step.dead { border-color: var(--red-dim); color: var(--red); }
.state-track .arrow { color: var(--line); }

/* --------------------------------------------------- phases 1-8 additions */

/* Stat rows: a small number with the thing it counts, side by side. Used on the schedule
   ledger and on the audit report, where the reader wants the figure before the prose. */
.stat-row { display: flex; flex-wrap: wrap; gap: 28px; margin: 18px 0 22px; }
.stat { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.stat-label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.stat-value { font-family: var(--mono); font-size: 20px; color: var(--text); }

/* Semantic pills. Colour carries meaning here: green is proven, red is wrong. */
.pill.ok { border-color: var(--green-dim); color: var(--green); }
.pill.bad { border-color: var(--red-dim); color: var(--red); }
td.bad, .mono.bad { color: var(--red); }

.rolechip {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; color: var(--text-dim);
}

/* Several small actions in one table cell, stacked so they never collide. */
.row-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.row-actions form { margin: 0; }

.brandswitch { margin: 0; }
.brandswitch select {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 8px; font-size: 13px; max-width: 180px;
}

fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 0 0 4px; }
fieldset legend { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); padding: 0 6px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 6px 0; cursor: pointer; }
label.check input { width: auto; margin: 0; }

/* The snapshot banner has to read as a frame around the content, not as more content: the
   whole point is that the reader knows they are looking at a copy taken on a date. */
.snapshot-banner {
  border: 1px solid var(--amber-dim);
  border-left: 3px solid var(--amber);
  background: rgba(232, 163, 61, 0.08);
  border-radius: 6px; padding: 12px 16px; margin: 0 0 20px;
  font-size: 14px; color: var(--text);
}
.snapshot-body {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; white-space: pre-wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px 18px; overflow-x: auto; max-height: 60vh; overflow-y: auto; color: var(--text);
}

.finding { border-left: 2px solid var(--line); padding: 2px 0 2px 16px; margin: 0 0 22px; }
.finding h3 { margin: 0 0 6px; font-size: 16px; }
.finding blockquote {
  margin: 8px 0; padding: 10px 14px; border-left: 2px solid var(--amber);
  background: var(--panel); font-size: 14px; color: var(--text);
}

.rules { margin: 10px 0 0; padding-left: 20px; }
.rules li { margin: 0 0 8px; color: var(--text-dim); font-size: 14px; max-width: 78ch; }
