:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg-soft: #eaf0f7;
  --surface: #ffffff;
  --surface-raised: #fbfdff;
  --surface-muted: #f1f4f8;
  --ink: #141a24;
  --ink-soft: #2f3a4a;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #d9e3ef;
  --line-strong: #aebfd2;
  --primary: #1f5794;
  --primary-strong: #123762;
  --primary-soft: #eef4fb;
  --teal: #08766d;
  --teal-soft: #edf8f6;
  --amber: #9a5b0a;
  --amber-soft: #fff8e8;
  --red: #a8322a;
  --red-soft: #fff3f1;
  --green: #167047;
  --green-soft: #eef8f2;
  --sidebar: #09111f;
  --sidebar-raised: #111b2e;
  --shadow: 0 24px 76px rgba(13, 20, 34, 0.13);
  --shadow-soft: 0 12px 30px rgba(13, 20, 34, 0.065);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.92), 0 18px 46px rgba(13, 20, 34, 0.075);
  --shadow-command: 0 16px 38px rgba(20, 58, 104, 0.18);
  --radius: 8px;
  --radius-sm: 6px;
  --focus: 0 0 0 3px rgba(31, 78, 140, 0.16);
  font-family:
    Inter, "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fbfcfe 0%, #f6f8fb 34%, #eef3f8 100%);
  letter-spacing: 0;
  overflow-x: hidden;
}

html {
  scrollbar-width: thin;
  scrollbar-color: #aebfd2 #edf2f7;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: #edf2f7;
}

*::-webkit-scrollbar-thumb {
  background: #b6c5d8;
  border: 2px solid #edf2f7;
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #8fa4bd;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:disabled {
  box-shadow: none;
  transform: none;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p,
small,
span,
strong,
b {
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

small {
  line-height: 1.45;
}

/* Application shell */
.shell {
  position: relative;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: hidden;
}

.shell::before {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 0;
  width: 260px;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(180deg, #111d31 0%, #0b1424 46%, #070d18 100%);
  box-shadow: 22px 0 54px rgba(11, 18, 32, 0.1);
}

.main {
  position: relative;
  z-index: 3;
  min-width: 0;
  overflow-x: hidden;
  padding: 20px 32px 40px;
  isolation: isolate;
}

.main::before {
  position: fixed;
  inset: 0 0 0 260px;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(rgba(31, 78, 140, 0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 78, 140, 0.024) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.72) 0%, rgba(246, 248, 251, 0) 44%);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.34) 42%, transparent 82%);
}

.main > * {
  position: relative;
  z-index: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 100vh;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px;
  color: #f8fafc;
  background:
    linear-gradient(180deg, #111d31 0%, #0c1627 46%, #070d18 100%);
  border-right: 1px solid rgba(226, 232, 240, 0.14);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04), 20px 0 50px rgba(11, 18, 32, 0.08);
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  padding: 8px 8px 16px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.14);
}

.brand-mark {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--primary-strong);
  background:
    linear-gradient(180deg, #ffffff 0%, #edf6ff 100%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  font-size: 18px;
  font-weight: 700;
}

.brand-mark::before {
  position: absolute;
  inset: 7px;
  z-index: -1;
  content: "";
  background:
    linear-gradient(135deg, rgba(33, 90, 151, 0.18), rgba(8, 118, 109, 0.1));
  border: 1px solid rgba(33, 90, 151, 0.18);
  border-radius: 6px;
  transform: rotate(45deg);
}

.brand-mark::after {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 13px;
  height: 3px;
  content: "";
  background: var(--teal);
  border-radius: 999px;
  box-shadow: -8px -10px 0 rgba(33, 90, 151, 0.38);
}

.brand-mark span {
  position: relative;
  z-index: 1;
}

.brand strong,
.brand span,
.sidebar-panel strong,
.sidebar-panel small {
  display: block;
  min-width: 0;
}

.brand strong {
  color: #ffffff;
  font-size: 19px;
  font-weight: 700;
}

.brand span,
.sidebar-panel small {
  margin-top: 3px;
  color: #aab8cc;
  font-size: 12px;
}

.sidebar-section-label {
  display: block;
  margin: 3px 8px 0;
  color: #8fa0b8;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  color: #dce7f5;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item.is-active {
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0.075) 100%);
  border-color: rgba(226, 232, 240, 0.2);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateX(1px);
}

