/* ==========================================================================
   TrapShield — premium security-console theme
   ========================================================================== */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-var.woff2") format("woff2-variations");
}

:root {
  /* --- Surfaces --- */
  --bg: #080c16;
  --bg-elevated: #0c1220;
  --panel: linear-gradient(180deg, rgba(23, 33, 56, 0.72) 0%, rgba(16, 23, 40, 0.72) 100%);
  --panel-solid: #101728;
  --panel-alt: #17223a;
  --panel-hover: #1a2540;
  --border: rgba(140, 165, 220, 0.14);
  --border-strong: rgba(140, 165, 220, 0.26);

  /* --- Text --- */
  --text: #eef2fb;
  --text-dim: #b7c3dc;
  --muted: #8394b8;
  --faint: #55648a;

  /* --- Brand / accents --- */
  --accent: #2dd9c8;       /* teal — primary brand */
  --accent-2: #6d83ff;     /* violet-blue — secondary brand */
  --accent-glow: rgba(45, 217, 200, 0.35);
  --danger: #ff5d7a;
  --danger-glow: rgba(255, 93, 122, 0.4);
  --warning: #ffb547;
  --success: #35e0a1;
  --info: #6d83ff;

  /* --- Elevation --- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 20px 60px -20px rgba(0, 0, 0, 0.65);
  --shadow-glow: 0 0 0 1px rgba(45, 217, 200, 0.15), 0 8px 30px -8px rgba(45, 217, 200, 0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light theme override -- toggled via data-theme="light" on <html>,
   applied by dashboard.js (see initTheme/applyTheme). Same brand accents
   (teal/violet/danger/warning/success) carry over unchanged since they
   already have enough contrast on a light surface; only surfaces, text,
   borders and shadows are re-tuned.

   This is deliberately NOT a stark all-white theme -- panels keep a soft
   teal/violet-tinted surface instead of plain white/gray, the page
   background keeps visible color washes, and the sidebar stays on the
   dark palette (redeclared just below) so the result reads as "a lighter
   take on the same console," a mix of dark and light, rather than a
   different, flatter app. */
html[data-theme="light"] {
  --bg: #e9edfa;
  --bg-elevated: #ffffff;
  --panel: linear-gradient(160deg, rgba(255, 255, 255, 0.95) 0%, rgba(224, 232, 250, 0.85) 100%);
  --panel-solid: #f7f9fd;
  --panel-alt: #eaeffb;
  --panel-hover: #dfe6f8;
  --border: rgba(45, 74, 130, 0.14);
  --border-strong: rgba(45, 74, 130, 0.26);

  --text: #101728;
  --text-dim: #47536e;
  --muted: #6b7690;
  --faint: #98a2ba;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 24px -8px rgba(15, 23, 42, 0.16);
  --shadow-lg: 0 20px 60px -20px rgba(15, 23, 42, 0.22);
  --shadow-glow: 0 0 0 1px rgba(45, 217, 200, 0.2), 0 8px 30px -8px rgba(45, 217, 200, 0.22);
}

html[data-theme="light"] body {
  background:
    radial-gradient(1100px 620px at 14% -10%, rgba(109, 131, 255, 0.20), transparent 60%),
    radial-gradient(900px 540px at 90% 6%, rgba(45, 217, 200, 0.18), transparent 55%),
    radial-gradient(820px 520px at 45% 105%, rgba(255, 181, 71, 0.10), transparent 60%),
    var(--bg);
}

html[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(30, 41, 59, 0.18); }
html[data-theme="light"] { scrollbar-color: rgba(30, 41, 59, 0.22) transparent; }
html[data-theme="light"] ::selection { color: #0a0f1c; }

/* Keep the sidebar on the dark palette even in light mode -- redeclaring
   the dark-theme variable values scoped to .sidebar means every child
   (nav links, brand text, user chip, section labels) automatically stays
   legible against it with no separate per-component overrides needed. */
html[data-theme="light"] .sidebar {
  --text: #eef2fb;
  --text-dim: #b7c3dc;
  --muted: #8394b8;
  --faint: #55648a;
  --border: rgba(140, 165, 220, 0.14);
  --border-strong: rgba(140, 165, 220, 0.26);
  --panel: linear-gradient(180deg, rgba(23, 33, 56, 0.72) 0%, rgba(16, 23, 40, 0.72) 100%);
  --panel-solid: #101728;
  --panel-alt: #17223a;
  --panel-hover: #1a2540;
  background: linear-gradient(180deg, rgba(20, 28, 48, 0.94) 0%, rgba(11, 16, 28, 0.94) 100%);
  border-right: 1px solid rgba(140, 165, 220, 0.16);
}

* { box-sizing: border-box; }

/* Any author rule that sets `display` on an element (e.g. `.nav-link {
   display: flex }`) otherwise beats the browser's built-in
   `[hidden] { display: none }` default, regardless of selector
   specificity -- author styles simply outrank user-agent styles in the
   cascade. Without this, role-gated elements (like the Admin nav link,
   toggled via `el.hidden = ...` in dashboard.js) stay visibly rendered
   even while `hidden` is set. This single rule guarantees `hidden` always
   wins, app-wide, instead of special-casing it selector by selector. */
[hidden] { display: none !important; }

::selection { background: rgba(45, 217, 200, 0.28); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(140, 165, 220, 0.22);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(140, 165, 220, 0.4); background-clip: padding-box; }

html { scrollbar-width: thin; scrollbar-color: rgba(140, 165, 220, 0.3) transparent; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 560px at 14% -8%, rgba(109, 131, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 88% 8%, rgba(45, 217, 200, 0.12), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Inter Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

code, .mono { font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace; letter-spacing: 0; }

.app-shell { display: flex; min-height: 100vh; position: relative; }

/* faint grid texture behind everything */
.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(140, 165, 220, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(140, 165, 220, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(1200px 800px at 20% 0%, black, transparent 75%);
  z-index: 0;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w, 248px);
  flex-shrink: 0;
  background: rgba(12, 18, 32, 0.6);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; padding: 0 4px; }
.brand-mark {
  width: 38px; height: 38px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
/* The TrapShield logo: a glowing cyan shield (static/img/logo-mark.svg). */
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}
.brand-accent, .auth-visual-brand .brand-accent { color: #3fd6ff; }
[data-theme="light"] .brand-accent { color: #0e9fd0; }
.brand-sub { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 2px; }

.status-pill { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-weight: 600; }
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(45, 217, 200, 0.6);
  animation: pulse-ring 2s var(--ease) infinite;
}
.pulse-dot.pulse-danger { background: var(--danger); box-shadow: 0 0 0 0 rgba(255, 93, 122, 0.6); animation-name: pulse-ring-danger; }

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(45, 217, 200, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(45, 217, 200, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 217, 200, 0); }
}
@keyframes pulse-ring-danger {
  0% { box-shadow: 0 0 0 0 rgba(255, 93, 122, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(255, 93, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 93, 122, 0); }
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; margin-top: 6px; }
.nav-section-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint); padding: 14px 12px 8px;
  display: flex; align-items: center; gap: 6px;
}
.nav-section-tag {
  font-size: 9px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent-2); background: rgba(109, 131, 255, 0.14);
  border: 1px solid rgba(109, 131, 255, 0.3); border-radius: 5px;
  padding: 1px 5px; cursor: help;
}
.content-header h1 .nav-section-tag { margin-left: 4px; vertical-align: middle; }
.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }
.nav-link .nav-label { flex: 1; }
.nav-link:hover { background: rgba(140, 165, 220, 0.08); color: var(--text); transform: translateX(1px); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(45, 217, 200, 0.16), rgba(109, 131, 255, 0.10));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(45, 217, 200, 0.22);
}
.nav-link.active svg { opacity: 1; color: var(--accent); }
.nav-link.active::before {
  content: "";
  position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.badge {
  background: linear-gradient(135deg, var(--danger), #ff3d63);
  color: white;
  border-radius: 999px;
  font-size: 10.5px;
  padding: 1px 7px;
  font-weight: 700;
  box-shadow: 0 2px 8px -1px var(--danger-glow);
}

.sidebar-footer {
  font-size: 11px; color: var(--faint); line-height: 1.6; margin-top: 20px;
  padding: 14px 12px; border-top: 1px solid var(--border);
}
.sidebar-footer strong { color: var(--muted); }

/* --- Content --- */
.content { flex: 1; padding: 26px 32px 60px; overflow-x: hidden; position: relative; z-index: 1; min-width: 0; }

.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
  /* Reserves room so header-actions (Updated / Auto-refresh / any buttons)
     never sits under the fixed theme-toggle button in the top-right
     corner -- .content already has 32px of right padding, this adds
     enough more to clear the button's ~38px width plus its own offset. */
  padding-right: 66px;
}
@media (max-width: 640px) { .content-header { padding-right: 52px; } }
.content-header h1 {
  font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 10px;
}
.content-header .subtitle { font-size: 13px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.header-actions { display: flex; align-items: center; gap: 14px; }

.last-updated { font-size: 11.5px; color: var(--faint); }
.last-updated .mono { color: var(--text-dim); }

.auto-refresh {
  font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px;
  user-select: none; cursor: pointer;
}
.switch {
  position: relative; width: 34px; height: 19px; flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-track {
  position: absolute; inset: 0; background: var(--panel-alt); border: 1px solid var(--border-strong);
  border-radius: 99px; transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--muted); transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.switch input:checked + .switch-track { background: rgba(45, 217, 200, 0.25); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(15px); background: var(--accent); }

.btn {
  border: 1px solid var(--border-strong);
  background: rgba(140, 165, 220, 0.06);
  color: var(--text);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.16s var(--ease);
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { border-color: var(--accent); background: rgba(45, 217, 200, 0.1); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-ghost { background: transparent; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #05121a;
  font-weight: 700;
  box-shadow: 0 8px 22px -6px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 10px 26px -6px var(--accent-glow); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-sm { padding: 5px 11px; font-size: 12px; }

.shield-frontdoor-cell { display: flex; align-items: center; gap: 6px; }
.shield-frontdoor-cell .shield-frontdoor { cursor: pointer; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--border-strong);
  background: rgba(140, 165, 220, 0.06);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease), color 0.16s var(--ease);
}
.icon-btn svg { width: 14px; height: 14px; display: block; }
.icon-btn:hover { border-color: var(--accent); background: rgba(45, 217, 200, 0.1); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.copied { border-color: var(--accent); color: var(--accent); }

/* Theme toggle -- fixed to the top-right corner of the whole viewport so
   it's reachable from every tab, not just re-added to each tab's own
   header-actions row. */
.theme-toggle-fixed {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 60;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  background: var(--panel-solid);
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease), transform 0.16s var(--ease);
}
.theme-toggle-fixed svg { width: 16px; height: 16px; display: block; }
.theme-toggle-fixed:hover { border-color: var(--accent); background: var(--panel-hover); transform: translateY(-1px); }
.theme-toggle-fixed:active { transform: translateY(0); }
@media (max-width: 640px) { .theme-toggle-fixed { top: 12px; right: 14px; width: 34px; height: 34px; } }

select, input[type="text"], input[type="password"], .text-input {
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.16s var(--ease);
}
select:focus, input[type="text"]:focus, input[type="password"]:focus, .text-input:focus { outline: none; border-color: var(--accent); }

.user-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; margin-bottom: 14px;
}
.user-chip-name { font-size: 12.5px; font-weight: 700; color: var(--text); }
.user-chip-role { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.mitre-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px; background: rgba(109, 131, 255, 0.14); color: #b7c1ff;
  border: 1px solid rgba(109, 131, 255, 0.3); white-space: nowrap;
}

.tab-panel { display: none; animation: fade-in 0.35s var(--ease); }
.tab-panel.active { display: block; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Stat cards --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}
.stat-card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.7;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat-card { cursor: pointer; }
.stat-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.stat-card:active { transform: translateY(0); }
.stat-card.danger::before { background: linear-gradient(90deg, var(--danger), #ff3d63); }
.stat-card.danger { border-color: rgba(255, 93, 122, 0.28); }

.stat-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(45, 217, 200, 0.12); color: var(--accent);
  flex-shrink: 0;
}
.stat-icon svg { width: 16px; height: 16px; }
.stat-card.danger .stat-icon { background: rgba(255, 93, 122, 0.14); color: var(--danger); }

.stat-label { font-size: 12px; color: var(--muted); margin-top: 14px; font-weight: 500; }
.stat-value {
  font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.stat-card.danger .stat-value { color: var(--danger); }

/* --- Charts / panels --- */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
}
.panel-title {
  font-size: 12.5px; font-weight: 700; margin-bottom: 14px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 8px;
}
.panel-title svg { width: 14px; height: 14px; color: var(--accent); opacity: 0.9; }
.panel canvas { max-height: 260px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.65; }

/* --- Tables --- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.data-table th {
  text-align: left;
  color: var(--faint);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--panel-solid);
  z-index: 1;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text-dim);
}
.data-table tbody tr { transition: background 0.12s var(--ease); }
.data-table tbody tr:hover { background: rgba(140, 165, 220, 0.06); }
.data-table tbody tr:hover td:first-child { color: var(--text); }
.data-table tbody tr:last-child td { border-bottom: none; }

.ip-pill {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  background: rgba(140, 165, 220, 0.08);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
}

/* Attacker location -- filled in lazily by hydrateIpGeo() in dashboard.js
   next to every ip-pill (see ipPill()). Empty/no-data state renders as
   nothing, so an address with no location data just looks like a plain
   ip-pill rather than showing a broken/empty badge. */
.ip-geo {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 5px;
  font-size: 12px;
  vertical-align: middle;
}
.ip-geo-code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* --- World map (Attacker Origins, Intelligence tab) --- */
.worldmap-panel { margin-bottom: 16px; }
.worldmap-stage {
  position: relative;
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: radial-gradient(120% 140% at 50% 20%, rgba(109, 131, 255, 0.08) 0%, transparent 60%), var(--bg-elevated);
  border: 1px solid var(--border);
}
.worldmap-svg { display: block; width: 100%; height: auto; }

.worldmap-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.03em;
  z-index: 2;
  background: var(--bg-elevated);
  transition: opacity 0.25s var(--ease);
}

.worldmap-sphere {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1;
}
.worldmap-graticule {
  fill: none;
  stroke: var(--border);
  stroke-width: 0.5;
  opacity: 0.6;
}
.worldmap-country {
  fill: var(--panel-alt);
  stroke: var(--bg-elevated);
  stroke-width: 0.6;
  transition: fill 0.5s var(--ease), stroke 0.2s var(--ease);
}
.worldmap-country:hover {
  stroke: var(--accent);
  stroke-width: 1.1;
}
.worldmap-country.has-attacks {
  fill: color-mix(in srgb, var(--danger) calc(var(--intensity, 0.3) * 100%), var(--panel-alt));
}

.worldmap-marker { cursor: pointer; }
.worldmap-marker-dot {
  fill: var(--danger);
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 1;
  filter: drop-shadow(0 0 5px var(--danger-glow));
}
.worldmap-marker-ring {
  fill: none;
  stroke: var(--danger);
  stroke-width: 1.5;
  /* Without this, "center" resolves against the whole <svg> viewport for
     SVG elements (not the circle's own geometry), so the scale animation
     below balloons the ring out from the map's center instead of its own
     -- a classic SVG CSS-transform gotcha. */
  transform-box: fill-box;
  transform-origin: center;
  animation: worldmap-pulse 2.6s var(--ease) infinite;
  opacity: 0;
}
@keyframes worldmap-pulse {
  0%   { transform: scale(0.6); opacity: 0.85; }
  70%  { transform: scale(2.6); opacity: 0; }
  100% { transform: scale(2.6); opacity: 0; }
}

.worldmap-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
  box-shadow: var(--shadow-md);
  max-width: 200px;
  white-space: nowrap;
}
.worldmap-tooltip strong { color: var(--text); }

.worldmap-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.worldmap-legend-scale {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.worldmap-legend-dot {
  display: inline-block;
  width: var(--dot-size, 10px);
  height: var(--dot-size, 10px);
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 4px var(--danger-glow);
  flex-shrink: 0;
}

/* Fallback for browsers without color-mix() support: a flat tinted fill
   instead of a graduated one -- still clearly distinguishes "has attacks"
   countries from the base map, just without intensity shading. */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .worldmap-country.has-attacks { fill: var(--accent-2); opacity: 0.55; }
}

.risk-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.risk-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; }
.risk-low { background: rgba(53, 224, 161, 0.12); color: var(--success); }
.risk-low::before { background: var(--success); }
.risk-medium { background: rgba(255, 181, 71, 0.13); color: var(--warning); }
.risk-medium::before { background: var(--warning); }
.risk-high {
  background: rgba(255, 93, 122, 0.15); color: #ff8296;
  box-shadow: 0 0 0 1px rgba(255, 93, 122, 0.18);
}
.risk-high::before { background: var(--danger); box-shadow: 0 0 6px 1px var(--danger); }

.sev-medium { color: var(--warning); font-weight: 700; }
.sev-high { color: var(--danger); font-weight: 700; }

.retrain-row { display: flex; align-items: center; gap: 16px; margin: 14px 0 4px; flex-wrap: wrap; }
#feedback-progress {
  font-size: 12.5px; color: var(--text-dim); background: var(--panel-alt);
  border: 1px solid var(--border); padding: 7px 13px; border-radius: 999px; font-weight: 600;
}

