/* Content Automation — control dashboard
 *
 * Two type registers, deliberately: the chrome is an instrument (IBM Plex Sans
 * and Mono, tight and technical), and the article under review is an article
 * (Newsreader, generous), because the reviewer is judging published prose and
 * it should look like prose rather than like a form field.
 *
 * Colour is spent almost entirely on the two hero signals — status and verdict
 * (§11.2). Everything else is paper and ink so those pills carry across a
 * dense table at a glance.
 */

:root {
  --paper:      #f4f6f8;
  --surface:    #ffffff;
  --rail:       #171d26;
  --rail-soft:  #232c39;
  --ink:        #12171f;
  --ink-soft:   #5a6675;
  --ink-faint:  #8c96a4;
  --rule:       #dde3ea;
  --rule-soft:  #eaeef3;

  --good:       #0f6b45;
  --good-bg:    #e2f2ea;
  --waiting:    #8a4b00;
  --waiting-bg: #fbeedb;
  --bad:        #a51f18;
  --bad-bg:     #fbe6e4;
  --working:    #24457f;
  --working-bg: #e3ebf8;

  --focus:      #24457f;

  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  --read: "Newsreader", Georgia, serif;

  --step: 0.25rem;
  --radius: 5px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.55 var(--sans);
  font-feature-settings: "tnum" 1;
}

a { color: var(--focus); text-decoration-thickness: 1px; text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

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

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

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.rail {
  background: var(--rail);
  color: #cbd3de;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.rail__mark {
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none;
  font-weight: 600; font-size: 13px; line-height: 1.25;
  letter-spacing: 0.01em;
}

/* The three trust gates, stacked — the one structural device in the design,
   and it encodes the thing the whole system is organised around. */
.rail__gate {
  width: 12px; height: 26px; border-radius: 2px; flex: none;
  background:
    linear-gradient(var(--bad) 0 33.3%, transparent 0 33.3%),
    linear-gradient(var(--waiting) 33.3% 66.6%, transparent 0),
    linear-gradient(var(--good) 66.6% 100%, transparent 0);
  opacity: 0.9;
}

.rail__nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }

.rail__nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border-radius: var(--radius);
  color: #b8c2cf; text-decoration: none; font-size: 13.5px;
}

.rail__nav a:hover { background: var(--rail-soft); color: #fff; }
.rail__nav a[aria-current="page"] { background: var(--rail-soft); color: #fff; font-weight: 500; }

.rail__count {
  font: 500 11px/1 var(--mono);
  background: var(--waiting-bg); color: var(--waiting);
  padding: 3px 6px; border-radius: 99px;
}
.rail__count--bad { background: var(--bad-bg); color: var(--bad); }

.rail__label {
  font: 500 10px/1 var(--sans);
  text-transform: uppercase; letter-spacing: 0.09em;
  color: #6d7889; margin: 0 0 8px 10px;
}

.rail__sites { display: grid; gap: 2px; }

.sitechip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--radius);
  color: #b8c2cf; text-decoration: none; font-size: 13px;
}
.sitechip:hover { background: var(--rail-soft); color: #fff; }
.sitechip__gate { width: 3px; height: 15px; border-radius: 2px; flex: none; background: var(--ink-faint); }
.sitechip--human .sitechip__gate   { background: #d99a3a; }
.sitechip--ai_check .sitechip__gate { background: #5b86d6; }
.sitechip--direct .sitechip__gate  { background: #3f9c72; }
.sitechip__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rail__empty { color: #6d7889; font-size: 12.5px; margin: 0 10px; }

.rail__foot {
  margin-top: auto; border-top: 1px solid var(--rail-soft); padding-top: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: #8b96a6;
}

.linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: #8b96a6; font: inherit; font-size: 12.5px; text-decoration: underline;
}
.linkbtn:hover { color: #fff; }

/* ----------------------------------------------------------------- main -- */

.main { padding: 26px 30px 60px; max-width: 1500px; }

.head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 20px;
}

.head__eyebrow {
  margin: 0 0 4px;
  font: 500 10.5px/1 var(--sans);
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint);
}

.head__title { margin: 0; font-size: 23px; font-weight: 600; letter-spacing: -0.01em; }
.head__actions { display: flex; gap: 8px; align-items: center; }

/* -------------------------------------------------------------- notices -- */

.notices { display: grid; gap: 6px; margin-bottom: 18px; }

.notice {
  margin: 0; padding: 9px 12px; border-radius: var(--radius);
  border-left: 3px solid var(--ink-faint); background: var(--surface);
  font-size: 13.5px;
}
.notice--success { border-color: var(--good); background: var(--good-bg); color: var(--good); }
.notice--warning { border-color: var(--waiting); background: var(--waiting-bg); color: var(--waiting); }
.notice--error   { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.notice--info    { border-color: var(--working); background: var(--working-bg); color: var(--working); }

/* --------------------------------------------------------------- panels -- */

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 7px;
  margin-bottom: 18px;
}

.panel__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--rule-soft);
}

.panel__title { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
.panel__note { margin: 0; font-size: 12.5px; color: var(--ink-soft); }
.panel__body { padding: 16px; }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }

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

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
  text-align: left; font-weight: 500; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint);
  padding: 9px 12px; border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

