/* Admin Dashboard — desktop-first, min-width 1200px */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 13px;
  background: #f0f2f5;
  color: #222;
  min-width: 1200px;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 { font-size: 16px; font-weight: 600; color: #fff; }
.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.readonly-badge {
  background: #c0392b;
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.period-buttons { display: flex; gap: 4px; }
.period-btn {
  background: #2c2c54;
  color: #aaa;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s;
}
.period-btn:hover { background: #3a3a6c; color: #fff; }
.period-btn.active { background: #0984e3; color: #fff; border-color: #0984e3; }

/* ── Main layout ── */
.main { padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; }

/* ── Grid ── */
.grid { display: grid; gap: 14px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-1 { grid-template-columns: 1fr; }

@media (max-width: 1400px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ── Fix-status card (Row 0) ── */
.card-subhead {
  font-weight: 400;
  font-size: 11px;
  color: #999;
  text-transform: none;
  margin-left: 6px;
}
.fix-status-summary {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
}
.fix-overall-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  letter-spacing: 0.4px;
  background: #f5f5f5;
}
.fix-overall-badge.status-ok    { background: #e8f8ef; color: #1e8449; }
.fix-overall-badge.status-warn  { background: #fff5e6; color: #b7651b; }
.fix-overall-badge.status-error { background: #fdecea; color: #922b21; }
.fix-status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 1200px) { .fix-status-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  { .fix-status-grid { grid-template-columns: 1fr; } }
.fix-card {
  border: 1px solid #e0e3e8;
  border-left-width: 4px;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fafbfc;
}
.fix-card.fix-green  { border-left-color: #27ae60; background: #f4faf6; }
.fix-card.fix-yellow { border-left-color: #e67e22; background: #fdf8f1; }
.fix-card.fix-red    { border-left-color: #c0392b; background: #fdf3f2; }
.fix-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.fix-dot { font-size: 14px; line-height: 1; }
.fix-name { flex: 1; font-weight: 600; font-size: 12px; color: #333; }
.fix-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid currentColor;
}
.fix-card-body { font-size: 11px; }
.fix-line {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}
.fix-line-key { color: #777; }

/* ── Strategy decision card (Row 0b) ── */
.strategy-decision-summary {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 12px;
}
.strategy-decision-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (max-width: 900px) { .strategy-decision-grid { grid-template-columns: 1fr; } }
.strategy-symbol-card .fix-name { font-size: 13px; }
.strategy-summary {
  margin-top: 6px;
  padding: 6px 8px;
  background: #fff;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
  color: #333;
  border-left: 3px solid #d0d4db;
}
.strategy-metrics {
  margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: #555;
}
.strategy-reasons {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.strategy-reason-tag {
  display: inline-block;
  padding: 2px 6px;
  background: #fff;
  border: 1px solid #e0e3e8;
  border-radius: 8px;
  font-size: 10px;
  color: #b7651b;
}
.strategy-signal-detail {
  margin-top: 6px;
  padding: 6px 8px;
  background: #f4faf6;
  border-radius: 4px;
  font-size: 12px;
  color: #1e8449;
  border-left: 3px solid #27ae60;
}

/* ── Card ── */
.card {
  background: #fff;
  border: 1px solid #e0e3e8;
  border-radius: 8px;
  overflow: hidden;
}
.card-header {
  background: #f7f8fa;
  border-bottom: 1px solid #e0e3e8;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 12px;
  color: #444;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.card-body {
  padding: 12px 14px;
  max-height: 340px;
  overflow-y: auto;
}

/* ── KV rows ── */
.kv {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
}
.kv:last-child { border-bottom: none; }
.kv-key { color: #666; }
.mt { margin-top: 10px; }

/* ── Status colors ── */
.status-ok     { color: #27ae60; font-weight: 600; }
.status-error  { color: #c0392b; font-weight: 600; }
.status-warn   { color: #e67e22; font-weight: 600; }
.status-pending{ color: #f39c12; font-weight: 600; }

/* ── Level colors ── */
.level-critical { color: #c0392b; font-weight: 700; }
.level-warn     { color: #e67e22; font-weight: 600; }
.level-info     { color: #7f8c8d; }

/* ── Signal link confidence badges ── */
.badge-high   { color: #27ae60; font-size: 10px; }
.badge-medium { color: #e67e22; font-size: 10px; }
.badge-low    { color: #95a5a6; font-size: 10px; }
.badge-none   { color: #bdc3c7; font-size: 10px; }
.text-muted   { color: #bdc3c7; }

/* ── Bar chart ── */
.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.bar-label {
  width: 120px;
  min-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #0984e3;
  text-decoration: none;
  font-size: 12px;
}
.bar-label:hover { text-decoration: underline; }
.bar-track {
  flex: 1;
  background: #f0f2f5;
  border-radius: 3px;
  height: 14px;
  overflow: hidden;
}
.bar-fill {
  background: #0984e3;
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
  min-width: 2px;
}
.bar-count {
  width: 40px;
  text-align: right;
  color: #555;
  font-size: 12px;
}

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.data-table th {
  background: #f7f8fa;
  border-bottom: 2px solid #e0e3e8;
  padding: 6px 8px;
  text-align: left;
  color: #555;
  white-space: nowrap;
}
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { background: #eef0f4; }
.data-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
  white-space: nowrap;
}
.data-table tbody tr:nth-child(even) { background: #fafbfc; }
.data-table tbody tr:hover { background: #e8f4fd; }

/* ── Subsection titles ── */
.subsection-title {
  font-size: 11px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 0 4px;
  border-bottom: 1px solid #eee;
  margin-bottom: 6px;
}

/* ── Loading / empty states ── */
.loading { color: #aaa; font-style: italic; padding: 20px 0; text-align: center; }
.empty   { color: #bbb; font-style: italic; padding: 10px 0; text-align: center; }

/* ── Footer ── */
.footer {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #1a1a2e;
  color: #888;
  font-size: 11px;
  padding: 8px 20px;
}

/* ── Tab navigation ── */
.tab-nav {
  display: flex;
  gap: 2px;
  background: #1a1a2e;
  padding: 0 20px;
  border-bottom: 2px solid #0984e3;
}
.tab-btn {
  background: transparent;
  color: #aaa;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: #e0e0e0; }
.tab-btn.active { color: #fff; border-bottom-color: #0984e3; font-weight: 600; }

/* ── Tab content visibility ── */
.tab-hidden { display: none !important; }

/* ── List page container ── */
.list-page { display: flex; flex-direction: column; gap: 12px; }

/* ── List filters bar ── */
.list-filters {
  background: #fff;
  border: 1px solid #e0e3e8;
  border-radius: 8px;
  padding: 10px 14px;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-select {
  background: #f7f8fa;
  border: 1px solid #cdd0d6;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  color: #333;
  cursor: pointer;
  min-width: 120px;
}
.filter-select:focus { outline: none; border-color: #0984e3; }
.filter-input {
  background: #f7f8fa;
  border: 1px solid #cdd0d6;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  color: #333;
  width: 160px;
}
.filter-input:focus { outline: none; border-color: #0984e3; }
.filter-apply-btn {
  background: #0984e3;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: background 0.15s;
}
.filter-apply-btn:hover { background: #0773c5; }
.filter-clear-btn {
  background: #f7f8fa;
  color: #666;
  border: 1px solid #cdd0d6;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.filter-clear-btn:hover { background: #eef0f4; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 12px;
  color: #555;
}
.page-btn {
  background: #f7f8fa;
  border: 1px solid #cdd0d6;
  border-radius: 4px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  color: #0984e3;
  transition: background 0.15s;
}
.page-btn:hover { background: #e8f4fd; }
.page-info { color: #777; }

/* ── Anomaly detail groups ── */
.anomaly-group {
  background: #fff;
  border: 1px solid #e0e3e8;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}
.anomaly-group-title {
  background: #f7f8fa;
  border-bottom: 1px solid #e0e3e8;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 12px;
  color: #444;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.anomaly-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: #f0f2f5;
}
.anomaly-group .empty,
.anomaly-group .table-wrap { padding: 10px 14px; }

/* ── Drift badge in positions ── */
.drift-badge:hover { text-decoration: underline; }

/* ── Detail panel (inline expand) ── */
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #1a2744; }
.expanded-row { background: #1a2744 !important; }

.detail-panel-row td { padding: 0 !important; border-top: none !important; }

.detail-panel {
  background: #0f1b2e;
  border: 1px solid #2a3a55;
  border-radius: 6px;
  margin: 4px 8px 12px;
  padding: 16px;
}

.detail-header {
  font-size: 14px;
  font-weight: 600;
  color: #e0e6ed;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #2a3a55;
}

.detail-section {
  margin-bottom: 12px;
}

.detail-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #8899aa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  cursor: pointer;
}

.detail-table { font-size: 12px; }

.key-highlights .kv { font-size: 13px; }

.error-text { color: #ff6b6b; font-family: monospace; font-size: 12px; }

.raw-json {
  background: #0a1220;
  color: #8899aa;
  font-size: 11px;
  padding: 8px;
  border-radius: 4px;
  max-height: 300px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.disposition-mini {
  background: #0a1220;
  border-radius: 4px;
  padding: 8px;
}

/* Attribution badges */
.attribution-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.attr-direct { background: #1a4d2e; color: #4ade80; }
.attr-meta { background: #4d3a1a; color: #fbbf24; }
.attr-inferred { background: #4d2a1a; color: #fb923c; }
.attr-unknown { background: #2a2a2a; color: #888; }

/* Classification badges */
.classification-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}
.cls-reject { background: #4d1a1a; color: #ff6b6b; }
.cls-skip { background: #4d3a1a; color: #fbbf24; }
.cls-advisory { background: #1a3a4d; color: #60a5fa; }
.cls-adjust { background: #3a1a4d; color: #c084fc; }
.cls-pass { background: #1a4d2e; color: #4ade80; }
.cls-sync { background: #1a2a4d; color: #818cf8; }
.cls-critical { background: #5c1a1a; color: #ff4444; border: 1px solid #ff4444; }
.cls-unknown { background: #2a2a2a; color: #888; }
