/* ==========================================================================
   SPYDER 4.0 - Sovereign Intelligence & Zero-Knowledge Vault Design System
   Monochrome Obsidian & Platinum Sovereign Edition (High-End Swiss Grade)
   ========================================================================== */

:root {
  /* Deep Obsidian Slate Surfaces */
  --bg-core: #080c14;
  --bg-surface: #0e1524;
  --bg-surface-elevated: #162034;
  --bg-surface-hover: #1e2c46;
  --bg-inset: #05080e;
  
  /* Precision Hairline Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: #24344d;
  --border-active: #ffffff;
  --border-danger: rgba(239, 68, 68, 0.4);
  
  /* Typography Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  
  /* Functional Accents (Strictly Semantic / No Neon) */
  --accent-cyan: #38bdf8;
  --accent-blue: #2563eb;
  --accent-emerald: #10b981;
  --accent-rose: #ef4444;
  --accent-amber: #f59e0b;

  /* Typography Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  /* Geometry & Shadows */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;
  
  --shadow-glow: none;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5), 0 2px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body, html {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-core);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.5;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
}

/* Base App Layout */
#app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 72px 16px 120px 16px;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  transition: opacity 0.15s ease;
}

body.locked #app-container,
body.locked #spyder-main-header {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Global Top Header (Frosted Glass Obsidian) */
header.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 50000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  padding: 0 16px;
  background: rgba(14, 21, 36, 0.94);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  gap: 12px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: #ffffff;
  white-space: nowrap;
}

.header-slot-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  font-family: var(--font-mono);
}

.header-slot-pill:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Vault Sync Header Button & Responsive Helpers */
.vault-sync-btn {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  color: #38bdf8;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  height: 26px;
  margin-left: 6px;
  flex-shrink: 0;
  white-space: nowrap;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.vault-sync-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.45);
}

.vault-sync-btn.revoked {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #f87171 !important;
}

.vault-sync-btn.revoked:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
}

.vault-sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  flex-shrink: 0;
}

.vault-sync-btn.revoked .vault-sync-dot {
  background: #ef4444 !important;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.vault-sync-text {
  font-weight: 700;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
}

.sync-text-full,
.ws-name-full {
  display: inline;
}

.sync-text-short,
.ws-name-short {
  display: none;
}

.badge-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.dash-storage-badge {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: #38bdf8;
  font-family: var(--font-mono);
  letter-spacing: 0.2px;
  line-height: normal;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Quick OFF Killswitch Button */
.quick-off-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  margin-left: 2px;
  flex-shrink: 0;
}

.quick-off-btn:hover {
  background: var(--accent-rose);
  border-color: var(--accent-rose);
  color: #ffffff;
}

.quick-off-btn:active {
  transform: scale(0.95);
}

/* Burger Button */
.burger-btn {
  width: 38px;
  height: 38px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.burger-btn:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.burger-bar {
  width: 18px;
  height: 2px;
  background-color: var(--text-muted);
  border-radius: 1px;
}

.burger-btn:hover .burger-bar {
  background-color: #ffffff;
}

/* Header Action Buttons Container (Desktop, Tablet & Mobile) */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Responsive Desktop vs Mobile Navigation */
.show-on-desktop {
  display: inline-flex !important;
}

.hide-on-desktop {
  display: none !important;
}

@media (max-width: 1024px) {
  .show-on-desktop {
    display: none !important;
  }
  .hide-on-desktop {
    display: inline-flex !important;
  }
}

/* Burger Menu Drawer Overlay */
.burger-drawer-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  z-index: 20000;
  display: flex;
  justify-content: flex-end;
}

.burger-drawer-card {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  width: 340px;
  max-width: 85vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.8);
  overflow-y: auto;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: #fff;
  transition: all 0.15s ease;
}

.drawer-nav-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.drawer-nav-item .nav-icon {
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  font-weight: 800;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 6px;
  color: #38bdf8;
  flex-shrink: 0;
}

.drawer-nav-item .nav-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.drawer-nav-item .nav-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Vault Mode Pill */
.vault-mode-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
}

.vault-mode-pill.master {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.vault-mode-pill.decoy {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  animation: pulse-kf 2s infinite;
}

@keyframes pulse-kf {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Action Buttons (Platinum White Primary & Obsidian Glass Secondary) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  font-family: var(--font-sans);
}

.btn-primary {
  background: #f8fafc;
  color: #080c14;
  border: 1px solid #ffffff;
  font-weight: 700;
}
.btn-primary:hover {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.15);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.btn-danger:hover {
  background: var(--accent-rose);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Compact Micro-Status Bar */
.status-micro-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.status-micro-bar::-webkit-scrollbar {
  display: none;
}

.micro-stat-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
}

.micro-stat-item.clickable {
  cursor: pointer;
  border: 1px solid var(--border-strong);
  color: #f8fafc;
  transition: all 0.15s ease;
}

.micro-stat-item.clickable:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.micro-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.micro-dot.green {
  background: var(--accent-emerald);
}

/* Main Content Grid */
.main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* Settings Accordion Container */
.settings-accordion-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 100%;
}

