/* Signal design system — Swiss Financial Precision (Альфа-Сигнал КИБ v2.0 / Swiss Core) */
:root {
  --ds-canvas: #f8f9ff;
  --ds-surface: #ffffff;
  --ds-surface-subtle: #eff4ff;
  --ds-ink: #0b1c30;
  --ds-secondary: #1e293b;
  --ds-muted: #565e74;
  --ds-line: #dce5f5;
  --ds-divider: #e5eeff;
  --ds-yellow: var(--ds-surface-subtle);
  --ds-lilac: var(--ds-surface-subtle);
  --ds-sky: var(--ds-info-bg);
  --ds-border-width: 1px;
  --ds-shadow-control: none;
  --ds-shadow-card: 0 1px 2px rgb(11 28 48 / 4%);
  --ds-control-border: #64748b;
  --ds-accent: #d62b20;
  --ds-accent-soft: #fef2f2;
  --ds-brand: #ef3124;
  --ds-positive: #047857;
  --ds-positive-bg: #ecfdf5;
  --ds-warning: #b45309;
  --ds-warning-bg: #fffbeb;
  --ds-info: #0051d5;
  --ds-info-bg: #eff4ff;
  --ds-error: #ba1a1a;
  --ds-error-bg: #fef2f2;
  --ds-radius-xs: 4px;
  --ds-radius-sm: 6px;
  --ds-radius-md: 8px;
  --ds-radius-lg: 12px;
  --ds-space-1: 4px;
  --ds-space-2: 8px;
  --ds-space-3: 12px;
  --ds-space-4: 16px;
  --ds-space-6: 24px;
  --ds-space-8: 32px;
  --ds-space-12: 48px;
  --ds-text-xs: 12px;
  --ds-text-sm: 13px;
  --ds-text-base: 14px;
  --ds-text-lg: 16px;
  --ds-text-xl: 20px;
  --ds-text-title: 34px;
  --ds-control-height: 40px;
  --ds-touch-target: 44px;
  --ds-sidebar-width: 232px;
  --ds-font-display: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ds-font-sans: "Hanken Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ds-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ds-focus: 0 0 0 3px #0051d5;
  --ds-shadow-popover: 0 10px 15px -3px rgb(11 28 48 / 8%), 0 4px 6px -4px rgb(11 28 48 / 3%);
  --ds-motion: 150ms ease-out;

  /* Compatibility aliases used by the existing application templates. */
  --font-sans: var(--ds-font-sans);
  --font-mono: var(--ds-font-mono);
  --font-display: var(--ds-font-display);
  --coreds-canvas: var(--ds-canvas);
  --coreds-main-bg: var(--ds-canvas);
  --coreds-surface: var(--ds-surface);
  --coreds-surface-secondary: var(--ds-surface-subtle);
  --coreds-modal-body-bg: var(--ds-canvas);
  --coreds-ink: var(--ds-ink);
  --coreds-ink-secondary: var(--ds-secondary);
  --coreds-muted: var(--ds-muted);
  --coreds-red: var(--ds-accent);
  --coreds-red-hover: #a92119;
  --coreds-green-bg: var(--ds-positive-bg);
  --coreds-green-ink: var(--ds-positive);
  --coreds-tag-neutral-bg: var(--ds-surface-subtle);
  --coreds-tag-neutral-ink: var(--ds-secondary);
  --coreds-tag-neutral-border: var(--ds-line);
  --coreds-bento-blue: var(--ds-info-bg);
  --coreds-bento-peach: var(--ds-warning-bg);
  --coreds-bento-peach-ink: var(--ds-ink);
  --coreds-radius-card: var(--ds-radius-md);
  --coreds-radius-modal: var(--ds-radius-lg);
  --coreds-radius-box: var(--ds-radius-md);
  --coreds-radius-control: var(--ds-radius-sm);
  --coreds-radius-input: var(--ds-radius-sm);
  --coreds-radius-tag: var(--ds-radius-xs);
  --coreds-shadow-card: var(--ds-shadow-card);
  --coreds-shadow-modal: var(--ds-shadow-popover);
  --ink: var(--ds-ink);
  --ink-secondary: var(--ds-secondary);
  --muted: var(--ds-muted);
  --line: var(--ds-line);
  --bg: var(--ds-canvas);
  --sheet-bg: var(--ds-canvas);
  --surface: var(--ds-surface);
  --surface-soft: var(--ds-surface-subtle);
  --surface-hover: #e5eeff;
  --sidebar-dark: var(--ds-surface);
  --hero-bg: var(--ds-surface);
  --hero-card: var(--ds-surface-subtle);
  --hero-card-hover: #e5eeff;
  --hero-btn-secondary: var(--ds-surface-subtle);
  --red: var(--ds-accent);
  --alfa: var(--ds-accent);
  --red-hover: #a92119;
  --red-tint: var(--ds-error-bg);
  --green: var(--ds-positive);
  --green-soft: var(--ds-positive-bg);
  --green-tint: var(--ds-positive-bg);
  --amber: var(--ds-warning);
  --amber-soft: var(--ds-warning-bg);
  --amber-tint: var(--ds-warning-bg);
  --blue: var(--ds-info);
  --promo-pink: var(--ds-error-bg);
  --promo-dark: var(--ds-ink);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: ease-in-out;
  --ease-drawer: cubic-bezier(.2, .75, .25, 1);
  --shadow-sm: var(--ds-shadow-control);
  --shadow-card: var(--ds-shadow-card);
  --shadow-hover: 0 4px 12px rgb(11 28 48 / 6%);
  --shadow-dropdown: var(--ds-shadow-popover);
  --shadow-modal: var(--ds-shadow-popover);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; }
