/* ════════════════════════════════════════════════════════════════
   KQLAB — Design System v3.0
   Direction artistique : Cybersecurity Intelligence Platform
   Inspiré de : Crimson7 Research + Syswarden
   ════════════════════════════════════════════════════════════════ */

/* ── Imports ─────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* ── Variables — Dark (défaut) ───────────────────────────────── */
:root {
  /* ── Backgrounds — Faraday-inspired slate navy ── */
  --bg-base:    #0f172a;
  --bg-surface: #1e293b;
  --bg-raised:  #263347;
  --bg-input:   #1e293b;
  --bg-hover:   #334155;
  --bg-active:  #3d4f6a;
  --bg-overlay: rgba(15, 23, 42, 0.92);

  /* ── Primaire — sky blue (brand KQLab) ── */
  --primary:        #0ea5e9;
  --primary-dim:    rgba(14, 165, 233, 0.12);
  --primary-border: rgba(14, 165, 233, 0.30);
  --primary-hover:  #38bdf8;

  /* ── Secondaire — blue (gradient logo) ── */
  --accent:         #3b82f6;
  --accent-dim:     rgba(59, 130, 246, 0.12);
  --accent-border:  rgba(59, 130, 246, 0.28);

  /* ── Violet — MITRE, intelligence ── */
  --intel:          #7c3aed;
  --intel-dim:      rgba(124, 58, 237, 0.12);
  --intel-border:   rgba(124, 58, 237, 0.28);

  /* ── Sévérités ── */
  --sev-critical:        #ff2d55;
  --sev-critical-bg:     rgba(255, 45, 85, 0.12);
  --sev-critical-border: rgba(255, 45, 85, 0.25);
  --sev-high:            #ff6b35;
  --sev-high-bg:         rgba(255, 107, 53, 0.12);
  --sev-high-border:     rgba(255, 107, 53, 0.25);
  --sev-medium:          #ffd60a;
  --sev-medium-bg:       rgba(255, 214, 10, 0.10);
  --sev-medium-border:   rgba(255, 214, 10, 0.22);
  --sev-low:             #2dd4bf;
  --sev-low-bg:          rgba(45, 212, 191, 0.10);
  --sev-low-border:      rgba(45, 212, 191, 0.22);
  --sev-info:            #6366f1;
  --sev-info-bg:         rgba(99, 102, 241, 0.10);
  --sev-info-border:     rgba(99, 102, 241, 0.22);

  /* ── Texte ── */
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary:  #64748b;
  --text-accent:    #38bdf8;
  --text-danger:    #ff2d55;
  --text-success:   #2dd4bf;
  --text-warning:   #ffd60a;
  --text-code:      #7dd3fc;

  /* ── Bordures ── */
  --border:         rgba(148, 163, 184, 0.08);
  --border-medium:  rgba(148, 163, 184, 0.14);
  --border-strong:  rgba(148, 163, 184, 0.24);
  --border-accent:  rgba(14, 165, 233, 0.28);
  --border-primary: rgba(14, 165, 233, 0.30);

  /* ── Polices ── */
  --font-ui:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* ── Typographie ── */
  --text-xs:   11px;
  --text-sm:   12px;
  --text-base: 14px;
  --text-md:   15px;
  --text-lg:   17px;
  --text-xl:   20px;
  --text-2xl:  24px;
  --text-3xl:  30px;
  --text-4xl:  38px;

  /* ── Spacing ── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* ── Border radius ── */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-full: 999px;

  /* ── Ombres ── */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.40);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.50);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.60);
  --shadow-glow-primary: 0 0 24px rgba(14, 165, 233, 0.18);
  --shadow-glow-accent:  0 0 24px rgba(59, 130, 246, 0.12);

  /* ── Transitions ── */
  --transition-fast: 120ms ease-out;
  --transition-base: 200ms ease-out;
  --transition-slow: 350ms ease-out;

  /* ── Z-index ── */
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  500;
  --z-modal:    600;
  --z-toast:    700;

  /* ════ LEGACY ALIASES (backward-compat inline styles) ════ */
  --bg:    #0f172a;
  --s1:    #1e293b;
  --s2:    #263347;
  --s3:    #334155;
  --bd:    rgba(148,163,184,0.08);
  --bd2:   rgba(148,163,184,0.14);
  --t1:    #f1f5f9;
  --t2:    #cbd5e1;
  --t3:    #94a3b8;
  --t4:    #64748b;
  --t5:    #475569;
  --red:   #ef4444;
  --red2:  #f87171;
  --red3:  rgba(239,68,68,0.35);
  --rdim:  rgba(239,68,68,0.12);
  --green: #2dd4bf;
  --blue:  #3b82f6;
  --orange:#f59e0b;
  --purple:#7c3aed;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:  'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --sh-sm: 0 1px 3px rgba(0,0,0,.40);
  --sh-md: 0 4px 16px rgba(0,0,0,.50);
  --sh-lg: 0 8px 32px rgba(0,0,0,.60);
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --tr:    150ms ease-out;
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --glass-bg: rgba(255,255,255,0.025);
  --glass-bd: rgba(255,255,255,0.07);

  /* ── Layout dimensions ── */
  --hdr-h: 56px;
}

/* ── Mode clair — warm stone (reposant pour les yeux) ───────── */
body.light {
  /* Warm parchment — 88-92% luminance, easy on eyes for extended sessions */
  --bg-base:    #e9e5df;
  --bg-surface: #eeeae4;
  --bg-raised:  #e1ddd7;
  --bg-input:   #e9e5df;
  --bg-hover:   #d8d3cc;
  --bg-active:  #cac5bd;
  --bg-overlay: rgba(233, 229, 223, 0.96);

  /* Warm neutral text — no cold navy */
  --text-primary:   #1c1917;
  --text-secondary: #3d3732;
  --text-tertiary:  #706b65;
  --text-code:      #0369a1;
  --text-accent:    #0284c7;
  --text-warning:   #92400e;
  --text-success:   #065f46;
  --text-danger:    #b91c1c;

  /* Primary stays sky blue */
  --primary:        #0ea5e9;
  --primary-dim:    rgba(14, 165, 233, 0.10);
  --primary-border: rgba(14, 165, 233, 0.28);
  --primary-hover:  #0284c7;

  /* Accent — blue */
  --accent:         #3b82f6;
  --accent-dim:     rgba(59, 130, 246, 0.09);
  --accent-border:  rgba(59, 130, 246, 0.22);

  /* MITRE violet */
  --intel:          #6d28d9;
  --intel-dim:      rgba(109, 40, 217, 0.07);
  --intel-border:   rgba(109, 40, 217, 0.20);

  /* Sévérités */
  --sev-medium:          #b45309;
  --sev-medium-bg:       rgba(180, 83, 9, 0.07);
  --sev-medium-border:   rgba(180, 83, 9, 0.20);
  --sev-low:             #0d9488;
  --sev-low-bg:          rgba(13, 148, 136, 0.07);
  --sev-low-border:      rgba(13, 148, 136, 0.20);
  --sev-critical-bg:     rgba(220, 38, 38, 0.07);
  --sev-high-bg:         rgba(234, 88, 12, 0.07);
  --sev-info-bg:         rgba(99, 102, 241, 0.07);

  /* Slightly stronger borders to define edges on warm bg */
  --border:         rgba(0,0,0,0.09);
  --border-medium:  rgba(0,0,0,0.14);
  --border-strong:  rgba(0,0,0,0.22);

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.13);
  --shadow-glow-primary: 0 0 20px rgba(14, 165, 233, 0.10);
  --shadow-glow-accent:  0 0 20px rgba(59, 130, 246, 0.07);

  /* Legacy aliases — light warm */
  --bg:    #e9e5df;
  --s1:    #eeeae4;
  --s2:    #e1ddd7;
  --s3:    #d8d3cc;
  --bd:    rgba(0,0,0,0.09);
  --bd2:   rgba(0,0,0,0.14);
  --t1:    #1c1917;
  --t2:    #292524;
  --t3:    #57534e;
  --t4:    #78716c;
  --t5:    #a8a29e;
  --rdim:  rgba(239,68,68,0.09);
  --red:   #ef4444;
  --red2:  #f87171;
  --green: #0d9488;
  --blue:  #3b82f6;
  --glass-bg: rgba(0,0,0,0.025);
  --glass-bd: rgba(0,0,0,0.07);
}

/* ════════════════════════════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-base);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(14, 165, 233, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(59, 130, 246, 0.04) 0%, transparent 50%);
  background-attachment: fixed;
}

body.light {
  background-image: none;
}

img { display: block; max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

::selection {
  background: var(--accent-dim);
  color: var(--text-accent);
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ── Focus ring ──────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ════════════════════════════════════════════════════════════════
   FORM ELEMENTS
════════════════════════════════════════════════════════════════ */
input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  outline: none;
  width: 100%;
  font-size: var(--text-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  line-height: 1.5;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--bg-input);
}
input::placeholder, textarea::placeholder { color: var(--text-tertiary); font-weight: 400; }
input.dim { color: var(--text-tertiary); background: var(--bg-base); }
textarea { resize: vertical; font-family: var(--font-mono); font-size: var(--text-sm); line-height: 1.6; min-height: 80px; }
select option { background: var(--bg-raised); color: var(--text-primary); }

body.light input, body.light select, body.light textarea {
  background: var(--bg-surface); border-color: var(--border-medium); color: var(--text-primary);
}
body.light input:focus, body.light select:focus, body.light textarea:focus {
  background: var(--bg-surface);
}

/* ════════════════════════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════════════════════════ */
button {
  cursor: pointer;
  border: 1px solid var(--border-medium);
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 8px 15px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: var(--text-sm);
  transition: all var(--transition-fast);
  line-height: 1;
  white-space: nowrap;
  font-family: var(--font-ui);
}
button:hover { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text-primary); }
button:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
button:active  { transform: scale(0.97); }
button:disabled:active { transform: none; }

/* Primary — sky blue CTA */
button.pri, .btn-primary {
  background: var(--primary);
  border-color: var(--primary-border);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(14,165,233,.28);
}
button.pri:hover, .btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 16px rgba(14,165,233,.40);
}
button.pri:active, .btn-primary:active { box-shadow: none; }

/* Secondary */
button.ok, .btn-secondary {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
button.ok { background: var(--sev-low-bg); border-color: var(--sev-low-border); color: var(--sev-low); }
button.ok:hover { background: rgba(45,212,191,.18); }
.btn-secondary:hover { border-color: var(--border-strong); color: var(--text-primary); background: var(--bg-hover); }

/* Ghost */
button.ghost, .btn-ghost {
  background: none;
  border: none;
  color: var(--text-tertiary);
  padding: 6px 10px;
}
button.ghost:hover, .btn-ghost:hover { color: var(--text-secondary); background: var(--bg-hover); }

button.full { width: 100%; padding: 13px 0; font-size: var(--text-base); border-radius: var(--radius-md); }
button.outline-red { border-color: var(--primary); color: var(--primary); background: transparent; }
button.outline-red:hover { background: var(--primary-dim); }

/* Btn component classes */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 7px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-ui); font-size: var(--text-sm); font-weight: 500;
  line-height: 1; cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap; border: 1px solid transparent;
  text-decoration: none; outline: none; position: relative; overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-danger {
  background: var(--sev-critical-bg); color: var(--sev-critical); border-color: var(--sev-critical-border);
}
.btn-danger:hover { background: rgba(255,45,85,.20); }

.btn-accent {
  background: var(--accent-dim); color: var(--accent); border-color: var(--accent-border);
}
.btn-accent:hover { background: rgba(0,212,255,.18); }

.btn-sm  { padding: 5px 12px; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-lg  { padding: 10px 22px; font-size: var(--text-md); }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-icon.btn-sm { width: 26px; height: 26px; padding: 5px; }

/* ════════════════════════════════════════════════════════════════
   TYPOGRAPHY HELPERS
════════════════════════════════════════════════════════════════ */
.lbl {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-tertiary); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 7px;
}
.sub   { font-size: 12px; color: var(--text-tertiary); margin-bottom: 7px; }
.hint  { font-size: 11px; color: var(--text-tertiary); margin-top: 5px; }
.hint.green { color: var(--sev-low); }
.red   { color: var(--primary); }
.green { color: var(--sev-low); }

.text-xs    { font-size: var(--text-xs); }
.text-sm    { font-size: var(--text-sm); }
.text-base  { font-size: var(--text-base); }
.text-lg    { font-size: var(--text-lg); }
.text-xl    { font-size: var(--text-xl); }
.text-2xl   { font-size: var(--text-2xl); }
.font-mono  { font-family: var(--font-mono); }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ════════════════════════════════════════════════════════════════
   LAYOUT HELPERS
