/* HAR Reference — "How the walk flows" (/static/har/system.html).
   This file is the whole stylesheet for that page: the rules below used to sit
   in a ~100-line inline <style> block in the HTML, against the house rule that
   CSS lives in CSS files. Moved out 2026-09-04, and every hardcoded hex swapped
   for the token nearest it (golden rule: design tokens only, never new ones).
   Only system.html links this file. */

*, *::before, *::after { box-sizing: border-box; }

body.har-system {
  margin: 0;
  font-family: var(--font-body);
  background: var(--surface-app);
  color: var(--text-primary);
  line-height: 1.6;
}

.har-system a { color: var(--text-link); }
.har-system a:hover { color: var(--text-link-hover); }

/* ---------- shell ---------- */

.har-system .layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  align-items: flex-start;
}

.har-system nav.side {
  width: 250px;
  flex: 0 0 250px;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  padding: var(--space-6) var(--space-4) var(--space-10);
  font-family: var(--font-heading);
  font-size: var(--text-sm);
}
.har-system nav.side .brand {
  display: block;
  margin-bottom: var(--space-3);
  font-weight: var(--font-bold);
  font-size: var(--text-base);
  color: inherit;
  text-decoration: none;
}
.har-system nav.side .grp {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
}
.har-system nav.side a.item {
  display: block;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}
.har-system nav.side a.item:hover { background: var(--surface-secondary); }
.har-system nav.side a.item.on {
  background: var(--accent-primary);
  color: var(--text-inverse);
}

.har-system main { flex: 1; min-width: 0; padding: var(--space-8) var(--space-6) var(--space-16); }
.har-system .wrap { max-width: 860px; }

/* ---------- type ---------- */

.har-system h1, .har-system h2,
.har-system h3, .har-system h4 { font-family: var(--font-heading); line-height: 1.25; }
.har-system h1 { font-size: var(--text-3xl); margin: 0 0 4px; }
.har-system h2 {
  font-size: var(--text-xl);
  margin: var(--space-10) 0 var(--space-3);
  border-bottom: 2px solid var(--border-subtle);
  padding-bottom: var(--space-2);
}
.har-system h3 { font-size: var(--text-base); margin: var(--space-6) 0 var(--space-2); }
.har-system .meta {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
}

.har-system code {
  font-family: var(--font-mono);
  font-size: .84em;
  background: var(--surface-tertiary);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
}

/* ---------- cards + tables ---------- */

.har-system .card {
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  margin: var(--space-4) 0;
  box-shadow: var(--shadow-sm);
}