.settings-acc-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.settings-acc-item[open] {
  border-color: var(--border-strong);
  background: var(--bg-surface);
}

.settings-acc-header {
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  background: var(--bg-surface-elevated);
}

.settings-acc-header::-webkit-details-marker {
  display: none;
}

.acc-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}

.settings-acc-body {
  padding: 14px 14px 18px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-inner-card {
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.settings-inner-card p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

/* License Dashboard Card Styling */
.license-dashboard-card {
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.8) 0%, rgba(30, 41, 59, 0.5) 100%) !important;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

.license-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.license-card-kicker {
  font-size: 10px;
  text-transform: uppercase;
  font-family: var(--font-mono);
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.license-card-tier-name {
  font-size: 15px;
  font-weight: 800;
  color: #38bdf8;
  margin-top: 2px;
  word-break: break-word;
}

.license-card-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #34d399;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.license-card-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 14px;
}

.license-card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  gap: 8px;
}

.license-row-label {
  color: #94a3b8;
  flex-shrink: 0;
  font-size: 11.5px;
}

.license-row-val {
  color: #f8fafc;
  font-weight: 600;
  text-align: right;
  word-break: break-word;
  font-size: 12px;
}

.license-key-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.license-card-actions {
  display: flex;
  gap: 8px;
}

.license-card-actions .btn {
  flex: 1;
  font-size: 12px;
  padding: 8px 12px;
  text-align: center;
  justify-content: center;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 600px) {
  .license-dashboard-card {
    padding: 12px 10px !important;
  }

  .license-card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .license-card-actions {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .license-card-actions .btn {
    width: 100% !important;
    padding: 9px 12px !important;
  }
}

/* Device Sub-Accordion & Mobile Device Cards */
.device-sub-acc {
  background: var(--bg-inset);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.device-sub-acc[open] {
  border-color: rgba(255, 255, 255, 0.2);
}

.device-sub-acc-header {
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  list-style: none;
  font-size: 12.5px;
}

.device-sub-acc-header::-webkit-details-marker {
  display: none;
}

.device-sub-acc-body {
  padding: 10px 12px 14px 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.device-slots-vertical-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.device-item-card {
  background: #0d1527;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.device-item-card.current {
  border-color: rgba(16, 185, 129, 0.45);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.1) 0%, rgba(13, 21, 39, 0.98) 100%);
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.08);
}

.device-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.device-avatar {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 9px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  font-weight: 800;
  color: #38bdf8;
  flex-shrink: 0;
}

.device-item-card.current .device-avatar {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.device-main-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.device-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.device-main-title {
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}

.device-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.device-status-badge.current {
  background: rgba(16, 185, 129, 0.22);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.device-status-badge.active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.device-platform-sub {
  font-size: 12.5px;
  color: #cbd5e1;
  font-weight: 500;
  line-height: 1.4;
}

.device-status-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #94a3b8;
  margin-top: 3px;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-status-line span {
  white-space: nowrap;
  flex-shrink: 0;
}

.device-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
  flex-shrink: 0;
}

.device-status-sep {
  color: rgba(255, 255, 255, 0.3);
  font-size: 11px;
}

.device-card-actions {
  display: flex;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.device-card-actions .btn {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  min-height: 36px;
  justify-content: center;
}

.free-slots-summary-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px dashed rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #cbd5e1;
  font-size: 12.5px;
  width: 100%;
  box-sizing: border-box;
}

/* Case List Section */
.section-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
  flex: 1;
}

.panel-title .dash-storage-badge {
  margin-left: auto;
  margin-right: 8px;
}

.panel-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.panel-header-actions .btn {
  min-width: 130px;
  justify-content: center;
  text-align: center;
}

@media (max-width: 600px) {
  .panel-title {
    width: 100%;
  }
  .panel-title .dash-storage-badge {
    margin-left: auto;
    margin-right: 0;
  }
  .panel-header-actions {
    width: 100%;
  }
  .panel-header-actions .btn {
    flex: 1 1 0px;
    width: 50%;
    min-width: 0;
    padding: 7px 6px;
    font-size: 11.5px;
  }
}