════════════════════════════════════════════════════════════════ */
.field     { margin-bottom: 14px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.btn-row   { display: flex; gap: 6px; flex-wrap: wrap; }
.sep       { text-align: center; color: var(--text-tertiary); font-size: 11px; margin: 10px 0; }
.actions   { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.err {
  padding: 9px 13px; border-radius: var(--radius-md);
  background: var(--primary-dim); color: #fca5a5;
  border: 1px solid var(--primary-border); font-size: 12px; margin-top: 10px;
}
.divider { height: 1px; background: var(--border); margin: var(--space-5) 0; }

/* ════════════════════════════════════════════════════════════════
   LOGO
════════════════════════════════════════════════════════════════ */
.logo-k {
  width: 40px; height: 40px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(14,165,233,.18), rgba(15,23,42,1));
  border: 1.5px solid rgba(14,165,233,.35);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-weight: 900; font-size: 16px;
  box-shadow: 0 0 18px rgba(14,165,233,.16);
  flex-shrink: 0;
}
.logo-k.sm { width: 32px; height: 32px; font-size: 13px; }
.logo-text  { font-size: 15px; font-weight: 800; }
.sm-text    { font-size: 11px; }
body.light .logo-k {
  background: linear-gradient(135deg, rgba(14,165,233,.12), #fff);
  border-color: rgba(14,165,233,.30);
  box-shadow: 0 0 16px rgba(14,165,233,.10);
}

/* ════════════════════════════════════════════════════════════════
   HEADER
════════════════════════════════════════════════════════════════ */
.hdr, .header {
  height: 56px; min-height: 56px;
  position: sticky; top: 0; z-index: 40;
  background: var(--bg-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
  display: flex; align-items: center; gap: 10px;
}
.hdr-left, .header-left   { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.hdr-center, .header-center {
  flex: 1; max-width: 40%; margin: 0 auto;
  display: flex; align-items: center;
}
.hdr-right, .header-right { display: flex; align-items: center; gap: 5px; flex-shrink: 0; margin-left: auto; }
.hdr-sep  { width: 1px; height: 18px; background: var(--border-medium); margin: 0 2px; flex-shrink: 0; }

body.light .hdr, body.light .header { background: rgba(233,229,223,.97); border-bottom-color: var(--border); }

/* Search bar in header */
.header-search {
  width: 100%; display: flex; align-items: center; gap: 9px;
  background: var(--bg-input); border: 1px solid var(--border-medium);
  border-radius: var(--radius-md); padding: 0 13px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.header-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.header-search .search-icon { color: var(--text-tertiary); flex-shrink: 0; }
.header-search input {
  flex: 1; padding: 9px 0;
  border: none; background: transparent;
  font-size: 13px; color: var(--text-primary); width: 100%;
  box-shadow: none !important;
}
.header-search input:focus { border: none; background: transparent; box-shadow: none; }
body.light .header-search { background: var(--bg-input); border-color: var(--border-medium); }
body.light .header-search:focus-within { background: var(--bg-surface); }

/* Legacy search bar */
.search-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-input-wrap {
  flex: 1; display: flex; align-items: center; gap: 9px;
  background: var(--bg-input); border: 1px solid var(--border-medium);
  border-radius: var(--radius-md); padding: 0 13px;
}
.search-icon { color: var(--text-tertiary); }
.search-input { flex: 1; padding: 9px 0; border: none; background: transparent; font-size: 13px; }
.search-input:focus { border: none; background: transparent; box-shadow: none; }
.star-btn { font-size: 17px; }
.star-btn.on { background: var(--primary-dim); color: #fca5a5; border-color: var(--primary-border); }

/* Header button styles */
.hdr-btn-new {
  padding: 7px 13px; border-radius: var(--radius-md);
  background: var(--primary); border: 1px solid var(--primary-border);
  color: #fff; font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(14,165,233,.30);
  transition: all .22s cubic-bezier(.34,1.56,.64,1);
}
.hdr-btn-new:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 18px rgba(14,165,233,.42);
  transform: translateY(-1px);
}
.hdr-btn-new:active { transform: translateY(0) scale(.97); box-shadow: none; }

.hdr-btn-tool {
  padding: 6px 10px; border-radius: var(--radius-md);
  border: 1px solid var(--border-medium); background: var(--bg-raised); color: var(--text-tertiary);
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; flex-shrink: 0;
  transition: all .18s ease-out;
}
.hdr-btn-tool:hover { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text-secondary); }
.hdr-btn-tool:active { transform: scale(.96); }

.hdr-btn-var {
  padding: 6px 10px; border-radius: var(--radius-md);
  border: 1px solid var(--intel-border);
  background: var(--intel-dim); color: #a78bfa;
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; flex-shrink: 0; position: relative;
  transition: all .18s ease-out;
}
.hdr-btn-var:hover { background: rgba(124,58,237,.18); border-color: var(--intel); }
.hdr-btn-var:active { transform: scale(.96); }

.hdr-btn-nav {
  padding: 6px 9px; border-radius: var(--radius-md);
  border: 1px solid transparent; background: transparent; color: var(--text-tertiary);
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; flex-shrink: 0; text-decoration: none;
  transition: all var(--transition-fast);
}
.hdr-btn-nav:hover { color: var(--text-secondary); background: var(--bg-hover); border-color: var(--border); }
.hdr-btn-nav.active { color: var(--text-primary); background: var(--bg-hover); border-color: var(--border-medium); }

.hdr-btn-admin {
  padding: 6px 9px; border-radius: var(--radius-md);
  border: 1px solid var(--primary-border);
  background: var(--primary-dim); color: var(--primary);
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; flex-shrink: 0; text-decoration: none;
  transition: all var(--transition-fast);
}
.hdr-btn-admin:hover { background: rgba(14,165,233,.18); border-color: var(--primary); }
.hdr-btn-admin.active { background: rgba(14,165,233,.18); }

.hdr-profile {
  padding: 4px 9px 4px 5px; border-radius: var(--radius-md);
  border: 1px solid var(--border-medium); background: var(--bg-raised); color: var(--text-secondary);
  font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; flex-shrink: 0; transition: all var(--transition-fast);
}
.hdr-profile:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.hdr-btn-icon {
  width: 32px; height: 32px; border-radius: var(--radius-md);
  border: 1px solid var(--border-medium); background: var(--bg-raised); color: var(--text-tertiary);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; flex-shrink: 0;
  transition: all .22s cubic-bezier(.34,1.56,.64,1);
}
.hdr-btn-icon:hover {
  background: var(--bg-hover); border-color: var(--border-strong); color: var(--text-primary);
  transform: translateY(-1px) scale(1.05); box-shadow: var(--shadow-sm);
}
.hdr-btn-icon:active { transform: scale(.92); }

.hdr-btn-lang {
  width: 32px; height: 32px; border-radius: var(--radius-md);
  border: 1px solid var(--border-medium); background: var(--bg-raised);
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden; cursor: pointer; padding: 0; flex-shrink: 0;
  transition: all .25s cubic-bezier(.34,1.56,.64,1);
}
.hdr-btn-lang:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px) scale(1.1); box-shadow: var(--shadow-md);
}
.hdr-btn-lang:active { transform: scale(.92); }

.hdr-btn-signout {
  padding: 6px 8px; border-radius: var(--radius-md);
  border: none; background: none; color: var(--text-tertiary);
  font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer; flex-shrink: 0; transition: all var(--transition-fast);
}
.hdr-btn-signout:hover { color: var(--primary); background: var(--primary-dim); }

/* ── Profile button (avatar + chevron) ───────────────────────── */
.hdr-profile-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 6px 4px 4px; border-radius: var(--radius-md);
  border: 1px solid var(--border-medium); background: var(--bg-raised);
  cursor: pointer; flex-shrink: 0;
  transition: all var(--transition-fast);
}
.hdr-profile-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.hdr-profile-btn svg { color: var(--text-tertiary); flex-shrink: 0; }

/* ── User dropdown ───────────────────────────────────────────── */
.hdr-user-wrap { position: relative; }

.hdr-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 218px;
  background: var(--bg-surface); border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  overflow: hidden;
  animation: ddSlide 160ms ease-out both;
}
@keyframes ddSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hdr-dd-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px 11px;
}
.hdr-dd-user { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.hdr-dd-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-dd-role { font-size: 11px; color: var(--text-tertiary); text-transform: capitalize; }
.hdr-dd-sep  { height: 1px; background: var(--border); margin: 0; }
.hdr-dd-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px; width: 100%;
  background: none; border: none;
  font-size: 13px; color: var(--text-secondary);
  cursor: pointer; text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.hdr-dd-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.hdr-dd-item--danger { color: var(--text-danger); }
.hdr-dd-item--danger:hover { background: rgba(255,45,85,.08); color: var(--text-danger); }

/* ── Header badge (unified) ──────────────────────────────────── */
.hdr-badge {
  position: absolute; top: -5px; right: -5px;
  border-radius: var(--radius-full); min-width: 14px; height: 14px;
  padding: 0 3px; font-size: 9px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  color: #fff; border: 2px solid var(--bg);
}
.hdr-badge--green  { background: #22c55e; }
.hdr-badge--violet { background: #7c3aed; }
.hdr-badge--red    { background: #ef4444; }
.hdr-badge--orange { background: #f97316; }

/* Light mode header */
body.light .hdr-btn-tool   { background: var(--bg-hover); border-color: var(--border-medium); color: var(--text-tertiary); }
body.light .hdr-btn-tool:hover { background: var(--bg-active); color: var(--text-primary); }
body.light .hdr-btn-icon   { background: var(--bg-hover); border-color: var(--border-medium); color: var(--text-tertiary); }
body.light .hdr-btn-icon:hover { background: var(--bg-active); color: var(--text-primary); }
body.light .hdr-btn-lang   { background: var(--bg-hover); border-color: var(--border-medium); }
body.light .hdr-btn-lang:hover { background: var(--bg-active); }
body.light .hdr-profile-btn { background: var(--bg-hover); border-color: var(--border-medium); }
body.light .hdr-profile-btn:hover { background: var(--bg-active); }
body.light .hdr-dropdown   { background: var(--bg-surface); border-color: var(--border-medium); }
body.light .hdr-dd-item:hover { background: var(--bg-hover); }
body.light .hdr-btn-nav    { color: var(--text-tertiary); }
body.light .hdr-btn-nav:hover  { color: var(--text-secondary); background: var(--bg-hover); border-color: var(--border); }
body.light .hdr-sep        { background: var(--border-medium); }

.user-badge {
  font-size: 12px; color: var(--text-secondary);
  padding: 5px 11px; background: var(--bg-raised);
  border: 1px solid var(--border-medium); border-radius: var(--radius-md);
}

/* ════════════════════════════════════════════════════════════════
   LAYOUT
════════════════════════════════════════════════════════════════ */
.main-layout { display: flex; min-height: calc(100vh - var(--hdr-h)); }
.content { flex: 1; padding: 20px 24px 60px; overflow-x: hidden; min-width: 0; }

/* ════════════════════════════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════════════════════════════ */
.side, .sidebar {
  width: 240px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 12px 8px 20px;
  overflow-y: auto; background: var(--bg-surface);
  display: flex; flex-direction: column; gap: 0;
}
body.light .side, body.light .sidebar { border-right-color: var(--border); background: var(--bg-surface); }

/* Folder item */
.si, .sidebar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--radius-md);
  cursor: pointer; margin-bottom: 1px;
  font-size: 13px; color: var(--text-secondary);
  transition: background var(--transition-fast), border-left-color var(--transition-fast);
  position: relative; border-left: 2px solid transparent;
}
.si:hover, .sidebar-item:hover  { background: var(--bg-hover); }
.si:hover .si-del-folder         { opacity: .5 !important; }
.si .si-del-folder:hover         { opacity: 1 !important; background: var(--primary-dim); }
.si.active, .sidebar-item.active {
  background: var(--primary-dim);
  border-left-color: var(--primary);
  color: var(--text-primary);
}
.si-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.si-count {
  font-size: 10px; font-weight: 700;
  min-width: 20px; height: 18px; padding: 0 5px;
  border-radius: 99px;
  background: var(--bg-hover); color: var(--text-tertiary);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.si.active .si-count { background: var(--primary-dim); color: #fca5a5; }

.si-group     { margin-top: 14px; }
.si-group-lbl { display: flex; align-items: center; gap: 7px; padding: 0 4px 5px; }
.si-group-lbl span {
  font-size: 10px; font-weight: 700; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: .7px; white-space: nowrap;
}
.si-group-lbl::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Folder icon */
.fic {
  font-size: 10px; font-weight: 800;
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; letter-spacing: -.5px;
}

/* Sidebar collapse (desktop) */
.side, .sidebar { transition: width 0.22s ease, min-width 0.22s ease, padding 0.22s ease, visibility 0s linear 0.22s; }
.side:not(.side--collapsed) { visibility: visible; transition: width 0.22s ease, min-width 0.22s ease, padding 0.22s ease, visibility 0s linear 0s; }
.side--collapsed { width: 0 !important; min-width: 0 !important; padding: 0 !important; overflow: hidden !important; border-right: none !important; visibility: hidden; pointer-events: none; }
.side--collapsed * { pointer-events: none; }
.side-collapse-hdr {
  display: flex; justify-content: flex-end; align-items: center;
  padding: 4px 4px 8px; flex-shrink: 0;
}
.btn-side-collapse {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: transparent;
  color: var(--t4); cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-size: 11px; line-height: 1;
}
.btn-side-collapse:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-side-expand {
  position: fixed; left: 0; top: 50%; transform: translateY(-50%);
  width: 18px; height: 52px; border-radius: 0 var(--radius-md) var(--radius-md) 0;
  border: 1px solid var(--border); border-left: none;
  background: var(--bg-surface); color: var(--t4); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  z-index: 40; font-size: 11px; line-height: 1;
  visibility: visible !important; pointer-events: auto !important;
}
.btn-side-expand:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-side-expand.hidden { display: none; }

.side-sep { height: 1px; background: var(--border); margin: 10px 4px; }

/* Language tab cards */
.lang-tabs { display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; padding: 0 2px; margin-bottom: 2px; }
.lang-tab {
  padding: 9px 4px 8px; border-radius: var(--radius-lg);
  cursor: pointer; border: 1px solid var(--border); background: var(--bg-surface);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: all var(--transition-fast);
}
.lang-tab:hover { border-color: var(--border-medium); background: var(--bg-hover); }
.lang-tab.active { border-color: var(--primary); background: var(--primary-dim); }
.lang-tab-icon { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-md); }
.lang-tab-icon svg { width: 18px; height: 18px; }
.lang-tab-name { font-size: 10px; font-weight: 800; letter-spacing: .4px; line-height: 1; }
.lang-tab-count {
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 15px; padding: 0 4px;
  border-radius: 99px; background: var(--bg-hover); color: var(--text-tertiary);
  display: inline-flex; align-items: center; justify-content: center;
}
body.light .lang-tab { background: var(--bg-surface); }

/* Sidebar filter sections */
.side-filters { padding: 3px 2px 2px; margin-bottom: 2px; }
.fsec         { margin-bottom: 9px; }
.fsec-lbl     { display: flex; align-items: center; gap: 5px; padding: 0 3px; margin-bottom: 5px; }
.fsec-lbl span { font-size: 9px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .8px; white-space: nowrap; }
.fsec-lbl::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.fchips { display: flex; flex-wrap: wrap; gap: 3px; padding: 0 2px; }
.fchip, .filter-chip {
  padding: 3px 8px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border-medium); background: transparent; color: var(--text-tertiary);
  transition: all .12s ease-out;
  display: inline-flex; align-items: center; gap: 4px;
  line-height: 1.5; text-transform: capitalize;
}
.fchip:hover, .filter-chip:hover { border-color: var(--border-strong); color: var(--text-secondary); background: var(--bg-hover); }
.fchip:focus-visible, .filter-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Severity filter chips */
.fchip.sev-on-critical { background: var(--sev-critical-bg); color: var(--sev-critical); border-color: var(--sev-critical-border); }
.fchip.sev-on-high     { background: var(--sev-high-bg);     color: var(--sev-high);     border-color: var(--sev-high-border); }
.fchip.sev-on-medium   { background: var(--sev-medium-bg);   color: var(--sev-medium);   border-color: var(--sev-medium-border); }
.fchip.sev-on-low      { background: var(--sev-low-bg);      color: var(--sev-low);      border-color: var(--sev-low-border); }
.fchip.sev-on-info     { background: var(--sev-info-bg);     color: var(--sev-info);     border-color: var(--sev-info-border); }

body.light .fchip.sev-on-critical { background: rgba(255,45,85,.08);  color: #c0162e; border-color: rgba(255,45,85,.25); }
body.light .fchip.sev-on-high     { background: rgba(255,107,53,.08); color: #c0480d; border-color: rgba(255,107,53,.25); }
body.light .fchip.sev-on-medium   { background: rgba(255,214,10,.08); color: #a07a00; border-color: rgba(255,214,10,.25); }
body.light .fchip.sev-on-low      { background: rgba(45,212,191,.08); color: #0b7266; border-color: rgba(45,212,191,.25); }
body.light .fchip.sev-on-info     { background: rgba(99,102,241,.08); color: #4338ca; border-color: rgba(99,102,241,.25); }

/* MITRE ATT&CK coverage filter */
.mitre-fchips { display: flex; flex-direction: column; gap: 1px; padding: 0 1px; }
.mitre-fchip {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 7px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; background: transparent; color: var(--text-tertiary);
  transition: background .1s, border-color .1s, color .1s;
  text-align: left; width: 100%;
}
.mitre-fchip:hover:not([disabled]) { background: var(--bg-hover); color: var(--text-secondary); border-color: var(--border-medium); }
.mitre-fchip--on { font-weight: 600; }
.mitre-fchip--zero { opacity: .28; cursor: default; pointer-events: none; }
.mitre-fchip-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; transition: background .1s; }
.mitre-fchip-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mitre-fchip-cnt { font-size: 9px; font-weight: 700; color: var(--text-quaternary); min-width: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.mitre-fchip--on .mitre-fchip-cnt { opacity: .9; }

.tchip[data-tip]::after, .tchip[data-tip]::before { display: none !important; }

/* ════════════════════════════════════════════════════════════════
   STATS CARDS
════════════════════════════════════════════════════════════════ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
  border-top: 2px solid var(--border-medium);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  display: flex; flex-direction: column; gap: 10px;
  animation: fadeInUp 280ms ease both;
}
.stat:nth-child(1) { animation-delay:  0ms; border-top-color: var(--primary); }
.stat:nth-child(2) { animation-delay: 50ms; border-top-color: var(--sev-high); }
.stat:nth-child(3) { animation-delay:100ms; border-top-color: var(--accent); }
.stat:nth-child(4) { animation-delay:150ms; border-top-color: var(--sev-critical); }
.stat:hover { box-shadow: var(--shadow-md); border-color: var(--border-medium); }

.stat-hd { display: flex; align-items: center; gap: 9px; }
.stat-ico {
  width: 34px; height: 34px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-ico-red    { background: var(--primary-dim);  color: var(--primary); }
.stat-ico-orange { background: var(--sev-high-bg);  color: var(--sev-high); }
.stat-ico-blue   { background: var(--accent-dim);   color: var(--accent); }
.stat-ico-red2   { background: var(--sev-critical-bg); color: var(--sev-critical); }
.stat-lbl-hd { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--text-tertiary); white-space: nowrap; }

body.light .stat-ico-red    { background: rgba(14,165,233,.08); }
body.light .stat-ico-orange { background: rgba(255,107,53,.08); }
body.light .stat-ico-blue   { background: rgba(0,212,255,.08); }
body.light .stat-ico-red2   { background: rgba(255,45,85,.08); }

.stat-main { display: flex; align-items: baseline; gap: 6px; line-height: 1; }
.stat-val { font-size: 30px; font-weight: 800; line-height: 1; margin-bottom: 0; font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 11px; color: var(--text-tertiary); font-weight: 500; }
.stat-denom { font-size: 14px; color: var(--text-tertiary); font-weight: 400; }
.stat-unit  { font-size: 12px; color: var(--text-tertiary); font-weight: 400; }

.stat-bar-wrap { display: flex; height: 5px; border-radius: 99px; overflow: hidden; gap: 2px; flex-shrink: 0; }
.stat-bar-seg  { border-radius: 99px; min-width: 3px; transition: flex 400ms ease; }
.stat-bar-empty { flex: 1; background: var(--border-medium); }

.stat-dot-grid { display: flex; flex-wrap: wrap; gap: 3px; }
.stat-dot { width: 10px; height: 10px; border-radius: 2px; transition: opacity 200ms, transform 150ms ease; cursor: default; flex-shrink: 0; }
.stat-dot:hover { opacity: .75; transform: scale(1.2); }

.stat-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.stat-chip {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  white-space: nowrap; transition: transform 150ms ease; cursor: default;
}
.stat-chip:hover { transform: scale(1.05); }

/* ════════════════════════════════════════════════════════════════
   QUERY VIEW TOOLBAR
════════════════════════════════════════════════════════════════ */
.qv-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 8px;
}
.qv-view-toggle {
  display: flex; background: var(--bg-raised);
  border: 1px solid var(--border-medium); border-radius: 7px; overflow: hidden;
}
.qv-vbtn {
  border: none; background: transparent; color: var(--text-tertiary);
  font-size: 12px; font-weight: 500; padding: 6px 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.qv-vbtn:hover  { background: var(--bg-hover); color: var(--text-secondary); }
.qv-vbtn.active { background: var(--bg-active); color: var(--text-primary); }
body.light .qv-view-toggle { background: var(--bg-surface); }

/* ── Query List view ── */
.qlist { display: flex; flex-direction: column; gap: 2px; }
.qlist-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
  background: var(--bg-surface);
  transition: background var(--transition-fast), border-color var(--transition-fast);
  animation: fadeIn 220ms ease both;
  position: relative;
}
.qlist-row:hover { background: var(--bg-hover); border-color: var(--border); }
.qlist-row--sel  { background: var(--primary-dim); border-color: var(--primary-border); }
.ql-sev-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ql-body { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.ql-title { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ql-desc  { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ql-tags  { display: flex; align-items: center; gap: 4px; flex-shrink: 0; flex-wrap: nowrap; }
.ql-tag   { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; white-space: nowrap; letter-spacing: .02em; }
.ql-tag-more { font-size: 10px; color: var(--text-tertiary); white-space: nowrap; }
.ql-env   { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 5px; white-space: nowrap; flex-shrink: 0; }

/* ── Query Table view ── */
.qtable-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
.qtable {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.qtable thead th {
  padding: 9px 12px; text-align: left; font-size: 11px; font-weight: 700;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .06em;
  background: var(--bg-raised); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.qtable-row {
  cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast);
  animation: fadeIn 200ms ease both;
}
.qtable-row:last-child { border-bottom: none; }
.qtable-row:hover { background: var(--bg-hover); }
.qtable-row--sel  { background: var(--primary-dim); }
.qtable-row td    { padding: 9px 12px; vertical-align: middle; }
.qt-title { display: block; font-weight: 600; color: var(--text-primary); }
.qt-desc  { display: block; font-size: 11px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.qt-mitre { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.qt-author { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }

/* ════════════════════════════════════════════════════════════════
   QUERY GRID & CARDS
════════════════════════════════════════════════════════════════ */
.qgrid, .query-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}

/* Card stagger */
.qgrid .card:nth-child(1),  .query-grid .card:nth-child(1)  { animation-delay: 0ms; }
.qgrid .card:nth-child(2),  .query-grid .card:nth-child(2)  { animation-delay: 40ms; }
.qgrid .card:nth-child(3),  .query-grid .card:nth-child(3)  { animation-delay: 80ms; }
.qgrid .card:nth-child(4),  .query-grid .card:nth-child(4)  { animation-delay: 120ms; }
.qgrid .card:nth-child(5),  .query-grid .card:nth-child(5)  { animation-delay: 160ms; }
.qgrid .card:nth-child(6),  .query-grid .card:nth-child(6)  { animation-delay: 200ms; }
.qgrid .card:nth-child(n+7), .query-grid .card:nth-child(n+7) { animation-delay: 0ms; }

/* ── Base card ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 9px;
  transition: transform var(--transition-base), border-color var(--transition-fast),
              box-shadow var(--transition-fast), background var(--transition-fast);
  animation: fadeIn 250ms ease both;
  position: relative; overflow: hidden;
}

/* Top accent bar — sévérité (visible au hover) */
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px; opacity: 0;
  transition: opacity var(--transition-fast);
}
.card[style*="border-left:3px solid #ff2d55"]::before,
.card[style*="border-left: 3px solid #ff2d55"]::before { background: var(--sev-critical); }
.card[style*="border-left:3px solid #ef4444"]::before,
.card[style*="border-left: 3px solid #ef4444"]::before { background: var(--sev-critical); }
.card[style*="border-left:3px solid #ff6b35"]::before,
.card[style*="border-left: 3px solid #ff6b35"]::before { background: var(--sev-high); }
.card[style*="border-left:3px solid #f97316"]::before,
.card[style*="border-left: 3px solid #f97316"]::before { background: var(--sev-high); }
.card[style*="border-left:3px solid #ffd60a"]::before,
.card[style*="border-left: 3px solid #ffd60a"]::before { background: var(--sev-medium); }
.card[style*="border-left:3px solid #eab308"]::before,
.card[style*="border-left: 3px solid #eab308"]::before { background: var(--sev-medium); }
.card[style*="border-left:3px solid #2dd4bf"]::before,
.card[style*="border-left: 3px solid #2dd4bf"]::before { background: var(--sev-low); }
.card[style*="border-left:3px solid #22c55e"]::before,
.card[style*="border-left: 3px solid #22c55e"]::before { background: var(--sev-low); }
.card[style*="border-left:3px solid #6366f1"]::before,
.card[style*="border-left: 3px solid #6366f1"]::before { background: var(--sev-info); }
.card[style*="border-left:3px solid #3b82f6"]::before,
.card[style*="border-left: 3px solid #3b82f6"]::before { background: var(--sev-info); }

.card:hover {
  transform: translateY(-2px);
  background: var(--bg-raised);
  border-color: var(--border-medium);
  box-shadow: var(--shadow-lg);
}
.card:hover::before { opacity: 1; }
.card:active { transform: translateY(0); }

body.light .card { background: var(--bg-surface); border-color: var(--border); }
body.light .card:hover { background: var(--bg-surface); box-shadow: var(--shadow-sm); border-color: var(--border-medium); }

/* ── Card sub-elements ── */
.card-row-head    { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.card-badges-row  { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; min-width: 0; }

/* Severity badge (card) */
.cb-sev {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  flex-shrink: 0; line-height: 1; border: 1px solid;
}
.cb-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.cb-sev-critical { background: var(--sev-critical-bg); color: var(--sev-critical); border-color: var(--sev-critical-border); }
.cb-sev-high     { background: var(--sev-high-bg);     color: var(--sev-high);     border-color: var(--sev-high-border); }
.cb-sev-medium   { background: var(--sev-medium-bg);   color: var(--sev-medium);   border-color: var(--sev-medium-border); }
.cb-sev-low      { background: var(--sev-low-bg);      color: var(--sev-low);      border-color: var(--sev-low-border); }
.cb-sev-info     { background: var(--sev-info-bg);     color: var(--sev-info);     border-color: var(--sev-info-border); }

body.light .cb-sev-critical { background: rgba(255,45,85,.08);  }
body.light .cb-sev-high     { background: rgba(255,107,53,.08); }
body.light .cb-sev-medium   { background: rgba(255,214,10,.08); }
body.light .cb-sev-low      { background: rgba(45,212,191,.08); }
body.light .cb-sev-info     { background: rgba(99,102,241,.08); }

/* Language badge */
.cb-lang {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: var(--radius-sm);
  font-size: 10px; font-weight: 700; border: 1px solid transparent;
  flex-shrink: 0; line-height: 1;
}

/* Platform badge */
.cb-env {
  display: inline-flex; align-items: center;
  padding: 2px 6px; border-radius: var(--radius-sm);
  font-size: 9px; font-weight: 700; letter-spacing: .3px;
  flex-shrink: 0; line-height: 1;
}

/* Star button */
.card-star-btn {
  background: none; border: none; cursor: pointer;
  padding: 2px 4px; border-radius: var(--radius-sm);
  font-size: 15px; line-height: 1; color: var(--text-tertiary);
  flex-shrink: 0; opacity: .55;
  transition: color var(--transition-fast), transform .18s var(--ease-spring), opacity var(--transition-fast);
}
.card:hover .card-star-btn { opacity: 1; }
.card-star-btn:hover    { color: #fbbf24; transform: scale(1.2); }
.card-star-btn.starred  { color: #fbbf24; opacity: 1; }

/* FP dot */
.fp-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; transition: background .3s; cursor: default; }
body.light .fp-dot { border: 1px solid rgba(0,0,0,.08); }

/* Card text */
.card-title-text {
  font-size: 14px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-primary); line-height: 1.3; letter-spacing: -.01em;
}
.card-desc-text  {
  font-size: 12px; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.45;
}

/* KQL preview */
.card-kql-prev {
  font-size: 11px; color: var(--text-code); font-family: var(--font-mono);
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; letter-spacing: -.01em; line-height: 1.5;
  width: 100%;
}
body.light .card-kql-prev { background: #f4f6fb; color: #1a56db; border-color: var(--border-medium); }

/* Meta row */
.card-meta-row { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.card-meta-sep { width: 1px; height: 11px; background: var(--border-medium); margin: 0 1px; flex-shrink: 0; }

/* MITRE chip */
.cmtag {
  display: inline-flex; align-items: center;
  padding: 2px 5px; border-radius: var(--radius-sm);
  font-size: 9px; font-weight: 700; letter-spacing: .1px;
  border: 1px solid transparent; font-family: var(--font-mono);
  cursor: default;
  transition: transform 150ms ease, opacity 150ms ease !important;
}
.cmtag:hover { transform: scale(1.05) !important; opacity: .9; }
.cmtag-more { font-size: 9px; color: var(--text-tertiary); font-weight: 600; padding: 2px 3px; }


/* Variable indicator */
.card-var-ind {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px; border-radius: var(--radius-sm);
  font-size: 9px; font-weight: 700;
  background: var(--intel-dim); color: #c4b5fd; border: 1px solid var(--intel-border);
  font-family: var(--font-mono); flex-shrink: 0;
}

/* Card footer */
.card-footer-row { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 2px; gap: 6px; }
.card-ctags { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; min-width: 0; }
.ctag {
  display: inline-block; padding: 2px 7px; border-radius: 99px;
  font-size: 10px; color: var(--text-tertiary); background: var(--bg-hover);
  border: 1px solid var(--border-medium); font-weight: 500;
  white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis;
}
.ctag-more { font-size: 10px; color: var(--text-tertiary); font-weight: 600; }
.card-auth { font-size: 10px; color: var(--text-tertiary); flex-shrink: 0; font-weight: 500; white-space: nowrap; }
body.light .ctag { background: var(--bg-hover); border-color: var(--border-medium); color: var(--text-tertiary); }

/* Legacy card classes */
.card-top    { display: flex; justify-content: space-between; align-items: flex-start; }
.card-badges { display: flex; align-items: center; gap: 5px; }
.star        { cursor: pointer; font-size: 16px; color: var(--text-tertiary); }
.card-title  { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-desc   { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-tags   { display: flex; gap: 3px; flex-wrap: wrap; }
.card-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }

/* ════════════════════════════════════════════════════════════════
   SEVERITY / ENV / LANG BADGES
════════════════════════════════════════════════════════════════ */
.sev {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  border: 1px solid;
}
.sev-critical { background: var(--sev-critical-bg); color: var(--sev-critical); border-color: var(--sev-critical-border); }
.sev-high     { background: var(--sev-high-bg);     color: var(--sev-high);     border-color: var(--sev-high-border); }
.sev-medium   { background: var(--sev-medium-bg);   color: var(--sev-medium);   border-color: var(--sev-medium-border); }
.sev-low      { background: var(--sev-low-bg);      color: var(--sev-low);      border-color: var(--sev-low-border); }
.sev-info     { background: var(--sev-info-bg);     color: var(--sev-info);     border-color: var(--sev-info-border); }

body.light .sev-critical { background: rgba(255,45,85,.08); }
body.light .sev-high     { background: rgba(255,107,53,.08); }
body.light .sev-medium   { background: rgba(255,214,10,.08); }
body.light .sev-low      { background: rgba(45,212,191,.08); }
body.light .sev-info     { background: rgba(99,102,241,.08); }

.env-badge    { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: var(--radius-sm); font-size: 10px; font-weight: 700; }
.env-defender, .env-Defender { background: rgba(245,158,11,.12); color: #f59e0b; border: 1px solid rgba(245,158,11,.25); }
.env-sentinel, .env-Sentinel { background: rgba(56,189,248,.12); color: #38bdf8; border: 1px solid rgba(56,189,248,.25); }
.env-both,     .env-Both     { background: var(--intel-dim);    color: #a78bfa; border: 1px solid var(--intel-border); }

body.light .env-defender, body.light .env-Defender { background: #fefce8; color: #a16207; border-color: rgba(245,158,11,.3); }
body.light .env-sentinel, body.light .env-Sentinel { background: #eff6ff; color: #1d4ed8; border-color: rgba(56,189,248,.3); }
body.light .env-both,     body.light .env-Both     { background: #faf5ff; color: #7c3aed; border-color: rgba(124,58,237,.25); }

.tag         { display: inline-block; padding: 2px 7px; border-radius: var(--radius-sm); font-size: 12px; color: var(--text-secondary); background: var(--bg-hover); border: 1px solid var(--border-medium); }
.tag-rm      { cursor: pointer; color: var(--primary); margin-left: 4px; }
.tag-row     { display: flex; gap: 5px; flex-wrap: wrap; }
.tag-input-row { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.tag-add     { width: 125px; padding: 5px 9px; font-size: 12px; }

.mbadge      { display: inline-block; padding: 2px 6px; border-radius: 3px; font-size: 9px; font-weight: 700; }
.pbadge      { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; }
.var-badge   { font-size: 9px; padding: 2px 6px; border-radius: var(--radius-sm); background: var(--intel-dim); color: #c4b5fd; font-weight: 600; }
.lang-badge  { display: inline-flex; align-items: center; gap: 3px; padding: 1px 5px; border-radius: 3px; font-size: 9px; font-weight: 700; vertical-align: middle; }

/* ════════════════════════════════════════════════════════════════
   DETAIL PANEL
════════════════════════════════════════════════════════════════ */
.detail-backdrop {
  position: fixed; inset: var(--hdr-h) 0 0 0;
  background: rgba(0,0,0,.6);
  z-index: 45;
  animation: fadeIn 200ms ease both;
}
.detail-panel {
  position: fixed; top: var(--hdr-h); right: 0; bottom: 0;
  width: 55%; max-width: 900px; min-width: 440px;
  background: var(--bg-surface); border-left: 1px solid var(--border-medium);
  z-index: 46; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: -8px 0 40px rgba(0,0,0,.5);
  animation: slideInRight 220ms cubic-bezier(.16,1,.3,1) both;
}
body.light .detail-panel { background: var(--bg-surface); box-shadow: -4px 0 24px rgba(0,0,0,.10); }
body.light .detail-backdrop { background: rgba(0,0,0,.28); }

/* Fullscreen detail panel */
.detail-panel--fullscreen {
  position: fixed; inset: 0; top: 0;
  width: 100% !important; max-width: 100% !important; min-width: unset !important;
  z-index: 200; border-left: none;
  animation: none;
  display: grid;
  grid-template-rows: auto auto 1fr;
}
.detail-panel--fullscreen .det-scroll {
  overflow-y: auto;
  display: grid;
  grid-template-columns: minmax(0,1fr) 380px;
  gap: 0;
  padding: 0 !important;
  align-items: start;
}
.detail-panel--fullscreen .det-scroll > * { padding: 18px 20px; }
.detail-panel--fullscreen .det-scroll > *:last-child { border-left: 1px solid var(--border); background: var(--bg-surface); height: 100%; }
.btn-det-expand {
  width: 28px; height: 28px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: none;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}
.btn-det-expand:hover { background: var(--bg-hover); color: var(--text-primary); }

.det-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.det-header h2 { font-size: 16px; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.det-scroll { flex: 1; overflow-y: auto; }
.det-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0;
}

.det-meta-panel {
  display: flex; flex-direction: column; gap: 0;
  margin-bottom: 20px;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden;
}
.det-meta-sec { padding: 11px 15px; border-bottom: 1px solid var(--border); }
.det-meta-sec:last-child { border-bottom: none; }
.det-meta-lbl {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--text-tertiary); margin-bottom: 9px;
}
.det-meta-items { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.det-meta-empty { font-size: 12px; color: var(--text-tertiary); }

.det-mtag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: var(--radius-md);
  font-size: 11px; font-weight: 600; border: 1px solid transparent; cursor: default;
  transition: opacity var(--transition-fast);
}
.det-mtag:hover { opacity: .8; }
.det-mtag-id   { font-family: var(--font-mono); font-size: 10px; font-weight: 800; letter-spacing: .2px; }
.det-mtag-name { font-size: 11px; font-weight: 500; opacity: .85; }

.det-tag {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 11px; color: var(--text-secondary); background: var(--bg-hover);
  border: 1px solid var(--border-medium); font-weight: 500; transition: background var(--transition-fast);
}
.det-tag:hover { background: var(--bg-active); }
body.light .det-tag { color: var(--text-secondary); background: var(--bg-hover); border-color: var(--border-medium); }
.det-tag-folder { color: var(--accent); background: var(--accent-dim); border-color: var(--accent-border); cursor: default; }
body.light .det-tag-folder { color: #1d4ed8; background: #dbeafe; border-color: rgba(59,130,246,.3); }

a.det-tag-cve {
  color: #fca5a5; background: rgba(239,68,68,.10); border-color: rgba(239,68,68,.25);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .02em;
  text-decoration: none; cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
a.det-tag-cve:hover { background: rgba(239,68,68,.20); border-color: #ef4444; color: #fecaca; }
body.light a.det-tag-cve { color: #b91c1c; background: #fee2e2; border-color: rgba(239,68,68,.3); }
body.light a.det-tag-cve:hover { background: #fecaca; border-color: #ef4444; }

.cve-refs-block {
  background: var(--bg-raised); border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 18px;
}
.cve-refs-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #fca5a5; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.cve-refs-label::before {
  content: ''; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: #ef4444; flex-shrink: 0;
}
.cve-ref-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 0; border-bottom: 1px solid var(--border);
}
.cve-ref-row:last-child { border-bottom: none; }
.cve-ref-id { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: #fca5a5; }
body.light .cve-ref-id { color: #b91c1c; }
.cve-ref-links { display: flex; gap: 6px; }
.cve-ref-link {
  font-size: 11px; color: var(--text-tertiary); text-decoration: none;
  padding: 2px 8px; border: 1px solid var(--border-medium); border-radius: var(--radius-sm);
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.cve-ref-link:hover { color: var(--text-primary); border-color: var(--border-strong); }

/* Repo-parsed references block */
.repo-refs-block {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 18px;
}
.repo-refs-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.repo-refs-label::before {
  content: ''; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent); flex-shrink: 0;
}
.repo-ref-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 4px 0; border-bottom: 1px solid var(--border);
}
.repo-ref-row:last-child { border-bottom: none; }
.repo-ref-note {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  white-space: nowrap; flex-shrink: 0;
}
.repo-ref-url {
  font-size: 11px; font-family: var(--font-mono); color: var(--accent);
  text-decoration: none; word-break: break-all;
  transition: opacity var(--transition-fast);
}
.repo-ref-url:hover { opacity: .75; text-decoration: underline; }

/* Legacy detail */
.detail-meta   { padding: 14px 20px 11px; border-bottom: 1px solid var(--border); }
.detail-badges { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 7px; align-items: center; }
.detail-pb     { font-size: 12px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 1px; }
.detail-author { font-size: 12px; color: var(--text-tertiary); margin-top: 7px; }
.detail-body   { padding: 14px 20px 20px; }
.detail-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.detail-tags   { margin-top: 12px; }
.meta-row      { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; font-size: 12px; }
.meta-dot      { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }
.meta-id       { color: var(--text-tertiary); }

/* KQL block */
.kql-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
pre.kql {
  background: var(--bg-base); border: 1px solid var(--border-medium);
  border-radius: var(--radius-md); padding: 14px;
  font-size: 12px; line-height: 1.7; color: var(--text-code);
  font-family: var(--font-mono); overflow-x: auto; white-space: pre;
}
body.light pre.kql { background: #f4f6fb; color: #1a56db; }

/* Variable resolver */
.varbox { background: rgba(14,165,233,.05); border: 1px solid var(--primary-border); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 14px; }
.varbox-title { font-size: 13px; font-weight: 700; color: var(--primary-hover); margin-bottom: 10px; }
.var-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 9px; }
.var-row  { display: flex; align-items: center; gap: 7px; }
.var-key  { font-size: 11px; color: var(--primary-hover); background: var(--primary-dim); padding: 3px 7px; border-radius: var(--radius-sm); font-family: var(--font-mono); border: 1px solid var(--primary-border); min-width: 90px; text-align: center; white-space: nowrap; }
.var-lbl  { font-size: 11px; color: var(--text-tertiary); min-width: 45px; }
.var-input { flex: 1; padding: 7px 9px; font-size: 12px; }
.var-input.mono { font-family: var(--font-mono); }
.var-warn { margin-top: 9px; font-size: 11px; color: var(--sev-medium); }
.ready-badge { font-size: 10px; padding: 3px 7px; border-radius: var(--radius-sm); background: var(--sev-low-bg); color: var(--sev-low); font-weight: 700; }
body.light .varbox { background: rgba(14,165,233,.03); border-color: rgba(14,165,233,.20); }
body.light .varbox-title { color: var(--primary); }
body.light .var-key { background: rgba(14,165,233,.08); color: var(--primary); border-color: rgba(14,165,233,.25); }

/* ════════════════════════════════════════════════════════════════
   MODALS
════════════════════════════════════════════════════════════════ */
.modal-overlay, .overlay {
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 150ms ease-out;
}
.modal-overlay.top { align-items: flex-start; padding-top: 20px; overflow-y: auto; }

.modal-box, .mdl {
  background: var(--bg-raised); border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  width: 100%; margin: 0 16px 40px;
  animation: scaleIn 180ms cubic-bezier(.16,1,.3,1) both;
  max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,.4);
}
.mdl.wide,    .modal-box.wide   { max-width: 780px; }
.mdl.narrow,  .modal-box.narrow { max-width: 480px; }

.modal-header, .mdl-h {
  padding: 15px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.modal-header h2, .mdl-h h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }

.modal-body, .mdl-body { padding: 20px; overflow-y: auto; }
.mdl-scroll { padding: 20px; max-height: 70vh; overflow-y: auto; }

.modal-footer, .mdl-footer {
  padding: 13px 20px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════
   PROFILE MODAL — Redesign
════════════════════════════════════════════════════════════════ */
.prof-modal { padding: 0; overflow: hidden; }
.prof-body  { overflow-y: auto; max-height: calc(90vh - 110px); }

.prof-identity {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.prof-av-wrap {
  position: relative; width: 72px; height: 72px; flex-shrink: 0;
}
.prof-av-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity var(--transition-fast);
  border: none; cursor: pointer; color: #fff;
}
.prof-av-wrap:hover .prof-av-overlay { opacity: 1; }

.prof-identity-info { display: flex; flex-direction: column; gap: 0; flex: 1; min-width: 0; }
.prof-username { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.prof-role-badge {
  display: inline-flex; align-items: center;
  padding: 1px 7px; border-radius: var(--radius-full);
  font-size: 10px; font-weight: 600; letter-spacing: .02em; text-transform: capitalize;
}
.prof-team-chip {
  font-size: 11px; color: var(--text-tertiary);
  background: var(--bg-raised); border: 1px solid var(--border-medium);
  padding: 1px 7px; border-radius: var(--radius-full);
}
.prof-del-photo {
  margin-top: 7px; font-size: 11px; color: var(--text-danger);
  background: none; border: none; cursor: pointer; padding: 0; text-align: left;
}

.prof-section {
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}
.prof-section--last { border-bottom: none; }

.prof-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-tertiary);
  padding: 12px 0 6px;
}
.prof-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.prof-row:last-child { border-bottom: none; }
.prof-row-key { font-size: 12px; color: var(--text-tertiary); flex-shrink: 0; min-width: 80px; }
.prof-row-val { font-size: 13px; color: var(--text-secondary); }

.prof-danger-btn {
  font-size: 11px; padding: 3px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--text-danger); color: var(--text-danger);
  background: none; cursor: pointer; flex-shrink: 0;
  transition: background var(--transition-fast);
}
.prof-danger-btn:hover { background: rgba(255,45,85,.08); }

.prof-env-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-tertiary);
}
.prof-env-dot--active { background: #22c55e; }

.prof-link-btn {
  font-size: 12px; color: var(--primary); background: none; border: none;
  cursor: pointer; padding: 0; white-space: nowrap; flex-shrink: 0;
  transition: opacity var(--transition-fast);
}
.prof-link-btn:hover { opacity: .75; }

.prof-sec-item {
  display: flex; align-items: center; gap: 10px;
}
.prof-sec-ico {
  width: 28px; height: 28px; border-radius: var(--radius-md);
  background: var(--bg-raised); border: 1px solid var(--border-medium);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--text-tertiary);
}
.prof-sec-label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.prof-sec-sub   { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

.prof-action-btn {
  font-size: 11px; padding: 4px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium); background: var(--bg-raised); color: var(--text-secondary);
  cursor: pointer; flex-shrink: 0;
  transition: all var(--transition-fast);
}
.prof-action-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text-primary); }
.prof-action-btn:disabled { opacity: .5; cursor: not-allowed; }

.close {
  background: none; border: none; color: var(--text-tertiary);
  font-size: 20px; cursor: pointer; padding: 3px 7px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast); line-height: 1;
}
.close:hover { color: var(--primary); background: var(--primary-dim); }

.reg-box {
  background: var(--bg-raised); border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg); width: 100%; max-width: 400px;
  padding: 26px; margin: 0 16px;
  animation: scaleIn 180ms cubic-bezier(.16,1,.3,1) both;
}
.reg-box h3 { font-size: 17px; font-weight: 700; margin-bottom: 5px; }
body.light .reg-box { background: var(--bg-surface); }
body.light .mdl, body.light .modal-box { background: var(--bg-surface); }

/* ════════════════════════════════════════════════════════════════
   LOGIN PAGE
════════════════════════════════════════════════════════════════ */
.login-wrap {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background-image:
    linear-gradient(rgba(14,165,233,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14,165,233,.04) 1px, transparent 1px);
  background-size: 44px 44px;
  background-color: var(--bg-base);
}
.login-box { width: 100%; max-width: 400px; padding: 0 20px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 26px; font-weight: 800; margin-top: 14px; letter-spacing: -.03em; }
.login-logo .logo-k { width: 56px; height: 56px; font-size: 22px; display: inline-flex; margin-bottom: 0; box-shadow: var(--shadow-glow-primary); }
.login-form {
  background: var(--bg-surface); border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl); padding: 22px; box-shadow: var(--shadow-lg);
}
.login-demo { text-align: center; margin-top: 16px; }
body.light .login-form { background: var(--bg-surface); }
body.light .login-wrap {
  background-image:
    linear-gradient(rgba(14,165,233,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14,165,233,.03) 1px, transparent 1px);
  background-color: var(--bg-base);
}

/* ════════════════════════════════════════════════════════════════
   TOAST — nouveau système
════════════════════════════════════════════════════════════════ */
/* Container du nouveau système Toast */
.toast-container {
  position: fixed; bottom: 20px; right: 20px;
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-raised); border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  font-size: var(--text-sm); font-weight: 500; color: var(--text-primary);
  pointer-events: all; min-width: 260px; max-width: 380px;
  animation: slideInRight 200ms ease-out;
}
.toast-item.success { border-left: 3px solid var(--sev-low);     }
.toast-item.error   { border-left: 3px solid var(--sev-critical); }
.toast-item.warning { border-left: 3px solid var(--sev-medium);   }
.toast-item.info    { border-left: 3px solid var(--accent);       }
.toast-item-icon { flex-shrink: 0; font-size: 15px; }
.toast-item-msg  { flex: 1; }
.toast-item-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-tertiary); font-size: 16px; padding: 0; line-height: 1;
  transition: color var(--transition-fast);
}
.toast-item-close:hover { color: var(--text-primary); }

/* Toast legacy (ancien système pour compatibilité) */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  padding: 11px 16px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  background: var(--sev-low-bg); color: var(--sev-low); border: 1px solid var(--sev-low-border);
  box-shadow: var(--shadow-md); pointer-events: none;
  animation: toastIn 200ms ease both; max-width: 320px;
}
.toast.error { background: var(--primary-dim); color: #fca5a5; border-color: var(--primary-border); }
body.light .toast { background: rgba(45,212,191,.08); color: #0d9488; border-color: var(--sev-low-border); }
body.light .toast.error { background: rgba(14,165,233,.08); color: var(--primary); border-color: var(--primary-border); }

/* ════════════════════════════════════════════════════════════════
   MISC COMPONENTS
════════════════════════════════════════════════════════════════ */
.tchip {
  padding: 5px 9px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border-medium); background: transparent; color: var(--text-tertiary);
  transition: all var(--transition-fast);
}
.tchip:hover { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text-secondary); }
.tchip.on    { background: var(--bg-active); border-color: var(--border-strong); color: var(--text-primary); }

.chips      { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 16px; }
.chip       { padding: 4px 9px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid var(--border-medium); background: transparent; color: var(--text-tertiary); transition: all var(--transition-fast); }
.chip-sep   { width: 1px; background: var(--border-medium); margin: 0 3px; }
.clear-chip { color: var(--primary); border: none; }

.folder-header { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; padding: 11px 13px; border: 1px solid; border-radius: var(--radius-md); }
.close-x { margin-left: auto; cursor: pointer; color: var(--text-tertiary); font-size: 17px; }

/* Empty state */
.empty        { text-align: center; padding: 60px; color: var(--text-tertiary); }
.empty-num    { font-size: 42px; margin-bottom: 10px; }
.empty-inline { grid-column: 1/-1; text-align: center; padding: 40px; color: var(--text-tertiary); }

/* PICERL bar */
.section   { margin-top: 26px; }
.pbar      { display: flex; gap: 2px; border-radius: var(--radius-md); overflow: hidden; }
.pbi       { flex: 1; padding: 11px 5px; text-align: center; cursor: pointer; }
.pbi-num   { font-size: 17px; font-weight: 800; }
.pbi-lbl   { font-size: 10px; opacity: .7; margin-top: 2px; }

.file-input { padding: 11px; }

/* JS Tooltip */
.kv-tip, .tooltip {
  position: fixed; z-index: 9999; display: none;
  background: var(--bg-raised); color: var(--text-secondary);
  border: 1px solid var(--border-medium); border-radius: var(--radius-md);
  padding: 8px 12px; font-size: 11px; font-weight: 500;
  white-space: pre-line; line-height: 1.6; pointer-events: none;
  max-width: 240px; min-width: 140px; box-shadow: var(--shadow-lg);
  font-family: var(--font-ui);
}

/* ════════════════════════════════════════════════════════════════
   WATCH ALERT BANNER
════════════════════════════════════════════════════════════════ */
.watch-banner {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; padding: 12px 16px;
  background: var(--accent-dim); border: 1px solid var(--accent-border);
  border-left: 3px solid var(--accent); border-radius: var(--radius-md);
  cursor: pointer; transition: background var(--transition-fast), border-color var(--transition-fast);
}
.watch-banner:hover { background: rgba(0,212,255,.14); }
.watch-banner-ico { color: var(--accent); flex-shrink: 0; animation: pulseIco 2.8s ease infinite; }
.watch-banner-txt { font-size: 13px; font-weight: 600; color: var(--text-accent); flex: 1; }
.watch-banner-count { color: var(--text-accent); font-size: 16px; font-weight: 800; }
.watch-banner-count.watch-banner-crit { color: var(--sev-critical); }
.watch-banner-btn { margin-left: auto; font-size: 12px; padding: 5px 12px; border-radius: 6px; flex-shrink: 0; }

body.light .watch-banner { background: var(--accent-dim); border-color: var(--accent-border); border-left-color: var(--accent); }
body.light .watch-banner:hover { background: rgba(0,212,255,.12); }
body.light .watch-banner-txt { color: #0284c7; }
body.light .watch-banner-count { color: #0284c7; }
body.light .watch-banner-ico { color: #0284c7; }

/* ════════════════════════════════════════════════════════════════
   SKELETON
════════════════════════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-active) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}
.skeleton-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 15px;
  display: flex; flex-direction: column; gap: 10px;
}
.sk-line { height: 10px; border-radius: 4px; background: var(--bg-hover); animation: shimmer 1.5s infinite; background-size: 200% 100%; }
.sk-title  { height: 14px; width: 65%; }
.sk-short  { width: 40%; }
.sk-bar    { height: 5px; width: 100%; border-radius: 99px; }

/* ════════════════════════════════════════════════════════════════
   HAMBURGER & SIDEBAR OVERLAY (mobile)
════════════════════════════════════════════════════════════════ */
.hdr-hamburger {
  display: none; width: 34px; height: 34px; border-radius: var(--radius-md);
  border: 1px solid var(--border-medium); background: var(--bg-raised); color: var(--text-tertiary);
  align-items: center; justify-content: center; cursor: pointer; padding: 0; flex-shrink: 0;
  transition: all var(--transition-fast);
}
.hdr-hamburger:hover { background: var(--bg-hover); border-color: var(--border-strong); color: var(--text-primary); }

.side-overlay {
  display: none; position: fixed; inset: var(--hdr-h) 0 0 0;
  background: rgba(0,0,0,.6); z-index: 29;
  animation: fadeIn 200ms ease both;
}
.side-overlay.active { display: block; }

/* ════════════════════════════════════════════════════════════════
   ANIMATIONS
════════════════════════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}
@keyframes pulseIco {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.1); opacity: .85; }
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: .35; }
  50%       { opacity: .65; }
}

/* Dot pulsant */
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.live { background: var(--sev-low); animation: pulseIco 2s ease-in-out infinite; }

/* Spinner */
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-medium); border-top-color: var(--accent); border-radius: 50%; animation: spin 600ms linear infinite; }

/* Animation classes */
.animate-fade-in     { animation: fadeIn    200ms ease-out both; }
.animate-fade-in-up  { animation: fadeInUp  250ms ease-out both; }
.animate-slide-right { animation: slideInRight 200ms ease-out both; }
.animate-scale-in    { animation: scaleIn   180ms ease-out both; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ════════════════════════════════════════════════════════════════
   WATCH VIEW
════════════════════════════════════════════════════════════════ */
.watch-article {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
  cursor: pointer; margin-bottom: 8px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.watch-article:hover { background: var(--bg-raised); border-color: var(--border-medium); }
.watch-article.was-read { opacity: .6; }

/* Watch top bar */
.wa-topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px; margin-bottom: 18px;
}
.wa-topbar-left  { display: flex; align-items: center; gap: 8px; }
.wa-topbar-right { display: flex; align-items: center; gap: 8px; }
.wa-topbar-ico   { color: var(--accent); flex-shrink: 0; }
.wa-topbar-title { font-size: 18px; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.wa-topbar-ts    { font-size: 12px; color: var(--text-tertiary); }

.wa-btn-sec { font-size: 12px; padding: 6px 13px; }
.wa-btn-refresh { font-size: 12px; padding: 6px 13px; display: inline-flex; align-items: center; gap: 6px; }
.wa-spin-icon { flex-shrink: 0; }
.wa-btn-refresh.spinning .wa-spin-icon { animation: spin .8s linear infinite; }

/* Watch stats */
.wa-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.wa-stat-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color var(--transition-fast);
}
.wa-stat-card--warn { border-color: var(--sev-high-border); }
.wa-stat-card--crit { border-color: var(--sev-critical-border); box-shadow: 0 0 14px var(--sev-critical-bg); }
.wa-stat-ico {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.wa-stat-ico--bell   { background: var(--accent-dim);         color: var(--accent); }
.wa-stat-ico--shield { background: var(--sev-critical-bg);    color: var(--sev-critical); }
.wa-stat-ico--db     { background: var(--intel-dim);          color: var(--intel); }
.wa-stat-body        { min-width: 0; }
.wa-stat-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-tertiary); margin-bottom: 4px; }
.wa-stat-val         { font-size: 28px; font-weight: 800; line-height: 1; color: var(--text-tertiary); }
.wa-stat-val--warn   { color: var(--sev-high); }
.wa-stat-val--crit   { color: var(--sev-critical); }
.wa-stat-val--purple { color: var(--intel); }

/* Watch filter bar */
.wa-filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-bottom: 14px; position: sticky; top: 0; z-index: 5;
  background: var(--bg-base); padding: 8px 0 6px;
}
.wa-filter-sep { width: 1px; height: 20px; background: var(--border-medium); flex-shrink: 0; }

.wa-filter-seg {
  display: flex; background: var(--bg-raised); border: 1px solid var(--border-medium);
  border-radius: 7px; overflow: hidden;
}
.wa-seg-btn {
  border: none; background: transparent; color: var(--text-tertiary);
  font-size: 12px; font-weight: 600; padding: 5px 11px; cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.wa-seg-btn:hover  { background: var(--bg-hover); color: var(--text-primary); }
.wa-seg-btn.active { background: var(--bg-active); color: var(--text-primary); }

.wa-filter-chips { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.wa-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 20px;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text-tertiary);
  cursor: pointer; transition: all var(--transition-fast);
}
.wa-chip:hover { background: var(--bg-hover); color: var(--text-secondary); }
.wa-chip.active {
  border-color: var(--chip-c, var(--accent-border));
  background: color-mix(in srgb, var(--chip-c, var(--accent)) 12%, transparent);
  color: var(--chip-c, var(--accent));
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .hdr-center { max-width: 30%; }
}

@media (max-width: 900px) {
  .detail-panel { width: 68%; min-width: 360px; }
  .qgrid, .query-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
}

@media (max-width: 768px) {
  :root { --hdr-h: 104px; }

  /* Header wraps to 2 rows: [hamburger + logo + actions] then [search bar] */
  .hdr, .header {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    row-gap: 0;
    padding: 0 12px 8px;
    align-items: center;
  }
  .hdr-left, .header-left   { height: 56px; display: flex; align-items: center; }
  .hdr-right, .header-right { height: 56px; display: flex; align-items: center; }
  .hdr-hamburger { display: inline-flex; align-self: center; margin-top: 0; }

  /* Search becomes a full-width second row */
  .hdr-center, .header-center {
    display: flex;
    order: 10;
    flex: 0 0 100%;
    max-width: 100%;
    margin: 0;
  }

  .hdr-sep { display: none; }
  .hdr-btn-tool, .hdr-btn-var, .hdr-btn-nav, .hdr-btn-admin, .hdr-btn-signout { display: none; }
  .hdr-profile span { display: none; }
  .hdr-profile { padding: 4px 5px; }

  .side, .sidebar {
    position: fixed; left: 0; top: var(--hdr-h);
    height: calc(100vh - var(--hdr-h)); width: 260px; z-index: 30;
    transform: translateX(-100%);
    transition: transform 300ms cubic-bezier(.16,1,.3,1);
    box-shadow: 4px 0 32px rgba(0,0,0,.55); overflow-y: auto;
  }
  .side.side--open, .sidebar.side--open { transform: translateX(0); }

  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .qgrid, .query-grid { grid-template-columns: 1fr; }
  .content { padding: 12px 14px 60px; }
  .ql-tags, .qt-mitre { display: none; }
  .qt-desc { max-width: 180px; }
  .detail-panel { width: 100%; min-width: unset; }
  .wa-stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  :root { --hdr-h: 104px; }
  .stats { grid-template-columns: 1fr; }
  .hdr, .header { padding: 0 10px 8px; gap: 6px; }
  .hdr-btn-new { padding: 7px 10px; font-size: 12px; }
  .hdr-btn-new svg { display: none; }
  .content { padding: 10px 10px 60px; }
  .wa-stats { grid-template-columns: 1fr; }
  .card-title-text { font-size: 13px; }
  .card-desc-text  { font-size: 11px; }
  .card-kql-prev   { font-size: 10px; }
}

@media (min-width: 1440px) {
  .qgrid, .query-grid { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 16px; }
}
@media (min-width: 1920px) {
  .qgrid, .query-grid { grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); }
}

/* ════════════════════════════════════════════════════════════════
   WATCH SLIDE-IN (article detail)
════════════════════════════════════════════════════════════════ */

/* Overlay backdrop */
.ws-overlay { display: none; }
.ws-overlay.open {
  display: block; position: fixed; inset: 0;
  background: rgba(0,0,0,.52); z-index: 49;
  animation: fadeIn 200ms ease both;
}

/* Slide-in panel */
.ws-panel { display: none; }
.ws-panel.open {
  display: flex; flex-direction: column;
  position: fixed; top: 0; right: 0; width: 580px; max-width: 100vw; height: 100vh;
  background: var(--bg-raised); border-left: 1px solid var(--border-medium);
  z-index: 50; overflow: hidden;
  box-shadow: -8px 0 40px rgba(0,0,0,.45);
  animation: slideInRight 280ms cubic-bezier(.16,1,.3,1) both;
}

/* Header */
.ws-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  gap: 10px; flex-shrink: 0;
}
.ws-header-left  { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.ws-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ws-fav { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
.ws-src-name {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--src-c, var(--text-tertiary)); flex-shrink: 0;
}
.ws-sev-pill {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-full);
  border: 1px solid; text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0;
}
.ws-sev-critical { background: var(--sev-critical-bg); color: var(--sev-critical); border-color: var(--sev-critical-border); }
.ws-sev-high     { background: var(--sev-high-bg);     color: var(--sev-high);     border-color: var(--sev-high-border); }
.ws-sev-medium   { background: var(--sev-medium-bg);   color: var(--sev-medium);   border-color: var(--sev-medium-border); }
.ws-sev-low      { background: var(--sev-low-bg);      color: var(--sev-low);      border-color: var(--sev-low-border); }
.ws-sev-info     { background: var(--sev-info-bg);     color: var(--sev-info);     border-color: var(--sev-info-border); }

.ws-dismiss-btn {
  font-size: 12px; padding: 5px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--bg-surface);
  color: var(--text-secondary); cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.ws-dismiss-btn:hover { background: var(--sev-critical-bg); color: var(--sev-critical); border-color: var(--sev-critical-border); }
.ws-read-btn {
  font-size: 12px; font-weight: 600; padding: 5px 13px; border-radius: var(--radius-md);
  background: var(--primary); color: #fff; text-decoration: none; display: inline-flex;
  align-items: center; transition: opacity var(--transition-fast);
}
.ws-read-btn:hover { opacity: .85; }
.ws-close {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: none; color: var(--text-tertiary); cursor: pointer; font-size: 18px; line-height: 1;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.ws-close:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Scrollable body */
.ws-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.ws-og-img { width: 100%; max-height: 200px; object-fit: cover; flex-shrink: 0; }
.ws-content { padding: 18px 20px 24px; flex: 1; }

/* Title + meta */
.ws-title { font-size: 17px; font-weight: 800; color: var(--text-primary); line-height: 1.35; margin: 0 0 10px; letter-spacing: -.02em; }
.ws-meta  { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.ws-ts     { font-size: 11px; color: var(--text-tertiary); }
.ws-sep    { color: var(--text-tertiary); font-size: 11px; }
.ws-domain { font-size: 11px; color: var(--text-tertiary); }
.ws-summary { font-size: 13px; color: var(--text-secondary); line-height: 1.65; margin-bottom: 16px; }

/* Chips */
.ws-chips-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.ws-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: var(--radius-full);
  border: 1px solid var(--border); background: var(--bg-surface); color: var(--text-secondary);
  text-decoration: none; transition: opacity var(--transition-fast);
}
.ws-chip:hover { opacity: .8; }
.ws-chip-cve  { color: var(--sev-critical); background: var(--sev-critical-bg); border-color: var(--sev-critical-border); font-family: var(--font-mono); font-size: 10px; }
.ws-chip-kw   { color: var(--intel); background: var(--intel-dim); border-color: var(--intel-border); }
.ws-chip-prod { color: var(--text-secondary); background: var(--bg-raised); border-color: var(--border-medium); }

/* Section label */
.ws-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-tertiary); margin-bottom: 8px;
}

/* Matching queries */
.ws-matches-section { margin-top: 8px; }
.ws-match-row {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 12px; margin-bottom: 6px; cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.ws-match-row:hover { background: var(--bg-hover); border-color: var(--border-medium); }
.ws-match-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.ws-match-title { flex: 1; font-size: 12px; font-weight: 600; color: var(--text-primary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-match-lang { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: var(--radius-sm); background: var(--bg-raised); border: 1px solid var(--border); color: var(--text-tertiary); }
.ws-match-env  { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: var(--radius-sm); border: 1px solid; }
.ws-match-score { font-size: 11px; font-weight: 800; color: var(--text-tertiary); margin-left: auto; flex-shrink: 0; }
.ws-score-track { height: 3px; border-radius: 2px; background: var(--bg-active); overflow: hidden; margin-bottom: 6px; }
.ws-score-fill  { height: 100%; border-radius: 2px; transition: width .3s ease; }
.ws-reasons { display: flex; flex-wrap: wrap; gap: 4px; }
.ws-reason-chip { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: var(--radius-sm); }

/* View all button */
.ws-viewall-btn {
  width: 100%; margin-top: 4px; padding: 8px; font-size: 12px; font-weight: 600;
  border: 1px dashed var(--border-medium); border-radius: var(--radius-md);
  background: none; color: var(--text-tertiary); cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.ws-viewall-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--accent-border); }

/* Empty state */
.ws-empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 16px; text-align: center; color: var(--text-tertiary); }
.ws-empty-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.ws-empty-sub   { font-size: 12px; line-height: 1.6; max-width: 320px; }


/* ════════════════════════════════════════════════════════════════
   ADMIN
════════════════════════════════════════════════════════════════ */
.admin-sidebar {
  width: 200px; flex-shrink: 0; background: var(--bg-surface);
  border-right: 1px solid var(--border); padding: 12px 8px;
  overflow-y: auto;
}
.admin-tab {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: var(--radius-md); cursor: pointer; margin-bottom: 2px;
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
  border: none; background: none; width: 100%; text-align: left;
}
.admin-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.admin-tab.active { background: var(--primary-dim); color: var(--primary); border-color: var(--primary-border); }

/* ════════════════════════════════════════════════════════════════
   PAGE HERO (style Crimson7)
════════════════════════════════════════════════════════════════ */
.page-hero { margin-bottom: var(--space-8); }
.page-hero-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--primary); margin-bottom: var(--space-2);
  display: flex; align-items: center; gap: var(--space-2);
}
.page-hero-title {
  font-size: var(--text-4xl); font-weight: 800;
  color: var(--text-primary); letter-spacing: -0.04em; line-height: 1.1;
}
.page-hero-title em { font-style: normal; color: var(--accent); }
.page-hero-sub { font-size: var(--text-md); color: var(--text-secondary); margin-top: var(--space-3); font-weight: 400; }

/* ════════════════════════════════════════════════════════════════
   WATCH VIEW — LIST / COMPACT / MOSAIC
════════════════════════════════════════════════════════════════ */
.wa-list { display: flex; flex-direction: column; gap: 8px; }

.wa-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px; cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  animation: fadeInUp 250ms ease both;
  animation-delay: calc(var(--i, 0) * 30ms);
}
.wa-card:hover { background: var(--bg-raised); border-color: var(--border-medium); box-shadow: var(--shadow-md); }
.wa-card--unread { border-left: 3px solid var(--sev-low); }
.wa-card--crit   { border-left: 3px solid var(--sev-critical); }

.wa-card-layout  { display: flex; gap: 14px; align-items: flex-start; }
.wa-card-thumb   { width: 80px; height: 52px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.wa-card-body    { flex: 1; min-width: 0; }
.wa-card-head    { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 7px; }
.wa-card-title   { font-size: 14px; font-weight: 600; color: var(--text-secondary); line-height: 1.35; margin-bottom: 5px; }
.wa-card-title--unread { color: var(--text-primary); font-weight: 700; }
.wa-card-desc    { font-size: 12px; color: var(--text-tertiary); line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wa-card-time    { font-size: 11px; color: var(--text-tertiary); margin-left: auto; white-space: nowrap; flex-shrink: 0; }
.wa-card-ext     { color: var(--text-tertiary); display: inline-flex; align-items: center; transition: color var(--transition-fast); padding: 2px; text-decoration: none; }
.wa-card-ext:hover { color: var(--accent); }
.wa-card-read-btn, .watch-read-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-tertiary); display: inline-flex; align-items: center;
  padding: 3px; border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}
.wa-card-read-btn:hover, .watch-read-btn:hover { color: var(--sev-low); background: var(--sev-low-bg); }

/* Source / severity pills */
.wa-src-pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px;
  border-radius: var(--radius-full); font-size: 10px; font-weight: 700; letter-spacing: .04em;
  background: var(--bg-hover); color: var(--text-tertiary); border: 1px solid var(--border-medium);
}
.wa-sev-pill {
  display: inline-flex; align-items: center; padding: 2px 7px;
  border-radius: var(--radius-full); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; border: 1px solid;
}
.wa-sev-critical { background: var(--sev-critical-bg); color: var(--sev-critical); border-color: var(--sev-critical-border); }
.wa-sev-high     { background: var(--sev-high-bg);     color: var(--sev-high);     border-color: var(--sev-high-border); }
.wa-sev-medium   { background: var(--sev-medium-bg);   color: var(--sev-medium);   border-color: var(--sev-medium-border); }
.wa-sev-low      { background: var(--sev-low-bg);      color: var(--sev-low);      border-color: var(--sev-low-border); }
.wa-sev-info     { background: var(--sev-info-bg);     color: var(--sev-info);     border-color: var(--sev-info-border); }

.wa-tag {
  display: inline-block; padding: 2px 6px; border-radius: var(--radius-sm);
  font-size: 10px; font-weight: 600; border: 1px solid var(--border-medium);
  background: var(--bg-hover); color: var(--text-tertiary);
}
.wa-tag-kw  { color: var(--intel); border-color: var(--intel-border); background: var(--intel-dim); }
.wa-tag-cve { color: var(--sev-critical); border-color: var(--sev-critical-border); background: var(--sev-critical-bg); font-family: var(--font-mono); }
.wa-match-pill {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-full);
  background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border);
}

/* Compact view */
.wa-compact-list { display: flex; flex-direction: column; gap: 1px; }
.wa-compact-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border-radius: var(--radius-md); cursor: pointer; font-size: 12px;
  transition: background var(--transition-fast);
  animation: fadeInUp 200ms ease both; animation-delay: calc(var(--i, 0) * 20ms);
}
.wa-compact-item:hover { background: var(--bg-hover); }
.wa-compact-item.unread { font-weight: 600; color: var(--text-primary); }
.wa-compact-dot  { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.wa-compact-fav  { width: 14px; height: 14px; border-radius: 2px; flex-shrink: 0; }
.wa-compact-src  { font-size: 10px; color: var(--text-tertiary); font-weight: 600; flex-shrink: 0; min-width: 80px; }
.wa-compact-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.wa-compact-item.unread .wa-compact-title { color: var(--text-primary); }
.wa-compact-sev  { font-size: 10px; font-weight: 700; flex-shrink: 0; }
.wa-compact-qcount { font-size: 10px; background: var(--accent-dim); color: var(--accent); padding: 1px 5px; border-radius: var(--radius-full); font-weight: 700; flex-shrink: 0; }
.wa-compact-time { font-size: 10px; color: var(--text-tertiary); flex-shrink: 0; }
.wa-compact-ext  { color: var(--text-tertiary); display: inline-flex; padding: 2px; transition: color var(--transition-fast); text-decoration: none; }
.wa-compact-ext:hover { color: var(--accent); }
.wa-compact-read-btn {
  background: none; border: none; cursor: pointer; color: var(--text-tertiary);
  display: inline-flex; align-items: center; padding: 2px; border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}
.wa-compact-read-btn:hover { color: var(--sev-low); }

/* Mosaic view */
.wa-mosaic-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px;
}
.wa-mosaic-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-fast), border-color var(--transition-fast);
  animation: fadeInUp 280ms ease both; animation-delay: calc(var(--i, 0) * 40ms);
  display: flex; flex-direction: column;
}
.wa-mosaic-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-medium); }
.wa-mosaic-card:active { transform: translateY(0); }
.wa-mosaic-card--unread { border-top: 2px solid var(--sev-low); }
.wa-mosaic-card--crit   { border-color: var(--sev-critical-border); }
.wa-mosaic-img { width: 100%; height: 140px; object-fit: cover; }
.wa-mosaic-img-fallback { width: 100%; height: 100px; display: flex; align-items: center; justify-content: center; }
.wa-mosaic-body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.wa-mosaic-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wa-mosaic-title {
  font-size: 13px; font-weight: 600; color: var(--text-secondary); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.wa-mosaic-card--unread .wa-mosaic-title { color: var(--text-primary); }
.wa-mosaic-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.wa-mosaic-time { font-size: 10px; color: var(--text-tertiary); }
.wa-mosaic-ext  { color: var(--text-tertiary); display: inline-flex; padding: 2px; transition: color var(--transition-fast); text-decoration: none; }
.wa-mosaic-ext:hover { color: var(--accent); }

/* Empty state watch */
.wa-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 40px; gap: 14px; text-align: center;
}
.wa-empty-txt { font-size: 14px; color: var(--text-tertiary); font-weight: 500; }