body {
  min-width: 320px;
  margin: 0;
  background: var(--ds-canvas);
  color: var(--ds-ink);
  font: var(--ds-text-base)/1.55 var(--ds-font-sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
body, .mono, .kpi-val, table, .graph-table, .badge {
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { color: inherit; font: inherit; }
button, a, select { touch-action: manipulation; }
button { padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .62; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--ds-info); outline-offset: 2px; }
a { color: var(--ds-accent); }
img, svg, canvas { max-width: 100%; }
[hidden] { display: none; }
code, pre, .trace-code { font-family: var(--ds-font-mono); }
pre { max-width: 100%; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Shared select field; native markup is the progressive-enhancement fallback. */
.ds-select {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: var(--ds-touch-target);
  min-height: var(--ds-touch-target);
  padding: 0 42px 0 14px;
  border: var(--ds-border-width) solid var(--ds-control-border);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface) url("chevron-down.svg") no-repeat right 14px center / 16px 16px;
  color: var(--ds-ink);
  font: 400 var(--ds-text-base)/1.4 var(--ds-font-sans);
  letter-spacing: normal;
  text-transform: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--ds-motion), background-color var(--ds-motion);
}
.ds-select:hover:not(:disabled) { border-color: var(--ds-secondary); }
.ds-select:focus { border-color: var(--ds-info); }
.ds-select:disabled { background-color: var(--ds-surface-subtle); cursor: not-allowed; }
.ds-select[aria-invalid="true"] { border-color: var(--ds-error); }
select.ds-select option { color: var(--ds-ink); background: var(--ds-surface); }
.ds-select[hidden], select.ds-select-native { display: none; }
.ds-select-trigger { overflow: hidden; text-align: left; }
.ds-select-trigger[aria-expanded="true"] { border-color: var(--ds-info); background-image: url("chevron-up.svg"); }
.ds-select-popup, .ds-select-menu {
  position: fixed;
  inset: auto;
  z-index: 1000;
  margin: 0;
  padding: 6px;
  max-width: calc(100vw - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  color: var(--ds-ink);
  box-shadow: var(--ds-shadow-popover);
  font: 400 var(--ds-text-base)/1.4 var(--ds-font-sans);
  transition: none;
}
.ds-select-popup[hidden], .ds-select-menu[hidden] { display: none; }
.ds-select-option {
  position: relative;
  display: flex;
  min-height: var(--ds-touch-target);
  align-items: center;
  padding: 11px 36px 11px 12px;
  border-radius: var(--ds-radius-sm);
  overflow-wrap: anywhere;
  cursor: pointer;
}
.ds-select-option.is-active { background: var(--ds-surface-subtle); }
.ds-select-option[aria-selected="true"] { background: var(--ds-accent-soft); font-weight: 600; }
.ds-select-option[aria-selected="true"]::after { content: "✓"; position: absolute; top: 50%; right: 12px; transform: translateY(-50%); color: var(--ds-accent); font-weight: 700; }
.ds-select-option[aria-disabled="true"] { color: var(--ds-muted); cursor: not-allowed; opacity: .6; }
@media (forced-colors: active) {
  select.ds-select { appearance: auto; -webkit-appearance: auto; background-image: none; }
  .ds-select-trigger { border-color: ButtonText; }
  .ds-select-option.is-active { outline: 2px solid Highlight; outline-offset: -2px; }
}

/* Navigation and workspace frame */
aside.sidebar {
  position: fixed;
  z-index: 5;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--ds-sidebar-width);
  flex-direction: column;
  gap: 0;
  overflow: auto;
  padding: var(--ds-space-6) var(--ds-space-4) var(--ds-space-4);
  border-right: var(--ds-border-width) solid var(--ds-line);
  background: var(--ds-surface);
}
.brand { display: flex; width: 100%; align-items: center; justify-content: flex-start; gap: 10px; margin: 0 0 24px; text-align: left; font-size: 16px; font-weight: 650; letter-spacing: 0; }
.brand-logo, .logo-mark { display: inline-grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: var(--ds-radius-xs); background: var(--ds-brand); color: #fff; border: 0; box-shadow: none; }
.brand-logo svg, .logo-mark svg { display: block; width: 24px; height: 24px; }
.brand-copy, .brand-title { display: flex; min-width: 0; flex-direction: column; }
.brand-copy strong, .brand-title strong { color: var(--ds-ink); font-size: 16px; font-weight: 680; line-height: 1.2; }
.brand-copy small, .brand-title small { margin-top: 2px; font-family: var(--ds-font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.06em; color: var(--ds-accent); }
.brand-sub, .subbrand { margin: 3px 0 16px; padding-bottom: 14px; border-bottom: 1px solid var(--ds-divider); color: var(--ds-muted); font-family: var(--ds-font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.mark { display: inline-flex; height: 22px; align-items: end; gap: 3px; }
.mark i { width: 5px; transform: skew(-15deg); border-radius: 2px; background: var(--ds-brand); }
.mark i:nth-child(1) { height: 11px; }
.mark i:nth-child(2) { height: 22px; }
.mark i:nth-child(3) { height: 16px; }
.label, .side-label, .eyebrow, .workspace-eyebrow { display: block; color: var(--ds-muted); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.company, .roleselect {
  margin: 7px 0 14px;
}
.company-switch-btn {
  width: 100%;
  margin: -4px 0 14px;
  justify-content: flex-start;
  font-family: var(--ds-font-mono);
  font-size: 11px;
  border: 1px dashed var(--ds-control-border);
  background: var(--ds-surface-subtle);
}
.roleselect { margin-bottom: 20px; }
.nav-group { display: grid; gap: 4px; }
.nav {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 11px;
  border: var(--ds-border-width) solid transparent; border-radius: var(--ds-radius-sm); background: transparent;
  color: var(--ds-secondary); font-size: 13px; text-align: left; text-decoration: none;
  transition: background var(--ds-motion), color var(--ds-motion), border-color var(--ds-motion);
}
.nav:hover { background: var(--ds-surface-subtle); color: var(--ds-ink); }
.nav.active { border-color: var(--ds-line); background: var(--ds-surface-subtle); color: var(--ds-ink); font-weight: 650; box-shadow: inset 3px 0 0 var(--ds-brand); }
.nav.active .nav-icon { color: var(--ds-accent); }
.nav.alfa-entry { border-color: transparent; background: var(--ds-surface); color: var(--ds-ink); }
.nav.alfa-entry.active { border-color: transparent; background: var(--ds-surface-subtle); }
.nav-icon { display: inline-grid; width: 18px; height: 18px; flex: 0 0 18px; place-items: center; color: currentColor; text-align: center; }
.nav-icon svg { display: block; width: 18px; height: 18px; }
.badge { margin-left: auto; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--ds-line); background: var(--ds-surface); color: var(--ds-secondary); font-family: var(--ds-font-mono); font-size: 11px; font-weight: 600; }
.nav.alfa-entry .badge { background: var(--ds-accent); color: white; }
.profile { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--ds-divider); color: var(--ds-secondary); font-size: 12px; }
.profile > summary { cursor: pointer; color: var(--ds-ink); font-size: 13px; font-weight: 650; }
.profile > .label { margin-top: 11px; }
.profile-kv { display: grid; grid-template-columns: 1fr auto; gap: 5px 9px; margin: 10px 0; padding: 10px; border-radius: var(--ds-radius-sm); background: var(--ds-surface-subtle); font-size: 11px; }
.profile-kv span:nth-child(even) { color: var(--ds-ink); font-weight: 650; text-align: right; }
.profile-industry-row { margin: 8px 0; }
.profile-open-btn { width: 100%; margin-top: 6px; justify-content: space-between; border: 1px solid var(--ds-line); background: var(--ds-surface-subtle); }
.hygiene-pill { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 8px; padding: 4px 8px; border-radius: var(--ds-radius-xs); background: var(--ds-warning-bg); color: var(--ds-warning); font-size: 11px; font-weight: 600; }
.hygiene-pill.ok { background: var(--ds-positive-bg); color: var(--ds-positive); }
.sidebottom { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--ds-divider); color: var(--ds-muted); font-size: 11px; }
.budget-bar { height: 6px; margin: 7px 0; overflow: hidden; border-radius: 99px; background: var(--ds-surface-subtle); }
.budget-fill { height: 100%; background: var(--ds-positive); transition: width var(--ds-motion); }
.demo-dot, .product-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--ds-positive); }
.reset-demo-btn { display: inline-flex; min-height: 32px; align-items: center; margin-top: 8px; padding: 4px 8px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-xs); background: var(--ds-surface-subtle); color: var(--ds-secondary); font-size: 11px; text-decoration: none; }
main { width: min(100% - var(--ds-sidebar-width), 1680px); margin-left: var(--ds-sidebar-width); padding: var(--ds-space-6) clamp(var(--ds-space-6), 3vw, 40px) var(--ds-space-12); }
#main-content { min-height: 100vh; }
.topbar { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--ds-divider); color: var(--ds-muted); font-family: var(--ds-font-mono); font-size: 11px; letter-spacing: 0.02em; }
.topbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.user { display: inline-flex; align-items: center; gap: 7px; }
.avatar { display: inline-grid; width: 30px; height: 30px; place-items: center; border-radius: var(--ds-radius-xs); background: var(--ds-ink); color: #fff; font-family: var(--ds-font-mono); font-size: 10px; font-weight: 700; }
.llm-pill, .signal-pill, .pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-xs); background: var(--ds-surface); color: var(--ds-secondary); font-family: var(--ds-font-mono); font-size: 11px; }
#backendStatusPill.is-online { border-color: #b7d4bf; background: var(--ds-positive-bg); color: var(--ds-positive); }
.mode-notice { margin: 12px 0 18px; padding: 10px 12px; border: 1px solid var(--ds-line); border-left: 3px solid var(--ds-info); border-radius: var(--ds-radius-sm); background: var(--ds-surface); color: var(--ds-secondary); box-shadow: var(--ds-shadow-card); font-size: 12px; }

