/* ============================================================
   CYRBER GUI v5 · ZAGROŻENIA (Sprint 2)
   List (30%) + detail with 5 tabs (70%)
   Inherits tokens + nav/statusbar/agent-bar from base-v5.css
   and reuses .missions-filter / .mf-* for the filter bar.
   ============================================================ */

/* Respect [hidden] even on flex/grid containers — otherwise a display: flex
   declaration wins over the browser's default [hidden]{display:none}. */
[hidden] { display: none !important; }

/* ── Page shell ─────────────────────────────────────────────── */

.threats-main {
  max-width: var(--page-max);
  width: 100%;
  margin: 0 auto;
  padding: clamp(16px, 2vh, 28px) var(--page-pad-x) clamp(88px, 10vh, 140px);
  animation: v5-fade-in 240ms ease both;
}

/* ── Header title + counter + filter bar ───────────────────── */

.threats-header { margin-bottom: 16px; }

.threats-title-row {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 14px;
}
.threats-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 500;
  font-size: clamp(20px, 1.8vw, 28px);
  letter-spacing: var(--ls-heading);
  text-transform: uppercase;
  margin: 0;
}
.threats-counter {
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--font-body-small);
  color: var(--fg-secondary);
  letter-spacing: 0.06em;
}
.threats-counter strong {
  color: var(--fg-primary);
  font-weight: 500;
  font-family: 'Orbitron', sans-serif;
}

/* Filter bar — reuses .missions-filter from missions-v5.css but we
   provide a copy so threats.html doesn't depend on loading that file. */
.missions-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}
.mf-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px;
  border-radius: 4px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border-subtle);
  transition: box-shadow 120ms ease, background 120ms ease;
}
.mf-group:hover {
  background: var(--bg-elevated);
  box-shadow: inset 0 0 0 1px var(--border-default);
}
.mf-group-wide { min-width: 240px; flex: 1 1 240px; }
.mf-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  white-space: nowrap;
}
.mf-select,
.mf-input {
  font-family: 'Inter', sans-serif;
  font-size: var(--font-body-small);
  color: var(--fg-primary);
  background: transparent;
  min-width: 80px;
  outline: 0;
  appearance: none;
  -webkit-appearance: none;
}
.mf-select { padding-right: 14px; cursor: pointer; }
.mf-input { min-width: 140px; width: 100%; }
.mf-input::placeholder { color: var(--fg-tertiary); }
.mf-reset {
  margin-left: auto;
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--font-body-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  padding: 6px 10px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--border-subtle);
  transition: color 120ms ease, box-shadow 120ms ease;
}
.mf-reset:hover {
  color: var(--fg-primary);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* ── AURUM context bar (slide-in) ─────────────────────────── */

.aurum-bar {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: inset 0 -1px 0 var(--border-subtle);
  transition: max-height 200ms ease-out, opacity 200ms ease-out, margin 200ms ease-out;
  margin-bottom: 0;
}
.aurum-bar:not([hidden]) {
  max-height: 48px;
  opacity: 1;
  margin-bottom: 12px;
}
.aurum-bar-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 12px 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--font-body-small);
  color: var(--fg-secondary);
  letter-spacing: 0.04em;
}
.ab-kpi strong { color: var(--fg-primary); font-weight: 500; }
.ab-sep { color: var(--fg-dimmed); }
.ab-eur { color: var(--fg-primary); }
.ab-head { padding: 0 2px; }
.ab-head.ab-ratio  { color: var(--accent-ratio); }
.ab-head.ab-animus { color: var(--accent-animus); }
.ab-head.ab-fatum  { color: var(--accent-fatum); }
.ab-daily { color: var(--accent-fatum); }

/* ── Split 30/70 ──────────────────────────────────────────── */

.threats-split {
  display: grid;
  grid-template-columns: minmax(320px, 30%) 1fr;
  gap: 14px;
  min-height: clamp(480px, 62vh, 820px);
}

/* ── LEFT — list ──────────────────────────────────────────── */