/* Watch slide-in */
.watch-slidein-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 49; animation: fadeIn 200ms ease both; }
.watch-slidein {
  position: fixed; top: 0; right: 0; width: 580px; max-width: 100vw; height: 100vh;
  background: var(--bg-raised); border-left: 1px solid var(--border-medium);
  z-index: 50; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: -8px 0 32px rgba(0,0,0,.45);
  animation: slideInRight 280ms cubic-bezier(.16,1,.3,1) both;
}
.watch-slidein-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.watch-slidein-scroll { flex: 1; overflow-y: auto; }
.watch-slidein-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.watch-slidein-hero { width: 100%; max-height: 220px; object-fit: cover; }
.watch-slidein-body { padding: 20px; }
.watch-slidein-title { font-size: 18px; font-weight: 800; color: var(--text-primary); letter-spacing: -.02em; line-height: 1.3; margin-bottom: 14px; }
.watch-slidein-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; align-items: center; }
.watch-slidein-summary { font-size: 13px; color: var(--text-secondary); line-height: 1.65; margin-bottom: 20px; }

/* Light mode overrides */
body.light .wa-card { background: var(--bg-surface); }
body.light .wa-card:hover { background: var(--bg-raised); }
body.light .wa-mosaic-card { background: var(--bg-surface); }
body.light .wa-compact-item:hover { background: var(--bg-hover); }
body.light .wa-filter-bar { background: var(--bg-base); }
body.light .wa-statbar-item { background: var(--bg-surface); border-color: var(--border-medium); }
body.light .wa-statbar-item:hover { background: var(--bg-hover); }
body.light .wa-statbar-item.active { background: rgba(3,105,161,.08); border-color: rgba(3,105,161,.22); }
body.light .wa-view-toggle { background: var(--bg-surface); }
body.light .wsrc-source-row { background: var(--bg-surface); border-color: var(--border-medium); }
body.light .wsrc-edit-form { background: var(--bg-surface); border-color: rgba(3,105,161,.25); }