/* Type, actions, filters and evidence feed */
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4,
.hero-banner h1,
.view-title,
.section-head h2,
.modal-head h2,
.card-head h3,
.company-title {
  font-family: var(--ds-font-display);
}
h1, .hero-banner h1, .view-title {
  margin: 22px 0 7px;
  font-size: clamp(28px, 2.5vw, var(--ds-text-title));
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
h2, .section-head h2, .modal-head h2 { font-size: var(--ds-text-xl); font-weight: 650; letter-spacing: -.025em; line-height: 1.3; }
h3, .card-head h3 { font-size: var(--ds-text-lg); font-weight: 650; line-height: 1.35; }
.subtitle { margin-bottom: 20px; color: var(--ds-secondary); font-size: 14px; }
.heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.heading h1 { margin-bottom: 6px; }
.heading .subtitle { margin-bottom: 0; }
.heading-actions { display: flex; gap: 8px; margin-bottom: 0; flex-wrap: wrap; }
.btn, .primary-btn, .secondary-btn, .ghost-btn, .side-action-btn {
  display: inline-flex; min-height: var(--ds-control-height); align-items: center; justify-content: center; gap: 7px;
  padding: 8px 13px; border: 1px solid transparent; border-radius: var(--ds-radius-sm);
  background: var(--ds-surface-subtle); color: var(--ds-ink); font-size: var(--ds-text-sm); font-weight: 600; box-shadow: var(--ds-shadow-control);
  line-height: 1.25; text-decoration: none; transition: background var(--ds-motion), border-color var(--ds-motion), color var(--ds-motion), transform var(--ds-motion);
}
.btn:hover:not(:disabled), .secondary-btn:hover:not(:disabled), .ghost-btn:hover:not(:disabled) { background: var(--surface-hover); }
.btn:active:not(:disabled), .secondary-btn:active:not(:disabled), .ghost-btn:active:not(:disabled) { filter: brightness(.96); }
.btn.dark, .primary-btn { border-color: var(--ds-accent); background: var(--ds-accent); color: #fff; }
.btn.dark:hover:not(:disabled), .primary-btn:hover:not(:disabled), .btn.alfa:hover:not(:disabled) { border-color: #bd2118; background: #bd2118; }
.btn.alfa { border-color: var(--ds-accent); background: var(--ds-accent); color: white; }
.btn-full { width: 100%; }
.btn-lg { min-height: 44px; padding: 11px 16px; }
.btn-xs { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.skip-link { position: fixed; z-index: 20; top: 8px; left: 8px; transform: translateY(-150%); padding: 9px 12px; border-radius: var(--ds-radius-sm); background: var(--ds-ink); color: #fff; }
.skip-link:focus { transform: translateY(0); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; align-items: start; gap: 28px; }
.controls { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; padding: 14px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-md); background: var(--ds-surface); box-shadow: var(--ds-shadow-card); }
.search { position: relative; flex: 1 1 240px; min-width: 200px; }
.search input, .csv-search-input, .form-input, .form-textarea, .journal-reason, .qa-input-row input, .qa-input-row textarea {
  width: 100%; min-width: 0; min-height: var(--ds-control-height); padding: 9px 11px; border: var(--ds-border-width) solid var(--ds-control-border);
  border-radius: var(--ds-radius-sm); background: var(--ds-surface); color: var(--ds-ink); font-size: var(--ds-text-base);
}
.search input { min-height: var(--ds-touch-target); padding-left: 36px; padding-right: 36px; }
.search span { position: absolute; top: 50%; transform: translateY(-50%); left: 12px; color: var(--ds-muted); font-size: 18px; }
.controls > .period { flex: 0 1 180px; width: 180px; }
.filterrow { display: flex; width: 100%; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filter-field { display: flex; min-width: 0; flex: 1 1 180px; max-width: 280px; flex-direction: column; gap: 6px; }
.filterrow label, .filterlabel { color: var(--ds-secondary); font-size: 12px; }
.clearfilters { display: inline-flex; min-height: var(--ds-touch-target); align-items: center; justify-content: center; padding: 8px 14px; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-sm); background: var(--ds-surface); color: var(--ds-secondary); font-size: 14px; }
.feedhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: var(--ds-muted); font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.feedhead, main .label, main .eyebrow, .kpi-label { letter-spacing: 0; text-transform: none; }
.feedhead { font-size: 12px; }
.workspace-eyebrow { display: block; font-family: var(--ds-font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ds-accent); margin-bottom: 4px; }
main .label, main .eyebrow { font-size: 12px; font-weight: 620; }
.ds-select.sort { width: 205px; flex: 0 1 205px; background-color: var(--ds-surface-subtle); border-color: var(--ds-line); }
.card, .journal-card, .qa-card { margin-bottom: 12px; padding: 20px; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-md); background: var(--ds-surface); }
.card { position: relative; overflow: hidden; margin-bottom: 20px; padding: 20px 20px 18px 24px; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-md); background: var(--ds-surface); box-shadow: var(--ds-shadow-card); transition: border-color var(--ds-motion), background var(--ds-motion); }
.card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--ds-info); }
.card.card-priority-high::before, .card.featured::before { background: var(--ds-brand); }
.card.card-priority-medium::before { background: var(--ds-warning); }
.card.card-priority-low::before { background: var(--ds-positive); }
.card:hover { border-color: #cbd2da; }
.card.featured { border-color: var(--ds-line); }
.cardtop { font-family: var(--ds-font-sans); display: flex; align-items: center; gap: 7px; margin-bottom: 9px; color: var(--ds-muted); font-size: 12px; flex-wrap: wrap; }
.card-id { font-family: var(--ds-font-mono); font-size: 11px; font-weight: 600; color: var(--ds-muted); padding: 2px 6px; border: 1px solid var(--ds-divider); border-radius: var(--ds-radius-xs); background: var(--ds-surface-subtle); }
.tag, .chip, .qa-chip { display: inline-flex; min-height: 22px; align-items: center; gap: 4px; padding: 2px 7px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-xs); background: var(--ds-surface-subtle); color: var(--ds-secondary); font-size: 11px; font-weight: 620; line-height: 1.35; white-space: nowrap; }
.tag.green, .priority-low { border-color: #cce0d1; background: var(--ds-positive-bg); color: var(--ds-positive); }
.tag.gray { border-color: var(--ds-line); background: var(--ds-surface-subtle); color: var(--ds-secondary); }
.tag.alfa-badge { border-color: #efc6c0; background: var(--ds-error-bg); color: var(--ds-accent); }
.tag.ai-badge { border-color: #c8dce8; background: var(--ds-info-bg); color: var(--ds-info); }
.tag.graph-badge, .priority-medium { border-color: #ead6a7; background: var(--ds-warning-bg); color: var(--ds-warning); }
.priority-high { border-color: #efc0ba; background: var(--ds-error-bg); color: var(--ds-error); }
.tag.priority-high, .tag.priority-medium, .tag.priority-low { padding: 2px 7px; }
.priority-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 6px; }
.ib-mini-top .priority-row { margin: 0; }
.score-badge { font-family: var(--ds-font-mono); font-size: 11px; font-weight: 700; border-radius: var(--ds-radius-xs); background: var(--ds-ink); color: #fff; padding: 2px 8px; }
.star { display: inline-grid; width: 36px; min-width: 36px; height: 36px; min-height: 36px; place-items: center; margin-left: auto; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-sm); background: var(--ds-surface); color: var(--ds-muted); font-size: 20px; line-height: 1; }
.star:hover { border-color: var(--ds-control-border); background: var(--ds-surface-subtle); }
.star.saved { color: var(--ds-warning); }
.titlebtn { padding: 0; border: 0; background: transparent; color: inherit; font-size: inherit; font-weight: inherit; text-align: left; }
.card h2 { max-width: 760px; margin-bottom: 8px; font-size: 22px; }
.reason { margin: 6px 0 12px; color: var(--ds-secondary); font-size: 13px; }
.card-reason { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-analytical-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 12px; margin: 12px 0; }
.card-analytical-grid .new { margin: 0; padding: 13px 14px; border: 1px solid var(--ds-divider); border-radius: var(--ds-radius-sm); background: var(--ds-surface-subtle); }
.card-analytical-grid .new p { margin: 0; color: var(--ds-secondary); font-size: 14px; }
.card-analytical-grid .new b { color: var(--ds-ink); }
.card-analytical-grid .impact { margin: 0; padding: 13px 14px; border: 1px solid var(--ds-line); border-left: 3px solid var(--ds-info); border-radius: var(--ds-radius-sm); background: var(--ds-surface); color: var(--ds-ink); font-size: 13px; }
.card-analytical-grid .impact.alfa-box { border-color: transparent; background: var(--ds-accent-soft); color: var(--ds-secondary); }
.impact-tag { font-family: var(--ds-font-mono); font-size: 10px; text-transform: uppercase; color: var(--ds-info); }
.new { margin: 0 0 12px; color: var(--ds-secondary); font-size: 14px; }
.new b { color: var(--ds-ink); }
.dual-grid, .detailgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.impact { min-width: 0; margin-bottom: 12px; padding: 13px 14px; border: 1px solid transparent; border-radius: var(--ds-radius-sm); background: var(--ds-surface-subtle); color: var(--ds-ink); font-size: 13px; }
.impact.alfa-box { border-color: transparent; background: var(--ds-accent-soft); color: var(--ds-secondary); }
.impact .label { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--ds-secondary); font-size: 12px; font-weight: 650; letter-spacing: 0; text-transform: none; }
.impact-step { margin-top: var(--ds-space-3); padding-top: var(--ds-space-3); border-top: 1px solid var(--ds-divider); color: var(--ds-secondary); }
.product-inline { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; padding: 10px 12px; border: 1px dashed var(--ds-control-border); border-radius: var(--ds-radius-sm); background: var(--ds-surface-subtle); color: var(--ds-secondary); font-size: 12px; }
.cardfoot { font-family: var(--ds-font-sans); display: flex; align-items: center; gap: 8px; padding-top: 11px; border-top: 1px solid var(--ds-divider); color: var(--ds-muted); font-size: 12px; flex-wrap: wrap; }
.sourceicon { display: inline-grid; width: 22px; height: 22px; place-items: center; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-xs); background: var(--ds-surface-subtle); color: var(--ds-secondary); font-family: var(--ds-font-mono); font-size: 9px; font-weight: 700; }
.sourceicon.alfa { border-color: #efc6c0; background: var(--ds-error-bg); color: var(--ds-accent); }
.sourcecount { color: var(--ds-secondary); }
.fb-group { display: inline-flex; gap: 4px; margin-left: 4px; }
.fb-btn { min-height: 30px; padding: 4px 8px; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-xs); background: var(--ds-surface); color: var(--ds-secondary); font-size: 11px; }
.fb-btn.active { border-color: #b7d4bf; background: var(--ds-positive-bg); color: var(--ds-positive); }
.cardfoot .open { box-shadow: var(--ds-shadow-control); display: inline-flex; min-height: 40px; align-items: center; justify-content: center; margin-left: auto; padding: 8px 12px; border: var(--ds-border-width) solid var(--ds-ink); border-radius: var(--ds-radius-sm); background: var(--ds-ink); color: #fff; font-size: 13px; font-weight: 650; text-decoration: none; transition: background var(--ds-motion), border-color var(--ds-motion), color var(--ds-motion); }
.cardfoot .open:hover { background: var(--ds-accent); border-color: var(--ds-accent); color: #fff; }
.empty { padding: 44px 20px; border: 1px dashed var(--ds-control-border); border-radius: var(--ds-radius-md); background: var(--ds-surface); color: var(--ds-secondary); text-align: center; }
.footertext, .footer-note, .caption { margin-top: 16px; color: var(--ds-muted); font-size: 12px; }
.empty-title { margin: 0 0 6px; font-size: 16px; font-weight: 650; color: var(--ds-ink); }
.right-heading { margin-bottom: 12px; font-size: 15px; font-weight: 650; line-height: 1.35; }
.box-heading { margin-bottom: 10px; font-size: var(--ds-text-lg); font-weight: 650; line-height: 1.35; }

/* Dashboard, audit and compact analytical data */
.ib-entry-banner { position: relative; overflow: hidden; margin-bottom: 22px; padding: 20px 22px; border: var(--ds-border-width) solid var(--ds-line); border-left: 4px solid var(--ds-brand); border-radius: var(--ds-radius-md); background: var(--ds-surface); box-shadow: var(--ds-shadow-card); }
.ib-entry-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.ib-entry-top > * { min-width: 0; max-width: 100%; }
.ib-entry-banner h2, .ib-entry-banner p { overflow-wrap: anywhere; }
.ib-entry-banner .tag { white-space: normal; }
.ib-mini-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.ib-mini { box-shadow: var(--ds-shadow-control); display: block; width: 100%; min-width: 0; max-width: 100%; padding: 14px; border: var(--ds-border-width) solid var(--ds-line); border-left: 3px solid var(--ds-info); border-radius: var(--ds-radius-sm); background: var(--ds-surface-subtle); color: var(--ds-ink); cursor: pointer; text-align: left; transition: border-color var(--ds-motion), background var(--ds-motion); }
.ib-mini:hover { border-color: var(--ds-control-border); border-left-color: var(--ds-accent); background: var(--ds-surface); }
.ib-mini-top { display: flex; min-width: 0; align-items: center; justify-content: flex-start; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.ib-mini-top .score-badge { margin-left: auto; }
.ib-mini-title { margin: 0 0 5px; font-size: 15px; font-weight: 650; }
.ib-mini-news { display: block; margin-bottom: 8px; overflow-wrap: anywhere; }
.ib-mini-cta { display: inline-block; margin-top: 4px; color: var(--ds-accent); font-weight: 600; }
.ib-card-desc { color: var(--ds-secondary); font-size: var(--ds-text-xs); }
.ib-card-btn { margin-top: 10px; }
.ib-card-meta { margin: 6px 0 10px; color: var(--ds-secondary); font-size: var(--ds-text-xs); }
.ib-card-footnote { margin: 10px 0 0; color: var(--ds-secondary); font-size: var(--ds-text-xs); }
.ib-card { box-shadow: var(--ds-shadow-control); }
.ib-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ds-space-3); margin-bottom: 22px; }
.ib-grid > *, .ib-mini-cards > * { min-width: 0; max-width: 100%; }
.ib-card p, .ib-card h2, .ib-mini span { overflow-wrap: anywhere; }
.ib-card, .box { min-width: 0; padding: 17px; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-md); background: var(--ds-surface); }
.ib-card .big, .big { font-family: var(--ds-font-display); margin: 5px 0 4px; color: var(--ds-ink); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.big.metric-positive, .metric-positive { color: var(--ds-positive); }
.ib-product-tags { display: flex; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.ib-signal-card, .ib-signal-kpi, .kpi-strip, .kpi-card, .kpi-label { min-width: 0; }
.kpi-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; }
.kpi-card { position: relative; overflow: hidden; margin: 0; padding: 14px 16px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-md); background: var(--ds-surface); box-shadow: var(--ds-shadow-card); }
.kpi-label { display: block; font-family: var(--ds-font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ds-muted); margin-bottom: 6px; }
.kpi-val { font-family: var(--ds-font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--ds-ink); line-height: 1.2; }
.kpi-val small { font-family: var(--ds-font-mono); font-size: 11px; font-weight: 500; color: var(--ds-muted); }
.kpi-val-status { color: var(--ds-info); font-size: 17px; }
.kpi-sub { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--ds-divider); font-size: 11px; color: var(--ds-secondary); }
.rightbox { margin-bottom: 16px; padding: 16px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-md); background: var(--ds-surface); box-shadow: var(--ds-shadow-card); }
.rightbox h3 { margin-bottom: 12px; font-size: 15px; }
.rightbox-principles { color: var(--ds-secondary); font-size: 13px; }
.principles-copy { color: var(--ds-secondary); font-size: 13px; }
.calendaritem { display: flex; gap: 11px; margin-bottom: 14px; }
.date { width: 34px; flex: 0 0 auto; font-size: 20px; line-height: 1; text-align: center; }
.date small { display: block; margin-top: 5px; color: var(--ds-muted); font-size: 10px; }
.calendaritem .date { width: 42px; flex: 0 0 auto; padding: 6px 4px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-xs); background: var(--ds-surface-subtle); font-family: var(--ds-font-mono); font-size: 16px; font-weight: 700; color: var(--ds-ink); line-height: 1; text-align: center; }
.calendaritem p { margin-bottom: 0; color: var(--ds-secondary); font-size: 13px; }
.calendaritem .hint, .hint { margin-top: 3px; color: var(--ds-muted); font-size: 12px; }
.note { margin-bottom: 22px; padding: 18px; border: var(--ds-border-width) solid var(--ds-line); border-left: 3px solid var(--ds-brand); border-radius: var(--ds-radius-md); background: var(--ds-surface); color: var(--ds-ink); box-shadow: var(--ds-shadow-card); font-size: 13px; }
.note h3 { margin-bottom: 6px; }
.note p { margin-bottom: 9px; color: var(--ds-secondary); font-size: 12px; }
.note button { display: inline-flex; min-height: 40px; align-items: center; padding: 8px 10px; border-radius: var(--ds-radius-xs); color: var(--ds-accent); font-size: 13px; text-decoration: underline; }
.note button:hover { background: #ffe2de; }
.note-glyph { color: var(--ds-accent); font-size: 24px; font-weight: 600; }
.detailgrid { margin-bottom: 14px; }
.box { margin-bottom: 12px; overflow-x: auto; }
.box h3 { margin-bottom: 10px; }
.graph-table { width: 100%; border-collapse: collapse; color: var(--ds-secondary); font-size: 12px; text-align: left; }
.graph-table th, .graph-table td { padding: 9px 10px; border-bottom: 1px solid var(--ds-divider); vertical-align: top; }
.graph-table th { color: var(--ds-ink); font-size: 11px; font-weight: 680; }
.graph-table tr:last-child td { border-bottom: 0; }
.governance-list { margin: 0; padding-left: 20px; color: var(--ds-secondary); }
.governance-list li { margin: 7px 0; }
.box-disclaimer, .box-title-spaced { margin-top: 16px; }
.product-offer { border-color: #efc6c0; background: #fffdfc; }
.product-offer-title { margin-bottom: 8px; font-size: 17px; font-weight: 660; }
.product-offer-meta { margin-bottom: 8px; color: var(--ds-secondary); font-size: 12px; }
.product-footer-hint { color: var(--ds-muted); font-size: 11px; }

/* Detail dialog and evidence-rich timeline */
dialog { width: min(1040px, calc(100vw - 32px)); max-width: 1040px; max-height: min(92vh, 920px); padding: 0; overflow: hidden; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-lg); background: var(--ds-surface); color: var(--ds-ink); box-shadow: var(--ds-shadow-popover); }
dialog::backdrop { background: rgb(32 34 31 / 48%); }
dialog[open] { display: flex; flex-direction: column; }
#detailContent { display: flex; min-height: 0; max-height: min(92vh, 920px); flex-direction: column; }
.dialoghead { position: relative; flex: 0 0 auto; padding: 22px 26px 0; border-bottom: 1px solid var(--ds-divider); background: var(--ds-surface); }
.dialoghead h2 { margin: 8px 42px 9px 0; font-size: 24px; }
.dialoghead > .cardtop, .dialoghead > .label { margin-right: 48px; }
.box > .label { margin-bottom: 6px; }
.dialoghead-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dialog-reason { margin-bottom: 10px; color: var(--ds-secondary); }
.close { box-shadow: none; position: absolute; top: 16px; right: 16px; display: grid; width: 36px; height: 36px; place-items: center; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-sm); background: var(--ds-surface-subtle); color: var(--ds-ink); font-size: 24px; }
.close:hover { border-color: var(--ds-line); background: var(--ds-surface-subtle); }
.tabs { display: flex; gap: 6px; padding: 4px; margin-top: 13px; margin-bottom: 14px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); background: var(--ds-surface-subtle); overflow-x: auto; }
.tabs button, .tab { min-height: 40px; padding: 7px 12px; border: 1px solid transparent; border-radius: var(--ds-radius-xs); background: transparent; color: var(--ds-secondary); font-size: 13px; font-weight: 500; white-space: nowrap; transition: background var(--ds-motion), border-color var(--ds-motion), color var(--ds-motion); }
.tabs button.active, .tab.active { border-color: var(--ds-line); background: var(--ds-surface); color: var(--ds-ink); font-weight: 650; box-shadow: var(--ds-shadow-card); }
.dialogbody { min-height: 0; padding: 20px 26px 26px; overflow: auto; }
.dialogbody .kpi-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.dialogbody .kpi-val-status { font-size: 15px; line-height: 1.35; }
.modal-section { margin-bottom: 20px; }
.chain, .trace-list { display: grid; gap: 9px; margin: 12px 0; }
.chain, .timeline { position: relative; }
.timeline { display: grid; gap: 12px; }
.chain span { display: block; padding: 10px 12px; border: 1px solid var(--ds-line); border-left: 3px solid var(--ds-info); border-radius: var(--ds-radius-xs); background: var(--ds-surface-subtle); font-weight: 500; }
.chain em { display: block; font-family: var(--ds-font-mono); font-style: normal; font-size: 11px; color: var(--ds-muted); padding-left: 8px; }
.event, .trace-step, .trace-code, .slice, .q-card { min-width: 0; padding: 12px 14px; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-sm); background: var(--ds-surface); }
.event.planned { border-style: dashed; background: var(--ds-surface-subtle); }
.event-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; color: var(--ds-muted); font-family: var(--ds-font-mono); font-size: 11px; }
.event h3 { margin: 0 0 6px; font-size: 15px; }
.event p { margin: 0 0 8px; color: var(--ds-secondary); font-size: 13px; }
.event-source-btn { display: inline-flex; min-height: 32px; align-items: center; padding: 5px 10px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-xs); background: var(--ds-surface-subtle); color: var(--ds-ink); font-size: 12px; font-weight: 600; }
.event-source-btn:hover { border-color: var(--ds-control-border); background: var(--surface-hover); }
.trace-step { border-left: 3px solid var(--ds-info); }
.trace-code { overflow-wrap: anywhere; font-size: 12px; }
.trace-code.critic-code, .critic { border-color: #efc6c0; background: #fff8f6; }
.timeline-intro { margin-bottom: 18px; color: var(--ds-muted); font-size: 13px; }
.range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
input[type="range"].range { display: block; width: 100%; min-width: 0; min-height: 28px; accent-color: var(--ds-accent); cursor: pointer; }
.range-caption, .chart-subtitle, .chart-disclaimer, .actions-disclaimer { color: var(--ds-muted); font-size: 12px; }
.chart { min-height: 120px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; color: var(--ds-secondary); font-size: 12px; }
.slice-summary { margin: 10px 0; padding: 12px; border-radius: var(--ds-radius-sm); background: var(--ds-surface-subtle); color: var(--ds-secondary); font-size: 13px; }
.slice-bar { height: 8px; border-radius: 99px; background: var(--ds-info); }
.slice-chip { display: inline-flex; padding: 3px 7px; border-radius: var(--ds-radius-xs); background: var(--ds-info-bg); color: var(--ds-info); font-size: 11px; }
dialog details > summary, .assumptions-summary, .source-summary { display: flex; min-height: 32px; align-items: center; padding: 4px 0; cursor: pointer; }
.assumptions-summary { font-weight: 650; }
.assumptions-lead { margin-top: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.box.actions { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.box.actions h3 { margin-bottom: 4px; }
.box.actions label { display: flex; min-height: 38px; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--ds-divider); border-radius: var(--ds-radius-xs); background: var(--ds-surface-subtle); color: var(--ds-ink); font-size: 13px; cursor: pointer; }
.box.actions label:hover { border-color: var(--ds-line); }
.box.actions .actions-disclaimer { margin: 4px 0 0; }
input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; min-width: 24px; min-height: 24px; margin: 0; accent-color: var(--ds-accent); cursor: pointer; flex: 0 0 24px; }
.source { margin: 8px 0; padding: 12px; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-sm); background: var(--ds-surface); }
.source-title { margin-top: 6px; font-weight: 650; }
.source-summary { color: var(--ds-info); font-size: 12px; }
.sources-note { margin-bottom: 14px; padding: 12px; border: 1px solid #c8dce8; border-radius: var(--ds-radius-sm); background: var(--ds-info-bg); }
.sources-note-text { margin: 0; color: var(--ds-secondary); font-size: 12px; }
.qa-chips, .qa-chips-spaced { display: flex; gap: 6px; flex-wrap: wrap; }
.qa-chips-spaced { margin-bottom: 10px; }
.qa-chip { border-color: #c8dce8; background: var(--ds-info-bg); color: var(--ds-info); }
.qa-box, .qa-card { padding: 14px; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-md); background: var(--ds-surface); }
.qa-log { display: grid; gap: 10px; }
.qa-msg { padding: 12px; border-radius: var(--ds-radius-sm); background: var(--ds-surface-subtle); }
.qa-msg-meta { margin-bottom: 4px; color: var(--ds-muted); font-size: 11px; }
.qa-msg-q { margin-bottom: 6px; }
.qa-msg-a { color: var(--ds-secondary); }
.qa-input-row { display: flex; align-items: center; gap: 8px; }
.qa-input-row input, .qa-input-row textarea { flex: 1; }
.journal-option { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; padding: 10px; border: var(--ds-border-width) solid var(--ds-line); border-radius: var(--ds-radius-sm); background: var(--ds-surface); }
.journal-option input { flex: 0 0 auto; margin-top: 3px; accent-color: var(--ds-accent); }
.journal-option-title { display: block; margin: 12px 0 5px; font-size: 13px; font-weight: 650; }
.journal-option-meta { display: block; margin: 4px 0; color: var(--ds-secondary); font-size: 12px; }
.journal-summary-text { color: var(--ds-secondary); font-size: 13px; }
.journal-reason { min-height: 76px; margin: 6px 0 10px; resize: vertical; }
.journal-error { margin: 8px 0; padding: 9px 11px; border-radius: var(--ds-radius-sm); background: var(--ds-error-bg); color: var(--ds-error); font-size: 12px; }
.journal-submit-btn { margin-top: 6px; }
.journal-card { border-left: 3px solid var(--ds-info); }
.decision-journal { border-color: #c8dce8; }
.product-dot.ok { background: var(--ds-positive); }
.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; display: none; max-width: min(420px, calc(100vw - 32px)); padding: 12px 16px; transform: translateY(0); border-radius: var(--ds-radius-sm); background: var(--ds-ink); color: white; font-size: 13px; opacity: 1; pointer-events: none; transition: opacity var(--ds-motion), transform var(--ds-motion); }
.toast.show, .toast.visible { transform: translateY(0); opacity: 1; }

/* Remaining template utilities */
.chart-subtitle { margin-bottom: 10px; }
.actions-disclaimer { margin-top: 13px; }
.source-title { color: var(--ds-ink); }
.text-muted { color: var(--ds-muted); }
.product-dot { background: var(--ds-muted); }
.signal-pill { color: var(--ds-secondary); }
.state, .kind, .priority, .stat, .org { color: var(--ds-secondary); }
.alfa-highlight { color: var(--ds-accent); }
.q-num { display: inline-grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: var(--ds-info-bg); color: var(--ds-info); font-size: 11px; font-weight: 700; }
#liveForm > p:first-child { margin-bottom: 16px; color: var(--ds-secondary); font-size: 13px; }
#liveForm > .label { margin-top: 14px; margin-bottom: 6px; }
#liveForm > #liveSubmit, #liveForm > #liveRetry { margin-top: 18px; }
.csv-search-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.csv-search-bar .csv-search-input { flex: 1 1 320px; }
.csv-checkbox-label { display: inline-flex; min-height: 40px; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); background: var(--ds-surface-subtle); color: var(--ds-secondary); font-size: 12px; cursor: pointer; }
.csv-search-results { max-height: 420px; overflow: auto; }
.form-textarea { min-height: 90px; resize: vertical; }
.range-caption { margin: 14px 0 5px; }
.caption { margin-top: 12px; }
.footer-note { margin-top: 18px; }
.product-dot, .demo-dot { flex: 0 0 auto; }

