/* Guardian console. Quiet by default; colour only where it signals something:
   red = serious / failed, amber = needs a person, green = live / fine. */
:root {
  --bg: #f7f7f5; --panel: #ffffff; --ink: #1c1d1f; --muted: #6b6f76; --line: #e3e3df;
  --brand: #1f3a5f; --brand-ink: #ffffff; --link: #1f4f8f;
  --red: #b42318; --red-bg: #fdecea; --amber: #a15c07; --amber-bg: #fdf3e1; --green: #1d7a46; --green-bg: #e6f4ec;
  --code: #f0f0ec; --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131416; --panel: #1b1c1f; --ink: #e8e8e6; --muted: #9a9ea6; --line: #2c2e33;
    --brand: #8fb3e0; --brand-ink: #10151c; --link: #9cc2f0;
    --red: #f28b82; --red-bg: #3a1f1d; --amber: #f0b45a; --amber-bg: #3a2c14; --green: #7fd1a0; --green-bg: #17301f;
    --code: #24262a; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: .2rem 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 2rem 0 .6rem; }
code { background: var(--code); padding: .1em .35em; border-radius: 4px; font-size: .9em; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.lede { max-width: 70ch; margin-top: 0; }
.error { color: var(--red); }

.top { display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.5rem; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 650; color: var(--ink); display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.mark { width: 18px; height: 20px; background: url(/static/icon.svg) center/contain no-repeat; display: inline-block; }
.top nav { display: flex; gap: .2rem; flex-wrap: wrap; }
.top nav a { color: var(--muted); padding: .35rem .7rem; border-radius: 6px; }
.top nav a:hover { color: var(--ink); background: var(--bg); text-decoration: none; }
.top nav a[aria-current] { color: var(--ink); background: var(--bg); font-weight: 600; }
.who { margin-left: auto; display: flex; gap: .8rem; align-items: center; font-size: .85rem; color: var(--muted); }

main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.5rem 4rem; }
.narrow { max-width: 760px; }
.head { display: flex; gap: 1.5rem; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; padding-top: .4rem; }
.crumbs { margin: 0; font-size: .85rem; color: var(--muted); }
.flash { background: var(--green-bg); color: var(--green); padding: .7rem 1rem; border-radius: var(--radius); }
.flash.warn { background: var(--amber-bg); color: var(--amber); }

button, .button { font: inherit; font-size: .92rem; padding: .5rem .95rem; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; display: inline-block; line-height: 1.3; }
button:hover, .button:hover { border-color: var(--muted); text-decoration: none; }
button:disabled { opacity: .6; cursor: progress; }
.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.primary:hover { filter: brightness(1.1); border-color: var(--brand); }
.bad { color: var(--red); }
button.link { border: 0; background: none; padding: 0; color: var(--link); font-size: inherit; }
button.small { padding: .2rem .55rem; font-size: .8rem; }
.wide { width: 100%; text-align: center; }

input, select, textarea { font: inherit; font-size: .95rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
textarea { width: 100%; resize: vertical; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--ink); }
.check { flex-direction: row; align-items: center; gap: .4rem; color: var(--ink); font-size: .9rem; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem .9rem; margin: 0; }
legend { font-size: .85rem; color: var(--muted); padding: 0 .3rem; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; }
.grow { flex: 1 1 14rem; }
.inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0; }

.login { max-width: 380px; margin: 8vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 2rem; }
.or { text-align: center; color: var(--muted); font-size: .85rem; margin: .5rem 0 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin: 1.2rem 0; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; display: flex; flex-direction: column; }
.tile b { font-size: 1.7rem; font-weight: 650; line-height: 1.1; }
.tile span { color: var(--muted); font-size: .85rem; }

.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; }
.filters select { max-width: 16rem; }
.count { margin: .8rem 0; font-size: .85rem; }