/* ════════════════════════════════════════════════════════════════
   WATCH — STATSBAR (KPI header)
════════════════════════════════════════════════════════════════ */
.wa-statsbar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 16px;
}
.wa-statbar-item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 18px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  cursor: pointer; transition: all var(--transition-fast); min-width: 110px;
}
.wa-statbar-item:hover  { border-color: var(--border-medium); background: var(--bg-raised); }
.wa-statbar-item.active { border-color: var(--accent-border); background: var(--accent-dim); }
.wa-statbar-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--text-tertiary); }
.wa-statbar-val { font-size: 26px; font-weight: 800; line-height: 1.1; color: var(--text-tertiary); }
.wa-statbar-val--unread  { color: var(--sev-high); }
.wa-statbar-val--critical{ color: var(--sev-critical); }
.wa-statbar-val--matched { color: var(--intel); }
.wa-statbar-val--neutral { color: var(--text-tertiary); }
.wa-statbar-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* Watch view toggle (list/compact/mosaic) */
.wa-view-toggle {
  display: flex; background: var(--bg-raised);
  border: 1px solid var(--border-medium); border-radius: 7px; overflow: hidden;
}
.wa-vbtn {
  border: none; background: transparent; color: var(--text-tertiary);
  font-size: 12px; font-weight: 500; padding: 6px 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.wa-vbtn:hover  { background: var(--bg-hover); color: var(--text-secondary); }
.wa-vbtn.active { background: var(--bg-active); color: var(--text-primary); }

/* ════════════════════════════════════════════════════════════════
   FEED SOURCES MODAL
════════════════════════════════════════════════════════════════ */
.wsrc-modal-body { max-height: 70vh; overflow-y: auto; padding: 18px 22px; }
.wsrc-section-hdr {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-tertiary); margin-bottom: 10px;
}
.wsrc-source-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 6px; transition: border-color var(--transition-fast);
}
.wsrc-source-row:hover { border-color: var(--border-medium); }
.wsrc-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.wsrc-favicon { width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0; }
.wsrc-info { flex: 1; min-width: 0; overflow: hidden; }
.wsrc-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wsrc-meta { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.wsrc-meta-err { color: var(--sev-high); }
.wsrc-type-pill {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 3px;
  background: var(--bg-hover); color: var(--text-secondary);
  border: 1px solid var(--border-medium); flex-shrink: 0; white-space: nowrap;
}
.wsrc-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.wsrc-toggle-btn { font-size: 11px; padding: 4px 10px; color: var(--text-secondary); }
.wsrc-edit-btn {
  font-size: 11px; padding: 4px 10px;
  color: var(--accent); border-color: var(--accent-border); background: var(--accent-dim);
}
.wsrc-edit-btn:hover { background: rgba(0,212,255,.18); }
.wsrc-del-btn {
  font-size: 11px; padding: 4px 10px;
  color: var(--primary); border-color: var(--primary-border); background: var(--primary-dim);
}
.wsrc-del-btn:hover { background: rgba(14,165,233,.2); }
.wsrc-edit-form {
  background: var(--bg-surface); border: 1px solid var(--accent-border);
  border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 6px;
}
.wsrc-edit-form-row { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.wsrc-edit-form-row input, .wsrc-edit-form-row select { flex: 1; min-width: 120px; font-size: 12px; padding: 6px 8px; }
.wsrc-edit-form-actions { display: flex; gap: 6px; justify-content: flex-end; }
.wsrc-edit-form-actions button { font-size: 12px; padding: 5px 14px; }

/* ════════════════════════════════════════════════════════════════
   REPO SOURCES — btn-group + toggle-switch
════════════════════════════════════════════════════════════════ */
.repo-row-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.repo-btn-group { display: flex; gap: 0; flex-shrink: 0; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-medium); }
.repo-btn-group button {
  font-size: 11px; padding: 5px 10px; border: none; border-radius: 0;
  border-right: 1px solid var(--border-medium); background: var(--bg-raised); color: var(--text-secondary);
  cursor: pointer; transition: background var(--transition-fast), color var(--transition-fast);
}
.repo-btn-group button:last-child { border-right: none; }
.repo-btn-group button:hover { background: var(--bg-hover); color: var(--text-primary); }
.repo-btn-group .repo-btn-sync  { color: var(--intel); }
.repo-btn-group .repo-btn-purge { color: var(--sev-high); }
.repo-btn-group .repo-btn-del   { color: var(--primary); }
.toggle-switch { position: relative; display: inline-block; width: 34px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border-strong); border-radius: 18px; transition: .2s;
}
.toggle-slider::before {
  content: ''; position: absolute; width: 12px; height: 12px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--intel); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ════════════════════════════════════════════════════════════════
   ADMIN PORTAL — Dashboard, Teams, Settings, Bulk bar