.threats-list {
  background: var(--bg-panel);
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tl-empty {
  padding: 24px;
  text-align: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--font-body-small);
  color: var(--fg-tertiary);
}
.tl-scroll {
  overflow-y: auto;
  flex: 1 1 auto;
  max-height: clamp(480px, 62vh, 820px);
}
.tl-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: clamp(10px, 1vw, 14px);
  box-shadow: inset 0 -1px 0 var(--border-subtle), inset 3px 0 0 var(--fg-dimmed);
  cursor: pointer;
  transition: background 120ms ease, box-shadow 120ms ease;
}
.tl-card:hover { background: var(--bg-elevated); }
.tl-card--critical { box-shadow: inset 0 -1px 0 var(--border-subtle), inset 3px 0 0 var(--accent-critical); }
.tl-card--high     { box-shadow: inset 0 -1px 0 var(--border-subtle), inset 3px 0 0 var(--accent-high); }
.tl-card--medium   { box-shadow: inset 0 -1px 0 var(--border-subtle), inset 3px 0 0 var(--accent-warning); }
.tl-card--low      { box-shadow: inset 0 -1px 0 var(--border-subtle), inset 3px 0 0 var(--fg-secondary); }
.tl-card--info     { box-shadow: inset 0 -1px 0 var(--border-subtle), inset 3px 0 0 var(--fg-dimmed); }
.tl-card--active {
  background: rgba(86, 194, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(86, 194, 255, 0.3),
              0 0 12px rgba(86, 194, 255, 0.08),
              inset 3px 0 0 currentColor;
}
.tl-card-row1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-cve {
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--font-body-small);
  color: var(--fg-primary);
  letter-spacing: 0.04em;
}
.tl-name {
  font-family: 'Inter', sans-serif;
  font-size: var(--font-body);
  color: var(--fg-secondary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tl-meta {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--fg-tertiary);
  letter-spacing: 0.04em;
}

/* Badges — reused by list + detail header */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.04);
}
.badge-sev-critical { background: rgba(239, 68, 68, 0.14);  color: var(--accent-critical); }
.badge-sev-high     { background: rgba(249, 115, 22, 0.14); color: var(--accent-high); }
.badge-sev-medium   { background: rgba(240, 180, 41, 0.14); color: var(--accent-warning); }
.badge-sev-low      { background: rgba(255, 255, 255, 0.06); color: var(--fg-secondary); }
.badge-sev-info     { background: rgba(255, 255, 255, 0.03); color: var(--fg-tertiary); }
.badge-head-ratio   { background: rgba(86, 194, 255, 0.10); color: var(--accent-ratio); }
.badge-head-animus  { background: rgba(255, 99, 99, 0.10);  color: var(--accent-animus); }
.badge-head-fatum   { background: rgba(188, 140, 255, 0.10); color: var(--accent-fatum); }
.badge-status-open           { background: rgba(255, 255, 255, 0.04); color: var(--fg-secondary); }
.badge-status-assigned       { background: rgba(240, 180, 41, 0.14); color: var(--accent-warning); }
.badge-status-accepted       { background: rgba(249, 115, 22, 0.14); color: var(--accent-high); }
.badge-status-false_positive { background: rgba(255, 255, 255, 0.04); color: var(--fg-tertiary); text-decoration: line-through; }
.badge-status-remediated     { background: rgba(63, 185, 80, 0.14);  color: var(--accent-live); }

/* ── RIGHT — detail ───────────────────────────────────────── */

.threat-detail {
  background: var(--bg-panel);
  border-radius: var(--radius-md);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.td-placeholder {
  padding: 80px 24px;
  text-align: center;
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--font-body-small);
  color: var(--fg-tertiary);
  letter-spacing: 0.06em;
}

.td-header {
  padding: 14px 20px;
  box-shadow: inset 0 -1px 0 var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.td-head-row-1 { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.td-title {
  margin: 0;
  font-family: 'Orbitron', sans-serif;
  font-weight: 500;
  font-size: clamp(14px, 1.2vw, 18px);
  letter-spacing: 0.08em;
  color: var(--fg-primary);
}
.td-cve {
  color: var(--fg-secondary);
  font-size: var(--font-body-small);
  letter-spacing: 0.04em;
}
.td-head-row-2 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.td-badge { font-size: 9px; letter-spacing: 0.14em; padding: 3px 7px; border-radius: 2px; text-transform: uppercase; font-family: 'Share Tech Mono', monospace; }
.td-meta {
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--font-body-small);
  color: var(--fg-tertiary);
  letter-spacing: 0.04em;
}

/* Tabs */
.td-tabs {
  display: flex;
  gap: 2px;
  padding: 0 16px;
  box-shadow: inset 0 -1px 0 var(--border-subtle);
  overflow-x: auto;
}
.td-tab {
  position: relative;
  padding: 12px 14px;
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--font-body-small);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  transition: color 140ms ease;
  white-space: nowrap;
}
.td-tab:hover { color: var(--fg-secondary); }
.td-tab.active { color: var(--fg-primary); }
.td-tab.active::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  background: var(--accent-animus);
}

/* Panels */
.td-body { flex: 1 1 auto; overflow-y: auto; }
.td-panel { display: none; padding: 20px; animation: v5-fade-in 200ms ease; }
.td-panel--active { display: block; }

/* Overview panel grids */
.td-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.td-stat {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.td-stat-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  margin-bottom: 4px;
}
.td-stat-value {
  font-family: 'Orbitron', sans-serif;
  font-size: var(--font-number);
  color: var(--fg-primary);
  line-height: 1.1;
}
.td-stat-sub {
  margin-top: 2px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--fg-secondary);
}
.td-section-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
  margin: 20px 0 8px;
}
.td-desc {
  font-family: 'Inter', sans-serif;
  font-size: var(--font-body);
  color: var(--fg-secondary);
  line-height: 1.55;
  white-space: pre-wrap;
}
.td-host-list { display: flex; flex-direction: column; gap: 6px; }
.td-host-item {
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--font-body-small);
  padding: 6px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xs);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}

