/* ═══════════════════════════════════════════════════════════════════════
   Judah 2.0 — Frontend
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --bg: #080c14;
  --bg-card: #0f1520;
  --bg-card-new: #111d2e;
  --bg-hover: #1a2438;
  --border: #1c2a3a;
  --border-subtle: #141e2c;
  --text: #e2e8f0;
  --text-sec: #94a3b8;
  --text-muted: #546178;
  --accent: #3b82f6;

  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --orange: #f97316;
  --blue: #3b82f6;
  --yellow: #eab308;
  --purple: #a855f7;

  --radius: 8px;
  --radius-sm: 5px;
  --gap: 8px;
  --transition: 0.15s ease;
}

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

html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 13px;
  line-height: 1.4;
  overflow-x: hidden;
}

.app { max-width: 1440px; margin: 0 auto; padding: 8px; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  gap: 12px;
  flex-wrap: wrap;
}

.header-left { display: flex; align-items: center; gap: 10px; }
.logo { display: flex; align-items: center; }
.logo { display: flex; align-items: center; }
.logo-icon { color: var(--accent); display: flex; }
.logo-text h1 { font-size: 16px; font-weight: 700; letter-spacing: 0.5px; line-height: 1.1; }
.logo-text span { font-size: 11px; color: var(--text-sec); }

.header-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.scan-status { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-sec); }
.scan-indicator { display: flex; align-items: center; gap: 6px; }
.scan-text { font-size: 11px; color: var(--text-sec); }
.scan-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #ef4444;
  display: inline-block; transition: background 0.3s;
}
.scan-dot.live { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.4); }

.status-pill {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  background: var(--bg-hover); border: 1px solid var(--border);
  font-size: 11px; color: var(--text-sec);
}
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #ef4444; transition: background 0.3s;
}
.pulse-dot.live { background: #22c55e; }

.stat-group { display: flex; gap: 4px; }
.stat-chip {
  display: flex; flex-direction: column; align-items: center;
  padding: 3px 8px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border: 1px solid var(--border);
  min-width: 44px;
}
.stat-label { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 15px; font-weight: 700; color: var(--text); }
.stat-accent { border-color: #3b82f644; }
.stat-accent .stat-value { color: var(--accent); }

.health-badge {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  background: var(--bg-hover); border: 1px solid var(--border);
  font-size: 11px; color: var(--text-sec);
  cursor: pointer; transition: all var(--transition);
  user-select: none;
}
.health-badge:hover { border-color: var(--accent); color: var(--text); }
.health-badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #ef4444; transition: background 0.3s;
  flex-shrink: 0;
}
.health-badge-dot.ok { background: #22c55e; box-shadow: 0 0 4px rgba(34,197,94,0.4); }
.health-badge-dot.warn { background: #f59e0b; }
.health-badge-text { font-weight: 600; }
.health-badge-coins { color: var(--text-muted); font-size: 10px; }

.btn-icon {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border: 1px solid var(--border);
  color: var(--text-sec); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--border); color: var(--text); }

/* Filter Section */
.filter-section {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; margin-bottom: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.filter-scroll { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-group-label {
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
  white-space: nowrap;
}
.filter-sep {
  width: 1px; height: 20px; background: var(--border);
  margin: 0 4px; flex-shrink: 0;
}

.filter-chip {
  padding: 4px 10px; border-radius: 20px;
  background: var(--bg-hover); border: 1px solid var(--border);
  color: var(--text-sec); cursor: pointer;
  font-size: 11px; white-space: nowrap;
  transition: all var(--transition);
}
.filter-chip:hover { border-color: var(--accent); color: var(--text); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.dir-chip.bullish.active { background: var(--green); border-color: var(--green); color: #fff; }
.dir-chip.bearish.active { background: var(--red); border-color: var(--red); color: #fff; }

/* Signal Type Banner */
.stype-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; margin-bottom: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.stype-badges {
  display: flex; gap: 6px; flex-wrap: wrap; flex: 1;
}
.stype-badge {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border: 1px solid var(--border);
  min-width: 100px;
}
.stype-icon { font-size: 12px; line-height: 1; }
.stype-name {
  font-size: 9px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.3px;
  font-weight: 600; white-space: nowrap;
}
.stype-count {
  font-size: 13px; font-weight: 700; color: var(--text);
  min-width: 20px; text-align: right;
}

/* Decisions Container */
.signals-container { display: flex; flex-direction: column; gap: 6px; }

.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-spinner { margin-bottom: 16px; color: var(--text-muted); }
.empty-spinner svg { animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#emptyTitle { font-size: 16px; color: var(--text-sec); margin-bottom: 6px; font-weight: 600; }
#emptyMsg { font-size: 12px; }

.no-results {
  text-align: center; padding: 40px; color: var(--text-muted);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.clear-btn {
  padding: 6px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; border: none;
  cursor: pointer; font-size: 12px;
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}
.card:hover { border-color: #2d3f56; }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; cursor: pointer;
  gap: 8px; flex-wrap: wrap;
}
.card-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; flex-wrap: wrap; }
.card-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.coin-link {
  font-size: 14px; font-weight: 700; color: var(--text);
  white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
  transition: color 0.15s;
}
.coin-link:hover { color: #3b82f6; }
.tv-icon { opacity: 0.5; transition: opacity 0.15s; flex-shrink: 0; }
.coin-link:hover .tv-icon { opacity: 1; }

.binance-link {
  display: inline-flex; align-items: center; color: var(--text-muted);
  text-decoration: none; opacity: 0.6; transition: all 0.15s;
}
.binance-link:hover { color: #f3ba2f; opacity: 1; }

/* ME State badge */
.me-state-badge {
  padding: 2px 7px; border-radius: 3px;
  font-size: 10px; font-weight: 600;
  background: #a855f722; color: #a855f7; border: 1px solid #a855f744;
  white-space: nowrap;
}

/* Score flow */
.score-flow {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
}
.score-d1 { color: var(--text-sec); }
.score-arrow { color: var(--text-muted); font-size: 10px; }
.score-d2 { color: var(--text); font-size: 14px; font-weight: 700; }

/* Confidence badge */
.conf-badge {
  padding: 2px 7px; border-radius: 3px;
  font-size: 10px; font-weight: 700;
  border: 1px solid;
  white-space: nowrap;
}
.conf-high { background: #22c55e22; color: #22c55e; border-color: #22c55e44; }
.conf-mid { background: #f59e0b22; color: #f59e0b; border-color: #f59e0b44; }
.conf-low { background: #ef444422; color: #ef4444; border-color: #ef444444; }

/* Direction dot */
.dir-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.dir-bullish { background: var(--green); }
.dir-bearish { background: var(--red); }
.dir-neutral { background: #6b7280; }

/* Tier badge */
.tier-badge {
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700;
  border: 1px solid;
}
.tier-sniper { background: #eab30822; color: #eab308; border-color: #eab30844; }
.tier-opportunity { background: #22c55e22; color: #22c55e; border-color: #22c55e44; }
.tier-watch { background: #3b82f622; color: #3b82f6; border-color: #3b82f644; }
.tier-weak { background: #a855f722; color: #a855f7; border-color: #a855f744; }
.tier-rejected { background: #6b728022; color: #6b7280; border-color: #6b728044; }

/* Age badge */
.age-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
  padding: 1px 5px; border-radius: 3px;
  background: var(--bg-hover); color: var(--text-muted);
}
.age-live { background: #22c55e22; color: #22c55e; animation: livePulse 1.5s infinite; }
@keyframes livePulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }

.expand-icon { color: var(--text-muted); font-size: 10px; }

/* Card Body */
.card-body {
  padding: 0 14px 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: 8px;
}

/* Spiral Badge */
.spiral-badge {
  padding: 2px 8px; border-radius: 4px;
  font-size: 10px; font-weight: 700;
  border: 1px solid; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 3px;
}
.spiral-expansion { background: #22c55e22; color: #22c55e; border-color: #22c55e44; }
.spiral-correction { background: #f9731622; color: #f97316; border-color: #f9731644; }
.spiral-failure { background: #ef444422; color: #ef4444; border-color: #ef444444; }
.spiral-neutral { background: #6b728022; color: #6b7280; border-color: #6b728044; }

/* Market Evolution Section (card body) */
.evolution-section {
  padding: 8px 0; border-top: 1px solid var(--border-subtle);
}
.evolution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px;
  margin-top: 4px;
}
.evol-cell {
  display: flex; flex-direction: column; gap: 2px;
  padding: 5px 8px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border: 1px solid var(--border-subtle);
}
.evol-lbl {
  font-size: 9px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600;
}
.evol-val {
  font-size: 12px; font-weight: 600; color: var(--text-sec);
}
.evol-action {
  font-size: 11px; color: var(--text-sec); margin-top: 4px;
  padding: 4px 8px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border: 1px solid var(--border-subtle);
}
.evol-action-label { font-weight: 700; color: var(--text); }

/* TradingView link */
.tv-link {
  color: var(--accent); text-decoration: none; font-weight: 600;
}
.tv-link:hover { text-decoration: underline; }

/* Evolution Detail Modal Grid */
.evolution-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
  margin-top: 4px;
}
.evol-detail-cell {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border: 1px solid var(--border-subtle);
}
.evol-detail-cell .evol-lbl { font-size: 9px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.evol-detail-cell .evol-val { font-size: 12px; font-weight: 600; color: var(--text-sec); }

/* Signal Type Summary Row */
.stype-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0;
  flex-wrap: wrap;
}
.stype-pill {
  padding: 2px 8px; border-radius: 12px;
  font-size: 10px; font-weight: 700;
  border: 1px solid; white-space: nowrap;
}

/* Score Row */
.score-row {
  display: flex; align-items: center; gap: 12px;
}
.score-val { font-size: 14px; font-weight: 700; }
.score-bar-bg {
  flex: 1; height: 6px; background: var(--bg-hover);
  border-radius: 3px; overflow: hidden; max-width: 120px;
}
.score-bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s; }

/* Levels Row */
.levels-row {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.lvl-cell {
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 10px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border: 1px solid var(--border-subtle);
  min-width: 60px; flex: 1;
}
.lvl-lbl { font-size: 9px; color: var(--text-muted); text-transform: uppercase; }
.lvl-val { font-size: 12px; font-weight: 600; color: var(--text); }
.lvl-entry { border-color: #22c55e33; }
.lvl-sl { border-color: #ef444433; }
.lvl-tp { border-color: #3b82f633; }
.lvl-rr { border-color: #f59e0b33; }

/* Reason Chain */
.reason-chain {
  display: flex; flex-direction: column; gap: 4px;
}
.reason-entry {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 3px 0;
}
.reason-source {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  padding: 1px 5px; border-radius: 3px; white-space: nowrap;
  min-width: 50px; text-align: center;
}
.reason-indicator { background: #a78bfa22; color: #a78bfa; border: 1px solid #a78bfa44; }
.reason-d1 { background: #3b82f622; color: #3b82f6; border: 1px solid #3b82f644; }
.reason-d2 { background: #22c55e22; color: #22c55e; border: 1px solid #22c55e44; }
.reason-narrative { background: #f59e0b22; color: #f59e0b; border: 1px solid #f59e0b44; }
.reason-risk { background: #ef444422; color: #ef4444; border: 1px solid #ef444444; }
.reason-weight { color: var(--text-muted); font-size: 10px; white-space: nowrap; }

/* Indicator Observations */
.indicator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px;
}
.indicator-card {
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.indicator-name {
  font-size: 11px; font-weight: 700; color: var(--text-sec);
  margin-bottom: 3px;
}
.indicator-signal {
  font-size: 10px; font-weight: 600;
  padding: 1px 5px; border-radius: 3px; display: inline-block;
}
.sig-long { background: #22c55e22; color: #22c55e; }
.sig-short { background: #ef444422; color: #ef4444; }
.sig-neutral { background: #6b728022; color: #6b7280; }
.sig-nodata { background: #ef444422; color: #ef4444; }

.indicator-summary {
  font-size: 10px; color: var(--text-muted); margin-top: 3px;
  line-height: 1.4;
}

/* Snapshot Info */
.snapshot-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 11px; color: var(--text-sec);
}
.snapshot-meta span { white-space: nowrap; }

/* Narrative text */
.narrative-text {
  font-size: 12px; color: var(--text-sec);
  line-height: 1.5; padding: 8px 0;
  border-top: 1px solid var(--border-subtle);
}
.obs-log-loading {
  font-size: 12px; color: var(--text-muted);
  padding: 20px; text-align: center;
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 800px; width: 100%;
  max-height: 85vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-card); z-index: 1;
}
.modal-header h2 { font-size: 15px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-sec);
  font-size: 22px; cursor: pointer; line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 14px 16px; }

/* Responsive */
@media (max-width: 768px) {
  .header { flex-direction: column; align-items: flex-start; }
  .header-right { width: 100%; justify-content: space-between; }
  .card-header { flex-direction: column; align-items: flex-start; }
  .card-right { width: 100%; justify-content: space-between; }
  .modal-content { max-width: 100%; }
}

@media (max-width: 480px) {
  .app { padding: 4px; }
  .header { padding: 8px 10px; }
  .logo-text span { display: none; }
  .stat-chip { min-width: 36px; padding: 2px 6px; }
  .stat-value { font-size: 13px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   Activity Bar — D1 / D2 / D3 / DL status indicators
   ═══════════════════════════════════════════════════════════════════════ */

.activity-bar {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px; margin-bottom: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); flex-wrap: wrap;
}
.activity-item {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border: 1px solid var(--border);
  font-size: 10px; min-width: 75px;
}
.act-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.act-status {
  font-size: 11px; font-weight: 600;
  color: var(--text-sec); font-variant-numeric: tabular-nums;
}
.act-status.act-live {
  color: var(--green);
  text-shadow: 0 0 6px rgba(34,197,94,0.4);
}
.act-status.act-recent {
  color: var(--amber);
}
.act-status.act-stale {
  color: var(--text-muted);
}
.act-status.act-error {
  color: var(--red);
}

/* ═══════════════════════════════════════════════════════════════════════
   Timer chips — D1/D2 countdown to next candle close
   ═══════════════════════════════════════════════════════════════════════ */

.timer-group {
  display: flex; gap: 4px; align-items: center;
}
.timer-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 7px; border-radius: var(--radius-sm);
  background: var(--bg-hover); border: 1px solid var(--border);
  font-size: 10px;
}
.timer-label {
  font-size: 9px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase;
}
.timer-format {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  color: var(--text-sec); font-size: 9px;
  border-radius: 3px; padding: 1px 2px; cursor: pointer;
  outline: none;
}
.timer-format:focus { border-color: var(--accent); }
.timer-value {
  font-size: 11px; font-weight: 700;
  color: var(--text); font-variant-numeric: tabular-nums;
  min-width: 32px; text-align: right;
}
.timer-scanning {
  color: var(--amber) !important;
  animation: livePulse 1s infinite;
}

/* ═══════════════════════════════════════════════════════════════════════
   Observability Panel — collapsible, 3 tabs
   ═══════════════════════════════════════════════════════════════════════ */

.obs-panel {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px; overflow: hidden;
  max-height: 500px;
  display: flex; flex-direction: column;
  transition: max-height 0.25s ease;
}
.obs-panel.collapsed { max-height: 36px; }
.obs-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-hover); border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
.obs-panel-title {
  font-size: 12px; font-weight: 700;
  color: var(--text);
}
.obs-panel-chevron {
  color: var(--text-sec); font-size: 10px;
  transition: transform 0.2s;
}
.obs-panel.collapsed .obs-panel-chevron {
  transform: rotate(-90deg);
}
.obs-tabs {
  display: flex; gap: 0; padding: 0;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
}
.obs-tab {
  padding: 6px 12px;
  background: none; border: none;
  color: var(--text-sec); cursor: pointer;
  font-size: 11px; font-weight: 600;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.obs-tab:hover { color: var(--text); background: var(--bg-hover); }
.obs-tab.active {
  color: var(--accent); border-bottom-color: var(--accent);
}
.obs-tab-panel {
  flex: 1; overflow-y: auto; padding: 8px 12px;
  min-height: 200px; max-height: 360px;
}
.obs-log-controls {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 6px;
}
.obs-log-controls select, .obs-log-controls input {
  background: var(--bg-hover); border: 1px solid var(--border);
  color: var(--text); font-size: 11px;
  border-radius: var(--radius-sm); padding: 3px 6px;
  outline: none;
}
.obs-log-controls .log-filter-info {
  margin-left: auto; font-size: 10px; color: var(--text-muted);
}
.log-container {
  background: #050a14; border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); padding: 6px;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 11px; line-height: 1.5;
  max-height: 280px; overflow-y: auto;
}
.log-line {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 1px 4px; border-radius: 2px;
}
.log-line:hover { background: rgba(255,255,255,0.03); }
.log-line.error-line { background: rgba(239,68,68,0.08); }
.log-line.warn-line { background: rgba(245,158,11,0.05); }
.log-ts {
  color: var(--text-muted); font-size: 10px;
  flex-shrink: 0; min-width: 50px;
}
.log-level {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  min-width: 50px; flex-shrink: 0;
  padding: 0 4px; border-radius: 2px;
}
.ll-error { color: var(--red); }
.ll-critical { color: var(--red); }
.ll-warning { color: var(--amber); }
.ll-info { color: var(--blue); }
.ll-debug { color: var(--text-muted); }
.log-msg {
  flex: 1; word-break: break-word; color: var(--text-sec);
}
.log-msg strong { color: var(--accent); }

/* Health tab */
.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.health-card {
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.health-card-title {
  font-size: 11px; font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 4px;
}
.health-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; padding: 2px 0;
}
.health-key { color: var(--text-muted); }
.health-val { font-weight: 600; color: var(--text); font-size: 11px; }
.health-val.ok { color: var(--green); }
.health-val.err { color: var(--red); }
.health-val.warn { color: var(--amber); }
.health-val.neutral { color: var(--text-sec); }
.health-bar {
  height: 3px; background: var(--border-subtle);
  border-radius: 2px; overflow: hidden; margin-top: 4px;
}
.health-bar-fill {
  height: 100%; border-radius: 2px;
  transition: width 0.3s;
}
.status-dot {
  display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  margin-right: 4px;
}
.status-dot.live { background: var(--green); }
.status-dot.stale { background: var(--amber); }
.status-dot.never { background: var(--red); }
.status-dot.unknown { background: var(--text-muted); }

/* Inspector tab */
.inspector-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 8px; margin-bottom: 8px;
}
.inspector-overall {
  font-size: 13px; font-weight: 700;
}
.inspector-ts {
  font-size: 10px; color: var(--text-muted);
}
.inspector-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.inspector-card {
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.inspector-card.OK, .inspector-card.HEALTHY { border-left-color: var(--green); }
.inspector-card.WARNING { border-left-color: var(--amber); }
.inspector-card.DEGRADED, .inspector-card.ERROR { border-left-color: var(--red); }
.inspector-card.STALE { border-left-color: var(--orange); }
.inspector-card.unknown { border-left-color: var(--text-muted); }
.ic-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.ic-title {
  font-size: 12px; font-weight: 700;
  color: var(--text);
}
.ic-status {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.ic-rows { display: flex; flex-direction: column; gap: 2px; }
.ic-row {
  display: flex; justify-content: space-between;
  font-size: 11px; padding: 1px 0;
}
.ic-row span:first-child { color: var(--text-muted); }
.ic-row span:last-child { color: var(--text); font-weight: 600; }
.text-amber { color: var(--amber) !important; }
.text-red { color: var(--red) !important; }
.ic-issues {
  display: flex; flex-direction: column; gap: 2px;
  margin-top: 4px; padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
}
.ic-issue {
  font-size: 10px; color: var(--amber);
  padding: 1px 0;
}
.inspector-actions {
  margin-top: 8px; padding: 6px 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}
.ic-action-title {
  font-size: 11px; font-weight: 700;
  color: var(--text); margin-bottom: 4px;
}
.ic-action {
  font-size: 11px; color: var(--green);
  padding: 1px 0;
}
.inspector-footer {
  font-size: 10px; color: var(--text-muted);
  text-align: right; padding: 4px 0;
}

/* Toggle button (FAB) */
.obs-toggle {
  position: fixed; bottom: 16px; right: 16px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); font-size: 18px;
  cursor: pointer; z-index: 150;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  transition: all 0.2s;
}
.obs-toggle:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════════════════════
   Type E Alert Container
   ═══════════════════════════════════════════════════════════════════════ */

.type-e-alert {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; margin-bottom: 8px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  font-size: 12px;
  animation: livePulse 1.5s 3;
}
.type-e-icon { font-size: 16px; }
.type-e-content { flex: 1; }
.type-e-title { font-weight: 700; color: var(--red); }
.type-e-detail { font-size: 11px; color: var(--text-sec); }
.type-e-dismiss {
  background: none; border: 1px solid var(--border);
  color: var(--text-sec); border-radius: 50%;
  width: 22px; height: 22px; cursor: pointer;
  font-size: 12px; line-height: 1;
}
.type-e-dismiss:hover { color: var(--text); border-color: var(--red); }

/* ═══════════════════════════════════════════════════════════════════════
   Card stale state — flag cards with stale data
   ═══════════════════════════════════════════════════════════════════════ */
.card-stale {
  opacity: 0.6;
  border-color: var(--border-subtle);
}
.card-stale .age-badge {
  background: rgba(245,158,11,0.15); color: var(--amber);
}

/* Sparkline canvas */
.sparkline {
  display: inline-block;
  width: 60px; height: 20px;
  vertical-align: middle;
}

/* Action chip / button */
.action-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.action-chip:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.action-chip.secondary {
  background: var(--bg-hover); color: var(--text-sec);
  border: 1px solid var(--border);
}
.action-chip.danger {
  background: var(--red); color: #fff;
}
