/* ══════════════════════════════════════════════════════════════════
   Watcher Panel — Modal CSS  (clearing-parked-quintet S5, Pillar C, 2026-06-01)
   Top-level admin panel adjacent to Train Station. .wd-* namespace mirrors
   the .ts-* shell. Reads the fork-safe /watcher/dashboard endpoint.
   Glyph 👁 · severity ladder CRITICAL / WARN / INFO · 24h default window.
   ══════════════════════════════════════════════════════════════════ */

/* ── Overlay & Modal Shell ────────────────────────────────────────── */

.wd-overlay {
  position: fixed;
  top: var(--nav-height, 60px);
  left: var(--side-nav-width, 60px);
  right: 0;
  bottom: 0;
  z-index: 1400;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.45);
  animation: wdFadeIn 0.2s ease;
}

@keyframes wdFadeIn { from { opacity: 0; } to { opacity: 1; } }

.wd-modal {
  background: #f7f8fa;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
  animation: wdSlideUp 0.25s ease;
}

@keyframes wdSlideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Header ───────────────────────────────────────────────────────── */

.wd-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.75rem;
  background: linear-gradient(135deg, #0f3057 0%, #1f5f8b 50%, #2c7a9c 100%);
  color: #fff;
  flex-shrink: 0;
  gap: 1rem;
}

.wd-header-left { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.wd-header-glyph { font-size: calc(1.9rem * var(--type-scale, 1)); line-height: 1; flex-shrink: 0; }
.wd-modal-title { margin: 0; font-size: calc(1.25rem * var(--type-scale, 1)); font-weight: 700; }
.wd-modal-subtitle { margin: 0.15rem 0 0; font-size: calc(0.8rem * var(--type-scale, 1)); opacity: 0.85; }

.wd-header-right { display: flex; align-items: center; gap: 0.5rem; }

.wd-refresh-btn, .wd-close-btn {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 36px; height: 36px;
  font-size: calc(1.1rem * var(--type-scale, 1));
  cursor: pointer;
  transition: background 0.15s ease;
}
.wd-refresh-btn:hover, .wd-close-btn:hover { background: rgba(255,255,255,0.3); }
.wd-close-btn { font-size: calc(1.4rem * var(--type-scale, 1)); }

/* ── Controls (window + severity floor) ───────────────────────────── */

.wd-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.75rem;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.wd-control-group { display: flex; align-items: center; gap: 0.4rem; }
.wd-control-label { font-size: calc(0.75rem * var(--type-scale, 1)); color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
.wd-control-group select {
  font-size: calc(0.82rem * var(--type-scale, 1));
  padding: 0.3rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

/* ── Severity Pills ───────────────────────────────────────────────── */

.wd-pills-row {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.75rem;
  flex-shrink: 0;
}
.wd-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.7rem 0.5rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.wd-pill:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.wd-pill.wd-pill-active { box-shadow: 0 0 0 2px currentColor inset; }
.wd-pill-count { font-size: calc(1.7rem * var(--type-scale, 1)); font-weight: 800; line-height: 1; }
.wd-pill-label { font-size: calc(0.72rem * var(--type-scale, 1)); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.25rem; }

.wd-pill-critical { color: #dc2626; border-color: #fecaca; }
.wd-pill-warn     { color: #d97706; border-color: #fde68a; }
.wd-pill-info     { color: #2563eb; border-color: #bfdbfe; }

/* ── Observation Feed ─────────────────────────────────────────────── */

.wd-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 1.75rem 1.5rem;
}

.wd-loading, .wd-empty, .wd-error { padding: 2rem; text-align: center; color: #64748b; }
.wd-error pre { text-align: left; background: #fef2f2; color: #991b1b; padding: 0.75rem; border-radius: 8px; overflow-x: auto; }

.wd-obs-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left-width: 4px;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: box-shadow 0.12s ease;
}
.wd-obs-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.08); }
.wd-obs-card.wd-sev-critical { border-left-color: #dc2626; }
.wd-obs-card.wd-sev-warn     { border-left-color: #d97706; }
.wd-obs-card.wd-sev-info     { border-left-color: #2563eb; }
.wd-obs-card.wd-triaged { opacity: 0.62; }

.wd-obs-sev {
  font-size: calc(0.62rem * var(--type-scale, 1));
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.wd-sev-critical .wd-obs-sev { background: #fee2e2; color: #b91c1c; }
.wd-sev-warn .wd-obs-sev     { background: #fef3c7; color: #b45309; }
.wd-sev-info .wd-obs-sev     { background: #dbeafe; color: #1d4ed8; }

.wd-obs-main { flex: 1; min-width: 0; }
.wd-obs-title { font-weight: 600; font-size: calc(0.9rem * var(--type-scale, 1)); color: #1e293b; }
.wd-obs-meta { font-size: calc(0.74rem * var(--type-scale, 1)); color: #64748b; margin-top: 0.25rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.wd-obs-source { font-family: ui-monospace, monospace; color: #475569; }
.wd-triaged-badge { color: #16a34a; font-weight: 600; }

/* ── Drill-in Drawer ──────────────────────────────────────────────── */

.wd-drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  justify-content: flex-end;
  animation: wdFadeIn 0.18s ease;
}
.wd-drawer {
  width: min(480px, 92vw);
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 30px rgba(0,0,0,0.25);
  animation: wdDrawerIn 0.2s ease;
}
@keyframes wdDrawerIn { from { transform: translateX(40px); opacity: 0.6; } to { transform: translateX(0); opacity: 1; } }

.wd-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}
.wd-drawer-header h3 { margin: 0; font-size: calc(1.05rem * var(--type-scale, 1)); }
.wd-drawer-body { flex: 1; overflow-y: auto; padding: 1.25rem; }
.wd-drawer-section { margin-bottom: 1.25rem; }
.wd-drawer-section h4 { margin: 0 0 0.5rem; font-size: calc(0.74rem * var(--type-scale, 1)); text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; }
.wd-drawer-section pre {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: calc(0.78rem * var(--type-scale, 1));
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.wd-kv { display: flex; gap: 0.5rem; font-size: calc(0.82rem * var(--type-scale, 1)); padding: 0.2rem 0; }
.wd-kv-key { color: #64748b; min-width: 120px; }
.wd-kv-val { color: #1e293b; font-family: ui-monospace, monospace; word-break: break-word; }

.wd-drawer-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.wd-triage-note {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.5rem;
  font-size: calc(0.85rem * var(--type-scale, 1));
  resize: vertical;
  min-height: 56px;
}
.wd-triage-actions { display: flex; gap: 0.5rem; }
.wd-btn {
  flex: 1;
  border: none;
  border-radius: 6px;
  padding: 0.55rem;
  font-size: calc(0.82rem * var(--type-scale, 1));
  font-weight: 600;
  cursor: pointer;
}
.wd-btn-primary { background: #0f3057; color: #fff; }
.wd-btn-primary:hover { background: #1f5f8b; }
.wd-btn-secondary { background: #e2e8f0; color: #334155; }
.wd-btn-secondary:hover { background: #cbd5e1; }

.wd-triage-history-item {
  font-size: calc(0.78rem * var(--type-scale, 1));
  padding: 0.4rem 0.5rem;
  background: #f8fafc;
  border-radius: 6px;
  margin-bottom: 0.35rem;
}
.wd-triage-history-item .wd-th-disp { font-weight: 700; color: #16a34a; }

/* ── Footer ───────────────────────────────────────────────────────── */

.wd-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1.75rem;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  font-size: calc(0.74rem * var(--type-scale, 1));
  color: #64748b;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .wd-overlay { left: 0; }
}