/* Cases Search & Filter Toolbar */
.cases-filter-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
  background: var(--bg-surface-elevated);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.cases-search-box {
  flex: 2;
  min-width: 200px;
  position: relative;
}

.cases-search-box input {
  padding-left: 32px;
  font-size: 12px;
  height: 36px;
  width: 100%;
}

.search-icon-hint {
  position: absolute;
  left: 10px;
  top: 9px;
  font-size: 13px;
  opacity: 0.5;
  pointer-events: none;
}

.cases-filter-selects {
  display: flex;
  gap: 8px;
  flex: 2;
}

.cases-filter-selects select {
  flex: 1;
  font-size: 12px;
  height: 36px;
}

/* Case Cards */
.case-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.case-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

@media (max-width: 640px) {
  .case-card {
    padding: 12px 14px;
  }
}

.case-card:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-strong);
}

.case-card.sensitive, .case-card.high {
  border-left: 3px solid var(--accent-rose);
}

.case-card.standard {
  border-left: 3px solid var(--accent-emerald);
}

/* 2-Row Modern Forensic Header */
.case-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  width: 100%;
}

.case-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  flex-wrap: nowrap;
}

.case-meta-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-width: 0;
}

.case-id-badge {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.case-ws-badge {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.case-status-pill {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.3px;
  line-height: normal;
  display: inline-flex;
  align-items: center;
}

.case-status-pill.danger {
  background: rgba(244, 63, 94, 0.12);
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.25);
}

.case-status-pill.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.25);
}

.case-status-pill.muted {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.25);
}

