/**
 * detective.css — CEO Panel · 🕵️ The Detective
 *
 * Mirrors cybersec.css conventions but with a forensic / investigative palette:
 *   - Neutral graphite backgrounds
 *   - Phase-color spectrum: SHADOW (gray), OBSERVE (amber), ACTIVE (green)
 *   - Severity scale: INFO (slate) → LOW (cyan) → MEDIUM (amber) → HIGH (orange) → CRITICAL (red)
 */

#panel-detective .det-inner {
    padding: 18px 22px 28px;
    color: #e8eaed;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
}

#panel-detective .det-loading,
#panel-detective .det-error {
    padding: 28px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

#panel-detective .det-error { color: #ef4444; }

/* ── Header ─────────────────────────────────────────────────────────────── */
#panel-detective .det-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid #2a2a3e;
    padding-bottom: 14px;
    margin-bottom: 18px;
}
#panel-detective .det-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
#panel-detective .det-title h2 {
    margin: 0;
    font-size: 1.4em;
    color: #e8eaed;
    font-weight: 600;
}
#panel-detective .det-icon {
    font-size: 1.6em;
}
#panel-detective .det-port {
    font-family: monospace;
    color: #777;
    font-size: 0.85em;
    background: #1a1a2a;
    padding: 2px 8px;
    border-radius: 4px;
}
#panel-detective .det-phase {
    font-family: monospace;
    font-weight: 700;
    font-size: 0.78em;
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 0.06em;
}
#panel-detective .det-phase.phase-shadow  { background: #2a2a3e; color: #aaa; border: 1px solid #44445a; }
#panel-detective .det-phase.phase-observe { background: #3a2a10; color: #fbbf24; border: 1px solid #92580f; }
#panel-detective .det-phase.phase-active  { background: #103a20; color: #34d399; border: 1px solid #0c6638; }
#panel-detective .det-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
#panel-detective .det-stat-inline {
    font-size: 0.82em;
    color: #aaa;
    margin-right: 6px;
}
#panel-detective .det-stat-inline b { color: #e8eaed; }

#panel-detective .det-cycle-btn,
#panel-detective .det-refresh-btn {
    background: #1a1a2a;
    color: #e8eaed;
    border: 1px solid #2a2a3e;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background 120ms;
}
#panel-detective .det-cycle-btn:hover,
#panel-detective .det-refresh-btn:hover { background: #2a2a3e; }
#panel-detective .det-cycle-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#panel-detective .det-cycle-btn { background: #103a20; border-color: #0c6638; color: #34d399; }
#panel-detective .det-cycle-btn:hover { background: #155a30; }

/* ── KPI Grid ───────────────────────────────────────────────────────────── */
#panel-detective .det-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}
#panel-detective .det-kpi {
    background: #15151f;
    border: 1px solid #2a2a3e;
    border-radius: 8px;
    padding: 12px 14px;
}
#panel-detective .det-kpi-label {
    font-size: 0.74em;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
#panel-detective .det-kpi-val {
    font-size: 1.65em;
    font-weight: 600;
    color: #e8eaed;
    font-family: monospace;
}
#panel-detective .det-kpi-val.warn { color: #fbbf24; }
#panel-detective .det-kpi-val.crit { color: #ef4444; }

/* ── Sections ───────────────────────────────────────────────────────────── */
#panel-detective .det-section {
    margin-top: 22px;
    background: #0f0f1a;
    border: 1px solid #2a2a3e;
    border-radius: 10px;
    padding: 16px 18px 18px;
}
#panel-detective .det-section h3 {
    margin: 0 0 4px 0;
    font-size: 1em;
    color: #e8eaed;
    font-weight: 600;
}
#panel-detective .det-section h3 .det-count {
    font-family: monospace;
    color: #777;
    font-size: 0.85em;
    margin-left: 8px;
    background: #1a1a2a;
    padding: 1px 8px;
    border-radius: 4px;
}
#panel-detective .det-section-sub {
    margin: 0 0 14px 0;
    color: #888;
    font-size: 0.85em;
}
#panel-detective .det-empty {
    color: #6e7681;
    text-align: center;
    padding: 14px 0;
    font-size: 0.92em;
}

