:root {
  --bg: #f5f3ee;
  --panel: #fffdf8;
  --ink: #1e1d1a;
  --muted: #69655d;
  --line: #ddd6c8;
  --accent: #3c6e52;
  --accent-soft: #e6efe9;
  --accent-ink: #234b37;
  --warn: #8d5d16;
  --warn-soft: #f7ecd8;
  --ok: #256043;
  --ok-soft: #e2f1e8;
  --fail: #8d3b35;
  --fail-soft: #f8e2df;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 18px 48px;
}
.topbar {
  display: grid;
  gap: 16px;
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  margin-bottom: 6px;
}
h1 {
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.05;
  margin: 0;
}
h2 {
  font-size: clamp(24px, 2.5vw, 30px);
  line-height: 1.1;
}
h3 {
  font-size: 18px;
  line-height: 1.25;
}
.lede {
  max-width: 62ch;
  color: var(--muted);
  margin: 8px 0 0;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.nav-link {
  text-decoration: none;
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.55);
}
.nav-link.active {
  background: var(--accent-soft);
  border-color: #bfd2c4;
  color: var(--accent-ink);
}
.content {
  display: grid;
  gap: 18px;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 12px;
}
.hero-panel,
.metric,
.panel,
.selection-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 1px 0 rgba(20,18,11,0.03);
}
.hero-panel {
  padding: 18px;
}
.hero-panel-brief {
  background: linear-gradient(180deg, #fffdf8 0%, #fbf8f1 100%);
}
.hero-copy {
  color: var(--muted);
  max-width: 48ch;
  margin: 8px 0 12px;
}
.hero-preview {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8f3e8;
  border: 1px solid #eadfcb;
  border-radius: 12px;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  color: #3b372f;
  min-height: 168px;
}
.hero-runline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  text-decoration: none;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}
.button-link:hover {
  background: #faf7f0;
}
.button-link.primary,
.button-link.subtle {
  border-color: #bfd2c4;
}
.button-link.primary {
  background: var(--accent);
  color: white;
}
.button-link.subtle {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.metric {
  padding: 14px 15px;
}
.metric-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.metric-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
}
.metric-hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.panel {
  padding: 16px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head h2, .panel h2, .selection-card h3, .panel h3 {
  margin: 0;
}
.panel-head a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.running, .badge.partial { background: var(--warn-soft); color: var(--warn); }
.badge.failed, .badge.error { background: var(--fail-soft); color: var(--fail); }
.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.key-list {
  margin: 0;
  padding-left: 18px;
}
.hero-list {
  color: var(--muted);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}
select, button {
  font: inherit;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}
button {
  min-height: 42px;
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  cursor: pointer;
}
.brief-panel {
  padding: 18px;
}
.brief-box,
.brief-box-plain {
  word-break: break-word;
  background: #fcfaf5;
  border: 1px solid #e8e0d2;
  border-radius: 12px;
  padding: 18px;
  max-height: 72vh;
  overflow: auto;
}
.brief-box-plain {
  margin: 0;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
}
.brief-prose {
  max-width: 68ch;
}
.brief-prose h2,
.brief-prose h3,
.brief-prose h4 {
  margin: 1.3em 0 0.45em;
}
.brief-prose h2:first-child,
.brief-prose h3:first-child,
.brief-prose h4:first-child {
  margin-top: 0;
}
.brief-prose p {
  margin: 0 0 1em;
  line-height: 1.7;
}
.brief-list {
  margin: 0 0 1.2em;
  padding-left: 1.3em;
}
.brief-list li {
  margin: 0 0 0.65em;
  line-height: 1.65;
}
.brief-quote {
  margin: 0 0 1.2em;
  padding: 10px 14px;
  border-left: 3px solid #bfd2c4;
  background: #f6faf7;
  color: #2d4335;
  border-radius: 0 10px 10px 0;
}
.brief-prose hr {
  border: 0;
  border-top: 1px solid #e3dacb;
  margin: 1.4em 0;
}
.source-line {
  color: var(--accent-ink);
  font-size: 14px;
}
.empty-state {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 22px 18px;
  color: var(--muted);
}
.empty-state h3 {
  margin: 0 0 6px;
  color: var(--ink);
}
.stack {
  display: grid;
  gap: 12px;
}
.selection-card {
  padding: 16px;
}
.selection-meta, .muted, .empty {
  color: var(--muted);
}
.selection-card a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: #f3eee3;
  padding: 0.08em 0.35em;
  border-radius: 6px;
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .shell { padding: 18px 12px 36px; }
  .two-col { grid-template-columns: 1fr; }
  th:nth-child(4), td:nth-child(4), th:nth-child(5), td:nth-child(5) { display: none; }
  .nav-link { flex: 1 1 auto; text-align: center; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-panel, .panel, .selection-card, .metric { border-radius: 14px; }
}