════════════════════════════════════════════════════════════════ */

/* Page wrapper */
.adm-page { max-width: 1400px; animation: fadeIn 200ms ease both; }
.adm-page-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.adm-page-title { font-size: var(--text-2xl); font-weight: 800; color: var(--text-primary); letter-spacing: -.03em; margin: 0; }
.adm-page-sub   { font-size: var(--text-sm); color: var(--text-tertiary); margin-top: 3px; }

/* Health badge */
.adm-health-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px;
  border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 600; white-space: nowrap;
}
.adm-health-badge.ok   { background: var(--sev-low-bg);    color: var(--sev-low);    border: 1px solid var(--sev-low-border); }
.adm-health-badge.warn { background: var(--sev-medium-bg); color: var(--sev-medium); border: 1px solid var(--sev-medium-border); }
.adm-health-badge .adm-health-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* KPI grid */
.adm-kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3); margin-bottom: var(--space-5);
}
.adm-kpi-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-4);
  display: flex; align-items: center; gap: var(--space-3);
  transition: all var(--transition-fast);
}
.adm-kpi-card:hover { border-color: var(--border-medium); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.adm-kpi-icon {
  width: 38px; height: 38px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.adm-kpi-icon--cyan   { background: var(--accent-dim); }
.adm-kpi-icon--violet { background: var(--intel-dim); }
.adm-kpi-icon--teal   { background: rgba(45,212,191,.10); }
.adm-kpi-icon--amber  { background: rgba(255,214,10,.10); }
.adm-kpi-icon--red    { background: var(--sev-critical-bg); }
.adm-kpi-icon--blue   { background: rgba(14,165,233,.10); }
.adm-kpi-val   { font-size: var(--text-2xl); font-weight: 800; color: var(--text-primary); letter-spacing: -.04em; line-height: 1; }
.adm-kpi-label { font-size: var(--text-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-tertiary); margin-top: 3px; }
.adm-kpi-sub   { font-size: 10px; color: var(--text-tertiary); margin-top: 1px; }

/* Charts row */
.adm-charts-row {
  display: flex; gap: var(--space-3); margin-bottom: var(--space-4); align-items: flex-start;
}
.adm-chart-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-5); min-width: 0;
}
.adm-chart-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: var(--space-4); flex-wrap: wrap; }
.adm-chart-title  { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 0; }
.adm-chart-sub    { font-size: var(--text-xs); color: var(--text-tertiary); }