.har-system .tablewrap { overflow-x: auto; }
.har-system table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--text-sm);
  margin: var(--space-3) 0;
}
.har-system th, .har-system td {
  text-align: left;
  vertical-align: top;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.har-system th {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
}

/* ---------- status + ask chips ---------- */

.har-system .st {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  margin-right: 6px;
  vertical-align: 1px;
}
/* build state — these mirror the chips on /static/the-rules.html and must
   never be flipped here on their own: that page owns build state. */
.har-system .st-built    { background: var(--color-green-100);  color: var(--color-green-600); }
.har-system .st-gap      { background: var(--surface-tertiary);  color: var(--text-secondary); border: 1px dashed var(--border-strong); }
.har-system .st-proposed { background: var(--color-yellow-100); color: var(--color-orange-600); }
.har-system .st-risk     { background: var(--color-red-100);    color: var(--color-red-600); }
/* ask type */
.har-system .st-choose   { background: var(--color-purple-100); color: var(--color-purple-700); }
.har-system .st-approve  { background: var(--color-green-100);  color: var(--color-green-600); }
.har-system .st-grant    { background: var(--color-yellow-100); color: var(--color-orange-600); }
.har-system .st-provide  { background: var(--color-blue-100);   color: var(--color-blue-600); }
.har-system .st-contact  { background: var(--color-purple-50);  color: var(--color-purple-600); }
.har-system .st-finish   { background: var(--surface-tertiary); color: var(--text-secondary); }

/* ---------- specimen: person-side card mock ---------- */

.har-system .spec {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-primary);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-3) 0 4px;
  max-width: 520px;
  box-shadow: var(--shadow-sm);
}
.har-system .spec .sp-title {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  font-size: var(--text-base);
  margin: 0 0 2px;
}
.har-system .spec .sp-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--space-3);
}
.har-system .spec .opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin: 6px 0;
  font-size: var(--text-sm);
}
.har-system .spec .opt .dot {
  width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-strong);
}
.har-system .spec .opt.sel .dot {
  border-color: var(--accent-primary);
  box-shadow: inset 0 0 0 4px var(--accent-primary);
}
.har-system .spec .opt .box {
  width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px;
  border-radius: var(--radius-xs);
  border: 2px solid var(--border-strong);
}
.har-system .spec .opt.sel .box {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}
.har-system .spec .opt small { display: block; color: var(--text-secondary); }
.har-system .spec .btnrow { display: flex; gap: 10px; margin-top: var(--space-3); }
.har-system .spec .btn {
  font-family: var(--font-heading);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--surface-primary);
}
.har-system .spec .btn.primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-inverse);
}
.har-system .spec textarea,
.har-system .spec input[type=text] {
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font: inherit;
  font-size: var(--text-sm);
  background: var(--surface-primary);
}
.har-system .spec .filedrop {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.har-system .spec .rankrow {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin: 6px 0;
  font-size: var(--text-sm);
  background: var(--surface-secondary);
}
.har-system .spec .grip { color: var(--text-muted); cursor: grab; font-size: var(--text-base); }
.har-system .spec .rankn { font-weight: var(--font-bold); color: var(--accent-primary); width: 18px; }
.har-system .spec .sig {
  border-bottom: 2px solid var(--text-primary);
  height: 44px;
  margin: var(--space-2) 0 4px;
  font-family: var(--font-sharpie);
  font-size: var(--text-2xl);
  color: var(--text-primary);
  display: flex;
  align-items: flex-end;
  padding: 0 var(--space-2);
}
.har-system .spec .formfield { margin: var(--space-3) 0; }
.har-system .spec .formfield label {
  display: block;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  font-family: var(--font-heading);
  margin-bottom: 4px;
  color: var(--text-secondary);
}
.har-system .spec .fakeselect {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: var(--text-sm);
  display: flex;
  justify-content: space-between;
  color: var(--text-primary);
  background: var(--surface-primary);
}

/* ---------- four-lane swimlane ---------- */

.har-system .lane-scroll {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}
.har-system .lane {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: var(--space-4) 0;
  font-size: var(--text-sm);
}
.har-system .lane .lh {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 6px 10px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-default);
}
.har-system .lane .cell {
  padding: 8px 10px;
  border-bottom: 1px dashed var(--border-subtle);
  min-height: 34px;
}
.har-system .lane .cell.world-cell { background: var(--surface-secondary); }
.har-system .lane .ev {
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7px 11px;
  box-shadow: var(--shadow-sm);
  display: inline-block;
}
.har-system .lane .ev.gate   { border-left: 4px solid var(--color-red-600); }
.har-system .lane .ev.agent  { border-left: 4px solid var(--color-purple-600); }
.har-system .lane .ev.person { border-left: 4px solid var(--color-green-600); }
.har-system .lane .ev.world  { border-left: 4px solid var(--color-cyan-700); }
.har-system .lane .exrow {
  grid-column: 1 / -1;
  padding: 4px 10px 12px;
  border-bottom: 1px dashed var(--border-subtle);
}
.har-system .lane .ex {
  display: block;
  background: var(--color-green-50);
  border: 1px solid var(--color-green-400);
  border-left: 4px solid var(--color-green-600);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: var(--text-sm);
  color: var(--color-green-600);
}
.har-system .lane .ex .extag {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-right: var(--space-2);
}

/* ---------- state bar ---------- */

.har-system .statebar {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  margin: var(--space-3) 0;
  font-family: var(--font-heading);
  font-size: var(--text-sm);
}
.har-system .statebar .stn {
  padding: 7px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--surface-primary);
  font-weight: var(--font-semibold);
}
.har-system .statebar .stn.hot {
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-color: var(--accent-primary);
}
.har-system .statebar .stn.ghost { border-style: dashed; }
.har-system .statebar .arr { color: var(--text-muted); }
.har-system .statebar .sep { margin-left: var(--space-3); }

/* ---------- callouts ---------- */

.har-system .callout {
  border-left: 5px solid var(--color-red-600);
  background: var(--color-red-50);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0;
  font-size: var(--text-sm);
}
.har-system .callout.good { border-left-color: var(--color-green-600); background: var(--color-green-50); }
.har-system .callout.warn { border-left-color: var(--color-orange-600); background: var(--color-yellow-50); }

/* ---------- numbered step cards ---------- */

.har-system .steps { counter-reset: step; }
.har-system .stepcard { position: relative; padding-left: 52px; }
.har-system .stepcard::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: var(--space-4);
  top: var(--space-5);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: var(--text-inverse);
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.har-system .kv { font-size: var(--text-sm); margin: 6px 0 0; }
.har-system .kv b {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-secondary);
  margin-right: 6px;
}

@media (max-width: 900px) {
  .har-system .layout { display: block; }
  .har-system nav.side { width: auto; position: static; max-height: none; padding: var(--space-4) var(--space-4) 0; }
  .har-system main { padding: var(--space-3) var(--space-4) var(--space-12); }
}

@media (max-width: 720px) {
  .har-system .lane { min-width: 760px; }
}

.har-system .meta.foot { margin-top: var(--space-12); }

/* 2026-09-05: the front-door plan carries one JSON shape block. Scrolls inside itself; the page never scrolls sideways. */
.har-system pre {
  background: var(--surface-tertiary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.45;
  max-width: 100%;
}
.har-system pre code { background: transparent; border: 0; padding: 0; }
