/* ATLAS Admin Console — Global Styles */
/* Design System: Dark theme, Segoe UI, ATLAS blue/green accent */

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2332;
  --bg-card: #141c2b;
  --border: #2d3a4a;
  --border-accent: #3b82f6;
  --text-primary: #d0d0d0;
  --text-secondary: #8899aa;
  --text-muted: #556677;
  --accent-blue: #3b82f6;
  --accent-green: #22c55e;
  --accent-yellow: #eab308;
  --accent-red: #ef4444;
  --accent-orange: #f97316;
  --accent-purple: #a855f7;
  --radius: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.4);
}

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

/* root element also needs overflow control */
html {
  overflow: hidden;
  height: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: radial-gradient(ellipse at 20% 0%, rgba(47,129,247,0.06) 0%, transparent 50%), radial-gradient(ellipse at 80% 100%, rgba(34,197,94,0.04) 0%, transparent 50%), linear-gradient(180deg, #0d1117 0%, #0a0e17 100%);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: auto;
}

/* ── Header ─────────────────────────────────────────────────────── */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  height: 48px;
  gap: 16px;
  flex-shrink: 0;
}

.header-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-blue);
  letter-spacing: 0.05em;
}

.header-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
}

.header-license {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: clamp(0.75rem, 1.5vw, 0.9rem);
  font-weight: 600;
  cursor: pointer;
}
.header-license.ok { background: #052e16; color: var(--accent-green); }
.header-license.warn { background: #422006; color: var(--accent-yellow); }
.header-license.expired { background: #450a0a; color: var(--accent-red); }

/* ── Tab Bar ────────────────────────────────────────────────────── */
.tab-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 16px;
  gap: 2px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
  height: calc(100vh - 90px);
  overflow-y: auto;
  overflow-x: auto;
  padding: 24px 32px;
  box-sizing: border-box;
}

/* ── Tab Bar ────────────────────────────────────────────────────── */
.tab-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 16px;
  gap: 2px;
  flex-shrink: 0;
  flex-wrap: wrap;
  height: auto;
  box-sizing: border-box;
}

/* ── Tab Panes ──────────────────────────────────────────────────── */
.tab-pane { display: none; }
.tab-pane.active { display: flex; flex-direction: column; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, #1c2a3d 0%, var(--bg-card) 50%, #0f1825 100%);
  border: 1px solid #2d3a4a;
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 8px 16px 8px;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.03),
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 -1px 0 rgba(0,0,0,0.15);
  position: relative;
}