/* ── Chart info tooltips ── */
.adm-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
}
.adm-tip-icon {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--text-tertiary);
  color: var(--text-tertiary);
  font-size: 9px; font-style: normal; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: default; flex-shrink: 0; user-select: none;
  opacity: 0.5;
  transition: opacity 0.15s, border-color 0.15s, color 0.15s;
}
.adm-tip:hover .adm-tip-icon {
  opacity: 1;
  border-color: var(--primary);
  color: var(--primary);
}
.adm-tip-bubble {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  background: var(--bg-raised);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 11px; font-weight: 400; line-height: 1.55;
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 200;
  text-align: left; white-space: normal;
}
.adm-tip-bubble::before {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border-medium);
}
.adm-tip-bubble::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%) translateY(-1px);
  border: 4px solid transparent;
  border-top-color: var(--bg-raised);
  z-index: 1;
}
.adm-tip:hover .adm-tip-bubble { opacity: 1; visibility: visible; }
.adm-chart-canvas-wrap {
  position: relative; width: 100%; height: 160px;
}
.adm-chart-canvas-wrap canvas { display: block; width: 100% !important; height: 100% !important; }
.adm-donut-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); text-align: center; pointer-events: none;
}
.adm-donut-num { display: block; font-size: 20px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.adm-donut-lbl { display: block; font-size: 10px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }

/* Chart legend */
.adm-legend { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.adm-legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.adm-legend-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.adm-legend-key  { flex: 1; color: var(--text-secondary); }
.adm-legend-val  { font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* Section label */
.adm-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-tertiary); margin: var(--space-5) 0 var(--space-3);
}

/* Bottom row (activity + health) */
.adm-bottom-row { display: flex; gap: var(--space-4); align-items: flex-start; margin-top: var(--space-4); }
.adm-activity-panel {
  flex: 1.5; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-5); min-width: 0; overflow: hidden;
}
.adm-activity-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); margin-bottom: var(--space-4); }
.adm-act-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.adm-act-row:last-child { border-bottom: none; }
.adm-act-time  { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); width: 36px; flex-shrink: 0; }
.adm-act-login { color: var(--text-secondary); font-size: 12px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-act-det   { color: var(--text-tertiary); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }

/* Health grid */
.adm-health-grid {
  flex: 1; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-5); min-width: 0;
}
.adm-health-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); margin-bottom: var(--space-4); }
.adm-health-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.adm-health-row:last-child { border-bottom: none; }
.adm-health-key { flex: 1; color: var(--text-tertiary); font-size: 12px; }
.adm-health-val { font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.adm-health-val.ok   { color: var(--sev-low); }
.adm-health-val.warn { color: var(--sev-medium); }
.adm-health-val.bad  { color: var(--sev-critical); }

/* Bulk action bar */
.bulk-bar {
  position: sticky; top: var(--hdr-h); z-index: 50;
  display: none; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--bg-raised); border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg); margin-bottom: var(--space-3);
  animation: fadeInUp 150ms ease-out;
  box-shadow: 0 4px 20px rgba(0,212,255,.08);
}
.bulk-bar.visible { display: flex; }
.bulk-count   { font-size: var(--text-sm); font-weight: 600; color: var(--accent); }
.bulk-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; flex-wrap: wrap; }
.adm-row-actions { display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition-fast); }
.adm-table-row:hover .adm-row-actions { opacity: 1; }