.callout {
  margin-top: 14px; padding: 12px 15px; border-radius: var(--radius-sm);
  font-size: 13px; border: 1px solid var(--border); display: none; align-items: flex-start; gap: 9px;
}
.callout.show { display: flex; animation: fade-in 0.3s var(--ease); }
.callout.info { background: rgba(109, 131, 255, 0.08); border-color: rgba(109, 131, 255, 0.25); color: #c4cdff; }
.callout.success { background: rgba(53, 224, 161, 0.08); border-color: rgba(53, 224, 161, 0.28); color: #9df3d3; }
.callout.error { background: rgba(255, 93, 122, 0.08); border-color: rgba(255, 93, 122, 0.28); color: #ffb3c0; }
.callout a { color: inherit; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }

/* --- Toggle switch (Deception Mode, and anything else that needs an on/off) --- */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--panel-alt); border: 1px solid var(--border-strong);
  border-radius: 999px; cursor: pointer; transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.switch .track::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: var(--muted); border-radius: 50%; transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.switch input:checked + .track { background: rgba(255, 93, 122, 0.22); border-color: rgba(255, 93, 122, 0.5); }
.switch input:checked + .track::before { transform: translateX(18px); background: #ff5d7a; }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .track { opacity: 0.5; cursor: not-allowed; }

/* --- Deception Mode panel + sidebar badge --- */
.deception-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 14px 0; }
.deception-row-label { display: flex; flex-direction: column; gap: 3px; }
.deception-row-label strong { font-size: 13.5px; color: var(--text); }
.deception-row-label span { font-size: 12px; color: var(--muted); }
.deception-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.04em; color: #ff5d7a; background: rgba(255, 93, 122, 0.12);
  border: 1px solid rgba(255, 93, 122, 0.35); border-radius: 999px; padding: 2px 8px 2px 6px;
  text-transform: uppercase; animation: fade-in 0.3s var(--ease);
  margin: -18px 0 16px 4px;
}
/* An author `display` rule beats the UA [hidden]{display:none} default
   regardless of specificity, so without this override the badge would stay
   visible even while its `hidden` attribute is set by dashboard.js. */
.deception-badge[hidden] { display: none; }
.deception-badge .dot { width: 5px; height: 5px; border-radius: 50%; background: #ff5d7a; animation: pulse-danger-dot 1.4s ease-in-out infinite; }
@keyframes pulse-danger-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* --- Onboarding / quick-start panel --- */
.onboarding-panel {
  display: flex; align-items: flex-start; gap: 14px;
  background: linear-gradient(135deg, rgba(45, 217, 200, 0.10) 0%, rgba(109, 131, 255, 0.10) 100%);
  border: 1px solid rgba(109, 131, 255, 0.28);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 18px;
  animation: fade-in 0.3s var(--ease);
}
.onboarding-panel[hidden] { display: none; }
.onboarding-icon {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #071019;
}
.onboarding-body { flex: 1 1 auto; min-width: 0; }
.onboarding-title { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; color: var(--text); }
.onboarding-text { font-size: 13px; line-height: 1.7; color: var(--text-dim); }
.onboarding-text b { color: var(--text); }
.onboarding-text ul { margin: 6px 0 0; padding-left: 18px; }
.onboarding-text li { margin-bottom: 3px; }
.onboarding-panel .btn { flex: 0 0 auto; margin-top: 2px; }

.live-tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700;
  color: var(--danger); text-transform: uppercase; letter-spacing: 0.06em;
  background: rgba(255, 93, 122, 0.1); padding: 4px 10px; border-radius: 999px;
  border: 1px solid rgba(255, 93, 122, 0.25);
}

.empty-state {
  padding: 40px 20px; text-align: center; color: var(--faint); font-size: 13px;
}

@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .content { padding: 20px 16px 40px; }
}

