/* Demand Workbench base styles. Screens add their own section styles below the
   shared blocks; keep selectors flat and specific to avoid cascade fights. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidenav {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.sidenav .brand {
  font-weight: 700; font-size: 16px; letter-spacing: 0.01em;
  padding: 2px 10px 16px; color: var(--ink);
}
.sidenav .brand .dot { color: var(--accent); }
.sidenav a.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 500;
}
.sidenav a.nav-item:hover { background: var(--bg); text-decoration: none; }
.sidenav a.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.sidenav .nav-step-num {
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint);
  width: 18px; text-align: right;
}
.sidenav a.nav-item.active .nav-step-num { color: var(--accent); }
.sidenav .nav-section {
  margin: 14px 10px 4px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-faint); font-weight: 600;
}

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 28px; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar .crumbs { font-size: 13px; color: var(--ink-3); }
.topbar .crumbs b { color: var(--ink); font-weight: 600; }
.topbar .who { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar .role-badge {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 99px; padding: 2px 10px; font-size: 12px; color: var(--ink-2);
}

.content { padding: 26px 28px 60px; max-width: 1180px; width: 100%; }

.page-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
.page-sub { color: var(--ink-3); margin: 0 0 22px; font-size: 14px; }

/* ---------- cards, tables ---------- */
.card {
  background: var(--surface-raised); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-bottom: 18px;
}
.card h2 { font-size: 15px; font-weight: 650; margin: 0 0 12px; }
.card-grid { display: grid; gap: 16px; }
.card-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-faint); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--line-strong);
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:hover td { background: var(--accent-softer); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ---------- provenance chips (server-stamped; templates only render) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 99px; padding: 1.5px 9px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em;
  white-space: nowrap; vertical-align: middle;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-computed { background: var(--computed-soft); color: var(--computed); }
.chip-recorded { background: var(--recorded-soft); color: var(--recorded); }
.chip-synthetic { background: var(--synthetic-soft); color: var(--synthetic); }

/* ---------- status pills ---------- */
.pill {
  display: inline-block; border-radius: 99px; padding: 2px 10px;
  font-size: 11.5px; font-weight: 600;
}
.pill-queued { background: var(--bg); color: var(--ink-3); }
.pill-running { background: var(--accent-soft); color: var(--accent); }
.pill-done { background: var(--computed-soft); color: var(--computed); }
.pill-failed { background: var(--accent-soft); color: var(--accent); }
.pill-missing { background: var(--synthetic-soft); color: var(--synthetic); }
.pill-awaiting { background: var(--recorded-soft); color: var(--recorded); }

/* ---------- buttons, forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  border-radius: var(--radius-sm); padding: 8px 16px;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 600;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary { background: var(--surface-raised); color: var(--ink-2); border: 1px solid var(--line-strong); }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

label.field { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label.field input, label.field select, label.field textarea {
  display: block; width: 100%; margin-top: 5px;
  background: var(--surface-raised); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 8px 10px; font-family: var(--font-body); font-size: 14px;
}
label.field input:focus, label.field select:focus { border-color: var(--accent); outline: none; }

/* ---------- flash / error surfaces (D7: every failed mutation is visible) ---------- */
.flash { border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; font-size: 13.5px; }
.flash-error { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent); }
.flash-ok { background: var(--computed-soft); color: var(--computed); border: 1px solid var(--computed); }
.flash-warn { background: var(--synthetic-soft); color: var(--synthetic); border: 1px solid var(--synthetic); }

/* ---------- the designed miss state ---------- */
.miss-panel {
  border: 2px dashed var(--synthetic); background: var(--synthetic-soft);
  border-radius: var(--radius); padding: 22px; text-align: center;
}
.miss-panel h3 { margin: 0 0 6px; color: var(--synthetic); }
.miss-panel p { margin: 0; color: var(--ink-2); font-size: 13.5px; }

/* ---------- progress ---------- */
.progress-track { background: var(--line); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-fill { background: var(--accent); height: 100%; transition: width 0.4s ease; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidenav { flex-direction: row; flex-wrap: wrap; gap: 6px; border-right: none; border-bottom: 1px solid var(--line); }
  .sidenav .brand { width: 100%; padding-bottom: 8px; }
  .sidenav .nav-section { width: 100%; margin: 6px 10px 0; }
  /* D10: tap targets ≥44px on mobile */
  .sidenav a.nav-item { min-height: 44px; padding: 10px 12px; align-items: center; }
  .topbar .who a, .topbar .role-badge { display: inline-flex; align-items: center; min-height: 44px; }
  .card-grid.cols-2, .card-grid.cols-3 { grid-template-columns: 1fr; }
  .content { padding: 18px 14px 40px; }
  .btn { min-height: 44px; }
}
