:root {
  --bg: #12100d;
  --bg-2: #1a1713;
  --panel: #221e19;
  --line: #3a332b;
  --ink: #f4eee4;
  --muted: #b3a796;
  --faint: #7d7366;
  --accent: #e4572e;
  --accent-2: #f2c14e;
  --good: #7cb77b;
  --bad: #d45d4e;
  --warn: #e0a84b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Outfit, "Segoe UI", sans-serif;
}

body {
  display: grid;
  grid-template-columns: 220px 1fr;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.clip { max-width: 28rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rail {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
  position: sticky;
  top: 0;
}

.mark { display: flex; gap: 12px; align-items: center; }
.mark strong { display: block; font-size: 20px; letter-spacing: -0.03em; }
.mark small { color: var(--faint); font-size: 12px; }
.mark-bug {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #1a100c;
  font-weight: 700;
  border-radius: 10px;
  letter-spacing: -0.04em;
}

.rail nav { display: grid; gap: 4px; }
.rail nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
}
.rail nav a:hover, .rail nav a.on {
  background: var(--panel);
  color: var(--ink);
}

.rail-out { margin-top: auto; }
.rail-out button, .ghost {
  background: transparent;
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  width: 100%;
}

.stage { padding: 32px 36px 64px; max-width: 1180px; }

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 28px;
}
.page-head h1 { margin: 0 0 6px; font-size: 32px; letter-spacing: -0.03em; }
.page-head p { margin: 0; color: var(--muted); max-width: 40rem; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.tile, .panel, .verdict {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
}
.tile span, .tile small { color: var(--faint); }
.tile b { display: block; font-size: 34px; letter-spacing: -0.04em; margin: 6px 0; }

.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 14px; margin-bottom: 22px; }
.panel h2 { margin: 0 0 8px; font-size: 18px; }
.hint { margin: 0 0 14px; color: var(--faint); font-size: 13px; }

.stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.check { display: flex; align-items: center; gap: 8px; }

button[type="submit"], .inline button, .decisions button {
  background: var(--accent);
  color: #1a100c;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 600;
}
.decisions button.danger { background: var(--bad); color: #fff; }
.decisions button.ghost, .inline .ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--faint); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

.toolbar { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.filters, .inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.st {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #2a241e;
}
.st-queued, .st-need_review { color: var(--warn); }
.st-posted, .st-keep, .st-scale { color: var(--good); }
.st-dead, .st-failed, .st-kill { color: var(--bad); }
.st-skip { color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 28px; }
.verdict header { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.verdict h3 { margin: 10px 0 6px; font-size: 18px; }
.verdict dl { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 12px 0; }
.verdict dt { color: var(--faint); font-size: 11px; text-transform: uppercase; }
.verdict dd { margin: 0; font-family: "IBM Plex Mono", monospace; font-size: 12px; }
.decisions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.sug { padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.sug-suggested_kill { background: rgba(212, 93, 78, 0.2); color: #f0a39a; }
.sug-suggested_keep { background: rgba(124, 183, 123, 0.18); color: #b7e0b6; }
.sug-suggested_scale { background: rgba(242, 193, 78, 0.18); color: var(--accent-2); }
.sug-need_review { background: #2a241e; color: var(--muted); }
.chip { font-size: 11px; color: var(--faint); }

.brand-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.brand-head h2 { margin: 0; font-size: 20px; }
.meta-list { display: grid; gap: 8px; margin: 16px 0 0; }
.meta-list div { display: grid; grid-template-columns: 8rem 1fr; gap: 8px; }
.meta-list dt { color: var(--faint); }
.meta-list dd { margin: 0; }
.notes { color: var(--muted); font-size: 13px; line-height: 1.45; }

.empty { color: var(--muted); padding: 28px; border: 1px dashed var(--line); border-radius: 12px; }

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill.good { border-color: var(--good); color: var(--good); }
.pill.bad { border-color: var(--bad); color: var(--bad); }
.pill.wait { color: var(--muted); }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 10px; font-size: 13px; }
.checks .pass { color: var(--good); font-weight: 600; }
.checks .fail { color: var(--bad); font-weight: 600; }

.job-line { color: var(--accent-2); font-size: 13px; }
#toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--panel); border: 1px solid var(--line);
  padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow);
}

body.gate {
  display: grid;
  place-items: center;
  min-height: 100vh;
  grid-template-columns: 1fr;
  background:
    radial-gradient(900px 400px at 20% -10%, rgba(228, 87, 46, 0.18), transparent),
    var(--bg);
}
.gate-card {
  width: min(420px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
}
.gate-card button { width: 100%; }
.flash { background: rgba(212, 93, 78, 0.15); color: #f0a39a; padding: 8px 10px; border-radius: 8px; margin: 0; }

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .rail { position: static; min-height: auto; flex-direction: row; flex-wrap: wrap; }
  .rail nav { grid-auto-flow: column; }
  .rail-out { margin: 0 0 0 auto; width: auto; }
  .tiles, .split { grid-template-columns: 1fr; }
  .stage { padding: 20px; }
}