/* Company Dependency Graph Workbench — Swiss Core v2.0 */
.graph-workbench { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; min-width: 0; max-width: 100%; }
.graph-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.graph-toolbar-titles { min-width: 0; }
.graph-toolbar-titles h3 { margin: 4px 0 0; font-size: 17px; line-height: 1.3; color: var(--ds-ink); }
.graph-toggle-group { display: inline-flex; background: var(--ds-surface-subtle); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); padding: 3px; gap: 3px; max-width: 100%; }
.graph-toggle-btn { background: transparent; border: 1px solid transparent; border-radius: var(--ds-radius-xs); padding: 6px 12px; font-size: var(--ds-text-sm); font-weight: 500; color: var(--ds-secondary); cursor: pointer; transition: background var(--ds-motion), color var(--ds-motion), border-color var(--ds-motion); min-height: 32px; white-space: nowrap; }
.graph-toggle-btn:hover { background: var(--ds-surface); color: var(--ds-ink); border-color: var(--ds-line); }
.graph-toggle-btn.active { background: var(--ds-surface); color: var(--ds-brand); border-color: var(--ds-line); font-weight: 600; box-shadow: var(--ds-shadow-card); }
.graph-telemetry-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; background: var(--ds-surface-subtle); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); font-size: var(--ds-text-xs); color: var(--ds-muted); }
.graph-telemetry-bar b { color: var(--ds-ink); font-weight: 600; }
.telemetry-sep { color: var(--ds-line); }
.graph-stage-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; min-width: 0; max-width: 100%; }
.graph-canvas-col { min-width: 0; max-width: 100%; display: flex; flex-direction: column; gap: 14px; }
.graph-bus { padding: 10px 12px; background: var(--ds-surface-subtle); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); min-width: 0; }
.graph-bus-head h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ds-muted); font-family: var(--ds-font-mono); font-weight: 600; }
.graph-bus-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.graph-bus-card { background: var(--ds-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-xs); padding: 8px 10px; min-width: 0; }
.graph-bus-card .label { display: block; font-size: 10px; color: var(--ds-muted); margin-bottom: 2px; }
.graph-bus-val { font-size: var(--ds-text-sm); font-weight: 600; color: var(--ds-ink); line-height: 1.3; overflow-wrap: anywhere; }
.graph-bus-sub { font-size: 11px; color: var(--ds-secondary); margin-top: 2px; line-height: 1.3; overflow-wrap: anywhere; }
.graph-swimlanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.graph-lane { background: var(--ds-canvas); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.graph-lane-head { border-bottom: 1px solid var(--ds-divider); padding-bottom: 6px; }
.graph-lane-head .label { display: block; font-size: 10px; color: var(--ds-muted); margin-bottom: 2px; }
.graph-lane-head h4 { margin: 0; font-size: 12px; font-weight: 700; color: var(--ds-ink); font-family: var(--ds-font-mono); }
.graph-lane-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.graph-node-card { display: block; width: 100%; box-sizing: border-box; text-align: left; background: var(--ds-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); padding: 10px 12px; cursor: pointer; transition: border-color var(--ds-motion), box-shadow var(--ds-motion), background var(--ds-motion); min-height: 72px; color: var(--ds-ink); }
.graph-node-card:hover { border-color: var(--ds-control-border); }
.graph-node-card.selected { border-color: var(--ds-brand); box-shadow: 0 0 0 2px var(--ds-brand); }
.graph-node-card.risk-critical { border-left: 3px solid var(--ds-brand); }
.graph-node-card.risk-elevated { border-left: 3px solid var(--ds-warning); }
.graph-node-card.risk-normal { border-left: 3px solid var(--ds-positive); }
.graph-node-card.core-card { border-left: 3px solid var(--ds-info); }
.node-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; gap: 4px; }
.node-id { font-family: var(--ds-font-mono); font-size: 11px; color: var(--ds-muted); font-weight: 600; }
.node-card-title { font-size: var(--ds-text-base); font-weight: 600; color: var(--ds-ink); margin-bottom: 2px; line-height: 1.3; }
.node-card-okved { font-size: 11px; color: var(--ds-secondary); margin-bottom: 6px; line-height: 1.25; }
.node-card-meta { display: flex; flex-direction: column; gap: 2px; font-size: var(--ds-text-xs); color: var(--ds-muted); }
.node-card-meta b { color: var(--ds-ink); }
.core-subcard { margin-top: 4px; }
.graph-sankey-svg { width: 100%; height: auto; max-width: 100%; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); background: var(--ds-canvas); display: block; }
.sankey-node { cursor: pointer; transition: opacity var(--ds-motion); }
.sankey-node:hover { opacity: 0.88; }
.sankey-quick-select { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; background: var(--ds-surface-subtle); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); }
.sankey-quick-select .btn.active { background: var(--ds-brand); color: #ffffff; border-color: var(--ds-brand); }
.graph-alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--ds-radius-sm); border: 1px solid var(--ds-line); min-width: 0; }
.alert-critical { background: var(--ds-error-bg); border-color: #efc6c0; color: var(--ds-error); }
.alert-critical strong { color: var(--ds-ink); display: block; margin-bottom: 2px; }
.alert-critical p { color: var(--ds-secondary); margin: 0; font-size: var(--ds-text-sm); line-height: 1.35; }
.alert-balanced { background: var(--ds-positive-bg); border-color: #cce0d1; color: var(--ds-positive); }
.alert-balanced strong { color: var(--ds-ink); display: block; margin-bottom: 2px; }
.alert-balanced p { color: var(--ds-secondary); margin: 0; font-size: var(--ds-text-sm); line-height: 1.35; }
.graph-alert-icon { font-size: 16px; font-weight: 700; line-height: 1.2; }
.graph-matrix-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.graph-matrix-panel { background: var(--ds-canvas); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.matrix-panel-head .label { display: block; font-size: 10px; color: var(--ds-muted); margin-bottom: 2px; }
.matrix-panel-head h4 { margin: 0; font-size: 13px; font-weight: 700; color: var(--ds-ink); }
.matrix-panel-list { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.matrix-card { display: block; width: 100%; box-sizing: border-box; text-align: left; background: var(--ds-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); padding: 10px 12px; cursor: pointer; transition: border-color var(--ds-motion), box-shadow var(--ds-motion); min-height: 64px; color: var(--ds-ink); }
.matrix-card:hover { border-color: var(--ds-control-border); }
.matrix-card.selected { border-color: var(--ds-brand); box-shadow: 0 0 0 2px var(--ds-brand); }
.matrix-card.risk-critical { border-left: 3px solid var(--ds-brand); }
.matrix-card.risk-elevated { border-left: 3px solid var(--ds-warning); }
.matrix-card.risk-normal { border-left: 3px solid var(--ds-positive); }
.matrix-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.matrix-title { font-size: var(--ds-text-sm); color: var(--ds-ink); }
.matrix-title small { color: var(--ds-muted); font-family: var(--ds-font-mono); }
.matrix-card-geo { font-size: 11px; color: var(--ds-secondary); margin-bottom: 6px; }
.matrix-card-sub { font-size: 11px; color: var(--ds-muted); margin-top: 6px; line-height: 1.35; }
.matrix-card-sub b { color: var(--ds-ink); }
.matrix-offer { color: var(--ds-secondary); font-size: 11px; }
progress.ds-progress { display: block; width: 100%; height: 8px; border-radius: 99px; overflow: hidden; appearance: none; -webkit-appearance: none; border: none; background: var(--ds-surface-subtle); }
progress.ds-progress::-webkit-progress-bar { background: var(--ds-surface-subtle); border-radius: 99px; }
progress.ds-progress::-webkit-progress-value { border-radius: 99px; background: var(--ds-info); }
progress.ds-progress::-moz-progress-bar { border-radius: 99px; background: var(--ds-info); }
progress.ds-progress.ds-progress-critical::-webkit-progress-value { background: var(--ds-brand); }
progress.ds-progress.ds-progress-critical::-moz-progress-bar { background: var(--ds-brand); }
progress.ds-progress.ds-progress-elevated::-webkit-progress-value { background: var(--ds-warning); }
progress.ds-progress.ds-progress-elevated::-moz-progress-bar { background: var(--ds-warning); }
progress.ds-progress.ds-progress-normal::-webkit-progress-value { background: var(--ds-positive); }
progress.ds-progress.ds-progress-normal::-moz-progress-bar { background: var(--ds-positive); }
.graph-table-wrap { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 100%; overflow-x: auto; box-sizing: border-box; }
.graph-table-filter-bar { display: flex; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.graph-table-filter-bar .btn.active { background: var(--ds-brand); color: #ffffff; border-color: var(--ds-brand); }
.graph-table tr.selected-row { background: var(--ds-surface-subtle); }
.graph-inspector { background: var(--ds-canvas); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-sm); padding: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; box-sizing: border-box; }
.inspector-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--ds-divider); padding-bottom: 6px; }
.inspector-id { font-family: var(--ds-font-mono); font-size: 11px; font-weight: 700; color: var(--ds-secondary); }
.inspector-badge-row { margin-top: -4px; }
.inspector-title { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.3; color: var(--ds-ink); }
.inspector-sub { font-size: 11px; color: var(--ds-secondary); margin-top: -8px; }
.inspector-kv-list { display: flex; flex-direction: column; gap: 4px; background: var(--ds-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-xs); padding: 8px 10px; }
.inspector-kv-row { display: flex; justify-content: space-between; font-size: var(--ds-text-xs); line-height: 1.4; gap: 6px; }
.inspector-k { color: var(--ds-muted); }
.inspector-v { color: var(--ds-ink); text-align: right; }
.inspector-evidence { background: var(--ds-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-xs); padding: 8px 10px; font-size: 11px; }
.inspector-evidence p { margin: 2px 0 0; color: var(--ds-secondary); line-height: 1.35; }
.inspector-stories { display: flex; flex-direction: column; gap: 6px; }
.inspector-story-btn { width: 100%; text-align: left; font-size: 11px; min-height: 32px; padding: 6px 10px; white-space: normal; line-height: 1.3; }
.inspector-offer { background: var(--ds-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-xs); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.inspector-offer-text { margin: 0; font-size: var(--ds-text-xs); font-weight: 600; color: var(--ds-ink); line-height: 1.35; }
.tag.red { border-color: #efc6c0; background: var(--ds-error-bg); color: var(--ds-error); }
.tag.amber { border-color: #ead6a7; background: var(--ds-warning-bg); color: var(--ds-warning); }
.tag.blue { border-color: #c8dce8; background: var(--ds-info-bg); color: var(--ds-info); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .right { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .rightbox { margin: 0; }
  .ib-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-strip, .dialogbody .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .graph-stage-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  aside.sidebar { position: static; display: grid; width: 100%; max-height: none; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 6px 8px; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--ds-divider); }
  .brand { grid-column: 1 / -1; margin-bottom: 8px; font-size: 18px; }
  .brand-sub, .subbrand { display: none; }
  #ibnav { grid-column: 1 / -1; }
  .sidebar > .label, .sidebar > .company, .sidebar > .roleselect { max-width: 100%; grid-column: 1 / -1; margin-top: 0; margin-bottom: 0; }
  #changeCompanyBtn, #auditnav, a.nav[href="/graph"], a.nav[href="assets/design-system.html"] { display: none; }
  #allnav, #savednav { width: 100%; min-width: 0; min-height: 48px; white-space: normal; align-self: stretch; }
  .profile { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 0; padding-top: 8px; }
  .profile > :not(.profile-open-btn) { display: none; }
  .profile-open-btn { width: 100%; margin-top: 0; }
  .sidebottom { display: none; }
  main { width: 100%; margin-left: 0; padding: 18px 16px 36px; }
  .topbar { align-items: flex-start; }
  .topbar-right { justify-content: flex-start; }
  .topbar-right > span:last-child { display: none; }
  .heading { align-items: flex-start; }
  .heading-actions { width: 100%; margin-bottom: 14px; }
  .heading-actions .btn { flex: 1 1 auto; }
  .layout, .dual-grid, .detailgrid, .ib-grid, .ib-mini-cards, .right, .card-analytical-grid { grid-template-columns: minmax(0, 1fr); }
  .graph-swimlanes, .graph-bus-grid, .graph-matrix-grid { grid-template-columns: minmax(0, 1fr); }
  .graph-toggle-group { flex-wrap: wrap; width: 100%; }
  .graph-toggle-btn { flex: 1 1 calc(50% - 6px); }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 16px; }
  .card h2 { font-size: 18px; }
  .cardfoot .open { margin-left: 0; }
  .fb-group { margin-left: 0; }
  .controls { padding: 0; border: 0; background: transparent; box-shadow: none; align-items: stretch; }
  .search { flex-basis: 100%; min-width: 0; }
  .controls > .period { flex: 1 1 100%; width: 100%; }
  .filterrow > * { max-width: 100%; }
  .filterrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  .filter-field { max-width: none; }
  .filterrow > .clearfilters { grid-column: 1 / -1; }
  .ds-select { font-size: 16px; }
  .ds-select-popup, .ds-select-menu { font-size: 16px; }
  dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: var(--ds-radius-md); }
  #detailContent { max-height: calc(100dvh - 22px); }
  .dialoghead { padding: 16px 16px 0; }
  .dialoghead h2 { margin-right: 35px; font-size: 20px; }
  .dialoghead > .cardtop, .dialoghead > .label { margin-right: 44px; }
  .tabs { gap: 6px; padding: 4px; flex-wrap: wrap; overflow-x: visible; }
  .dialogbody { padding: 16px; }
  .box { padding: 14px; }
  .qa-input-row { align-items: stretch; flex-wrap: wrap; }
  .qa-input-row input, .qa-input-row .btn { flex: 1 1 100%; }
  .graph-table { min-width: 580px; }
  .toast { right: 12px; bottom: 12px; left: 12px; width: auto; max-width: none; text-align: center; }
  .btn, .primary-btn, .secondary-btn, .ghost-btn, .side-action-btn, .clearfilters,
  .cardfoot .open, .note button { min-height: var(--ds-touch-target); }
  input, select, textarea { min-height: 44px; font-size: 16px; }
}
@media (max-width: 560px) {
  .filterrow { grid-template-columns: minmax(0, 1fr); }
  .graph-toggle-btn { flex: 1 1 100%; }
}
@media (max-width: 380px) {
  main { padding-right: 12px; padding-left: 12px; }
  .sidebar { padding-right: 12px; padding-left: 12px; }
  .topbar { flex-direction: column; }
  .topbar-right { gap: 6px; }
  .heading-actions { display: grid; grid-template-columns: 1fr; }
  .heading-actions .btn { width: 100%; }
  .kpi-strip { grid-template-columns: 1fr; }
  .feedhead { align-items: flex-start; flex-direction: column; }
  .ds-select.sort { width: 100%; flex: none; }
  .cardfoot { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto; transition-duration: .01ms; animation-duration: .01ms; animation-iteration-count: 1; }
}

/* API text and immutable IDs can contain long tokens; retain the shared layout. */
.api-content { min-width: 0; overflow-wrap: anywhere; }
.api-content .journal-option > span { min-width: 0; }
.api-content [hidden] { display: none; }

/* ==========================================================================
   MILESTONE M4: UNIFIED SEARCH ENGINE FLYOUT & MODAL (SWISS CORE TOKENS)
   ========================================================================== */
.search-container {
  position: relative;
  flex: 1 1 240px;
  min-width: 0;
}
.search-submit-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface-subtle);
  color: var(--ds-secondary);
  font-size: var(--ds-text-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--ds-border-width) solid var(--ds-line);
  transition: all var(--ds-motion);
}
.search-submit-btn:hover {
  background: var(--ds-divider);
  color: var(--ds-ink);
}
.search-flyout {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  width: 100%;
  max-width: 560px;
  background: var(--ds-surface);
  border: var(--ds-border-width) solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  box-shadow: var(--ds-shadow-popover);
  z-index: 1000;
  max-height: 520px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.search-flyout.is-hidden {
  display: none;
}
.search-flyout-header {
  padding: 12px 16px 8px;
  border-bottom: var(--ds-border-width) solid var(--ds-line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--ds-canvas);
  border-radius: var(--ds-radius-md) var(--ds-radius-md) 0 0;
}
.search-flyout-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.search-flyout-title {
  font-size: var(--ds-text-sm);
  font-weight: 600;
  color: var(--ds-ink);
}
.search-flyout-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--ds-muted);
  background: var(--ds-surface-subtle);
  padding: 2px 7px;
  border-radius: var(--ds-radius-sm);
}
.search-flyout-close {
  font-size: 18px;
  color: var(--ds-muted);
  padding: 0 4px;
  line-height: 1;
}
.search-flyout-close:hover {
  color: var(--ds-ink);
}
.search-flyout-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}
.search-flyout-tab {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--ds-radius-sm);
  background: var(--ds-surface-subtle);
  color: var(--ds-muted);
  border: var(--ds-border-width) solid transparent;
  white-space: nowrap;
}
.search-flyout-tab:hover {
  background: var(--ds-divider);
  color: var(--ds-ink);
}
.search-flyout-tab.active {
  background: var(--ds-surface);
  color: var(--ds-accent);
  border-color: var(--ds-line);
  box-shadow: var(--ds-shadow-card);
}
.search-flyout-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.search-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ds-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.search-group-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.search-item {
  padding: 10px 12px;
  border-radius: var(--ds-radius-md);
  border: var(--ds-border-width) solid var(--ds-line);
  background: var(--ds-surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all var(--ds-motion);
  text-decoration: none;
  color: inherit;
}
.search-item:hover {
  border-color: var(--ds-control-border);
  background: var(--ds-canvas);
  box-shadow: var(--ds-shadow-card);
}
.search-item-clickable {
  cursor: pointer;
}
.search-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.search-item-title {
  font-size: var(--ds-text-sm);
  font-weight: 600;
  color: var(--ds-ink);
}
.search-item-meta {
  font-size: 11px;
  color: var(--ds-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.search-item-quote {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ds-secondary);
  background: var(--ds-surface-subtle);
  border-left: 2px solid var(--ds-accent);
  padding: 6px 10px;
  border-radius: 0 var(--ds-radius-sm) var(--ds-radius-sm) 0;
  margin-top: 4px;
}
.search-flyout-status {
  padding: 24px 16px;
  text-align: center;
  color: var(--ds-muted);
  font-size: var(--ds-text-sm);
}
.search-flyout-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--ds-muted);
  font-size: var(--ds-text-sm);
}

