:root {
  color-scheme: dark;
  --ink-0: #0d0c0a;
  --ink-1: #15130f;
  --ink-2: #1d1a15;
  --ink-3: #28231b;
  --panel: rgba(30, 27, 21, 0.92);
  --panel-strong: #211d17;
  --paper: #e9dfca;
  --muted: #b8af9d;
  --faint: #948b7c;
  --line: rgba(205, 165, 94, 0.18);
  --line-strong: rgba(205, 165, 94, 0.38);
  --brass: #d0a45b;
  --brass-bright: #e6bf77;
  --copper: #bd7042;
  --teal: #5faaa0;
  --danger: #d56e63;
  --success: #82b786;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--ink-0); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--paper);
  background:
    radial-gradient(circle at 84% 6%, rgba(189, 112, 66, 0.12), transparent 28rem),
    linear-gradient(rgba(208, 164, 91, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(208, 164, 91, 0.025) 1px, transparent 1px),
    var(--ink-0);
  background-size: auto, 32px 32px, 32px 32px, auto;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -4rem;
  z-index: 1000;
  padding: 0.75rem 1rem;
  color: var(--ink-0);
  background: var(--brass-bright);
  border-radius: 8px;
}
.skip-link:focus { top: 1rem; }

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 18px 14px;
  background: rgba(14, 13, 10, 0.92);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 6px 16px;
  border-bottom: 1px solid var(--line);
}
.brand-link { color: inherit; text-decoration: none; }
.brand-link:hover strong { color: var(--brass-bright); }

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: #231a0f;
  font-family: Georgia, serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(145deg, var(--brass-bright), #9c682f);
  border: 1px solid #f2d495;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(52, 34, 16, 0.34), 0 8px 24px rgba(205, 143, 63, 0.16);
}

.brand strong { display: block; font-family: Georgia, serif; font-size: 19px; letter-spacing: 0.02em; }
.brand span:last-child { display: block; max-width: 150px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: 0.1em; white-space: nowrap; }

.primary-nav { display: grid; gap: 5px; margin-top: 16px; }

.nav-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 11px;
  text-align: left;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { color: var(--paper); background: rgba(208, 164, 91, 0.06); }
