/* NoPress console, in the NoPress.ai design system: paper and ink, one brand
   color (press) for the primary action and links, teal for what the assistant
   wrote, rules instead of shadows, square-ish corners. Light and dark. */
:root {
  --bg: #f7f5f0;          /* paper */
  --panel: #ffffff;       /* paper-raised */
  --sunk: #eeebe3;        /* paper-sunk */
  --ink: #16181d;         /* ink */
  --body: #16181d;        /* ink */
  --muted: #5b5f68;       /* ink-muted */
  --line: #d9d5cb;        /* rule: hairlines only */
  --line-strong: #8a8e96; /* rule-strong: control borders */
  --accent: #c2410c;      /* press */
  --accent-ink: #9a3412;  /* press, hovered */
  --on-accent: #ffffff;   /* on-press */
  --accent-wash: #f6dccd; /* press-soft */
  --teal: #0f5c5a;        /* teal: the assistant */
  --teal-wash: #d3e8e6;   /* teal-soft */
  --good: #0f5c5a;
  --good-wash: #d3e8e6;
  --warn: #8a5a00;
  --warn-wash: #f6ead0;
  --bad: #b42318;         /* danger */
  --bad-wash: #f9e0dd;
  --radius: 8px;          /* radius-md: cards, the largest */
  --radius-sm: 4px;       /* radius-sm: buttons, inputs, badges */
  --shadow: none;         /* rules, not shadows */
  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter Tight", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418;
    --panel: #1b1e24;
    --sunk: #0c0d10;
    --ink: #f2efe8;
    --body: #f2efe8;
    --muted: #a2a6ae;
    --line: #2c3038;
    --line-strong: #6b707a;
    --accent: #ff7a45;
    --accent-ink: #ff9a70;
    --on-accent: #121418;
    --accent-wash: #3a2216;
    --teal: #4fb8b0;
    --teal-wash: #14302f;
    --good: #4fb8b0;
    --good-wash: #14302f;
    --warn: #f0c060;
    --warn-wash: #2c2412;
    --bad: #f97066;
    --bad-wash: #3a1a18;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--body); font: 15px/1.6 var(--sans); }
a { color: var(--accent); }
a:hover { color: var(--accent-ink); }
h1, h2, h3 { color: var(--ink); line-height: 1.2; margin: 0 0 .4em; }
h1, h2 { font-family: var(--display); font-weight: 600; }
h1 { font-size: 32px; letter-spacing: -.01em; }
h2 { font-size: 22px; margin-top: 8px; }
h3 { font-size: 15px; }
code { font: 13px/1.4 var(--mono); color: var(--muted); }
section { margin-top: 36px; }
.muted { color: var(--muted); }
.muted a { color: inherit; }

/* top bar */
.top { display: flex; align-items: center; gap: 28px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
/* The brand: wordmark and Slash fills follow the theme (i = ink, p = press, t = teal). */
.mark { display: flex; align-items: center; text-decoration: none; }
.mark svg { height: 26px; width: auto; display: block; }
svg .i { fill: var(--ink); }
svg .p { fill: var(--accent); }
svg .t { fill: var(--teal); }
.btn .icon, .btn .slash-mark { width: 18px; height: 18px; flex: none; }
/* Ask: the Slash beside the word, on paper so the mark keeps its own colors. */
.btn.btn-ask { background: var(--panel); color: var(--ink); border-color: var(--accent); }
.btn.btn-ask:hover { background: var(--accent-wash); color: var(--ink); border-color: var(--accent); }
.top nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.top nav a { padding: 7px 12px; border-radius: var(--radius-sm); color: var(--body); text-decoration: none; font-weight: 500; white-space: nowrap; }
.top nav a:hover { background: var(--bg); color: var(--ink); }
.top nav a[aria-current="page"] { background: var(--accent-wash); color: var(--ink); }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; white-space: nowrap; }

main { max-width: 920px; margin: 0 auto; padding: 32px 24px 80px; }
main.wide { max-width: 1120px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head h1, .head h2 { margin: 0; }
.crumbs { margin: 0 0 6px; font-size: 14px; }

/* controls */
button, .btn { display: inline-flex; align-items: center; gap: 6px; font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
button.ghost, .btn.ghost { background: transparent; color: var(--accent); }
button.ghost:hover, .btn.ghost:hover { background: var(--accent-wash); color: var(--accent-ink); }
button.danger.ghost { color: var(--bad); border-color: var(--bad); }
button.danger.ghost:hover { background: var(--bad-wash); }
button.small { padding: 6px 10px; font-size: 13px; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; }
button.link:hover { background: none; color: var(--accent-ink); text-decoration: underline; }
button.link.danger { color: var(--bad); }
label { display: grid; gap: 5px; font-weight: 600; font-size: 14px; color: var(--ink); }
label small { font-weight: 400; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; align-self: end; padding-bottom: 10px; }
label.check input { width: auto; margin: 0; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 9px 11px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { resize: vertical; }
.stack { display: grid; gap: 16px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
form.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
form.inline select { width: auto; padding: 6px 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.menu { display: flex; gap: 14px; justify-content: flex-end; flex-wrap: wrap; }

/* messages */
.note, .warn, .error, .dev { padding: 11px 14px; border-radius: var(--radius-sm); margin: 0 0 20px; }
.note { background: var(--good-wash); color: var(--good); }
.warn { background: var(--warn-wash); color: var(--warn); }
.error { background: var(--bad-wash); color: var(--bad); }
.dev { background: var(--accent-wash); }
.empty { color: var(--muted); padding: 18px 0; }
section.empty { text-align: center; padding: 64px 0; }
.invite { background: var(--accent-wash); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.invite p { margin: 0 0 10px; }
.invite input { font: 13px ui-monospace, Consolas, monospace; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 20px; }
.stat { display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; color: var(--body); text-decoration: none; box-shadow: var(--shadow); }
a.stat:hover { border-color: var(--accent); color: var(--body); }
.stat b { font-size: 32px; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { font-weight: 600; color: var(--ink); }
.stat small { color: var(--muted); }
.stat.hot { border-color: var(--accent); background: var(--accent-wash); }

/* lists */
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list th { white-space: nowrap; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.list td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.list tr:last-child td { border-bottom: 0; }
.list tr.off td { opacity: .6; }
.list .num { text-align: right; }
.list td a { text-decoration: none; }
.count { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; text-align: center; }
.tag { display: inline-block; padding: 1px 7px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.pill { display: inline-block; padding: 2px 9px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.pending { background: var(--warn-wash); color: var(--warn); }
.pill.approved { background: var(--accent-wash); color: var(--ink); }
.pill.published { background: var(--good-wash); color: var(--good); }
.pill.rejected { background: var(--bad-wash); color: var(--bad); }
.pill.withdrawn { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

ul.changes { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
ul.changes li { padding: 12px 16px; border-bottom: 1px solid var(--line); }
ul.changes li:last-child { border-bottom: 0; }
ul.changes a { text-decoration: none; }
ul.changes .muted { font-size: 13px; margin-top: 2px; }

ol.audit { list-style: none; margin: 0; padding: 0; font-size: 14px; }
ol.audit li { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
ol.audit .when { color: var(--muted); font-variant-numeric: tabular-nums; }

/* site page */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 20px 0 0; }
.facts div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.facts dd { margin: 2px 0 0; color: var(--ink); overflow-wrap: anywhere; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 20px; }
.split > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
ul.tree, ul.pages { margin: 0; padding-left: 18px; }
ul.tree li, ul.pages li { margin: 3px 0; }
.solo > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.solo ul.pages { columns: 2 280px; column-gap: 32px; max-height: none; display: block; }
.solo ul.pages li { break-inside: avoid; }
ul.pages { max-height: 420px; overflow: auto; list-style: none; padding: 0; }
ul.pages li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 4px 0; }
details.review { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; }
details.review summary { cursor: pointer; padding: 10px 16px; font-weight: 600; color: var(--ink); }
details.review ul { margin: 0; padding: 0 16px 12px 34px; }
details.review li { margin: 4px 0; }

/* change page */
.detail { white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-top: 16px; color: var(--ink); }
.links { display: flex; gap: 10px; margin-top: 16px; }
pre.diff { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 0; overflow-x: auto; font: 13px/1.5 var(--mono); }
pre.diff span { display: block; padding: 0 16px; }
pre.diff .add { background: var(--good-wash); color: var(--good); }
pre.diff .del { background: var(--bad-wash); color: var(--bad); }
pre.diff .hunk { color: var(--accent); }
.decision { border-left: 4px solid var(--accent); padding: 4px 0 4px 16px; }
.decision.rejected { border-color: var(--bad); }
.decision.published { border-color: var(--good); }
section.card { margin-top: 28px; }

/* sign-in */
.signin { max-width: 400px; margin: 10vh auto 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }

@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 10px 16px; padding: 10px 16px; }
  .top nav { order: 3; flex-basis: 100%; }
  main { padding: 24px 16px 64px; }
  .split { grid-template-columns: 1fr; }
  ol.audit li { grid-template-columns: 1fr; gap: 0; }
  /* Rows become cards: every column stays, nothing scrolls sideways. */
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.list tr:last-child { border-bottom: 0; }
  .list td { border: 0; padding: 4px 16px; }
  .list .num { text-align: left; }
  .menu { justify-content: flex-start; }
}
.hint { margin: 20px 0 8px; font-size: 14px; }

/* Ask: the assistant */
.chat { display: grid; gap: 22px; margin: 24px 0; }
.turn { display: grid; gap: 10px; }
.msg { max-width: 760px; border-radius: var(--radius); padding: 12px 16px; border: 1px solid var(--line); background: var(--panel); }
.msg .who { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg .text { white-space: pre-wrap; color: var(--ink); }
.msg .text + .text { margin-top: 8px; }
.msg .text.error { color: var(--bad); }
.msg.me { justify-self: end; background: var(--accent-wash); border-color: transparent; }
.msg.pepe { justify-self: start; background: var(--teal-wash); border-color: transparent; }
.msg.pepe .who { color: var(--teal); }
.state { font-weight: 600; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.state.done { color: var(--good); }
.state.failed { color: var(--bad); }
.state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .state .dot { animation: none; } }
.result { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0 0; }
.result .btn.small { padding: 6px 10px; font-size: 13px; }
details.steps { margin-top: 10px; font-size: 13px; color: var(--muted); }
details.steps summary { cursor: pointer; }
details.steps ol { margin: 6px 0 0; padding-left: 20px; }
details.steps li { margin: 2px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
details.steps li.k-error { color: var(--bad); }
.ask { display: grid; gap: 10px; }
.ask label { font-size: 15px; }
details.advanced { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 10px 14px; }
details.advanced summary { cursor: pointer; font-weight: 600; color: var(--ink); }
details.advanced textarea { font: 13px ui-monospace, Consolas, monospace; margin-top: 6px; }

/* #15: keys and site access */
fieldset.keys, fieldset.sites-pick { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; display: grid; gap: 12px; min-width: 0; }
fieldset.keys legend, fieldset.sites-pick legend { font-weight: 700; color: var(--ink); padding: 0 6px; }
fieldset.keys .key { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
fieldset.sites-pick { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
fieldset.sites-pick legend { grid-column: 1 / -1; }
fieldset.sites-pick .check, fieldset.keys .check { padding-bottom: 0; font-weight: 500; }

/* Choosing an account (#38) */
.who .acct { font-weight: 600; color: var(--ink); text-decoration: none; padding: 6px 10px; border-radius: var(--radius-sm); background: var(--accent-wash); }
.who a.acct:hover { background: var(--bg); }
.pick .choices { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.pick .choices form { margin: 0; }
.pick button.choice { width: 100%; justify-content: center; font: 600 20px/1.2 var(--display); padding: 18px 20px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.pick button.choice:hover, .pick button.choice.current { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-ink); }

/* Focus: a 2px press ring, offset 2px, on everything interactive. */
:where(a, button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* What each role can do (#50) */
details.roles { margin: 12px 0 16px; }
details.roles summary { cursor: pointer; font-weight: 600; color: var(--ink); }
details.roles table { margin-top: 10px; }
details.roles th[scope="row"] { white-space: nowrap; }
details.roles p { margin: 8px 0 0; font-size: 14px; }

.facts .sub { display: block; font-size: 14px; }