label[for="role"], .roleselect {
  display: none;
}

/* Live Ingest Presets (Criterion 05 Accelerator) */
.live-presets-block {
  margin-bottom: var(--ds-space-4);
  padding: var(--ds-space-3);
  background: var(--ds-surface-subtle);
  border: var(--ds-border-width) solid var(--ds-line);
  border-radius: var(--ds-radius-md);
}
.live-presets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--ds-space-2);
}
.live-presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--ds-space-2);
}
@media (max-width: 640px) {
  .live-presets-grid {
    grid-template-columns: 1fr;
  }
}
.live-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--ds-space-1);
  padding: var(--ds-space-2) var(--ds-space-3);
  background: var(--ds-surface);
  border: var(--ds-border-width) solid var(--ds-line);
  border-radius: var(--ds-radius-sm);
  text-align: left;
  transition: all var(--ds-motion);
}
.live-preset-btn:hover {
  border-color: var(--ds-info);
  background: var(--ds-info-bg);
}
.preset-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  font-size: var(--ds-text-xs);
  font-weight: 700;
  border-radius: var(--ds-radius-xs);
  line-height: 1.3;
}
.preset-badge.tier1 {
  background: var(--ds-positive-bg);
  color: var(--ds-positive);
  border: var(--ds-border-width) solid var(--ds-positive);
}
.preset-badge.inside {
  background: var(--ds-warning-bg);
  color: var(--ds-warning);
  border: var(--ds-border-width) solid var(--ds-warning);
}
.preset-badge.refuted {
  background: var(--ds-error-bg);
  color: var(--ds-error);
  border: var(--ds-border-width) solid var(--ds-error);
}
.preset-badge.asym {
  background: var(--ds-info-bg);
  color: var(--ds-info);
  border: var(--ds-border-width) solid var(--ds-info);
}
.preset-title {
  font-size: var(--ds-text-xs);
  color: var(--ds-ink);
  line-height: 1.35;
  font-weight: 500;
}
.preset-applied {
  outline: 2px solid var(--ds-info);
  outline-offset: 2px;
}