/* Remediation tab — 4 action buttons */
.td-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.td-action-btn {
  padding: 14px;
  text-align: left;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
  transition: background 140ms ease, box-shadow 140ms ease;
  font-family: 'Inter', sans-serif;
  color: var(--fg-primary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.td-action-btn:hover:not(:disabled) {
  background: var(--bg-interactive);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.td-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.td-action-btn-primary {
  background: rgba(188, 140, 255, 0.10);
  box-shadow: inset 0 0 0 1px rgba(188, 140, 255, 0.3);
}
.td-action-btn-primary:hover:not(:disabled) {
  background: rgba(188, 140, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(188, 140, 255, 0.5);
}
.td-action-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
}
.td-action-title {
  font-family: 'Orbitron', sans-serif;
  font-size: var(--font-body-plus);
  letter-spacing: 0.06em;
}
.td-action-desc {
  font-size: var(--font-body-small);
  color: var(--fg-secondary);
  line-height: 1.35;
}

/* Evidence + History timelines */
.td-timeline { display: flex; flex-direction: column; gap: 10px; }
.td-event {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.td-event-ts {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--fg-tertiary);
}
.td-event-body {}
.td-event-kind {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-primary);
  margin-right: 8px;
}
.td-event-actor { font-size: var(--font-body-small); color: var(--fg-secondary); }
.td-event-summary { font-size: var(--font-body-small); color: var(--fg-secondary); margin-top: 3px; }

/* Evidence tab — scan diagnostics block */
.td-raw-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.6;
  color: var(--fg-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  margin: 4px 0 12px 0;
  max-height: 280px;
  overflow-y: auto;
}

/* Compliance tab */
.td-framework {
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
  margin-bottom: 10px;
}
.td-framework-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.td-framework-name {
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.08em;
  font-size: var(--font-body-plus);
  color: var(--fg-primary);
}
.td-framework-meta { font-size: var(--font-body-small); color: var(--fg-tertiary); font-family: 'Share Tech Mono', monospace; }
.td-framework-body {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.td-framework.collapsed .td-framework-body { display: none; }
.td-control {
  padding: 8px 10px;
  background: var(--bg-panel);
  border-radius: var(--radius-xs);
  font-size: var(--font-body-small);
  color: var(--fg-secondary);
}
.td-control-ref {
  font-family: 'Share Tech Mono', monospace;
  color: var(--fg-primary);
  letter-spacing: 0.04em;
  margin-right: 6px;
}

/* ── Modals ───────────────────────────────────────────────── */

.th-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 90;
  animation: v5-fade-in 160ms ease both;
}
.th-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: var(--bg-panel);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 0 0 1px var(--border-default);
  z-index: 100;
  display: none;
  flex-direction: column;
  animation: v5-fade-in 200ms ease;
}
.th-modal[aria-hidden="false"] { display: flex; }
.thm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  box-shadow: inset 0 -1px 0 var(--border-subtle);
}
.thm-title {
  font-family: 'Orbitron', sans-serif;
  font-size: var(--font-body-plus);
  letter-spacing: 0.08em;
  margin: 0;
  color: var(--fg-primary);
}
.thm-close { font-family: 'Share Tech Mono', monospace; color: var(--fg-tertiary); padding: 4px 8px; border-radius: 4px; transition: color 120ms ease; }
.thm-close:hover { color: var(--fg-primary); }
.thm-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.thm-field { display: flex; flex-direction: column; gap: 4px; }
.thm-field-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-tertiary);
}
.thm-field-input,
.thm-field-select,
.thm-field-textarea {
  font-family: 'Inter', sans-serif;
  font-size: var(--font-body);
  color: var(--fg-primary);
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-xs);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
  outline: 0;
  resize: vertical;
}
.thm-field-textarea { min-height: 96px; }
.thm-field-hint {
  font-size: 10px;
  color: var(--fg-tertiary);
  font-family: 'Share Tech Mono', monospace;
}
.thm-field-error {
  font-size: 10px;
  color: var(--accent-animus);
  font-family: 'Share Tech Mono', monospace;
}
.thm-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px;
  box-shadow: inset 0 1px 0 var(--border-subtle);
}
.thm-btn {
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  font-family: 'Share Tech Mono', monospace;
  font-size: var(--font-body-small);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: background 120ms ease, box-shadow 120ms ease;
}
.thm-btn-ghost {
  color: var(--fg-secondary);
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}
.thm-btn-ghost:hover { color: var(--fg-primary); box-shadow: inset 0 0 0 1px var(--border-strong); }
.thm-btn-primary {
  background: rgba(86, 194, 255, 0.12);
  color: var(--accent-ratio);
  box-shadow: inset 0 0 0 1px rgba(86, 194, 255, 0.4);
}
.thm-btn-primary:hover { background: rgba(86, 194, 255, 0.20); }
.thm-btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-critical);
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.4);
}
.thm-btn-danger:hover { background: rgba(239, 68, 68, 0.20); }

/* ── Responsive fallback (narrow viewports) ──────────────── */

@media (max-width: 900px) {
  .threats-split { grid-template-columns: 1fr; }
  .threats-list { max-height: 320px; }
  .threats-list .tl-scroll { max-height: 280px; }
  .mf-group-wide { min-width: 100%; flex-basis: 100%; }
}
