:root {
  --bg: #edf1f5;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --surface-translucent: rgba(255, 255, 255, 0.96);
  --matrix: #fffdf2;
  --matrix-surface: #ffffff;
  --matrix-ink: #111827;
  --matrix-text: #111827;
  --matrix-frame: #111827;
  --text: #172338;
  --muted: #647084;
  --line: #d6dde7;
  --ink: #111827;
  --navy: #10243c;
  --blue: #2d74a7;
  --accent-soft: #eff6ff;
  --accent-text: #1d4ed8;
  --bull: #e33434;
  --bull-soft: #fff1f2;
  --bull-text: #be123c;
  --bear: #22964b;
  --bear-soft: #ecfdf5;
  --bear-text: #047857;
  --neutral: #6b7280;
  --amber: #f2a71b;
  --amber-soft: #fffbeb;
  --amber-text: #92400e;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --radius-control: 6px;
  --radius-panel: 8px;
  --font-size-xs: 10px;
  --font-size-sm: 12px;
  --font-size-body: 13px;
  --font-size-subtitle: 15px;
  --font-size-title: clamp(27px, 3vw, 36px);
  --motion-fast: 120ms;
  --motion-state: 180ms;
  --motion-ease: cubic-bezier(0.2, 0, 0, 1);
  --shadow: 0 1px 2px rgba(16, 36, 60, 0.08);
  --shadow-raised: 0 10px 28px rgba(16, 36, 60, 0.12);
}

:root[data-theme="soft"] {
  --bg: #f4f1e7;
  --surface: #fffdf6;
  --surface-soft: #f8f4e9;
  --surface-translucent: rgba(255, 253, 246, 0.96);
  --text: #1f2933;
  --muted: #6b6558;
  --line: #ddd6c8;
  --shadow: 0 1px 2px rgba(94, 72, 42, 0.1);
  --shadow-raised: 0 10px 28px rgba(94, 72, 42, 0.14);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1724;
  --surface: #172233;
  --surface-soft: #111c2d;
  --surface-translucent: rgba(23, 34, 51, 0.96);
  --text: #e6edf7;
  --muted: #9caec4;
  --line: #2d3b4f;
  --navy: #0b1220;
  --blue: #58a6df;
  --accent-soft: #172f4f;
  --accent-text: #93c5fd;
  --bull-soft: #451f24;
  --bull-text: #fda4af;
  --bear-soft: #113923;
  --bear-text: #6ee7b7;
  --amber-soft: #3b2b12;
  --amber-text: #fcd34d;
  --danger-soft: #451f24;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.32);
  --shadow-raised: 0 12px 30px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-size: var(--font-size-body);
  font-family:
    "Inter", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--line);
  background: var(--surface-translucent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.brand,
.top-actions,
.operator,
.matrix-title,
.status-panel div {
  display: flex;
  align-items: center;
}

.brand {
  gap: var(--space-3);
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--navy);
  color: #ffffff;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.updated,
.refresh-cadence,
.icon-button,
.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border-radius: 8px;
  white-space: nowrap;
}

.updated,
.refresh-cadence {
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}

.refresh-cadence[data-refresh-cadence-state="ready"] {
  color: var(--text);
}

.refresh-cadence[data-refresh-cadence-state="error"] {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  color: var(--danger);
}

.icon-button {
  width: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.primary-button {
  padding: 0 14px;
  border: 0;
  background: var(--navy);
  color: #ffffff;
}

.primary-button {
  transition:
    transform var(--motion-state) var(--motion-ease),
    box-shadow var(--motion-state) var(--motion-ease),
    background var(--motion-state) var(--motion-ease);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-raised);
}

.primary-button:disabled {
  cursor: progress;
  opacity: 0.85;
  animation: pulseGlow 1.4s ease-in-out infinite;
}

#addNewsSourceButton:disabled {
  cursor: not-allowed;
  background: #dbe3ea;
  color: #6b7280;
  opacity: 1;
  animation: none;
  box-shadow: none;
}

@keyframes pulseGlow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(45, 116, 167, 0.5);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(45, 116, 167, 0);
  }
}

.ghost-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.admin-entry {
  text-decoration: none;
}

.admin-entry[hidden] {
  display: none;
}

.account-menu {
  position: relative;
}

.account-trigger[aria-expanded="true"] {
  border-color: rgba(45, 116, 167, 0.45);
  background: rgba(45, 116, 167, 0.08);
  color: var(--blue);
}

.account-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  width: min(280px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: 0 16px 36px rgba(16, 36, 60, 0.18);
}

.account-popover[hidden],
.account-personal-links[hidden] {
  display: none;
}

.account-popover header {
  display: grid;
  gap: 3px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
}

.account-popover header span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.account-popover header strong {
  font-size: 13px;
}

.account-personal-links {
  display: grid;
}

.account-popover a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.account-popover a:hover,
.account-popover a:focus-visible {
  background: var(--surface-soft);
  outline: none;
}

.account-popover a svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.account-popover .admin-entry {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 6px 6px;
  color: var(--blue);
}

.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #ffc9c9;
  border-radius: 8px;
  background: #fff5f5;
  color: var(--red);
  font-weight: 800;
  white-space: nowrap;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.workspace {
  display: grid;
  grid-template-columns:
    minmax(208px, 228px) minmax(0, 1fr)
    minmax(300px, var(--detail-panel-width, 340px));
  gap: var(--space-4);
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: var(--space-4);
}

.control-panel,
.matrix-workbench,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-panel {
  --sidebar-page-accent: var(--blue);
  --sidebar-page-soft: rgba(45, 116, 167, 0.06);
  --sidebar-page-border: rgba(45, 116, 167, 0.18);
  position: sticky;
  top: 76px;
  display: grid;
  align-content: start;
  gap: 12px;
  max-height: calc(100vh - 94px);
  padding: 14px 14px 14px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.control-panel > *,
.sidebar-control-zone,
.control-group,
.status-panel {
  min-width: 0;
  max-width: 100%;
}

.control-panel[data-active-page="history"] {
  --sidebar-page-accent: #0f8a5f;
  --sidebar-page-soft: rgba(15, 138, 95, 0.07);
  --sidebar-page-border: rgba(15, 138, 95, 0.22);
}

.control-panel[data-active-page="training"] {
  --sidebar-page-accent: #6b5dd3;
  --sidebar-page-soft: rgba(107, 93, 211, 0.07);
  --sidebar-page-border: rgba(107, 93, 211, 0.2);
}

.control-panel::-webkit-scrollbar {
  width: 6px;
}

.control-panel::-webkit-scrollbar-thumb {
  background: rgba(17, 24, 39, 0.18);
  border-radius: 999px;
}

.operator {
  min-width: 0;
  gap: 10px;
}

.operator strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operator span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--surface-soft);
}

.operator svg,
.top-actions svg,
.nav-actions svg {
  width: 18px;
  height: 18px;
}

.fallback-icon {
  display: inline-grid;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  place-items: center;
}

.fallback-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.nav-actions {
  display: grid;
  gap: 8px;
}

.nav-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
}

.nav-actions button.active {
  border-color: var(--blue);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.sidebar-quick-actions {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--sidebar-page-border);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

.sidebar-quick-actions header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-quick-actions header span {
  color: var(--sidebar-page-accent);
  font-size: 11px;
  font-weight: 900;
}

.sidebar-quick-actions header strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.sidebar-quick-actions button {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid rgba(45, 116, 167, 0.18);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}

.sidebar-quick-actions button:hover,
.sidebar-quick-actions button:focus-visible {
  border-color: var(--sidebar-page-accent);
  background: var(--accent-soft);
  color: var(--sidebar-page-accent);
}

.sidebar-quick-actions button.is-hidden {
  display: none;
}

.sidebar-quick-actions svg {
  width: 16px;
  height: 16px;
}

.sidebar-context-card {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--sidebar-page-border);
  border-radius: 8px;
  background: var(--surface);
}

.sidebar-context-main {
  display: grid;
  gap: 4px;
}

.sidebar-context-card span {
  color: var(--sidebar-page-accent);
  font-size: 11px;
  font-weight: 900;
}

.sidebar-context-card strong {
  color: var(--text);
  font-size: 14px;
}

.sidebar-context-card p {
  display: none;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.sidebar-scope-tags em {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(45, 116, 167, 0.12);
}

.sidebar-scope-map {
  display: none;
  gap: 5px;
}

.sidebar-scope-map.is-visible {
  display: grid;
}

.sidebar-scope-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.sidebar-scope-row > span {
  display: inline-grid;
  min-height: 22px;
  place-items: center;
  border-radius: 6px;
  background: var(--sidebar-page-accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
}

.sidebar-scope-row.global > span {
  background: #647084;
}

.sidebar-scope-row p {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  min-width: 0;
  margin: 0;
}

.sidebar-scope-row b,
.sidebar-scope-row em {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
}

.sidebar-scope-row b {
  background: #ffffff;
  color: var(--sidebar-page-accent);
  box-shadow: inset 0 0 0 1px var(--sidebar-page-border);
}

.sidebar-scope-row.global b {
  color: #647084;
  box-shadow: inset 0 0 0 1px rgba(100, 112, 132, 0.16);
}

.sidebar-scope-row em {
  background: #ffffff;
  color: var(--muted);
  font-style: normal;
}

.sidebar-control-zone {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(45, 116, 167, 0.14);
  border-radius: 8px;
  background: #ffffff;
}

.page-control-zone {
  background: var(--surface);
}

.global-control-zone {
  border-color: rgba(100, 112, 132, 0.22);
  background: var(--surface);
}

.sidebar-zone-head {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(100, 112, 132, 0.22);
}

.sidebar-zone-head > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.sidebar-zone-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.sidebar-zone-head strong {
  min-width: 0;
  overflow: hidden;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--sidebar-page-soft);
  color: var(--sidebar-page-accent);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-control-zone .sidebar-zone-head strong {
  background: #f3f5f7;
  color: var(--muted);
}

.sidebar-zone-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.sidebar-control-zone > .sidebar-zone-head {
  display: none;
}

.control-panel #pageControlGroup,
.control-panel #globalSettingsFold {
  display: none;
}

.page-control-zone .sidebar-zone-head small {
  color: var(--sidebar-page-accent);
}

.sidebar-control-zone.is-empty {
  display: none;
}

.sidebar-fold {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 8px;
  border: 1px solid rgba(45, 116, 167, 0.14);
  border-radius: 8px;
  background: #ffffff;
}

.sidebar-fold > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  align-items: center;
  min-width: 0;
  list-style: none;
  cursor: pointer;
}

.sidebar-fold > summary::-webkit-details-marker {
  display: none;
}