/* Teams grid */
.teams-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: var(--space-4); }
.team-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); overflow: hidden; transition: border-color var(--transition-fast);
}
.team-card:hover { border-color: var(--border-medium); }
.team-card-header {
  display: flex; align-items: flex-start; gap: var(--space-4); padding: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.team-avatar-wrap { flex-shrink: 0; }
.team-avatar-img {
  width: 52px; height: 52px; border-radius: var(--radius-lg);
  object-fit: cover; border: 2px solid var(--border-medium); display: block;
}
.team-avatar-initials {
  width: 52px; height: 52px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff;
}
.team-card-meta { flex: 1; min-width: 0; }
.team-card-name { font-size: var(--text-md); font-weight: 700; color: var(--text-primary); }
.team-card-desc { font-size: var(--text-sm); color: var(--text-tertiary); margin-top: 2px; }
.team-stat { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 10px 8px; text-align: center; border-right: 1px solid var(--border); }
.team-stat:last-child { border-right: none; }
.team-card-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }
.team-members { padding: var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: 4px; }
.team-member-row {
  display: flex; align-items: center; gap: var(--space-3); padding: 5px 6px;
  border-radius: var(--radius-md); transition: background var(--transition-fast);
}
.team-member-row:hover { background: var(--bg-hover); }
.team-member-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--intel-dim); color: var(--intel);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.team-member-info { flex: 1; min-width: 0; }
.team-member-name { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-member-role { font-size: var(--text-xs); color: var(--text-tertiary); }
.team-add-member {
  padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border);
  display: flex; gap: var(--space-2);
}
.adm-empty-hint { font-size: var(--text-xs); color: var(--text-tertiary); text-align: center; padding: var(--space-3) 0; }