/* Role-Specific Q&A Chips (Criterion 10) */
.qa-role-chips-label {
  font-size: var(--ds-text-xs);
  font-weight: 700;
  color: var(--ds-secondary);
  margin-bottom: var(--ds-space-1);
  letter-spacing: 0.2px;
}
.qa-chips-role {
  margin-bottom: var(--ds-space-2);
}
.qa-chip.role-tailored {
  background: var(--ds-positive-bg);
  color: var(--ds-positive);
  border-color: var(--ds-positive);
  font-weight: 600;
  cursor: pointer;
}
.qa-chip.role-tailored:hover {
  background: var(--ds-surface);
}

/* REA & Veracity Strip (RumourEval + СКАН/Медиалогия) */
.card-science-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ds-space-2);
  margin: var(--ds-space-2) 0;
  padding: 4px var(--ds-space-2);
  background: var(--ds-surface-subtle);
  border: var(--ds-border-width) solid var(--ds-line);
  border-radius: var(--ds-radius-sm);
  font-size: var(--ds-text-xs);
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}
.dialog-science-strip {
  margin: var(--ds-space-3) 0 var(--ds-space-2);
}
.badge-veracity-tier1 {
  background: var(--ds-positive-bg);
  color: var(--ds-positive);
  border: var(--ds-border-width) solid var(--ds-positive);
  font-weight: 700;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--ds-radius-xs);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.badge-veracity-rumor {
  background: var(--ds-warning-bg);
  color: var(--ds-warning);
  border: var(--ds-border-width) solid var(--ds-warning);
  font-weight: 700;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--ds-radius-xs);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.badge-veracity-refuted {
  background: var(--ds-error-bg);
  color: var(--ds-error);
  border: var(--ds-border-width) solid var(--ds-error);
  font-weight: 700;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--ds-radius-xs);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.syndication-meta {
  color: var(--ds-muted);
  font-size: var(--ds-text-xs);
  line-height: 1.35;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.citation-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: auto;
}
.cite-pill {
  font-family: var(--ds-font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ds-info);
  background: var(--ds-info-bg);
  border: var(--ds-border-width) solid var(--ds-line);
  padding: 0 4px;
  border-radius: var(--ds-radius-xs);
}