.sidebar-fold > summary span {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.sidebar-fold > summary em {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}

.sidebar-fold > summary::after {
  content: "展开";
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef7ff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.sidebar-fold[open] > summary::after {
  content: "收起";
}

.sidebar-fold > .control-group,
.sidebar-fold > .sidebar-control-zone {
  margin-top: 2px;
}

.control-group {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.control-group[data-sidebar-role="page"] {
  border-left: 3px solid var(--sidebar-page-border);
  padding-left: 10px;
}

.control-group[data-sidebar-role="global"],
.status-panel[data-sidebar-role="global"] {
  border-color: rgba(100, 112, 132, 0.26);
}

.control-group[data-sidebar-owner-label],
.status-panel[data-sidebar-owner-label] {
  position: relative;
}

.control-group[data-sidebar-owner-label]::before,
.status-panel[data-sidebar-owner-label]::before {
  content: attr(data-sidebar-owner-label);
  justify-self: start;
  width: fit-content;
  min-height: 20px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--sidebar-page-soft);
  color: var(--sidebar-page-accent);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
}

.control-group[data-sidebar-role="global"]::before,
.status-panel[data-sidebar-role="global"]::before {
  background: #f3f5f7;
  color: #647084;
}

.control-group.is-hidden,
.status-panel.is-hidden {
  display: none;
}

.control-group label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.filter-options {
  gap: 11px;
}

.time-options {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(45, 116, 167, 0.16);
  border-radius: 8px;
  background: #f7fbff;
}

.time-options-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.time-options-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.time-options-head strong {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--blue);
  font-size: 11px;
  box-shadow: inset 0 0 0 1px rgba(45, 116, 167, 0.14);
}

.time-custom-field.is-hidden {
  display: none;
}

select,
input[type="text"],
input[type="password"],
input[type="datetime-local"],
input[type="search"],
input[type="color"] {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
}

input[type="color"] {
  width: 100%;
  padding: 4px;
}

input[type="range"] {
  accent-color: var(--blue);
}

.matrix-scale-control span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.matrix-scale-control b {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.appearance-options {
  gap: 9px;
}

.color-control span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.color-control b {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.matrix-bg-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.matrix-bg-presets button {
  min-width: 0;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.58);
}

.matrix-bg-presets button.is-active {
  border-color: var(--blue);
  box-shadow:
    0 0 0 2px rgba(45, 116, 167, 0.18),
    inset 0 0 0 2px rgba(255, 255, 255, 0.68);
}

.group-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.module-options {
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(45, 116, 167, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(45, 116, 167, 0.06), rgba(45, 116, 167, 0.02)),
    #ffffff;
}

.page-sidebar-section {
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(45, 116, 167, 0.16);
  border-radius: 8px;
  background: #ffffff;
}

.page-sidebar-section label {
  gap: 6px;
}

.sidebar-page-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.sidebar-page-card strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.sidebar-page-card span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-page-card b {
  color: var(--blue);
  font-size: 12px;
}

.sidebar-page-actions {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.sidebar-page-actions .secondary-action,
.sidebar-page-actions .primary-button {
  width: 100%;
  min-height: 34px;
}

.module-options-head,
.module-toggle {
  min-width: 0;
}

.module-options-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.module-options-head > span {
  flex: 0 0 auto;
}

.module-options-head > span:not(.group-title) {
  padding: 3px 7px;
  border-radius: 999px;
  background: #edf7fb;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.module-toggle-list {
  display: grid;
  gap: 6px;
}

.module-toggle {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.module-toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  opacity: 0;
}

.module-toggle-text {
  display: grid;
  min-width: 0;
  gap: 2px;
  pointer-events: none;
}

.module-toggle-text strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-toggle-text em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.workspace-options {
  gap: 10px;
}

.workspace-options input,
.workspace-options select {
  width: 100%;
}

.workspace-summary {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.workspace-summary strong {
  color: var(--text);
  font-size: 13px;
}

.workspace-summary b {
  color: var(--blue);
}

.workspace-actions {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 8px;
}

.workspace-actions .danger {
  border-color: rgba(227, 52, 52, 0.25);
  color: var(--red);
}

.workspace-status {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.workspace-status.success {
  border-color: rgba(34, 163, 92, 0.28);
  background: rgba(34, 163, 92, 0.08);
  color: var(--green);
}

.workspace-status.error {
  border-color: rgba(227, 52, 52, 0.28);
  background: rgba(227, 52, 52, 0.08);
  color: var(--red);
}

.switch-control {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #d8e0ea;
  pointer-events: none;
  transition:
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.switch-control::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(17, 24, 39, 0.24);
  transition: transform 0.16s ease;
}

.module-toggle input:checked + .module-toggle-text strong {
  color: var(--blue);
}

.module-toggle input:checked ~ .switch-control {
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(45, 116, 167, 0.12);
}

.module-toggle input:checked ~ .switch-control::after {
  transform: translateX(16px);
}

.module-toggle input:focus-visible ~ .switch-control {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.secondary-action {
  min-height: 34px;
  border: 1px dashed var(--blue);
  border-radius: 8px;
  background: #edf7fb;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.secondary-action.danger-action {
  border-color: rgba(227, 52, 52, 0.55);
  background: #fff0ef;
  color: var(--bear);
}

.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ghost-action {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.ai-provider-options input,
.ai-provider-options select {
  width: 100%;
}

.ai-settings-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

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

.ai-capability-card,
.ai-last-status {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
}

.ai-capability-card span,
.ai-capability-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.ai-capability-card strong {
  display: block;
  margin: 3px 0;
  color: var(--ink);
  font-size: 15px;
}

.ai-last-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ai-last-status.success {
  border-color: rgba(34, 150, 75, 0.34);
  color: var(--bull);
}

.ai-last-status.error {
  border-color: rgba(227, 52, 52, 0.34);
  color: var(--bear);
}

#aiProviderStatus.online {
  color: var(--bull);
}

.matrix-manager-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

:root[data-theme="dark"] .topbar {
  background: var(--surface-translucent);
}

:root[data-theme="dark"] .nav-actions button.active,
:root[data-theme="dark"] .time-options,
:root[data-theme="dark"] .module-options,
:root[data-theme="dark"] .sidebar-context-card,
:root[data-theme="dark"] .sidebar-control-zone,
:root[data-theme="dark"] .training-action-dock,
:root[data-theme="dark"] .training-advanced-weights,
:root[data-theme="dark"] .training-apply-confirmation,
:root[data-theme="dark"] .training-impact-panel,
:root[data-theme="dark"] .training-inspector-nav,
:root[data-theme="dark"] .training-logic-strip,
:root[data-theme="dark"] .training-matrix-impact-card,
:root[data-theme="dark"] .training-preview-notice,
:root[data-theme="dark"] .training-priority-note,
:root[data-theme="dark"] .training-review-card,
:root[data-theme="dark"] .training-review-switcher,
:root[data-theme="dark"] .training-route-summary,
:root[data-theme="dark"] .training-sample-summary,
:root[data-theme="dark"] .training-settings-dirty,
:root[data-theme="dark"] .training-weight-share,
:root[data-theme="dark"] .matrix-focus-note,
:root[data-theme="dark"] .secondary-action {
  background: rgba(88, 166, 223, 0.1);
}

:root[data-theme="dark"] select,
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] input[type="datetime-local"],
:root[data-theme="dark"] input[type="search"],
:root[data-theme="dark"] input[type="color"],
:root[data-theme="dark"] .updated,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .ghost-button,
:root[data-theme="dark"] .module-toggle,
:root[data-theme="dark"] .training-impact-item,
:root[data-theme="dark"] .training-filter-button,
:root[data-theme="dark"] .training-apply-summary span,
:root[data-theme="dark"] .training-inspector-nav button,
:root[data-theme="dark"] .training-inspector-nav button.active,
:root[data-theme="dark"] .training-inspector-nav button[aria-current="step"],
:root[data-theme="dark"] .training-review-switcher button,
:root[data-theme="dark"] .training-logic-step,
:root[data-theme="dark"] .training-empty-results,
:root[data-theme="dark"] .training-matrix-path,
:root[data-theme="dark"] .training-page-status,
:root[data-theme="dark"] .training-route-steps article,
:root[data-theme="dark"] .training-review-change,
:root[data-theme="dark"] .training-weight-tags span,
:root[data-theme="dark"] .matrix-focus-note button,
:root[data-theme="dark"] .combo-check-list label {
  background: var(--surface-soft);
  color: var(--text);
}

:root[data-theme="dark"] .matrix-drop-preview span,
:root[data-theme="dark"] .time-options-head strong,
:root[data-theme="dark"] .sidebar-scope-tags em,
:root[data-theme="dark"] .sidebar-scope-row,
:root[data-theme="dark"] .sidebar-scope-row b,
:root[data-theme="dark"] .sidebar-scope-row em,
:root[data-theme="dark"] .sidebar-zone-head strong,
:root[data-theme="dark"] .training-matrix-impact-meta span,
:root[data-theme="dark"] .training-review-meta span,
:root[data-theme="dark"] .control-group[data-sidebar-owner-label]::before,
:root[data-theme="dark"] .status-panel[data-sidebar-owner-label]::before,
:root[data-theme="dark"] .control-group[data-sidebar-role="global"]::after,
:root[data-theme="dark"] .status-panel[data-sidebar-role="global"]::after,
:root[data-theme="dark"] .switch-control::after {
  background: var(--surface);
}

:root[data-theme="dark"] .control-group[data-sidebar-role="page"]::after {
  background: rgba(88, 166, 223, 0.18);
}

.status-panel {
  display: grid;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.status-panel .status-title {
  padding-bottom: 2px;
  border-bottom: 1px dashed rgba(100, 112, 132, 0.24);
}

.status-panel div {
  justify-content: space-between;
  gap: 10px;
}

.status-panel span {
  color: var(--muted);
}

.status-panel .status-title strong {
  color: var(--text);
}

.status-panel .status-title span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.status-panel strong {
  color: var(--amber);
}

.status-panel .online {
  color: var(--bull);
}

.matrix-workbench {
  min-width: 0;
  padding: 16px;
}

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

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

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

.matrix-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.time-context {
  color: var(--blue);
  font-weight: 800;
}

.matrix-focus-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(45, 116, 167, 0.22);
  border-radius: 8px;
  background: #f7fbff;
  color: var(--muted);
  font-size: 12px;
}

.matrix-focus-note span,
.matrix-focus-note strong,
.matrix-focus-note small {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
}

.matrix-focus-note span {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 900;
}

.matrix-focus-note strong {
  color: var(--text);
}

.matrix-focus-note small {
  color: var(--muted);
  font-weight: 800;
}

.matrix-focus-note button {
  margin-left: auto;
  min-height: 28px;
  border: 1px dashed var(--blue);
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.is-hidden {
  display: none !important;
}

.view-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.view-tabs button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.view-tabs button.active {
  background: var(--navy);
  color: #ffffff;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 0;
}

.matrix-analysis-toolbar {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.matrix-impact-context {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(45, 116, 167, 0.3);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: var(--surface);
}

.matrix-impact-context.is-error {
  border-color: rgba(190, 51, 51, 0.34);
  border-left-color: #be3333;
}

.matrix-impact-selectors {
  display: grid;
  min-width: 0;
  flex: 1 1 auto;
  grid-template-columns: repeat(2, minmax(160px, 260px));
  gap: 8px;
}

.matrix-impact-selectors label {
  display: grid;
  min-width: 0;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.matrix-impact-selectors select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 0 30px 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.matrix-impact-readout {
  display: grid;
  min-width: min(100%, 260px);
  flex: 0 1 320px;
  gap: 2px;
  text-align: right;
}

.matrix-impact-readout strong {
  color: var(--text);
  font-size: 14px;
}

.matrix-impact-readout span,
.matrix-impact-readout small {
  color: var(--muted);
  font-size: 11px;
}

.matrix-impact-context.is-error .matrix-impact-readout small {
  color: #be3333;
}

.matrix-impact-contributions {
  width: 100%;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.matrix-impact-contributions summary {
  width: max-content;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.matrix-impact-contributions > div {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.matrix-impact-contributions button {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
}

.matrix-impact-contributions button:hover {
  border-color: rgba(45, 116, 167, 0.38);
  background: var(--surface);
}

.matrix-impact-contributions button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.matrix-impact-contributions button strong {
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.matrix-category-tabs {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.matrix-category-tabs button {
  display: grid;
  min-width: 92px;
  min-height: 48px;
  flex: 0 0 auto;
  align-content: center;
  gap: 2px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.matrix-category-tabs button:hover {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.matrix-category-tabs button.active,
.matrix-category-tabs button[aria-selected="true"] {
  border-color: rgba(45, 116, 167, 0.38);
  background: var(--surface);
  color: var(--blue);
  box-shadow: inset 0 -2px 0 var(--blue);
}

.matrix-category-tabs span {
  font-size: 13px;
  font-weight: 900;
}

.matrix-category-tabs small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.matrix-analysis-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  gap: 8px;
}

.matrix-comparison-control {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.matrix-comparison-control select {
  min-width: 132px;
  min-height: 34px;
  padding: 0 30px 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.matrix-layout-status {
  display: none;
  width: 100%;
  padding: 7px 10px;
  border-left: 3px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.matrix-layout-status.is-visible,
.matrix-workbench[data-matrix-layout-mode="editing"] .matrix-layout-status {
  display: block;
}

.matrix-workbench[data-matrix-layout-mode="editing"] .matrix-layout-status {
  border-left-color: var(--amber);
  color: var(--text);
}

.matrix-filter-combos {
  width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.matrix-filter-combos summary {
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.matrix-filter-combos .combo-guide {
  margin-top: 8px;
}

.combo-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.matrix-combo-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
}

.combo-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.combo-bar-head div {
  display: grid;
  gap: 2px;
}

.combo-bar-head strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.combo-bar-head span,
.combo-bar-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.combo-bar-head small {
  overflow: hidden;
  max-width: 44%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-guide {
  margin: -2px 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.combo-weight-notice {
  width: fit-content;
  margin: 0;
  padding: 5px 9px;
  border: 1px solid rgba(42, 163, 83, 0.22);
  border-radius: 999px;
  background: #f1fbf4;
  color: #137045;
  font-size: 12px;
  font-weight: 900;
}

.active-weight-profile-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 8px;
  background: #eef6ff;
}

.active-weight-profile-banner div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.active-weight-profile-banner span,
.active-weight-profile-banner small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.combo-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: var(--blue);
  box-shadow: 0 6px 14px rgba(45, 116, 167, 0.14);
}

.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.chip-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--dot, var(--ink));
}

.combo-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.combo-dots .chip-dot {
  width: 8px;
  height: 8px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.64);
}

.combo-dot-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.1);
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

.chip.active .combo-dot-more {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.chip-dot.energy {
  background: #172338;
}

.chip-dot.metals {
  background: #c48a10;
}

.chip-dot.tech {
  background: #3c96e8;
}

.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.08);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  font-style: normal;
}

.chip.active .chip-count {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.combo-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 11px;
  border: 1px dashed rgba(45, 116, 167, 0.55);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.combo-action.active {
  border-style: solid;
  background: #eef7ff;
}

.combo-action.danger {
  border-color: rgba(239, 68, 68, 0.45);
  color: var(--red);
}

.combo-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.combo-custom-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(45, 116, 167, 0.18);
  border-radius: 8px;
  background: #ffffff;
}

.combo-custom-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.combo-custom-head strong {
  color: var(--text);
  font-size: 12px;
}

.combo-check-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.combo-check-list label {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.combo-check-list label small {
  grid-column: 3;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combo-check-list input {
  width: 14px;
  height: 14px;
  accent-color: var(--blue);
}

.settings-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.category-matrices {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.matrix-card,
.composite-card {
  --matrix-scale: 1;
  min-width: 0;
  align-self: start;
  padding: 12px;
  border: 2px solid var(--matrix-frame);
  border-radius: 8px;
  background: var(--matrix);
  color: var(--matrix-text);
}

.matrix-workbench[data-matrix-layout-mode="analysis"] .matrix-card {
  cursor: default;
}

.matrix-workbench[data-matrix-layout-mode="editing"] .matrix-card {
  border-style: dashed;
  box-shadow: 0 0 0 3px rgba(242, 167, 27, 0.1);
}

.primary-matrix-card {
  min-height: 0;
}

.comparison-matrix-card {
  background: var(--matrix);
  box-shadow: inset 0 3px 0 rgba(45, 116, 167, 0.18);
}

.matrix-drag-handle {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 8px;
  border: 1px dashed var(--blue);
  border-radius: 5px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  cursor: grab;
}

.matrix-mini-action {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.matrix-mini-action:hover {
  border-color: var(--bear);
  color: var(--bear);
}

.matrix-direction-label {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 7px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.matrix-direction-label.bull {
  color: var(--bull);
}

.matrix-direction-label.bear {
  color: var(--bear);
}

.matrix-direction-label.neutral {
  color: var(--neutral);
}

.matrix-semantic-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.matrix-semantic-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.matrix-semantic-legend i,
.matrix-semantic-legend b {
  display: inline-flex;
  width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: 9px;
  font-style: normal;
}

.matrix-semantic-legend .legend-bull {
  color: var(--bull);
}

.matrix-semantic-legend .legend-bear {
  color: var(--bear);
}

.matrix-semantic-legend .legend-neutral {
  color: var(--neutral);
}

.matrix-semantic-legend .legend-conflict {
  color: var(--amber);
}

.matrix-semantic-legend .legend-extension {
  border-style: dashed;
  opacity: 0.7;
}

.matrix-semantic-legend .legend-index {
  width: 3px;
  border: 0;
  border-radius: 0;
  background: var(--blue);
}

.matrix-comparison-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.matrix-card.is-empty-matrix,
.composite-card.is-empty-matrix {
  border-color: #d6dee8;
  background:
    linear-gradient(0deg, rgba(100, 112, 132, 0.05), rgba(100, 112, 132, 0.05)),
    var(--matrix);
}

.matrix-card.is-empty-matrix .matrix-title h2,
.composite-card.is-empty-matrix .composite-title h2 {
  color: var(--muted);
}

.matrix-card.is-empty-matrix .index-pill,
.composite-card.is-empty-matrix .index-pill {
  background: #f1f5f9;
  color: var(--muted);
}

.matrix-card.is-empty-matrix .news-block.continued,
.composite-card.is-empty-matrix .news-block.continued {
  opacity: 0.46;
  filter: saturate(0.72);
}

.matrix-empty-hint {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.matrix-title {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.matrix-title-tools {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.sortable-card {
  position: relative;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    opacity 160ms ease,
    background 160ms ease;
}

.sortable-card.is-dragging {
  z-index: 20;
  opacity: 0.34;
  pointer-events: none;
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(45, 116, 167, 0.24);
}

.sortable-card.is-flow-hidden {
  display: none;
}

.matrix-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 999;
  max-height: calc(100vh - 24px);
  opacity: 0.86;
  pointer-events: none;
  transform-origin: top left;
  transition: none;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.28);
  filter: saturate(1.04);
  overflow: hidden;
}

.matrix-drag-ghost .matrix-scale-handle,
.matrix-drag-ghost .matrix-size-readout {
  display: none;
}

.matrix-drop-preview {
  display: flex;
  align-self: start;
  min-height: var(--preview-height, 180px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  border: 2px dashed var(--blue);
  border-radius: 8px;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(45, 116, 167, 0.09),
      rgba(45, 116, 167, 0.09) 10px,
      rgba(45, 116, 167, 0.03) 10px,
      rgba(45, 116, 167, 0.03) 20px
    ),
    #f7fbff;
  color: var(--blue);
  font-weight: 900;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.7),
    0 12px 26px rgba(45, 116, 167, 0.12);
}

.matrix-drop-preview.side-drop {
  min-height: var(--preview-height, 180px);
  border-style: solid;
  background:
    linear-gradient(90deg, rgba(45, 116, 167, 0.16), rgba(45, 116, 167, 0.05)),
    #f7fbff;
}

.matrix-drop-preview.side-drop.side-fill-row {
  border-width: 3px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.8),
    0 0 0 4px rgba(45, 116, 167, 0.14),
    0 14px 32px rgba(45, 116, 167, 0.16);
}

.matrix-drop-preview span {
  padding: 4px 9px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--navy);
  font-size: 12px;
  box-shadow: 0 5px 14px rgba(17, 24, 39, 0.1);
}

.matrix-drop-preview small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.sortable-card.panel-drop-target {
  border-color: var(--blue);
  background:
    linear-gradient(0deg, rgba(45, 116, 167, 0.09), rgba(45, 116, 167, 0.09)),
    var(--matrix);
  box-shadow:
    0 0 0 4px rgba(45, 116, 167, 0.18),
    var(--shadow);
}

.sortable-card.panel-drop-target::before {
  content: attr(data-drop-label);
  position: absolute;
  top: -13px;
  left: 12px;
  z-index: 2;
  padding: 4px 8px;
  border: 1px solid rgba(45, 116, 167, 0.25);
  border-radius: 999px;
  background: #ffffff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(45, 116, 167, 0.16);
}

.sortable-card.is-drop-resizing {
  border-style: dashed;
  box-shadow:
    0 0 0 4px rgba(45, 116, 167, 0.14),
    inset 0 0 0 2px rgba(45, 116, 167, 0.18),
    var(--shadow);
}

.sortable-card.side-drop-target {
  border-style: solid;
  box-shadow:
    0 0 0 4px rgba(45, 116, 167, 0.2),
    inset 0 0 0 2px rgba(45, 116, 167, 0.18),
    var(--shadow);
}

.sortable-card.side-drop-target::after {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  z-index: 3;
  width: 7px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(45, 116, 167, 0.16);
}

.sortable-card.side-before-target::after {
  left: -5px;
}

.sortable-card.side-after-target::after {
  right: -5px;
}

.sortable-card.home-drop-target {
  opacity: 0.72;
  border-color: #15956a;
  background:
    linear-gradient(0deg, rgba(21, 149, 106, 0.1), rgba(21, 149, 106, 0.1)),
    var(--matrix);
  box-shadow:
    0 0 0 4px rgba(21, 149, 106, 0.2),
    inset 0 0 0 2px rgba(21, 149, 106, 0.24),
    var(--shadow);
}

.sortable-card.home-drop-target::before {
  content: attr(data-drop-label);
  position: absolute;
  top: -13px;
  left: 12px;
  z-index: 2;
  padding: 4px 8px;
  border: 1px solid rgba(21, 149, 106, 0.28);
  border-radius: 999px;
  background: #ffffff;
  color: #087650;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(21, 149, 106, 0.16);
}

.matrix-panel-dragging {
  cursor: grabbing;
}

.matrix-panel-autoscroll::before,
.matrix-panel-autoscroll::after {
  content: "";
  position: fixed;
  right: 0;
  left: 0;
  z-index: 998;
  height: 86px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.matrix-autoscroll-up::before {
  top: 0;
  opacity: 1;
  background: linear-gradient(180deg, rgba(45, 116, 167, 0.18), rgba(45, 116, 167, 0));
}

.matrix-autoscroll-down::after {
  bottom: 0;
  opacity: 1;
  background: linear-gradient(0deg, rgba(45, 116, 167, 0.18), rgba(45, 116, 167, 0));
}

.matrix-panel-scaling {
  cursor: nwse-resize;
}

/* Daily Radar Phase 1 */
.workspace.is-radar-page {
  grid-template-columns: 248px minmax(0, 1fr);
}

.radar-workbench {
  min-width: 0;
  min-height: calc(100dvh - 56px);
  padding: var(--space-5) clamp(var(--space-4), 3vw, 42px) 48px;
  overflow-x: hidden;
  background: var(--surface-soft);
}

.radar-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  max-width: 1180px;
  margin: 0 auto 18px;
}

.radar-page-head > div:first-child > span,
.radar-onboarding-copy > span,
.radar-create-form header span,
.radar-topic-editor header span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.5;
}

.radar-page-head h1,
.radar-onboarding-copy h1 {
  margin: 0;
  color: var(--text);
  font-size: var(--font-size-title);
  line-height: 1.12;
  letter-spacing: 0;
}

.radar-page-head p,
.radar-onboarding-copy p {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: var(--font-size-body);
  line-height: 1.6;
}

.radar-topic-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.radar-head-metrics {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.radar-engine-status {
  color: #0f766e;
  font-weight: 700;
}

.radar-head-metrics > div {
  min-width: 90px;
  padding: 10px var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
}

.radar-head-metrics span,
.radar-head-metrics strong {
  display: block;
}

.radar-head-metrics span {
  color: var(--muted);
  font-size: var(--font-size-sm);
}

.radar-head-metrics strong {
  margin-top: 4px;
  color: var(--text);
  font-size: 20px;
}

.radar-context-bar {
  display: flex;
  align-items: end;
  gap: var(--space-2);
  max-width: 1180px;
  margin: 0 auto 14px;
  padding: var(--space-3);
  border-block: 1px solid var(--line);
  background: var(--surface-translucent);
}

.radar-context-bar label {
  display: grid;
  gap: 4px;
  min-width: 170px;
  color: var(--muted);
  font-size: 11px;
}

.radar-context-topic-control {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: end;
  gap: 8px;
  min-width: 430px;
}

.radar-context-topic-control > label {
  min-width: 0;
}

.radar-topic-entry-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
}

.radar-topic-entry-actions .ghost-action {
  min-height: 30px;
  padding: 5px 8px;
  font-size: var(--font-size-xs);
}

.radar-topic-manager-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.34);
  animation: workbench-backdrop-enter var(--motion-fast) var(--motion-ease);
}

.radar-topic-manager {
  display: flex;
  flex-direction: column;
  width: min(520px, calc(100vw - 24px));
  height: 100dvh;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-raised);
  animation: workbench-panel-enter var(--motion-state) var(--motion-ease);
}

.radar-topic-manager > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5);
  border-bottom: 1px solid var(--line);
}

.radar-topic-manager > header span {
  color: var(--muted);
  font-size: var(--font-size-xs);
  font-weight: 800;
}

.radar-topic-manager h2 {
  margin: 3px 0 0;
  color: var(--text);
  font-size: var(--font-size-title);
}

.radar-topic-manager > header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

.radar-topic-manager-list {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  min-height: 0;
  padding: var(--space-4);
  overflow-y: auto;
}

.radar-topic-manager-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

.radar-topic-manager-item.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.radar-topic-manager-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.radar-topic-manager-copy span,
.radar-topic-manager-copy small {
  color: var(--muted);
  font-size: var(--font-size-xs);
}

.radar-topic-manager-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: var(--font-size-body);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radar-topic-manager-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.radar-topic-manager-actions .secondary-action {
  min-width: 62px;
}

.radar-topic-manager > footer {
  margin-top: auto;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--line);
  background: var(--surface-translucent);
}

.radar-context-bar select,
.radar-topic-editor input,
.radar-topic-editor select,
.radar-topic-editor textarea,
.radar-create-form input,
.radar-create-form select,
.radar-create-form textarea,
.radar-view-editor input,
.radar-view-editor select {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.radar-topic-editor textarea,
.radar-create-form textarea {
  padding: 8px 10px;
  resize: vertical;
}

.radar-view-actions {
  display: flex;
  gap: 4px;
}

.radar-context-bar > .primary-button {
  margin-left: auto;
  white-space: nowrap;
}

.radar-view-editor,
.radar-topic-editor,
.radar-create-form {
  max-width: 1180px;
  margin: 0 auto 14px;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.radar-view-editor {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 180px auto;
  align-items: end;
  gap: 10px;
}

.radar-view-editor label,
.radar-topic-editor label,
.radar-create-form label {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: 12px;
}

.radar-view-editor > div,
.radar-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.radar-view-assistant {
  align-self: end;
  min-height: 36px;
  white-space: nowrap;
}

.radar-notification-trigger {
  position: relative;
  align-self: end;
  min-height: 36px;
  white-space: nowrap;
}

.radar-notification-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #b91c1c;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.radar-notifications {
  display: grid;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto 14px;
  padding: 16px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.radar-notifications > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.radar-notifications > header > div {
  min-width: 0;
}

.radar-notifications > header span {
  color: var(--amber-text);
  font-size: 10px;
  font-weight: 800;
}

.radar-notifications h2 {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 17px;
  letter-spacing: 0;
}

.radar-notifications > header p,
.radar-notification-policy,
.radar-notification-state p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.radar-notification-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.radar-notification-controls .ghost-action.is-active {
  border-color: var(--blue);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.radar-notification-policy {
  padding: 8px 10px;
  border-left: 3px solid var(--blue);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.radar-digest-schedule {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface-subtle);
}

.radar-digest-schedule > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.radar-digest-schedule > div strong {
  color: var(--text);
  font-size: 12px;
}

.radar-digest-schedule > div span,
.radar-digest-schedule label > span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.radar-digest-schedule label {
  display: grid;
  gap: 4px;
}

.radar-digest-schedule select {
  min-width: 112px;
  min-height: 34px;
}

.radar-digest-schedule .ghost-action.is-active {
  border-color: var(--blue);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.radar-digest-deliveries {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.radar-digest-deliveries > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
}

.radar-digest-deliveries > header span {
  color: var(--muted);
  font-size: 10px;
}

.radar-digest-deliveries > p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.radar-digest-deliveries > div {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.radar-digest-delivery {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 8px 10px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-soft);
}

.radar-digest-delivery > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.radar-digest-delivery strong,
.radar-digest-delivery > span {
  color: var(--text);
  font-size: 11px;
}

.radar-digest-delivery div span,
.radar-digest-delivery p {
  color: var(--muted);
  font-size: 10px;
}

.radar-digest-delivery p {
  grid-column: 1 / -1;
  margin: 0;
}

.radar-digest-delivery.is-delivered {
  border-left-color: var(--positive);
}

.radar-digest-delivery.is-failed {
  border-left-color: var(--bull-text);
  background: var(--danger-soft);
}

.radar-digest-delivery.is-skipped {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.radar-notification-state {
  padding: 12px;
  border: 1px dashed var(--line);
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 12px;
}

.radar-notification-state.is-error {
  border-color: var(--bull-text);
  background: var(--danger-soft);
  color: var(--bull-text);
}

.radar-notification-state.is-error p {
  color: inherit;
}

.radar-notification-list {
  display: grid;
  gap: 8px;
  max-height: min(520px, 60vh);
  overflow-y: auto;
}

.radar-notification-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid #94a3b8;
  background: var(--surface);
}

.radar-notification-item.is-unread {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.radar-notification-event {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.radar-notification-event span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.radar-notification-event strong {
  color: var(--text);
  font-size: 13px;
}

.radar-notification-event p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.radar-notification-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.radar-notification-scores span {
  padding: 3px 6px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
}

.radar-notification-item details {
  color: var(--muted);
  font-size: 11px;
}

.radar-notification-item summary {
  color: var(--accent-text);
  cursor: pointer;
  font-weight: 700;
}

.radar-notification-item ul {
  margin: 7px 0 0;
  padding-left: 18px;
}

.radar-notification-item > .ghost-action {
  justify-self: start;
}

.radar-view-draft {
  display: grid;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto 14px;
  padding: 16px;
  border: 1px solid #b8c8d4;
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.radar-view-draft > header,
.radar-view-draft-preview-head,
.radar-view-draft-preview > footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.radar-view-draft > header > div,
.radar-view-draft-preview-head > div {
  min-width: 0;
}

.radar-view-draft > header span,
.radar-view-draft-preview-head span {
  color: #0f766e;
  font-size: 10px;
  font-weight: 800;
}

.radar-view-draft h2,
.radar-view-draft h3 {
  margin: 3px 0 0;
  color: var(--text);
  letter-spacing: 0;
}

.radar-view-draft h2 {
  font-size: 17px;
}

.radar-view-draft h3 {
  font-size: 15px;
}

.radar-view-draft p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.radar-view-draft-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.radar-view-draft-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #334155;
  font-size: 12px;
}

.radar-view-draft-form textarea {
  width: 100%;
  min-height: 68px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.radar-view-draft-state {
  padding: 10px 12px;
  border-left: 3px solid #0284c7;
  background: #f0f9ff;
  color: #075985;
}

.radar-view-draft-state strong {
  font-size: 12px;
}

.radar-view-draft-state p {
  color: inherit;
}

.radar-view-draft-state.insufficient_evidence,
.radar-view-draft-state.empty {
  border-left-color: #d97706;
  background: #fffbeb;
  color: #92400e;
}

.radar-view-draft-state.failed {
  border-left-color: #dc2626;
  background: #fef2f2;
  color: #b91c1c;
}

.radar-view-draft-preview {
  display: grid;
  gap: 12px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.radar-view-draft-preview-head small {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.radar-view-draft-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.radar-view-draft-filter-list > span {
  padding: 4px 7px;
  border: 1px solid #a7c8ca;
  border-radius: 4px;
  background: #ecfdf5;
  color: #0f766e;
  font-size: 10px;
  font-weight: 700;
}

.radar-view-draft-filter-list > .radar-view-draft-empty {
  border-color: var(--line);
  background: var(--surface-subtle);
  color: var(--muted);
}

.radar-view-draft-rationale {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-left: 3px solid #0f766e;
  background: #ecfdf5;
}

.radar-view-draft-rationale strong {
  color: #065f46;
  font-size: 11px;
}

.radar-view-draft-rationale small {
  color: #0f766e;
  font-size: 10px;
}

.radar-view-draft-warning {
  color: #92400e !important;
  font-weight: 700;
}

.radar-view-draft-warning.is-error {
  color: #b91c1c !important;
}

.radar-view-draft.is-warning {
  border-color: #fde68a;
}

.radar-view-draft.is-error {
  border-color: #fecaca;
}

.radar-view-draft-preview > footer {
  align-items: center;
  justify-content: flex-start;
}

.radar-view-draft-preview > footer > small {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
}

.radar-topic-editor header,
.radar-create-form header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.radar-topic-editor h2,
.radar-create-form h2 {
  margin: 0;
  font-size: 18px;
}

.radar-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.radar-topic-editor > label,
.radar-create-form > label {
  margin-top: 10px;
}

.radar-rule-history {
  margin: 14px 0;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.radar-rule-history > header {
  align-items: end;
  margin-bottom: 8px;
}

.radar-rule-history h3 {
  margin: 0;
  color: #172033;
  font-size: 14px;
}

.radar-rule-history small,
.radar-rule-history li span {
  color: #64748b;
  font-size: 11px;
}

.radar-rule-history ol {
  display: grid;
  gap: 6px;
  max-height: 210px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.radar-rule-history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  background: #f8fafc;
}

.radar-rule-history li[data-current="true"] {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.radar-rule-history li > div {
  display: grid;
  gap: 2px;
}

.radar-rule-current {
  color: #0f766e !important;
  font-weight: 800;
}

.radar-rule-invalid {
  color: #b45309 !important;
  font-weight: 800;
}

.radar-rule-history-more {
  display: block;
  margin: 8px auto 0;
}

.radar-rule-suggestions {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.radar-rule-suggestions > header,
.radar-rule-suggestions.is-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.radar-rule-suggestions h2 {
  margin: 2px 0 0;
  color: #172033;
  font-size: 16px;
}

.radar-rule-suggestions small,
.radar-rule-suggestions.is-error span {
  color: #64748b;
  font-size: 12px;
}

.radar-rule-suggestion-list {
  display: grid;
  gap: 8px;
}

.radar-rule-suggestion-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 12px;
  border: 1px solid #dbe4ee;
  border-radius: 6px;
  background: #fff;
}

.radar-rule-suggestion-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.radar-rule-suggestion-copy > span {
  color: #0f766e;
  font-size: 11px;
  font-weight: 800;
}

.radar-rule-suggestion-copy p {
  margin: 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
}

.radar-rule-suggestion-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

@media (max-width: 760px) {
  .radar-rule-suggestions > header,
  .radar-rule-suggestions.is-error,
  .radar-rule-suggestion-list article {
    align-items: stretch;
    flex-direction: column;
  }

  .radar-rule-suggestion-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.radar-state-panel {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 1180px;
  margin: 0 auto 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-left: 4px solid #64748b;
  border-radius: var(--radius-control);
  background: var(--surface);
}

.radar-state-panel.ready {
  border-left-color: #0f766e;
}

.radar-state-panel.no-change {
  border-left-color: #2563eb;
}

.radar-state-panel.processing,
.radar-state-panel.loading {
  border-left-color: #a16207;
}

.radar-state-panel.error {
  border-left-color: #b91c1c;
}

.radar-state-panel > div {
  min-width: 0;
  flex: 1;
}

.radar-state-panel strong,
.radar-state-panel p {
  display: block;
  margin: 0;
}

.radar-state-panel p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.radar-state-icon,
.radar-loading-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 4px rgb(100 116 139 / 12%);
}

.radar-state-panel.ready .radar-state-icon {
  background: #0f766e;
  box-shadow: 0 0 0 4px rgb(15 118 110 / 12%);
}

.radar-state-panel.loading .radar-state-icon {
  animation: radar-pulse 1.2s ease-in-out infinite;
}

@keyframes radar-pulse {
  50% { opacity: 0.35; transform: scale(0.75); }
}

.radar-change-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  max-width: 1180px;
  margin: 0 auto;
}

.radar-change-card {
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.radar-change-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.radar-change-type,
.radar-change-score {
  color: #0f766e;
  font-size: 11px;
  font-weight: 800;
}

.radar-change-score {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.radar-change-card h2 {
  margin: 10px 0 7px;
  color: var(--text);
  font-size: var(--font-size-subtitle);
  line-height: 1.35;
}

.radar-change-card > p {
  display: -webkit-box;
  min-height: 42px;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: var(--font-size-body);
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.radar-card-meta,
.radar-source-line,
.radar-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.radar-card-meta {
  margin-top: 12px;
}

.radar-card-meta span {
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 10px;
}

.radar-card-meta .tone-bull {
  background: var(--bull-soft);
  color: var(--bull-text);
}

.radar-card-meta .tone-bear {
  background: var(--bear-soft);
  color: var(--bear-text);
}

.radar-card-meta .is-warning {
  background: var(--amber-soft);
  color: var(--amber-text);
}

.radar-card-meta .status-ai-validated {
  background: #ecfeff;
  color: #0e7490;
}

.radar-card-meta .status-needs-review {
  background: #fff7ed;
  color: #c2410c;
}

.radar-card-meta .radar-personalization-score {
  background: #eff6ff;
  color: #1d4ed8;
}

.radar-card-meta .radar-read-state {
  background: #f1f5f9;
  color: #475569;
}

.radar-card-actions .is-active {
  border-color: #0f766e;
  background: #ecfdf5;
  color: #0f766e;
}

.radar-operation-status {
  max-width: 1180px;
  margin: 0 auto 12px;
  padding: 9px 12px;
  border: 1px solid #bae6fd;
  border-radius: 5px;
  background: #f0f9ff;
  color: #075985;
  font-size: 12px;
}

.radar-operation-status.success {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #047857;
}

.radar-operation-status.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.radar-operation-status.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.radar-source-line {
  margin-top: 10px;
  color: #64748b;
  font-size: 10px;
}

.radar-source-line span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.radar-why {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  padding: 9px 10px;
  border-left: 2px solid #94a3b8;
  background: #f8fafc;
  color: #64748b;
  font-size: 10px;
}

.radar-why strong {
  color: #334155;
}

.radar-why .radar-personalization-reason {
  color: #1d4ed8;
}

.radar-card-actions {
  margin-top: 12px;
}

.radar-card-actions button {
  min-height: 32px;
}

.radar-card-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.radar-evidence {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.radar-evidence a,
.radar-evidence-item {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 4px;
  color: #334155;
  text-decoration: none;
}

.radar-evidence a:hover {
  background: #f1f5f9;
}

.radar-evidence span,
.radar-evidence small,
.radar-evidence-loading,
.radar-evidence-empty,
.radar-evidence-error {
  color: #64748b;
  font-size: 10px;
}

.radar-evidence-error {
  color: #b91c1c;
}

.radar-evidence-role {
  font-weight: 700;
}

.radar-onboarding-shell,
.radar-template-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
  max-width: 1180px;
  margin: 24px auto 0;
}

.radar-onboarding-copy {
  align-self: center;
  padding: 28px 0;
}

.radar-login-link {
  display: inline-flex;
  margin-top: 18px;
  text-decoration: none;
}

.radar-trust-list {
  display: grid;
  align-content: center;
  border-left: 1px solid #cbd5e1;
}

.radar-trust-list > div {
  display: grid;
  gap: 4px;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.radar-trust-list span {
  color: #64748b;
  font-size: 12px;
}

.radar-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
}

.radar-template-card {
  display: grid;
  gap: 6px;
  min-height: 128px;
  padding: 14px;
  border: 1px solid #d6dde7;
  border-radius: 6px;
  background: #fff;
  color: #172033;
  text-align: left;
}

.radar-template-card:hover,
.radar-template-card.is-selected {
  border-color: #0f766e;
  box-shadow: inset 3px 0 #0f766e;
}

.radar-template-card span,
.radar-template-card small {
  color: #64748b;
  font-size: 11px;
}

.radar-template-card strong {
  line-height: 1.45;
}

.radar-focus-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.radar-create-form fieldset {
  margin: 12px 0;
  padding: 0;
  border: 0;
}

.radar-preset-activation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.75fr);
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #ccdae5;
  border-radius: 5px;
  background: #f8fafc;
}

.radar-preset-activation > div > span,
.radar-preset-activation label > span {
  color: #475569;
  font-size: 11px;
}

.radar-official-source-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.radar-official-source-groups > span {
  padding: 4px 7px;
  border: 1px solid #a7c8ca;
  border-radius: 4px;
  background: #ecfdf5;
  color: #0f766e;
  font-size: 11px;
  font-weight: 700;
}

.radar-activation-status {
  max-width: 1180px;
  margin: 0 auto 12px;
  padding: 10px 12px;
  border: 1px solid #a7f3d0;
  border-radius: 5px;
  background: #ecfdf5;
  color: #065f46;
  font-size: 12px;
}

.radar-beta-activation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid color-mix(in srgb, var(--warning) 54%, var(--line));
  border-radius: var(--radius-panel);
  background: color-mix(in srgb, var(--warning) 9%, var(--panel));
  color: var(--text);
}

.radar-beta-activation.is-missed {
  border-color: color-mix(in srgb, var(--danger) 48%, var(--line));
  background: color-mix(in srgb, var(--danger) 7%, var(--panel));
}

.radar-beta-activation > div {
  min-width: 0;
}

.radar-beta-activation p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.radar-beta-activation-error {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  color: var(--danger);
}

.radar-beta-activation-error .ghost-action {
  flex: 0 0 auto;
}

.radar-topic-briefing {
  display: grid;
  gap: 12px;
  max-width: 1180px;
  margin: 0 auto 12px;
  padding: 15px 16px;
  border: 1px solid #b8c8d4;
  border-radius: 5px;
  background: #f8fafc;
  color: #1e293b;
}

.radar-topic-briefing > header,
.radar-topic-briefing > footer,
.radar-topic-briefing.is-empty,
.radar-topic-briefing.is-processing {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.radar-topic-briefing-copy {
  min-width: 0;
}

.radar-topic-briefing-copy > span {
  color: #0f766e;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.radar-topic-briefing h2 {
  margin: 3px 0 0;
  font-size: 16px;
  line-height: 1.35;
}

.radar-topic-briefing p {
  margin: 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.65;
}

.radar-topic-briefing > header > small,
.radar-topic-briefing > footer > small {
  color: #64748b;
  font-size: 10px;
  white-space: nowrap;
}

.radar-topic-briefing-why {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-left: 3px solid #0f766e;
  background: #ecfdf5;
}

.radar-topic-briefing-why strong {
  color: #065f46;
  font-size: 11px;
}

.radar-topic-briefing > footer {
  align-items: center;
  justify-content: flex-start;
  color: #475569;
  font-size: 11px;
}

.radar-topic-briefing > footer > small {
  margin-left: auto;
}

.radar-topic-briefing.is-warning {
  border-color: #fde68a;
  background: #fffbeb;
}

.radar-topic-briefing-warning {
  color: #92400e !important;
  font-weight: 700;
}

.radar-topic-briefing.is-error {
  border-color: #fecaca;
  background: #fef2f2;
}

.radar-topic-briefing.is-processing {
  border-color: #bae6fd;
  background: #f0f9ff;
}

.radar-topic-briefing-progress {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 2px solid #bae6fd;
  border-top-color: #0369a1;
  border-radius: 50%;
  animation: radar-briefing-spin 0.8s linear infinite;
}

@keyframes radar-briefing-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 720px) {
  .radar-topic-briefing > header,
  .radar-topic-briefing > footer,
  .radar-topic-briefing.is-empty,
  .radar-topic-briefing.is-processing {
    align-items: stretch;
    flex-direction: column;
  }

  .radar-topic-briefing > footer > small {
    margin-left: 0;
    white-space: normal;
  }
}

.radar-create-form legend {
  margin-bottom: 7px;
  color: #334155;
  font-size: 12px;
}

.radar-focus-option {
  display: inline-flex !important;
  grid-template-columns: auto 1fr;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

.radar-focus-option input {
  width: 15px;
  min-height: 15px;
}

.radar-advanced-rules {
  margin: 12px 0;
  border-block: 1px solid #e2e8f0;
  padding: 10px 0;
}

.radar-advanced-rules summary {
  cursor: pointer;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.radar-preview-result {
  margin: 10px 0;
  padding: 9px 10px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
}

@media (max-width: 1040px) {
  .workspace.is-radar-page {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .radar-change-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .radar-template-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .radar-beta-activation {
    grid-template-columns: minmax(0, 1fr);
  }

  .radar-beta-activation .secondary-action {
    width: 100%;
    justify-content: center;
  }

  .radar-beta-activation-error {
    align-items: stretch;
    flex-direction: column;
  }

  .radar-beta-activation-error .ghost-action {
    width: 100%;
    justify-content: center;
  }

  .workspace.is-radar-page {
    display: block;
  }

  .workspace.is-radar-page .control-panel {
    position: static;
    width: 100%;
  }

  .radar-workbench {
    min-height: auto;
    padding: 18px 12px 36px;
  }

  .radar-page-head,
  .radar-context-bar,
  .radar-onboarding-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .radar-head-metrics,
  .radar-context-bar,
  .radar-view-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .radar-context-bar label,
  .radar-context-bar > .primary-button {
    width: 100%;
    margin-left: 0;
  }

  .radar-context-topic-control {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    min-width: 0;
  }

  .radar-preset-activation {
    grid-template-columns: minmax(0, 1fr);
  }

  .radar-topic-manager {
    width: 100vw;
    border-left: 0;
  }

  .radar-topic-manager-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .radar-topic-manager-actions {
    justify-content: flex-end;
  }

  .radar-form-grid,
  .radar-view-editor,
  .radar-template-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .radar-view-assistant {
    width: 100%;
  }

  .radar-notification-trigger {
    width: 100%;
  }

  .radar-notifications > header {
    align-items: stretch;
    flex-direction: column;
  }

  .radar-notification-controls > .ghost-action {
    flex: 1 1 140px;
  }

  .radar-notification-list {
    max-height: none;
  }

  .radar-digest-schedule {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .radar-digest-schedule .ghost-action,
  .radar-digest-schedule select {
    width: 100%;
  }

  .radar-digest-delivery {
    grid-template-columns: minmax(0, 1fr);
  }

  .radar-view-draft-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .radar-view-draft > header,
  .radar-view-draft-preview-head,
  .radar-view-draft-preview > footer {
    align-items: stretch;
    flex-direction: column;
  }

  .radar-view-draft-preview > footer > small {
    margin-left: 0;
  }

  .radar-evidence a,
  .radar-evidence-item {
    grid-template-columns: minmax(0, 1fr);
  }
}

.matrix-drag-handle {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px dashed var(--blue);
  border-radius: 7px;
  background: #edf7fb;
  color: var(--blue);
  cursor: grab;
  font-size: 11px;
  font-weight: 900;
  user-select: none;
}

.sortable-card.is-dragging .matrix-drag-handle {
  cursor: grabbing;
}

.composite-panel-card {
  margin-top: 0;
}

.matrix-scale-handle {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 5;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(45, 116, 167, 0.36);
  border-radius: 9px 3px 9px 3px;
  background:
    linear-gradient(135deg, transparent 45%, rgba(45, 116, 167, 0.58) 46%, rgba(45, 116, 167, 0.58) 51%, transparent 52%),
    linear-gradient(135deg, transparent 59%, rgba(45, 116, 167, 0.42) 60%, rgba(45, 116, 167, 0.42) 65%, transparent 66%),
    linear-gradient(135deg, transparent 73%, rgba(45, 116, 167, 0.28) 74%, rgba(45, 116, 167, 0.28) 79%, transparent 80%),
    #ffffff;
  cursor: nwse-resize !important;
  opacity: 0.86;
  box-shadow: 0 8px 16px rgba(45, 116, 167, 0.12);
  transition:
    transform 160ms ease,
    opacity 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.matrix-scale-handle::after {
  content: "长";
  position: absolute;
  right: 22px;
  bottom: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(45, 116, 167, 0.22);
  border-radius: 999px;
  background: #ffffff;
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translate(6px, 3px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  box-shadow: 0 8px 18px rgba(45, 116, 167, 0.16);
}

.matrix-card:hover .matrix-scale-handle,
.matrix-scale-handle:hover,
.matrix-card.is-scaling .matrix-scale-handle {
  border-color: var(--blue);
  cursor: nwse-resize !important;
  opacity: 1;
  transform: translate(-1px, -1px);
  box-shadow: 0 10px 20px rgba(45, 116, 167, 0.2);
}

.matrix-card:hover .matrix-scale-handle::after,
.matrix-card.is-scaling .matrix-scale-handle::after {
  opacity: 1;
  transform: translate(0, 0);
}

.matrix-size-readout {
  position: absolute;
  right: 40px;
  bottom: 10px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(45, 116, 167, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--navy);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.14);
}

.matrix-card:hover .matrix-size-readout,
.matrix-card.is-scaling .matrix-size-readout {
  opacity: 1;
  transform: translateY(0);
}

.matrix-card.is-scaling .axis-matrix {
  outline: 2px solid rgba(45, 116, 167, 0.28);
  outline-offset: 4px;
}

.matrix-card.is-scaling {
  border-color: var(--blue);
  box-shadow:
    0 0 0 4px rgba(45, 116, 167, 0.14),
    var(--shadow);
}

.matrix-title.center {
  justify-content: center;
}

.matrix-title h2 {
  white-space: nowrap;
}

.title-macro {
  color: #2d74a7;
}

.title-assets {
  color: #7c83ff;
}

.title-commodities {
  color: #a56700;
}

.title-tech {
  color: #3c96e8;
}

.title-geopolitical {
  color: #ef4444;
}

.title-custom {
  color: var(--matrix-color, var(--blue));
}

.matrix-mini-action {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.matrix-mini-action:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.matrix-mini-action.danger {
  color: var(--bear);
}

.matrix-mini-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.index-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 7px;
  background: #1d1d1f;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.index-pill.positive {
  background: var(--bull);
}

.index-pill.negative {
  background: var(--bear);
}

.axis-matrix {
  display: grid;
  grid-template-columns: var(--axis-scale-width, 32px) minmax(0, 1fr);
  gap: var(--axis-gap, 6px);
  min-height: var(--axis-min-height, 408px);
}

.axis-matrix.compact {
  min-height: var(--axis-compact-min-height, 388px);
}

.axis-matrix.wide {
  min-height: var(--axis-wide-min-height, 440px);
}

.axis-scale {
  position: relative;
  color: var(--matrix-text);
  font-size: var(--axis-font, 11px);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.axis-scale::before {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  bottom: 6px;
  width: 2px;
  background: #cfd6df;
  border-radius: 999px;
}

.axis-scale .tick {
  position: absolute;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  transform: translateY(-50%);
  white-space: nowrap;
}

.axis-scale .tick::after {
  content: "";
  display: block;
  width: 6px;
  height: 2px;
  background: var(--matrix-text);
}

.axis-scale .top {
  top: 4%;
  color: var(--matrix-text);
}

.axis-scale .t4 {
  top: 27%;
  color: var(--matrix-text);
  opacity: 0.78;
}

.axis-scale .mid {
  top: 50%;
  color: var(--matrix-text);
}

.axis-scale .t-4 {
  top: 73%;
  color: var(--matrix-text);
  opacity: 0.78;
}

.axis-scale .bottom {
  top: 96%;
  color: var(--matrix-text);
}

.axis-scale.hide-top .tick.top,
.axis-scale.hide-t4 .tick.t4,
.axis-scale.hide-mid .tick.mid,
.axis-scale.hide-b4 .tick.t-4,
.axis-scale.hide-bottom .tick.bottom {
  visibility: hidden;
}

.axis-side {
  display: none;
  position: absolute;
  left: 0;
  padding: 1px 4px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.88);
  font-size: calc(var(--axis-font, 11px) * 0.9);
  line-height: 1.2;
}

.side-bear {
  top: 6px;
  color: var(--bear);
}

.side-bull {
  bottom: 6px;
  color: var(--bull);
}

.index-cursor {
  position: absolute;
  left: 0;
  top: var(--index-y, 50%);
  z-index: 3;
  display: inline-flex;
  min-width: 22px;
  justify-content: center;
  padding: 2px 4px;
  border: 1px solid rgba(100, 112, 132, 0.34);
  border-radius: 5px;
  background: #ffffff;
  color: var(--matrix-text);
  font-size: calc(var(--axis-font, 11px) * 0.9);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.14);
  transform: translateY(-50%);
}

.index-cursor::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -7px;
  width: 7px;
  height: 2px;
  background: currentColor;
  transform: translateY(-50%);
}

.index-cursor.positive {
  border-color: rgba(227, 52, 52, 0.35);
  color: var(--bull);
}

.index-cursor.negative {
  border-color: rgba(34, 150, 75, 0.35);
  color: var(--bear);
}

.block-grid {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: var(--grid-pad, 6px);
  border: var(--grid-border, 2px) solid var(--matrix-ink);
  background: var(--matrix-surface);
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.04);
  overflow: hidden;
}

.zone {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(var(--zone-cell, 18px), 1fr));
  grid-template-rows: repeat(var(--zone-rows, 8), minmax(var(--zone-cell, 18px), 1fr));
  gap: var(--zone-gap, 3px);
  flex: 1 1 0;
  min-height: 0;
  position: relative;
}

.zone::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(to bottom, rgba(100, 112, 132, 0.18) 1px, transparent 1px);
  background-size: 100% calc(100% / var(--zone-rows, 8));
  opacity: 0.75;
}

.zone-bull {
  background:
    linear-gradient(0deg, rgba(227, 52, 52, 0.06), rgba(227, 52, 52, 0));
  border-radius: 4px;
}

.zone-bear {
  background:
    linear-gradient(180deg, rgba(34, 150, 75, 0.06), rgba(34, 150, 75, 0));
  border-radius: 4px;
}

.zone-empty {
  grid-column: 1 / -1;
  align-self: center;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
  opacity: 0.7;
}

.zone-bull .zone-empty {
  align-self: end;
  margin-bottom: 12px;
}

.zone-bear .zone-empty {
  align-self: start;
  margin-top: 12px;
}

.axis-line {
  height: var(--axis-line-height, 1px);
  margin: var(--axis-line-y, 4px) var(--axis-line-x, -2px);
  background: #cfd6df;
}

.news-block {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  gap: var(--block-gap, 1px);
  padding: var(--block-pad, 3px);
  border: var(--block-border, 2px) solid var(--tone);
  background: #ffffff;
  color: var(--ink);
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    outline 120ms ease,
    background 200ms ease,
    border-color 200ms ease;
}

.news-block:hover {
  z-index: 2;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(17, 24, 39, 0.16);
  outline: 2px solid rgba(45, 116, 167, 0.28);
  outline-offset: 1px;
}

.news-block.selected {
  z-index: 3;
  background: rgba(45, 116, 167, 0.08);
  outline: 3px solid rgba(45, 116, 167, 0.55);
  outline-offset: 1px;
  box-shadow: 0 8px 20px rgba(45, 116, 167, 0.22);
}

.news-block.changed {
  animation: blockPulse 900ms ease both;
}

.news-block.change-up {
  box-shadow: inset 0 0 0 2px rgba(34, 150, 75, 0.16);
}

.news-block.change-down {
  box-shadow: inset 0 0 0 2px rgba(227, 52, 52, 0.16);
}

@keyframes blockPulse {
  0% {
    transform: scale(0.96);
    filter: brightness(1.08);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.news-block.filler {
  visibility: hidden;
  pointer-events: none;
  cursor: default;
  background: transparent;
  border-color: transparent;
}

.news-block.filler:hover {
  transform: none;
  box-shadow: none;
  outline: none;
}

.news-block.continued {
  border-style: dashed;
  background: #ffffff;
  opacity: 0.74;
}

.news-block.continued strong {
  font-size: clamp(9px, 0.72vw, 12px);
}

.news-block.continued span {
  font-size: clamp(8px, 0.62vw, 10px);
}

.news-block.bull {
  --tone: var(--bull);
}

.news-block.bear {
  --tone: var(--bear);
}

.news-block.neutral {
  --tone: var(--neutral);
}

.news-block.level-a {
  display: grid;
  grid-column: span 4;
  grid-row: span 4;
  grid-template-columns: minmax(38px, 28%) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  justify-content: stretch;
  min-height: var(--block-a-min, 66px);
  border-width: var(--block-a-border, 3px);
  text-align: left;
}

.news-block.level-b {
  grid-column: span 2;
  grid-row: span 2;
  min-height: var(--block-b-min, 42px);
}

.news-block.level-c {
  grid-column: span 1;
  grid-row: span 1;
  flex-direction: row;
  min-height: var(--block-c-min, 18px);
  padding: var(--block-c-pad, 1px);
  font-weight: 900;
}

.news-block-copy {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
}

.news-block-heading {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}

.news-block-heading strong,
.news-block-heading .news-block-strength {
  flex: 0 0 auto;
}

.news-block.level-a .news-block-copy {
  padding-right: 1px;
  padding-bottom: var(--block-contrib-height, 14px);
}

.news-block.level-b .news-block-copy {
  width: 100%;
  padding: 1px 2px 8px;
}

.news-block strong,
.news-block span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-block.level-a strong {
  font-size: var(--block-a-title, 22px);
}

.news-block.level-b strong {
  font-size: var(--block-b-title, 13px);
}

.news-block.level-c strong {
  font-size: var(--block-c-title, 11px);
  letter-spacing: 0.02em;
}

.news-block.level-a span {
  font-size: var(--block-a-subtitle, 15px);
}

.news-block.level-b span {
  font-size: var(--block-b-subtitle, 10px);
}

.news-block span {
  color: var(--muted);
  font-weight: 700;
}

.news-block .news-block-title {
  color: var(--ink);
  font-weight: 800;
}

.news-block.level-a .news-block-heading strong {
  font-size: clamp(11px, 0.9vw, 14px);
}

.news-block.level-b .news-block-heading strong {
  font-size: clamp(8px, 0.65vw, 10px);
}

.news-block.level-a .news-block-title {
  font-size: clamp(9px, 0.76vw, 12px);
  line-height: 1.05;
}

.news-block.level-b .news-block-title {
  font-size: clamp(7px, 0.58vw, 9px);
  line-height: 1;
}

.news-block .news-block-direction {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--tone);
  font-size: clamp(8px, 0.68vw, 11px);
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-block .news-block-impact,
.news-block .news-block-meta,
.news-block .news-block-strength {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-block .news-block-impact {
  color: var(--tone);
  font-size: clamp(8px, 0.66vw, 11px);
  font-weight: 900;
  line-height: 1.1;
}

.news-block .news-block-meta {
  color: var(--muted);
  font-size: clamp(7px, 0.58vw, 9px);
  font-weight: 700;
  line-height: 1.1;
}

.news-block .news-block-strength {
  color: var(--tone);
  font-size: clamp(8px, 0.65vw, 10px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.news-block.level-b .news-block-impact,
.news-block.level-b .news-block-meta {
  font-size: clamp(7px, 0.55vw, 9px);
}

.news-block.level-c .news-block-strength {
  font-size: clamp(7px, 0.58vw, var(--block-c-title, 11px));
}

.news-block.level-c .news-block-direction {
  font-size: var(--block-c-title, 11px);
}

.news-block-image {
  width: 100%;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.08);
}

.news-block-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-block-image-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: 1px dashed rgba(100, 112, 132, 0.42);
  background: rgba(100, 112, 132, 0.08);
}

.news-block-image-fallback.bull {
  background:
    radial-gradient(circle at 78% 22%, rgba(255, 255, 255, 0.56), transparent 34%),
    linear-gradient(135deg, rgba(227, 52, 52, 0.32), rgba(251, 191, 36, 0.16));
}

.news-block-image-fallback.bear {
  background:
    radial-gradient(circle at 78% 22%, rgba(255, 255, 255, 0.56), transparent 34%),
    linear-gradient(135deg, rgba(34, 150, 75, 0.32), rgba(20, 184, 166, 0.16));
}

.news-block-image-fallback b {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-block.level-a .news-block-image {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
}

.news-block.level-b .news-block-image {
  height: clamp(18px, 30%, 34px);
}

.news-block-ai-summary {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.2;
  white-space: normal;
  -webkit-box-orient: vertical;
}

.news-block.level-a .news-block-ai-summary {
  -webkit-line-clamp: 1;
  font-size: clamp(8px, 0.66vw, 10px);
}

.news-block.level-b .news-block-ai-summary {
  -webkit-line-clamp: 1;
  font-size: clamp(9px, 0.7vw, 11px);
}

.news-block.level-a .contrib {
  position: absolute;
  right: var(--block-contrib-offset, 4px);
  bottom: var(--block-contrib-offset, 4px);
  display: inline-flex;
  align-items: center;
  height: var(--block-contrib-height, 14px);
  padding: 0 var(--block-contrib-pad, 5px);
  border-radius: 999px;
  background: var(--tone);
  color: #fff;
  font-size: var(--block-contrib-font, 9px);
  font-weight: 900;
  font-style: normal;
  letter-spacing: 0.02em;
}

.news-block.level-b .contrib {
  position: absolute;
  right: 2px;
  bottom: 2px;
  color: var(--tone);
  font-size: clamp(7px, 0.55vw, 9px);
  font-weight: 900;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.delta-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 18px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  font-style: normal;
  line-height: 1;
  color: #fff;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.delta-badge.up {
  background: var(--bull);
}

.delta-badge.down {
  background: var(--bear);
}

.news-block .delta-badge {
  position: absolute;
  top: var(--block-badge-top, 3px);
  right: var(--block-badge-top, 3px);
  margin-left: 0;
  min-width: var(--block-badge-min, 18px);
  height: var(--block-badge-height, 14px);
  padding: 0 var(--block-badge-pad, 4px);
  font-size: var(--block-badge-font, 9px);
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.18);
}

.news-block.level-c .delta-badge {
  top: auto;
  right: var(--block-c-badge-offset, 1px);
  bottom: var(--block-c-badge-offset, 1px);
  min-width: var(--block-c-badge-min, 12px);
  height: var(--block-c-badge-height, 10px);
  padding: 0 var(--block-c-badge-pad, 2px);
  font-size: var(--block-c-badge-font, 7px);
}

.news-block.level-a strong {
  color: var(--tone);
}

.news-block.level-b strong {
  color: var(--ink);
}

.news-block.level-c strong {
  color: var(--muted);
  line-height: 1;
}

.composite-card {
  margin-top: 14px;
}

#compositePanel {
  min-height: 380px;
}

#compositePanel .axis-matrix {
  width: 100%;
  margin: 0 auto;
}

.matrix-title h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.06);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.spark {
  width: 60px;
  height: 20px;
}

.trend-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.trend-delta.up {
  color: var(--bull);
}

.trend-delta.down {
  color: var(--bear);
}

.trend-delta.flat {
  color: var(--muted);
}

.composite-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(17, 24, 39, 0.18);
}

.composite-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.composite-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.stat-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stat-cell > span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.stat-cell strong {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 14px;
  line-height: 1.2;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-cell em {
  font-style: normal;
  font-weight: 900;
}

.stat-cell em.up {
  color: var(--bull);
}

.stat-cell em.down {
  color: var(--bear);
}

.stat-cell strong i {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

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

.stat-cell .bull-bar {
  height: 4px;
  border-radius: 999px;
  background: var(--bear);
  overflow: hidden;
}

.stat-cell .bull-bar i {
  display: block;
  width: var(--p, 50%);
  height: 100%;
  background: var(--bull);
  transition: width 320ms ease;
}

.stat-cell .top-mover {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.stat-cell .top-mover[data-id]:hover {
  color: var(--blue);
  text-decoration: underline;
}

.risk-score {
  width: fit-content;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.risk-score.risk-low {
  background: #eaf7f0;
  color: var(--bull);
}

.risk-score.risk-mid {
  background: #fff7df;
  color: #a56700;
}

.risk-score.risk-high {
  background: #fff0ef;
  color: var(--bear);
}

.news-stream {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.news-stream header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.news-stream header strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}

.news-stream header span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.stream-pulse {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(34, 150, 75, 0.12);
  color: var(--bull);
  font-size: 11px;
  font-weight: 800;
}

.stream-pulse i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--bull);
  animation: streamPulse 1.4s ease-in-out infinite;
}

@keyframes streamPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 150, 75, 0.6);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(34, 150, 75, 0);
  }
}

.stream-list {
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.stream-list::-webkit-scrollbar {
  width: 6px;
}

.stream-list::-webkit-scrollbar-thumb {
  background: rgba(17, 24, 39, 0.18);
  border-radius: 999px;
}

.stream-item {
  display: grid;
  grid-template-columns: 44px 4px 1fr;
  gap: 8px;
  align-items: stretch;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.stream-item:hover {
  border-color: var(--blue);
  transform: translateX(2px);
}

.stream-item.selected {
  border-color: var(--blue);
  background: rgba(45, 116, 167, 0.08);
}

.stream-time {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stream-bar {
  border-radius: 999px;
  background: var(--neutral);
}

.stream-item.bull .stream-bar {
  background: var(--bull);
}

.stream-item.bear .stream-bar {
  background: var(--bear);
}

.stream-body strong {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.stream-body small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.lvl-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 14px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  font-style: normal;
}

.lvl-mini.lvl-b {
  background: #475569;
}

.lvl-mini.lvl-c {
  background: #94a3b8;
}

.line-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 14px;
}

.composite-chart-shell {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #ffffff;
  overflow-x: auto;
  overflow-y: hidden;
}

.composite-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 680px;
  padding: 12px 14px 6px;
  border-bottom: 1px solid var(--line);
}

.composite-chart-head strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.composite-chart-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.composite-chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.composite-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.composite-chart-legend i {
  display: inline-block;
  width: 18px;
  height: 8px;
  border-radius: 999px;
}

.composite-chart-legend .legend-bull {
  background: #e33434;
}

.composite-chart-legend .legend-bear {
  background: #22964b;
}

.composite-chart-legend .legend-index {
  height: 0;
  border-top: 3px solid #172338;
  border-radius: 0;
  background: transparent;
}

.composite-echarts-canvas {
  min-width: 680px;
  height: 360px;
}

.composite-echarts-canvas[data-composite-chart="gantt"] {
  height: 390px;
}

.composite-echarts-canvas[data-composite-chart-ready="false"] {
  min-height: 320px;
}

.line-chart,
.mini-map,
.list-view,
.gantt-view {
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #ffffff;
}

.line-chart {
  padding: 12px;
}

.line-chart svg {
  width: 100%;
  height: 300px;
}

.line-chart svg circle {
  cursor: pointer;
  transition: r 120ms ease;
}

.line-chart svg circle:hover {
  r: 6;
}

.line-chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.line-chart-legend .muted {
  color: var(--muted);
  font-weight: 500;
}

.line-mark {
  display: inline-block;
  width: 22px;
  height: 0;
  margin-right: 6px;
  border-top: 2.5px solid var(--ink);
  vertical-align: middle;
}

.line-mark.dashed {
  border-top-style: dashed;
  border-top-color: var(--blue);
}

.mini-map {
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.mini-map-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.mini-map .axis-matrix {
  min-height: 320px;
}

.list-view {
  overflow: auto;
}

.list-view table {
  width: 100%;
  border-collapse: collapse;
}

.list-view th,
.list-view td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

.list-view th {
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.list-view tbody tr {
  cursor: pointer;
  transition: background 140ms ease;
}

.list-view tbody tr:hover {
  background: rgba(45, 116, 167, 0.06);
}

.list-view tbody tr.selected {
  background: rgba(45, 116, 167, 0.12);
  box-shadow: inset 3px 0 0 var(--blue);
}

.list-view .news-cell strong {
  display: block;
  font-size: 13px;
}

.list-view .news-cell small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.list-view .lvl-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
  background: var(--ink);
  color: #fff;
}

.list-view .lvl-pill.lvl-b {
  background: #475569;
}

.list-view .lvl-pill.lvl-c {
  background: #94a3b8;
}

.list-view .dir-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.list-view .dir-pill.bull {
  background: #eaf7f0;
  color: var(--bull);
}

.list-view .dir-pill.bear {
  background: #fff0ef;
  color: var(--bear);
}

.list-view .contrib-cell {
  font-weight: 800;
}

.list-view .contrib-cell.bull {
  color: var(--bull);
}

.list-view .contrib-cell.bear {
  color: var(--bear);
}

.list-view .muted {
  color: var(--muted);
  font-size: 12px;
}

.gantt-view {
  padding: 6px 0 12px;
}

.gantt-axis {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 54px;
  gap: 10px;
  align-items: center;
  padding: 8px 12px 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}

.gantt-axis-spacer {
  height: 1px;
}

.gantt-axis-track {
  position: relative;
  height: 18px;
}

.gantt-axis-track span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.gantt-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 54px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  cursor: pointer;
  transition: background 140ms ease;
}

.gantt-row:hover {
  background: rgba(45, 116, 167, 0.05);
}

.gantt-row.selected {
  background: rgba(45, 116, 167, 0.1);
  box-shadow: inset 3px 0 0 var(--blue);
}

.gantt-row strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-track {
  position: relative;
  height: 16px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}

.gantt-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--w);
  height: 100%;
  margin-left: var(--x);
  border-radius: inherit;
  background: var(--tone);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.gantt-bar em {
  font-style: normal;
}

.history-workbench {
  grid-column: 2 / -1;
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.history-head h1 {
  margin: 0;
}

.history-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.history-head-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.market-source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(100, 112, 132, 0.2);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.market-source-pill.remote {
  border-color: rgba(25, 164, 85, 0.28);
  background: rgba(25, 164, 85, 0.08);
  color: var(--bull);
}

.market-source-pill.loading {
  border-color: rgba(45, 116, 167, 0.26);
  background: rgba(45, 116, 167, 0.08);
  color: var(--blue);
}

.market-source-pill.fallback {
  border-color: rgba(197, 132, 12, 0.24);
  background: rgba(197, 132, 12, 0.08);
  color: #9a6500;
}

.history-segment {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.history-segment button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.history-segment button.active {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.history-segment i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--dot);
}

.history-segment em {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(100, 112, 132, 0.12);
  color: inherit;
  font-size: 11px;
  font-style: normal;
  text-align: center;
}

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

.history-kpis article,
.history-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-kpis article {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.history-kpis span,
.history-panel header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.history-kpis strong {
  font-size: 24px;
  line-height: 1;
}

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

.all-news-page,
.history-evidence-library,
.collection-processing-workbench {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.all-news-navigation {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}

.all-news-navigation button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.all-news-navigation button:hover,
.all-news-navigation button:focus-visible {
  color: var(--text);
  background: var(--surface-soft);
}

.all-news-navigation button.active {
  border-bottom-color: var(--blue);
  color: var(--accent-text);
}

.all-news-navigation svg {
  width: 16px;
  height: 16px;
}

.processing-truth-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-left: 3px solid var(--blue);
  background: var(--surface-soft);
}

.processing-truth-note svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--accent-text);
}

.processing-truth-note p {
  display: grid;
  gap: 3px;
  margin: 0;
}

.processing-truth-note strong {
  color: var(--text);
  font-size: 13px;
}

.processing-truth-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.processing-persisted-status {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

.processing-persisted-status > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.processing-persisted-status header span,
.processing-persisted-status header strong,
.processing-persisted-status header small {
  display: block;
}

.processing-persisted-status header > div > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.processing-persisted-status header strong {
  margin-top: 3px;
  color: var(--text);
  font-size: 14px;
}

.processing-persisted-status header small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.processing-status-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.processing-status-metrics article {
  min-width: 0;
  padding: 9px;
  border-left: 2px solid var(--line-strong);
  background: var(--surface-soft);
}

.processing-status-metrics span,
.processing-status-metrics strong {
  display: block;
}

.processing-status-metrics span {
  color: var(--muted);
  font-size: 9px;
}

.processing-status-metrics strong {
  overflow-wrap: anywhere;
  margin-top: 3px;
  color: var(--text);
  font-size: 13px;
}

.processing-status-metrics small {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 6px;
  font-size: 9px;
}

.processing-status-metrics small span {
  overflow-wrap: anywhere;
}

.processing-status-metrics small b {
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 750;
  text-align: right;
}

.processing-status-metrics [data-processing-status-metric="processing"] {
  border-left-color: var(--blue);
}

.processing-status-metrics [data-processing-status-metric="failed"] {
  border-left-color: var(--red);
}

.processing-persisted-status > p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.processing-persisted-status > p.error {
  color: var(--red);
}

.processing-task-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.processing-task-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

.processing-task-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.processing-task-card header div {
  min-width: 0;
}

.processing-task-card header span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.processing-task-card header strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 14px;
}

.processing-task-card header em {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
}

.processing-task-card[data-task-state="running"] header em,
.processing-task-card[data-task-state="queued"] header em {
  border-color: rgba(45, 116, 167, 0.28);
  color: var(--accent-text);
}

.processing-task-card[data-task-state="completed"] header em {
  border-color: rgba(34, 163, 92, 0.28);
  color: var(--bear-text);
}

.processing-task-card[data-task-state="partially-completed"] header em {
  border-color: rgba(197, 132, 12, 0.3);
  color: var(--amber-text);
}

.processing-task-card[data-task-state="failed"] header em {
  border-color: rgba(227, 52, 52, 0.28);
  color: var(--red);
}

.processing-task-counts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.processing-task-counts div {
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.processing-task-counts span,
.processing-task-counts strong {
  display: block;
  text-align: center;
}

.processing-task-counts span {
  color: var(--muted);
  font-size: 9px;
}

.processing-task-counts strong {
  margin-top: 2px;
  color: var(--text);
  font-size: 15px;
}

.processing-task-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.processing-task-card > .processing-task-error {
  color: var(--red);
}

.processing-source-selection {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

.processing-source-selection > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.processing-source-selection header span,
.processing-source-selection header strong,
.processing-source-selection header small {
  display: block;
}

.processing-source-selection header span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.processing-source-selection header strong {
  margin-top: 3px;
  color: var(--text);
  font-size: 14px;
}

.processing-source-selection header small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.processing-source-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.processing-source-row,
.processing-source-select-all {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.processing-source-row span,
.processing-source-row strong,
.processing-source-row small {
  display: block;
  min-width: 0;
}

.processing-source-row strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-source-row small,
.processing-source-row em,
.processing-source-select-all em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
}

.processing-source-select-all span {
  font-size: 12px;
  font-weight: 850;
}

.processing-source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.processing-empty-state {
  display: grid;
  justify-items: start;
  gap: 6px;
  padding: 14px;
  background: var(--surface-soft);
}

.processing-empty-state span {
  color: var(--muted);
  font-size: 12px;
}

.processing-tool-area {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 12px;
  min-width: 0;
}

.processing-tool-area > [data-processing-tools] {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

@media (max-width: 980px) {
  .processing-task-overview,
  .processing-tool-area {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .all-news-navigation button {
    flex: 1 1 0;
    justify-content: center;
  }

  .processing-task-counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .processing-persisted-status > header {
    display: grid;
  }

  .processing-status-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .processing-source-selection > header {
    display: grid;
  }

  .processing-source-row,
  .processing-source-select-all {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .processing-source-row > em,
  .processing-source-select-all > em {
    grid-column: 2;
  }
}

.history-page-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.evidence-library-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(45, 116, 167, 0.24);
  border-radius: 999px;
  background: rgba(45, 116, 167, 0.07);
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.history-shared-db-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.history-shared-db-strip div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-shared-db-strip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.history-shared-db-strip strong {
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-shared-db-strip small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.history-news-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.7fr) repeat(5, minmax(108px, 0.8fr)) auto auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-filter-reset {
  min-height: 36px;
  align-self: end;
}

.history-official-scope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
}

.history-news-toolbar label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.history-news-toolbar input,
.history-news-toolbar select {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
}

.history-news-toolbar input {
  padding: 0 12px;
}

.history-news-toolbar select {
  padding: 0 10px;
}

.history-news-filter-summary {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 4px;
  min-height: 36px;
  color: var(--muted);
  white-space: nowrap;
}

.history-news-filter-summary strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.history-all-news-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 12px;
  align-items: start;
}

.history-news-database-panel,
.history-news-database-panel .history-table {
  min-width: 0;
}

.history-news-empty-row {
  padding: 24px !important;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.history-secondary-market-panel {
  min-width: 0;
}

.history-snapshot-section {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.history-snapshot-controls,
.history-snapshot-review {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.history-snapshot-controls > header,
.history-snapshot-review > header,
.snapshot-panel-card > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.history-snapshot-controls header span,
.history-snapshot-review header span,
.snapshot-panel-card header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.history-snapshot-controls header strong,
.history-snapshot-review header strong,
.snapshot-panel-card header strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 15px;
}

.history-snapshot-controls header button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(45, 116, 167, 0.32);
  border-radius: 7px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.history-snapshot-controls header button:disabled {
  opacity: 0.58;
}

.snapshot-status {
  display: block;
  margin: 10px 12px 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.snapshot-status.success {
  border-color: rgba(25, 164, 85, 0.24);
  background: rgba(25, 164, 85, 0.08);
  color: var(--bear);
}

.snapshot-status.error {
  border-color: rgba(227, 52, 52, 0.24);
  background: rgba(227, 52, 52, 0.08);
  color: var(--bull);
}

.snapshot-list {
  display: grid;
  gap: 8px;
  max-height: 340px;
  padding: 12px;
  overflow: auto;
}

.snapshot-list button {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.snapshot-list button.active {
  border-color: var(--blue);
  background: #f0f8ff;
  box-shadow: inset 0 0 0 1px rgba(45, 116, 167, 0.18);
}

.snapshot-list span,
.snapshot-list em,
.history-snapshot-review header small,
.snapshot-weight-list span {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.snapshot-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-snapshot-review > header > b {
  display: inline-flex;
  min-width: 44px;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--navy);
  color: #fff;
  font-size: 18px;
}

.history-snapshot-review > header > b.positive,
.snapshot-list em.positive,
.snapshot-panel-card em.positive,
.snapshot-weight-list em.positive {
  color: var(--bull);
}

.history-snapshot-review > header > b.negative,
.snapshot-list em.negative,
.snapshot-panel-card em.negative,
.snapshot-weight-list em.negative {
  color: var(--bear);
}

.snapshot-panel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.snapshot-panel-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.snapshot-panel-card header {
  padding: 10px;
}

.snapshot-panel-card header em {
  font-size: 16px;
  font-style: normal;
  font-weight: 900;
}

.snapshot-mini-matrix {
  padding: 10px;
  --matrix-scale: 0.62;
  --axis-scale-width: 26px;
  --axis-gap: 4px;
  --axis-min-height: 230px;
  --axis-font: 9px;
  --grid-pad: 4px;
  --grid-border: 1px;
  --zone-cell: 10px;
  --zone-gap: 2px;
  --block-pad: 1px;
  --block-border: 1px;
  --block-a-title: 14px;
  --block-b-title: 9px;
  --block-c-title: 8px;
  --block-a-subtitle: 10px;
  --block-b-subtitle: 8px;
  --block-badge-font: 7px;
}

.snapshot-mini-matrix .axis-matrix {
  min-height: 230px;
}

.snapshot-mini-matrix .news-block {
  pointer-events: none;
}

.snapshot-weight-track {
  padding: 0 12px 12px;
}

.snapshot-weight-track h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 14px;
}

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

.snapshot-weight-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.snapshot-weight-list strong {
  display: block;
  overflow: hidden;
  max-width: 360px;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.snapshot-weight-list em {
  flex: 0 0 auto;
  font-style: normal;
  font-weight: 900;
}

.snapshot-empty {
  display: grid;
  gap: 6px;
  padding: var(--space-4);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.snapshot-empty strong {
  color: var(--text);
  font-size: 15px;
}

.snapshot-empty.small {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.history-kpis .positive,
.history-table .positive,
.history-index-card.positive strong {
  color: var(--bull);
}

.history-kpis .negative,
.history-table .negative,
.history-index-card.negative strong {
  color: var(--bear);
}

.history-kpis .up,
.history-table .up {
  color: var(--bull);
}

.history-kpis .down,
.history-table .down {
  color: var(--bear);
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
}

.history-panel {
  overflow: hidden;
}

.history-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.history-panel header strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
}

.history-panel header small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.history-panel header button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(45, 116, 167, 0.32);
  border-radius: 7px;
  background: #fff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.history-timeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.history-timeline button {
  display: grid;
  gap: 3px;
  min-height: 70px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.history-timeline button.active {
  border-color: var(--blue);
  background: #f0f8ff;
  box-shadow: inset 0 0 0 1px rgba(45, 116, 167, 0.18);
}

.history-timeline span,
.history-timeline em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.history-timeline strong {
  font-size: 20px;
  line-height: 1;
}

.history-timeline strong.positive {
  color: var(--bull);
}

.history-timeline strong.negative {
  color: var(--bear);
}

.history-chart {
  padding: 0 12px 12px;
}

.history-chart svg {
  width: 100%;
  min-height: 260px;
}

.history-chart polygon {
  fill: rgba(45, 116, 167, 0.1);
}

.history-chart polyline {
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.history-chart text {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.history-point {
  cursor: pointer;
}

.history-point circle {
  fill: #fff;
  stroke: var(--blue);
  stroke-width: 3;
}

.history-point.selected circle {
  fill: var(--blue);
}

.history-inspector {
  display: grid;
  gap: 12px;
  padding-bottom: 12px;
}

.history-index-card {
  display: grid;
  gap: 4px;
  margin: 12px 12px 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.history-index-card span,
.history-index-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.history-index-card strong {
  font-size: 34px;
  line-height: 1;
}

.history-mini-matrix {
  margin: 0 12px;
}

.history-mini-matrix .axis-matrix {
  min-height: 330px;
}

.history-inspector h3 {
  margin: 0 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.history-headlines {
  display: grid;
  gap: 8px;
  margin: 0 12px;
}

.history-headlines button {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.history-headlines button.bull {
  border-left-color: var(--bull);
}

.history-headlines button.bear {
  border-left-color: var(--bear);
}

.history-headlines strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-headlines span {
  color: var(--muted);
  font-size: 11px;
}

.history-empty {
  margin: 0 12px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.history-table {
  overflow-x: auto;
}

.history-table table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th,
.history-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

.history-table th {
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.history-table tbody tr {
  cursor: pointer;
}

.history-table tbody tr:hover,
.history-table tbody tr.selected {
  background: #f0f8ff;
}

.history-table tbody tr.selected {
  box-shadow: inset 3px 0 0 var(--blue);
}

.history-table td strong,
.history-table td span {
  display: block;
}

.history-table td span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.history-table em {
  font-style: normal;
  font-weight: 900;
}

.history-market-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.history-market-tabs button {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--market);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.history-market-tabs button.active {
  border-color: var(--blue);
  border-top-color: var(--market);
  background: #f0f8ff;
  box-shadow: inset 0 0 0 1px rgba(45, 116, 167, 0.2);
}

.history-market-tabs span,
.history-market-tabs em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.history-market-tabs strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-market-tabs .positive,
.history-market-match .positive {
  color: var(--bull);
}

.history-market-tabs .negative,
.history-market-match .negative {
  color: var(--bear);
}

.history-compare-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.history-detail-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.history-primary-layout {
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
}

.history-market-chart {
  padding: 12px;
}

.history-market-chart svg {
  display: block;
  width: 100%;
  min-height: 320px;
}

.history-echarts-canvas {
  display: none;
  width: 100%;
  height: 430px;
  min-height: 430px;
}

.history-market-chart.is-echarts-ready > svg {
  display: none;
}

.history-market-chart.is-echarts-ready .history-echarts-canvas {
  display: block;
}

.history-market-chart text {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.history-market-chart .chart-field {
  fill: #fbfdff;
  stroke: var(--line);
}

.market-close-line {
  fill: none;
  stroke: var(--market);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.market-candle line {
  stroke: #647084;
  stroke-width: 1.5;
}

.market-candle rect {
  stroke-width: 1.5;
}

.market-candle.up rect {
  fill: rgba(45, 116, 167, 0.16);
  stroke: var(--blue);
}

.market-candle.down rect {
  fill: rgba(100, 112, 132, 0.16);
  stroke: #647084;
}

.market-news-marker {
  cursor: pointer;
}

.market-news-marker line {
  stroke-dasharray: 4 4;
  stroke-width: 1;
  opacity: 0.36;
}

.market-news-marker circle {
  fill: #fff;
  stroke-width: 3;
}

.market-news-marker text {
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
}

.market-news-marker.bull line,
.market-news-marker.bull circle {
  stroke: var(--bull);
}

.market-news-marker.bear line,
.market-news-marker.bear circle {
  stroke: var(--bear);
}

.market-news-marker.selected line {
  opacity: 0.8;
  stroke-width: 2;
}

.market-news-marker.selected circle {
  fill: var(--surface);
}

.history-news-timeline {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.history-news-timeline::before {
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: 29px;
  width: 2px;
  border-radius: 999px;
  background: var(--line);
  content: "";
}

.history-news-timeline button {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 4px 10px;
  min-height: 64px;
  padding: 9px 10px 9px 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.history-news-timeline button::before {
  position: absolute;
  top: 22px;
  left: 24px;
  width: 12px;
  height: 12px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 2px var(--line);
  content: "";
}

.history-news-timeline button.bull::before {
  background: var(--bull);
}

.history-news-timeline button.bear::before {
  background: var(--bear);
}

.history-news-timeline button.selected {
  border-color: var(--blue);
  background: #f0f8ff;
  box-shadow: inset 0 0 0 1px rgba(45, 116, 167, 0.2);
}

.history-news-timeline time {
  grid-row: 1 / 3;
  align-self: center;
  color: var(--navy);
  font-size: 12px;
  font-weight: 900;
}

.history-news-timeline span,
.history-news-timeline em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.history-news-timeline strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-news-timeline em {
  justify-self: end;
}

.history-market-match,
.history-market-note {
  display: grid;
  gap: 6px;
  margin: 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.history-news-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin: 0 12px;
}

.history-news-meta > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-news-meta span,
.history-market-match span,
.history-market-note strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.history-news-meta strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-news-meta small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.history-news-detail-panel {
  max-height: 760px;
  overflow: auto;
}

.history-evidence-section {
  display: grid;
  gap: 9px;
  margin: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.history-evidence-section > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.history-evidence-section > header span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.history-evidence-section > header strong {
  font-size: 13px;
}

.history-evidence-section dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.history-evidence-section dl div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.history-evidence-section dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.history-evidence-section dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 800;
}

.history-evidence-section h3,
.history-evidence-section p,
.history-evidence-section ul {
  margin: 0;
}

.history-evidence-section h3 {
  font-size: 14px;
  line-height: 1.35;
}

.history-evidence-section p,
.history-evidence-section li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.history-source-limitation {
  padding: 8px;
  border-left: 3px solid var(--amber);
  background: rgba(197, 132, 12, 0.08);
  color: #805500;
  font-weight: 800;
}

.history-assessment-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-assessment-summary b {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 11px;
}

.history-detail-title {
  display: grid;
  gap: 8px;
  margin: 12px 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #fff;
}

.history-detail-title.bull {
  border-left-color: var(--bull);
}

.history-detail-title.bear {
  border-left-color: var(--bear);
}

.history-detail-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.history-detail-title h2 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.25;
}

.history-detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.history-detail-actions button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(45, 116, 167, 0.22);
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.history-detail-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.history-detail-title div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.history-detail-title b {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 11px;
}

.history-inspector > .multi-tag-row {
  margin: 0 12px;
}

.history-news-detail-panel > .multi-tag-row {
  margin: 0 12px;
}

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

.history-param-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.history-param-grid span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.history-param-grid strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.history-raw-json {
  margin: 0 12px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-raw-json summary {
  padding: 10px 12px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.history-raw-json pre {
  max-height: 320px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  color: #0f172a;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.history-market-match strong {
  font-size: 14px;
}

.history-market-match p,
.history-market-note p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.history-market-match em {
  font-style: normal;
  font-weight: 900;
}

.history-news-title-cell {
  min-width: 260px;
}

.history-news-tags-cell {
  min-width: 260px;
}

.history-news-source-cell {
  min-width: 88px;
}

.history-source-link {
  min-height: 22px;
  padding: 0 8px;
  font-size: 11px;
}

.history-options {
  display: grid;
  gap: 10px;
}

.history-option-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.history-option-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.history-option-panel summary::-webkit-details-marker {
  display: none;
}

.history-option-panel summary::after {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  content: "+";
}

.history-option-panel[open] summary::after {
  content: "-";
}

.history-option-panel summary strong {
  color: var(--text);
  font-size: 14px;
}

.history-option-panel summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-option-body {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.history-option-panel > .history-kpis,
.history-option-panel > .history-news-timeline,
.history-option-panel > .history-table-panel {
  margin: 0;
  border-top: 1px solid var(--line);
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
}

.training-workbench {
  grid-column: 2 / -1;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.training-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.training-head h1 {
  margin: 0;
}

.training-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.training-page-status {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef7ff;
  color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(45, 116, 167, 0.14);
}

.training-page-status strong,
.training-page-status small {
  font-size: 12px;
  font-weight: 900;
}

.training-page-status small {
  color: var(--muted);
}

.training-page-status.ready {
  background: #f6fff9;
  color: var(--bull);
  box-shadow: inset 0 0 0 1px rgba(42, 163, 83, 0.2);
}

.training-page-status.applied {
  background: #eaf8ef;
  color: var(--bull);
  box-shadow: inset 0 0 0 1px rgba(42, 163, 83, 0.28);
}

.training-page-status.stale {
  background: #fff9ec;
  color: #a56700;
  box-shadow: inset 0 0 0 1px rgba(242, 167, 27, 0.3);
}

.training-simple-page {
  display: grid;
  gap: 14px;
}

.training-simple-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.training-simple-head h1 {
  margin: 2px 0 0;
  font-size: 24px;
}

.training-simple-head span,
.training-simple-head small,
.training-simple-card header span,
.training-simple-card header small,
.training-simple-market-head span,
.training-simple-market-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.training-simple-head p {
  max-width: 680px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.training-simple-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid rgba(45, 116, 167, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
}

.training-simple-status > div:first-child {
  display: grid;
  gap: 4px;
}

.training-simple-status span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.training-simple-status strong {
  font-size: 17px;
}

.training-simple-status small {
  color: var(--muted);
  font-size: 12px;
}

.training-simple-status.ready {
  border-color: rgba(42, 163, 83, 0.28);
  background: #f7fff9;
}

.training-simple-status.applied {
  border-color: rgba(45, 116, 167, 0.32);
  background: #eef7ff;
}

.training-simple-status.stale {
  border-color: rgba(242, 167, 27, 0.38);
  background: #fff8ed;
}

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

.training-simple-actions button {
  min-height: 34px;
}

.training-simple-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  gap: 14px;
  align-items: start;
}

.training-simple-card {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.training-simple-card header,
.training-simple-market-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.training-simple-card h2 {
  margin: 2px 0 0;
  font-size: 18px;
}

.training-simple-market-head strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-simple-selects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.training-simple-selects label {
  display: grid;
  gap: 6px;
}

.training-simple-selects label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.training-simple-selects select {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

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

.training-simple-guide article,
.training-simple-default-rule {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.training-simple-guide b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
}

.training-simple-guide strong,
.training-simple-default-rule strong {
  color: var(--text);
  font-size: 13px;
}

.training-simple-guide span,
.training-simple-default-rule span,
.training-simple-default-rule small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.training-simple-default-rule {
  grid-template-columns: minmax(100px, 0.45fr) minmax(140px, 0.75fr) minmax(0, 1fr);
  align-items: center;
  background: #eef7ff;
}

.training-simple-tag-grid,
.training-simple-market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.training-simple-tag,
.training-simple-market {
  min-height: 76px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.training-simple-tag:hover,
.training-simple-tag:focus-visible,
.training-simple-market:hover,
.training-simple-market:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(45, 116, 167, 0.12);
}

.training-simple-tag.active {
  border-color: var(--blue);
  background: #eef7ff;
}

.training-simple-market {
  border-left: 4px solid var(--market-color, var(--blue));
}

.training-simple-market.active {
  background: #f6fff9;
  box-shadow: inset 0 0 0 1px rgba(42, 163, 83, 0.24);
}

.training-simple-tag span,
.training-simple-market span,
.training-simple-weight span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.training-simple-tag strong,
.training-simple-market strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
}

.training-simple-tag small,
.training-simple-market small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.training-simple-readout,
.training-simple-result-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.training-simple-readout span,
.training-simple-result-metrics span {
  min-height: 50px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.training-simple-readout b,
.training-simple-result-metrics b {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 16px;
}

.training-simple-weight-list {
  display: grid;
  gap: 8px;
}

.training-simple-weight {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px 74px;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.training-simple-weight strong {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-simple-weight > b {
  justify-self: center;
  min-width: 42px;
  padding: 6px 0;
  border-radius: 999px;
  background: #eef7ff;
  color: var(--blue);
  text-align: center;
  font-size: 16px;
}

.training-simple-weight > small {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.training-simple-weight.up > small {
  color: var(--bull);
}

.training-simple-weight.down > small {
  color: var(--bear);
}

.training-simple-chart {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.training-simple-chart header,
.training-saved-runs header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.training-simple-chart header span,
.training-saved-runs header span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.training-simple-chart header strong,
.training-saved-runs header strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
}

.training-simple-chart header small,
.training-saved-runs header small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.training-simple-chart svg {
  width: 100%;
  min-height: 180px;
  overflow: visible;
}

.training-chart-axis {
  stroke: #d6e0eb;
  stroke-width: 1;
}

.training-chart-row text {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.training-chart-original {
  fill: #d8e4f0;
}

.training-chart-output {
  fill: var(--blue);
}

.training-chart-output.up {
  fill: var(--bull);
}

.training-chart-output.down {
  fill: var(--bear);
}

.training-chart-output.flat {
  fill: #647084;
}

.training-chart-value {
  fill: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.training-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.training-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.training-chart-legend i {
  width: 18px;
  height: 8px;
  border-radius: 99px;
}

.training-chart-legend .original {
  background: #d8e4f0;
}

.training-chart-legend .output {
  background: var(--blue);
}

.training-simple-confirmation,
.training-simple-empty {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid rgba(45, 116, 167, 0.16);
  border-radius: 8px;
  background: #f8fbff;
}

.training-simple-confirmation span,
.training-simple-empty strong {
  font-weight: 900;
}

.training-simple-confirmation small,
.training-simple-empty small {
  color: var(--muted);
  font-size: 12px;
}

.training-saved-runs {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.training-weight-status {
  margin: 0;
  padding: 7px 9px;
  border: 1px solid rgba(100, 112, 132, 0.18);
  border-radius: 7px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.training-weight-status.success {
  border-color: rgba(42, 163, 83, 0.24);
  background: #f1fbf4;
  color: #137045;
}

.training-weight-status.error {
  border-color: rgba(227, 52, 52, 0.24);
  background: #fff4f2;
  color: #b42318;
}

.training-saved-run-list {
  display: grid;
  gap: 8px;
}

.training-saved-run {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.training-saved-run.active {
  border-color: rgba(42, 163, 83, 0.35);
  background: #f6fff9;
}

.training-saved-run.selected {
  border-color: rgba(45, 116, 167, 0.32);
  background: #f3f8ff;
}

.training-saved-run strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-saved-run small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.training-saved-run em {
  display: block;
  margin-top: 3px;
  color: #137045;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.35;
}

.training-saved-run > span {
  min-width: 68px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}

.training-saved-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.training-saved-empty {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px dashed #cbd7e4;
  border-radius: 8px;
  background: #f8fafc;
}

.training-saved-empty strong {
  font-size: 13px;
}

.training-saved-empty small {
  color: var(--muted);
  font-size: 12px;
}

.training-route-summary {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.4fr) auto;
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid rgba(45, 116, 167, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 255, 0.96)),
    #ffffff;
}

.training-route-summary.ready,
.training-route-summary.applied {
  border-color: rgba(42, 163, 83, 0.28);
  background:
    linear-gradient(180deg, rgba(246, 255, 249, 0.96), rgba(255, 255, 255, 0.96)),
    #ffffff;
}

.training-route-summary.stale {
  border-color: rgba(242, 167, 27, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(255, 255, 255, 0.96)),
    #ffffff;
}

.training-route-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  align-content: center;
}

.training-route-copy span,
.training-route-steps span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.training-route-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.training-route-copy small,
.training-route-steps small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-route-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.training-route-steps article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(45, 116, 167, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.training-route-steps strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-route-actions {
  display: grid;
  gap: 8px;
  align-content: center;
  justify-items: stretch;
}

.training-route-actions button {
  min-height: 34px;
  white-space: nowrap;
}

.training-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.training-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.training-step em {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.training-step span,
.training-step small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-step strong {
  display: block;
  overflow: hidden;
  margin: 3px 0;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-step i {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  margin-top: 5px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--blue);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.training-step:hover,
.training-step:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 8px 18px rgba(45, 116, 167, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.training-step:disabled,
.training-step[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.68;
}

.training-step:disabled:hover,
.training-step[aria-disabled="true"]:hover {
  border-color: var(--line);
  box-shadow: none;
  transform: none;
}

.training-step.complete {
  border-color: rgba(42, 163, 83, 0.35);
  background: #f6fff9;
}

.training-step.complete em {
  background: var(--green);
  color: #fff;
}

.training-step.current {
  border-color: rgba(45, 116, 167, 0.36);
  background: #f4faff;
}

.training-step.current em {
  background: var(--blue);
  color: #fff;
}

.training-step.stale {
  border-color: rgba(242, 167, 27, 0.44);
  background: #fff9ec;
}

.training-step.stale em,
.training-step.stale i {
  background: #f2a71b;
  color: #172338;
}

.training-step.current:not(.stale)[data-training-run] i,
.training-step.current[data-training-apply] i,
.training-step.complete[data-training-view-monitor] i {
  background: var(--blue);
  color: #fff;
}

.training-step.locked {
  opacity: 0.74;
}

.training-action-dock {
  position: sticky;
  top: 78px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(45, 116, 167, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 255, 0.96)),
    #ffffff;
  box-shadow: 0 12px 28px rgba(16, 36, 60, 0.1);
  backdrop-filter: blur(14px);
}

.training-route-summary,
.training-action-dock,
.training-apply-confirmation,
.training-impact-panel,
.training-panel {
  scroll-margin-top: 156px;
}

.training-action-dock.ready {
  border-color: rgba(42, 163, 83, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 255, 249, 0.96)),
    #ffffff;
}

.training-action-dock.stale {
  border-color: rgba(242, 167, 27, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 250, 240, 0.96)),
    #ffffff;
}

.training-next-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px;
  min-width: 0;
}

.training-next-action span {
  grid-column: 1;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.training-next-action strong {
  grid-column: 1;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-next-action small {
  grid-column: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-dock-filter {
  grid-column: 2;
  grid-row: 1 / 4;
  align-self: center;
  justify-self: end;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid rgba(45, 116, 167, 0.14);
  border-radius: 8px;
  background: rgba(237, 247, 251, 0.74);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.training-dock-filter strong {
  min-height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--blue);
  font-size: 11px;
  line-height: 1.1;
  white-space: normal;
}

.training-dock-filter.active {
  border-color: rgba(45, 116, 167, 0.26);
  background: #ffffff;
}

.training-dock-filter button {
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid rgba(45, 116, 167, 0.2);
  border-radius: 999px;
  background: #ffffff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.training-dock-actions {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 8px;
  align-items: center;
}

.training-dock-actions button {
  min-height: 34px;
  white-space: nowrap;
}

.training-dock-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.training-apply-confirmation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(42, 163, 83, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(240, 255, 246, 0.96), rgba(255, 255, 255, 0.96)),
    #ffffff;
  box-shadow: 0 10px 24px rgba(42, 163, 83, 0.09);
}

.training-apply-confirmation > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.training-apply-confirmation span,
.training-apply-confirmation small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.training-apply-confirmation > div:first-child > span {
  color: var(--bull);
  font-size: 11px;
  font-weight: 900;
}

.training-apply-confirmation strong {
  color: var(--text);
  font-size: 16px;
}

.training-apply-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.training-apply-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(42, 163, 83, 0.14);
}

.training-apply-summary b {
  margin-left: 4px;
  color: var(--bull);
}

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

.training-apply-actions button {
  min-height: 34px;
  white-space: nowrap;
}

.training-impact-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(45, 116, 167, 0.18);
  border-radius: 8px;
  background: #ffffff;
}

.training-impact-panel > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.training-impact-panel header span {
  display: block;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.training-impact-panel header strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 16px;
}

.training-impact-panel header small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.training-impact-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.training-impact-metrics article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.training-impact-metrics span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.training-impact-metrics strong {
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.training-impact-metrics .up strong {
  color: var(--bull);
}

.training-impact-metrics .down strong {
  color: var(--bear);
}

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

.training-impact-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--neutral);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.training-impact-item:hover,
.training-impact-item:focus-visible {
  border-color: var(--blue);
  outline: none;
}

.training-impact-item.up {
  border-left-color: var(--bull);
}

.training-impact-item.down {
  border-left-color: var(--bear);
}

.training-impact-item span,
.training-impact-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-impact-item strong {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-impact-item em {
  color: var(--text);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
}

.training-impact-item b {
  color: var(--neutral);
}

.training-impact-item.up b {
  color: var(--bull);
}

.training-impact-item.down b {
  color: var(--bear);
}

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

.training-kpis article,
.training-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.training-kpis article {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.training-kpis span,
.training-panel header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.training-kpis strong {
  font-size: 24px;
  line-height: 1;
}

.training-kpis small,
.training-panel header small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.training-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 14px;
  align-items: start;
}

.training-main,
.training-side {
  display: grid;
  gap: 14px;
}

.training-panel {
  overflow: hidden;
}

.training-inspector {
  overflow: visible;
}

.training-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.training-panel header strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
}

.training-feature-list {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.training-feature-list.compact {
  padding-top: 0;
}

.training-profile-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.training-profile {
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.training-profile:hover,
.training-profile.active {
  border-color: var(--blue);
  background: #f4faff;
}

.training-profile.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.training-profile strong {
  font-size: 13px;
}

.training-profile span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.training-profile-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 0 12px 12px;
}

.training-profile-edit label {
  display: grid;
  gap: 5px;
}

.training-profile-edit label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.training-profile-edit input {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
}

.training-profile-edit > div {
  display: flex;
  gap: 8px;
}

.training-feature {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 44px minmax(160px, 1.2fr);
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.training-feature-list.compact .training-feature {
  grid-template-columns: minmax(88px, 0.8fr) 44px minmax(130px, 1.4fr);
}

.training-feature-list.compact .training-feature input {
  grid-column: 1 / -1;
}

.training-feature strong,
.training-sample strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.training-feature span,
.training-sample small,
.training-inspector-body p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.training-feature b {
  color: var(--blue);
  font-size: 18px;
  text-align: right;
}

.training-feature input,
.training-control input {
  width: 100%;
  accent-color: var(--blue);
}

.training-profile-page {
  gap: 18px;
}

.training-profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.training-profile-status .training-simple-actions {
  flex-wrap: wrap;
}

.training-profile-config,
.training-profile-generated {
  min-width: 0;
}

.training-profile-generated .training-simple-weight-list {
  max-height: 360px;
  overflow-y: auto;
}

.training-profile-page .training-feature-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.training-profile-page .training-feature {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) 44px minmax(120px, 1.4fr);
  gap: 10px;
  align-items: center;
}

.training-sample-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.training-sample-filter {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 12px 0;
}

.training-preview-notice {
  display: grid;
  gap: 4px;
  margin: 12px 12px 0;
  padding: 10px;
  border: 1px solid rgba(242, 167, 27, 0.32);
  border-radius: 8px;
  background: #fff9ec;
}

.training-preview-notice span,
.training-preview-notice small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.training-preview-notice strong {
  color: var(--text);
  font-size: 13px;
}

.training-filter-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
  min-width: 0;
  min-height: 62px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
}

.training-filter-button:hover,
.training-filter-button:focus-visible,
.training-filter-button.active {
  border-color: var(--blue);
  background: #f4faff;
  outline: none;
}

.training-filter-button.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.training-filter-button span,
.training-filter-button b,
.training-filter-button small {
  min-width: 0;
}

.training-filter-button span {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-filter-button b {
  display: inline-grid;
  min-width: 24px;
  min-height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #edf7fb;
  color: var(--blue);
  font-size: 12px;
}

.training-filter-button small {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-filter-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 12px 0;
  padding: 9px 10px;
  border: 1px solid rgba(45, 116, 167, 0.22);
  border-radius: 8px;
  background: #f6fbff;
}

.training-filter-status span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-filter-status strong {
  color: var(--blue);
}

.training-filter-status button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(45, 116, 167, 0.26);
  border-radius: 999px;
  background: #ffffff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.training-filter-status button:hover,
.training-filter-status button:focus-visible {
  border-color: var(--blue);
  background: #edf7fb;
  outline: none;
}

.training-sample-summary {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) repeat(3, auto) auto;
  gap: 8px;
  align-items: center;
  margin: 10px 12px 0;
  padding: 9px 10px;
  border: 1px solid rgba(100, 112, 132, 0.18);
  border-radius: 8px;
  background: #fbfdff;
}

.training-sample-summary span,
.training-sample-summary em {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-sample-summary strong {
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

.training-priority-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin: 10px 12px 0;
  padding: 9px 10px;
  border: 1px solid rgba(42, 163, 83, 0.24);
  border-radius: 8px;
  background: #f6fff9;
}

.training-priority-note span {
  color: var(--bull);
  font-size: 11px;
  font-weight: 900;
}

.training-priority-note strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-priority-note small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.training-priority-note button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(42, 163, 83, 0.28);
  border-radius: 999px;
  background: #ffffff;
  color: var(--bull);
  font-size: 12px;
  font-weight: 900;
}

.training-priority-note button:hover,
.training-priority-note button:focus-visible {
  border-color: var(--bull);
  background: #eaf7f0;
  outline: none;
}

.training-empty-results {
  grid-column: 1 / -1;
  display: grid;
  min-height: 96px;
  place-items: center;
  border: 1px dashed rgba(100, 112, 132, 0.32);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.training-sample {
  position: relative;
  display: grid;
  gap: 7px;
  min-height: 118px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.training-sample-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.training-sample:hover,
.training-sample.active {
  border-color: var(--blue);
  background: #f4faff;
}

.training-sample.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.training-sample.priority {
  border-color: rgba(42, 163, 83, 0.42);
}

.training-sample.priority.active {
  box-shadow:
    inset 3px 0 0 var(--bull),
    0 8px 18px rgba(42, 163, 83, 0.12);
}

.training-priority-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eaf7f0;
  color: var(--bull);
  font-size: 11px;
  font-weight: 900;
}

.training-delta-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--neutral);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.training-delta-badge.up {
  background: #eaf7f0;
  color: var(--bull);
}

.training-delta-badge.down {
  background: #fff0ef;
  color: var(--bear);
}

.training-sample-footer {
  display: grid;
  grid-template-columns: auto minmax(96px, 1fr);
  gap: 8px;
  align-items: end;
  min-width: 0;
  margin-top: auto;
}

.training-outcome {
  align-self: end;
  max-width: 100%;
  overflow: hidden;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-confidence-label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.training-confidence-label b {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-outcome.aligned {
  color: var(--green);
}

.training-outcome.conflicted {
  color: var(--red);
}

.training-outcome.weak {
  color: var(--muted);
}

.training-confidence,
.training-mini-summary i {
  display: block;
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.training-confidence::before,
.training-mini-summary i::before {
  display: block;
  width: var(--v);
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  content: "";
}

.training-control {
  display: grid;
}

.training-auto-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 12px 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.training-auto-summary > div:first-child {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.training-auto-summary strong {
  color: var(--text);
  font-size: 14px;
}

.training-auto-summary span,
.training-auto-summary small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.training-auto-badges,
.training-tag-list,
.training-market-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.training-auto-badges {
  justify-content: flex-end;
}

.training-auto-badges em,
.training-tag-list em,
.training-market-list em {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.training-auto-badges em:first-child {
  background: var(--blue);
  color: #ffffff;
}

.training-logic-strip {
  display: grid;
  gap: 10px;
  margin: 12px 12px 0;
  padding: 12px;
  border: 1px solid rgba(45, 116, 167, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(45, 116, 167, 0.06), rgba(45, 116, 167, 0.015)),
    #ffffff;
}

.training-logic-strip header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.training-logic-strip header strong {
  color: var(--text);
  font-size: 14px;
}

.training-logic-strip header span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.training-settings-dirty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(242, 167, 27, 0.36);
  border-radius: 8px;
  background: #fff8e8;
  color: var(--muted);
  font-size: 12px;
}

.training-settings-dirty span {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--amber);
  color: #ffffff;
  font-weight: 900;
}

.training-settings-dirty strong {
  color: var(--text);
}

.training-settings-dirty small {
  color: var(--muted);
  font-weight: 800;
}

.training-logic-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.training-logic-step {
  position: relative;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.training-logic-step:not(:last-child)::after {
  position: absolute;
  top: 18px;
  right: -11px;
  z-index: 1;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #edf7fb;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  line-height: 16px;
  text-align: center;
  content: ">";
}

.training-logic-step em {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.training-logic-step span,
.training-logic-step small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.training-logic-step strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-preset-row {
  display: grid;
  gap: 10px;
  padding: 12px 12px 0;
}

.training-preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px dashed rgba(45, 116, 167, 0.32);
  border-radius: 8px;
  background: #fbfdff;
  cursor: pointer;
  list-style: none;
}

.training-preset-head::-webkit-details-marker {
  display: none;
}

.training-preset-head::after {
  color: var(--blue);
  font-size: 14px;
  font-weight: 900;
  content: "+";
}

.training-preset-row[open] .training-preset-head::after {
  content: "-";
}

.training-preset-head strong {
  color: var(--text);
  font-size: 13px;
}

.training-preset-head span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.training-preset-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.training-tag-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px 12px 0;
}

.training-tag-map > div {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.training-tag-map > b {
  color: var(--blue);
  font-size: 18px;
  line-height: 1;
}

.training-tag-map span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.training-tag-map strong {
  color: var(--text);
  font-size: 14px;
}

.training-tag-map small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
}

.training-tag-list em {
  border: 1px solid rgba(45, 116, 167, 0.16);
  color: var(--blue);
}

.training-market-list em {
  border: 1px solid rgba(15, 23, 42, 0.12);
}

.training-market-list i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--market-color);
}

.training-compact-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 12px;
}

.training-compact-metrics span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(45, 116, 167, 0.14);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.training-compact-metrics b {
  margin-right: 4px;
  color: var(--blue);
}

.training-preset {
  display: grid;
  gap: 5px;
  min-width: 0;
  min-height: 104px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.training-preset:hover,
.training-preset.active {
  border-color: var(--blue);
  background: #f4faff;
}

.training-preset.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.training-preset span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.training-preset strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-preset small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.training-advanced-weights {
  display: grid;
  gap: 10px;
  margin: 0 12px 12px;
  border: 1px solid rgba(45, 116, 167, 0.16);
  border-radius: 8px;
  background: #fbfdff;
}

.training-advanced-weights > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.training-advanced-weights > summary::-webkit-details-marker {
  display: none;
}

.training-advanced-weights > summary::before {
  justify-self: center;
  grid-column: 3;
  grid-row: 1;
  color: var(--blue);
  font-size: 14px;
  font-weight: 900;
  content: "+";
}

.training-advanced-weights[open] > summary::before {
  content: "-";
}

.training-advanced-weights:not([open]) .training-weight-share,
.training-advanced-weights:not([open]) .training-feature-list {
  display: none;
}

.training-advanced-weights > summary span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.training-advanced-weights > summary strong {
  color: var(--text);
  font-size: 13px;
}

.training-advanced-weights > summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-advanced-weights > summary b {
  grid-column: 2;
  color: var(--blue);
  font-size: 12px;
  white-space: nowrap;
}

.training-advanced-weights .training-weight-share {
  margin: 0 10px;
}

.training-advanced-weights .training-feature-list {
  padding: 10px;
}

.training-config-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.training-control .training-config-grid label,
.training-control label.training-feature {
  padding: 10px;
}

.training-config-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.training-config-grid label span {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.training-config-grid label small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.training-weight-share {
  display: grid;
  gap: 8px;
  margin: 0 12px 12px;
  padding: 10px;
  border: 1px solid rgba(45, 116, 167, 0.16);
  border-radius: 8px;
  background: #f7fbff;
}

.training-weight-share header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.training-weight-share strong {
  color: var(--text);
  font-size: 13px;
}

.training-weight-share header span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.training-weight-stack {
  display: flex;
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef6;
}

.training-weight-stack i {
  display: block;
  flex: 0 0 var(--v);
  min-width: 2px;
  background: var(--feature-color);
}

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

.training-weight-tags span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid rgba(45, 116, 167, 0.12);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.training-weight-tags i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--feature-color);
}

.training-weight-tags b {
  color: var(--text);
  font-size: 11px;
}

.training-control label {
  display: grid;
  gap: 6px;
  padding: 12px 12px 0;
}

.training-control label span {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.training-control select {
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
}

.training-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
}

.training-actions .primary-button,
.training-actions .ghost-button,
.training-actions .secondary-action {
  width: 100%;
  min-height: 36px;
}

.training-actions .ghost-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.training-action-hint {
  margin: -4px 12px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.training-mini-summary {
  display: grid;
  gap: 5px;
  margin: 0 12px 12px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.training-mini-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.training-mini-summary strong {
  font-size: 22px;
  line-height: 1;
}

.training-confidence-note {
  margin: 0 12px 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.training-confidence-note summary {
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.training-confidence-note p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.training-inspector-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.training-inspector-body h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.4;
}

.training-inspector-body p {
  margin: 0;
}

.training-review-switcher {
  display: grid;
  grid-template-columns: minmax(82px, auto) minmax(0, 1fr) minmax(82px, auto);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(45, 116, 167, 0.16);
  border-radius: 8px;
  background: #f8fbfe;
}

.training-review-switcher span {
  min-width: 0;
  text-align: center;
}

.training-review-switcher strong,
.training-review-switcher small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-review-switcher strong {
  color: var(--navy);
  font-size: 14px;
  font-weight: 950;
}

.training-review-switcher small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.training-review-switcher button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(45, 116, 167, 0.22);
  border-radius: 7px;
  background: #ffffff;
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 950;
}

.training-review-switcher button:hover,
.training-review-switcher button:focus-visible {
  border-color: var(--blue);
  background: #edf7fb;
  outline: none;
  box-shadow: 0 0 0 3px rgba(45, 116, 167, 0.1);
}

.training-review-switcher button:disabled {
  border-color: rgba(100, 112, 132, 0.14);
  background: var(--surface-soft);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.68;
  box-shadow: none;
}

.training-inspector-nav {
  position: sticky;
  top: 58px;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: 0 10px 20px rgba(16, 36, 60, 0.08);
}

.training-inspector-nav button {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 7px;
  min-width: 0;
  min-height: 44px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.training-inspector-nav button:hover,
.training-inspector-nav button:focus-visible {
  border-color: rgba(45, 116, 167, 0.34);
  box-shadow: 0 0 0 3px rgba(45, 116, 167, 0.1);
}

.training-inspector-nav button.active,
.training-inspector-nav button[aria-current="step"] {
  border-color: rgba(45, 116, 167, 0.42);
  background: #edf7fb;
  box-shadow:
    inset 0 0 0 1px rgba(45, 116, 167, 0.12),
    0 8px 18px rgba(45, 116, 167, 0.12);
}

.training-inspector-nav b {
  grid-row: span 2;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-size: 11px;
}

.training-inspector-nav button.active b,
.training-inspector-nav button[aria-current="step"] b {
  background: var(--navy);
}

.training-inspector-nav span {
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-inspector-nav small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.training-inspector-nav button.active small,
.training-inspector-nav button[aria-current="step"] small {
  color: var(--blue);
}

.training-review-card {
  display: grid;
  gap: 10px;
  scroll-margin-top: 136px;
  padding: 12px;
  border: 1px solid rgba(45, 116, 167, 0.18);
  border-left: 4px solid var(--neutral);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(45, 116, 167, 0.05), rgba(45, 116, 167, 0.015)),
    #ffffff;
}

.training-review-card.up {
  border-left-color: var(--bull);
}

.training-review-card.down {
  border-left-color: var(--bear);
}

.training-review-card.flat {
  border-left-color: var(--neutral);
}

.training-review-head,
.training-review-meta,
.training-review-change {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.training-review-head span,
.training-review-head em,
.training-review-meta span,
.training-review-change small {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.training-review-card > strong {
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
}

.training-review-card.up > strong,
.training-review-card.up .training-review-change i {
  color: var(--bull);
}

.training-review-card.down > strong,
.training-review-card.down .training-review-change i {
  color: var(--bear);
}

.training-review-change {
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.training-review-change span {
  display: grid;
  gap: 2px;
}

.training-review-change span:last-child {
  text-align: right;
}

.training-review-change b {
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}

.training-review-change i {
  flex: 0 0 auto;
  min-width: 48px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--neutral);
  font-size: 13px;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.training-review-meta {
  flex-wrap: wrap;
}

.training-review-meta span {
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #edf7fb;
  color: var(--blue);
}

.training-matrix-impact-card {
  display: grid;
  gap: 10px;
  scroll-margin-top: 136px;
  padding: 12px;
  border: 1px solid rgba(100, 112, 132, 0.18);
  border-left: 4px solid var(--impact-color, var(--blue));
  border-radius: 8px;
  background: #ffffff;
}

.training-matrix-impact-head,
.training-matrix-impact-meta,
.training-matrix-path {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.training-matrix-impact-head span,
.training-matrix-impact-head em,
.training-matrix-impact-meta span,
.training-matrix-path small {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.training-matrix-impact-card > strong {
  color: var(--text);
  font-size: 15px;
}

.training-matrix-path {
  padding: 10px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(100, 112, 132, 0.06), rgba(45, 116, 167, 0.08)),
    var(--surface-soft);
}

.training-matrix-path span {
  display: grid;
  gap: 2px;
}

.training-matrix-path span:last-child {
  text-align: right;
}

.training-matrix-path b {
  color: var(--text);
  font-size: 15px;
}

.training-matrix-path i {
  flex: 0 0 auto;
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: var(--impact-color, var(--blue));
  color: #ffffff;
  font-style: normal;
  font-weight: 900;
}

.training-matrix-impact-meta {
  flex-wrap: wrap;
}

.training-matrix-impact-meta span {
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(45, 116, 167, 0.08);
  color: var(--blue);
}

.training-reason-card {
  display: grid;
  gap: 6px;
  scroll-margin-top: 136px;
  padding: 11px;
  border: 1px solid rgba(45, 116, 167, 0.2);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #f7fbff;
}

.training-reason-card span {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.training-reason-card strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.training-reason-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.training-result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.training-result-grid div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.training-result-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.training-result-grid dd {
  margin: 0;
  font-size: 16px;
  font-weight: 900;
}

.training-result-grid dd.up {
  color: var(--bull);
}

.training-result-grid dd.down {
  color: var(--bear);
}

.training-result-grid dd.flat {
  color: var(--neutral);
}

.training-market-match {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.training-market-match span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.training-market-match strong {
  color: var(--text);
  font-size: 12px;
  text-align: center;
}

.training-factor-bars {
  display: grid;
  gap: 8px;
}

.training-factor-bars div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 30px;
  gap: 8px;
  align-items: center;
}

.training-factor-bars span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.training-factor-bars i {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.training-factor-bars i::before {
  display: block;
  width: var(--v);
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  content: "";
}

.training-factor-bars b {
  color: var(--text);
  font-size: 12px;
  text-align: right;
}

.training-log ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  list-style: none;
}

.training-log li {
  padding: 9px 10px;
  border-left: 3px solid var(--blue);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.training-focus-pulse {
  animation: trainingFocusPulse 1.2s ease;
}

@keyframes trainingFocusPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(45, 116, 167, 0.32);
  }
  55% {
    box-shadow: 0 0 0 5px rgba(45, 116, 167, 0.14);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(45, 116, 167, 0);
  }
}

.detail-panel {
  position: sticky;
  top: 82px;
  display: grid;
  align-content: start;
  gap: 14px;
  max-height: calc(100vh - 98px);
  padding: 16px;
  overflow: auto;
}

#detailBody {
  display: grid;
  gap: var(--space-3);
  animation: detailFade var(--motion-state) var(--motion-ease) both;
}

@keyframes detailFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.detail-panel h2 {
  font-size: 18px;
  line-height: 1.4;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.bull {
  color: var(--bull);
  background: #eaf7f0;
}

.status-pill.bear {
  color: var(--bear);
  background: #fff0ef;
}

.status-pill.neutral {
  color: var(--neutral);
  background: #eef2f7;
}

.contrib-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.contrib-pill.bull {
  background: var(--bull);
}

.contrib-pill.bear {
  background: var(--bear);
}

.contrib-pill.neutral {
  background: var(--neutral);
}

.detail-summary {
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.conflict-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #fff;
}

.conflict-panel.quiet {
  border-left-color: var(--bull);
  background: #f7fbf8;
}

.conflict-panel.risk-low {
  border-left-color: var(--bull);
}

.conflict-panel.risk-mid {
  border-left-color: var(--amber);
}

.conflict-panel.risk-high {
  border-left-color: var(--bear);
}

.conflict-panel header,
.conflict-panel.quiet > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.conflict-panel strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}

.conflict-panel span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.conflict-panel header b {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 11px;
}

.conflict-list {
  display: grid;
  gap: 6px;
}

.conflict-item {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  text-align: left;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.conflict-item:hover {
  border-color: var(--blue);
  background: #fff;
  transform: translateX(2px);
}

.conflict-item span {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
}

.conflict-item.bull span {
  color: var(--bull);
}

.conflict-item.bear span {
  color: var(--bear);
}

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

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.meta-grid div {
  display: grid;
  gap: 2px;
}

.meta-grid-wide {
  grid-column: 1 / -1;
}

.meta-grid dt {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.meta-grid dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.detail-source-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(45, 116, 167, 0.24);
  border-radius: 6px;
  background: #eef7ff;
  color: var(--blue);
  text-decoration: none;
  font-size: 12px;
  font-weight: 900;
}

.detail-source-link:hover,
.detail-source-link:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(45, 116, 167, 0.14);
}

.source-link-missing {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.prediction-target-row {
  display: grid;
  gap: 6px;
  margin: 8px 0 10px;
}

.prediction-target-row > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.prediction-target-row p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.prediction-target-row b,
.prediction-target-row strong {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--target-color, #647084);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.prediction-target-row.empty strong {
  color: var(--muted);
  font-weight: 800;
}

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

.multi-tag-row.compact {
  max-width: 360px;
}

.multi-tag-chip,
.multi-tag-more {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.multi-tag-chip b {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  background: #eef7ff;
  color: var(--blue);
  font-size: 11px;
}

.multi-tag-chip em {
  padding: 0 8px;
  font-style: normal;
}

.multi-tag-more {
  padding: 0 8px;
  color: var(--muted);
}

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

.tag-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.detail-sub {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.detail-sub-row .detail-sub {
  margin: 0;
}

.score-help-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.score-help-toggle:hover,
.score-help-toggle[aria-expanded="true"] {
  border-color: rgba(45, 116, 167, 0.45);
  background: #eef7ff;
}

.detail-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 40px 16px;
  color: var(--muted);
  text-align: center;
}

.detail-empty svg {
  width: 36px;
  height: 36px;
  opacity: 0.6;
}

.detail-empty p {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

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

.metric-list {
  display: grid;
  gap: 10px;
}

.score-note {
  margin: -2px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(45, 116, 167, 0.14);
  border-radius: 8px;
  background: #f7fbff;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.score-note.is-hidden {
  display: none;
}

.score-note p {
  margin: 0 0 6px;
  color: var(--text);
  font-weight: 700;
}

.score-note dl {
  display: grid;
  gap: 5px;
  margin: 0;
}

.score-note dl div {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
}

.score-note dt {
  color: var(--text);
  font-weight: 800;
}

.score-note dd {
  margin: 0;
  min-width: 0;
}

.metric-list.compact {
  gap: 9px;
}

.metric-list.is-hidden {
  display: none;
}

.metric-row {
  display: grid;
  grid-template-columns: 58px minmax(72px, 1fr) 32px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.metric-row span:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
  color: var(--muted);
}

.metric-row span:first-child strong {
  color: var(--text);
  font-size: 12px;
}

.metric-row span:first-child em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1.25;
}

.metric-bar {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-soft);
}

.metric-bar i {
  display: block;
  width: var(--v);
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

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

.reason-list li {
  padding: 10px 12px;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 13px;
  line-height: 1.55;
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.drawer.open {
  display: block;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(16, 36, 60, 0.42);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  align-content: start;
  gap: var(--space-4);
  width: min(460px, 100%);
  height: 100%;
  padding: var(--space-4);
  overflow-y: auto;
  background: var(--surface);
  box-shadow: var(--shadow-raised);
}

.app-drawer-panel {
  width: min(500px, 100%);
}

.drawer-panel header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.drawer-panel header span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.drawer-panel header h2 {
  margin: 3px 0 0;
}

.drawer-panel header p {
  max-width: 34rem;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.app-drawer-body {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
}

.app-drawer-body > .control-group,
.app-drawer-body > .status-panel,
.app-drawer-body > .connect-form,
.app-drawer-generated {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

.app-drawer-body > .control-group {
  border-top: 1px solid var(--line);
}

.app-drawer-body [data-sidebar-owner-label]::before,
.app-drawer-body [data-sidebar-role]::after {
  display: none;
}

.app-drawer-body .control-group[data-sidebar-role="page"] {
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.app-drawer-empty {
  padding: 18px;
  border: 1px dashed rgba(100, 112, 132, 0.34);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.settings-home.app-drawer-generated,
.settings-secondary-nav.app-drawer-generated {
  padding: 0;
  border: 0;
  background: transparent;
}

.settings-home-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.settings-home-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: var(--space-3);
  min-height: 72px;
  padding: var(--space-3) var(--space-2);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.settings-home-row:hover,
.settings-home-row:focus-visible {
  background: var(--surface-soft);
}

.settings-home-row > i:first-child {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: var(--radius-control);
  background: var(--accent-soft);
  color: var(--accent);
}

.settings-home-row > span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.settings-home-row strong {
  font-size: var(--font-size-body);
}

.settings-home-row small {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--font-size-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-warning {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: var(--amber-soft);
  color: var(--amber-text);
  font-size: var(--font-size-xs);
  font-style: normal;
  font-weight: 900;
}

.settings-secondary-nav {
  display: flex;
  align-items: center;
  min-height: 36px;
}

.settings-back-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 14px 0 10px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition:
    background var(--motion-state),
    border-color var(--motion-state),
    box-shadow var(--motion-state),
    transform var(--motion-state);
}

.settings-back-button > i {
  width: 16px;
  height: 16px;
  padding: 2px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-text);
}

.settings-back-button:hover {
  border-color: var(--blue);
  background: var(--surface-soft);
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.12);
}

.settings-back-button:active {
  box-shadow: none;
  transform: translateY(1px);
}

.settings-back-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.commercial-usage.app-drawer-generated {
  display: grid;
  gap: 14px;
}

.commercial-usage-state {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.commercial-usage-state.is-error {
  border-color: color-mix(in srgb, var(--bear) 42%, var(--line));
}

.commercial-usage-state .secondary-action {
  justify-self: start;
}

.commercial-usage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.commercial-usage-head > div {
  display: grid;
  gap: 3px;
}

.commercial-usage-head strong {
  font-size: 20px;
}

.commercial-usage-head span,
.commercial-usage-head small {
  color: var(--muted);
}

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

.commercial-usage-metric {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.commercial-usage-metric.is-limit {
  border-color: color-mix(in srgb, var(--bear) 38%, var(--line));
}

.commercial-usage-metric span,
.commercial-usage-metric small {
  color: var(--muted);
}

.commercial-usage-metric .commercial-usage-reserved {
  color: var(--blue);
}

.commercial-beta-access {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--risk) 34%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--risk) 6%, var(--surface));
}

.commercial-beta-access.is-allowed {
  border-color: color-mix(in srgb, var(--blue) 40%, var(--line));
  background: color-mix(in srgb, var(--blue) 7%, var(--surface));
}

.commercial-beta-access.is-error {
  border-color: color-mix(in srgb, var(--bear) 42%, var(--line));
}

.commercial-beta-access > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.commercial-beta-access > header > div {
  display: grid;
  gap: 3px;
}

.commercial-beta-access small,
.commercial-beta-access > p {
  color: var(--muted);
}

.commercial-beta-access > p {
  margin: 0;
  font-size: 12px;
}

.commercial-beta-access-badge {
  flex: 0 0 auto;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.commercial-beta-invitation-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.commercial-beta-invitation-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.commercial-beta-invitation-form input {
  width: 100%;
  min-width: 0;
}

.commercial-beta-access-result {
  min-height: 18px;
}

.commercial-beta-access-result:empty {
  display: none;
}

.commercial-beta-access-result.is-error {
  color: var(--bear);
}

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

.commercial-beta-activation > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.commercial-beta-activation p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.commercial-beta-activation.is-activated {
  border-color: color-mix(in srgb, var(--blue) 38%, var(--line));
}

.commercial-beta-activation.is-missed {
  border-color: color-mix(in srgb, var(--bear) 42%, var(--line));
}

.commercial-usage-pack {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--blue) 38%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
}

.commercial-usage-pack > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.commercial-usage-pack span,
.commercial-usage-pack small,
.commercial-usage-pack-status {
  color: var(--muted);
}

.commercial-usage-pack-status {
  grid-column: 1 / -1;
  min-height: 18px;
  margin: 0;
  font-size: 12px;
}

.commercial-usage-pack-status:empty {
  display: none;
}

.commercial-usage-pack-status.is-error {
  color: var(--bear);
}

.commercial-usage-pack-history {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.commercial-usage-pack-history > header {
  display: grid;
  gap: 3px;
}

.commercial-usage-pack-history > header small,
.commercial-usage-pack-history-item small,
.commercial-usage-pack-history-state {
  color: var(--muted);
}

.commercial-usage-pack-history-list {
  display: grid;
  gap: 8px;
}

.commercial-usage-pack-history-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
}

.commercial-usage-pack-history-item > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.commercial-usage-pack-history-status {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.commercial-usage-pack-history-item[data-commercial-usage-pack-dispute="open"]
  .commercial-usage-pack-history-status,
.commercial-usage-pack-history-item[data-commercial-usage-pack-dispute="lost"]
  .commercial-usage-pack-history-status,
.commercial-usage-pack-history-state.is-error {
  color: var(--bear);
}

.commercial-usage-pack-history-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
}

.commercial-plan-limits {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.commercial-plan-limits > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.commercial-plan-limits > div + div {
  border-top: 1px solid var(--line);
}

.commercial-plan-limits dt,
.commercial-plan-limits dd {
  margin: 0;
}

.commercial-plan-limits dt,
.commercial-usage-note {
  color: var(--muted);
}

.commercial-usage-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 640px) {
  .commercial-usage-head {
    align-items: stretch;
    flex-direction: column;
  }

  .commercial-usage-grid {
    grid-template-columns: 1fr;
  }

  .commercial-beta-access > header,
  .commercial-beta-invitation-form {
    grid-template-columns: 1fr;
  }

  .commercial-beta-access > header {
    align-items: stretch;
    flex-direction: column;
  }

  .commercial-beta-invitation-form .secondary-action {
    width: 100%;
    justify-content: center;
  }

  .commercial-usage-pack {
    grid-template-columns: 1fr;
  }

  .commercial-beta-activation {
    grid-template-columns: 1fr;
  }

  .commercial-beta-activation .secondary-action {
    width: 100%;
    justify-content: center;
  }

  .commercial-usage-pack .secondary-action {
    width: 100%;
    justify-content: center;
  }
}

.settings-readonly-field,
.settings-topic-summary {
  display: grid;
  gap: 4px;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface-soft);
}

.settings-readonly-field > span,
.settings-topic-summary > span,
.settings-readonly-field > small {
  color: var(--muted);
  font-size: var(--font-size-xs);
}

.settings-readonly-field > strong,
.settings-topic-summary > strong {
  color: var(--text);
  font-size: var(--font-size-body);
}

.settings-preference-section {
  display: grid;
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}

.settings-preference-section > header {
  display: grid;
  gap: 3px;
}

.settings-preference-section > header strong {
  color: var(--text);
  font-size: var(--font-size-body);
}

.settings-preference-section > header small {
  color: var(--muted);
  font-size: var(--font-size-xs);
  line-height: 1.45;
}

.settings-account-links {
  display: grid;
  border-top: 1px solid var(--line);
}

.settings-account-links a {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  font-size: var(--font-size-sm);
  font-weight: 800;
  text-decoration: none;
}

.settings-account-links a:hover,
.settings-account-links a:focus-visible {
  color: var(--accent-text);
  background: var(--surface-soft);
}

.settings-account-links svg {
  width: 16px;
  height: 16px;
}

.settings-autosave-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: var(--font-size-xs);
  font-weight: 700;
  line-height: 1.5;
}

.settings-autosave-status[data-state="saving"] {
  color: var(--accent-text);
}

.settings-autosave-status[data-state="dirty"] {
  color: var(--amber-text);
}

.settings-autosave-status[data-state="saved"] {
  color: var(--bear-text);
}

.settings-autosave-status[data-state="error"] {
  color: var(--amber-text);
}

.source-settings-configuration {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
}

[data-processing-tools][hidden],
[data-ai-provider-field][hidden] {
  display: none !important;
}

.ai-advanced-settings {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ai-advanced-settings > summary {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.ai-advanced-settings > summary small {
  color: var(--muted);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.ai-advanced-settings-body {
  display: grid;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
}

.tag-combo-editor {
  gap: 14px;
}

.tag-editor-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tag-editor-summary strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.tag-editor-summary p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.tag-editor-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(45, 116, 167, 0.18);
  border-radius: 8px;
  background: #f8fbfe;
}

.tag-editor-preview span {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.tag-editor-preview b {
  color: var(--text);
  font-size: 16px;
}

.tag-editor-preview small {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-editor-field {
  display: grid;
  gap: 6px;
}

.tag-editor-field span,
.tag-editor-group h3 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.tag-editor-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tag-editor-list {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-height: min(44vh, 460px);
  overflow: auto;
  padding-right: 2px;
}

.tag-editor-group {
  display: grid;
  gap: 8px;
}

.tag-editor-group h3 {
  margin: 0;
}

.tag-editor-options {
  display: grid;
  gap: 8px;
}

.tag-editor-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tag-editor-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.tag-editor-option span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tag-editor-option strong,
.tag-editor-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-editor-option strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.tag-editor-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.tag-editor-option em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.08);
  color: var(--text);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

@media (max-width: 640px) {
  .tag-editor-summary,
  .tag-editor-actions {
    grid-template-columns: 1fr;
  }

  .tag-editor-summary {
    display: grid;
  }
}

.drawer-score-summary {
  display: grid;
  gap: 10px;
}

.drawer-score-summary h3,
.drawer-raw-news h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.drawer-score-summary p,
.drawer-raw-news p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.drawer-raw-news dl,
.drawer-score-summary dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.drawer-raw-news dl div,
.drawer-score-summary dl div {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.drawer-raw-news dt,
.drawer-score-summary dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.drawer-raw-news dd,
.drawer-score-summary dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.connect-form {
  display: grid;
  gap: 12px;
}

.connect-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.news-collection-settings {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(45, 116, 167, 0.24);
  border-radius: 8px;
  background: #f8fbff;
}

.news-collection-settings header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.news-collection-settings strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.news-collection-settings span,
.news-collection-workspace {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.news-collection-workspace {
  padding: 8px 10px;
  border: 1px dashed rgba(45, 116, 167, 0.28);
  border-radius: 8px;
  background: #ffffff;
}

.collection-wizard {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(102, 126, 234, 0.24);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f7f9ff);
}

.collection-wizard header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.collection-wizard strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.collection-wizard span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.collection-wizard-steps {
  display: grid;
  gap: 8px;
}

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

.collection-step.is-active {
  border-color: rgba(45, 116, 167, 0.38);
  box-shadow: 0 0 0 2px rgba(45, 116, 167, 0.08);
}

.collection-step.pending {
  border-color: rgba(214, 148, 40, 0.34);
  background: rgba(214, 148, 40, 0.06);
}

.collection-step.success {
  border-color: rgba(34, 163, 92, 0.28);
  background: rgba(34, 163, 92, 0.07);
}

.collection-step.error {
  border-color: rgba(227, 52, 52, 0.28);
  background: rgba(227, 52, 52, 0.07);
}

.collection-step-badge {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.collection-step-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.collection-step-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collection-step-copy span,
.collection-step-state {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.collection-step-state {
  font-weight: 800;
  white-space: nowrap;
}

.collection-wizard-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
  gap: 8px;
}

.collection-wizard-result {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.collection-wizard-result.success {
  border-color: rgba(34, 163, 92, 0.28);
  background: rgba(34, 163, 92, 0.08);
  color: var(--green);
}

.collection-wizard-result.error {
  border-color: rgba(227, 52, 52, 0.28);
  background: rgba(227, 52, 52, 0.08);
  color: var(--red);
}

.source-preset-import {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.source-package-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(45, 116, 167, 0.18);
  border-radius: 8px;
  background: var(--surface);
}

.source-package-panel-head strong,
.source-import-progress header strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.source-package-panel-head span,
.source-import-progress header span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-package-grid {
  display: grid;
  gap: 10px;
}

.source-package-card {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.source-package-card.is-previewing {
  border-color: rgba(45, 116, 167, 0.36);
  box-shadow: 0 0 0 2px rgba(45, 116, 167, 0.08);
}

.source-package-card header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.source-package-card header strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.source-package-card header span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-package-card header em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.source-package-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-package-meta span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

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

.source-package-actions .primary-button,
.source-package-actions .secondary-action {
  min-width: 0;
  justify-content: center;
  white-space: normal;
}

.source-package-preview {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px dashed rgba(45, 116, 167, 0.28);
  border-radius: 8px;
  background: var(--surface);
}

.source-package-preview.is-hidden {
  display: none;
}

.source-package-preview > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.source-package-preview ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-package-preview li {
  display: grid;
  gap: 2px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.source-package-preview li strong {
  color: var(--text);
  font-size: 12px;
}

.source-package-preview li span,
.source-package-preview li small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.source-import-progress {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.source-progress-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.source-progress-grid div {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.source-progress-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.source-progress-grid strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 16px;
}

.source-import-progress p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-import-progress[data-source-import-phase="error"],
.source-import-progress[data-source-import-phase="partial"] {
  border-color: rgba(227, 52, 52, 0.22);
}

.connect-form textarea {
  min-height: 92px;
  resize: vertical;
}

.source-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.source-status {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-status.success {
  border-color: rgba(34, 163, 92, 0.28);
  background: rgba(34, 163, 92, 0.08);
  color: var(--green);
}

.source-status.error {
  border-color: rgba(227, 52, 52, 0.28);
  background: rgba(227, 52, 52, 0.08);
  color: var(--red);
}

.translation-task-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.translation-task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.translation-task-head strong {
  color: var(--text);
  font-size: 13px;
}

.translation-task-head span {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(76, 111, 255, 0.12);
  color: var(--blue);
  font-size: 11px;
}

.translation-task-panel[data-translation-task-phase="success"]
  .translation-task-head
  span {
  background: rgba(34, 163, 92, 0.12);
  color: var(--green);
}

.translation-task-panel[data-translation-task-phase="partial"]
  .translation-task-head
  span {
  background: rgba(234, 179, 8, 0.14);
  color: #9a6a00;
}

.translation-task-panel[data-translation-task-phase="error"]
  .translation-task-head
  span {
  background: rgba(227, 52, 52, 0.12);
  color: var(--red);
}

.translation-task-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.translation-task-stats div {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.translation-task-stats span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.translation-task-stats strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 16px;
}

.translation-task-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.news-source-list {
  display: grid;
  gap: 10px;
}

.news-source-library {
  display: grid;
  gap: 10px;
}

.news-source-library-head {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.news-source-library-head strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.news-source-library-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.source-library-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-library-stats span {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 800;
}

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

.source-library-bulk-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.connect-form .source-select-all {
  grid-column: 1 / -1;
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: flex-start;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.source-library-bulk-actions .primary-button,
.source-library-bulk-actions .secondary-action {
  min-width: 0;
  width: 100%;
  justify-content: center;
  white-space: normal;
}

.source-table-scroll {
  width: 100%;
  overflow-x: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.news-source-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.news-source-table,
.news-source-table thead,
.news-source-table tbody {
  display: block;
}

.news-source-table thead {
  display: none;
}

.news-source-table tbody {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.news-source-table tr {
  display: grid;
  grid-template-columns: 28px auto minmax(0, 1fr);
  gap: 4px 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.news-source-table td {
  min-width: 0;
  padding: 0;
  border: 0;
  text-align: left;
  vertical-align: top;
}

.news-source-table td::before {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
  content: attr(data-label);
}

.news-source-table td:first-child::before,
.news-source-table td:nth-child(2)::before,
.news-source-table td:nth-child(3)::before,
.news-source-table td:nth-child(4)::before,
.news-source-table td:nth-child(8)::before {
  display: none;
}

.news-source-table td:first-child {
  grid-column: 1;
  grid-row: 1 / span 4;
  padding-top: 2px;
}

.news-source-table td:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}

.news-source-table td:nth-child(3) {
  grid-column: 3;
  grid-row: 1;
}

.news-source-table td:nth-child(4) {
  grid-column: 2 / -1;
  grid-row: 2;
}

.news-source-table td:nth-child(5),
.news-source-table td:nth-child(6),
.news-source-table td:nth-child(7) {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.news-source-table td:nth-child(5) {
  grid-column: 2 / -1;
  grid-row: 3;
}

.news-source-table td:nth-child(6) {
  grid-column: 2 / -1;
  grid-row: 4;
}

.news-source-table td:nth-child(7) {
  grid-column: 2 / -1;
  grid-row: 5;
}

.news-source-table td:nth-child(8) {
  grid-column: 2 / -1;
  grid-row: 6;
  margin-top: 4px;
}

.news-source-table tr.is-selected {
  background: rgba(45, 116, 167, 0.06);
}

.source-table-name,
.source-table-type {
  display: block;
}

.source-table-name {
  color: var(--text);
  font-size: 12px;
}

.source-table-type {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.source-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-table-actions .secondary-action {
  min-height: 30px;
  padding: 6px 8px;
}

.news-source-empty,
.news-source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.news-source-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.news-source-card {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.news-source-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.news-source-card header div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.news-source-card strong {
  color: var(--text);
  font-size: 13px;
}

.news-source-card header span,
.news-source-meta {
  color: var(--muted);
  font-size: 11px;
}

.source-status-pill {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.source-status-pill.online {
  border-color: rgba(34, 163, 92, 0.24);
  background: rgba(34, 163, 92, 0.09);
  color: var(--green);
}

.news-source-url {
  overflow: hidden;
  color: var(--blue);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.news-source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.source-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 760px) {
  .source-library-toolbar,
  .source-library-bulk-actions,
  .source-package-actions {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 1280px) {
  .workspace {
    grid-template-columns: minmax(240px, 252px) minmax(0, 1fr);
  }

  .detail-panel {
    position: static;
    grid-column: 1 / -1;
    max-height: none;
  }

  .stream-list {
    max-height: 200px;
  }

  .matrix-grid-row,
  .line-view,
  .history-layout,
  .history-snapshot-section,
  .training-layout {
    grid-template-columns: 1fr;
  }

  .history-kpis,
  .history-shared-db-strip,
  .training-kpis,
  .training-impact-metrics,
  .training-logic-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-news-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .training-action-dock {
    grid-template-columns: 1fr;
  }

  .training-route-summary {
    grid-template-columns: 1fr;
  }

  .training-route-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .training-layout.has-generated .training-main,
  .training-layout.has-generated .training-side {
    display: contents;
  }

  .training-layout.has-generated .training-sample-panel {
    order: 1;
  }

  .training-layout.has-generated .training-inspector {
    order: 2;
  }

  .training-layout.has-generated .training-control {
    order: 3;
  }

  .training-layout.has-generated .training-log {
    order: 4;
  }

  .training-logic-step:not(:last-child)::after {
    display: none;
  }

  .training-dock-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .training-apply-confirmation {
    grid-template-columns: 1fr;
  }

  .training-apply-summary,
  .training-apply-actions {
    justify-content: flex-start;
  }

  .training-preset-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .training-sample-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .training-impact-list {
    grid-template-columns: 1fr;
  }

  .history-market-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .training-profile-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-matrices {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .composite-head {
    grid-template-columns: 1fr;
  }

  .composite-stats {
    grid-template-columns: 1fr 1fr;
  }

  .composite-stats .stat-cell:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .training-flow {
    grid-template-columns: 1fr;
  }

  .training-step {
    padding: 10px;
  }
}

@media (max-width: 900px) {
  .topbar {
    position: static;
  }

  .training-inspector-nav {
    top: 10px;
  }

  .training-review-card,
  .training-matrix-impact-card,
  .training-reason-card {
    scroll-margin-top: 92px;
  }

  .topbar,
  .matrix-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .matrix-workbench {
    order: 1;
  }

  .matrix-analysis-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .matrix-impact-context {
    align-items: stretch;
    flex-direction: column;
  }

  .matrix-impact-selectors {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .matrix-impact-readout {
    min-width: 0;
    flex: 0 0 auto;
    text-align: left;
  }

  .matrix-category-tabs {
    width: 100%;
  }

  .matrix-analysis-actions {
    width: 100%;
    align-items: flex-end;
    justify-content: space-between;
  }

  .matrix-comparison-control {
    min-width: 0;
    flex: 1 1 auto;
  }

  .matrix-comparison-control select {
    width: 100%;
    min-width: 0;
  }

  .matrix-semantic-legend {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .history-workbench {
    order: 1;
    grid-column: 1 / -1;
  }

  .training-workbench {
    order: 1;
    grid-column: 1 / -1;
  }

  .training-simple-head,
  .training-simple-status,
  .training-simple-card header,
  .training-simple-market-head {
    flex-direction: column;
  }

  .training-simple-actions {
    justify-content: flex-start;
  }

  .training-simple-layout,
  .training-simple-selects,
  .snapshot-panel-grid,
  .snapshot-weight-list {
    grid-template-columns: 1fr;
  }

  .training-profile-layout {
    grid-template-columns: 1fr;
  }

  .training-profile-page .training-feature {
    grid-template-columns: 1fr;
  }

  .training-simple-market-head strong {
    white-space: normal;
  }

  .training-saved-run {
    grid-template-columns: 1fr;
  }

  .training-saved-run > span {
    text-align: left;
  }

  .training-saved-actions {
    justify-content: flex-start;
  }

  .detail-panel {
    order: 2;
  }

  .control-panel {
    order: 3;
    position: static;
    max-height: none;
  }

  .nav-actions,
  .category-matrices {
    grid-template-columns: 1fr;
  }

  .matrix-card,
  .composite-card {
    grid-column: 1 / -1 !important;
  }

  .view-tabs,
  .history-segment,
  .history-market-tabs,
  .history-timeline {
    width: 100%;
    overflow-x: auto;
  }

  .history-market-tabs {
    display: flex;
    padding-bottom: 2px;
  }

  .history-market-tabs button {
    min-width: 136px;
  }

  .training-head,
  .history-head {
    flex-direction: column;
  }

  .training-action-dock {
    position: sticky;
    top: 10px;
  }

  .training-route-summary,
  .training-action-dock,
  .training-apply-confirmation,
  .training-impact-panel,
  .training-panel {
    scroll-margin-top: 150px;
  }

  .training-auto-summary,
  .training-tag-map {
    grid-template-columns: 1fr;
  }

  .training-auto-badges {
    justify-content: flex-start;
  }

  .training-tag-map > b {
    display: none;
  }

  .history-head-actions {
    justify-items: start;
    width: 100%;
  }

  .history-timeline {
    display: flex;
    padding-bottom: 14px;
  }

  .history-timeline button {
    min-width: 120px;
  }

  .history-news-timeline button {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .history-news-meta {
    grid-template-columns: 1fr;
  }

  .history-shared-db-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-news-tags-cell {
    min-width: 220px;
  }

  .history-news-timeline em {
    justify-self: start;
  }
}

@media (max-width: 560px) {
  html,
  body,
  .app-shell {
    max-width: 100%;
    overflow-x: hidden;
  }

  h1 {
    font-size: 23px;
  }

  .composite-stats {
    grid-template-columns: 1fr;
  }

  .training-kpis,
  .history-kpis,
  .history-shared-db-strip,
  .history-news-toolbar,
  .history-param-grid,
  .training-impact-metrics,
  .training-route-steps,
  .training-logic-steps {
    grid-template-columns: 1fr;
  }

  .training-simple-readout,
  .training-simple-result-metrics,
  .training-simple-tag-grid,
  .training-simple-market-grid,
  .training-simple-guide,
  .training-simple-default-rule {
    grid-template-columns: 1fr;
  }

  .training-simple-weight {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .training-simple-weight > small {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .training-logic-strip header {
    align-items: flex-start;
    flex-direction: column;
  }

  .training-advanced-weights > summary {
    grid-template-columns: minmax(0, 1fr) 18px;
  }

  .training-advanced-weights > summary b {
    grid-column: 1;
  }

  .training-advanced-weights > summary::before {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
  }

  .training-feature,
  .training-dock-filter,
  .training-priority-note,
  .training-sample-footer,
  .training-sample-summary,
  .training-profile-list,
  .training-profile-edit,
  .training-preset-list,
  .training-tag-map,
  .training-sample-filter,
  .training-sample-list,
  .training-config-grid,
  .training-dock-actions,
  .training-route-actions,
  .training-actions {
    grid-template-columns: 1fr;
  }

  .training-profile-edit > div {
    display: grid;
    grid-template-columns: 1fr;
  }

  .training-next-action,
  .training-dock-filter {
    grid-template-columns: 1fr;
  }

  .training-dock-filter {
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
    width: 100%;
  }

  .training-feature b {
    text-align: left;
  }

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

  .history-news-timeline button {
    padding-left: 46px;
  }

  .history-news-timeline strong {
    white-space: normal;
  }

  .composite-stats .stat-cell:last-child {
    grid-column: auto;
  }

  .chip-row {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .chip {
    flex: 0 0 auto;
  }

  .top-actions > *,
  .primary-button,
  .ghost-button {
    width: 100%;
  }

.top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .icon-button {
    width: 100%;
  }

  .axis-matrix,
  .axis-matrix.compact {
    --axis-scale-width: 24px;
    --axis-gap: 4px;
    --grid-pad: 4px;
    --zone-cell: 12px;
    --zone-gap: 2px;
    --block-a-title: 20px;
    --block-a-subtitle: 13px;
    --block-b-title: 12px;
    --block-b-subtitle: 9px;
    --block-c-title: 10px;
    min-width: 0;
    min-height: var(--axis-mobile-min-height, 352px);
    zoom: 0.65;
  }

  .matrix-workbench,
  .matrix-card,
  .composite-card {
    max-width: 100%;
    overflow-x: auto;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
    overflow: visible;
  }

  .matrix-title,
  .composite-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .matrix-title-tools {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

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

/* React migration parity layer: keep the new workbench close to legacy chrome. */
.newsisagent-react-shell {
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: hidden;
}

.newsisagent-react-shell .matrix-combo-row,
.newsisagent-react-shell .view-tabs {
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.newsisagent-react-shell .matrix-card[data-panel-scale="2"] {
  grid-column: span 2;
}

.newsisagent-react-shell .matrix-card[data-panel-scale="3"] {
  grid-column: span 3;
}

.newsisagent-react-shell .matrix-card .matrix-drag-handle {
  cursor: grab;
}

.newsisagent-react-shell .matrix-card:active .matrix-drag-handle,
.newsisagent-react-shell .matrix-card.is-dragging .matrix-drag-handle {
  cursor: grabbing;
}

.newsisagent-react-shell .matrix-title,
.newsisagent-react-shell .composite-title {
  min-width: 0;
  overflow: hidden;
}

.newsisagent-react-shell .matrix-title-tools {
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.newsisagent-react-shell .matrix-mini-action {
  flex: 0 0 auto;
  pointer-events: auto;
  position: relative;
  z-index: 4;
}

.newsisagent-react-shell .history-hero,
.newsisagent-react-shell .training-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.newsisagent-react-shell .history-hero h1,
.newsisagent-react-shell .training-hero h1 {
  margin: 0;
}

.newsisagent-react-shell .history-hero span,
.newsisagent-react-shell .training-hero span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.newsisagent-react-shell .history-hero p,
.newsisagent-react-shell .training-hero p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.newsisagent-react-shell .history-main,
.newsisagent-react-shell .history-sidebar,
.newsisagent-react-shell .training-card,
.newsisagent-react-shell .training-review {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.newsisagent-react-shell .history-sidebar,
.newsisagent-react-shell .history-card,
.newsisagent-react-shell .training-card,
.newsisagent-react-shell .training-review {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.newsisagent-react-shell .history-sidebar label,
.newsisagent-react-shell .training-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.newsisagent-react-shell .training-simple-target-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.newsisagent-react-shell .training-simple-target-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.newsisagent-react-shell .history-sidebar select,
.newsisagent-react-shell .training-card input,
.newsisagent-react-shell .training-card select {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
}

.newsisagent-react-shell .training-weight-control span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.newsisagent-react-shell .training-weight-control b {
  color: var(--blue);
}

.newsisagent-react-shell .training-weight-control small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.newsisagent-react-shell .saved-profile-list,
.newsisagent-react-shell .training-table,
.newsisagent-react-shell .news-source-list {
  display: grid;
  gap: 8px;
}

.newsisagent-react-shell .saved-profile-list > div,
.newsisagent-react-shell .training-table > button,
.newsisagent-react-shell .news-source-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
}

.newsisagent-react-shell .saved-profile-list > div.active {
  border-color: rgba(45, 116, 167, 0.32);
  background: #f0f8ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.newsisagent-react-shell .saved-profile-list button,
.newsisagent-react-shell .news-source-item button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.newsisagent-react-shell .training-table > button.up {
  border-color: rgba(227, 52, 52, 0.22);
  background: rgba(227, 52, 52, 0.06);
}

.newsisagent-react-shell .training-table > button.down {
  border-color: rgba(34, 163, 92, 0.24);
  background: rgba(34, 163, 92, 0.07);
}

.newsisagent-react-shell .training-table > button.selected {
  border-color: rgba(45, 116, 167, 0.42);
  box-shadow:
    0 0 0 2px rgba(45, 116, 167, 0.14),
    inset 3px 0 0 var(--blue);
}

.newsisagent-react-shell .news-source-item {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

.newsisagent-react-shell .news-source-item div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.newsisagent-react-shell .news-source-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .newsisagent-react-shell .history-hero,
  .newsisagent-react-shell .training-hero {
    flex-direction: column;
  }

  .newsisagent-react-shell .history-layout,
  .newsisagent-react-shell .training-layout,
  .newsisagent-react-shell .training-simple-target-grid,
  .newsisagent-react-shell .news-source-item {
    grid-template-columns: 1fr;
  }

  .newsisagent-react-shell .matrix-card[data-panel-scale="2"],
  .newsisagent-react-shell .matrix-card[data-panel-scale="3"] {
    grid-column: auto;
  }
}

/* Today's Intelligence UX, Phase 1 */
.control-panel > .operator,
.control-panel > .sidebar-context-card,
.control-panel > .sidebar-quick-actions {
  display: none;
}

.workspace.is-radar-page {
  grid-template-columns: minmax(168px, 184px) minmax(0, 1fr);
}

.control-panel {
  padding: 10px;
}

.nav-actions {
  gap: 5px;
}

.nav-actions button {
  min-height: 42px;
  padding: 0 10px;
  border-radius: 6px;
}

.nav-actions button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-destination-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.settings-destination-grid button {
  justify-content: flex-start;
  min-width: 0;
  min-height: 40px;
}

.radar-source-health {
  font-size: 12px !important;
}

.radar-head-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(104px, 1fr));
  width: min(100%, 430px);
}

.radar-head-metrics > button {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.radar-head-metrics > button:hover,
.radar-head-metrics > button:focus-visible,
.radar-head-metrics > button[aria-pressed="true"] {
  border-color: #0f766e;
  box-shadow: inset 0 -2px #0f766e;
}

.radar-head-metrics span,
.radar-head-metrics small {
  color: var(--muted);
  font-size: 10px;
}

.radar-head-metrics strong {
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.radar-context-actions,
.radar-primary-actions,
.radar-onboarding-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.radar-context-actions {
  margin-left: auto;
}

.radar-context-date {
  align-self: end;
  min-height: 40px;
  padding: 11px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.radar-context-search {
  flex: 1 1 220px;
  min-width: 180px;
}

.radar-context-search input {
  width: 100%;
  min-height: 40px;
}

.radar-onboarding-actions {
  margin-top: 18px;
}

.radar-onboarding-actions .radar-login-link {
  margin-top: 0;
}

.radar-inbox {
  display: grid;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
}

.radar-event-section {
  min-width: 0;
  border-top: 1px solid var(--line);
}

.radar-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 13px 2px 11px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.radar-section-head > span {
  display: grid;
  gap: 2px;
}

.radar-section-head strong {
  font-size: 15px;
}

.radar-section-head small {
  color: var(--muted);
  font-size: 11px;
}

.radar-section-head b {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
}

.radar-section-head::after {
  content: "⌃";
  color: var(--muted);
  font-size: 14px;
}

.radar-event-section.is-collapsed .radar-section-head::after {
  content: "⌄";
}

.radar-section-items {
  margin: 0;
}

.radar-section-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.radar-change-card {
  box-shadow: none;
}

.radar-event-classification {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.radar-priority,
.radar-change-type {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--surface-soft);
}

.radar-priority.priority-needs-attention {
  background: var(--amber-soft);
  color: var(--amber-text);
}

.radar-priority.priority-worth-reviewing {
  background: #eff6ff;
  color: #1d4ed8;
}

.radar-priority.priority-general-update {
  color: #475569;
}

.radar-follow-action.is-active,
.radar-card-actions .is-active {
  border-color: var(--blue);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.radar-card-meta .radar-target {
  background: var(--surface-soft);
  box-shadow: inset 0 0 0 1px var(--line);
}

.radar-card-meta .radar-target.is-muted {
  color: var(--muted);
}

.radar-card-meta .radar-processing-stage {
  background: var(--amber-soft);
  color: #9a3412;
  box-shadow: inset 0 0 0 1px #fed7aa;
}

.radar-card-meta .radar-processing-failure {
  background: var(--danger-soft);
  color: var(--danger);
  box-shadow: inset 0 0 0 1px #fecaca;
}

.radar-card-meta .radar-processing-recovery {
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #fca5a5;
  border-radius: 5px;
  background: var(--surface);
  color: #b91c1c;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.radar-card-meta .radar-processing-recovery:hover {
  background: #fef2f2;
}

.matrix-head-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}


.radar-primary-actions {
  margin-top: 12px;
}

.radar-secondary-actions {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.radar-secondary-actions > summary {
  padding: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.radar-secondary-actions .radar-card-actions {
  margin-top: 8px;
}

.radar-empty-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  max-width: 1180px;
  margin: 0 auto 14px;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
}

:root[data-theme="dark"] .radar-priority.priority-needs-attention,
:root[data-theme="dark"] .radar-card-meta .radar-processing-stage {
  background: #3b2b12;
  color: #fcd34d;
}

:root[data-theme="dark"] .radar-priority.priority-worth-reviewing {
  background: #172f4f;
  color: #93c5fd;
}

:root[data-theme="dark"] .radar-priority.priority-general-update,
:root[data-theme="dark"] .radar-change-type {
  background: var(--surface-soft);
  color: var(--muted);
}

:root[data-theme="dark"] .radar-card-meta .radar-processing-failure {
  background: #451f24;
  color: #fca5a5;
  box-shadow: inset 0 0 0 1px #7f1d1d;
}

@media (max-width: 900px) {
  .radar-workbench {
    padding-bottom: 32px;
  }

  .radar-head-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: none;
  }

  .radar-context-actions {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .radar-head-metrics > button {
    padding: 8px;
  }

  .radar-head-metrics span,
  .radar-head-metrics small {
    font-size: 9px;
  }

  .radar-head-metrics strong {
    font-size: 19px;
  }

  .radar-primary-actions > button,
  .radar-empty-actions > button {
    flex: 1 1 140px;
  }

  .settings-destination-grid {
    grid-template-columns: 1fr;
  }

}

/* Today's Intelligence UX, Phase 2: Change Event detail and evidence */
.radar-review-layout {
  display: grid;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.radar-review-layout.has-detail {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 16px;
  max-width: 1460px;
}

.radar-review-layout > .radar-inbox,
.radar-review-layout .radar-change-list {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

.radar-review-layout.has-detail .radar-change-list {
  grid-template-columns: 1fr;
}

.radar-change-card {
  cursor: pointer;
}

.radar-change-card:focus-visible,
.radar-change-card.is-selected {
  border-color: #0f766e;
  outline: 2px solid rgb(15 118 110 / 18%);
  outline-offset: 1px;
}

.radar-change-card h2 > button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
}

.radar-change-card h2 > button:hover {
  color: #0f766e;
}

.radar-event-detail {
  position: sticky;
  top: 12px;
  align-self: start;
  max-height: calc(100dvh - 24px);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow-raised);
  color: var(--text);
}

.radar-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--line);
}

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

.radar-detail-head span,
.radar-detail-layer > header span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.radar-detail-head h2 {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.4;
}

.radar-detail-head > .icon-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
}

.radar-detail-status,
.radar-detail-primary-actions,
.radar-detail-secondary-actions,
.radar-source-fact-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.radar-detail-status {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.radar-detail-status span {
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
}

.radar-detail-status .tone-bull,
.radar-assessment-grid .tone-bull {
  color: #be123c;
}

.radar-detail-status .tone-bear,
.radar-assessment-grid .tone-bear {
  color: #047857;
}

.radar-detail-language {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  margin: 12px 16px 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.radar-detail-language button {
  min-height: 32px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.radar-detail-language button[aria-pressed="true"] {
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(15 23 42 / 12%);
  color: var(--text);
}

.radar-detail-primary-actions {
  padding: 10px 16px 14px;
}

.radar-detail-primary-actions > button {
  flex: 1 1 150px;
}

.radar-detail-layer {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 12px;
}

.radar-detail-layer:focus-visible,
.radar-detail-layer[data-radar-evidence-focused="true"] {
  outline: 2px solid rgb(15 118 110 / 22%);
  outline-offset: -3px;
}

.radar-detail-layer > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.radar-detail-layer > header h3 {
  margin: 2px 0 0;
  font-size: 15px;
}

.radar-detail-layer > header small {
  max-width: 180px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  text-align: right;
}

.radar-source-fact-list {
  display: grid;
  gap: 10px;
}

.radar-source-fact {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 11px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.radar-source-fact-media {
  position: relative;
  display: grid;
  align-content: center;
  min-height: 92px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.radar-source-fact-media img {
  width: 100%;
  height: 92px;
  object-fit: cover;
}

.radar-source-fact-media small {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 2px 4px;
  border-radius: 3px;
  background: rgb(15 23 42 / 76%);
  color: #fff;
  font-size: 8px;
}

.radar-source-fact-copy {
  min-width: 0;
}

.radar-source-fact-copy > header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
}

.radar-source-fact-copy h4,
.radar-source-fact-copy p,
.radar-ai-summary-copy p,
.radar-assessment-note p,
.radar-event-synopsis,
.radar-assessment-disclaimer {
  margin: 0;
}

.radar-source-fact-copy h4 {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.4;
}

.radar-source-fact-copy > p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.radar-source-fact-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
}

.radar-source-fact-meta a {
  color: #0f766e;
  font-weight: 700;
}

.radar-source-limitation {
  padding: 6px 8px;
  border-left: 3px solid #d97706;
  background: #fffbeb;
  color: #92400e !important;
}

.radar-event-synopsis,
.radar-ai-summary-copy,
.radar-assessment-note,
.radar-detail-facts > div {
  padding: 10px;
  border-left: 3px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.radar-ai-summary-copy,
.radar-assessment-note {
  display: grid;
  gap: 4px;
}

.radar-ai-summary-copy strong,
.radar-assessment-note strong {
  color: var(--text);
}

.radar-detail-facts {
  display: grid;
  gap: 6px;
  margin: 0;
}

.radar-detail-facts dt {
  color: var(--muted);
  font-size: 9px;
}

.radar-detail-facts dd {
  margin: 3px 0 0;
  color: var(--text);
}

.radar-fact-review {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.radar-fact-review > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.radar-fact-review strong {
  font-size: 11px;
}

.radar-fact-review small {
  max-width: 320px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.radar-fact-review-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.radar-fact-review-actions .ghost-action {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 10px;
}

.radar-fact-review-actions .ghost-action.is-error {
  border-color: rgb(185 28 28 / 45%);
  background: rgb(254 226 226 / 72%);
  color: #991b1b;
}

.radar-assessment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.radar-assessment-grid > div {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
}

.radar-assessment-grid span {
  color: var(--muted);
  font-size: 9px;
}

.radar-assessment-grid strong {
  font-size: 15px;
}

.radar-assessment-disclaimer {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.radar-impact-assessment-list {
  display: grid;
  gap: 10px;
}

.radar-impact-assessment-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.radar-impact-assessment-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.radar-impact-assessment-card > header h4 {
  margin: 2px 0;
  font-size: 14px;
}

.radar-impact-assessment-card > header span,
.radar-impact-assessment-card > header small {
  color: var(--muted);
  font-size: 9px;
}

.radar-impact-badges,
.radar-impact-actions,
.radar-impact-form > footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.radar-impact-badges {
  justify-content: flex-end;
}

.radar-impact-badges > span,
.radar-impact-badges > strong {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
  font-size: 9px;
}

.radar-impact-badges > strong {
  min-width: 25px;
  color: var(--text);
  text-align: center;
}

.radar-impact-badges [data-impact-provenance="user-override"] {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
  font-weight: 800;
}

.radar-impact-axis {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 9px;
}

.radar-impact-axis span:last-child {
  text-align: right;
}

.radar-impact-axis strong {
  padding: 3px 7px;
  border-inline: 1px solid var(--line);
  font-size: 10px;
  text-align: center;
}

.radar-impact-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.radar-impact-metrics > div {
  min-width: 0;
  padding: 7px;
  border-left: 2px solid var(--line);
  background: var(--surface-soft);
}

.radar-impact-metrics dt {
  color: var(--muted);
  font-size: 8px;
}

.radar-impact-metrics dd {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.radar-impact-base-value,
.radar-impact-assessment-error,
.radar-impact-operation-status {
  margin: 0;
  padding: 8px;
  border-left: 3px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.radar-impact-assessment-error,
.radar-impact-operation-status[data-tone="error"] {
  border-left-color: #ef4444;
  color: #b91c1c;
}

.radar-impact-operation-status[data-tone="success"] {
  border-left-color: #10b981;
  color: #047857;
}

.radar-impact-form {
  display: grid;
  gap: 10px;
  padding: 11px;
  border: 1px solid #f59e0b;
  background: #fffbeb;
}

.radar-impact-form > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.radar-impact-form > header > div {
  display: grid;
  gap: 3px;
}

.radar-impact-form > header span {
  color: #92400e;
  font-size: 9px;
  line-height: 1.45;
}

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

.radar-impact-form label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.radar-impact-form label > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.radar-impact-form select,
.radar-impact-form input,
.radar-impact-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.radar-impact-form select,
.radar-impact-form input {
  min-height: 34px;
  padding: 6px 8px;
}

.radar-impact-form textarea {
  min-height: 68px;
  padding: 8px;
  resize: vertical;
}

.radar-impact-form > footer {
  justify-content: flex-end;
}

:root[data-theme="dark"]
  .radar-impact-badges
  [data-impact-provenance="user-override"],
:root[data-theme="dark"] .radar-impact-form {
  background: #3b2b12;
  color: #fef3c7;
}

:root[data-theme="dark"] .radar-impact-form > header span {
  color: #fcd34d;
}

.radar-detail-secondary-actions {
  padding: 14px 16px 18px;
  border-top: 1px solid var(--line);
}

.radar-detail-secondary-actions button {
  flex: 1 1 120px;
}

.radar-detail-local-status {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 11px;
}

.radar-detail-local-status.is-error {
  border-color: #fca5a5;
  color: #b91c1c;
}

:root[data-theme="dark"] .radar-source-limitation {
  background: #3b2b12;
  color: #fcd34d !important;
}

@media (max-width: 1120px) {
  .radar-review-layout.has-detail {
    grid-template-columns: minmax(0, 1fr) minmax(330px, 380px);
  }
}

@media (max-width: 900px) {
  body.radar-detail-open {
    overflow: hidden;
  }

  .radar-review-layout.has-detail {
    display: block;
  }

  .radar-event-detail {
    position: fixed;
    inset: 0;
    z-index: 1200;
    width: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .radar-impact-metrics,
  .radar-impact-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .radar-source-fact {
    grid-template-columns: 1fr;
  }

  .radar-source-fact-media,
  .radar-source-fact-media img {
    height: 132px;
  }

  .radar-detail-layer > header {
    align-items: flex-start;
    flex-direction: column;
  }

  .radar-detail-layer > header small {
    max-width: none;
    text-align: left;
  }

  .radar-fact-review {
    align-items: stretch;
    flex-direction: column;
  }

  .radar-fact-review-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 520px) {
  .radar-impact-assessment-card > header {
    flex-direction: column;
  }

  .radar-impact-badges {
    justify-content: flex-start;
  }

  .radar-impact-axis {
    grid-template-columns: 1fr;
  }

  .radar-impact-axis span:last-child,
  .radar-impact-axis strong {
    text-align: left;
  }

  .radar-impact-axis strong {
    border-inline: 0;
    border-block: 1px solid var(--line);
  }

  .radar-impact-metrics,
  .radar-impact-form-grid {
    grid-template-columns: 1fr;
  }
}

/* Phase 4: source onboarding, AI boundary, and high-value preferences. */
.source-onboarding {
  display: grid;
  gap: 12px;
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--line);
}

.source-onboarding > header > div,
.source-advanced-options > summary {
  display: grid;
  gap: 3px;
}

.source-onboarding > header span,
.source-advanced-options > summary em,
.source-capability-preview > span,
.source-capability-preview > small {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.45;
}

.source-url-first-field {
  font-weight: 700;
}

.source-url-first-field input {
  margin-top: 6px;
}

.source-capability-preview {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  border-radius: 6px;
  background: var(--surface-soft);
}

.source-capability-preview[data-source-capability-state="ready"] {
  border-left-color: var(--bear);
}

.source-capability-preview[data-source-capability-state="error"] {
  border-left-color: var(--bull);
}

.source-capability-summary,
.source-capability-limitations,
.source-scope-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-capability-summary span,
.source-capability-limitations span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
}

.source-advanced-options {
  border-bottom: 1px solid var(--line);
}

.source-advanced-options > summary {
  padding: 12px 0;
  cursor: pointer;
}

.source-advanced-body {
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
}

.source-scope-tabs {
  margin-top: 12px;
}

.source-scope-tabs button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
}

.source-scope-tabs button.active {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
  color: var(--blue);
  font-weight: 800;
}

.source-scope-tabs button span {
  margin-left: 4px;
  color: var(--muted);
}

.source-scope-note,
.source-attention-reason {
  color: var(--muted);
  font-size: 11px;
}

.source-attention-reason {
  display: block;
  margin-top: 5px;
  color: #b45309;
}

.source-readonly-label {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  color: var(--muted);
  font-size: 11px;
}

.ai-basic-status {
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  border-left: 3px solid var(--bear);
  background: var(--surface-soft);
}

.ai-basic-status span,
.ai-basic-status small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.ai-basic-status small.error {
  color: var(--bull);
}

.ai-basic-status small.success {
  color: var(--bear);
}

.ai-byok-toggle {
  margin-top: 4px;
}

.ai-byok-fields {
  display: grid;
  gap: 10px;
  padding: 10px 0 2px 12px;
  border-left: 2px solid var(--line);
}

.ai-byok-fields[hidden],
#retryAiTaskButton[hidden] {
  display: none;
}

:root[data-density="compact"] .workspace {
  gap: 12px;
  padding: 12px;
}

:root[data-density="compact"] .control-panel,
:root[data-density="compact"] .matrix-workbench,
:root[data-density="compact"] .detail-panel {
  box-shadow: 0 8px 22px rgba(16, 36, 60, 0.06);
}

:root[data-density="compact"] .control-panel {
  gap: 8px;
  padding: 10px;
}

:root[data-density="compact"] .news-stream,
:root[data-density="compact"] .detail-body {
  padding: 10px;
}

:root[data-show-images="false"] [data-news-block-image],
:root[data-show-images="false"] .radar-source-fact-media {
  display: none !important;
}

@media (max-width: 700px) {
  .source-onboarding-actions > button,
  .source-scope-tabs > button {
    flex: 1 1 120px;
  }

  .source-capability-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phase 6: mobile navigation and accessibility contracts. */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1400;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--navy);
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.48);
  outline-offset: 2px;
}

.mobile-bottom-nav {
  display: none;
}

.matrix-mobile-readonly {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.command-palette {
  width: min(560px, calc(100vw - 24px));
  max-height: min(680px, calc(100dvh - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-raised);
}

.command-palette::backdrop {
  background: rgba(16, 36, 60, 0.52);
  backdrop-filter: blur(2px);
}

.command-palette > form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.command-palette header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.command-palette header span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.command-palette h2 {
  margin: 3px 0 0;
  font-size: 19px;
}

.command-search-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.command-search-field input {
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.command-search-field kbd {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
}

.command-list {
  display: grid;
  gap: 4px;
}

.command-list > button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.command-list > button:hover,
.command-list > button:focus-visible {
  border-color: rgba(15, 118, 110, 0.34);
  background: rgba(15, 118, 110, 0.08);
}

.command-list > button span {
  display: grid;
  gap: 2px;
}

.command-list > button small,
.command-empty {
  color: var(--muted);
  font-size: 11px;
}

.command-empty {
  margin: 0;
  padding: 14px;
  text-align: center;
}

body.app-drawer-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .app-shell {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  .control-panel > .nav-actions {
    display: none;
  }

  .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 18;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--surface-translucent);
    box-shadow: 0 -4px 16px rgba(16, 36, 60, 0.1);
    backdrop-filter: blur(14px);
  }

  .mobile-bottom-nav button {
    display: grid;
    min-width: 0;
    min-height: 50px;
    place-items: center;
    align-content: center;
    gap: 3px;
    padding: 4px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
  }

  .mobile-bottom-nav button span {
    overflow: hidden;
    max-width: 100%;
    font-size: 10px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-bottom-nav button.active,
  .mobile-bottom-nav button[aria-current="page"] {
    background: rgba(15, 118, 110, 0.1);
    color: #0f766e;
  }

  .matrix-workbench[data-mobile-readonly="true"] .matrix-card,
  .matrix-workbench[data-mobile-readonly="true"] .news-block {
    touch-action: pan-y;
  }

  .matrix-workbench[data-mobile-readonly="true"] .matrix-drag-handle,
  .matrix-workbench[data-mobile-readonly="true"] .matrix-scale-handle,
  .matrix-workbench[data-mobile-readonly="true"] [data-matrix-edit-layout],
  .matrix-workbench[data-mobile-readonly="true"] [data-matrix-save-layout] {
    display: none !important;
  }

  .app-drawer-panel {
    width: 100%;
  }

  .command-palette {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }
}

/* Professional intelligence workbench visual polish, Phase 7. */
.icon-button,
.ghost-button,
.nav-actions button,
.radar-change-card,
.radar-section-head,
.radar-state-panel,
.command-list > button {
  transition:
    color var(--motion-state) var(--motion-ease),
    border-color var(--motion-state) var(--motion-ease),
    background-color var(--motion-state) var(--motion-ease),
    box-shadow var(--motion-state) var(--motion-ease),
    transform var(--motion-state) var(--motion-ease);
}

.radar-change-card:hover {
  border-color: rgba(45, 116, 167, 0.42);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

#radarPage:not(.is-hidden),
.matrix-workbench:not(.is-hidden),
#historyPage:not(.is-hidden),
#trainingPage:not(.is-hidden) {
  animation: workbench-surface-enter var(--motion-state) var(--motion-ease)
    both;
}

.drawer.open .drawer-backdrop {
  animation: workbench-backdrop-enter var(--motion-state) var(--motion-ease)
    both;
}

.drawer.open .drawer-panel,
.radar-event-detail.is-entering {
  animation: workbench-panel-enter var(--motion-state) var(--motion-ease) both;
}

@keyframes workbench-surface-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes workbench-panel-enter {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes workbench-backdrop-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}
.history-range-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid #c7d7e8;
  border-radius: 6px;
  background: #f4f8fc;
  color: #17324d;
}

.history-range-notice > i {
  width: 18px;
  height: 18px;
  color: #356a9a;
}

.history-range-notice > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.history-range-notice strong,
.history-range-notice span {
  overflow-wrap: anywhere;
}

.history-range-notice span {
  color: #526a81;
  font-size: 12px;
}

@media (max-width: 720px) {
  .history-range-notice {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .history-range-notice .secondary-action {
    grid-column: 1 / -1;
    justify-self: stretch;
  }
}