.tier-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.tier-badge.sensitive, .tier-badge.high {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.tier-badge.standard {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.case-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.accordion-arrow {
  font-size: 9px;
  color: #38bdf8;
  display: inline-block;
  margin-top: 3px;
  transition: transform 0.2s ease;
  user-select: none;
}

.accordion-arrow.open {
  transform: rotate(90deg);
}

.case-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  word-break: break-word;
  flex: 1;
}

.case-submeta-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.case-status-date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.case-date-text {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.case-metrics-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

.case-summary-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #94a3b8;
  font-family: var(--font-mono);
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.summary-sep {
  color: #475569;
  font-size: 9px;
}

.case-toggle-hint {
  color: #38bdf8;
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
  cursor: pointer;
  transition: color 0.15s ease;
}

.case-toggle-hint:hover {
  color: #7dd3fc;
}

.case-section-empty-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  color: var(--text-muted);
}

.case-details-drawer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Unified Case Section Container */
.case-section-box {
  background: rgba(10, 16, 28, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  width: 100%;
  box-sizing: border-box;
}

.case-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.case-section-title {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono, monospace);
}

.case-section-title.cyan { color: #38bdf8; }
.case-section-title.amber { color: #fbbf24; }
.case-section-title.emerald { color: #34d399; }
.case-section-title.rose { color: #f43f5e; }

.case-section-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Sachverhalt & Vermerke */
.case-desc-box {
  background: rgba(10, 16, 28, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  width: 100%;
  box-sizing: border-box;
}

.case-desc-label {
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #94a3b8;
  font-family: var(--font-mono, monospace);
  margin-bottom: 5px;
}

.case-desc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}

.case-desc-header:hover .case-desc-label {
  color: #fff;
}

.desc-accordion-arrow {
  font-size: 9px;
  color: var(--accent-cyan);
  transition: transform 0.15s ease;
  display: inline-block;
  width: 10px;
}

.case-desc-toggle-hint {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.case-desc-text {
  line-height: 1.55;
  color: #f8fafc;
  font-size: 13px;
  word-break: break-word;
  white-space: pre-line;
}

/* Markdown Table of Contents & Sections */
.desc-toc-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 10px;
}
.desc-toc-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
}
.desc-toc-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.desc-toc-title {
  font-size: 10px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
}
.desc-toc-count {
  font-size: 9px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 8px;
  font-family: var(--font-mono, monospace);
}
.desc-toc-actions {
  display: flex;
  gap: 6px;
  width: 100%;
}
.desc-toc-btn {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.desc-toc-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
}
.desc-toc-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.desc-toc-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #cbd5e1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: background 0.15s ease, color 0.15s ease;
  text-decoration: none;
  width: fit-content;
}
.desc-toc-item:hover {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
}
.desc-toc-item.level-2 {
  padding-left: 14px;
  font-size: 11px;
  color: #94a3b8;
}
.desc-toc-item.level-3 {
  padding-left: 26px;
  font-size: 10.5px;
  color: #64748b;
}

/* Collapsible Markdown Sections */
.desc-sections-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.desc-section {
  background: rgba(14, 21, 36, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}
.desc-section.level-2 {
  margin-left: 10px;
  border-left: 2px solid rgba(56, 189, 248, 0.3);
}
.desc-section.level-3 {
  margin-left: 20px;
  border-left: 2px solid rgba(148, 163, 184, 0.3);
}
.desc-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.02);
  transition: background 0.15s ease;
}
.desc-section-header:hover {
  background: rgba(255, 255, 255, 0.05);
}
.desc-sec-arrow {
  font-size: 9px;
  color: var(--accent-cyan);
  display: inline-block;
  width: 10px;
  transition: transform 0.15s ease;
}
.desc-sec-title {
  font-weight: 700;
  font-size: 12px;
  color: #f8fafc;
  flex: 1;
  word-break: break-word;
}
.desc-sec-title.level-2 {
  font-weight: 600;
  font-size: 11.5px;
  color: #e2e8f0;
}
.desc-sec-title.level-3 {
  font-weight: 500;
  font-size: 11px;
  color: #cbd5e1;
}
.desc-sec-words {
  font-size: 8.5px;
  color: var(--text-faint);
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.2px;
}
.desc-section-body {
  padding: 8px 10px 10px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(5, 8, 14, 0.4);
}

/* Entities & Actors */
.case-ids-box {
  width: 100%;
  box-sizing: border-box;
  font-size: 12px;
  color: var(--text-muted);
}

.case-id-tags {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.entity-item-card {
  background: rgba(22, 32, 52, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  box-sizing: border-box;
}

.entity-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.entity-type-badge {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: var(--font-mono, monospace);
}

.entity-name {
  color: #fff;
  font-size: 12.5px;
  word-break: break-word;
}

.entity-role-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  color: #cbd5e1;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.entity-role-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #64748b;
  font-family: var(--font-mono, monospace);
  flex-shrink: 0;
}

.entity-role-val {
  color: #f1f5f9;
  font-weight: 500;
  word-break: break-word;
}

.id-tag {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: #f8fafc;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  word-break: break-all;
}

/* Timeline & Chronology */
.timeline-vertical-flow {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  padding-left: 12px;
  border-left: 2px solid rgba(245, 158, 11, 0.35);
  margin-left: 6px;
  margin-top: 4px;
}

.timeline-event-card {
  background: rgba(22, 32, 52, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 11.5px;
  position: relative;
}

.timeline-event-dot {
  position: absolute;
  left: -17px;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid #080c14;
}

.timeline-event-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 2px;
}

.timeline-event-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.timeline-event-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  font-family: var(--font-mono, monospace);
}

.timeline-event-title {
  color: #fff;
  font-size: 12px;
  word-break: break-word;
}

.timeline-event-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.timeline-event-time {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
}

.timeline-event-actor {
  font-size: 10.5px;
  color: #38bdf8;
  margin-top: 2px;
}

.timeline-event-desc {
  color: #cbd5e1;
  font-size: 11px;
  line-height: 1.4;
  margin-top: 2px;
  word-break: break-word;
}

/* Documents & Evidence Vault */
.case-docs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.case-doc-card {
  background: rgba(22, 32, 52, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.case-doc-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.case-doc-icon {
  font-size: 10px;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  flex-shrink: 0;
}

.case-doc-details {
  overflow: hidden;
  min-width: 0;
}

.case-doc-name {
  color: #fff;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.case-doc-meta {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.case-doc-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* Chat Archive Inset */
.case-chat-archive-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.case-chat-msg {
  background: rgba(22, 32, 52, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
}

/* Action Buttons */
.case-actions-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 8px;
  margin-top: 10px;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 480px) {
  .case-actions-bar {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .case-actions-bar .btn-danger {
    grid-column: span 2;
  }
  .case-section-empty-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 8px;
  }
  .case-section-empty-bar .case-section-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }
  .case-section-empty-bar .case-section-actions > button {
    flex: 1 1 0px;
    width: 50%;
    min-width: 0;
    min-height: 32px;
    justify-content: center;
    text-align: center;
  }
  .case-section-empty-bar > button {
    width: 100%;
    min-height: 32px;
    justify-content: center;
  }
}

/* Sidebar Tool Panels */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tool-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.tool-box h4 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-box p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* Panic Lock Overlay */
#panic-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 999999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
}

#panic-overlay.active {
  display: flex;
}

/* Modal Dialogues */
.modal-backdrop {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(4, 6, 10, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 999999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 12px 100px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.modal-card {
  background: #0e1524;
  border: 1px solid #24344d;
  border-radius: 8px;
  width: 100%;
  max-width: 580px;
  padding: 20px 16px 36px 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85);
  margin: 10px auto 60px auto;
  flex-shrink: 0;
  color: #f8fafc;
  user-select: text;
  -webkit-user-select: text;
}

/* Hide APK download links and cards if inside installed Android App or Standalone PWA */
@media all and (display-mode: standalone) {
  .apk-download-link,
  .apk-download-card {
    display: none !important;
  }
}

body.is-standalone-app .apk-download-link,
body.is-standalone-app .apk-download-card {
  display: none !important;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: all 0.15s ease;
  user-select: text;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.seed-box {
  background: var(--bg-inset);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #f8fafc;
  line-height: 1.8;
  word-break: break-all;
  user-select: text;
  margin: 10px 0;
}

.cert-dropzone {
  border: 2px dashed rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.05);
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cert-dropzone:hover, .cert-dropzone.dragover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  transform: scale(1.01);
}

.alert-banner {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.alert-banner.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.alert-banner.info {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   MULTI-TENANT WORKSPACE & TEAM SELECTOR STYLES
   ========================================================================== */

.workspace-selector-box {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: 14px;
}

.ws-switcher-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: #fff;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  max-width: 240px;
  letter-spacing: 0.2px;
  box-sizing: border-box;
}

.ws-switcher-btn:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

#ws-current-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-arrow {
  font-size: 9px;
  opacity: 0.7;
  margin-left: 2px;
}

.ws-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  width: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  padding: 6px;
  z-index: 50005;
}

.ws-dropdown-header {
  font-size: 10px;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.8px;
  padding: 6px 10px;
  text-transform: uppercase;
}

.ws-options-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ws-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
  color: #cbd5e1;
  font-size: 12px;
  transition: all 0.15s ease;
}

.ws-option-item:hover {
  background: var(--bg-surface-elevated);
  color: #fff;
}

.ws-option-item.active {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
  color: #ffffff;
  font-weight: 700;
}

.ws-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}