.table td { padding: 10px 12px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfc; }
.table .num { text-align: right; font-family: var(--mono); font-size: 12.5px; }
.table__title { font-weight: 500; }
.table__sub { color: var(--ink-soft); font-size: 12.5px; }

.empty { padding: 34px 16px; text-align: center; color: var(--ink-soft); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- pills -- */

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font: 500 11px/1.5 var(--sans); letter-spacing: 0.02em; white-space: nowrap;
  background: #eef1f5; color: var(--ink-soft);
}
.pill--good    { background: var(--good-bg); color: var(--good); }
.pill--waiting { background: var(--waiting-bg); color: var(--waiting); }
.pill--bad     { background: var(--bad-bg); color: var(--bad); }
.pill--working { background: var(--working-bg); color: var(--working); }
.pill--muted, .pill--none { background: #eef1f5; color: var(--ink-faint); }

.sev { font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }
.sev--bad { color: var(--bad); }
.sev--waiting { color: var(--waiting); }
.sev--muted { color: var(--ink-faint); }

.tag {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  background: #eef1f5; color: var(--ink-soft);
  font: 400 11.5px/1.6 var(--mono);
}

/* -------------------------------------------------------------- buttons -- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--radius);
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font: 500 13px/1.2 var(--sans); cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--ink-faint); }
.btn--primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--primary:hover { background: #000; }
.btn--good { background: var(--good); border-color: var(--good); color: #fff; }
.btn--danger { color: var(--bad); border-color: #f0c9c6; }
.btn--danger:hover { background: var(--bad-bg); }
.btn--small { padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* --------------------------------------------------------------- fields -- */

.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 5px; }
.field__help { margin: 5px 0 0; font-size: 12.5px; color: var(--ink-soft); }
.field__error { margin: 5px 0 0; font-size: 12.5px; color: var(--bad); }

input[type="text"], input[type="url"], input[type="password"], input[type="number"],
input[type="email"], select, textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font: 400 13.5px/1.5 var(--sans);
}
textarea { resize: vertical; }
textarea[name="template_text"] { font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
select { appearance: auto; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.filters .field { margin: 0; min-width: 140px; }
.filters label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-faint); }

.checks { display: grid; gap: 4px; }
.checks label { display: flex; gap: 7px; align-items: center; font-weight: 400; font-size: 13px; }

/* ------------------------------------------------------- article review -- */

/* The signature: the article on the left, the verifier's flagged claims aligned
   as margin annotations on the right — a marked-up proof rather than a form. */
.proof { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }

.article {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 7px;
  padding: 30px 38px 36px;
}

.article__kicker {
  font: 500 10.5px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-faint); margin: 0 0 10px;
}

.article__title {
  font: 500 30px/1.2 var(--read); letter-spacing: -0.01em;
  margin: 0 0 18px; max-width: 26ch;
}