/* ==========================================================================
   Interaction layer — subtle polish: entrance reveals, tilt, magnetic
   buttons, a custom cursor. Everything here is progressive enhancement
   (see interactions.js): the dashboard is fully usable if any of it fails
   or is disabled, and prefers-reduced-motion turns it all off.
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  transition-delay: var(--reveal-delay, 0s);
}
.reveal.reveal-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.reveal-visible { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* Perspective context for the tilt effect — set on the direct parent of
   whatever gets tilted (grids for cards, the tab/login card for lone panels). */
.stat-grid, .chart-grid, .tab-panel, body { perspective: 1200px; }
/* Tilt (see interactions.js initTilt) is intentionally scoped to the small
   .stat-card / .login-card tiles only, never .panel -- a large panel (a
   full data table, an Admin section) tilting on every mousemove pixel
   reads as flicker rather than polish. .panel still gets a plain
   box-shadow/border-color transition for its (non-tilt) hover states. */
.panel { transition: box-shadow 0.2s var(--ease), border-color 0.2s var(--ease); }
.stat-card, .login-card {
  transition: transform 0.35s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
  will-change: transform;
}

/* Magnetic buttons ease back to rest via this transition once JS clears
   the inline transform on mouseleave. */
.btn { transition: all 0.16s var(--ease), transform 0.25s var(--ease); }