.ws-action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.ws-action-btn:hover {
  background: var(--bg-surface-elevated);
  color: #fff;
}

/* Team Management Cards */
.teams-vertical-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.team-card-box {
  background: var(--bg-inset);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.team-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.team-card-title {
  font-weight: 700;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.team-member-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  margin: 2px 4px 2px 0;
}

/* ==========================================================================
   MOBILE, FOLDABLE & TABLET RESPONSIVE ADAPTATIONS (<= 1024px or Touch-Screen)
   ========================================================================== */
@media (max-width: 1024px), (pointer: coarse) and (hover: none) {
  .hide-on-mobile,
  .hide-on-touch {
    display: none !important;
  }
}

.is-touch-device .hide-on-mobile,
.is-touch-device .hide-on-touch,
body.is-touch-device .hide-on-mobile,
body.is-touch-device .hide-on-touch {
  display: none !important;
}

@media (max-width: 1024px) {

  #app-container {
    padding: 60px 10px 80px 10px;
  }

  header.app-header {
    height: 50px;
    padding: 0 8px;
    gap: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    overflow: visible;
  }

  .sync-text-full,
  .ws-name-full {
    display: none !important;
  }

  .sync-text-short,
  .ws-name-short {
    display: inline !important;
  }

  .vault-sync-btn {
    height: 24px;
    padding: 1px 6px;
    margin-left: 2px;
    gap: 4px;
    font-size: 9.5px;
  }

  .vault-sync-dot {
    width: 5px;
    height: 5px;
  }

  .brand-badge {
    gap: 5px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }

  .brand-badge img {
    width: 22px !important;
    height: 22px !important;
    border-radius: 5px;
  }

  .brand-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.6px;
  }

  .quick-off-btn {
    display: none !important; /* Avoid touch mis-clicks & reclaim 30px */
  }

  #vault-mode-indicator {
    display: none !important;
  }

  .workspace-selector-box {
    margin: 0 !important;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 140px;
    display: flex;
    justify-content: center;
  }

  .ws-switcher-btn {
    height: 28px;
    padding: 0 7px;
    font-size: 10.5px;
    gap: 4px;
    width: auto;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }

  #ws-current-icon {
    font-size: 12px;
    flex-shrink: 0;
  }

  #ws-current-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
    text-align: left;
    font-size: 11px;
  }

  .ws-arrow {
    font-size: 8px;
    flex-shrink: 0;
    margin-left: 1px;
  }

  .ws-dropdown-menu {
    width: 270px;
    max-width: 90vw;
    right: 0;
    left: auto;
  }

  .header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0;
  }

  #header-settings-btn {
    display: none !important;
  }

  .burger-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    flex-shrink: 0;
  }

  .burger-bar {
    width: 16px;
  }

  /* Cases Toolbar Mobile */
  .cases-filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 10px;
    gap: 8px;
  }

  .cases-search-box {
    width: 100%;
    min-width: 0;
  }

  .cases-filter-selects {
    width: 100%;
    gap: 6px;
  }

  .cases-filter-selects select {
    font-size: 11px;
    height: 34px;
    min-width: 0;
    flex: 1;
  }

  .panel-header {
    flex-wrap: wrap;
    gap: 10px;
  }

  .modal-backdrop {
    padding: 12px 6px 100px 6px !important;
    align-items: flex-start !important;
  }

  .modal-card {
    padding: 16px 12px 32px 12px;
    margin: 8px auto 60px auto;
    width: 98% !important;
    max-width: 100% !important;
  }

  .settings-acc-header, .device-sub-acc-header {
    padding: 10px 10px;
  }

  .settings-acc-body, .device-sub-acc-body {
    padding: 8px 6px 12px 6px;
  }

  .settings-inner-card {
    padding: 10px 8px;
  }

  .device-item-card {
    padding: 12px;
    gap: 10px;
  }
}