/* ── Phase Switcher ─────────────────────────────────────────────────────── */
#panel-detective .det-phase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
#panel-detective .det-phase-card {
    background: #15151f;
    border: 1px solid #2a2a3e;
    border-radius: 8px;
    padding: 14px;
    transition: border-color 120ms;
}
#panel-detective .det-phase-card.active { border-color: #34d399; box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.25); }
#panel-detective .det-phase-icon { font-size: 1.4em; margin-bottom: 6px; }
#panel-detective .det-phase-name {
    font-size: 0.95em;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: 0.04em;
}
#panel-detective .det-phase-desc {
    color: #888;
    font-size: 0.82em;
    margin-bottom: 10px;
    line-height: 1.4;
}
#panel-detective .det-phase-btn {
    width: 100%;
    background: #1a1a2a;
    color: #e8eaed;
    border: 1px solid #2a2a3e;
    border-radius: 6px;
    padding: 7px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background 120ms;
}
#panel-detective .det-phase-btn:hover:not(:disabled) { background: #2a2a3e; }
#panel-detective .det-phase-btn:disabled {
    color: #34d399;
    border-color: #0c6638;
    background: #103a20;
    cursor: default;
    font-weight: 600;
}

/* ── Tables ─────────────────────────────────────────────────────────────── */
#panel-detective .det-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86em;
}
#panel-detective .det-table thead {
    background: #15151f;
}
#panel-detective .det-table th {
    text-align: left;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.78em;
    padding: 8px 10px;
    border-bottom: 1px solid #2a2a3e;
    font-weight: 600;
}
#panel-detective .det-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #1a1a2a;
    color: #e8eaed;
}
#panel-detective .det-case-row {
    cursor: pointer;
    transition: background 100ms;
}
#panel-detective .det-case-row:hover { background: #1a1a2a; }

/* ── Severity / Status badges ──────────────────────────────────────────── */
#panel-detective .det-sev {
    display: inline-block;
    font-family: monospace;
    font-size: 0.74em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}
#panel-detective .det-sev.sev-info     { background: #1a2030; color: #8bb4d8; }
#panel-detective .det-sev.sev-low      { background: #102530; color: #6ed3e3; }
#panel-detective .det-sev.sev-medium   { background: #2a2010; color: #fbbf24; }
#panel-detective .det-sev.sev-high     { background: #3a1a10; color: #fb923c; }
#panel-detective .det-sev.sev-critical { background: #3a0a14; color: #f87171; }

#panel-detective .det-status {
    display: inline-block;
    font-family: monospace;
    font-size: 0.74em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}
#panel-detective .det-status.status-open       { background: #2a2a3e; color: #aaa; }
#panel-detective .det-status.status-diagnosing { background: #1a2030; color: #8bb4d8; }
#panel-detective .det-status.status-proposed   { background: #1a3030; color: #6ed3e3; }
#panel-detective .det-status.status-dispatched { background: #2a2010; color: #fbbf24; }
#panel-detective .det-status.status-verifying  { background: #103a20; color: #34d399; }
#panel-detective .det-status.status-closed     { background: #1a2a1a; color: #6ee7b7; }
#panel-detective .det-status.status-escalated  { background: #3a1a10; color: #fb923c; }
#panel-detective .det-status.status-dropped    { background: #2a2a2a; color: #777; }

/* ── How it Works ───────────────────────────────────────────────────────── */
#panel-detective .det-explain h4 {
    color: #e8eaed;
    font-size: 0.9em;
    margin: 0 0 4px 0;
}
#panel-detective .det-explain p {
    color: #aaa;
    font-size: 0.85em;
    line-height: 1.5;
    margin: 0;
}
#panel-detective .det-explain code {
    background: #1a1a2a;
    color: #fbbf24;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.92em;
}
#panel-detective .det-explain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

/* ── Modal ──────────────────────────────────────────────────────────────── */
.det-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.det-modal {
    background: #0f0f1a;
    border: 1px solid #2a2a3e;
    border-radius: 12px;
    width: 720px;
    max-width: 92vw;
    max-height: 86vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 50px rgba(0,0,0,0.7);
}
.det-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #2a2a3e;
}
.det-modal-head h3 { margin: 0; color: #e8eaed; font-size: 1em; }
.det-modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.4em;
    cursor: pointer;
    padding: 0 6px;
}
.det-modal-close:hover { color: #e8eaed; }
.det-modal-body {
    overflow-y: auto;
    padding: 16px 18px;
    color: #e8eaed;
    font-size: 0.86em;
}
.det-modal-body h4 {
    margin: 14px 0 6px 0;
    color: #888;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.det-meta { width: 100%; border-collapse: collapse; }
.det-meta th {
    text-align: left;
    width: 130px;
    color: #888;
    padding: 4px 10px 4px 0;
    font-weight: 500;
    vertical-align: top;
    font-size: 0.85em;
}
.det-meta td { padding: 4px 0; font-family: monospace; font-size: 0.85em; }
.det-pre {
    background: #15151f;
    border: 1px solid #2a2a3e;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 0.78em;
    color: #cbd5e1;
    overflow-x: auto;
    white-space: pre;
}
