﻿:root {
  --bg: #0d1724;
  --panel-bg: #e8eff6;
  --panel-white: #ffffff;
  --ink: #0f1c2a;
  --blue: #1e7ee8;
  --orange: #ff972f;
  --border: #b4c2d1;
  --border-strong: #7f95ab;
  --muted: #506273;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI Variable", "Segoe UI", "Inter", sans-serif;
}

.glow {
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(70px);
  opacity: 0.22;
  z-index: 0;
}

.glow-a {
  width: 340px;
  height: 340px;
  left: -80px;
  top: -80px;
  background: #007df3;
}

.glow-b {
  width: 360px;
  height: 360px;
  right: -120px;
  top: 120px;
  background: #ff972f;
}

.app-shell {
  position: relative;
  z-index: 2;
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 18px 44px;
}

.topbar {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(5, minmax(110px, 130px));
  gap: 10px;
  align-items: center;
}

.logo-pill,
.nav-pill,
.menu-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-white);
}

.logo-pill {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 14px;
  color: #fff;
  background: #0c1218;
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}

.nav-pill,
.menu-pill {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-weight: 600;
  color: var(--ink);
  background: var(--panel-white);
  cursor: pointer;
}

.nav-pill.blue {
  background: var(--blue);
  color: #fff;
  border-color: #1767be;
  box-shadow: 0 1px 0 rgba(14, 63, 114, 0.32);
}

.tab-strip {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}