@media (max-width: 380px) {
  header.app-header {
    padding: 0 5px;
    gap: 4px;
    overflow: visible;
  }

  .brand-title {
    font-size: 11.5px;
    letter-spacing: 0.3px;
  }

  .vault-sync-btn {
    height: 22px;
    padding: 1px 4px;
    gap: 3px;
    margin-left: 1px;
  }

  .workspace-selector-box {
    max-width: 115px;
  }

  .ws-switcher-btn {
    height: 26px;
    padding: 0 4px;
    font-size: 9.5px;
  }

  .burger-btn {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
  }
}

/* ==========================================================================
   INTELLIGENCE RELATIONSHIP GRAPH MODAL & CANVAS STYLES
   ========================================================================== */
#graph-modal:not(.hidden) {
  padding: 0 !important;
  margin: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
  display: flex !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  z-index: 60000 !important;
}

#graph-modal.hidden {
  display: none !important;
}

.graph-modal-card {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  overflow: hidden !important;
  background: var(--bg-core);
  box-shadow: none !important;
}

.graph-top-toolbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 10;
  height: 48px;
  box-sizing: border-box;
  overflow: hidden;
}

.graph-filter-btn {
  font-size: 11.5px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  flex-shrink: 0;
  font-weight: 600;
}

.graph-title-box {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.graph-title-short {
  display: none;
}

.graph-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.graph-center-btn {
  font-size: 11px;
  height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.graph-close-btn {
  height: 32px;
  width: 32px;
  min-width: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Graph Sidebar Drawer */
.graph-sidebar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 320px;
  max-width: 85vw;
  background: rgba(14, 21, 36, 0.97);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-strong);
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.85);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.graph-sidebar.open {
  transform: translateX(0);
}

.graph-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(8, 12, 20, 0.8);
}

.graph-sidebar-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.graph-canvas-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at center, #0e1524 0%, #05080f 100%);
  cursor: grab;
}

.graph-canvas-wrapper.grabbing {
  cursor: grabbing;
}

.graph-hud-controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(14, 21, 36, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px;
  z-index: 20;
}

.graph-hud-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.graph-hud-btn:hover {
  background: var(--bg-surface-hover);
  border-color: #38bdf8;
  color: #38bdf8;
}

.graph-inspector-panel {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 16px;
  right: 16px;
  width: 320px;
  max-width: calc(100vw - 40px);
  max-height: calc(100% - 32px);
  background: rgba(14, 21, 36, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 25;
  overflow: hidden;
  animation: slideInRight 0.2s ease-out;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 900px) {
  .graph-top-toolbar {
    padding: 6px 10px;
    gap: 6px;
    overflow: hidden;
  }

  .graph-inspector-panel {
    top: auto;
    bottom: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    max-height: 48vh;
    padding: 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.85);
    animation: slideUpBottom 0.2s ease-out;
  }

  @keyframes slideUpBottom {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

.graph-legend-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

/* ==========================================================================
   FORENSIC DOSSIER & PDF EXPORT STYLES
   ========================================================================== */
.dossier-paper {
  background: #0d1322;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 32px 28px;
  color: #f8fafc;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  position: relative;
}

.dossier-header-box {
  border-bottom: 2px solid #3b82f6;
  padding-bottom: 16px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.dossier-shield-box {
  background: rgba(192, 132, 252, 0.08);
  border: 1px solid rgba(192, 132, 252, 0.3);
  border-left: 4px solid #c084fc;
  border-radius: 4px;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 11.5px;
  color: #e2e8f0;
}

.dossier-section {
  margin-bottom: 22px;
}

.dossier-section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dossier-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 6px;
}

.dossier-table th {
  text-align: left;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
}

.dossier-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.dossier-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 12px;
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: monospace;
  font-size: 10px;
  color: #64748b;
}

/* Watermark Overlay */
.dossier-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  font-size: 44px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.03);
  letter-spacing: 8px;
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
  z-index: 1;
}

