/* euRedact bastion. One stylesheet, no framework. The CSP allows no inline
   style, so every visual state is a class here. Colours are euRedact's own:
   ink #082B33, teal #0E4F5C, sand #F1F5F5, yellow #FED766. */

:root {
  --bg: #f1f5f5; --surface: #ffffff; --surface-2: #f7fafa; --ink: #082b33; --ink-2: #3e5a62;
  --muted: #5b7780; --line: #dde6e8; --line-2: #c9d8db;
  --brand: #0e4f5c; --brand-2: #2a6b78; --brand-ink: #ffffff; --yellow: #fed766;
  --ok: #1d6b3a; --ok-bg: #e5f3ea; --warn: #8a5a00; --warn-bg: #fdf3d8;
  --bad: #a32020; --bad-bg: #fbe8e6; --info: #0e4f5c; --info-bg: #e3eff1;
  --shadow: 0 1px 2px rgba(8, 43, 51, .06), 0 4px 16px rgba(8, 43, 51, .06);
  --radius: 12px; --radius-sm: 8px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #071a1f; --surface: #0e252b; --surface-2: #122d34; --ink: #e8f0f2; --ink-2: #b8cbd0;
    --muted: #8fa8af; --line: #1f3d45; --line-2: #2a4f58;
    --brand: #7fc4d1; --brand-2: #9fd6e0; --brand-ink: #071a1f;
    --ok: #74d394; --ok-bg: #12301f; --warn: #f2c35e; --warn-bg: #33270b;
    --bad: #ff8f86; --bad-bg: #3a1614; --info: #8fd0dc; --info-bg: #123038;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    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, sans-serif; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
code, pre, kbd { font-family: var(--mono); font-size: .88em; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0; }
h3 { font-size: .9rem; margin: 0 0 6px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.hidden, [hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* -- icons ------------------------------------------------------------------- */
.icon { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.icon.big { width: 28px; height: 28px; }

/* -- top bar ------------------------------------------------------------------ */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface);
  border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink);
  flex: none; }
.brand-mark { width: 26px; height: 26px; color: var(--brand); }
.brand-name { font-size: 1.05rem; letter-spacing: -.01em; }
.brand-sub { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted);
  padding: 2px 6px; border: 1px solid var(--line-2); border-radius: 6px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; white-space: nowrap; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--info-bg); color: var(--brand); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad);
  color: #fff; font-size: .75rem; font-weight: 700; display: inline-flex; align-items: center;
  justify-content: center; }
.session { display: flex; gap: 8px; align-items: center; flex: none; }

/* pills and menus (details/summary: works without JS) */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.pill { display: flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  font-size: .88rem; white-space: nowrap; user-select: none; }
.pill:hover { border-color: var(--brand-2); }
.live-menu.on .pill { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.live-menu .until { color: var(--muted); }
.live-menu.on .until { color: inherit; opacity: .85; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.live-menu.on .dot { background: var(--ok); }
.dot.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(29, 107, 58, .45); }
  70% { box-shadow: 0 0 0 7px rgba(29, 107, 58, 0); } 100% { box-shadow: 0 0 0 0 transparent; } }
details { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); width: 300px; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; }
.menu p { color: var(--ink-2); font-size: .88rem; }
.menu-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.user-menu .menu { width: 210px; padding: 6px; }
.user-menu .menu a, .user-menu .menu .link { display: flex; gap: 8px; align-items: center;
  width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none;
  background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.user-menu .menu a:hover, .user-menu .menu .link:hover { background: var(--surface-2); }

/* -- page --------------------------------------------------------------------- */
.page { max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; min-width: 0; }
.section, .card { min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub, .section .sub { color: var(--muted); margin: 4px 0 0; }
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; color: var(--muted);
  font-size: .9rem; }
.back:hover { color: var(--brand); }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-bottom: 12px; }
.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px;
  align-items: start; }
