/* CSRF Context UI. Charcoal grounds, sky accents, lime only for wins (cybersecurityreach.org DESIGN.md). */
:root {
  --bg: #111317; --panel: #181b21; --panel-2: #1f232b; --line: #2a2f39; --line-2: #3a404c;
  --ink: #e8eaee; --muted: #9aa3b2; --faint: #6b7383;
  --sky: #38bdf8; --sky-ink: #7dd3fc; --sky-soft: rgba(56, 189, 248, .12);
  --lime: #a3e635; --lime-soft: rgba(163, 230, 53, .14);
  --amber: #fbbf24; --amber-soft: rgba(251, 191, 36, .12); --red: #f87171; --red-soft: rgba(248, 113, 113, .12);
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-text-size-adjust: 100%; }
a { color: var(--sky-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 8px; }
code, pre, .mono { font-family: var(--mono); font-size: .88em; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px 18px; background: rgba(17, 19, 23, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.brand { color: var(--ink); font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand span { color: var(--sky); }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--panel-2); text-decoration: none; }
.nav a.on { color: var(--ink); background: var(--panel-2); }
.nav .count { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: 12px; }
.who { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 13px; white-space: nowrap; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .top { flex-wrap: wrap; padding: 10px 16px; }
  .menu-btn { display: inline-flex; margin-left: auto; }
  .nav { display: none; order: 3; flex-basis: 100%; flex-direction: column; }
  .nav.open { display: flex; }
  .nav a { padding: 10px; font-size: 15px; }
  .who { order: 4; flex-basis: 100%; }
}

.app { max-width: 1120px; margin: 0 auto; padding: 22px 18px 80px; }
@media (max-width: 560px) { .app { padding: 16px 16px 72px; } }
.kicker { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--sky); margin: 0 0 6px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.lead { color: var(--muted); margin: 0 0 18px; max-width: 70ch; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; min-width: 0; }
.card + .card { margin-top: 14px; }
.grid .card + .card { margin-top: 0; }
.card h2 .faint { font-weight: 400; font-size: 13px; }
.section { margin-top: 22px; }

/* Buttons and inputs */
button, .btn { font: 600 14px/1 var(--sans); color: var(--ink); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 9px 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
button:hover, .btn:hover { border-color: var(--sky); text-decoration: none; }
button.primary, .btn.primary { background: var(--sky); color: #08131c; border-color: var(--sky); }
button.primary:hover { background: var(--sky-ink); }
button.danger { color: var(--red); }
button.small { padding: 5px 9px; min-height: 28px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; min-height: 0; color: var(--sky-ink); font-weight: 500; }
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 4px; }
input, select, textarea { width: 100%; font: 15px/1.4 var(--sans); color: var(--ink); background: var(--bg); border: 1px solid var(--line-2); border-radius: 6px; padding: 9px 10px; }
textarea { min-height: 90px; resize: vertical; }
textarea.code { font: 13px/1.5 var(--mono); min-height: 340px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-soft); }
.field { margin-bottom: 12px; }
.fields { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.hint { font-size: 12px; color: var(--faint); margin-top: 3px; }
.hint.over { color: var(--red); }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.check input { width: auto; }
.filters { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 14px; }

/* Tags and status */
.tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font: 500 12px/1.6 var(--mono); background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag.win { background: var(--lime-soft); color: var(--lime); border-color: transparent; }
.tag.sky { background: var(--sky-soft); color: var(--sky-ink); border-color: transparent; }
.tag.amber { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.tag.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.notice { padding: 10px 12px; border-radius: 6px; background: var(--amber-soft); color: var(--amber); font-size: 14px; margin: 8px 0; }
.notice.sky { background: var(--sky-soft); color: var(--sky-ink); }
.notice.red { background: var(--red-soft); color: var(--red); }

/* Lists and tables */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.entry { display: grid; grid-template-columns: 92px 1fr auto; gap: 4px 12px; align-items: baseline; cursor: pointer; }
.entry:hover .what { color: var(--sky-ink); }
.entry .date { font: 13px var(--mono); color: var(--faint); }
.entry .meta { grid-column: 2 / 4; font-size: 13px; color: var(--faint); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
@media (max-width: 560px) { .entry { grid-template-columns: 1fr auto; } .entry .date { grid-column: 1 / 3; } .entry .meta { grid-column: 1 / 3; } }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
th { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--faint); border-top: 0; }
.table-wrap { overflow-x: auto; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }

/* Progress and charts */
.bar { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; margin: 6px 0 4px; }
.bar > span { display: block; height: 100%; background: var(--sky); border-radius: 999px; }
.bar.done > span { background: var(--lime); }
.big { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.stat .label { font: 500 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.spark { width: 100%; height: 120px; display: block; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line-2); }
.timeline li { position: relative; padding: 6px 0 6px 10px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--sky); }
.timeline li.here::before { background: var(--sky); }

/* Markdown */
.md { max-width: 78ch; }
.md h1 { font-size: 22px; margin: 18px 0 8px; }
.md h2 { font-size: 18px; margin: 20px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.md h3 { font-size: 15px; margin: 16px 0 6px; }
.md p, .md ul, .md ol { margin: 0 0 10px; }
.md li { margin: 3px 0; }
.md code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--bg); border: 1px solid var(--line); padding: 10px; border-radius: 6px; overflow-x: auto; }
.md blockquote { margin: 0 0 10px; padding: 4px 12px; border-left: 3px solid var(--line-2); color: var(--muted); }
.md table { margin: 8px 0 14px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* Diff */
.diff { font: 12.5px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px; max-height: 420px; overflow: auto; }
.diff .add { background: rgba(163, 230, 53, .12); color: #d9f99d; display: block; }
.diff .del { background: rgba(248, 113, 113, .12); color: #fecaca; display: block; text-decoration: line-through; }

/* Editor */
.editor { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 860px) { .editor { grid-template-columns: 1fr; } }
.preview { border: 1px solid var(--line); border-radius: 6px; padding: 12px; max-height: 70vh; overflow: auto; }

/* Dialog and toast */
.dialog { max-width: min(640px, calc(100vw - 32px)); width: 100%; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); color: var(--ink); padding: 18px; }
.dialog::backdrop { background: rgba(0, 0, 0, .6); }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50; max-width: min(560px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 8px 30px rgba(0, 0, 0, .4); }
.toast.err { border-color: var(--red); color: #fecaca; }

/* Plain server pages (sign-in errors, OAuth consent) */
body.plain { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.card.narrow { max-width: 520px; width: 100%; }
.card.narrow .brand { display: block; margin-bottom: 12px; }
.card.narrow .warn { color: var(--amber); }
.card.narrow button { margin-right: 6px; }

.signin { max-width: 460px; margin: 10vh auto; text-align: center; }
.signin .btn { margin-top: 10px; }
.row > select, .row > input:not([type="checkbox"]):not([type="file"]) { width: auto; min-width: 160px; }