/* ==========================================================================
   PRINT / PDF MEDIA ENGINE
   ========================================================================== */
@media print {
  /* Hide all background UI, modals backdrop, bars and buttons */
  body * {
    visibility: hidden;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  /* Make only the Dossier Document Preview visible and fill the page */
  #dossier-export-modal,
  #dossier-document-preview,
  #dossier-document-preview * {
    visibility: visible;
  }

  #dossier-export-modal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100% !important;
    height: auto !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }

  .modal-card,
  #dossier-preview-scroll-container {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }

  .modal-header,
  .dossier-options-bar {
    display: none !important;
  }

  .dossier-paper {
    background: #ffffff !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 11pt;
  }

  .dossier-header-box {
    border-bottom: 2pt solid #1e293b !important;
  }

  .dossier-shield-box {
    background: #f8fafc !important;
    border: 1pt solid #cbd5e1 !important;
    border-left: 4pt solid #7c3aed !important;
    color: #0f172a !important;
  }

  .dossier-section-title {
    color: #334155 !important;
    border-bottom: 1pt solid #cbd5e1 !important;
  }

  .dossier-table th {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    border-bottom: 1.5pt solid #94a3b8 !important;
  }

  .dossier-table td {
    color: #0f172a !important;
    border-bottom: 0.5pt solid #e2e8f0 !important;
  }

  .dossier-watermark {
    color: rgba(0, 0, 0, 0.04) !important;
    font-size: 52pt !important;
  }

  .dossier-footer {
    border-top: 1pt solid #cbd5e1 !important;
    color: #64748b !important;
  }
}

/* ==========================================================================
   PWA & STANDALONE APP SPECIFIC OPTIMIZATIONS
   ========================================================================== */
@media all and (display-mode: standalone), (display-mode: fullscreen) {
  .hide-in-pwa {
    display: none !important;
  }
}

body.is-standalone-app .hide-in-pwa {
  display: none !important;
}

/* ==========================================================================
   SETTINGS & OPSEC CENTER (DEDICATED FULL-PAGE VIEW)
   ========================================================================== */

.settings-page-container {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  animation: fadeIn 0.15s ease-out;
}

.settings-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  flex-wrap: wrap;
  gap: 12px;
}

.settings-mobile-nav {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: var(--shadow-card);
}

.settings-mobile-nav-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.settings-mobile-select {
  width: 100%;
  background: var(--bg-surface-elevated);
  color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
}

.settings-mobile-select:focus {
  border-color: var(--accent-cyan);
}

.settings-page-grid {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 18px;
  align-items: start;
}

.settings-nav-sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px;
  position: sticky;
  top: 72px;
}

.settings-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.settings-nav-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.settings-nav-btn.active {
  background: var(--bg-surface-elevated);
  color: #ffffff;
  border-color: var(--accent-cyan);
  box-shadow: inset 3px 0 0 var(--accent-cyan);
  font-weight: 600;
}

.settings-nav-btn .snav-icon {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 6px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.settings-nav-btn.active .snav-icon {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
}

.settings-nav-btn .snav-info {
  min-width: 0;
  flex: 1;
}

.settings-nav-btn .snav-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}

.settings-nav-btn .snav-sub {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.2;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-nav-btn.active .snav-sub {
  color: var(--text-muted);
}

.settings-tab-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-card);
  min-height: 520px;
}

.settings-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-tab-pane.hidden {
  display: none !important;
}

.settings-pane-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  margin-bottom: 4px;
}

.settings-pane-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-pane-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 4px;
}

/* Responsive Settings Grid & Action Rows */
.settings-form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
  width: 100%;
}

.settings-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.settings-btn-row .btn {
  flex: 1;
  min-width: 140px;
  text-align: center;
  justify-content: center;
}

.settings-card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 1024px) {
  .settings-mobile-nav {
    display: block !important;
    margin-bottom: 12px;
  }
  .settings-page-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .settings-nav-sidebar {
    display: none !important;
  }
  .settings-tab-content {
    padding: 16px;
  }
}