.card-title {
  font-size: clamp(0.75rem, 1.5vw, 0.9rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 8px 12px 8px;
}

/* ── Metric Cards ───────────────────────────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: linear-gradient(180deg, #1c2a3d 0%, var(--bg-card) 50%, #0f1825 100%);
  border: 1px solid #2d3a4a;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.03),
    inset 0 1px 0 rgba(255,255,255,0.05),
    inset 0 -1px 0 rgba(0,0,0,0.15);
  position: relative;
}
.metric-value { font-size: 1.8rem; font-weight: 700; color: var(--text-primary); }
.metric-label { font-size: clamp(0.75rem, 1.5vw, 0.9rem); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.metric-card.critical .metric-value { color: var(--accent-red); }
.metric-card.warning .metric-value { color: var(--accent-yellow); }
.metric-card.success .metric-value { color: var(--accent-green); }

/* ── Tables ─────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: auto;
  font-size: 0.85rem;
}
.data-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  height: 40px;
  box-sizing: border-box;
  vertical-align: middle;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}
.data-table tr:hover td { background: var(--bg-tertiary); }
.data-table .actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.data-table .actions .btn { flex-shrink: 0; white-space: nowrap; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  padding: 6px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #243044; border-color: #3d4f66; }
.btn-primary { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-success { background: #052e16; border-color: var(--accent-green); color: var(--accent-green); }
.btn-success:hover { background: #064e3b; }
.btn-danger { background: #450a0a; border-color: var(--accent-red); color: var(--accent-red); }
.btn-danger:hover { background: #7f1d1d; }
.btn-sm { padding: 3px 8px; font-size: clamp(0.75rem, 1.5vw, 0.9rem); line-height: 1.2; box-sizing: border-box; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group { margin: 0 8px 12px 8px; }
.form-label { display: block; font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 4px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 7px 10px;
  font-size: 0.85rem;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: clamp(0.7rem, 1.2vw, 0.82rem);
  font-weight: 600;
}
.badge-critical { background: #450a0a; color: var(--accent-red); }
.badge-high { background: #451a03; color: var(--accent-orange); }
.badge-medium { background: #422006; color: var(--accent-yellow); }
.badge-low { background: #052e16; color: var(--accent-green); }
.badge-info { background: #172554; color: #60a5fa; }
.badge-new { background: #3730a3; color: #a5b4fc; }
.badge-acknowledged { background: #1e3a5f; color: #60a5fa; }
.badge-resolved { background: #052e16; color: var(--accent-green); }
.badge-automated { background: #083344; color: #22d3ee; border: 1px solid #155e75; }

/* ── Status Dot ─────────────────────────────────────────────────── */
.status-dot {
  vertical-align: middle;
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.online { background: var(--accent-green); }
.status-dot.offline { background: var(--accent-red); }
.status-dot.pending { background: var(--accent-yellow); }

/* ── Toast ──────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  animation: toastIn 0.2s ease;
}
.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.info { border-left: 3px solid var(--accent-blue); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 8px; width: 90%; max-width: 600px; max-height: 80vh; display: flex; flex-direction: column; }
.modal-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 0.95rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.2rem; cursor: pointer; padding: 0; line-height: 1; }
.modal-close:hover { color: var(--text-primary); }
.modal-body {
  padding: 18px;
  overflow-y: auto;
  overflow-x: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Scrollbar styling for webkit (Chrome/Edge) */
.modal-body ::-webkit-scrollbar { width: 8px; }
.modal-body ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Toolbar ────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 8px 16px 8px;
  flex-wrap: wrap;
}
.toolbar-search { flex: 1; min-width: 200px; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; }

/* ── Sub-tabs ───────────────────────────────────────────────────── */
.sub-tab-bar {
  display: flex;
  gap: 4px;
  margin: 0 8px 16px 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.sub-tab-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 5px 12px;
  cursor: pointer;
  font-size: clamp(0.85rem, 1.8vw, 1rem);
  font-family: inherit;
  border-radius: var(--radius);
}
.sub-tab-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.sub-tab-btn.active { color: var(--accent-blue); background: #172554; border-color: #1e3a8a; }
.sub-tab-btn .count {
  display: inline-block;
  background: var(--bg-primary);
  border-radius: 10px;
  padding: 0 6px;
  font-size: clamp(0.7rem, 1.2vw, 0.82rem);
  margin-left: 4px;
}

/* ── Filter Bar ─────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-bar .form-select { width: auto; min-width: 130px; }
.filter-bar .form-input { width: auto; min-width: 180px; }

/* ── Playbook Cards ─────────────────────────────────────────────── */
.playbook-grid {
  padding-left: 8px;
  padding-right: 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.playbook-card {
  display: flex;
  flex-direction: column;
  margin: 0 8px 12px 8px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.playbook-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.playbook-title { font-size: clamp(1rem, 2.5vw, 1.25rem); font-weight: 600; color: var(--text-primary); }
.playbook-meta { font-size: clamp(0.75rem, 1.5vw, 0.9rem); color: var(--text-muted); margin-top: 4px; }
.playbook-steps { font-size: clamp(0.85rem, 1.8vw, 1rem); color: var(--text-secondary); margin: 8px 0; }
.playbook-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.playbook-tag { background: var(--bg-tertiary); border-radius: 3px; padding: 2px 6px; font-size: clamp(0.7rem, 1.2vw, 0.82rem); color: var(--text-muted); }
.playbook-actions { display: flex; gap: 6px; margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }

/* ── Two-column layout ──────────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid;
  padding-left: 8px;
  padding-right: 8px; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: stretch; }

/* ── Empty State ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.empty-state-icon { font-size: 2rem; margin-bottom: 8px; opacity: 0.5; }

/* ── Loading ────────────────────────────────────────────────────── */
.loading { text-align: center; padding: 30px; color: var(--text-muted); font-size: 0.85rem; }

/* ── Charts ────────────────────────────────────────────────────── */
.bar-chart { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.bar-chart .bar { flex: 1; background: var(--accent-blue); border-radius: 2px 2px 0 0; min-width: 8px; transition: height 0.3s; }
.bar-chart .bar.critical { background: var(--accent-red); }
.bar-chart .bar.high { background: var(--accent-orange); }

/* ── Donut Chart ────────────────────────────────────────────────── */
.donut-chart { position: relative; width: 100px; height: 100px; }
.donut-chart svg { transform: rotate(-90deg); }
.donut-chart text { transform: rotate(90deg); }

/* ── License Strip ──────────────────────────────────────────────── */
.license-strip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 8px 16px 8px;
}
.license-strip.ok { border-color: var(--accent-green); background: #052e16; }
.license-strip.warn { border-color: var(--accent-yellow); background: #422006; }
.license-strip.expired { border-color: var(--accent-red); background: #450a0a; }
.license-info { flex: 1; font-size: 0.82rem; }
.license-info strong { color: var(--text-primary); }

/* ── Airgap File Browser ────────────────────────────────────────── */
.file-browser {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 300px;
  overflow-y: auto;
  overflow-x: auto;
}
.file-item { padding: 6px 12px; display: flex; align-items: center; gap: 8px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 0.82rem; }
.file-item:hover { background: var(--bg-tertiary); }
.file-item input[type="checkbox"] { flex-shrink: 0; }
.file-item.selected { background: #172554; }

/* ── Airgap Queue ───────────────────────────────────────────────── */
.queue-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.queue-item .path { flex: 1; font-size: 0.82rem; color: var(--text-secondary); font-family: monospace; }
.queue-item .category { font-size: clamp(0.75rem, 1.5vw, 0.9rem); }
.queue-item .remove { background: none; border: none; color: var(--accent-red); cursor: pointer; font-size: 1rem; padding: 0; }

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #3d4f66; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #3d4f66; }
/* ── Drop Zone ───────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--text-muted);
  background: var(--bg-secondary);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.06);
  color: var(--text-primary);
}
/* ── Integration Cards ─────────────────────────────────────────── */
.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.int-card {
  margin: 0 8px 16px 8px;
  background: #111827;
  border: 1px solid #1e2a3a;
  border-radius: 10px;
  padding: 16px;
}
.int-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.int-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: #e2e8f0;
}

/* Integration card buttons */
.int-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 20px;
}
.int-edit-btn {
  background: #f59e0b;
  color: #0a0e17;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.int-edit-btn:hover { background: #fbbf24; }
.int-save-btn {
  background: #22c55e;
  color: white;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.int-save-btn:hover { background: #4ade80; }

/* ── Classification Banner (pinned, non-dismissible) ────────────────────────
   Federal compliance feature. Operators must always see their network's
   classification at the top of the admin console — not scrollable, not
   dismissable, not hidden by anything. Color scheme per DoDM 5200.01 Vol 2
   page marking convention: green for CUI/unclass, red for SECRET,
   yellow bg + red text for TOP SECRET.
*/
.classification-banner {
  position: sticky;
  top: 0;
  z-index: 9999;
  width: 100%;
  padding: 10px 20px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: 'Segoe UI', system-ui, sans-serif;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  /* Pinned: not dismissable. No close button, no collapse. */
}

.classification-banner-text {
  display: inline-block;
  vertical-align: middle;
}

/* Pre-load state: dark, neutral. Brief flash on page load before /api/v1/health returns. */
.classification-banner-loading {
  background: #1a2332;
  color: #8899aa;
}

/* Unclassified - CUI: solid green, white text */
.classification-banner-cui {
  background: #15803d;
  color: #ffffff;
  border-bottom: 2px solid #166534;
}

/* Classified - SECRET: solid red, white text */
.classification-banner-secret {
  background: #b91c1c;
  color: #ffffff;
  border-bottom: 2px solid #7f1d1d;
}

/* Classified - TOP SECRET: yellow/amber background, RED text (federal convention) */
.classification-banner-top-secret {
  background: #facc15;
  color: #b91c1c;
  border-bottom: 3px solid #b91c1c;
}

/* ── Rejection Banner (on archived playbook cards) ────────────────────────────
   Rejection is a special case of archive: a playbook can be archived
   because it's retired (no longer needed) OR because an admin explicitly
   rejected it during the suggestion review. The rejection metadata
   (rejected_by, rejected_at, rejection_reason) is preserved on the row,
   so the UI shows this banner only on archived cards where rejection
   data is present. Makes rejection visually distinguishable from a
   normal archive in the Archived tab.
*/
.rejection-banner {
  background: #450a0a;
  border-left: 3px solid #ef4444;
  border-radius: 4px;
  padding: 6px 10px;
  margin: 8px 0 4px 0;
  color: #fecaca;
  font-size: 0.78rem;
  line-height: 1.4;
}
.rejection-banner strong {
  color: #fca5a5;
}

/* ── ATLAS Console panel (dashboard tab) ── */
.console-section {
  margin-top: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.console-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(15, 26, 42, 0.4);
}
.console-icon {
  width: 128px;
  height: auto;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  display: block;
}
.console-head h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.console-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.console-rules {
  display: flex;
  gap: 18px;
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}
.console-rules span { display: flex; align-items: center; gap: 4px; }
.console-rules .ok { color: #10b981; }
.console-rules .no { color: #ef4444; }

.chat {
  padding: 18px 20px;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(10, 14, 23, 0.3);
}
.msg {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}
.msg.user {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}
.msg.atlas {
  background: var(--panel-2);
  border: 1px solid var(--line);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}
.msg .role {
  font-size: 10px;
  text-transform: uppercase;
  color: #556677;
  margin-bottom: 4px;
  letter-spacing: 0.6px;
}
.msg.user .role { color: rgba(255, 255, 255, 0.8); }
.msg .body { white-space: pre-wrap; word-wrap: break-word; }
.msg .meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  line-height: 1.5;
}
.msg .actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.msg .suggested {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.composer {
  border-top: 1px solid var(--line);
  padding: 14px 20px;
  background: rgba(15, 26, 42, 0.3);
}
.composer-wrap {
  position: relative;
}
.attach-btn {
  position: absolute;
  left: 8px;
  bottom: 9px;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  padding: 0;
  z-index: 1;
}
.attach-btn:hover { color: var(--text); border-color: var(--accent); }
.composer-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 10px 12px 10px 38px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  height: 56px;
}
.composer-input:focus { outline: none; border-color: var(--accent); }
.composer-input::placeholder { color: #556677; }
.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 12px;
}
.composer-hint { font-size: 11px; color: #556677; flex: 1; }
.send-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 7px 18px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
}
.send-btn:hover { background: #2563eb; }
.send-btn:disabled { background: var(--neutral); cursor: not-allowed; opacity: 0.6; }

.attachment-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 20px 8px;
  padding: 6px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
}
.attachment-thumb {
  width: 36px;
  height: 28px;
  background: linear-gradient(135deg, #1e3a5f, #3b82f6);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: white;
  font-weight: 600;
  flex-shrink: 0;
}
.attachment-info { flex: 1; min-width: 0; }
.attachment-name { color: var(--text); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-size { font-size: 10px; margin-top: 1px; }
.attachment-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  line-height: 1;
}
.attachment-remove:hover { color: #ef4444; }

/* ─── Audit Report Builder ─── */
.report-builder .lead { color: var(--text-secondary); font-size: 14px; }
.report-filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.report-filters .form-label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.report-filters .form-input, .report-filters .form-select { width: 100%; }
.report-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.report-table { font-size: 12px; }
.report-table th { position: sticky; top: 0; }
.report-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.report-badges .badge { font-size: 11px; }
.report-summary h4 { margin: 0 0 8px 0; }
@media (max-width: 900px) {
  .report-filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .report-filters { grid-template-columns: 1fr; }
}

/* ─── Time Range Quick Picks ─── */
.time-pick {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
}
.time-pick:hover {
  color: var(--text-primary);
  border-color: var(--accent-blue);
}
.time-pick.active {
  background: #172554;
  color: var(--accent-blue);
  border-color: var(--accent-blue);
  font-weight: 600;
}
#custom-range-inputs .form-input {
  width: 220px;
}

/* ─── Active Range Display ─── */
.active-range-display {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
}
.active-range-display .range-label {
  font-weight: 600;
  color: var(--accent-blue);
}
.active-range-display .range-dates {
  color: var(--text-primary);
}

/* ─── Date Range Picker ─── */
.dp-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
}
.dp-popup {
  background: var(--bg-secondary, #1a1f2e);
  border: 1px solid var(--border, #2a3040);
  border-radius: 10px;
  display: flex;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  font-family: 'Inter', sans-serif;
  color: var(--text-primary, #e8ecf4);
}
.dp-sidebar {
  padding: 16px 12px;
  border-right: 1px solid var(--border, #2a3040);
  min-width: 140px;
}
.dp-quick-picks {
  display: flex; flex-direction: column; gap: 4px;
}
.dp-quick {
  background: none; border: none; color: var(--text-secondary, #9aa3b8);
  padding: 8px 12px; text-align: left; cursor: pointer;
  border-radius: 6px; font-size: 13px; font-family: inherit;
  transition: all 0.15s;
}
.dp-quick:hover { background: var(--bg-tertiary, #222838); color: var(--text-primary, #e8ecf4); }
.dp-quick.active { background: #172554; color: var(--accent-blue, #00D4FF); font-weight: 600; }
.dp-calendars {
  display: flex; padding: 16px; gap: 12px;
}
.dp-calendar { width: 280px; }
.dp-month-header {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-bottom: 12px; font-size: 14px; font-weight: 600;
}
.dp-nav {
  background: none; border: none; color: var(--text-secondary, #9aa3b8);
  font-size: 20px; cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.dp-nav:hover { background: var(--bg-tertiary, #222838); color: var(--text-primary, #e8ecf4); }
.dp-day-names { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.dp-day-name { text-align: center; font-size: 11px; color: var(--text-secondary, #9aa3b8); padding: 4px 0; }
.dp-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-day {
  text-align: center; padding: 6px 0; font-size: 12px; cursor: pointer;
  border-radius: 4px; transition: all 0.1s; min-height: 28px;
}
.dp-day:hover { background: var(--bg-tertiary, #222838); }
.dp-day.dp-empty { cursor: default; }
.dp-day.dp-empty:hover { background: none; }
.dp-day.dp-today { font-weight: 700; border: 1px solid var(--accent-blue, #00D4FF); }
.dp-day.dp-range-start { background: var(--accent-blue, #00D4FF); color: #0A0E1A; font-weight: 700; border-radius: 4px 0 0 4px; }
.dp-day.dp-range-end { background: var(--accent-blue, #00D4FF); color: #0A0E1A; font-weight: 700; border-radius: 0 4px 4px 0; }
.dp-day.dp-in-range { background: rgba(0, 212, 255, 0.15); }
.dp-day.dp-range-start.dp-range-end { border-radius: 4px; }
.dp-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid var(--border, #2a3040);
  width: 100%; box-sizing: border-box;
}
.dp-range-display { font-size: 13px; color: var(--text-secondary, #9aa3b8); }
.dp-actions { display: flex; gap: 8px; }
@media (max-width: 800px) {
  .dp-popup { flex-direction: column; }
  .dp-sidebar { border-right: none; border-bottom: 1px solid var(--border, #2a3040); }
  .dp-quick-picks { flex-direction: row; flex-wrap: wrap; }
  .dp-calendars { flex-direction: column; }
}

/* Console icon wrapper */
.console-icon-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}


