body {
  font-family: Arial, sans-serif;
  background: #0b1020;
  color: #e8eefc;
  margin: 0;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

h1 {
  margin: 0 0 20px;
}

.controls {
  margin-bottom: 20px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #dbe7ff;
}

input, select, button {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #334;
  background: #11182d;
  color: #e8eefc;
}

button {
  cursor: pointer;
}

button:hover {
  background: #16213d;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background: #121a30;
  border: 1px solid #243250;
  border-radius: 16px;
  padding: 16px;
  min-height: 86px;
}

.label {
  color: #9ab0d6;
  font-size: 13px;
  margin-bottom: 8px;
}

.value {
  font-size: 28px;
  font-weight: 700;
}

.chart-panel, .table-panel {
  background: #121a30;
  border: 1px solid #243250;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
}

#trendChart {
  height: 420px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid #243250;
  padding: 10px 8px;
  font-size: 13px;
  text-align: right;
}

th:first-child, td:first-child {
  text-align: left;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.num-neg {
  color: #fca5a5;
}

.num-pos {
  color: #86efac;
}

.num-muted {
  color: #94a3b8;
}

.hit-yes {
  color: #86efac;
  font-weight: 700;
}

.hit-no {
  color: #fca5a5;
  font-weight: 700;
}

.hit-na {
  color: #94a3b8;
}

.status-banner {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #243250;
  background: #11182d;
  color: #cbd5e1;
  font-size: 13px;
}

.status-banner.warn {
  border-color: #6b5d22;
  background: #1b1a12;
  color: #fde68a;
}

.status-banner.error {
  border-color: #5c2631;
  background: #1f1216;
  color: #fecaca;
}

.status-banner.ok {
  border-color: #21403a;
  background: #0f1d1b;
  color: #bbf7d0;
}

.single-point-note {
  margin-top: 10px;
  font-size: 12px;
  color: #9ca3af;
}

.coverage-panel {
  background: linear-gradient(180deg, rgba(18,26,48,1) 0%, rgba(15,22,42,1) 100%);
}

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

.coverage-title {
  font-size: 24px;
  font-weight: 700;
}

.coverage-subtitle,
.coverage-footnote {
  font-size: 12px;
  color: #93a4c8;
}

.coverage-badge {
  min-width: 92px;
  text-align: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
}

.coverage-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) minmax(300px, 1fr);
  gap: 14px;
  align-items: stretch;
}

.coverage-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.coverage-card {
  border: 1px solid #243250;
  border-radius: 16px;
  background: rgba(17, 24, 45, 0.92);
  padding: 16px;
}

.coverage-card-primary {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 138px;
}

.coverage-card.compact {
  min-height: 104px;
}

.coverage-rate-value {
  font-size: 42px;
  line-height: 1;
  font-weight: 800;
  margin-bottom: 12px;
}

.coverage-list-block {
  margin-top: 14px;
  border-top: 1px solid #243250;
  padding-top: 14px;
}

.coverage-list-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
}

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

.ticker-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(127, 29, 29, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.26);
  color: #fecaca;
  font-size: 12px;
  font-weight: 700;
}

.ticker-badge.ok {
  background: rgba(20, 83, 45, 0.25);
  border-color: rgba(74, 222, 128, 0.28);
  color: #bbf7d0;
}

.tone-good {
  color: #86efac;
}

.tone-warn {
  color: #fde68a;
}

.tone-bad {
  color: #fca5a5;
}

.tone-neutral {
  color: #cbd5e1;
}

.coverage-badge.tone-good {
  background: rgba(20, 83, 45, 0.22);
  border-color: rgba(74, 222, 128, 0.28);
}

.coverage-badge.tone-warn {
  background: rgba(120, 53, 15, 0.22);
  border-color: rgba(251, 191, 36, 0.28);
}

.coverage-badge.tone-bad {
  background: rgba(127, 29, 29, 0.22);
  border-color: rgba(248, 113, 113, 0.28);
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.table-summary {
  color: #9ab0d6;
  font-size: 13px;
}

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

.filter-chip {
  border: 1px solid #334155;
  background: #0f172a;
  color: #cbd5e1;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
}

.filter-chip.active {
  background: #1d4ed8;
  border-color: #2563eb;
  color: #eff6ff;
}

/* V4 Summary patch */
.model-summary-panel {
  margin-top: 20px;
}

.panel-title {
  font-size: 28px;
  font-weight: 800;
  color: #f4f7ff;
  margin-bottom: 6px;
}

.panel-subtitle {
  color: #9eb0d3;
  font-size: 13px;
  margin-bottom: 16px;
}

.summary-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.summary-metric-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.summary-metric-card {
  background: rgba(18, 29, 61, 0.9);
  border: 1px solid rgba(96, 122, 189, 0.28);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.summary-metric-label {
  font-size: 12px;
  color: #97abd6;
  margin-bottom: 8px;
}

.summary-metric-value {
  font-size: 30px;
  font-weight: 800;
  color: #eef4ff;
  line-height: 1.1;
}

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

.summary-footnote {
  color: #8fa3cc;
  font-size: 12px;
  margin-top: 6px;
}

.summary-metric-card.tone-good .summary-metric-value {
  color: #98f0b2;
}

.summary-metric-card.tone-bad .summary-metric-value {
  color: #ffb0b0;
}

.summary-metric-card.tone-warn .summary-metric-value {
  color: #ffe08a;
}

@media (max-width: 1100px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 900px) {
  .summary-matrix-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .summary-metric-value {
    font-size: 24px;
  }
}

@media (max-width: 700px) {
  .cards,
  .coverage-stack {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 16px;
  }

  th, td {
    padding: 8px 6px;
    font-size: 12px;
  }

  .value {
    font-size: 24px;
  }

  .coverage-rate-value {
    font-size: 34px;
  }

  .coverage-header,
  .coverage-list-header,
  .table-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* V3 Phase 1 interaction layer */
.ticker-badge.clickable {
  cursor: pointer;
  appearance: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.ticker-badge.clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.20), 0 8px 18px rgba(0, 0, 0, 0.18);
  background: rgba(127, 29, 29, 0.28);
}

.ticker-badge.clickable:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.9);
  outline-offset: 2px;
}