@media (max-width: 600px) {
  .settings-tab-content {
    padding: 12px 10px !important;
  }

  .settings-form-grid-2col {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .settings-btn-row {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .settings-btn-row .btn {
    width: 100% !important;
    min-width: 100% !important;
    flex: none !important;
    padding: 10px 14px !important;
  }

  .settings-card-header-flex {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
  }

  .hide-on-mobile {
    display: none !important;
  }

  .burger-drawer-backdrop {
    justify-content: stretch;
  }

  .burger-drawer-card {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    border-left: none !important;
    border-radius: 0 !important;
    padding: 16px 16px 28px 16px !important;
    box-shadow: none !important;
  }

  /* Graph Mobile Full-Width Adaptations */
  .graph-top-toolbar {
    padding: 6px 10px !important;
    height: 46px !important;
    overflow: hidden !important;
  }

  .graph-filter-btn {
    padding: 0 8px !important;
    font-size: 11px !important;
  }

  .graph-filter-extra {
    display: none !important;
  }

  .graph-title-full {
    display: none !important;
  }

  .graph-title-short {
    display: inline !important;
    font-size: 12px !important;
  }

  .graph-center-label {
    display: none !important;
  }

  .graph-center-btn {
    width: 32px !important;
    min-width: 32px !important;
    padding: 0 !important;
    justify-content: center !important;
    font-size: 14px !important;
  }

  .graph-sidebar {
    width: 100vw !important;
    max-width: 100vw !important;
    border-right: none !important;
  }

  /* Case Drawer Mobile Optimizations */
  .case-card {
    padding: 10px 12px !important;
  }
  .case-details-drawer {
    margin-top: 10px !important;
    padding-top: 10px !important;
    gap: 8px !important;
  }
  .case-section-box,
  .case-desc-box {
    padding: 8px 10px !important;
  }
  .entity-item-card,
  .timeline-event-card,
  .case-doc-card {
    padding: 6px 8px !important;
  }
  .timeline-event-dot {
    left: -15px !important;
  }
}

/* ==========================================================================
   Universal Info-Tip & Popover Tooltips
   ========================================================================== */
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  transition: all 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}

.info-tip:hover, .info-tip:focus, .info-tip.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #ffffff;
}

.info-tip .tip-popup {
  visibility: hidden;
  opacity: 0;
  width: 260px;
  background: #0d1527;
  color: #f8fafc;
  text-align: left;
  border-radius: 6px;
  padding: 10px 12px;
  position: absolute;
  z-index: 10000;
  bottom: 135%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.45;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(56, 189, 248, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.3);
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
  pointer-events: none;
  white-space: normal !important;
}

.info-tip .tip-popup::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #0d1527 transparent transparent transparent;
}

.info-tip.tip-left .tip-popup {
  left: auto;
  right: 0;
  transform: none;
}
.info-tip.tip-left .tip-popup::after {
  left: auto;
  right: 8px;
}

.info-tip:hover .tip-popup,
.info-tip:focus .tip-popup,
.info-tip.active .tip-popup {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* Floating Notification Toast */
.spyder-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #f8fafc;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8), 0 0 15px rgba(56, 189, 248, 0.2);
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 90vw;
  pointer-events: none;
}

.spyder-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ==========================================================================
   Zero-Knowledge Component Inspector & In-App Feedback System
   ========================================================================== */
@keyframes spyderHighlightPulse {
  0% {
    outline: 3px solid rgba(56, 189, 248, 0.95);
    box-shadow: 0 0 25px rgba(56, 189, 248, 0.9);
    transform: scale(1.008);
  }
  50% {
    outline: 3px solid rgba(56, 189, 248, 1);
    box-shadow: 0 0 35px rgba(56, 189, 248, 1);
  }
  100% {
    outline: 2px solid rgba(56, 189, 248, 0);
    box-shadow: none;
    transform: scale(1);
  }
}

.spyder-inspect-glow {
  outline: 3px solid #38bdf8 !important;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.8) !important;
  animation: spyderHighlightPulse 1.2s ease-out forwards !important;
  transition: all 0.2s ease !important;
}

#spyder-feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#spyder-feedback-modal.hidden {
  display: none !important;
}

.feedback-modal-card {
  background: #080d1a;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  padding: 22px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.9), 0 0 25px rgba(56, 189, 248, 0.15);
  animation: modalFadeIn 0.2s ease-out;
  color: #f8fafc;
}

.feedback-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.feedback-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.feedback-id-tag {
  font-family: var(--font-mono, monospace);
  font-weight: 800;
  color: #38bdf8;
  font-size: 12px;
  background: rgba(56, 189, 248, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
}

.feedback-name-tag {
  font-size: 12.5px;
  font-weight: 600;
  color: #e2e8f0;
}

.feedback-category-group {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.feedback-cat-btn {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #1e293b;
  background: #0f172a;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.feedback-cat-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
}

.feedback-meta-note {
  font-size: 11px;
  color: #64748b;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