/* Custom cursor — desktop, fine-pointer only; interactions.js only adds
   the has-custom-cursor class after confirming it can run. */
html.has-custom-cursor, html.has-custom-cursor a, html.has-custom-cursor button,
html.has-custom-cursor input, html.has-custom-cursor select, html.has-custom-cursor .nav-link,
html.has-custom-cursor .switch { cursor: none; }

.ts-cursor {
  position: fixed; top: 0; left: 0; width: 22px; height: 22px;
  border: 1.5px solid var(--accent); border-radius: 50%;
  pointer-events: none; z-index: 9999; opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.25s var(--ease), width 0.22s var(--ease), height 0.22s var(--ease),
              background 0.22s var(--ease);
  mix-blend-mode: difference;
  will-change: transform;
}
.ts-cursor.is-visible { opacity: 0.85; }
.ts-cursor.is-hover { width: 42px; height: 42px; background: rgba(45, 217, 200, 0.14); }
.ts-cursor.is-down { width: 16px; height: 16px; }

@media (pointer: coarse), (hover: none) {
  .ts-cursor { display: none !important; }
  html.has-custom-cursor, html.has-custom-cursor a, html.has-custom-cursor button,
  html.has-custom-cursor input, html.has-custom-cursor select, html.has-custom-cursor .nav-link {
    cursor: auto;
  }
}

