/* ==========================================================================
   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;
  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;
}

.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);
}

/* 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: 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;
}

/* 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: 18px;
}

.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);
}

.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;
}

/* 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: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
}

.device-item-card.current {
  border-left: 3px solid var(--accent-emerald);
  background: rgba(16, 185, 129, 0.04);
}

.device-card-row-top {
  display: flex;
  align-items: flex-start;
  width: 100%;
}

.device-title-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

.device-icon {
  font-size: 18px;
  line-height: 1;
  margin-top: 2px;
  flex-shrink: 0;
}

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

.device-name {
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  line-height: 1.3;
  word-break: break-word;
}

.device-status-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.device-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.3px;
  width: fit-content;
}

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

.device-status-badge.active {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.device-card-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: #94a3b8;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

.meta-tag {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.dev-action-btn {
  width: 100%;
  margin-top: 2px;
  font-size: 11.5px;
  padding: 7px 10px;
  justify-content: center;
}

.free-slots-summary-box {
  background: var(--bg-inset);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: #64748b;
  font-size: 12px;
  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: 8px;
}

/* 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: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}

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

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

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

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

.tier-badge.sensitive {
  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-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.case-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  word-break: break-word;
}

.accordion-arrow {
  font-size: 10px;
  color: var(--text-muted);
  display: inline-block;
  transition: transform 0.2s ease;
}

.case-summary-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 6px;
  cursor: pointer;
}

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

.case-desc-box {
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #cbd5e1;
  word-break: break-word;
}

.case-ids-box {
  font-size: 12px;
  color: var(--text-muted);
}

.case-id-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.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;
}

.case-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  justify-content: flex-end;
}

/* 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-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 ADAPTATIONS (<= 600px)
   ========================================================================== */
@media (max-width: 600px) {
  #app-container {
    padding: 58px 10px 80px 10px;
  }

  header.app-header {
    height: 52px;
    padding: 0 10px;
    gap: 6px;
  }

  .brand-badge {
    gap: 6px;
    flex-shrink: 0;
  }

  .brand-badge img {
    width: 24px !important;
    height: 24px !important;
  }

  .brand-title {
    font-size: 14px;
    letter-spacing: 1px;
  }

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

  .workspace-selector-box {
    margin-right: 6px;
    flex-shrink: 1;
    min-width: 0;
  }

  .ws-switcher-btn {
    height: 36px;
    padding: 0 8px;
    font-size: 11px;
    max-width: 140px;
    gap: 4px;
  }

  .ws-dropdown-menu {
    width: 260px;
    right: 0;
  }

  .burger-btn {
    width: 36px;
    height: 36px;
  }

  .modal-backdrop {
    padding: 58px 10px 80px 10px;
  }

  .status-micro-bar {
    padding: 4px 8px;
    gap: 6px;
    margin-bottom: 12px;
  }

  .micro-stat-item {
    font-size: 11px;
    padding: 2px 7px;
  }

  .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: 8px 10px;
    gap: 6px;
  }

  .quick-off-btn {
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 380px) {
  .brand-title {
    font-size: 13px;
    letter-spacing: 0.5px;
  }

  .ws-switcher-btn {
    max-width: 105px;
    padding: 0 6px;
    font-size: 10px;
  }

  .workspace-selector-box {
    margin-right: 4px;
  }
}

/* ==========================================================================
   INTELLIGENCE RELATIONSHIP GRAPH MODAL & CANVAS STYLES
   ========================================================================== */
.graph-modal-card {
  max-width: 96vw;
  width: 96vw;
  height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  overflow: hidden;
  background: var(--bg-core);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(56, 189, 248, 0.1);
}

.graph-top-toolbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  z-index: 10;
}

.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 {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 320px;
  max-width: calc(100vw - 40px);
  max-height: calc(100% - 32px);
  overflow-y: auto;
  background: rgba(14, 21, 36, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 25;
  animation: slideInRight 0.2s ease-out;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(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;
}