/* Dual Temporal Horizon Badge (Signal AI + Prewave) */
.card-horizon-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ds-space-2);
  margin-bottom: var(--ds-space-2);
  max-width: 100%;
  min-width: 0;
}
.dialog-horizon-strip {
  margin-bottom: var(--ds-space-3);
}
.horizon-badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 2px 8px;
  border-radius: var(--ds-radius-xs);
  font-size: var(--ds-text-xs);
  line-height: 1.4;
  border: var(--ds-border-width) solid var(--ds-line);
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}
.horizon-badge.reaction {
  background: var(--ds-warning-bg);
  color: var(--ds-warning);
}
.horizon-badge.pnl {
  background: var(--ds-info-bg);
  color: var(--ds-info);
}

/* Adversarial Debate & Uncertainty Block (TradingAgents + CRO Gate) */
.adversarial-debate-box {
  margin-top: var(--ds-space-4);
  border-left: 3px solid var(--ds-info);
}
.debate-header {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-1);
  margin-bottom: var(--ds-space-3);
}
.debate-header h3 {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-2);
  flex-wrap: wrap;
}
.debate-meta {
  font-size: var(--ds-text-xs);
  color: var(--ds-muted);
}
.adversarial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--ds-space-3);
}
@media (max-width: 760px) {
  .adversarial-grid {
    grid-template-columns: 1fr;
  }
}
.debate-card {
  padding: var(--ds-space-3);
  border-radius: var(--ds-radius-sm);
  border: var(--ds-border-width) solid var(--ds-line);
  background: var(--ds-surface);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
  min-width: 0;
  overflow-wrap: anywhere;
}
.debate-card.bull {
  background: var(--ds-positive-bg);
  border-color: var(--ds-line);
}
.debate-card.bear {
  background: var(--ds-warning-bg);
  border-color: var(--ds-line);
}
.debate-card.cro {
  background: var(--ds-surface-subtle);
  border-color: var(--ds-line);
}
.debate-card-head {
  display: flex;
  align-items: center;
  gap: var(--ds-space-1);
  font-size: var(--ds-text-xs);
  color: var(--ds-ink);
}
.debate-card.bull .debate-card-head { color: var(--ds-positive); }
.debate-card.bear .debate-card-head { color: var(--ds-warning); }
.debate-card.cro .debate-card-head { color: var(--ds-info); }
.debate-icon {
  font-weight: 700;
  font-size: 13px;
}
.debate-card-body {
  margin: 0;
  font-size: var(--ds-text-xs);
  line-height: 1.45;
  color: var(--ds-secondary);
}

/* Scientific & Governance Telemetry Drawer & Cards (Criterion 08) */
.governance-telemetry-drawer {
  margin-bottom: var(--ds-space-4);
  background: var(--ds-surface);
  border: var(--ds-border-width) solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  box-shadow: var(--ds-shadow-card);
  max-width: 100%;
  min-width: 0;
}
.telemetry-drawer-summary {
  padding: var(--ds-space-3) var(--ds-space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--ds-space-2);
  cursor: pointer;
  list-style: none;
  user-select: none;
  min-width: 0;
}
.telemetry-drawer-summary::-webkit-details-marker {
  display: none;
}
.telemetry-summary-left {
  display: flex;
  align-items: center;
  gap: var(--ds-space-2);
  flex-wrap: wrap;
  font-size: var(--ds-text-sm);
  min-width: 0;
  max-width: 100%;
}
.telemetry-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ds-positive);
  display: inline-block;
  flex-shrink: 0;
}
.telemetry-preview-pill {
  font-size: var(--ds-text-xs);
  color: var(--ds-muted);
  background: var(--ds-surface-subtle);
  padding: 2px 8px;
  border-radius: var(--ds-radius-xs);
  border: var(--ds-border-width) solid var(--ds-line);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.telemetry-toggle-hint {
  font-size: var(--ds-text-xs);
  color: var(--ds-info);
  font-weight: 600;
  white-space: normal;
}
.telemetry-drawer-content {
  padding: var(--ds-space-3) var(--ds-space-4) var(--ds-space-4);
  border-top: var(--ds-border-width) solid var(--ds-line);
  background: var(--ds-surface-subtle);
}
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--ds-space-2);
}
@media (max-width: 960px) {
  .telemetry-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .telemetry-grid {
    grid-template-columns: 1fr;
  }
}
.telemetry-card {
  padding: var(--ds-space-3);
  background: var(--ds-surface);
  border: var(--ds-border-width) solid var(--ds-line);
  border-radius: var(--ds-radius-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.telemetry-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ds-muted);
  font-weight: 700;
}
.telemetry-value {
  font-size: var(--ds-text-lg);
  font-weight: 700;
  color: var(--ds-ink);
  line-height: 1.2;
}
.telemetry-desc {
  margin: 0;
  font-size: 11.5px;
  color: var(--ds-secondary);
  line-height: 1.35;
}
.telemetry-cards-5 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: var(--ds-space-4);
}

/* ==========================================================================
   INTEGRATED DEPENDENCY GRAPH WORKSPACE, 4-ZONE TOPOLOGY & <=2 HOP PATHS
   ========================================================================== */
.workspace-graph-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-3);
  margin-bottom: var(--ds-space-4);
  padding: var(--ds-space-3) var(--ds-space-4);
  background: var(--ds-surface);
  border: var(--ds-border-width) solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  box-shadow: var(--ds-shadow-card);
  max-width: 100%;
  min-width: 0;
}
.workspace-role-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-2);
  min-width: 0;
}
.workspace-role-btn {
  padding: 6px 12px;
  border-radius: var(--ds-radius-sm);
  border: var(--ds-border-width) solid var(--ds-line);
  background: var(--ds-surface-subtle);
  color: var(--ds-secondary);
  font-size: var(--ds-text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ds-motion);
}
.workspace-role-btn:hover {
  border-color: var(--ds-info);
  color: var(--ds-ink);
}
.workspace-role-btn.active {
  background: var(--ds-ink);
  color: var(--ds-surface);
  border-color: var(--ds-ink);
}