.split.even { grid-template-columns: 1fr 1fr; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* -- cards -------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 650; margin-bottom: 12px;
  color: var(--ink-2); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
/* minmax(0, …): a long command scrolls inside its card instead of widening the page */
.cards { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.cards.two { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }

/* request cards */
.req { display: block; min-width: 0; color: inherit; text-decoration: none;
  border-left: 4px solid var(--line-2);
  transition: border-color .15s, transform .15s; }
.req:hover { border-color: var(--brand); transform: translateY(-1px); }
.req.risk-high { border-left-color: var(--bad); }
.req.risk-medium { border-left-color: var(--warn); }
.req-head { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  flex-wrap: wrap; }
.what { font-size: 1.05rem; }
.verb { font-weight: 700; }
.on { color: var(--muted); margin: 0 6px; }
.target { font-weight: 600; color: var(--brand); }
h1 .on { margin: 0 8px; font-weight: 400; }
.cmd { display: block; margin: 10px 0; padding: 9px 12px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow-x: auto;
  white-space: nowrap; color: var(--ink); }
.reason { display: flex; gap: 8px; color: var(--ink-2); font-style: italic; }
.reason .icon { margin-top: 3px; color: var(--muted); }
.req-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px;
  font-size: .88rem; }
.req-foot .meta { color: var(--muted); }
.req-foot .go { margin-left: auto; color: var(--brand); font-weight: 600; }
.countdown.soon { color: var(--bad); font-weight: 600; }

/* chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; line-height: 1.6; background: var(--surface-2);
  color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip .icon { width: 13px; height: 13px; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.chip.muted { color: var(--muted); }
.chip.plain { background: transparent; }

/* -- buttons ------------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; position: relative;
  transition: background .15s, border-color .15s, opacity .15s; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.btn.wide { width: 100%; }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.busy span { visibility: hidden; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -- forms -------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.field > span { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field em { font-weight: 400; color: var(--muted); font-style: normal; }
.field.inline { flex-direction: row; align-items: center; margin: 0; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; }
textarea { resize: vertical; font-family: var(--mono); font-size: .88rem; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--info-bg); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; cursor: pointer; }
.check input { width: auto; margin-top: 4px; }
.check.bad { color: var(--bad); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.preview { display: flex; gap: 10px; align-items: center; padding: 12px 14px; margin-bottom: 14px;
  border-radius: var(--radius-sm); background: var(--info-bg); color: var(--info); font-weight: 500; }
.fine { color: var(--muted); font-size: .84rem; margin: 10px 0 0; }

/* -- alerts ------------------------------------------------------------------- */
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid transparent; margin-bottom: 14px; }
.alert .icon { margin-top: 2px; }
.alert p { margin: 4px 0 0; }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.info { background: var(--info-bg); color: var(--info); margin-top: 20px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert p, .alert code { color: var(--ink-2); }

/* -- request detail ----------------------------------------------------------- */
.code-block { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  margin: 10px 0; background: var(--surface-2); }
.code-head { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--line); font-size: .8rem;
  color: var(--muted); font-family: var(--mono); }
.code-block pre { margin: 0; padding: 12px; overflow-x: auto; color: var(--ink); }
pre.wrap { white-space: pre-wrap; word-break: break-all; }
pre.output { max-height: 480px; overflow-y: auto; font-size: .82rem; line-height: 1.45; }
.card-title .spacer { flex: 1; }
.kvp.link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600;
  color: var(--brand); text-decoration: none; }
.quote { margin: 0; padding: 12px 16px; border-left: 3px solid var(--line-2);
  background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  white-space: pre-wrap; }
.verdict { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius-sm);
  margin-bottom: 14px; }
.verdict b { font-size: 1.05rem; }
.verdict p { margin: 2px 0 0; color: var(--ink-2); }
.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.warn { background: var(--warn-bg); color: var(--warn); }
.verdict.bad { background: var(--bad-bg); color: var(--bad); }
.opinion.ok { border-top: 3px solid var(--ok); }
.opinion.warn { border-top: 3px solid var(--warn); }
.opinion.bad { border-top: 3px solid var(--bad); }
.kvs { margin: 0; }
.kv { display: grid; grid-template-columns: 9.5rem 1fr; gap: 10px; padding: 9px 0;
  border-top: 1px solid var(--line); }
.kv dt { color: var(--muted); font-size: .88rem; }
.kv dd { margin: 0; }
.kv dd p { margin: 4px 0 0; color: var(--ink-2); font-size: .9rem; }
.checks { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.checks ul, .list { margin: 0; padding: 0; list-style: none; }
.checks li { display: flex; gap: 8px; padding: 4px 0; color: var(--ink-2); }
.checks .icon { color: var(--ok); margin-top: 3px; }
.list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.decide { border: 2px solid var(--brand); }
.decide-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px;
  bottom: 0; width: 2px; background: var(--line); }
.tl-dot { width: 28px; height: 28px; border-radius: 50%; flex: none; display: flex;
  align-items: center; justify-content: center; background: var(--info-bg); color: var(--info); }