/* Settings page */
.settings-section {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); margin-bottom: var(--space-4); overflow: hidden;
}
.settings-section-header {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border); background: var(--bg-raised);
}
.settings-section-icon  { font-size: 16px; }
.settings-section-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); flex: 1; }
.settings-table { padding: var(--space-2) 0; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border); transition: background var(--transition-fast);
}
.settings-row:last-child { border-bottom: none; }
.settings-row:hover { background: var(--bg-hover); }
.settings-label { font-size: var(--text-sm); color: var(--text-secondary); }
.settings-value { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); text-align: right; }
.settings-input { width: 90px; text-align: right; padding: 4px 8px; font-size: var(--text-sm); }
.settings-maintenance { padding: var(--space-2) 0; }
.settings-maint-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.settings-maint-row:last-child { border-bottom: none; }
.settings-maint-title { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.settings-maint-desc  { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: 2px; }

/* Old chart row compat aliases */
.adm-chart-row { display: flex; gap: var(--space-3); margin-bottom: var(--space-4); align-items: flex-start; }
.adm-chart-row-3 > .adm-chart-card:first-child { flex: 2; }
.adm-chart-row-3 > .adm-chart-card:not(:first-child) { flex: 1; }
.adm-chart-row-2 > .adm-chart-card { flex: 1; }

@media (max-width: 900px) {
  .adm-charts-row, .adm-chart-row { flex-direction: column; }
  .adm-bottom-row { flex-direction: column; }
  .teams-grid { grid-template-columns: 1fr; }
  .adm-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── KQL Syntax Highlighting (Prism overrides — VSCode dark theme) ─ */

/* Code block host — always dark regardless of app theme */
.re-code-content,
pre.re-code-content[class*="language-"] {
  background: #0d1117 !important;
  margin: 0 !important;
  padding: 10px 14px !important;
  border-radius: 0 !important;
  font-family: var(--mono, 'Cascadia Code', 'Fira Code', monospace) !important;
  font-size: 11.5px !important;
  line-height: 1.6 !important;
  color: #e6edf3 !important;
  white-space: pre !important;
  overflow-x: auto !important;
  tab-size: 4 !important;
}

/* Prism Tomorrow theme overrides — VSCode-inspired palette */
.re-code-content .token.keyword,
.re-code-content .token.rule,
.re-code-content .token.important  { color: #569cd6 !important; font-weight: 600 !important; }

.re-code-content .token.function,
.re-code-content .token.attr-name  { color: #dcdcaa !important; font-weight: normal !important; }

.re-code-content .token.class-name,
.re-code-content .token.builtin,
.re-code-content .token.entity     { color: #4ec9b0 !important; font-weight: 500 !important; }

.re-code-content .token.string,
.re-code-content .token.char,
.re-code-content .token.attr-value { color: #ce9178 !important; }

.re-code-content .token.comment,
.re-code-content .token.prolog,
.re-code-content .token.doctype    { color: #6a9955 !important; font-style: italic !important; }

.re-code-content .token.number,
.re-code-content .token.boolean    { color: #b5cea8 !important; }

.re-code-content .token.operator,
.re-code-content .token.delimiter  { color: #d4d4d4 !important; }

/* KQL pipe | — highlight distinctly */
.re-code-content .token.punctuation { color: #808080 !important; }
.re-code-content .token.pipe        { color: #c586c0 !important; font-weight: 700 !important; }

.re-code-content .token.variable    { color: #9cdcfe !important; }
.re-code-content .token.constant    { color: #4fc1ff !important; }
.re-code-content .token.type        { color: #4ec9b0 !important; }
.re-code-content .token.tag         { color: #569cd6 !important; }
.re-code-content .token.selector    { color: #d7ba7d !important; }
.re-code-content .token.property    { color: #9cdcfe !important; }
.re-code-content .token.regex       { color: #d16969 !important; }
.re-code-content .token.url         { color: #ce9178 !important; }

/* Keep Prism from overriding our block background on light theme */
body.light .re-code-block           { background: #0d1117; }
body.light .re-code-content         { color: #e6edf3; }
body.light pre[class*="language-"]  { background: #0d1117 !important; }

/* ════════════════════════════════════════════════════════════════
   BULK ACTIONS
════════════════════════════════════════════════════════════════ */
.card--selected {
  outline: 2px solid var(--red);
  outline-offset: -1px;
  background: rgba(220, 38, 38, 0.07) !important;
}
.card-bulk-check {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  pointer-events: none;
}
.card-bulk-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--red);
}
.hdr-btn-tool--active {
  background: var(--primary-dim) !important;
  border-color: var(--primary-border) !important;
  color: var(--red) !important;
}

/* ════════════════════════════════════════════════════════════════
   ENHANCED EMPTY STATES
════════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 64px 32px;
  animation: fadeInUp 300ms var(--ease-spring) both;
}
.empty-state-icon {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-raised); border: 1px solid var(--border-medium);
  font-size: 28px; margin-bottom: 20px;
  box-shadow: 0 0 0 8px var(--bg-surface);
}
.empty-state-icon svg { opacity: .45; color: var(--text-tertiary); }
.empty-state-title {
  font-size: var(--text-lg); font-weight: 700; color: var(--text-primary);
  margin-bottom: 8px; letter-spacing: -.01em;
}
.empty-state-desc {
  font-size: var(--text-sm); color: var(--text-tertiary);
  max-width: 320px; line-height: 1.6; margin-bottom: 24px;
}
.empty-state-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.empty-state-hint {
  margin-top: 24px; padding: 10px 16px;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-md); font-size: var(--text-xs);
  color: var(--text-tertiary); display: flex; align-items: center; gap: 8px;
}
.empty-state-hint kbd { font-family: var(--font-ui); }

/* ════════════════════════════════════════════════════════════════
   KEYBOARD SHORTCUTS OVERLAY
════════════════════════════════════════════════════════════════ */
.ov-shortcuts {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background: var(--bg-overlay); display: flex;
  align-items: center; justify-content: center;
  animation: fadeIn 150ms ease both;
}
.shortcuts-box {
  background: var(--bg-raised); border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg); padding: 24px 28px;
  width: 400px; max-width: 90vw; box-shadow: var(--shadow-lg);
  animation: scaleIn 180ms var(--ease-spring) both;
}
.shortcuts-list { display: flex; flex-direction: column; gap: 4px; }
.shortcut-row {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 10px; border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}
.shortcut-row:hover { background: var(--bg-hover); }
.shortcut-row span { font-size: var(--text-sm); color: var(--text-secondary); flex: 1; }
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 24px; padding: 0 6px;
  background: var(--bg-active); border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 5px;
  font-family: var(--font-ui); font-size: var(--text-xs); font-weight: 700;
  color: var(--text-primary); letter-spacing: .03em;
  box-shadow: 0 1px 0 var(--border-strong); flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════
   DRAG & DROP — FOLDER SIDEBAR
════════════════════════════════════════════════════════════════ */
.si[draggable="true"] { cursor: grab; }
.si[draggable="true"]:active { cursor: grabbing; }
.si.drag-over {
  background: var(--primary-dim) !important;
  border-top: 2px solid var(--primary) !important;
  border-radius: var(--radius-md);
}
.si.dragging { opacity: .35; transform: scale(.98); }

/* ════════════════════════════════════════════════════════════════
   MICRO-ANIMATIONS & POLISH
════════════════════════════════════════════════════════════════ */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.shake { animation: shake 320ms ease both; }

@keyframes pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.pop { animation: pop 200ms var(--ease-spring) both; }

/* Card micro-lift on hover */
.card {
  transition: transform var(--transition-base), box-shadow var(--transition-base),
              border-color var(--transition-base), background var(--transition-base) !important;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.card:active { transform: translateY(0) scale(.99); }

/* Button press feedback */
button:active:not(:disabled) { transform: scale(.97); }

/* Modal open animation */
.modal-wrap { animation: scaleIn 200ms var(--ease-spring) both; }

/* Skeleton loading grid */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  animation: fadeIn 200ms ease both;
}
.skeleton-card { border-left: 3px solid var(--bg-active); }
.sk-line { background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-active) 50%, var(--bg-hover) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 4px; }

/* Folder count badge pop on update */
.si-count { transition: background var(--transition-fast), color var(--transition-fast); }

/* Search input focus glow */
.header-search:focus-within {
  box-shadow: 0 0 0 2px var(--primary-border);
}

/* Shortcut hint in header search placeholder area */
.search-shortcut-hint {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--text-tertiary); pointer-events: none;
  font-family: var(--font-ui); letter-spacing: .05em;
}

/* ════════════════════════════════════════════════════════════════
   OFFLINE BANNER
════════════════════════════════════════════════════════════════ */
.kv-offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  background: #92400e; color: #fef3c7;
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 8px 16px; font-size: 13px; font-weight: 600;
  border-bottom: 1px solid #b45309;
  animation: slideUp 250ms ease both;
}
.kv-is-offline .hdr { top: 36px; }
.kv-is-offline .main-layout { padding-top: 36px; }

/* ════════════════════════════════════════════════════════════════
   VIRTUAL SCROLL — CSS-native (content-visibility)
════════════════════════════════════════════════════════════════ */
.card {
  content-visibility: auto;
  contain-intrinsic-size: 0 185px;
}