/* ==========================================================================
   Auth pages (login / forgot-password / reset-password) -- split-screen
   cover layout shared by app/templates/login.html, forgot_password.html
   and reset_password.html.
   ========================================================================== */
body.auth-body { min-height: 100vh; }
.auth-page { display: flex; min-height: 100vh; width: 100%; }

/* ---- Left cover panel ---- */
.auth-visual {
  flex: 1 1 56%;
  position: relative;
  overflow: hidden;
  padding: 0;
  background:
    radial-gradient(900px 600px at 15% -10%, rgba(109, 131, 255, 0.28), transparent 60%),
    radial-gradient(800px 700px at 100% 110%, rgba(45, 217, 200, 0.22), transparent 60%),
    linear-gradient(165deg, #070b14 0%, #0b1424 48%, #08201d 100%);
}
.auth-visual::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(140, 165, 220, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(140, 165, 220, 0.07) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(1000px 700px at 30% 30%, black, transparent 75%);
  -webkit-mask-image: radial-gradient(1000px 700px at 30% 30%, black, transparent 75%);
}
.auth-visual-content { position: absolute; inset: 0; z-index: 1; max-width: none; }

/* Logo overlaid on top of the full-bleed hero image */
.auth-visual-brand {
  position: absolute;
  top: 28px;
  left: 32px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  padding: 7px 16px 7px 7px;
  background: rgba(7, 11, 20, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}
.auth-visual-brand .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.auth-visual-brand .brand-mark svg { width: 19px; height: 19px; }
.auth-visual-brand span { font-weight: 800; font-size: 16px; letter-spacing: -0.02em; color: #eef2fb; }

/* Hero image now fills the entire left panel, edge to edge */
.auth-hero { position: absolute; inset: 0; margin: 0; }
.auth-hero svg { width: 100%; height: 100%; display: block; }
.auth-hero img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 0;
  border: none;
  box-shadow: none;
}
/* Subtle top scrim so the logo stays legible over bright parts of the photo */
.auth-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 7, 13, 0.55) 0%, rgba(4, 7, 13, 0) 22%, rgba(4, 7, 13, 0) 78%, rgba(4, 7, 13, 0.35) 100%);
  pointer-events: none;
}

/* Hero illustration motion -- subtle, decorative only. */
@keyframes auth-radar-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.hero-radar { transform-box: fill-box; transform-origin: center; }
.hero-radar--slow { animation: auth-radar-spin 50s linear infinite; }
.hero-radar--rev { animation: auth-radar-spin 38s linear infinite reverse; }

@keyframes auth-node-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.hero-node-safe { animation: auth-node-pulse 2.6s ease-in-out infinite; }
.hero-node-safe:nth-child(2) { animation-delay: 0.4s; }
.hero-node-safe:nth-child(3) { animation-delay: 0.8s; }
.hero-node-safe:nth-child(4) { animation-delay: 1.2s; }