.tab-btn {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 16px;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-weight: 700;
  background: var(--panel-white);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.tab-btn.active {
  background: var(--blue);
  color: #fff;
}

.home-hero {
  margin-top: 14px;
  background: linear-gradient(135deg, #eef5fd 0%, #e3edf8 65%, #dce8f5 100%);
  margin-bottom: 35px;
}

.home-kicker {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #29445f;
  font-weight: 700;
}

.home-hero h1 {
  margin: 8px 0 0;
  font-size: clamp(1.45rem, 2.5vw, 2.1rem);
  line-height: 1.15;
}

.home-lead {
  margin: 12px 0 0;
  max-width: 78ch;
  font-size: 1rem;
  color: #2e455d;
}

.home-hero-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.home-card h2 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.home-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.home-card p {
  margin: 0 0 10px;
  color: #30475d;
  line-height: 1.45;
}

.facts-list,
.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.facts-list li {
  border: 1px solid #b6c3d1;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.facts-list li span {
  font-size: 0.9rem;
  color: #42586d;
}

.facts-list li strong {
  font-size: 0.92rem;
  color: #0f2940;
}

.plain-list li {
  border-left: 3px solid #7b98b6;
  padding-left: 10px;
  color: #2f475d;
}

.contact-list {
  display: grid;
  gap: 10px;
}

.contacts-grid {
  margin-top: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-contacts {
  margin-top: 12px;
  margin-bottom: 18px;
}

.home-funding {
  margin-top: 8px;
  margin-bottom: 6px;
  display: flex;
  justify-content: center;
}

.home-funding-logo {
  background-color: white;
  width: min(100%, 280px);
  height: auto;
  display: block;
  grid-column: 1 / -1;
  justify-self: center;
}

.hero-wrap {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 10px;
}

.hero-title-card,
.hero-steps-card {
  min-height: 176px;
  border-radius: 14px;
  border: 1px solid var(--border);
}

.hero-title-card {
  background: #090b0f;
  color: #fff;
  display: flex;
  align-items: center;
  padding: 18px;
}

.hero-title-card h1 {
  margin: 0;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-size: clamp(1.45rem, 2.2vw, 1.95rem);
  line-height: 1.15;
}

.hero-steps-card {
  background: var(--panel-bg);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.hero-steps-card ol {
  margin: 0;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-size: clamp(0.95rem, 1.35vw, 1.15rem);
  line-height: 1.4;
}

.panel {
  min-width: 0;
  background: var(--panel-bg);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.wizard-shell {
  margin-top: 14px;
}

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

.wizard-head h2 {
  margin: 0;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-size: 2.05rem;
  line-height: 1.1;
}

.wizard-stepper {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wizard-alert {
  position: relative;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid #f1b3b3;
  border-radius: 12px;
  background: #fff4f4;
  color: #d61f1f;
}

.wizard-alert::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 14px;
  height: 14px;
  background: #fff4f4;
  border-left: 1px solid #f1b3b3;
  border-bottom: 1px solid #f1b3b3;
  transform: translateX(-50%) rotate(-45deg);
}

.wizard-alert-icon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #e32222;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 auto;
}

.wizard-alert-text {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.report-status-alert {
  position: relative;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 12px;
}

.report-status-alert::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 14px;
  height: 14px;
  transform: translateX(-50%) rotate(-45deg);
}

.report-status-icon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 auto;
}

.report-status-text {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.report-status-alert.warning {
  border: 1px solid #f2cc80;
  background: #fff7e8;
  color: #9a5a00;
}

.report-status-alert.warning::after {
  background: #fff7e8;
  border-left: 1px solid #f2cc80;
  border-bottom: 1px solid #f2cc80;
}

.report-status-alert.warning .report-status-icon {
  background: #f0ad00;
}

.report-status-alert.success {
  border: 1px solid #9fd7a9;
  background: #effcf2;
  color: #1f6b2d;
}

.report-status-alert.success::after {
  background: #effcf2;
  border-left: 1px solid #9fd7a9;
  border-bottom: 1px solid #9fd7a9;
}

.report-status-alert.success .report-status-icon {
  background: #2e9e44;
}

.report-status-alert.error {
  border: 1px solid #f1b3b3;
  background: #fff4f4;
  color: #d61f1f;
}

.report-status-alert.error::after {
  background: #fff4f4;
  border-left: 1px solid #f1b3b3;
  border-bottom: 1px solid #f1b3b3;
}

.report-status-alert.error .report-status-icon {
  background: #e32222;
}

.copy-mouse-hint {
  position: fixed;
  z-index: 1500;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -130%) scale(0.98);
  transition: opacity 0.12s ease, transform 0.12s ease;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #1767be;
  background: #007df3;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.copy-mouse-hint.visible {
  opacity: 1;
  transform: translate(-50%, -130%) scale(1);
}

.wizard-chip {
  border: 1px solid #b3c2d0;
  border-radius: 10px;
  padding: 7px 12px;
  background: #f3f7fb;
  color: #405366;
  font-size: 0.92rem;
  font-weight: 600;
}

.wizard-chip.active {
  border-color: #2f73b8;
  background: #deecfb;
  color: #173d62;
}

.wizard-step {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.wizard-nav {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stats-strip {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  background: #f7fbff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.mode-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mode-option {
  border: 1px solid #b7c5d2;
  border-radius: 10px;
  background: #f9fcff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.mode-option:has(input:checked) {
  border-color: #2f73b8;
  background: #deecfb;
}

.mode-option input {
  width: auto;
}

.mode-option-disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.mode-option-disabled span {
  color: #6b7c8c;
}

.title-strip {
  margin-top: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  align-items: center;
  gap: 12px;
  background: #f7fbff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.title-strip label {
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  background: var(--panel-white);
  color: var(--ink);
}

textarea {
  min-height: 146px;
  resize: vertical;
}

.ingest-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

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

.card h3,
.settings-card h3,
.run-card h3,
.analysis-panel h2,
.results-head h2,
.report-panel h3,
.history-panel h2 {
  margin: 0 0 10px;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-size: 1.26rem;
}

.upload-actions,
.action-row,
.field-row,
.load-run-row,
.history-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.history-head {
  justify-content: space-between;
}

.file-list {
  margin-top: 10px;
  min-height: 24px;
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}

.chip-btn,
.chip-link {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 9px 14px;
  background: var(--panel-white);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chip-btn.blue {
  background: var(--blue);
  color: #fff;
  border-color: #1767be;
  box-shadow: 0 1px 0 rgba(14, 63, 114, 0.32);
}

.chip-btn.black {
  background: #111;
  color: #fff;
}

.chip-btn.warn,
.chip-btn.demo {
  background: var(--orange);
}

.chip-btn.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.analysis-panel {
  margin-top: 0;
}

.analysis-head {
  margin-bottom: 8px;
}

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

.module-row {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.module-title {
  margin: 0;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-size: 1.05rem;
}

.module-desc {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.toggle-wrap input {
  display: none;
}

.toggle-ui {
  width: 54px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  position: relative;
  background: #fff;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #bbb;
  transition: all 0.2s ease;
}

.toggle-wrap input:checked + .toggle-ui {
  background: #dbeaff;
}

.toggle-wrap input:checked + .toggle-ui::after {
  left: 28px;
  background: var(--blue);
}

.control-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.muted {
  color: var(--muted);
  margin: 6px 0 0;
  font-size: 0.93rem;
}

.run-progress {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.run-progress-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #bfd6ef;
  border-top-color: #007df3;
  animation: run-progress-spin 0.8s linear infinite;
}

.run-progress-note {
  margin-top: 0;
}

@keyframes run-progress-spin {
  to {
    transform: rotate(360deg);
  }
}

.history-load-state {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 600;
}

.history-load-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #bfd6ef;
  border-top-color: #007df3;
  animation: run-progress-spin 0.8s linear infinite;
}

.hidden {
  display: none;
}

.results-zone {
  margin-top: 14px;
}

.results-load-state {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 88px;
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 600;
}

.results-load-state.hidden {
  display: none;
}

.results-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.results-filter-bar {
  margin-top: 10px;
}

.results-filter-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.results-filter-group {
  border: 1px solid #9fb2c4;
  background: rgba(255, 255, 255, 0.64);
  border-radius: 10px;
  padding: 10px;
}

.results-filter-group strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.results-filter-group .field-row {
  gap: 6px;
}

.results-filter-group label {
  font-weight: 600;
  font-size: 0.88rem;
}

.results-filter-group .field-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.results-filter-group input[type="date"],
.results-filter-group input[type="text"] {
  width: auto;
  min-width: 132px;
}

.results-filter-group input[type="checkbox"] {
  width: auto;
  min-width: 0;
}

.ner-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.ner-control-card {
  border: 1px solid #9fb2c4;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  padding: 10px;
}

.ner-control-card h4 {
  margin: 0 0 8px;
  font-size: 0.92rem;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
}

.ner-date-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ner-date-row label {
  font-weight: 600;
  font-size: 0.86rem;
}

.ner-slider-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.84rem;
  color: #486074;
  margin-bottom: 6px;
}

.ner-range-stack {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 6px 8px;
  align-items: center;
}

.ner-range-stack label {
  font-weight: 600;
  font-size: 0.84rem;
  color: #3b5063;
}

.ner-range-stack input[type="range"] {
  width: 100%;
  min-width: 0;
}

.ner-type-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ner-type-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #9aaec0;
  border-radius: 8px;
  background: #fff;
  padding: 5px 9px;
  font-size: 0.9rem;
  font-weight: 600;
}

.ner-type-pill:has(input:checked) {
  border-color: #2f73b8;
  background: #deecfb;
}

.ner-type-pill input[type="checkbox"] {
  width: auto;
  min-width: 0;
}

.ner-name-filter-wrap {
  display: grid;
  gap: 8px;
}

.ner-name-filter-wrap input[type="text"] {
  width: 100%;
}

.ner-name-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ner-name-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #2f73b8;
  border-radius: 999px;
  background: #eaf3fc;
  color: #0f3f68;
  padding: 2px 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

.ner-name-chip-remove {
  border: 0;
  background: transparent;
  color: #0f3f68;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1;
  padding: 0;
}

.demo-badge {
  border: 1px solid #245f9d;
  border-radius: 999px;
  padding: 7px 10px;
  background: #dbeaff;
  color: #12375a;
  font-weight: 700;
  font-size: 0.82rem;
}

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

.kpi-card {
  background: #0e151d;
  border: 1px solid #2b3845;
  color: #fff;
  border-radius: 14px;
  padding: 10px;
}

.kpi-card .k {
  color: #b7d4f8;
  font-size: 0.85rem;
}

.kpi-card .v {
  margin-top: 6px;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-size: 1.2rem;
}

.chart-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.chart-wide {
  grid-column: 1 / -1;
}

.chart-card canvas {
  display: block;
  width: 100%;
  height: 220px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #94a6b4;
  border-radius: 12px;
}
.variable-summary {
  height: 220px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #94a6b4;
  border-radius: 12px;
  padding: 10px;
  overflow: auto;
  display: grid;
  gap: 10px;
  align-content: start;
}

.variable-group {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #a4b4c1;
  border-radius: 10px;
  padding: 8px 10px;
}

.variable-group h4 {
  margin: 0 0 6px;
  font-size: 0.92rem;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
}

.variable-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.variable-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
}

.variable-key {
  color: #243440;
  overflow-wrap: anywhere;
}

.variable-key.def-link {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: #1d4f7c;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.variable-key.def-link:hover {
  color: #0b3e6c;
}

#narrativesChart {
  cursor: pointer;
}

.variable-count {
  min-width: 24px;
  text-align: right;
  border-radius: 999px;
  background: #e8f1fa;
  border: 1px solid #9ab3c8;
  padding: 1px 7px;
  font-weight: 700;
  color: #0e3048;
}

.variable-empty {
  color: #5f6f7d;
  font-size: 0.9rem;
}

.ner-graph {
  width: 100%;
  height: 630px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #94a6b4;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  cursor: grab;
}

.ner-graph.dragging {
  cursor: grabbing;
}

.ner-graph svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ner-entity-details {
  margin-top: 10px;
  border: 1px solid #9fb2c4;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px;
}

.ner-entity-details h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.ner-entity-list {
  display: grid;
  gap: 8px;
}

.ner-entity-item {
  border: 1px solid #b2c0cd;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.ner-entity-item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 700;
}

.ner-entity-item-excerpt {
  margin-top: 6px;
  font-size: 0.86rem;
  color: #334655;
}

.ner-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #5c6d7d;
  font-weight: 600;
}

@media (max-width: 1080px) {
  .chart-card canvas {
    height: 190px;
  }

  .ner-graph {
    height: 340px;
  }
}

.docs-grid,
.history-list {
  display: grid;
  gap: 10px;
}

.doc-card,
.history-card {
  border: 1px solid #9aaab8;
  background: rgba(255, 255, 255, 0.74);
  border-radius: 12px;
  padding: 10px;
}

.history-card[data-open-history] {
  cursor: pointer;
}

.doc-head,
.history-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-weight: 700;
}

.doc-excerpt {
  margin: 8px 0;
  background: #fff;
  border: 1px solid #b3c1cd;
  border-radius: 10px;
  padding: 8px;
  max-height: 120px;
  overflow: auto;
}

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

.doc-chip {
  border-radius: 999px;
  border: 1px solid #8ea0af;
  background: #fff;
  padding: 4px 8px;
  font-size: 0.82rem;
}

.doc-chip.def-chip {
  cursor: pointer;
}

.doc-chip.def-chip:hover {
  border-color: #2f73b8;
  background: #eaf3fc;
}

.result-def-hint {
  position: fixed;
  z-index: 1500;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -128%) scale(0.98);
  transition: opacity 0.12s ease, transform 0.12s ease;
  max-width: min(420px, 90vw);
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #2f73b8;
  background: #f4f9ff;
  color: #13385c;
  font-size: 0.86rem;
  line-height: 1.35;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.result-def-hint.visible {
  opacity: 1;
  transform: translate(-50%, -128%) scale(1);
}

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

.override-grid label {
  font-size: 0.82rem;
  font-weight: 600;
  display: block;
}

.override-grid input {
  margin-top: 3px;
  font-size: 0.9rem;
}

.report-box {
  margin-top: 10px;
  border: 1px solid #20354a;
  background: #0d1420;
  color: #eef4ff;
  border-radius: 12px;
  padding: 10px;
}

.report-box h4 {
  margin: 10px 0 6px;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
}

.report-box ul {
  margin: 0;
  padding-left: 20px;
}

.history-title {
  margin: 0 0 6px;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-size: 1.1rem;
}

.history-kind {
  border-radius: 999px;
  border: 1px solid #7f92a2;
  padding: 2px 8px;
  font-size: 0.78rem;
  background: #fff;
}

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

  .hero-wrap,
  .ingest-grid,
  .control-grid,
  .chart-grid,
  .results-filter-groups,
  .ner-controls,
  .override-grid,
  .kpi-grid,
  .title-strip {
    grid-template-columns: 1fr;
  }

  .title-strip label {
    font-size: 1.05rem;
  }

  .stats-strip,
  .mode-picker {
    grid-template-columns: 1fr;
  }

  .home-grid,
  .contacts-grid {
    grid-template-columns: 1fr;
  }
}


.stat-line {
  margin: 0;
}

.history-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.history-controls label {
  font-size: 0.9rem;
  font-weight: 600;
}

.history-controls select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  background: #fff;
  font: inherit;
}


.docs-toggle {
  width: 100%;
}

.docs-toggle summary {
  list-style: none;
  cursor: pointer;
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.docs-toggle summary::-webkit-details-marker {
  display: none;
}

.docs-toggle summary::after {
  content: "+";
  font-size: 1.25rem;
  line-height: 1;
}

.docs-toggle[open] summary::after {
  content: "-";
}

.docs-toggle #documents {
  margin-top: 10px;
}

.documents-panel {
  margin-top: 10px;
  margin-bottom: 10px;
}

.history-summary {
  border: 1px solid #8ea0af;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  padding: 8px 10px;
  margin: 10px 0;
  color: #23303c;
  font-size: 0.92rem;
}

.history-toggle-body {
  margin-top: 10px;
}





#keyStatus {
  overflow-wrap: anywhere;
  word-break: break-word;
}