.timeline li.bad .tl-dot { background: var(--bad-bg); color: var(--bad); }
.timeline li.skip .tl-dot { background: var(--surface-2); color: var(--muted); }
.timeline li.done .tl-dot { background: var(--ok-bg); color: var(--ok); }
.cell-sub { color: var(--muted); font-size: .82rem; margin-top: 2px; }

/* -- empty states ------------------------------------------------------------ */
.empty { text-align: center; padding: 34px 20px; color: var(--muted); background: var(--surface);
  border: 1px dashed var(--line-2); border-radius: var(--radius); }
.card .empty { border: 0; padding: 18px 10px; background: none; }
.empty .icon { color: var(--line-2); margin-bottom: 6px; }
.empty-title { color: var(--ink-2); font-weight: 650; margin-bottom: 2px; }

/* -- tables ------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 650; padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table a { text-decoration: none; color: inherit; }
.table a:hover .verb { color: var(--brand); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
code.rule { background: var(--surface-2); padding: 2px 7px; border-radius: 6px;
  border: 1px solid var(--line); }
.kvps { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.kvp { font-size: .84rem; color: var(--ink-2); word-break: break-word; }
.kvp b { color: var(--muted); font-weight: 600; }

/* tabs */
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { padding: 5px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2);
  font-size: .88rem; font-weight: 500; }
.tab.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

/* -- allowlist ------------------------------------------------------------------ */
.rec-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.rec p { color: var(--ink-2); }
.rec-actions { display: flex; gap: 8px; margin-top: 10px; }
.form-card { max-width: 760px; }

/* -- metrics ------------------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; }
.tile-top { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.tile-label { font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.tile-value { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px;
  font-variant-numeric: tabular-nums; }
.tile-sub { color: var(--muted); font-size: .82rem; }
.tile.bad .tile-value { color: var(--bad); }
svg.bars, svg.stack { display: block; width: 100%; height: auto; }
.bar-label { fill: var(--ink-2); font-size: 13px; }
.bar-value { fill: var(--ink); font-size: 13px; font-weight: 600; }
.bar-track { fill: var(--surface-2); }
.bar-fill { fill: var(--brand); }
.bar-row:hover .bar-fill { fill: var(--brand-2); }
.seg.ok { fill: var(--ok); } .seg.warn { fill: var(--warn); } .seg.bad { fill: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 8px; }

/* -- shell steps ------------------------------------------------------------------ */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px;
  max-width: 820px; }
.step { display: flex; gap: 16px; }
.step-n { width: 32px; height: 32px; border-radius: 50%; flex: none; display: flex;
  align-items: center; justify-content: center; background: var(--info-bg); color: var(--brand);
  font-weight: 700; }
.step-body { flex: 1; min-width: 0; }
.step-body h2 { margin-bottom: 6px; }

/* -- sign-in -------------------------------------------------------------------- */
body.focus .page { display: flex; justify-content: center; padding-top: 9vh; }
.focus-card { width: 100%; max-width: 420px; text-align: center; padding: 32px 28px; }
.focus-card h1 { margin: 8px 0 6px; }
.focus-card .sub { color: var(--muted); margin-bottom: 22px; }
.focus-card .field { text-align: left; }
.focus-icon { width: 60px; height: 60px; margin: 0 auto; border-radius: 16px; display: flex;
  align-items: center; justify-content: center; background: var(--info-bg); color: var(--brand); }

/* -- toasts --------------------------------------------------------------------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50;
  display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px;
  border-radius: var(--radius); background: var(--ink); color: var(--bg); box-shadow: var(--shadow);
  animation: rise .2s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* -- small screens ------------------------------------------------------------- */
@media (max-width: 860px) {
  .split, .split.even { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px 12px; padding: 8px 16px; }
  .nav { order: 3; flex-basis: 100%; flex-wrap: wrap; }
  .session { margin-left: auto; }
  .page { padding: 18px 16px 90px; }
  h1 { font-size: 1.35rem; }
  .menu { position: fixed; left: 16px; right: 16px; width: auto; top: 110px; }
  .decide-actions .btn { flex: 1; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .req-foot .go { margin-left: 0; }
  /* tables become stacked rows: each row a block, its cells flowing */
  .table thead { display: none; }
  .table, .table tbody, .table tr { display: block; }
  .table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 3px 8px 3px 0;
    border: 0; }
  .table td:nth-child(2) { display: block; }
  .table .cell-sub code { word-break: break-all; }
  .right { text-align: left; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile-value { font-size: 1.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