.nav-item.is-active::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  content: "";
  background: linear-gradient(180deg, #59d2c5 0%, var(--teal) 100%);
  border-radius: 999px;
  box-shadow: 0 0 22px rgba(8, 118, 109, 0.34);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #cfe0f8;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(226, 232, 240, 0.12);
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-icon small {
  display: none;
}

.nav-copy,
.nav-copy span,
.nav-copy small {
  min-width: 0;
  display: block;
}

.nav-copy span {
  overflow: hidden;
  color: inherit;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-copy small {
  overflow: hidden;
  margin-top: 2px;
  color: #9badc4;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-card {
  margin-top: auto;
  padding: 12px;
  background:
    linear-gradient(180deg, rgba(24, 35, 55, 0.98) 0%, rgba(18, 28, 46, 0.98) 100%);
  border: 1px solid rgba(226, 232, 240, 0.16);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 18px 34px rgba(0, 0, 0, 0.16);
}

.workspace-card > strong {
  margin: 9px 0 8px;
  overflow-wrap: anywhere;
  color: #ffffff;
  font-size: 15px;
  line-height: 1.35;
}

.workspace-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
}

.workspace-stats span {
  min-width: 0;
  padding: 7px;
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(226, 232, 240, 0.1);
  border-radius: var(--radius);
}

.workspace-stats b,
.workspace-stats small {
  display: block;
}

.workspace-stats b {
  color: #ffffff;
  font-size: 16px;
}

.workspace-stats small {
  overflow: hidden;
  color: #aab8cc;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-next {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.workspace-next > span {
  color: #91a3bb;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  min-height: 66px;
  margin: -20px -32px 18px;
  padding: 13px 32px;
  background: rgba(247, 249, 252, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 30px rgba(13, 20, 34, 0.052);
}

body:has(.modal-backdrop) .topbar {
  z-index: 0;
}

.topbar-title {
  min-width: 0;
}

.topbar h1 {
  margin-top: 3px;
  color: var(--ink);
  font-size: 25px;
  line-height: 1.12;
  font-weight: 700;
}

.topbar p {
  max-width: 850px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.top-actions,
.utility-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.utility-bar {
  align-items: center;
}

.journey-rail {
  display: flex;
  gap: 6px;
  margin: 0 0 18px;
  padding: 7px;
  overflow-x: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 251, 255, 0.92) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  scrollbar-width: thin;
}

.journey-step {
  min-width: 154px;
  flex: 1 0 154px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  box-shadow: none;
}

.journey-step:hover,
.journey-step:focus-visible {
  color: var(--primary);
  background: #ffffff;
  border-color: #c7d5e8;
  outline: none;
  box-shadow: var(--focus);
}

.journey-step span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
}

.journey-step strong,
.journey-step small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journey-step strong {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.journey-step small {
  color: var(--muted);
  font-size: 11px;
}

.journey-step.is-current {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-color: rgba(31, 78, 140, 0.35);
  box-shadow: 0 8px 18px rgba(31, 78, 140, 0.08);
}

.journey-step.is-current span {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.journey-step.is-complete span {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

.scope-chip {
  width: 220px;
  min-height: 44px;
  display: grid;
  gap: 2px;
  padding: 7px 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.scope-chip span,
.scope-chip strong {
  display: block;
  min-width: 0;
}

.scope-chip span {
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.scope-chip strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-chip.success {
  border-color: #b8ded6;
  background: #fbfffe;
}

.scope-chip.warn {
  border-color: #f0d39b;
  background: #fffdf7;
}

.topbar-context {
  width: 210px;
  min-height: 44px;
  padding: 7px 9px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 18px rgba(13, 20, 34, 0.045);
}

.topbar-context span,
.topbar-context strong,
.topbar-context small {
  display: block;
  min-width: 0;
}

.topbar-context span {
  color: var(--faint);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar-context strong {
  overflow: hidden;
  margin-top: 2px;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-context small {
  color: var(--muted);
  font-size: 11px;
}

.service-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.service,
.status-badge,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 4px 7px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.service strong {
  font-weight: 600;
}

.service-dot {
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 999px;
}

.service.is-ok,
.status-badge.success,
.badge.success {
  color: #0b6840;
  background: #f7fcfa;
  border-color: #cae8d7;
}

.service.is-ok .service-dot {
  background: var(--green);
}

.service.is-pending {
  color: var(--muted);
  background: #ffffff;
  border-color: var(--line);
}

.service.is-pending .service-dot {
  background: var(--faint);
}

.service.is-bad,
.status-badge.danger,
.badge.danger,
.badge.warn {
  color: #8a2f26;
  background: var(--red-soft);
  border-color: #f2c6c0;
}

.status-badge.warn {
  color: #8a4a04;
  background: var(--amber-soft);
  border-color: #f0d39b;
}

.status-badge.neutral {
  color: var(--ink-soft);
}

/* Shared layout */
.page-header,
.command-center,
.section-intro,
.empty-state,
.panel,
.active-collection-panel,
.workflow-card,
.metric-card,
.retrieval-card,
.collection-item,
.project-card,
.source-role-card,
.mini-card,
.coverage,
.readiness-card,
.suggestion-card,
.job,
.finding,
.editor-block,
.block-preview {
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.collection-item,
.project-card,
.process-action-card,
.source-role-card,
.mini-card,
.workflow-card,
.readiness-card {
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.collection-item:hover,
.project-card:hover,
.process-action-card:hover,
.source-role-card:hover {
  border-color: #adc1da;
  box-shadow: 0 20px 44px rgba(13, 20, 34, 0.105);
  transform: translateY(-1px);
}

.page-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
  overflow: hidden;
  padding: 17px 18px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border-color: #d7e1ee;
  box-shadow: var(--shadow-card);
}

.page-header h2,
.command-center h2,
.section-intro h2,
.panel h2,
.empty-state h2 {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.16;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.page-header p,
.command-center p,
.section-intro p,
.panel p,
.empty-state p,
.hint {
  color: var(--muted);
  line-height: 1.55;
}

.page-header p {
  max-width: 860px;
  margin-top: 6px;
  font-size: 14px;
}

.page-actions,
.button-row,
.command-actions,
.sto-hero-actions,
.chip-row,
.readiness-row,
.stage-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-actions {
  justify-content: flex-end;
}

.button-row.compact {
  align-items: center;
  justify-content: flex-end;
}

.grid {
  display: grid;
  gap: 16px;
}

.ai-workbench,
.expert-workbench {
  display: grid;
  gap: 16px;
}

.section-shell {
  display: grid;
  gap: 16px;
}

.grid.two,
.matrix-grid,
.ai-workbench,
.expert-workbench {
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.18fr);
}

.process-grid {
  grid-template-columns: minmax(300px, 0.62fr) minmax(320px, 0.38fr);
  align-items: start;
}

.expert-workbench {
  grid-template-columns: minmax(460px, 0.95fr) minmax(0, 1.05fr);
}

.panel {
  min-width: 0;
  padding: 16px;
  position: relative;
}

.panel,
.active-collection-panel,
.empty-state,
.workflow-card,
.retrieval-card,
.collection-item,
.project-card {
  position: relative;
}

.panel::before,
.page-header::before,
.section-intro::before,
.active-collection-panel::before,
.collection-item::before,
.project-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  pointer-events: none;
  content: "";
  background: linear-gradient(90deg, transparent 0%, rgba(33, 90, 151, 0.22) 18%, rgba(8, 118, 109, 0.14) 52%, transparent 100%);
  border-radius: var(--radius) var(--radius) 0 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head > div {
  min-width: 0;
}

.panel-head .badge,
.panel-head .status-badge {
  flex: 0 0 auto;
}

.panel-head h2,
.panel h3 {
  margin-top: 4px;
  color: var(--ink);
  font-weight: 700;
}

.panel h3 {
  font-size: 18px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 6px;
  color: #2b5ea6;
  background: #f5f8fe;
  border: 1px solid #dbe7fb;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.hint {
  margin: 8px 0 0;
  font-size: 14px;
}

.hint.tight {
  margin-top: 6px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric-card {
  display: grid;
  gap: 4px;
  padding: 12px 13px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 20px rgba(13, 20, 34, 0.045);
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.18;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.metric-card.success {
  border-color: #c8e7dc;
  background:
    linear-gradient(180deg, #ffffff 0%, #f7fffc 100%);
}

.metric-card.warn {
  border-color: #f0d39b;
  background:
    linear-gradient(180deg, #ffffff 0%, #fffaf0 100%);
}

.workspace-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 14px;
  margin-bottom: 16px;
}

.active-collection-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.active-collection-panel h2 {
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 21px;
  font-weight: 700;
}

.collection-compact-summary {
  margin-bottom: 14px;
}

.readiness-stack {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.workflow-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.workflow-map.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workflow-card {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 12px;
  text-align: left;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.workflow-card:hover,
.workflow-card:focus-visible {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--focus), 0 14px 28px rgba(13, 20, 34, 0.08);
}

.workflow-card span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
}

.workflow-card b,
.workflow-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-card small {
  color: var(--muted);
}

.workflow-card.done,
.workflow-step.done {
  border-color: #cfe8dc;
  background:
    linear-gradient(180deg, #ffffff 0%, #f7fffc 100%);
}

.executive-command-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 251, 255, 0.99) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.executive-copy {
  min-width: 0;
}

.executive-copy h2 {
  margin-top: 7px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 23px;
  line-height: 1.18;
  font-weight: 700;
}

.executive-copy p {
  max-width: 820px;
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
}

.executive-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.executive-stats div {
  min-width: 0;
  padding: 11px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.executive-stats span,
.executive-stats strong,
.executive-stats small {
  display: block;
  min-width: 0;
}

.executive-stats span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.executive-stats strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
}

.executive-stats small {
  color: var(--muted);
  font-size: 12px;
}

.executive-actions {
  display: flex;
  justify-content: flex-end;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.screen-steps,
.outcome-strip {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.screen-steps {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.outcome-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.screen-step,
.outcome-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.screen-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.screen-step > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
}

.screen-step.done > span {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

.screen-step.pending > span {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #c7d5e8;
}

.screen-step strong,
.screen-step small,
.outcome-card span,
.outcome-card strong,
.outcome-card small {
  display: block;
  min-width: 0;
}

.screen-step strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-step small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outcome-card {
  display: grid;
  gap: 4px;
  padding: 12px 13px;
}

.outcome-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.outcome-card strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.18;
  font-weight: 700;
}

.outcome-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.outcome-card.success {
  border-color: #cfe8dc;
  background: #fbfefd;
}

.outcome-card.warn {
  border-color: #f0d39b;
  background: #fffdf7;
}

.outcome-card.danger {
  border-color: #f2c6c0;
  background: var(--red-soft);
}

.verification-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: stretch;
  margin: 14px 0;
  padding: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.verification-board.compact {
  grid-template-columns: 1fr;
  margin-top: 0;
}

.verification-board article {
  min-width: 0;
  padding: 11px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.verification-board span,
.verification-board strong,
.verification-board small {
  display: block;
  min-width: 0;
}

.verification-board span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.verification-board strong {
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
}

.verification-board small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.verification-actions {
  display: grid;
  gap: 8px;
  align-content: center;
}

.review-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.review-pill.success {
  color: #0b6840;
  background: #f7fcfa;
  border-color: #cae8d7;
}

.review-pill.warn {
  color: #8a4a04;
  background: var(--amber-soft);
  border-color: #f0d39b;
}

.review-pill.danger {
  color: #8a2f26;
  background: var(--red-soft);
  border-color: #f2c6c0;
}

.workflow-rail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.sto-matrix-rail {
  grid-template-columns: repeat(10, minmax(190px, 1fr));
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.workflow-rail .workflow-step {
  appearance: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
}

.workflow-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.workflow-step > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #ffffff;
  background: var(--primary);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
}

.workflow-step.is-active {
  border-color: rgba(31, 78, 140, 0.45);
  background: #f7fbff;
  box-shadow: inset 0 0 0 1px rgba(31, 78, 140, 0.18);
}

.workflow-step.is-done > span {
  background: var(--teal);
}

.workflow-step strong,
.workflow-step small {
  display: block;
  min-width: 0;
}

.workflow-step strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-step small {
  color: var(--muted);
}

.sto-section-brief {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(180px, 0.65fr) minmax(240px, 0.9fr);
  gap: 10px;
  margin: 14px 0;
}

.sto-section-brief article {
  min-width: 0;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.sto-section-brief article.is-current {
  border-color: #c7d5e8;
  background: #f8fbff;
}

.sto-section-brief span,
.sto-section-brief strong,
.sto-section-brief small {
  display: block;
  min-width: 0;
}

.sto-section-brief span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sto-section-brief strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
}

.sto-section-brief small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.section-intro {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding: 18px;
}

/* Controls */
.button,
.icon-button,
.upload-control {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-weight: 600;
  line-height: 1.2;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

.button,
.icon-button {
  position: relative;
  overflow: hidden;
}

.button::before,
.icon-button::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 52%);
  opacity: 0;
  transition: opacity 0.14s ease;
}

.button:hover::before,
.button:focus-visible::before,
.icon-button:hover::before,
.icon-button:focus-visible::before {
  opacity: 1;
}

.primary-action {
  min-height: 38px;
}

.button:hover,
.button:focus-visible,
.icon-button:hover,
.icon-button:focus-visible,
.upload-control:hover,
.upload-control:focus-within {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--focus), 0 10px 20px rgba(13, 20, 34, 0.075);
  transform: translateY(-1px);
}

.button:active,
.icon-button:active {
  transform: translateY(1px);
}

.button.primary {
  color: #ffffff;
  background:
    linear-gradient(180deg, #3271b4 0%, var(--primary) 48%, var(--primary-strong) 100%);
  border-color: #1f4e8c;
  box-shadow: 0 16px 34px rgba(20, 58, 104, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.button.primary:hover,
.button.primary:focus-visible {
  background:
    linear-gradient(180deg, #2d70b8 0%, #215a97 46%, #143a68 100%);
}

.button.ghost {
  background: transparent;
  box-shadow: none;
}

.button.danger,
.button.tiny.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #f2c6c0;
}

.button.tiny,
.icon-button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 13px;
}

.icon-button {
  width: 34px;
  padding: 0;
}

.icon-button {
  color: var(--ink-soft);
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

input,
select {
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  padding: 10px 12px;
  resize: vertical;
  overflow: hidden;
  line-height: 1.55;
}

.inline-resolution {
  width: 100%;
  min-height: 78px;
  font: inherit;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--focus), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

input.is-invalid {
  border-color: #e2a39d;
  background: #fffafa;
  box-shadow: 0 0 0 3px rgba(168, 50, 42, 0.1);
}

.field-error,
.file-selection-hint {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.field-error,
.file-selection-hint.is-error {
  color: var(--red);
}

input::placeholder,
textarea::placeholder {
  color: #7a8798;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .full,
.field.full {
  grid-column: 1 / -1;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
}

.upload-box,
.matrix-subject-panel,
.quick-search-panel,
.document-select-search,
.settings-details,
.query-plan,
.category-strip,
.action-toolbar {
  display: grid;
  gap: 12px;
  padding: 14px;
  background:
    linear-gradient(180deg, #f8fbff 0%, var(--surface-muted) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.upload-control {
  position: relative;
  width: 100%;
  min-height: 64px;
  background: #ffffff;
  text-align: center;
}

.upload-control input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.upload-caption {
  color: var(--muted);
}

.action-toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin: 12px 0;
}

.action-toolbar strong,
.action-toolbar small {
  display: block;
}

.action-toolbar small {
  margin-top: 3px;
  color: var(--muted);
}

.document-context-details .action-toolbar {
  grid-template-columns: 1fr;
}

.document-context-details .action-toolbar .button-row {
  justify-content: flex-start;
}

/* States */
.notice,
.inline-notice {
  padding: 11px 13px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.5;
}

.notice.success,
.inline-notice.success {
  color: #0b6840;
  background: var(--green-soft);
  border-color: #bde7d1;
}

.notice.error,
.inline-notice.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #f2c6c0;
}

.notice.muted,
.inline-notice.warn {
  color: #7a4a10;
  background: var(--amber-soft);
  border-color: #f0d39b;
}

.inline-notice {
  display: grid;
  gap: 3px;
}

.global-message-stack {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
}

.global-message {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(13, 20, 34, 0.08);
}

.global-message > span {
  width: 10px;
  height: 10px;
  background: var(--primary);
  border-radius: 999px;
}

.global-message strong,
.global-message p {
  display: block;
  min-width: 0;
}

.global-message strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.global-message p {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.global-message.success {
  border-color: #cfe8dc;
  background: #fbfefd;
}

.global-message.success > span {
  background: var(--teal);
}

.global-message.danger {
  border-color: #f2c6c0;
  background: var(--red-soft);
}

.global-message.danger > span {
  background: var(--red);
}

.global-message.processing {
  border-color: #c7d5e8;
  background: #f8fbff;
}

.global-message.processing::after {
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: message-progress 1.6s ease-in-out infinite;
}

.global-message.processing > span {
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(31, 78, 140, 0.12);
}

@keyframes message-progress {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(100%);
  }
}

.empty-state {
  display: grid;
  gap: 10px;
  place-items: start;
  padding: 22px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f9fcff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.empty-state.compact {
  padding: 16px;
}

.empty-state-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #c7d5e8;
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 10px 24px rgba(31, 78, 140, 0.1);
  font-weight: 700;
}

.empty-state h3,
.empty-state h2 {
  color: var(--ink);
  font-weight: 700;
}

/* Tables */
.table-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 12px 0 0;
  padding: 11px 12px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}

.table-toolbar strong,
.table-toolbar span,
.table-toolbar small {
  display: block;
  min-width: 0;
}

.table-toolbar strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.table-toolbar span,
.table-toolbar small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.table-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.table-toolbar + .table-shell,
.table-toolbar + .table-wrap {
  border-radius: 0 0 var(--radius) var(--radius);
}

.table-wrap,
.table-shell {
  width: 100%;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 44px rgba(13, 20, 34, 0.07);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #b9c6d6 transparent;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
}

.table-shell.wide table,
.table-wrap.wide table {
  min-width: 1040px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 14px;
  color: var(--ink-soft);
  background:
    linear-gradient(180deg, #f7f9fc 0%, #eef4fa 100%);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
}

td {
  padding: 13px 14px;
  vertical-align: top;
  border-bottom: 1px solid #e7edf5;
  transition: background 0.12s ease;
}

tbody tr:hover td {
  background: #f6faff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-shell.wide thead th:last-child,
.table-wrap.wide thead th:last-child,
.table-shell.wide tbody td:last-child,
.table-wrap.wide tbody td:last-child {
  position: sticky;
  right: 0;
  z-index: 3;
  background: #ffffff;
  box-shadow: -14px 0 26px rgba(13, 20, 34, 0.075);
}

.table-shell.wide thead th:last-child,
.table-wrap.wide thead th:last-child {
  z-index: 4;
  background:
    linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%);
}

.table-shell.wide tbody tr:hover td:last-child,
.table-wrap.wide tbody tr:hover td:last-child {
  background: #fbfdff;
}

tbody tr.has-conflict td,
tbody tr.is-warning td {
  background: #fffdf7;
}

tbody tr.has-conflict:hover td,
tbody tr.is-warning:hover td {
  background: #fff9ee;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 4px;
  color: var(--muted);
}

td strong {
  font-weight: 700;
}

.button-cell {
  min-width: 190px;
  white-space: nowrap;
}

.add-row td {
  background: #f4f9ff;
}

.add-row-control {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.sto-add-control {
  grid-template-columns: minmax(160px, 0.3fr) minmax(240px, 0.8fr) minmax(220px, 0.7fr) minmax(180px, 0.6fr) auto;
}

.norm {
  padding: 8px 0;
  border-bottom: 1px dashed #d8e1ec;
}

.norm:last-child {
  border-bottom: 0;
}

.warn-text {
  color: #9a3f0a;
  font-weight: 700;
}

.result-panel {
  margin-top: 16px;
}

.result-panel .panel-head {
  align-items: flex-start;
}

/* Collections and processing */
.collection-list,
.job-list,
.section-list,
.chunk-list,
.analysis-list,
.project-list,
.profile-group,
.sto-matrix-group {
  display: grid;
  gap: 12px;
}

.collection-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.collection-item.is-active {
  border-color: #bfe9d4;
  background: #fbfffd;
}

.collection-item h3,
.project-card strong {
  overflow-wrap: anywhere;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metrics span,
.metric-row div {
  min-width: 94px;
  padding: 9px 10px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metrics strong,
.metrics small,
.metric-row dt,
.metric-row dd {
  display: block;
  margin: 0;
}

.metrics strong,
.metric-row dd {
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.metrics small,
.metric-row dt {
  color: var(--muted);
  font-size: 11px;
}

.process-action-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin: 14px 0;
  padding: 14px;
  background: var(--surface-raised);
}

.processing-doc-sidebar {
  position: sticky;
  top: 86px;
  align-self: start;
}

.processing-doc-sidebar .panel-head {
  margin-bottom: 8px;
}

.processing-doc-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 260px);
  min-height: 360px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.processing-doc-item {
  display: grid;
  gap: 9px;
  padding: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.processing-doc-item:hover {
  border-color: #b8c8dc;
  box-shadow: 0 8px 18px rgba(13, 20, 34, 0.05);
}

.processing-doc-item.is-selected {
  background: #f8fbff;
  border-color: #b9cbe3;
  box-shadow: inset 3px 0 0 var(--primary);
}

.processing-doc-item.is-inactive,
.check-row.is-inactive,
tr.is-inactive {
  background: #fff8f7;
  border-color: #f0c7c2;
  box-shadow: inset 3px 0 0 var(--red);
}

.check-row.is-inactive:has(input:checked) {
  background: #fff8f7;
  border-color: #e9aaa3;
  box-shadow: inset 3px 0 0 var(--red);
}

.danger-text {
  color: var(--red) !important;
  font-weight: 700;
}

.processing-doc-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.processing-doc-check.check-row {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.processing-doc-check input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.processing-doc-check input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 4px var(--primary), inset 0 0 0 6px #ffffff;
}

.processing-doc-check strong,
.processing-doc-check small,
.processing-doc-meta small {
  display: block;
  min-width: 0;
}

.processing-doc-check strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  line-height: 1.25;
}

.processing-doc-check small,
.processing-doc-meta small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.processing-doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.process-action-card p {
  margin-top: 6px;
}

.activity-panel {
  margin-top: 12px;
}

.job {
  padding: 14px;
}

.job-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.job-progress {
  height: 8px;
  overflow: hidden;
  margin: 12px 0;
  background: #e6edf6;
  border-radius: 999px;
}

.job-progress span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.operation-state {
  border-color: #c7d5e8;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.operation-state .job-progress {
  margin: 14px 0 10px;
}

.job-stats,
.parser-summary,
.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

/* Matrix and retrieval */
.matrix-workbench-page {
  display: grid;
  gap: 16px;
}

.matrix-workbench-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.76fr) minmax(420px, 1.24fr);
  gap: 16px;
  align-items: start;
}

.matrix-doc-panel,
.matrix-command-card,
.matrix-result-panel {
  overflow: hidden;
}

.matrix-doc-panel .panel-head,
.matrix-command-card .panel-head,
.matrix-result-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.panel-head p,
.matrix-result-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.badge.strong {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #c7d5e8;
}

.matrix-command-card {
  display: grid;
  gap: 14px;
}

.matrix-command-card .matrix-subject-panel {
  margin: 0;
}

.matrix-plan-summary {
  display: grid;
  gap: 12px;
  padding: 13px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #d4dfec;
  border-radius: var(--radius);
}

.matrix-plan-summary.is-empty {
  background: #fafcff;
  border-style: dashed;
}

.matrix-plan-summary strong,
.matrix-plan-summary small {
  display: block;
}

.matrix-plan-summary strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.matrix-plan-summary small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.matrix-direction-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.matrix-direction-chips span {
  max-width: 100%;
  padding: 5px 8px;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.matrix-action-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.matrix-action-footer strong,
.matrix-action-footer small {
  display: block;
}

.matrix-action-footer strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.matrix-action-footer small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.matrix-action-footer.compact {
  display: flex;
  justify-content: flex-end;
}

.matrix-empty-workspace {
  align-items: start;
  text-align: left;
}

.matrix-empty-steps,
.matrix-job-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin-top: 14px;
}

.matrix-empty-steps article,
.matrix-job-grid article {
  min-width: 0;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.matrix-empty-steps strong,
.matrix-empty-steps span,
.matrix-job-grid span,
.matrix-job-grid strong,
.matrix-job-grid small {
  display: block;
}

.matrix-empty-steps strong,
.matrix-job-grid strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.matrix-empty-steps span,
.matrix-job-grid small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.matrix-job-grid span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  color: #ffffff;
  background: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
}

.matrix-table th:first-child,
.matrix-table td:first-child {
  width: 24%;
}

.matrix-table th:nth-child(2),
.matrix-table td:nth-child(2) {
  width: 50%;
}

.matrix-table th:nth-child(3),
.matrix-table td:nth-child(3) {
  width: 26%;
}

.matrix-row-title,
.matrix-value-stack,
.matrix-check-stack,
.matrix-source-stack,
.matrix-decision-stack {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.matrix-row-title strong {
  color: var(--ink);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.matrix-row-title small {
  color: var(--muted);
  line-height: 1.35;
}

.matrix-readiness {
  width: max-content;
  max-width: 100%;
  padding: 4px 7px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.matrix-readiness.success {
  color: #0b6840;
  background: #f7fcfa;
  border-color: #cae8d7;
}

.matrix-readiness.warn {
  color: #8a4a04;
  background: var(--amber-soft);
  border-color: #f0d39b;
}

.matrix-readiness.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #efc2bd;
}

.matrix-source-stack {
  align-content: start;
}

.source-missing {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  padding: 5px 8px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #efc2bd;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
}

.doc-picker {
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.doc-picker.tall {
  max-height: 590px;
}

.document-selection-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
  padding: 8px 10px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.select-all-inline {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 30px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.select-all-inline input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.select-all-inline input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 4px var(--primary), inset 0 0 0 6px #ffffff;
}

.select-all-inline input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.compact-hint {
  margin: -2px 0 8px;
  font-size: 12px;
}

.check-row,
.toggle-card {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.check-row:hover,
.toggle-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(13, 20, 34, 0.05);
}

.check-row:has(input:checked),
.toggle-card:has(input:checked) {
  background: #f8fbff;
  border-color: #b9cbe3;
  box-shadow: inset 3px 0 0 var(--primary);
}

.check-row input[type="checkbox"],
.toggle-card input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.check-row input[type="checkbox"]:checked,
.toggle-card input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 4px var(--primary), inset 0 0 0 6px #ffffff;
}

.check-row input[type="checkbox"]:focus-visible,
.toggle-card input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.check-row strong,
.check-row small,
.toggle-card strong,
.toggle-card small {
  display: block;
  min-width: 0;
}

.sto-norm-cell {
  display: grid;
  gap: 4px;
}

.sto-norm-cell strong {
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sto-norm-cell small {
  color: var(--muted);
  line-height: 1.35;
}

.check-row small,
.toggle-card small {
  color: var(--muted);
}

.quick-search-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 190px auto;
  gap: 10px;
  align-items: end;
}

.document-select-search .quick-search-controls {
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.38fr) auto;
}

.document-select-search {
  gap: 8px;
  padding: 10px;
}

.document-select-search .panel-head {
  display: none;
}

.retrieval-results {
  display: grid;
  gap: 10px;
}

.retrieval-card {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.retrieval-card p {
  margin: 0;
  color: var(--muted);
}

.retrieval-card.document-hit.is-selected {
  border-color: #bfe9d4;
  background: #fbfffd;
}

.query-plan {
  margin-top: 12px;
}

.query-plan strong,
.query-plan span {
  display: block;
}

.query-plan span {
  color: var(--muted);
}

.matrix-plan-modal {
  width: min(860px, 100%);
}

.matrix-plan-head {
  align-items: center;
}

.matrix-plan-hero {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 16px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f8fbff 0%, #f2f7fc 100%);
  border: 1px solid #c9d9ec;
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.matrix-plan-hero strong {
  font-size: 18px;
  line-height: 1.25;
}

.matrix-plan-hero p {
  max-width: 720px;
  color: var(--ink-soft);
}

.matrix-plan-preview {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.matrix-plan-preview > strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.matrix-plan-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.matrix-plan-cards article {
  min-width: 0;
  display: grid;
  gap: 9px;
  padding: 13px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f9fcff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.matrix-plan-cards span,
.matrix-plan-cards small {
  display: block;
}

.matrix-plan-cards span {
  color: var(--ink);
  font-weight: 700;
}

.matrix-plan-cards small {
  color: var(--muted);
  line-height: 1.45;
}

.matrix-direction-editor {
  width: 100%;
  min-height: 104px;
  padding: 10px 11px;
  color: var(--ink-soft);
  background: #ffffff;
  border: 1px solid #cbd8ea;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
}

.matrix-direction-editor:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--focus);
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  padding-top: 14px;
  margin-top: 14px;
  background: linear-gradient(to top, var(--surface) 78%, rgba(255, 255, 255, 0));
}

.layer-grid,
.param-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* Parsed document and source */
.parsed-view {
  margin-top: 16px;
}

.parsed-modal {
  width: min(1180px, 100%);
}

.parsed-modal.parsed-view {
  margin-top: 0;
}

.parsed-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
}

.parser-summary {
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  margin-bottom: 12px;
}

.parser-summary div {
  padding: 11px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.parser-summary small,
.section-meta,
.chunk-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.parser-summary strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.2;
}

.section-card,
.chunk-card {
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.section-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.clause-list {
  display: grid;
  gap: 7px;
  padding: 0;
  margin: 10px 0 0;
  list-style: none;
}

.clause-list li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  background: var(--surface-muted);
  border-radius: var(--radius);
}

.chunk-card p {
  margin-top: 8px;
  color: var(--ink-soft);
}

.source-drawer {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 90;
  width: min(720px, calc(100vw - 28px));
  overflow: auto;
  padding: 18px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: -24px 0 90px rgba(17, 24, 39, 0.24);
  scrollbar-gutter: stable;
}

.source-drawer header,
.source-drawer .panel-head {
  position: sticky;
  top: -18px;
  z-index: 2;
  margin: -18px -18px 14px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.source-preview {
  display: grid;
  place-items: center;
  min-height: 220px;
  margin-bottom: 12px;
  padding: 14px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.source-meta > *,
.source-meta div {
  min-width: 0;
  padding: 9px 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.source-preview img {
  max-width: 100%;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(13, 20, 34, 0.08);
}

.source-page-frame {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  line-height: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 34px rgba(13, 20, 34, 0.1);
}

.source-page-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.source-highlight-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.source-highlight {
  position: absolute;
  z-index: 3;
  background: rgba(245, 158, 11, 0.34);
  border: 1px solid rgba(154, 91, 10, 0.62);
  border-radius: 3px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.32) inset,
    0 0 0 2px rgba(245, 158, 11, 0.08);
  mix-blend-mode: multiply;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.source-page-frame:hover .source-highlight {
  background: rgba(245, 158, 11, 0.46);
  border-color: rgba(154, 91, 10, 0.8);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.4) inset,
    0 0 0 3px rgba(245, 158, 11, 0.12);
}

.source-highlight.is-weak {
  background: rgba(31, 78, 140, 0.22);
  border-color: rgba(31, 78, 140, 0.5);
  box-shadow: 0 0 0 2px rgba(31, 78, 140, 0.08);
}

.source-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

blockquote {
  margin: 12px 0;
  padding: 13px 15px;
  color: var(--ink-soft);
  background: #f7fbff;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  line-height: 1.6;
}

.source-drawer blockquote {
  max-height: 300px;
  overflow: auto;
  font-size: 14px;
  scrollbar-width: thin;
}

@media (prefers-reduced-motion: no-preference) {
  .page-header,
  .section-intro,
  .panel,
  .metric-card,
  .workflow-card,
  .screen-step,
  .outcome-card,
  .table-shell,
  .table-wrap {
    animation: surface-in 0.22s ease both;
  }

  .modal-card,
  .source-drawer {
    animation: elevated-in 0.18s ease both;
  }
}

@keyframes surface-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes elevated-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Consultant and analysis */
.consultant-workbench {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(460px, 1.18fr);
  gap: 16px;
  align-items: start;
}

.consultant-context-panel,
.consultant-answer-card {
  overflow: hidden;
}

.consultant-context-panel .panel-head,
.consultant-answer-card .panel-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.consultant-question-kit {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 10px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f6f9fd 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.consultant-question-kit strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.consultant-composer {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 13px;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.consultant-composer .field {
  margin: 0;
}

.consultant-composer-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.consultant-composer-footer small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.consultant-answer-card {
  position: sticky;
  top: 16px;
}

.example-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.example-list span,
.question-example,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 54px;
  padding: 10px;
  color: var(--ink-soft);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
}

.question-example {
  position: relative;
  display: flex;
  font-family: inherit;
  text-align: left;
  line-height: 1.32;
  cursor: pointer;
}

.question-example::after {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: auto;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #c7d5e8;
  border-radius: 6px;
  content: "↗";
  font-size: 12px;
  font-weight: 700;
}

.question-example:hover {
  color: var(--primary);
  background: #ffffff;
  border-color: #b8c8dc;
  box-shadow: 0 10px 22px rgba(13, 20, 34, 0.07);
  transform: translateY(-1px);
}

.question-example:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.chat-input textarea {
  min-height: 150px;
  font-size: 16px;
}

.ai-workbench > .panel:first-child,
.expert-workbench > .panel:first-child {
  align-self: start;
}

.qa-answer {
  display: grid;
  gap: 13px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.consultant-empty-state {
  min-height: 360px;
  align-content: center;
  justify-items: start;
  text-align: left;
}

.consultant-empty-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  margin-top: 14px;
}

.consultant-empty-flow article {
  min-width: 0;
  padding: 11px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.consultant-empty-flow strong,
.consultant-empty-flow span {
  display: block;
}

.consultant-empty-flow strong {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.consultant-empty-flow span {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.35;
}

.ai-answer-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.answer-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 180px);
  gap: 14px;
  align-items: start;
}

.answer-confidence {
  display: grid;
  gap: 7px;
  justify-items: end;
  text-align: right;
}

.answer-confidence small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.answer-meta-grid,
.analysis-summary-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.answer-meta-grid article,
.analysis-summary-board article {
  min-width: 0;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.analysis-action-flow {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.analysis-action-flow article {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.analysis-action-flow article.active {
  border-color: #c7d5e8;
  box-shadow: 0 12px 24px rgba(31, 78, 140, 0.06);
}

.analysis-action-flow article.done {
  border-color: #cfe8dc;
  background:
    linear-gradient(180deg, #ffffff 0%, #f7fffc 100%);
}

.analysis-action-flow article.disabled {
  opacity: 0.72;
}

.analysis-action-flow article > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #ffffff;
  background:
    linear-gradient(180deg, #2b67a9 0%, var(--primary-strong) 100%);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
}

.analysis-action-flow strong,
.analysis-action-flow small {
  display: block;
  min-width: 0;
}

.analysis-action-flow strong {
  color: var(--ink);
  font-size: 15px;
}

.analysis-action-flow small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.answer-meta-grid span,
.answer-meta-grid strong,
.answer-meta-grid small,
.analysis-summary-board span,
.analysis-summary-board strong,
.analysis-summary-board small {
  display: block;
  min-width: 0;
}

.answer-meta-grid span,
.analysis-summary-board span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.answer-meta-grid strong,
.analysis-summary-board strong {
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
  font-weight: 700;
}

.answer-meta-grid small,
.analysis-summary-board small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.analysis-summary-board article.success {
  border-color: #cfe8dc;
  background: #fbfefd;
}

.analysis-summary-board article.warn {
  border-color: #f0d39b;
  background: #fffdf7;
}

.answer-evidence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.evidence-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.evidence-chip > span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--teal);
  background: var(--teal-soft);
  border: 1px solid #b8ded6;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.ai-answer-panel > section,
.ai-answer-panel > div:not(.source-card) {
  min-width: 0;
}

.ai-answer-panel > section {
  padding: 13px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ai-answer-panel h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.ai-answer-panel p {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
}

.answer-section {
  display: grid;
  gap: 10px;
}

.answer-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.58;
}

.answer-list li + li {
  margin-top: 6px;
}

.answer-list.muted {
  color: var(--ink-soft);
}

.ai-answer-panel .source-card {
  margin-top: 8px;
}

.answer-limits,
.answer-limitations,
.answer-sources {
  padding-top: 0;
  border-top: 0;
}

.qa-answer p {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.65;
}

.category-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.finding {
  padding: 14px 14px 14px 16px;
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
}

.finding.is-prohibit {
  border-color: #f2c6c0;
  border-left-color: var(--red);
  background: #fff8f7;
}

.finding.is-permit {
  border-color: #cfe8dc;
  border-left-color: var(--teal);
  background: #fbfefd;
}

.finding h3 {
  margin: 8px 0;
}

.finding-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.finding blockquote {
  max-height: 220px;
  overflow: auto;
  font-size: 14px;
}

.finding-actions {
  margin-top: 10px;
}

/* STO workflow */
.sto-project-home {
  display: grid;
  gap: 16px;
}

.sto-project-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(420px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.sto-create-panel,
.sto-project-list-panel,
.sto-stage-panel {
  overflow: hidden;
}

.sto-create-panel .panel-head,
.sto-project-list-panel .panel-head,
.sto-stage-panel > .panel-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.sto-project-search-field {
  margin: 12px 0;
}

.sto-project-list-panel .project-list {
  max-height: 560px;
  overflow-y: auto;
  padding-right: 5px;
  scrollbar-width: thin;
}

.sto-create-footer,
.sto-stage-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
  padding: 13px;
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sto-create-footer strong,
.sto-create-footer small,
.sto-stage-footer strong,
.sto-stage-footer small {
  display: block;
}

.sto-create-footer strong,
.sto-stage-footer strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.sto-create-footer small,
.sto-stage-footer small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.sto-workspace {
  display: grid;
  gap: 15px;
}

.sto-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: center;
  padding: 18px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-color: var(--line);
  box-shadow: var(--shadow-card);
}

.sto-project-title {
  min-width: 0;
}

.sto-hero h2 {
  color: var(--ink);
  font-size: 24px;
}

.sto-hero p {
  max-width: 880px;
  margin-top: 7px;
  color: var(--muted);
}

.sto-hero .eyebrow {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: #b8ded6;
}

.sto-hero .button {
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line-strong);
}

.sto-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sto-header-meta span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 5px 8px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.sto-project-status-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 11px;
  padding: 14px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f6f9fd 100%);
  border: 1px solid #cddaea;
  border-radius: var(--radius);
  box-shadow: 0 18px 42px rgba(13, 20, 34, 0.08);
}

.sto-status-card-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 10px 11px;
  background: var(--surface);
  border: 1px solid rgba(205, 218, 234, 0.9);
  border-radius: var(--radius-sm);
}

.sto-status-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sto-status-metrics article {
  min-width: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(205, 218, 234, 0.9);
  border-radius: var(--radius-sm);
}

.sto-project-status-card span,
.sto-project-status-card strong {
  display: block;
}

.sto-project-status-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sto-project-status-card strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
}

.sto-project-status-card .status-badge {
  width: max-content;
  max-width: 100%;
}

.stage-tabs {
  position: sticky;
  top: 88px;
  z-index: 6;
  padding: 6px;
  background: rgba(247, 249, 252, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 28px rgba(13, 20, 34, 0.06);
}

.stage-tab {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px 11px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 700;
}

.stage-tab b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.stage-tab span,
.stage-tab small {
  display: block;
  min-width: 0;
}

.stage-tab small {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
}

.stage-tab:hover,
.stage-tab:focus-visible,
.stage-tab.is-active,
.tree-item.is-active {
  color: var(--primary);
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border-color: #c7d5e8;
  outline: none;
  box-shadow: var(--shadow-soft);
}

.stage-tab.is-active b {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
}

.project-card,
.source-role-card {
  display: grid;
  gap: 12px;
  padding: 15px;
}

.project-card {
  grid-template-columns: minmax(0, 1fr);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.project-card-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.project-card-main strong {
  color: var(--ink);
  font-size: 17px;
}

.sto-project-row {
  gap: 10px;
  padding: 13px;
}

.sto-project-row .project-card-main {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  align-items: start;
}

.sto-project-row .project-card-main strong,
.sto-project-row .project-card-main small {
  grid-column: 1;
}

.sto-project-row .project-card-main .status-badge {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
}

.sto-project-row .metric-row div {
  min-width: 0;
  padding: 8px 9px;
}

.sto-project-row .button-row {
  justify-content: flex-start;
}

.project-card .metric-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.coverage-grid,
.suggestion-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.coverage,
.readiness-card,
.suggestion-card,
.mini-card {
  padding: 12px;
}

.coverage.covered {
  border-color: #bfe9d4;
  background: var(--green-soft);
}

.coverage.partial {
  border-color: #f0d39b;
  background: var(--amber-soft);
}

.coverage.missing_source {
  border-color: #f2c6c0;
  background: var(--red-soft);
}

.role-reason {
  padding: 10px;
  background: var(--surface-muted);
  border-radius: var(--radius);
}

.suggestion-card p {
  margin: 0 0 6px;
  color: var(--ink);
}

.readiness-card.danger,
.issue.blocking {
  border-color: #f2c6c0;
  background: var(--red-soft);
}

.sto-sections-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 14px;
}

.section-tree,
.section-side {
  align-self: start;
}

.document-workbench {
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.section-side {
  position: sticky;
  top: 150px;
}

.tree-item {
  width: 100%;
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding: 10px;
  text-align: left;
  color: var(--ink-soft);
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.tree-item:hover {
  border-color: #c7d5e8;
  background: #f8fbff;
}

.tree-item span {
  font-weight: 700;
}

.tree-item small {
  color: var(--muted);
}

.document-editor {
  width: 100%;
  min-height: 430px;
  padding: 18px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0%, #fffdf9 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.65;
}

.document-preview-surface {
  width: min(100%, 920px);
  margin: 14px auto 0;
  padding: 30px 36px;
  color: #111827;
  background:
    linear-gradient(180deg, #ffffff 0%, #fffdf9 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 28px 70px rgba(13, 20, 34, 0.12), 0 1px 0 rgba(255, 255, 255, 0.9);
}

.document-preview-surface header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.document-preview-surface h3 {
  margin-top: 5px;
  color: #111827;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 700;
}

.document-preview-body {
  min-height: 180px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.document-preview-surface .document-preview-body:empty::before {
  content: "Раздел пока не заполнен.";
}

.document-preview-body:empty::before {
  content: "Раздел пока не заполнен.";
  color: var(--muted);
  font-family: Inter, "Segoe UI Variable", "Segoe UI", Roboto, Arial, sans-serif;
}

.sto-export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.sto-export-grid article {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.sto-export-grid article.is-ready {
  border-color: #cfe8dc;
  background: #fbfefd;
}

.sto-export-grid article.is-locked {
  border-color: #f0d39b;
  background: #fffdf7;
}

.sto-export-grid span,
.sto-export-grid strong,
.sto-export-grid small {
  display: block;
}

.sto-export-grid span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sto-export-grid strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
}

.sto-export-grid small {
  color: var(--muted);
  line-height: 1.4;
}

.issue {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.issue.warning {
  border-color: #f0d39b;
  background: var(--amber-soft);
}

.issue.info {
  border-color: #bfd5f7;
  background: #eff6ff;
}

.issue-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.issue-tags span,
.issue-list span {
  display: inline-flex;
  padding: 5px 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(247, 249, 252, 0.98) 0%, rgba(238, 243, 248, 0.98) 100%);
  backdrop-filter: blur(14px);
}

.modal-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 20px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 28px 90px rgba(16, 24, 40, 0.3);
  scrollbar-gutter: stable;
}

.modal-card > .panel-head:first-child {
  position: sticky;
  top: -20px;
  z-index: 2;
  margin: -20px -20px 16px;
  padding: 18px 20px 14px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.modal-card h2 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.2;
}

.modal-card > p {
  color: var(--muted);
  line-height: 1.55;
}

.modal-card .button-row:last-child {
  justify-content: flex-end;
  padding-top: 14px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

/* Collection vitrine */
.vitrine-page {
  display: grid;
  gap: 18px;
}

.vitrine-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding: 24px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(31, 87, 148, 0.08), transparent 46%),
    linear-gradient(180deg, #fff, #f9fbfe);
}

.vitrine-hero h2 {
  max-width: 920px;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1.08;
}

.vitrine-hero p {
  max-width: 880px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.vitrine-hero-actions,
.modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.vitrine-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  gap: 16px;
  align-items: end;
  padding: 16px;
}

.vitrine-search {
  margin: 0;
}

.vitrine-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.vitrine-filter {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 11px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.vitrine-filter b {
  min-width: 22px;
  padding: 2px 6px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
}

.vitrine-filter.is-active {
  color: var(--primary-strong);
  background: var(--primary-soft);
  border-color: rgba(31, 87, 148, 0.32);
  box-shadow: var(--focus);
}

.vitrine-selection-summary {
  display: grid;
  min-width: 86px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.vitrine-selection-summary strong {
  font-size: 22px;
  line-height: 1;
}

.vitrine-selection-summary span {
  color: var(--muted);
  font-size: 12px;
}

.vitrine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 16px;
}

.vitrine-card {
  position: relative;
  min-height: 168px;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.vitrine-card:hover {
  transform: translateY(-2px);
  border-color: rgba(31, 87, 148, 0.36);
  box-shadow: 0 22px 56px rgba(13, 20, 34, 0.11);
}

.vitrine-card.is-selected {
  border-color: rgba(8, 118, 109, 0.48);
  box-shadow: 0 0 0 3px rgba(8, 118, 109, 0.08), var(--shadow-card);
}

.vitrine-card.is-active::after {
  display: none;
  content: none;
}

.vitrine-card.processing::before,
.vitrine-card.failed::before,
.vitrine-card.partial::before,
.vitrine-card.ready::before {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  display: block;
  width: 5px;
  content: "";
}

.vitrine-card.ready::before {
  background: var(--teal);
}

.vitrine-card.processing::before,
.vitrine-card.partial::before {
  background: var(--amber);
}

.vitrine-card.failed::before {
  background: var(--red);
}

.vitrine-card.ready {
  border-color: rgba(8, 118, 109, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 252, 250, 0.98));
}

.vitrine-card.processing,
.vitrine-card.partial {
  border-color: rgba(154, 91, 10, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 249, 237, 0.98));
}

.vitrine-card.failed {
  border-color: rgba(168, 50, 42, 0.36);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 247, 246, 0.98));
}

.vitrine-card-open {
  display: grid;
  width: 100%;
  min-height: 168px;
  align-content: center;
  padding: 22px;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
}

.vitrine-card-open h3 {
  margin-top: 10px;
  font-size: 23px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.vitrine-card-open p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.45;
}

.vitrine-card-status {
  width: fit-content;
  margin-top: 14px;
  min-height: 28px;
  padding: 6px 10px;
  font-size: 12px;
}

.vitrine-card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
}

.vitrine-card-meta span {
  padding: 5px 8px;
  color: var(--ink-soft);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.vitrine-progress {
  height: 7px;
  margin-top: 18px;
  overflow: hidden;
  background: #e8eef6;
  border-radius: 999px;
}

.vitrine-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--teal));
  border-radius: inherit;
}

.vitrine-card-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
}

.vitrine-card-footer small {
  color: var(--muted);
}

.vitrine-card-check {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: grid;
  place-items: center;
}

.vitrine-card-check input {
  position: absolute;
  opacity: 0;
}

.vitrine-card-check span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.vitrine-card-check span::after {
  width: 12px;
  height: 7px;
  content: "";
  border: solid #fff;
  border-width: 0 0 2px 2px;
  opacity: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}

.vitrine-card-check input:checked + span {
  background: var(--teal);
  border-color: var(--teal);
}

.vitrine-card-check input:checked + span::after {
  opacity: 1;
}

.vitrine-card-check input:disabled + span {
  opacity: 0.46;
}

.vitrine-create-card {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 168px;
  padding: 24px;
  text-align: center;
  border-style: dashed;
  background:
    linear-gradient(180deg, rgba(31, 87, 148, 0.04), rgba(8, 118, 109, 0.04));
}

.create-plus {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  border-radius: var(--radius);
  font-size: 30px;
  font-weight: 600;
  box-shadow: var(--shadow-command);
}

.collection-doc-modal,
.collection-import-modal,
.workset-modal {
  width: min(980px, 100%);
}

.collection-doc-list,
.workset-doc-list {
  display: grid;
  gap: 8px;
  max-height: min(52vh, 560px);
  overflow: auto;
  padding-right: 4px;
}

.collection-doc-row,
.workset-doc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.workset-doc-row {
  grid-template-columns: 24px minmax(0, 1fr);
  cursor: pointer;
}

.collection-doc-row strong,
.workset-doc-row strong {
  display: block;
  font-size: 15px;
}

.collection-doc-row small,
.workset-doc-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.collection-doc-row.is-inactive,
.workset-doc-row.is-inactive {
  background: var(--red-soft);
  border-color: rgba(168, 50, 42, 0.26);
}

.collection-append-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
  padding: 14px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.upload-control.compact {
  min-height: 40px;
  padding: 9px 12px;
}

.import-mode-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.import-mode {
  display: grid;
  gap: 4px;
  min-height: 78px;
  padding: 12px;
  text-align: left;
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.import-mode small {
  color: var(--muted);
}

.import-mode.is-active {
  border-color: rgba(31, 87, 148, 0.46);
  background: var(--primary-soft);
  box-shadow: var(--focus);
}

.upload-dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 170px;
  padding: 20px;
  text-align: center;
  color: var(--ink-soft);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(241, 244, 248, 0.82));
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.upload-dropzone input {
  max-width: 320px;
}

.unified-upload .button-row {
  justify-content: center;
  margin-top: 8px;
}

.unified-upload input,
.button input[type="file"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.modal-actions {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.status-badge.success {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: rgba(8, 118, 109, 0.25);
}

.status-badge.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(168, 50, 42, 0.24);
}

.status-badge.warn {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(154, 91, 10, 0.25);
}

.conflict-modal {
  width: min(880px, 100%);
}

.conflict-options {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.conflict-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.conflict-option p {
  margin: 6px 0 0;
  color: var(--ink-soft);
}

/* Auth */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 34px;
}

/* Compatibility */
.document-preview,
.block-preview {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 1180px) {
  .shell::before {
    display: none;
  }

  .main::before {
    inset: 0;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    display: grid;
    grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
    align-items: stretch;
    padding: 14px 16px;
  }

  .sidebar > .sidebar-section-label {
    display: none;
  }

  .brand {
    padding: 0;
    border-bottom: 0;
  }

  .nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-self: stretch;
  }

  .nav-item {
    min-height: 48px;
    padding: 7px 8px;
  }

  .workspace-card {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(210px, 1fr) auto minmax(260px, 0.8fr) minmax(150px, 0.55fr);
    gap: 8px 12px;
    align-items: center;
    margin-top: 0;
    padding: 10px 12px;
  }

  .workspace-card > .sidebar-section-label {
    grid-column: 1;
    margin: 0;
  }

  .workspace-card > strong {
    grid-column: 1;
    margin: 0;
  }

  .workspace-card > .status-badge {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .workspace-card > .workspace-stats {
    grid-column: 3;
    grid-row: 1 / span 2;
    margin: 0;
  }

  .workspace-card > small {
    display: none;
  }

  .workspace-card > .workspace-next {
    grid-column: 4;
    grid-row: 1 / span 2;
    margin: 0;
  }

  .topbar {
    position: relative;
    top: auto;
    grid-template-columns: 1fr;
    margin: 0 0 18px;
    padding: 0;
    background: transparent;
    border-bottom: 0;
    backdrop-filter: none;
  }

  .top-actions,
  .utility-bar,
  .page-actions {
    justify-content: flex-start;
  }

  .journey-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace-board,
  .executive-command-panel,
  .page-header,
  .section-intro,
  .active-collection-panel,
  .grid.two,
  .process-grid,
  .matrix-grid,
  .matrix-workbench-grid,
  .consultant-workbench,
  .ai-workbench,
  .expert-workbench,
  .sto-project-grid,
  .sto-hero,
  .sto-export-grid,
  .sto-sections-layout,
  .parsed-grid {
    grid-template-columns: 1fr;
  }

  .workflow-steps,
  .screen-steps,
  .outcome-strip,
  .matrix-empty-steps,
  .matrix-job-grid,
  .consultant-empty-flow,
  .verification-board,
  .sto-section-brief,
  .sto-create-footer,
  .sto-stage-footer,
  .answer-meta-grid,
  .analysis-summary-board,
  .executive-stats,
  .overview-grid,
  .parser-summary,
  .job-stats,
  .add-row-control,
  .sto-add-control {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stage-tabs {
    position: static;
  }

  .section-side {
    position: static;
  }

  .processing-doc-sidebar {
    position: static;
  }

  .processing-doc-list {
    max-height: 460px;
  }
}

@media (max-width: 760px) {
  .main,
  .sidebar {
    padding: 14px;
  }

  .sidebar {
    display: flex;
    gap: 12px;
  }

  .brand {
    padding: 0 2px 10px;
  }

  .sidebar-section {
    gap: 8px;
  }

  .sidebar-title {
    display: none;
  }

  .nav {
    display: flex;
    gap: 8px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    padding: 0 0 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .nav-item {
    min-width: 124px;
    min-height: 44px;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    scroll-snap-align: center;
  }

  .nav-index,
  .nav-icon {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .workspace-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
    padding: 12px;
  }

  .workspace-card > .sidebar-section-label,
  .workspace-card > strong {
    grid-column: 1 / -1;
  }

  .workspace-card > .status-badge {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }

  .workspace-card .workspace-stats {
    display: none;
  }

  .workspace-card small {
    display: none;
  }

  .matrix-plan-cards,
  .matrix-action-footer,
  .matrix-empty-steps,
  .matrix-job-grid,
  .consultant-empty-flow,
  .consultant-composer-footer,
  .sto-project-status-card,
  .sto-export-grid,
  .sto-create-footer,
  .sto-stage-footer,
  .example-list,
  .analysis-action-flow article {
    grid-template-columns: 1fr;
  }

  .consultant-answer-card {
    position: static;
  }

  .analysis-action-flow article > span {
    width: 32px;
    height: 32px;
  }

  .workspace-card .button {
    display: none;
  }

  .workspace-card .workspace-next {
    display: none;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .page-header h2,
  .command-center h2,
  .section-intro h2,
  .panel h2,
  .empty-state h2 {
    max-width: calc(100vw - 56px);
    font-size: 23px;
  }

  .panel,
  .page-header,
  .command-center,
  .section-intro,
  .empty-state,
  .active-collection-panel {
    padding: 14px;
  }

  .workflow-map,
  .workflow-map.compact,
  .workflow-steps,
  .screen-steps,
  .outcome-strip,
  .verification-board,
  .sto-section-brief,
  .answer-hero,
  .answer-meta-grid,
  .analysis-summary-board,
  .executive-command-panel,
  .executive-stats,
  .overview-grid,
  .layer-grid,
  .param-grid,
  .parser-summary,
  .source-meta,
  .coverage-grid,
  .metric-row,
  .quick-search-controls,
  .document-select-search .quick-search-controls,
  .add-row-control,
  .sto-add-control,
  .job-stats,
  .issue,
  .form-grid,
  .workspace-stats,
  .collection-item,
  .process-action-card,
  .action-toolbar {
    grid-template-columns: 1fr;
  }

  .journey-rail {
    display: flex;
    gap: 8px;
    max-width: 100%;
    overflow-x: auto;
    padding: 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .journey-step {
    flex: 0 0 154px;
    min-width: 154px;
    scroll-snap-align: center;
  }

  .verification-actions {
    grid-template-columns: 1fr;
  }

  .answer-confidence {
    justify-items: start;
    text-align: left;
  }

  .button,
  .upload-control {
    width: 100%;
  }

  .topbar-context,
  .scope-chip {
    width: 100%;
  }

  .top-actions,
  .utility-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .service-row {
    display: none;
  }

  .top-actions .status-badge,
  .top-actions .button,
  .utility-bar .status-badge,
  .utility-bar .button {
    width: 100%;
    justify-content: center;
  }

  .source-drawer {
    inset: 8px;
    width: auto;
  }

  .global-message {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .global-message .button,
  .global-message .icon-button {
    width: 100%;
    grid-column: 2;
  }

  .source-drawer header,
  .source-drawer .panel-head {
    top: -14px;
    margin: -14px -14px 12px;
    padding: 14px;
  }

  .table-shell.wide thead th:last-child,
  .table-wrap.wide thead th:last-child,
  .table-shell.wide tbody td:last-child,
  .table-wrap.wide tbody td:last-child {
    position: static;
    box-shadow: none;
  }

  .document-preview-surface {
    padding: 20px 18px;
  }

  .document-preview-surface header {
    display: grid;
  }

  .processing-doc-list {
    min-height: 260px;
    max-height: 420px;
  }
}

@media (max-width: 980px) {
  .vitrine-hero,
  .vitrine-toolbar {
    grid-template-columns: 1fr;
  }

  .vitrine-hero-actions,
  .modal-actions {
    justify-content: flex-start;
  }

  .import-mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .collection-append-box {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .vitrine-grid {
    grid-template-columns: 1fr;
  }

  .import-mode-grid {
    grid-template-columns: 1fr;
  }

  .collection-doc-row {
    grid-template-columns: 1fr;
  }
}