.tag { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag.sev-high, .tag.status-failed, .tag.route-people { background: var(--red-bg); color: var(--red); border-color: transparent; }
.tag.sev-medium, .tag.warn, .tag.status-in_review, .tag.route-draft_for_head_office { background: var(--amber-bg); color: var(--amber); border-color: transparent; }
.tag.ok, .tag.status-published, .tag.route-reply, .tag.route-approved_answer { background: var(--green-bg); color: var(--green); border-color: transparent; }
.tile b.sev-high, a.sev-high { color: var(--red); }

.problems { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .7rem; }
.problem { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; }
.problem.sev-high { border-left-color: var(--red); }
.problem.sev-medium { border-left-color: var(--amber); }
.problem.st-resolved, .problem.st-not_a_problem { opacity: .65; }
.problem .detail { margin: .5rem 0; max-width: 95ch; }
.pmeta { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin: 0; }
.docline { margin: .5rem 0 0; font-size: .9rem; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.sides blockquote { margin: 0; padding: .6rem .8rem; background: var(--bg); border-radius: 6px; font-size: .92rem; }
.sides cite { display: block; font-style: normal; font-size: .8rem; margin-bottom: .2rem; }
.note { font-size: .88rem; margin: .5rem 0 0; }
.problem details { margin-top: .5rem; }
.problem summary { cursor: pointer; color: var(--link); font-size: .85rem; }
.problem details form { margin-top: .5rem; }
.compact .problem { padding: .7rem .9rem; }
.empty { color: var(--muted); padding: 1rem; }

table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list th, .list td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.list th { font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--bg); text-transform: uppercase; letter-spacing: .03em; }
.list tr:last-child td { border-bottom: 0; }
.facts tr.fact-unverified td { background: var(--amber-bg); }

.jobs { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .2rem 1rem .8rem; margin-top: 1rem; }
.jobs ul { list-style: none; padding: 0; margin: 0; }
.jobs li { padding: .4rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.jobs li:last-child { border-bottom: 0; }
.progress { color: var(--muted); font-size: .85rem; }
.job-running .tag { background: var(--amber-bg); color: var(--amber); border-color: transparent; }

.review-box { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: var(--radius); padding: .2rem 1.2rem 1rem; margin: 1rem 0; }
.bad-box { border-left-color: var(--red); }
.danger h2 { color: var(--red); }
.diff { font: .85rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; max-height: 480px; overflow: auto; }
.diff div { white-space: pre-wrap; padding: 0 .4rem; }
.diff .add { background: var(--green-bg); }
.diff .add::before { content: "+ "; color: var(--green); }
.diff .del { background: var(--red-bg); text-decoration: line-through; text-decoration-color: var(--muted); }
.diff .del::before { content: "− "; color: var(--red); }
.diff .hunk { color: var(--muted); }
details.section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; margin-bottom: .5rem; }
details.section summary { cursor: pointer; }
.steps li { margin-bottom: .35rem; }

.answer { margin-top: 1.2rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; }
.reply { font-size: 1.02rem; white-space: pre-wrap; margin: .8rem 0; padding: .8rem 1rem; background: var(--bg); border-radius: 6px; }
.cites { padding-left: 1.1rem; }
.cites li { margin-bottom: .4rem; }
.answer summary { cursor: pointer; color: var(--link); font-size: .9rem; margin: .3rem 0; }
dl.roles { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; font-size: .9rem; }
dl.roles dt { font-weight: 600; }
dl.roles dd { margin: 0; color: var(--muted); }

@media (max-width: 720px) {
  main { padding: 1rem 1rem 3rem; }
  .top { padding: .6rem 1rem; gap: .6rem; }
  .who { margin-left: 0; width: 100%; }
  .sides { grid-template-columns: 1fr; }
  table.list { display: block; overflow-x: auto; }
}
@media print {
  .top, .noprint, .flash { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .problem { break-inside: avoid; border-color: #ccc; }
  .tile { border-color: #ccc; }
  a { color: #000; }
}