.workspace-graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: var(--ds-space-4);
  align-items: start;
  max-width: 100%;
  min-width: 0;
}
@media (max-width: 1080px) {
  .workspace-graph-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.workspace-graph-main {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-4);
  min-width: 0;
  max-width: 100%;
}
.workspace-graph-side {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-4);
  min-width: 0;
  max-width: 100%;
}

/* 4-Zone SVG Canvas & Legend */
.z4-svg-wrap {
  background: var(--ds-surface);
  border: var(--ds-border-width) solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  padding: var(--ds-space-3);
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
}
.graph-4zone-svg {
  width: 100%;
  height: auto;
  max-height: 460px;
  display: block;
  background: var(--ds-canvas);
  border-radius: var(--ds-radius-sm);
  border: var(--ds-border-width) solid var(--ds-divider);
}
.z4-svg-node {
  cursor: pointer;
}
.z4-legend-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-2) var(--ds-space-4);
  padding-top: var(--ds-space-3);
  margin-top: var(--ds-space-2);
  border-top: var(--ds-border-width) solid var(--ds-line);
  font-size: var(--ds-text-xs);
  color: var(--ds-muted);
}
.z4-legend-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-3);
}
.z4-lg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.z4-lg-swatch {
  display: inline-block;
  width: 16px;
  height: 10px;
  border-radius: 3px;
  background: var(--ds-surface);
  border: 2px solid var(--ds-ink);
}
.z4-lg-swatch.typ {
  border-style: dashed;
  border-color: var(--ds-muted);
}
.z4-lg-swatch.doc {
  border-color: var(--ds-positive);
}
.z4-lg-swatch.role {
  border-color: var(--ds-info);
}
.z4-lg-swatch.hl {
  border-color: var(--ds-brand);
  background: var(--ds-error-bg);
}

/* 4-Zone Cards Grid */
.z4-zones-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--ds-space-3);
  margin-top: var(--ds-space-3);
  max-width: 100%;
  min-width: 0;
}
@media (max-width: 760px) {
  .z4-zones-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.z4-zone-card {
  background: var(--ds-canvas);
  border: var(--ds-border-width) solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  padding: var(--ds-space-3);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
  min-width: 0;
}
.z4-zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ds-space-2);
  padding-bottom: var(--ds-space-1);
  border-bottom: var(--ds-border-width) solid var(--ds-line);
}
.z4-zone-title {
  font-size: var(--ds-text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ds-ink);
}
.z4-node-list {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
  min-width: 0;
}
.z4-node-btn {
  width: 100%;
  text-align: left;
  background: var(--ds-surface);
  border: 1.5px solid var(--ds-ink);
  border-radius: var(--ds-radius-sm);
  padding: var(--ds-space-2) var(--ds-space-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all var(--ds-motion);
  min-width: 0;
  overflow-wrap: anywhere;
}
.z4-node-btn.status-assumed_by_industry {
  border-style: dashed;
  border-color: var(--ds-control-border);
}
.z4-node-btn.status-document {
  border-color: var(--ds-positive);
  border-width: 2px;
}
.z4-node-btn.role-match {
  border-color: var(--ds-info);
}
.z4-node-btn.is-selected {
  background: var(--ds-surface-subtle);
  box-shadow: var(--ds-focus);
}
.z4-node-btn.is-highlighted {
  border-color: var(--ds-brand);
  border-width: 2px;
  background: var(--ds-error-bg);
}
.z4-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}
.z4-node-name {
  font-size: var(--ds-text-sm);
  font-weight: 600;
  color: var(--ds-ink);
}
.z4-node-meta {
  font-size: 11px;
  color: var(--ds-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* News Match Tester Panel */
.graph-tester-box {
  background: var(--ds-surface);
  border: var(--ds-border-width) solid var(--ds-line);
  border-radius: var(--ds-radius-md);
  padding: var(--ds-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-3);
  min-width: 0;
}
.graph-tester-textarea {
  width: 100%;
  min-height: 78px;
  resize: vertical;
  padding: var(--ds-space-2) var(--ds-space-3);
  border: var(--ds-border-width) solid var(--ds-control-border);
  border-radius: var(--ds-radius-sm);
  background: var(--ds-canvas);
  color: var(--ds-ink);
  font-size: var(--ds-text-sm);
  font-family: var(--ds-font-sans);
}
.graph-tester-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.graph-sample-chip {
  padding: 4px 10px;
  font-size: 11.5px;
  border-radius: var(--ds-radius-xs);
  border: var(--ds-border-width) solid var(--ds-line);
  background: var(--ds-surface-subtle);
  color: var(--ds-secondary);
  cursor: pointer;
  text-align: left;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.graph-sample-chip:hover {
  border-color: var(--ds-info);
  color: var(--ds-info);
}
.graph-path-btn {
  width: 100%;
  text-align: left;
  padding: var(--ds-space-2) var(--ds-space-3);
  border-radius: var(--ds-radius-sm);
  border: var(--ds-border-width) solid var(--ds-line);
  background: var(--ds-canvas);
  color: var(--ds-ink);
  font-size: var(--ds-text-xs);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all var(--ds-motion);
  min-width: 0;
  overflow-wrap: anywhere;
}
.graph-path-btn:hover {
  border-color: var(--ds-info);
}
.graph-path-btn.active {
  border-color: var(--ds-brand);
  background: var(--ds-error-bg);
  font-weight: 600;
}
.why-edge-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
}
.why-edge-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: var(--ds-space-2);
  align-items: baseline;
  font-size: var(--ds-text-xs);
  padding: 6px 8px;
  background: var(--ds-canvas);
  border-radius: var(--ds-radius-xs);
  border: var(--ds-border-width) solid var(--ds-line);
}
.edge-sign {
  font-family: var(--ds-font-mono);
  font-weight: 700;
  text-align: center;
}
.edge-sign.pos { color: var(--ds-positive); }
.edge-sign.neg { color: var(--ds-error); }
.term-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.term-pill {
  font-family: var(--ds-font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--ds-radius-xs);
  background: var(--ds-surface-subtle);
  border: var(--ds-border-width) solid var(--ds-line);
  color: var(--ds-secondary);
}

/* Group Factor Matrix & Holding Overview */
.group-matrix-wrap {
  overflow-x: auto;
  max-width: 100%;
  border: var(--ds-border-width) solid var(--ds-line);
  border-radius: var(--ds-radius-sm);
}
.group-mx-table {
  border-collapse: collapse;
  width: 100%;
  font-size: var(--ds-text-xs);
}
.group-mx-table th,
.group-mx-table td {
  padding: 6px 8px;
  border-bottom: var(--ds-border-width) solid var(--ds-line);
  text-align: left;
}
.group-mx-table thead th {
  background: var(--ds-surface-subtle);
  font-weight: 700;
  color: var(--ds-secondary);
}
.mx-dot {
  display: inline-block;
  border-radius: 50%;
  background: var(--ds-ink);
  border: 2px solid var(--ds-ink);
}
.mx-dot.high { width: 13px; height: 13px; }
.mx-dot.medium { width: 10px; height: 10px; }
.mx-dot.low { width: 7px; height: 7px; }
.mx-dot.typ {
  background: var(--ds-muted);
  border-color: var(--ds-muted);
}
.mx-dot.via {
  background: transparent;
}
.group-flows-list {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
  margin-top: var(--ds-space-3);
}
.group-flow-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--ds-text-xs);
}
.group-flow-head {
  display: flex;
  justify-content: space-between;
  gap: var(--ds-space-2);
  flex-wrap: wrap;
}
.holding-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--ds-space-3);
  margin-top: var(--ds-space-3);
}
.holding-co-card {
  padding: var(--ds-space-3);
  border-radius: var(--ds-radius-sm);
  border: var(--ds-border-width) solid var(--ds-line);
  background: var(--ds-canvas);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.holding-co-card.is-own {
  border-color: var(--ds-info);
  background: var(--ds-surface-subtle);
}

/* Story Detail <=2 Hops Impact Trajectory Block */
.story-graph-box {
  border-left: 3px solid var(--ds-brand);
  max-width: 100%;
  min-width: 0;
}
.story-graph-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--ds-space-2);
  margin-bottom: var(--ds-space-3);
}
.story-graph-head h3 {
  margin: 0;
}
.story-touched-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--ds-space-3);
  font-size: var(--ds-text-xs);
  min-width: 0;
}
.story-graph-paths {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-3);
  margin-bottom: var(--ds-space-3);
  max-width: 100%;
  min-width: 0;
}
.story-hop-card {
  padding: var(--ds-space-3);
  border-radius: var(--ds-radius-sm);
  border: var(--ds-border-width) solid var(--ds-line);
  background: var(--ds-canvas);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
  max-width: 100%;
  min-width: 0;
}
.story-hop-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--ds-muted);
}
.story-hop-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--ds-space-2);
  max-width: 100%;
  min-width: 0;
}
@media (max-width: 640px) {
  .story-hop-chain {
    flex-direction: column;
  }
}
.story-hop-node {
  flex: 1 1 140px;
  padding: var(--ds-space-2);
  border-radius: var(--ds-radius-xs);
  background: var(--ds-surface);
  border: 1.5px solid var(--ds-ink);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.story-hop-node.typ {
  border-style: dashed;
  border-color: var(--ds-control-border);
}
.story-hop-node.target-co {
  background: var(--ds-surface-subtle);
  border-color: var(--ds-brand);
}
.story-hop-node-zone {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ds-muted);
  font-weight: 700;
}
.story-hop-node-title {
  font-size: var(--ds-text-xs);
  font-weight: 700;
  color: var(--ds-ink);
}
.story-hop-node-sub {
  font-size: 10.5px;
  color: var(--ds-secondary);
}
.story-hop-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  font-size: 10.5px;
  color: var(--ds-muted);
  text-align: center;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.story-hop-arrow-glyph {
  font-family: var(--ds-font-mono);
  font-weight: 700;
  color: var(--ds-brand);
  font-size: 13px;
}
.story-graph-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-2);
  align-items: center;
}