.article__body { font: 400 17px/1.68 var(--read); color: #1b222c; max-width: 68ch; }
.article__body h2 { font-size: 21px; font-weight: 500; margin: 30px 0 8px; }
.article__body h3 { font-size: 18px; font-weight: 500; margin: 24px 0 6px; }
.article__body p { margin: 0 0 16px; }
.article__body ul, .article__body ol { margin: 0 0 16px; padding-left: 22px; }
.article__body li { margin-bottom: 6px; }
.article__body blockquote {
  margin: 0 0 16px; padding-left: 16px; border-left: 2px solid var(--rule);
  color: var(--ink-soft);
}

.margin { position: sticky; top: 20px; display: grid; gap: 12px; }

.annot {
  background: var(--surface); border: 1px solid var(--rule);
  border-left: 3px solid var(--ink-faint); border-radius: var(--radius);
  padding: 11px 13px;
}
.annot--high { border-left-color: var(--bad); }
.annot--medium { border-left-color: var(--waiting); }
.annot--low { border-left-color: var(--ink-faint); }

.annot__head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 6px;
}
.annot__kind { font: 500 11px/1 var(--mono); color: var(--ink-soft); }
.annot__claim { margin: 0 0 6px; font-size: 13px; font-style: italic; color: var(--ink); }
.annot__detail { margin: 0; font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; }

.verdictcard { text-align: center; padding: 16px; }
.verdictcard__label {
  font: 500 10.5px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-faint); margin: 0 0 8px;
}
.verdictcard__value { font: 600 26px/1 var(--sans); letter-spacing: -0.01em; }
.verdictcard--good .verdictcard__value { color: var(--good); }
.verdictcard--waiting .verdictcard__value { color: var(--waiting); }
.verdictcard--bad .verdictcard__value { color: var(--bad); }
.verdictcard__note { margin: 8px 0 0; font-size: 12.5px; color: var(--ink-soft); }

/* A YMYL article should look more cautionary than a football one. (§11.1B) */
.article--ymyl { border-top: 3px solid var(--waiting); }
.ymylbar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--radius); margin-bottom: 14px;
  background: var(--waiting-bg); color: var(--waiting); font-size: 13px;
}

/* ---------------------------------------------------------------- meter -- */

.meter { height: 5px; border-radius: 99px; background: var(--rule-soft); overflow: hidden; }
.meter__fill { height: 100%; background: var(--working); }
.meter__fill--waiting { background: var(--waiting); }
.meter__fill--bad { background: var(--bad); }
.meter__fill--good { background: var(--good); }

.stat { display: grid; gap: 2px; }
.stat__value { font: 600 22px/1.1 var(--sans); letter-spacing: -0.01em; }
.stat__label { font-size: 12px; color: var(--ink-soft); }

.statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 18px; }

/* ---------------------------------------------------------------- trace -- */

.trace { display: grid; gap: 1px; background: var(--rule-soft); border-radius: var(--radius); overflow: hidden; }
.trace__row { background: var(--surface); padding: 9px 12px; display: grid; gap: 3px; }
.trace__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trace__step { font: 500 12px/1 var(--mono); }
.trace__meta { font-size: 12px; color: var(--ink-faint); }
.trace__error { font-size: 12.5px; color: var(--bad); }

details.raw > summary { cursor: pointer; font-size: 12.5px; color: var(--ink-soft); padding: 4px 0; }
details.raw pre {
  margin: 6px 0 0; padding: 10px; border-radius: var(--radius);
  background: #f7f9fb; border: 1px solid var(--rule-soft);
  font: 400 11.5px/1.5 var(--mono); overflow-x: auto; max-height: 320px;
}

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 1120px) {
  .proof { grid-template-columns: minmax(0, 1fr); }
  .margin { position: static; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .rail__nav { grid-auto-flow: column; }
  .rail__sites, .rail__foot { display: none; }
  .main { padding: 18px 16px 48px; }
  .article { padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* --------------------------------------------------------------- login --- */

.login { display: grid; place-items: center; min-height: 100vh; background: var(--rail); }
.login__card {
  background: var(--surface); border-radius: 9px; padding: 30px 32px;
  width: min(370px, calc(100vw - 32px));
}
.login__title { margin: 14px 0 20px; font-size: 19px; font-weight: 600; }