.nav-item.is-active {
  color: var(--paper);
  background: linear-gradient(90deg, rgba(208, 164, 91, 0.17), rgba(208, 164, 91, 0.035));
  border-color: var(--line-strong);
  box-shadow: inset 3px 0 0 var(--brass);
}
.nav-glyph { color: var(--brass); font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: 0.08em; }
.nav-item strong { display: block; font-size: 14px; }
.nav-item small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.rail-footer { margin-top: auto; padding: 18px 8px 4px; border-top: 1px solid var(--line); }
.rail-footer small { display: block; margin-top: 7px; color: var(--faint); font-size: 11px; }
.local-badge { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; box-shadow: 0 0 12px rgba(130, 183, 134, 0.65); }
.rail-account { display: grid; gap: 2px; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.rail-account strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.rail-account span { overflow: hidden; color: var(--faint); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.rail-policy-group { min-height: 0; margin: 18px 6px 0; padding-top: 15px; border-top: 1px solid var(--line); }
.rail-policy-group > span { display: block; margin-bottom: 8px; color: var(--faint); font-family: ui-monospace, monospace; font-size: 9px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.rail-policy-group nav { display: grid; gap: 2px; }
.rail-policy-link { padding: 6px 8px; color: var(--muted); border-radius: 7px; font-size: 11px; font-weight: 700; line-height: 1.25; text-decoration: none; }
.rail-policy-link:hover { color: var(--paper); background: rgba(208, 164, 91, 0.06); }
.rail-policy-link.is-active { color: var(--brass-bright); background: rgba(208, 164, 91, 0.11); }

.workbench { min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 88px;
  padding: 16px clamp(20px, 3vw, 42px);
  background: linear-gradient(180deg, rgba(13, 12, 10, 0.96), rgba(13, 12, 10, 0.68));
  border-bottom: 1px solid var(--line);
}

.topbar h1, .section-heading h2, .panel h2, .output-panel h2, .modal h2 {
  margin: 3px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.topbar h1 { font-size: clamp(29px, 3.2vw, 40px); }
.eyebrow { margin: 0; color: var(--brass); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.16em; }
.topbar-actions, .button-row, .modal-actions, .output-actions { display: flex; align-items: center; gap: 9px; }

main { padding: 18px clamp(20px, 3vw, 42px) 48px; }
.view[hidden] { display: none !important; }

.button, .icon-button, .text-button, .close-button {
  border: 0;
  cursor: pointer;
}
.button {
  min-height: 42px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
}
.button-brass { color: #241a0e; background: linear-gradient(145deg, var(--brass-bright), #b67c39); box-shadow: 0 8px 24px rgba(181, 117, 46, 0.14); }
.button-brass:hover { filter: brightness(1.08); }
.button-quiet { color: var(--paper); background: rgba(208, 164, 91, 0.07); }
.button-quiet:hover { background: rgba(208, 164, 91, 0.13); }
.button-danger { color: #fff0ed; background: rgba(168, 60, 51, 0.7); border-color: rgba(213,110,99,0.65); }
.button-danger:hover { background: rgba(189, 70, 60, 0.84); }
.button-guide { color: #b9d8d3; background: rgba(95, 170, 160, 0.07); border-color: rgba(95, 170, 160, 0.26); }
.button-guide:hover { color: #d8eee9; background: rgba(95, 170, 160, 0.13); border-color: rgba(95, 170, 160, 0.42); }
.button:disabled, .icon-button:disabled { opacity: 0.45; cursor: not-allowed; }
.text-button { padding: 5px; color: var(--brass-bright); background: transparent; font-size: 13px; }
.text-button:hover { text-decoration: underline; }
.text-button:disabled { opacity: 0.4; cursor: default; text-decoration: none; }
.text-button-muted { color: var(--muted); }
.text-button-create { color: #9fd1c8; }

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 10px;
  background: rgba(22, 20, 16, 0.74);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.metric { padding: 9px 16px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric strong { display: block; font-family: Georgia, serif; font-size: 19px; color: var(--paper); }
.metric span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; }

.prompt-map {
  display: grid;
  grid-template-columns: minmax(190px, 1.25fr) repeat(4, minmax(122px, 1fr)) minmax(170px, 1.15fr);
  min-height: 60px;
  margin-bottom: 10px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(25, 23, 18, 0.9), rgba(18, 17, 14, 0.82));
  border: 1px solid var(--line);
  border-radius: 12px;
}
.prompt-map-intro, .prompt-map-part, .prompt-map-result { min-width: 0; padding: 10px 12px; border: 0; border-right: 1px solid var(--line); }
.prompt-map-intro { display: grid; align-content: center; gap: 3px; text-align: left; color: var(--muted); background: rgba(208, 164, 91, 0.045); cursor: pointer; }
.prompt-map-intro:hover { background: rgba(208, 164, 91, 0.09); }
.prompt-map-intro span { color: var(--brass); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.11em; }
.prompt-map-intro strong { color: var(--paper); font-family: Georgia, serif; font-size: 14px; }
.prompt-map-part, .prompt-map-result { display: flex; align-items: center; gap: 9px; }
.prompt-map-part > span { display: grid; flex: 0 0 auto; place-items: center; width: 22px; height: 22px; color: var(--brass); font-family: ui-monospace, monospace; font-size: 9px; border: 1px solid var(--line-strong); border-radius: 50%; }
.prompt-map-part strong, .prompt-map-result strong { display: block; overflow: hidden; color: var(--paper); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.prompt-map-part small, .prompt-map-result small { display: block; margin-top: 3px; overflow: hidden; color: var(--faint); font-size: 10px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.prompt-map-result { border-right: 0; background: rgba(95, 170, 160, 0.055); }
.prompt-map-result > span { flex: 0 0 auto; color: var(--teal); font-size: 19px; }

.forge-layout {
  display: grid;
  grid-template-columns: minmax(520px, 0.98fr) minmax(430px, 1.02fr);
  gap: 14px;
  align-items: stretch;
  min-height: calc(100vh - 184px);
}
.forge-controls { display: grid; gap: 10px; align-content: start; }
.forge-controls > .recipe-panel { order: -1; }
.panel, .output-panel, .table-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 15px; }
.panel-heading, .section-heading, .output-heading, .modal-heading, .document-picker-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.panel-heading > div, .output-heading > div { display: flex; align-items: center; gap: 10px; }
.panel-heading-actions, .section-heading-actions { display: flex; align-items: center; gap: 10px; }
.panel-heading-actions { flex-wrap: wrap; justify-content: flex-end; }
.panel-heading h2, .output-heading h2 { font-size: 18px; }
.step-number {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: var(--brass-bright);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}
.panel-help { margin: 6px 0 12px 35px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.profile-panel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(42, 35, 25, 0.95), rgba(25, 22, 17, 0.96)),
    var(--panel);
}
.profile-panel::before {
  content: "STYLE SELECTOR  /  CONTEXT CONTROL";
  position: absolute;
  right: 18px;
  bottom: 8px;
  color: rgba(231, 203, 147, 0.12);
  font-family: ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  pointer-events: none;
}
.profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.profile-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: rgba(7, 7, 6, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.28);
}
.profile-card::before, .profile-card::after {
  content: "";
  position: absolute;
  z-index: 2;
  width: 4px;
  height: 4px;
  top: 7px;
  background: color-mix(in srgb, var(--profile-accent, var(--brass)) 68%, #59452d);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.55);
  pointer-events: none;
}
.profile-card::before { left: 7px; }
.profile-card::after { right: 7px; }
.profile-card.is-selected {
  border-color: color-mix(in srgb, var(--profile-accent, var(--brass)) 82%, white 8%);
  background: linear-gradient(145deg, color-mix(in srgb, var(--profile-accent, var(--brass)) 15%, transparent), rgba(7,7,6,0.54));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--profile-accent, var(--brass)) 28%, transparent), 0 10px 28px rgba(0,0,0,0.24);
}
.profile-select {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  grid-template-areas: "mark copy" "gauges gauges";
  gap: 10px;
  width: 100%;
  min-height: 128px;
  padding: 13px 11px 26px;
  text-align: left;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.profile-card.is-selected .profile-select { color: var(--paper); }
.profile-mark, .profile-editor-mark {
  grid-area: mark;
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  color: #20160c;
  font-family: Georgia, serif;
  font-weight: 900;
  background: radial-gradient(circle at 35% 30%, #f0d39b, var(--profile-accent, var(--brass)) 55%, #72502f);
  border: 1px solid color-mix(in srgb, var(--profile-accent, var(--brass)) 55%, white 25%);
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(37, 23, 11, 0.28), 0 5px 14px rgba(0,0,0,0.3);
}
.profile-copy { grid-area: copy; min-width: 0; padding-top: 2px; }
.profile-copy strong { display: block; color: var(--paper); font-family: Georgia, serif; font-size: 14px; }
.profile-copy small { display: block; margin-top: 4px; color: var(--faint); font-size: 11px; line-height: 1.4; }
.profile-gauges { grid-area: gauges; display: grid; gap: 5px; }
.profile-gauge { display: grid; grid-template-columns: minmax(42px, 1fr) auto; gap: 7px; align-items: center; }
.profile-gauge i { display: block; height: 3px; overflow: hidden; background: rgba(255,255,255,0.07); border-radius: 999px; }
.profile-gauge b { display: block; height: 100%; background: var(--profile-accent, var(--brass)); box-shadow: 0 0 8px color-mix(in srgb, var(--profile-accent, var(--brass)) 45%, transparent); }
.profile-gauge small { color: var(--faint); font-family: ui-monospace, monospace; font-size: 9px; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.profile-tune {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 3;
  padding: 3px 5px;
  color: var(--faint);
  background: transparent;
  border: 0;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
}
.profile-tune:hover { color: var(--profile-accent, var(--brass-bright)); }
.profile-readout { min-height: 34px; margin: 8px 0 0; padding: 8px 10px; color: var(--muted); background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.055); border-radius: 9px; font-size: 11px; line-height: 1.5; }
.profile-readout strong { color: var(--paper); }

.workspace-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.workspace-tile { position: relative; min-width: 0; }
.workspace-summary { margin-top: 9px; padding: 9px 11px; color: var(--muted); background: rgba(0,0,0,0.18); border: 1px solid rgba(255,255,255,0.055); border-radius: 9px; font-size: 11px; line-height: 1.5; }
.workspace-summary strong { color: var(--paper); }
.confidential-alert { margin-top: 12px; padding: 12px 14px; color: #f0d8bd; background: rgba(142, 61, 42, 0.22); border: 1px solid rgba(212, 120, 88, 0.5); border-radius: 9px; font-size: 11px; line-height: 1.55; }
.workspace-choice {
  position: relative;
  min-height: 78px;
  width: 100%;
  height: 100%;
  padding: 10px 11px 30px;
  text-align: left;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  cursor: pointer;
}
.workspace-choice:hover { color: var(--paper); border-color: var(--workspace-accent, var(--line-strong)); }
.workspace-choice.is-selected {
  color: var(--paper);
  background: color-mix(in srgb, var(--workspace-accent, var(--brass)) 13%, transparent);
  border-color: var(--workspace-accent, var(--brass));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--workspace-accent, var(--brass)) 35%, transparent);
}
.workspace-choice::after {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  background: var(--workspace-accent, var(--brass));
  border-radius: 0 4px 4px 0;
  opacity: 0.35;
}
.workspace-choice.is-selected::after { opacity: 1; }
.workspace-choice strong { display: block; font-size: 13px; }
.workspace-choice small { display: -webkit-box; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.workspace-inspect { position: absolute; right: 9px; bottom: 7px; z-index: 1; padding: 3px 5px; color: var(--faint); background: transparent; border: 0; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.09em; cursor: pointer; }
.workspace-inspect:hover, .workspace-inspect:focus-visible { color: var(--paper); text-decoration: underline; text-underline-offset: 3px; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.recipe-panel .field-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.task-grid { display: grid; grid-template-columns: minmax(180px, 0.72fr) minmax(300px, 1.28fr); gap: 10px; }
.task-first-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 0.34fr); gap: 10px; align-items: end; }
.task-primary textarea { min-height: 118px; font-size: 14px; line-height: 1.55; }
.approach-stage { display: grid; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.approach-heading { display: flex; align-items: flex-start; gap: 9px; }
.approach-heading h3 { margin: 1px 0 2px; color: var(--paper); font-family: Georgia, serif; font-size: 16px; }
.approach-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.approach-recommendation { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 13px; background: rgba(95,170,160,0.07); border: 1px solid rgba(95,170,160,0.25); border-radius: 10px; }
.approach-recommendation > div:first-child { display: grid; gap: 3px; }
.approach-recommendation small { color: #a4d0c8; font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.approach-recommendation strong { color: var(--paper); font-family: Georgia, serif; font-size: 16px; }
.approach-recommendation p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.approach-recommendation em { color: var(--faint); font-size: 9px; font-style: normal; }
.approach-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.approach-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 10px; background: rgba(0,0,0,.17); border: 1px solid var(--line); border-radius: 9px; }
.approach-picker[hidden], .approach-mismatch[hidden] { display: none; }
.approach-mismatch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; color: #ead5ad; background: rgba(184,107,55,.12); border: 1px solid rgba(227,188,116,.33); border-radius: 9px; }
.approach-mismatch p { margin: 0; font-size: 11px; line-height: 1.45; }
.approach-mismatch > div { display: flex; flex: 0 0 auto; gap: 7px; }
.scope-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-fieldset { min-width: 0; margin: 0; padding: 9px 10px 10px; border: 1px solid var(--line); border-radius: 9px; }
.choice-fieldset[hidden] { display: none; }
.choice-fieldset legend { padding: 0 5px; color: var(--paper); font-size: 10px; font-weight: 800; }
.choice-fieldset > small { display: block; margin-top: 7px; color: var(--faint); font-size: 9px; line-height: 1.35; }
.segmented-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
#change-boundary-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.segmented-choices label { position: relative; display: grid; gap: 2px; min-width: 0; padding: 7px 8px; color: var(--muted); background: rgba(0,0,0,.2); border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.segmented-choices label:has(input:checked) { color: var(--paper); background: rgba(194,137,70,.12); border-color: rgba(227,188,116,.5); box-shadow: inset 0 0 0 1px rgba(227,188,116,.12); }
.segmented-choices input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-choices strong { overflow-wrap: anywhere; font-size: 9px; }
.segmented-choices small { color: var(--faint); font-size: 8px; line-height: 1.25; }
.support-controls { margin-top: 10px; }
.first-success-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 10px; padding: 9px 10px; background: rgba(95,170,160,0.045); border: 1px solid rgba(95,170,160,0.13); border-radius: 9px; }
.first-success-examples > span { color: #c4e0db; font-size: 11px; font-weight: 800; }
.first-success-examples button { padding: 5px 8px; color: var(--paper); background: rgba(0,0,0,0.22); border: 1px solid rgba(95,170,160,0.2); border-radius: 7px; font-size: 10px; font-weight: 800; cursor: pointer; }
.first-success-examples button:hover { border-color: rgba(95,170,160,0.48); background: rgba(95,170,160,0.1); }
.first-success-examples small { flex: 1 1 100%; color: var(--faint); font-size: 10px; line-height: 1.4; }
.field { display: grid; gap: 7px; margin-top: 12px; }
.field > span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.09em; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field-label-row label { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.09em; }
.field-label-row .text-button { padding: 0; font-size: 11px; text-transform: none; letter-spacing: 0; }
.field small { color: var(--muted); font-size: 11px; line-height: 1.45; }
input, select, textarea {
  width: 100%;
  color: var(--paper);
  background: rgba(8, 8, 6, 0.72);
  border: 1px solid rgba(225, 193, 133, 0.18);
  border-radius: 9px;
}
input, select { min-height: 42px; padding: 0 12px; }
textarea { padding: 12px; line-height: 1.55; resize: vertical; }
input::placeholder, textarea::placeholder { color: #645e53; }
select option { background: var(--ink-2); }

.option-row { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 10px; }
.check-control { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; cursor: pointer; }
.check-control input { width: 16px; height: 16px; min-height: 0; accent-color: var(--brass); }

.document-picker { margin-top: 13px; padding: 13px; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-radius: 10px; }
.document-picker-heading { align-items: flex-start; margin-bottom: 9px; }
.document-picker-heading strong { font-size: 13px; }
.document-picker-heading small { max-width: 280px; color: var(--faint); font-size: 11px; line-height: 1.4; text-align: right; }
.document-option { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-top: 1px solid rgba(255,255,255,0.05); }
.document-option input { width: 15px; height: 15px; min-height: 0; margin-top: 2px; }
.document-option span { font-size: 12px; }
.document-option small { display: block; margin-top: 2px; color: var(--faint); }

.prompt-preview { margin-top: 13px; overflow: hidden; background: rgba(95,170,160,0.045); border: 1px solid rgba(95,170,160,0.2); border-radius: 11px; }
.prompt-preview summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px; cursor: pointer; list-style: none; }
.prompt-preview summary::-webkit-details-marker { display: none; }
.prompt-preview summary > span { display: grid; gap: 2px; }
.prompt-preview summary small { color: #a4d0c8; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; }
.prompt-preview summary strong { color: var(--paper); font-family: Georgia, serif; font-size: 15px; }
.prompt-preview summary em { color: var(--muted); font-size: 10px; font-style: normal; text-align: right; }
.prompt-preview-body { display: grid; gap: 10px; padding: 0 14px 13px; border-top: 1px solid rgba(95,170,160,0.13); }
.prompt-preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-top: 11px; }
.prompt-preview-grid h3 { margin: 0 0 7px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; }
.prompt-preview-grid dl { display: grid; grid-template-columns: minmax(90px, auto) 1fr; gap: 4px 9px; margin: 0; }
.prompt-preview-grid dt { color: var(--faint); font-size: 10px; }
.prompt-preview-grid dd { margin: 0; overflow-wrap: anywhere; color: var(--paper); font-size: 10px; line-height: 1.35; }
.prompt-preview-size { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 10px; background: rgba(0,0,0,0.2); border: 1px solid var(--line); border-radius: 8px; }
.prompt-preview-size strong { color: var(--paper); font-size: 11px; }
.prompt-preview-size span { color: var(--muted); font-size: 10px; text-align: right; }
.prompt-preview-size[data-level="warning"] { background: rgba(184,107,55,0.1); border-color: rgba(227,188,116,0.35); }
.prompt-preview-size[data-level="large"] { background: rgba(168,60,51,0.13); border-color: rgba(213,110,99,0.42); }
.prompt-preview-warnings { padding: 9px 10px; color: #e4c995; background: rgba(184,107,55,0.09); border: 1px solid rgba(227,188,116,0.25); border-radius: 8px; font-size: 10px; line-height: 1.45; }
.prompt-preview-warnings[hidden] { display: none; }
.prompt-preview-trust { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.prompt-preview-hashes { display: flex; gap: 14px; min-width: 0; color: var(--faint); font-size: 9px; }
.prompt-preview-hashes span { display: flex; gap: 5px; min-width: 0; }
.prompt-preview-hashes code { max-width: 170px; overflow: hidden; text-overflow: ellipsis; color: #8f887b; white-space: nowrap; }
.context-receipt { overflow: hidden; background: rgba(0,0,0,0.16); border: 1px solid rgba(255,255,255,0.055); border-radius: 8px; }
.context-receipt > summary { padding: 9px 10px; color: #a4d0c8; font-size: 10px; font-weight: 800; cursor: pointer; }
.context-receipt > div { display: grid; gap: 9px; max-height: 300px; overflow: auto; padding: 0 10px 10px; }
.context-receipt p, .context-receipt em { margin: 0; color: var(--faint); font-size: 10px; line-height: 1.45; }
.context-receipt-shelf { padding: 9px; background: rgba(255,255,255,0.018); border: 1px solid rgba(255,255,255,0.05); border-radius: 7px; }
.context-receipt-shelf h4, .context-receipt-shelf h5 { margin: 0; color: var(--paper); }
.context-receipt-shelf h4 { font-size: 12px; }
.context-receipt-shelf h5 { margin-top: 8px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; }
.context-receipt-shelf ul { display: grid; gap: 4px; margin: 5px 0 0; padding: 0; list-style: none; }
.context-receipt-shelf li { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding-top: 5px; border-top: 1px solid rgba(255,255,255,0.045); }
.context-receipt-shelf li strong, .context-receipt-shelf li small { display: block; }
.context-receipt-shelf li strong { color: var(--paper); font-size: 10px; }
.context-receipt-shelf li small, .context-receipt-shelf li code { color: var(--faint); font-size: 9px; }

.forge-button {
  position: sticky;
  bottom: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 66px;
  margin-top: 13px;
  padding: 0 20px;
  color: #24190d;
  text-align: left;
  background: linear-gradient(125deg, #e3bc74, #b86b37);
  border: 1px solid #edcf95;
  border-radius: 13px;
  cursor: pointer;
  box-shadow: 0 18px 44px rgba(159, 87, 38, 0.34), 0 0 0 5px rgba(13,12,10,0.78);
}
.forge-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.forge-button:disabled { opacity: 0.5; cursor: not-allowed; filter: saturate(0.55); box-shadow: none; }
.forge-button:disabled:hover { filter: saturate(0.55); transform: none; }
.forge-button span { font-family: Georgia, serif; font-size: 23px; font-weight: 700; }
.forge-button small { max-width: 280px; font-size: 11px; text-align: right; opacity: 0.82; }

.output-panel { display: flex; flex-direction: column; min-height: 620px; padding: 16px; background: linear-gradient(160deg, rgba(34, 29, 22, 0.97), rgba(20, 18, 14, 0.97)); }
.output-heading { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.output-heading > div:first-child { align-items: flex-start; flex-direction: column; gap: 1px; }
.output-state { color: var(--teal); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.13em; }
.icon-button { min-height: 36px; padding: 0 12px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; font-weight: 800; }
.icon-button:hover:not(:disabled) { color: var(--paper); border-color: var(--line-strong); }
.output-command-bar { justify-content: flex-end; flex-wrap: wrap; }
.output-format-control { display: grid; grid-template-columns: auto minmax(132px, 1fr); align-items: center; gap: 7px; color: var(--faint); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.output-format-control select { min-height: 36px; padding: 0 9px; font-size: 10px; text-transform: none; letter-spacing: 0; }
.output-copy-button { min-width: 92px; }
.output-clear-button { color: var(--muted); }
.output-clear-button:hover:not(:disabled) { color: var(--paper); }
.output-clear-button:disabled { opacity: 0.4; cursor: not-allowed; text-decoration: none; }
.output-stats { display: flex; gap: 16px; padding: 11px 1px; color: var(--faint); font-family: ui-monospace, monospace; font-size: 10px; }
.output-explainer { display: grid; gap: 8px; margin-bottom: 10px; padding: 12px 13px; color: var(--muted); background: rgba(95,170,160,0.055); border: 1px solid rgba(95,170,160,0.17); border-radius: 10px; }
.output-explainer[hidden] { display: none; }
.output-explainer > div { display: grid; gap: 4px; }
.output-explainer span { color: #a4d0c8; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; }
.output-explainer strong, .output-explainer p { margin: 0; color: var(--paper); font-size: 11px; line-height: 1.5; }
.output-used p { color: var(--muted); }
.output-empty-guide { display: grid; gap: 5px; margin-bottom: 10px; padding: 13px 14px; color: var(--muted); background: rgba(95,170,160,0.06); border: 1px solid rgba(95,170,160,0.16); border-radius: 10px; font-size: 12px; line-height: 1.5; }
.output-empty-guide strong { color: var(--paper); font-family: Georgia, serif; font-size: 15px; }
.output-empty-guide[hidden] { display: none; }
#output-text {
  flex: 1;
  min-height: 460px;
  color: #d8cfbd;
  background: #0d0c0a;
  border-color: rgba(225, 193, 133, 0.12);
  border-radius: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  scrollbar-color: #584932 #17140f;
}
.output-export-warning { margin: 9px 1px 0; color: #a99d89; font-size: 10px; line-height: 1.45; }
.hash-line { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; padding-top: 12px; color: var(--faint); font-size: 10px; }
.hash-line code { overflow: hidden; text-overflow: ellipsis; color: #8f887b; }

.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) repeat(3, auto) auto auto auto; gap: 9px; margin-bottom: 24px; padding: 12px; box-shadow: none; }
.toolbar select { min-width: 130px; }
.button-danger-soft { color: #efc4b7; background: rgba(157,65,49,0.14); border-color: rgba(216,111,91,0.32); }
.button-danger-soft:hover { color: #ffe0d6; background: rgba(157,65,49,0.24); border-color: rgba(216,111,91,0.52); }
.shelf-manager-card, .shelf-inspector-card { width: 100%; max-width: 100%; overflow-x: hidden; }
.shelf-manager-section + .shelf-manager-section { margin-top: 22px; }
.shelf-manager-section .section-heading, .shelf-inspector-grid .section-heading { margin-bottom: 9px; }
.shelf-manager-section h3, .shelf-inspector-grid h3 { margin: 0; font-family: Georgia, serif; font-size: 18px; }
.shelf-manager-list, .inventory-list { display: grid; gap: 8px; }
.shelf-manager-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 13px 12px 16px; background: rgba(0,0,0,0.2); border: 1px solid var(--line); border-left: 3px solid var(--workspace-accent, var(--brass)); border-radius: 9px; }
.shelf-manager-row > div { display: grid; flex: 1 1 auto; min-width: 0; gap: 3px; }
.shelf-manager-row strong { color: var(--paper); font-size: 13px; }
.shelf-manager-row span, .shelf-manager-row small { overflow-wrap: anywhere; color: var(--muted); font-size: 10px; line-height: 1.4; }
.shelf-inspector-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 13px 0 18px; padding: 11px 12px; background: rgba(95,170,160,0.06); border: 1px solid rgba(95,170,160,0.18); border-radius: 9px; }
.shelf-inspector-summary strong { color: #b8ddd6; font-size: 11px; }
.shelf-inspector-summary span { color: var(--muted); font-size: 10px; }
.shelf-inspector-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.inventory-list { max-height: 360px; overflow: auto; }
.inventory-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 10px; background: rgba(0,0,0,0.18); border: 1px solid var(--line); border-radius: 8px; }
.inventory-row[data-included="true"] { background: rgba(95,170,160,0.065); border-color: rgba(95,170,160,0.24); }
.inventory-row > div { display: grid; gap: 3px; min-width: 0; }
.inventory-row > div:last-child { justify-items: end; text-align: right; }
.inventory-row strong { overflow: hidden; color: var(--paper); font-size: 11px; text-overflow: ellipsis; }
.inventory-row small, .inventory-row code { color: var(--faint); font-size: 9px; }
.inventory-row span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; }
.inventory-row[data-included="true"] span { color: #a4d0c8; }
.knowledge-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.65fr); gap: 24px; }
.section-heading { margin-bottom: 13px; }
.section-heading h2 { font-size: 24px; }
.section-heading > span { color: var(--faint); font-size: 12px; }
.section-copy { max-width: 860px; margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.recipe-page-heading { align-items: flex-end; }

.concept-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 12px;
  padding: 14px 17px;
  background: linear-gradient(100deg, rgba(95, 170, 160, 0.07), rgba(29, 26, 21, 0.78) 42%, rgba(29, 26, 21, 0.72));
  border: 1px solid rgba(95, 170, 160, 0.19);
  border-radius: 12px;
}
.concept-note h2 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 17px; font-weight: 600; }
.concept-note p:not(.eyebrow) { max-width: 980px; margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.concept-note .text-button { flex: 0 0 auto; }
.concept-note-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 12px; }

.context-list { display: grid; gap: 10px; }
.context-card {
  position: relative;
  padding: 16px 18px 15px 21px;
  background: rgba(29, 26, 21, 0.82);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.context-card:hover { border-color: var(--line-strong); background: rgba(35, 31, 24, 0.9); }
.context-card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; background: var(--workspace-accent, var(--brass)); border-radius: 0 4px 4px 0; }
.context-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.context-card h3 { margin: 0; font-size: 14px; }
.context-card p { display: -webkit-box; margin: 10px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.55; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.context-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.pill { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; color: var(--faint); background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.06); border-radius: 999px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.pill-frozen { color: #ebc279; border-color: rgba(230, 191, 119, 0.28); }
.pill-current { color: #83b9ae; border-color: rgba(95, 170, 160, 0.27); }
.pill-provisional { color: #caa57b; border-color: rgba(202, 165, 123, 0.25); }
.priority { color: var(--faint); font-family: ui-monospace, monospace; font-size: 10px; white-space: nowrap; }

.document-list, .backup-list { display: grid; gap: 8px; }
.document-card, .backup-card, .empty-state {
  padding: 14px;
  background: rgba(29, 26, 21, 0.72);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.document-card { cursor: pointer; }
.document-card:hover { border-color: var(--line-strong); }
.document-card strong { display: block; overflow-wrap: anywhere; font-size: 12px; }
.document-card small, .backup-card small { display: block; margin-top: 6px; color: var(--faint); font-size: 10px; }
.empty-state { color: var(--faint); font-size: 12px; line-height: 1.5; text-align: center; border-style: dashed; }

.table-panel { overflow-x: auto; box-shadow: none; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; }
td { color: var(--muted); font-size: 12px; }
td strong { display: block; color: var(--paper); font-size: 13px; }
tbody tr:hover { background: rgba(208, 164, 91, 0.035); }
.history-heading { align-items: flex-end; }
.history-heading .section-copy { max-width: 760px; }
.history-prompt-cell { min-width: 280px; max-width: 520px; }
.history-prompt-cell span { display: -webkit-box; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.history-actions { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.history-actions .text-button:last-child { color: #a4d0c8; }

.recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.recipe-card { display: flex; flex-direction: column; min-height: 190px; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 13px; }
.recipe-card h3 { margin: 10px 0 7px; font-family: Georgia, serif; font-size: 18px; }
.recipe-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.recipe-card footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 16px; color: var(--faint); font-size: 10px; }

.system-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.system-grid .panel { min-height: 250px; }
.system-grid h2 { margin-top: 8px; font-size: 23px; }
.system-list { display: grid; gap: 0; margin: 20px 0 0; }
.system-list > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.system-list dt { color: var(--faint); font-size: 11px; }
.system-list dd { margin: 0; overflow-wrap: anywhere; color: var(--muted); font-family: ui-monospace, monospace; font-size: 11px; }
.system-actions-card p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.6; }
.system-actions-card .button-row { margin-top: 26px; }
.account-card { grid-column: span 3; min-height: 0 !important; }
.account-card .button-row { flex-wrap: wrap; }
.account-logout { display: flex; gap: 15px; align-items: center; margin-top: 16px; }
.danger-link { color: #e29b93; }
.recovery-code-result { margin-top: 16px; padding: 15px; background: rgba(95,170,160,0.07); border: 1px solid rgba(95,170,160,0.22); border-radius: 10px; }
.recovery-code-result small { display: block; color: var(--muted); }
.recovery-code-result strong { display: block; margin-top: 8px; overflow-wrap: anywhere; color: var(--paper); font-family: ui-monospace, monospace; font-size: 15px; letter-spacing: 0.04em; }
.recovery-code-result p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.backup-heading { margin-top: 30px; }
.backup-card { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.backup-card strong { font-family: ui-monospace, monospace; font-size: 11px; }

.modal {
  width: min(820px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  color: var(--paper);
  background: transparent;
  border: 0;
}
.modal-wide { width: min(980px, calc(100vw - 40px)); overflow-x: hidden; }
.modal::backdrop { background: rgba(4, 4, 3, 0.76); backdrop-filter: blur(5px); }
.modal-card { max-height: calc(100vh - 32px); padding: 22px; overflow-y: auto; background: #1c1914; border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 32px 100px rgba(0,0,0,0.7); }
.modal-small { width: min(520px, 100%); margin-inline: auto; }
.modal-heading { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.modal-heading h2 { font-size: 24px; }
.close-button { display: grid; place-items: center; width: 34px; height: 34px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 50%; font-size: 24px; line-height: 1; }
.close-button:hover { color: var(--paper); border-color: var(--line-strong); }
.modal-intro { margin: 15px 0 2px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.modal .field small { font-size: 12px; line-height: 1.5; }
.field-note { margin: 13px 0 0; padding: 12px 13px; color: var(--muted); background: rgba(95, 170, 160, 0.055); border: 1px solid rgba(95, 170, 160, 0.16); border-radius: 9px; font-size: 12px; line-height: 1.55; }
.field-note strong { color: var(--paper); }
.help-drawer { margin-top: 13px; color: var(--muted); background: rgba(0, 0, 0, 0.16); border: 1px solid rgba(255, 255, 255, 0.065); border-radius: 10px; }
.help-drawer[open] { border-color: rgba(95, 170, 160, 0.2); }
.help-drawer summary { padding: 12px 13px; color: #c4e0db; font-size: 12px; font-weight: 800; cursor: pointer; }
.help-drawer-body { padding: 0 13px 12px; border-top: 1px solid rgba(255, 255, 255, 0.055); }
.help-drawer-body p { margin: 10px 0 0; font-size: 12px; line-height: 1.65; }
.help-drawer-body strong { color: var(--paper); }
.marker-list code { color: var(--brass-bright); font-family: ui-monospace, monospace; font-size: 11px; }
.modal-actions { justify-content: flex-end; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line); }
.secret-warning { margin: 12px 0 0; color: #c1ad8d; font-size: 11px; }
.onboarding-copy { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.onboarding-modal::backdrop { background: rgba(5, 5, 4, 0.86); backdrop-filter: blur(5px); }
.file-drop { padding: 14px; background: rgba(0,0,0,0.2); border: 1px dashed var(--line-strong); border-radius: 10px; }
.file-drop input { padding: 9px; }
.delta-preview { margin-top: 13px; padding: 13px; color: var(--muted); background: #11100d; border: 1px solid var(--line); border-radius: 9px; font-family: ui-monospace, monospace; font-size: 11px; line-height: 1.55; white-space: pre-wrap; }
.viewer-card { display: flex; flex-direction: column; height: min(860px, calc(100vh - 32px)); }
.viewer-meta { padding: 10px 0; color: var(--faint); font-family: ui-monospace, monospace; font-size: 10px; }
#viewer-content { flex: 1; min-height: 430px; resize: none; font-family: ui-monospace, monospace; font-size: 13px; }

.profile-editor { width: min(900px, 100%); margin-inline: auto; }
.profile-editor-plate { display: flex; align-items: center; gap: 13px; margin-top: 16px; padding: 13px; background: rgba(0,0,0,0.22); border: 1px solid var(--line); border-radius: 11px; }
.profile-editor-mark { --profile-accent: var(--brass); flex: 0 0 auto; }
.profile-editor-plate strong { display: block; font-family: Georgia, serif; font-size: 17px; }
.profile-editor-plate small { display: block; margin-top: 4px; color: var(--faint); font-size: 11px; }
.tuning-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.tuning-guide > div { padding: 10px 11px; background: rgba(95, 170, 160, 0.045); border: 1px solid rgba(95, 170, 160, 0.13); border-radius: 9px; }
.tuning-guide strong { display: block; color: #c4e0db; font-size: 11px; }
.tuning-guide span { display: block; margin-top: 4px; color: var(--faint); font-size: 10px; line-height: 1.45; }
.profile-editor-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.profile-editor-section .section-heading h3 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 20px; }
.axis-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.axis-editor { display: grid; gap: 8px; padding: 12px; background: rgba(0,0,0,0.18); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; }
.axis-editor > span, .axis-editor > small { display: flex; justify-content: space-between; gap: 10px; }
.axis-editor strong { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; }
.axis-editor output { color: var(--brass-bright); font-family: ui-monospace, monospace; font-size: 12px; }
.axis-editor input[type="range"] { min-height: 4px; height: 4px; padding: 0; accent-color: var(--brass); cursor: pointer; }
.axis-editor > small { color: var(--faint); font-size: 10px; }
.axis-editor > small i { font-style: normal; }
.axis-editor > em { color: #a4d0c8; font-size: 10px; font-style: normal; line-height: 1.35; }
.default-shelf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.default-shelf-choice { display: flex; gap: 9px; align-items: flex-start; padding: 11px; background: rgba(0,0,0,0.18); border: 1px solid rgba(255,255,255,0.06); border-radius: 9px; cursor: pointer; }
.default-shelf-choice:has(input:checked) { border-color: var(--workspace-accent, var(--brass)); background: color-mix(in srgb, var(--workspace-accent, var(--brass)) 10%, transparent); }
.default-shelf-choice input { flex: 0 0 auto; width: 15px; height: 15px; min-height: 0; margin-top: 2px; accent-color: var(--workspace-accent, var(--brass)); }
.default-shelf-choice strong { display: block; font-size: 11px; }
.default-shelf-choice small { display: block; margin-top: 3px; color: var(--faint); font-size: 10px; line-height: 1.4; }

.onboarding-modal .modal-small { width: min(760px, 100%); }
.onboarding-setup-copy { margin: 18px 0 4px; }
.onboarding-formula { display: grid; grid-template-columns: repeat(4, minmax(90px, 1fr) auto) minmax(90px, 1fr); gap: 6px; align-items: stretch; margin: 16px 0; }
.onboarding-formula > span { display: grid; align-content: center; min-height: 58px; padding: 8px; text-align: center; background: rgba(0,0,0,0.2); border: 1px solid var(--line); border-radius: 9px; }
.onboarding-formula > span.is-result { background: rgba(95, 170, 160, 0.07); border-color: rgba(95, 170, 160, 0.25); }
.onboarding-formula strong { font-size: 11px; }
.onboarding-formula small { display: block; margin-top: 3px; color: var(--faint); font-size: 10px; }
.onboarding-formula > b { align-self: center; color: var(--brass); font-family: Georgia, serif; font-size: 15px; font-weight: 400; }

.guide-modal { width: min(960px, calc(100vw - 28px)); }
.guide-card { width: 100%; margin-inline: auto; }
.guide-lead { max-width: 760px; margin: 16px 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.guide-flow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.guide-flow article { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 11px; padding: 15px; background: rgba(0,0,0,0.18); border: 1px solid rgba(255,255,255,0.065); border-radius: 11px; transition: border-color 160ms ease, background 160ms ease; }
.guide-flow article.is-focus { background: rgba(208, 164, 91, 0.075); border-color: var(--line-strong); }
.guide-number { display: grid; place-items: center; width: 27px; height: 27px; color: var(--brass-bright); font-family: ui-monospace, monospace; font-size: 10px; border: 1px solid var(--line-strong); border-radius: 50%; }
.guide-flow h3 { margin: 1px 0 7px; color: var(--brass-bright); font-size: 10px; text-transform: uppercase; letter-spacing: 0.11em; }
.guide-flow strong { display: block; color: var(--paper); font-family: Georgia, serif; font-size: 18px; }
.guide-flow p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.guide-flow small { display: block; margin-top: 9px; color: #a4d0c8; font-size: 11px; }
.guide-result { display: flex; align-items: center; gap: 14px; margin-top: 10px; padding: 13px 15px; background: linear-gradient(90deg, rgba(95,170,160,0.08), rgba(208,164,91,0.05)); border: 1px solid rgba(95,170,160,0.2); border-radius: 11px; }
.guide-result .brand-mark { flex: 0 0 auto; }
.guide-result strong { font-family: Georgia, serif; font-size: 16px; }
.guide-result p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 2000; display: grid; gap: 8px; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 13px 15px; color: var(--paper); background: #272119; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow); font-size: 12px; animation: toast-in 180ms ease-out; }
.toast.is-error { border-color: rgba(213,110,99,0.55); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.noscript { position: fixed; inset: auto 20px 20px; padding: 16px; color: #21160b; background: var(--brass-bright); border-radius: 10px; }

.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.auth-shell { display: grid; grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 0.8fr); width: min(1080px, 100%); overflow: hidden; background: rgba(21,19,15,0.94); border: 1px solid var(--line-strong); border-radius: 22px; box-shadow: 0 36px 120px rgba(0,0,0,0.58); }
.auth-brand-panel { display: flex; flex-direction: column; justify-content: center; min-height: 680px; padding: clamp(32px, 5vw, 68px); background: radial-gradient(circle at 15% 10%, rgba(208,164,91,0.16), transparent 22rem), linear-gradient(145deg, rgba(37,31,23,0.96), rgba(15,14,11,0.98)); border-right: 1px solid var(--line); }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 52px; }
.auth-brand strong { font-family: Georgia, serif; font-size: 25px; }
.auth-brand-panel h1, .recovery-card h1 { max-width: 650px; margin: 12px 0 18px; font-family: Georgia, serif; font-size: clamp(34px, 4vw, 52px); font-weight: 600; line-height: 1.04; letter-spacing: -0.035em; }
.auth-brand-panel > p:not(.eyebrow) { max-width: 600px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.auth-method { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 42px; }
.auth-method span { display: flex; gap: 9px; align-items: center; padding: 12px; color: var(--muted); background: rgba(0,0,0,0.2); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.auth-method b { display: grid; place-items: center; width: 23px; height: 23px; color: var(--brass-bright); font-family: ui-monospace, monospace; font-size: 10px; border: 1px solid var(--line-strong); border-radius: 50%; }
.auth-card { display: flex; flex-direction: column; justify-content: center; min-height: 680px; padding: clamp(28px, 4vw, 52px); }
.auth-tabs { display: flex; gap: 6px; margin-bottom: 24px; padding: 5px; background: rgba(0,0,0,0.22); border: 1px solid var(--line); border-radius: 10px; }
.auth-tabs a { flex: 1; padding: 10px; color: var(--muted); text-align: center; text-decoration: none; border-radius: 7px; font-size: 12px; font-weight: 800; }
.auth-tabs a.is-active { color: var(--paper); background: rgba(208,164,91,0.13); }
.auth-form { display: none; }
.auth-form.is-active { display: block; }
.auth-form h2 { margin: 7px 0 6px; font-family: Georgia, serif; font-size: 28px; }
.auth-form > div > p:last-child { margin: 0 0 19px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.auth-submit { width: 100%; min-height: 48px; margin-top: 20px; }
.auth-error { margin-bottom: 18px; padding: 12px 14px; color: #ffd8d3; background: rgba(168,60,51,0.2); border: 1px solid rgba(213,110,99,0.42); border-radius: 9px; font-size: 13px; line-height: 1.45; }
.auth-error a { display: inline-block; margin: 7px 10px 0 0; color: var(--brass-bright); font-weight: 800; }
.auth-error small { display: block; margin-top: 7px; color: rgba(255,216,211,0.72); font-family: ui-monospace, monospace; font-size: 10px; }
.auth-status { margin-bottom: 18px; padding: 12px 14px; color: var(--muted); background: rgba(95,170,160,0.08); border: 1px solid rgba(95,170,160,0.24); border-radius: 9px; font-size: 13px; line-height: 1.5; }
.auth-status strong { color: var(--paper); }
.auth-version { margin-top: 26px; color: var(--faint); font-size: 10px; text-align: center; }
.recovery-page { width: min(720px, 100%); }
.recovery-card { padding: clamp(32px, 6vw, 68px); text-align: center; background: rgba(24,21,17,0.96); border: 1px solid var(--line-strong); border-radius: 22px; box-shadow: 0 36px 120px rgba(0,0,0,0.58); }
.recovery-card .brand-mark { margin: 0 auto 25px; }
.recovery-card h1 { margin-inline: auto; }
.recovery-card > p:not(.eyebrow) { max-width: 580px; margin: 0 auto; color: var(--muted); font-size: 15px; line-height: 1.65; }
.recovery-code-display { margin: 28px 0 12px; padding: 18px; overflow-wrap: anywhere; color: var(--paper); background: rgba(0,0,0,0.35); border: 1px solid var(--line-strong); border-radius: 12px; font-family: ui-monospace, monospace; font-size: clamp(14px, 3vw, 20px); letter-spacing: 0.06em; }
.recovery-continue { display: flex; align-items: center; justify-content: center; margin-top: 12px; text-decoration: none; }

.billing-actions form { margin: 0; }
.policy-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.policy-links a, .auth-policies a, .subscription-policies a { color: var(--brass-bright); font-size: 12px; text-decoration: none; }
.policy-links a:hover, .auth-policies a:hover, .subscription-policies a:hover { text-decoration: underline; }
.staging-payment-lock { margin: 18px 0 0; padding: 11px 12px; color: var(--muted); background: rgba(0,0,0,0.18); border: 1px solid var(--line); border-radius: 9px; font-size: 12px; line-height: 1.5; }
.auth-policies { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px 13px; margin-top: 18px; }
.policy-consent, .policy-acceptance label { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.policy-consent { margin-top: 16px; }
.policy-consent input, .policy-acceptance input { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 1px; accent-color: var(--brass); }

.admin-workbench { min-width: 0; }
.admin-main { padding: 0 24px 48px; }
.admin-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 18px; overflow: hidden; background: rgba(27,24,19,0.92); border: 1px solid var(--line); border-radius: 12px; }
.admin-metrics > div { display: grid; gap: 7px; min-width: 0; padding: 15px 17px; border-right: 1px solid var(--line); }
.admin-metrics > div:last-child { border-right: 0; }
.admin-metrics span { color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.admin-metrics strong { color: var(--paper); font-family: Georgia, serif; font-size: 25px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr); gap: 14px; }
.admin-grid .panel { min-height: 0; }
.admin-grid .panel > p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.6; }
.admin-control-form { display: flex; gap: 12px; align-items: end; margin-top: 18px; }
.admin-control-form .field { flex: 1; margin: 0; }
.admin-section-heading { align-items: end; margin-top: 30px; }
.admin-search { display: flex; gap: 9px; align-items: end; width: min(500px, 100%); }
.admin-search .field { flex: 1; margin: 0; }
.admin-table-panel { background: rgba(21,19,15,0.82); border: 1px solid var(--line); border-radius: 12px; }
.admin-table-panel table { min-width: 760px; }
.admin-cell-subtext { display: block; margin-top: 4px; color: var(--faint); font-family: ui-monospace, monospace; font-size: 10px; overflow-wrap: anywhere; }
.admin-actions { min-width: 150px; }
.admin-actions form { display: inline-block; margin: 3px 9px 3px 0; }
.admin-self-label { color: var(--faint); font-size: 11px; }
.admin-event-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 28px; }
.admin-event-grid > article { min-width: 0; }
.admin-event-grid .section-heading { min-height: 76px; }
.admin-error { color: #ffd8d3; background: rgba(168,60,51,0.2); border-color: rgba(213,110,99,0.42); }

@media (max-width: 1100px) {
  .admin-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .admin-metrics > div { border-bottom: 1px solid var(--line); }
  .admin-event-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .admin-main { padding: 0 14px 36px; }
  .admin-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-control-form, .admin-search { align-items: stretch; flex-direction: column; }
  .admin-section-heading { align-items: stretch; }
}
.policy-consent a, .policy-acceptance a { color: var(--brass-bright); }
.policy-acceptance { display: grid; gap: 12px; margin: 18px 0; padding: 14px; background: rgba(208,164,91,0.07); border: 1px solid var(--line); border-radius: 10px; }
.policy-acceptance .button { justify-self: start; }

.about-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.65fr); gap: 14px; }
.about-grid .panel { min-height: 330px; }
.about-intro-card > p:not(.eyebrow), .about-plan-card > p:not(.eyebrow) { max-width: 720px; color: var(--muted); font-size: 15px; line-height: 1.65; }
.about-intro-card > .button { display: inline-flex; align-items: center; margin-top: 22px; text-decoration: none; }
.about-control-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 23px; }
.about-control-list span { padding: 12px 13px; color: var(--paper); background: rgba(0,0,0,0.17); border: 1px solid var(--line); border-radius: 9px; font-size: 12px; font-weight: 750; }
.about-control-list b { margin-right: 7px; color: var(--brass); font-family: ui-monospace, monospace; font-size: 9px; letter-spacing: 0.08em; }
.about-plan-card { background: linear-gradient(145deg, rgba(48,39,27,0.98), rgba(26,23,18,0.94)); }
.about-plan-card h2 { margin: 12px 0 15px; font-size: clamp(42px, 5vw, 68px); }
.about-plan-card h2 small { color: var(--muted); font: 650 13px Inter, sans-serif; letter-spacing: 0; }
.about-policy-heading { margin: 48px 0 17px; }
.policy-directory { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.policy-directory > a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 13px; align-items: center; min-height: 112px; padding: 18px 20px; color: var(--paper); background: rgba(29,26,21,0.82); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; transition: border-color 140ms ease, background 140ms ease, transform 140ms ease; }
.policy-directory > a:hover { background: rgba(39,34,26,0.94); border-color: var(--line-strong); transform: translateY(-1px); }
.policy-directory > a > span { color: var(--brass); font-family: ui-monospace, monospace; font-size: 10px; }
.policy-directory strong { display: block; margin-bottom: 5px; font-family: Georgia, serif; font-size: 18px; }
.policy-directory small { display: block; color: var(--muted); font-size: 12px; line-height: 1.45; }
.policy-directory > a > b { color: var(--brass-bright); font-size: 18px; }
.edition-commercial[data-active-view="about"] #quick-import, .edition-commercial[data-active-view="about"] #quick-context { display: none; }

.storefront-page, .legal-page, .subscription-page { background: radial-gradient(circle at 76% 7%, rgba(189,112,66,0.19), transparent 31rem), radial-gradient(circle at 4% 55%, rgba(95,170,160,0.08), transparent 28rem), var(--ink-0); }
.storefront-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 14px clamp(20px, 5vw, 72px); background: rgba(13,12,10,0.84); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.storefront-brand { display: inline-flex; align-items: center; gap: 11px; color: var(--paper); text-decoration: none; }
.storefront-brand strong { font-family: Georgia, serif; font-size: 22px; }
.storefront-header nav, .storefront-footer nav { display: flex; align-items: center; flex-wrap: wrap; gap: 18px; }
.storefront-header nav > a:not(.button), .storefront-footer a { color: var(--muted); font-size: 13px; font-weight: 700; text-decoration: none; }
.storefront-header nav > a:hover, .storefront-footer a:hover { color: var(--paper); }
.storefront-main { padding: 0; }
.storefront-hero { display: flex; flex-direction: column; justify-content: center; min-height: 680px; padding: clamp(70px, 10vw, 150px) max(24px, calc((100vw - 1180px) / 2)); border-bottom: 1px solid var(--line); }
.storefront-hero h1 { max-width: 980px; margin: 13px 0 24px; font-family: Georgia, serif; font-size: clamp(49px, 8vw, 104px); font-weight: 500; line-height: 0.94; letter-spacing: -0.055em; }
.storefront-lead { max-width: 790px; margin: 0; color: var(--muted); font-size: clamp(18px, 2vw, 24px); line-height: 1.55; }
.storefront-actions { display: flex; flex-wrap: wrap; gap: 11px; margin: 34px 0 17px; }
.storefront-actions .button, .membership-card .button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; text-decoration: none; }
.storefront-hero > small { color: var(--faint); font-size: 12px; }
.storefront-section { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: clamp(72px, 9vw, 124px) 0; border-bottom: 1px solid var(--line); }
.storefront-section > h2, .storefront-split h2, .storefront-privacy h2 { max-width: 850px; margin: 11px 0 34px; font-family: Georgia, serif; font-size: clamp(34px, 5vw, 64px); font-weight: 500; line-height: 1.05; letter-spacing: -0.04em; }
.storefront-control-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line-strong); border-radius: 16px; overflow: hidden; }
.storefront-control-grid article { min-height: 255px; padding: 28px; background: rgba(27,24,19,0.78); border-right: 1px solid var(--line); }
.storefront-control-grid article:last-child { border-right: 0; }
.storefront-control-grid span { color: var(--brass); font-family: ui-monospace, monospace; font-size: 11px; }
.storefront-control-grid h3 { margin: 28px 0 12px; font-family: Georgia, serif; font-size: 24px; }
.storefront-control-grid p, .storefront-points p, .storefront-privacy p, .membership-card p, .membership-card li, .storefront-faq p, .storefront-example-grid p, .storefront-section-lead { color: var(--muted); line-height: 1.7; }
.storefront-split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(45px, 8vw, 110px); }
.storefront-split h2 { margin-bottom: 0; }
.storefront-points { display: grid; gap: 7px; align-content: center; }
.storefront-points strong { color: var(--paper); }
.storefront-privacy { padding-inline: clamp(24px, 7vw, 90px); background: linear-gradient(135deg, rgba(95,170,160,0.08), rgba(208,164,91,0.06)); border: 1px solid var(--line-strong); border-radius: 18px; }
.storefront-privacy p { max-width: 820px; font-size: 17px; }
.storefront-privacy a { color: var(--brass-bright); font-weight: 800; }
.storefront-section-lead { max-width: 820px; margin: -12px 0 34px; font-size: 18px; }
.storefront-example-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.storefront-example-grid article { min-height: 230px; padding: 27px; background: rgba(27,24,19,0.76); border: 1px solid var(--line-strong); border-radius: 14px; }
.storefront-example-grid span { color: var(--brass); font-family: ui-monospace, monospace; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.storefront-example-grid h3 { margin: 30px 0 10px; font-family: Georgia, serif; font-size: 25px; }
.storefront-note { display: block; margin-top: 18px; color: var(--faint); font-size: 12px; }
.membership-card { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-top: clamp(72px, 9vw, 124px); padding-inline: clamp(26px, 6vw, 84px); background: rgba(31,27,21,0.84); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow); }
.membership-card h2 { margin: 8px 0 17px; font-family: Georgia, serif; font-size: clamp(40px, 5vw, 66px); font-weight: 500; line-height: 1.02; }
.membership-card > div:last-child { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.membership-card ul { margin: 0 0 24px; padding-left: 20px; }
.storefront-faq { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.storefront-faq details { padding: 20px 22px; background: rgba(27,24,19,0.72); border: 1px solid var(--line); border-radius: 12px; }
.storefront-faq summary { cursor: pointer; font-weight: 800; }
.storefront-faq p { margin-bottom: 0; }
.storefront-footer { display: flex; justify-content: space-between; gap: 24px; padding: 34px clamp(20px, 5vw, 72px); color: var(--faint); border-top: 1px solid var(--line); }
.error-page { min-height: 100vh; background: radial-gradient(circle at 75% 15%, rgba(189,112,66,0.18), transparent 30rem), var(--ink-0); }
.error-main { display: grid; width: min(760px, calc(100% - 40px)); min-height: 100vh; margin: 0 auto; padding: 48px 0; align-content: center; }
.error-main > .storefront-brand { margin-bottom: 22px; }
.error-card { padding: clamp(30px, 6vw, 64px); background: rgba(27,24,19,0.86); border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow); }
.error-card h1 { margin: 12px 0 18px; font-family: Georgia, serif; font-size: clamp(42px, 7vw, 74px); font-weight: 500; line-height: 1; letter-spacing: -0.045em; }
.error-card > p:not(.eyebrow) { max-width: 580px; margin: 0 0 28px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.error-card .button { display: inline-flex; align-items: center; min-height: 48px; text-decoration: none; }

.legal-shell .workbench { min-width: 0; }
.legal-topbar .button, .topbar-actions > a.button { display: inline-flex; align-items: center; text-decoration: none; }
.legal-main { width: min(940px, calc(100% - 40px)); margin: 0 auto; padding: clamp(54px, 7vw, 100px) 0; }
.legal-heading { margin-bottom: 52px; }
.legal-heading h2, .subscription-card h1 { margin: 12px 0 20px; font-family: Georgia, serif; font-size: clamp(42px, 7vw, 72px); font-weight: 500; letter-spacing: -0.045em; }
.legal-lead { margin-bottom: 60px; color: var(--muted); font-size: 20px; line-height: 1.6; }
.legal-main section { padding: 23px 0; border-top: 1px solid var(--line); }
.legal-main section h3 { margin: 0 0 10px; font-family: Georgia, serif; font-size: 25px; }
.legal-main section p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.75; }
.legal-return { display: flex; margin-top: 42px; padding-top: 28px; border-top: 1px solid var(--line); }
.legal-return .button { display: inline-flex; align-items: center; text-decoration: none; }

.subscription-main { display: grid; align-content: center; width: min(780px, calc(100% - 32px)); min-height: 100vh; margin: 0 auto; padding: 40px 0; }
.subscription-main > .storefront-brand { margin: 0 auto 24px; }
.subscription-card { padding: clamp(28px, 6vw, 60px); background: rgba(25,22,17,0.94); border: 1px solid var(--line-strong); border-radius: 20px; box-shadow: var(--shadow); }
.subscription-card > p:not(.eyebrow), .billing-unavailable { color: var(--muted); font-size: 16px; line-height: 1.7; }
.subscription-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0; }
.subscription-actions form { margin: 0; }
.subscription-actions .button { display: inline-flex; align-items: center; min-height: 46px; text-decoration: none; }
.notice { margin: 22px 0; padding: 13px 15px; color: var(--paper); background: rgba(208,164,91,0.08); border: 1px solid var(--line-strong); border-radius: 10px; }
.notice.success { background: rgba(130,183,134,0.1); border-color: rgba(130,183,134,0.4); }
.subscription-policies { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px 16px; margin-top: 23px; }

@media (max-width: 1180px) {
  .prompt-map { grid-template-columns: minmax(175px, 1.2fr) repeat(2, minmax(145px, 1fr)); }
  .prompt-map > :nth-child(3), .prompt-map > :nth-child(6) { border-right: 0; }
  .prompt-map > :nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .forge-layout { grid-template-columns: 1fr; }
  .output-panel { min-height: 600px; }
  .recipe-panel .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: minmax(220px, 1fr) repeat(2, auto); }
  .toolbar .button { width: 100%; }
  .knowledge-layout { grid-template-columns: 1fr; }
  .recipe-grid, .system-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
  .app-shell { display: block; }
  .rail { position: static; display: block; height: auto; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 0 12px; }
  .brand-mark { width: 38px; height: 38px; }
  .primary-nav { display: flex; gap: 6px; overflow-x: auto; margin-top: 12px; padding-bottom: 2px; }
  .nav-item { flex: 0 0 auto; display: block; width: auto; min-width: 92px; padding: 9px 11px; text-align: center; }
  .nav-glyph, .nav-item small { display: none; }
  .rail-footer { display: none; }
  .rail-policy-group { margin: 11px 0 0; padding-top: 11px; }
  .rail-policy-group > span { padding-left: 2px; }
  .rail-policy-group nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
  .rail-policy-link { flex: 0 0 auto; padding: 8px 10px; border: 1px solid var(--line); }
  .topbar { min-height: 96px; padding: 20px 20px; }
  main { padding: 20px; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .workspace-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-select { min-height: 112px; }
  .task-grid { grid-template-columns: 1fr; }
  .task-first-grid, .scope-grid { grid-template-columns: 1fr; }
  .approach-recommendation, .approach-mismatch { align-items: flex-start; flex-direction: column; }
  .approach-picker { grid-template-columns: 1fr; }
  .prompt-preview-grid { grid-template-columns: 1fr; }
  .shelf-inspector-grid { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .tuning-guide { grid-template-columns: 1fr; }
  .onboarding-formula { grid-template-columns: 1fr; }
  .onboarding-formula > b { justify-self: center; transform: rotate(90deg); }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand-panel { min-height: 0; padding: 32px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-brand { margin-bottom: 28px; }
  .auth-brand-panel h1 { font-size: 36px; }
  .auth-card { min-height: 0; }
  .storefront-control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .storefront-control-grid article:nth-child(2) { border-right: 0; }
  .storefront-control-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .storefront-split, .membership-card { grid-template-columns: 1fr; }
  .storefront-example-grid { grid-template-columns: 1fr; }
  .storefront-faq { grid-template-columns: 1fr; }
  .legal-main { width: min(940px, calc(100% - 32px)); }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; }
  .topbar-actions { display: none; }
  .topbar h1 { font-size: 30px; }
  .field-grid, .recipe-panel .field-grid, .recipe-grid, .system-grid { grid-template-columns: 1fr; }
  .axis-editor-grid, .default-shelf-grid { grid-template-columns: 1fr; }
  .workspace-grid { grid-template-columns: 1fr; }
  .workspace-choice { min-height: 70px; }
  .forge-layout { min-height: auto; }
  .output-panel { min-height: 520px; padding: 13px; }
  .output-heading { align-items: stretch; flex-direction: column; }
  .output-command-bar { justify-content: stretch; width: 100%; }
  .output-format-control { flex: 1 1 100%; grid-template-columns: 1fr; }
  .output-command-bar .button { flex: 1 1 auto; justify-content: center; }
  #output-text { min-height: 390px; }
  .forge-button { align-items: flex-start; flex-direction: column; gap: 4px; padding: 14px 17px; }
  .forge-button small { text-align: left; }
  .prompt-preview summary, .prompt-preview-size { align-items: flex-start; flex-direction: column; }
  .prompt-preview summary em, .prompt-preview-size span { text-align: left; }
  .prompt-preview-hashes { flex-direction: column; gap: 4px; }
  .toolbar { grid-template-columns: 1fr; }
  .panel-heading, .section-heading { align-items: flex-start; }
  .panel-heading-actions, .section-heading-actions { align-items: flex-end; flex-direction: column; }
  .concept-note { align-items: flex-start; flex-direction: column; gap: 8px; }
  .prompt-map { grid-template-columns: 1fr 1fr; }
  .prompt-map > * { border-right: 1px solid var(--line) !important; border-bottom: 1px solid var(--line); }
  .prompt-map > :nth-child(even) { border-right: 0 !important; }
  .prompt-map > :nth-last-child(-n+2) { border-bottom: 0; }
  .guide-flow { grid-template-columns: 1fr; }
  .modal-card { padding: 17px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .button { flex: 1 1 auto; }
  .shelf-manager-row, .shelf-inspector-summary { align-items: flex-start; flex-direction: column; }
  .shelf-manager-row .button { width: 100%; }
  .inventory-row { grid-template-columns: 1fr; }
  .inventory-row > div:last-child { justify-items: start; text-align: left; }
  .account-card { grid-column: auto; }
  .auth-page { padding: 10px; }
  .auth-shell { border-radius: 15px; }
  .auth-brand-panel { padding: 24px; }
  .auth-method { grid-template-columns: 1fr; margin-top: 26px; }
  .auth-card { padding: 24px; }
  .storefront-header { position: static; align-items: flex-start; }
  .storefront-header nav > a:not(.button) { display: none; }
  .storefront-hero { min-height: 570px; }
  .storefront-control-grid { grid-template-columns: 1fr; }
  .storefront-control-grid article { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .storefront-control-grid article:last-child { border-bottom: 0; }
  .storefront-footer { flex-direction: column; }
  .storefront-footer nav { gap: 10px 15px; }
  .policy-links { grid-template-columns: 1fr; }
  .about-control-list, .policy-directory { grid-template-columns: 1fr; }
  .policy-directory > a { min-height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