@keyframes auth-threat-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(1.25); } }
.hero-node-threat { transform-box: fill-box; transform-origin: center; animation: auth-threat-pulse 1.6s ease-in-out infinite; }

@keyframes auth-threat-line { to { stroke-dashoffset: -18; } }
.hero-threat-line { animation: auth-threat-line 1s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .hero-radar, .hero-node-safe, .hero-node-threat, .hero-threat-line { animation: none; }
}

.auth-visual h1 {
  font-size: 27px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.28;
  color: #f4f7ff; margin: 0 0 12px;
}
.auth-visual h1 .accent-text {
  background: linear-gradient(90deg, #2dd9c8, #6d83ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-visual > .auth-visual-content > p.tagline {
  font-size: 14.5px; line-height: 1.65; color: #aeb9d6; margin: 0 0 28px; max-width: 400px;
}

.auth-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-features li { display: flex; align-items: flex-start; gap: 12px; font-size: 13.5px; color: #c7d0e8; line-height: 1.5; }
.auth-feature-icon {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(45, 217, 200, 0.12); color: #2dd9c8;
  border: 1px solid rgba(45, 217, 200, 0.22);
}
.auth-feature-icon svg { width: 15px; height: 15px; }
.auth-features b { color: #eef2fb; }

@media (max-width: 880px) {
  .auth-visual { display: none; }
}

/* ---- Right form panel ---- */
.auth-form-side {
  flex: 1 1 44%;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
  position: relative;
}
.login-card {
  width: 380px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 34px 32px; box-shadow: var(--shadow-lg); position: relative; z-index: 1;
  backdrop-filter: blur(20px);
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .brand-mark { width: 52px; height: 52px; border-radius: 14px; }
.login-brand .brand-mark svg { width: 28px; height: 28px; }
.login-brand h1 { font-size: 19px; margin: 0; font-weight: 800; letter-spacing: -0.02em; }
.login-brand p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.field small { display: block; font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.field input {
  width: 100%; background: var(--panel-alt); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text); font-size: 14px; font-family: inherit;
}
.field input:focus { outline: none; border-color: var(--accent); }
.login-btn { width: 100%; justify-content: center; padding: 11px; font-size: 14px; margin-top: 4px; }
.login-error {
  background: rgba(255, 93, 122, 0.1); border: 1px solid rgba(255, 93, 122, 0.3); color: #ffb3c0;
  padding: 10px 13px; border-radius: var(--radius-sm); font-size: 12.5px; margin-bottom: 16px;
}
.login-success {
  background: rgba(53, 224, 161, 0.1); border: 1px solid rgba(53, 224, 161, 0.3); color: #8ff0cf;
  padding: 10px 13px; border-radius: var(--radius-sm); font-size: 12.5px; margin-bottom: 16px; line-height: 1.6;
}
.reset-link-box {
  background: var(--panel-alt); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 12px; word-break: break-all; margin-bottom: 16px; color: var(--accent);
}
.divider { display: flex; align-items: center; gap: 10px; margin: 20px 0; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.sso-btn { width: 100%; justify-content: center; padding: 10px; }
.login-footer { text-align: center; margin-top: 22px; font-size: 11px; color: var(--faint); line-height: 1.6; }
.login-footer a, .forgot-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.login-footer a:hover, .forgot-link:hover { text-decoration: underline; }
.forgot-link-row { text-align: right; margin: -8px 0 16px; }
.forgot-link-row a { font-size: 12px; color: var(--text-dim); text-decoration: none; }
.forgot-link-row a:hover { color: var(--accent); }

/* ==========================================================================
   Public landing page (app/templates/landing.html, served at "/" for
   anyone not signed in -- see app/routes/dashboard.py). Reuses the same
   tokens, .btn/.panel/.stat-card/.brand-mark primitives and .reveal /
   .ts-cursor interaction layer as the dashboard and auth pages, so it
   reads as the same product rather than a bolted-on marketing site.
   ========================================================================== */
body.landing-body { min-height: 100vh; }

.landing-shell {
  position: relative;
  min-height: 100vh;
  overflow-x: clip;
}
.landing-shell::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(1100px 620px at 14% -10%, rgba(109, 131, 255, 0.20), transparent 60%),
    radial-gradient(900px 540px at 90% 4%, rgba(45, 217, 200, 0.18), transparent 55%),
    radial-gradient(820px 520px at 50% 100%, rgba(255, 181, 71, 0.08), transparent 60%),
    var(--bg);
}

.landing-container { max-width: 1180px; margin: 0 auto; padding: 0 28px; }

/* ---- Nav ---- */
.landing-nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  background: rgba(8, 12, 22, 0.72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.landing-nav .brand { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0; }
.landing-nav .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
.landing-nav .brand-mark svg { width: 18px; height: 18px; }
.landing-nav .brand-name { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.landing-nav-links { display: flex; align-items: center; gap: 26px; }
.landing-nav-links a {
  font-size: 13.5px; font-weight: 600; color: var(--text-dim); text-decoration: none;
}
.landing-nav-links a:hover { color: var(--text); }
.landing-nav-cta { display: flex; align-items: center; gap: 10px; }
@media (max-width: 760px) { .landing-nav-links { display: none; } }

/* ---- Hero ---- */
.landing-hero {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 48px; align-items: center;
  padding: 84px 0 60px;
}
.landing-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); background: rgba(45, 217, 200, 0.1);
  border: 1px solid rgba(45, 217, 200, 0.24); border-radius: 999px;
  padding: 6px 13px; margin-bottom: 18px;
}
.landing-eyebrow .pulse-dot { position: static; }
.landing-hero h1 {
  font-size: 46px; line-height: 1.14; font-weight: 800; letter-spacing: -0.03em;
  color: var(--text); margin: 0 0 18px;
}
.landing-hero h1 .accent-text {
  background: linear-gradient(90deg, #2dd9c8, #6d83ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.landing-hero .tagline { font-size: 16px; line-height: 1.7; color: var(--text-dim); max-width: 480px; margin: 0 0 30px; }
.landing-cta-row { display: flex; align-items: center; gap: 14px; margin-bottom: 34px; flex-wrap: wrap; }
.landing-cta-row .btn { padding: 12px 20px; font-size: 14.5px; }
.landing-chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.landing-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--text-dim);
  background: var(--panel-alt); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 13px;
}
.landing-chip svg { width: 13px; height: 13px; color: var(--accent); flex-shrink: 0; }

/* ---- Hero radar illustration (reuses .hero-radar/.hero-node-* keyframes
   defined above under "Auth pages") ---- */
.landing-hero-visual {
  position: relative; aspect-ratio: 1 / 1; max-width: 420px; margin: 0 auto;
}
.landing-hero-visual svg { width: 100%; height: 100%; }
.landing-radar-ring { fill: none; stroke: rgba(140, 165, 220, 0.16); stroke-width: 1; }
.landing-radar-sweep { fill: url(#radarSweepGradient); transform-box: fill-box; transform-origin: center; }
@media (max-width: 920px) {
  .landing-hero { grid-template-columns: 1fr; padding-top: 56px; text-align: center; }
  .landing-hero .tagline { margin-left: auto; margin-right: auto; }
  .landing-cta-row, .landing-chip-row { justify-content: center; }
  .landing-hero-visual { max-width: 300px; }
}

/* ---- Section shell ---- */
.landing-section { padding: 54px 0; }
.landing-section-head { max-width: 620px; margin: 0 0 34px; }
.landing-section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.landing-kicker {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); margin: 0 0 10px;
}
.landing-section-head h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 10px; color: var(--text); }
.landing-section-head p { font-size: 14.5px; line-height: 1.7; color: var(--muted); margin: 0; }

/* ---- Stats strip ---- */
.landing-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }

/* ---- "How it works" steps ---- */
.landing-steps {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px;
  counter-reset: step;
}
.landing-step { position: relative; }
.landing-step-num {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 9px; margin-bottom: 12px;
  background: linear-gradient(135deg, rgba(45, 217, 200, 0.18), rgba(109, 131, 255, 0.18));
  border: 1px solid var(--border-strong); color: var(--accent);
  font-weight: 800; font-size: 13px;
}
.landing-step h3 { font-size: 14.5px; font-weight: 700; color: var(--text); margin: 0 0 8px; }
.landing-step p { font-size: 13px; line-height: 1.65; color: var(--muted); margin: 0; }

/* ---- Feature grid ---- */
.landing-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; }
.landing-features .panel { margin-bottom: 0; }
.landing-features .panel p { font-size: 13px; line-height: 1.68; color: var(--muted); margin: 0; }

/* ---- CTA banner ---- */
.landing-cta-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: 30px 34px; box-shadow: var(--shadow-glow);
}
.landing-cta-banner h2 { font-size: 20px; font-weight: 800; margin: 0 0 6px; color: var(--text); }
.landing-cta-banner p { font-size: 13.5px; color: var(--muted); margin: 0; }

/* ---- Footer ---- */
.landing-footer {
  border-top: 1px solid var(--border); padding: 30px 0 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.landing-footer-brand { display: flex; align-items: center; gap: 10px; }
.landing-footer-brand .brand-mark { width: 26px; height: 26px; border-radius: 8px; }
.landing-footer-brand .brand-mark svg { width: 14px; height: 14px; }
.landing-footer-brand span { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.landing-footer-note { font-size: 12px; color: var(--faint); text-align: right; line-height: 1.6; }
.landing-footer-links { display: flex; gap: 18px; }
.landing-footer-links a { font-size: 12.5px; color: var(--text-dim); text-decoration: none; font-weight: 600; }
.landing-footer-links a:hover { color: var(--accent); }
@media (max-width: 640px) {
  .landing-footer { flex-direction: column; text-align: center; }
  .landing-footer-note { text-align: center; }
}

/* ---------------- Session replay modal ---------------- */
.replay-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(4, 8, 16, 0.72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.replay-overlay[hidden] { display: none; }
.replay-modal {
  background: var(--surface-1, #0f1724); border: 1px solid var(--border, #22304a);
  border-radius: 14px; width: min(760px, 100%); max-height: 86vh;
  display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.replay-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border, #22304a);
}
.replay-head h2 { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.replay-head .muted { font-size: 12.5px; }
.replay-controls {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  border-bottom: 1px solid var(--border, #22304a);
}
.replay-controls #replay-scrub { flex: 1; accent-color: var(--accent, #2dd9c8); }
.replay-steps {
  list-style: none; margin: 0; padding: 8px 12px; overflow-y: auto; flex: 1;
}
.replay-step {
  display: flex; gap: 12px; padding: 9px 10px; border-radius: 8px;
  opacity: .4; transition: opacity .15s, background .15s;
}
.replay-step.played { opacity: 1; }
.replay-step.current { background: rgba(45, 217, 200, .10); }
.replay-step-time { color: var(--text-dim, #8aa0bf); font-size: 12px; min-width: 56px; padding-top: 1px; }
.replay-step-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.replay-step-type {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent, #2dd9c8); font-weight: 700;
}
.replay-step-summary { font-size: 13.5px; word-break: break-word; }
.replay-step-ua { font-size: 11px; color: var(--text-dim, #8aa0bf); word-break: break-all; }

/* ==========================================================================
   Movable sidebar (sidebar.js): drag the right edge to resize it, collapse
   it to an icon rail with the edge tab or Ctrl+B, and on phones it slides
   in from the left as a drawer. The width and collapsed state are
   remembered per browser.
   ========================================================================== */

.sidebar { transition: width 0.24s var(--ease), padding 0.24s var(--ease), transform 0.28s var(--ease); }
.app-shell.sidebar-resizing .sidebar { transition: none; }
.app-shell.sidebar-resizing, .app-shell.sidebar-resizing * { cursor: col-resize !important; user-select: none; }

.sidebar-toggle {
  position: absolute; top: 30px; right: -12px; z-index: 12;
  width: 24px; height: 24px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); background: var(--panel-solid); color: var(--text-dim);
  cursor: pointer; padding: 0;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease), transform 0.24s var(--ease);
}
.sidebar-toggle:hover { color: var(--accent); border-color: var(--accent); }
.sidebar-toggle svg { display: block; }

.sidebar-resizer {
  position: absolute; top: 0; right: -4px; bottom: 0; width: 8px; z-index: 11;
  cursor: col-resize; touch-action: none;
}
.sidebar-resizer::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px;
  background: var(--accent); opacity: 0; transition: opacity 0.16s var(--ease);
}
.sidebar-resizer:hover::after, .sidebar-resizer:focus-visible::after,
.app-shell.sidebar-resizing .sidebar-resizer::after { opacity: 0.7; }
.sidebar-resizer:focus-visible { outline: none; }

/* Collapsed: an icon rail (desktop only; on phones the sidebar is a drawer). */
@media (min-width: 901px) {
  .app-shell.sidebar-collapsed .sidebar { width: 72px; padding-left: 12px; padding-right: 12px; }
  .app-shell.sidebar-collapsed .sidebar-toggle { transform: rotate(180deg); }
  .app-shell.sidebar-collapsed .sidebar-resizer { display: none; }
  .app-shell.sidebar-collapsed .brand { justify-content: center; padding: 0; }
  .app-shell.sidebar-collapsed .brand > div:not(.brand-mark),
  .app-shell.sidebar-collapsed .nav-label,
  .app-shell.sidebar-collapsed .user-chip-info,
  .app-shell.sidebar-collapsed .sidebar-footer-text { display: none; }
  .app-shell.sidebar-collapsed .nav-section-label { font-size: 0; padding: 10px 0 6px; justify-content: center; }
  .app-shell.sidebar-collapsed .nav-section-label::before { content: ""; width: 22px; height: 1px; background: var(--border-strong); }
  .app-shell.sidebar-collapsed .nav-section-tag { display: none; }
  .app-shell.sidebar-collapsed .nav-link { justify-content: center; padding: 11px 0; }
  .app-shell.sidebar-collapsed .nav-link.active::before { left: -12px; }
  .app-shell.sidebar-collapsed .nav-link .badge { position: absolute; top: 3px; right: 4px; font-size: 9px; padding: 0 5px; }
  .app-shell.sidebar-collapsed .deception-badge { font-size: 0; gap: 0; padding: 6px; justify-content: center; align-self: center; }
  .app-shell.sidebar-collapsed .sidebar-footer { padding: 12px 0 0; }
  .app-shell.sidebar-collapsed .user-chip { flex-direction: column; padding: 6px 4px; margin-bottom: 0; }
}

.sidebar-open-btn, .sidebar-scrim { display: none; }

/* Phones and small tablets: the sidebar is a drawer, closed by default. */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; height: 100dvh;
    width: min(280px, 84vw); padding: 22px 16px;
    overflow-y: auto; z-index: 70;
    background: rgba(10, 15, 28, 0.97);
    transform: translateX(-105%);
  }
  .app-shell.sidebar-open .sidebar { transform: none; box-shadow: 24px 0 60px -20px rgba(0, 0, 0, 0.7); }
  .sidebar-toggle, .sidebar-resizer { display: none !important; }
  .sidebar-scrim {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(3, 6, 14, 0.55); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity 0.24s var(--ease);
  }
  .sidebar-scrim[hidden] { display: block; }
  .app-shell.sidebar-open .sidebar-scrim { opacity: 1; pointer-events: auto; }

  .sidebar-open-btn {
    display: flex; align-items: center; justify-content: center;
    position: fixed; top: 12px; left: 14px; z-index: 60;
    width: 38px; height: 38px; border-radius: 999px; padding: 0;
    border: 1px solid var(--border-strong); background: var(--panel-solid); color: var(--text);
    cursor: pointer;
  }
  .sidebar-open-btn svg { display: block; }
  .content { padding-top: 62px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-toggle, .sidebar-scrim { transition: none; }
}