#compareTable thead th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

#compareTable thead th.sortable:hover {
  color: #dbe7ff;
}

#compareTable thead th.sortable .sort-indicator {
  display: inline-block;
  min-width: 14px;
  margin-left: 6px;
  color: #7f8fb2;
}

#compareTable thead th.sortable.sorted-asc,
#compareTable thead th.sortable.sorted-desc {
  color: #eff6ff;
}

#compareTable thead th.sortable.sorted-asc .sort-indicator,
#compareTable thead th.sortable.sorted-desc .sort-indicator {
  color: #7dd3fc;
}

#compareTable tbody tr.row-focus {
  position: relative;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.20) 0%, rgba(59, 130, 246, 0.10) 100%);
  box-shadow:
    inset 4px 0 0 #60a5fa,
    0 0 0 1px rgba(96, 165, 250, 0.18);
}

#compareTable tbody tr.row-focus:hover {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.26) 0%, rgba(59, 130, 246, 0.14) 100%);
}

#compareTable tbody tr.row-focus td:first-child {
  color: #dbeafe;
  font-weight: 700;
}

#compareTable tbody tr.row-focus.flash-once {
  animation: rowFocusFlash 1s ease-out 1;
}

@keyframes rowFocusFlash {
  0% {
    background: rgba(250, 204, 21, 0.35);
  }
  100% {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.20) 0%, rgba(59, 130, 246, 0.10) 100%);
  }
}

/* V3 Phase 2 focus mode */
.hidden {
  display: none !important;
}

.table-toolbar-left,
.table-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.focus-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  background: rgba(37, 99, 235, 0.10);
  color: #bfdbfe;
  font-size: 12px;
  line-height: 1;
}

.focus-state strong {
  color: #eff6ff;
  font-weight: 700;
}

.clear-focus-btn {
  border: 1px solid #475569;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
}

.clear-focus-btn:hover {
  background: #172033;
  border-color: #64748b;
}

.ticker-badge.clickable.active {
  background: rgba(37, 99, 235, 0.24);
  border-color: rgba(96, 165, 250, 0.70);
  color: #dbeafe;
  box-shadow:
    0 0 0 1px rgba(96, 165, 250, 0.22),
    0 0 0 4px rgba(37, 99, 235, 0.10);
}

.ticker-badge.clickable.active:hover {
  background: rgba(37, 99, 235, 0.30);
}

.table-toolbar {
  align-items: center;
}

@media (max-width: 700px) {
  .table-toolbar-right {
    width: 100%;
  }
}


/* V5 Summary extension */
.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 6px;
}

.summary-basis-badge {
  min-width: 110px;
  text-align: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.30);
  background: rgba(37, 99, 235, 0.12);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.summary-secondary-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(96, 122, 189, 0.18);
}

.summary-scatter-chart {
  min-height: 360px;
  border: 1px solid rgba(96, 122, 189, 0.18);
  border-radius: 16px;
  background: rgba(11, 16, 32, 0.28);
}

.summary-excluded-block {
  margin-top: 18px;
}

.summary-excluded-table-wrap {
  margin-top: 10px;
  overflow-x: auto;
  border: 1px solid rgba(96, 122, 189, 0.18);
  border-radius: 14px;
  background: rgba(11, 16, 32, 0.22);
}

.summary-excluded-table {
  width: 100%;
  border-collapse: collapse;
}

.summary-excluded-table th,
.summary-excluded-table td {
  border-bottom: 1px solid rgba(96, 122, 189, 0.14);
  padding: 10px 12px;
  font-size: 12px;
  text-align: right;
}

.summary-excluded-table th:first-child,
.summary-excluded-table td:first-child,
.summary-excluded-table th:last-child,
.summary-excluded-table td:last-child {
  text-align: left;
}

.summary-excluded-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 900px) {
  .panel-title-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .summary-scatter-chart {
    min-height: 320px;
  }
}
