/* Bowtie RISK Assessment Platform - Professional Theme */
:root {
  --bg-dark-nav: #0b1329;
  --bg-dark-surface: #111c38;
  --border-dark: #1e293b;
  --text-light: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #0f172a;
  --bg-canvas: #f8fafc;
  --bg-sidebar: #ffffff;
  --border-light: #e2e8f0;
  --primary-blue: #2563eb;
  --danger-red: #e00000;
  --accent-orange: #f97316;
  --accent-yellow: #eab308;
  --accent-slate: #334155;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-dark-nav);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: hidden;
  background-color: var(--bg-dark-nav);
}

/* ==========================================================================
   TOP NAVIGATION BAR
   ========================================================================== */
.top-nav {
  height: calc(56px + env(safe-area-inset-top, 0px));
  min-height: calc(56px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background-color: var(--bg-dark-nav);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: max(16px, env(safe-area-inset-left, 16px));
  padding-right: max(16px, env(safe-area-inset-right, 16px));
  border-bottom: 1px solid var(--border-dark);
  z-index: 100;
  user-select: none;
  box-sizing: border-box;
}

.nav-left, .nav-center, .nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  user-select: none;
}
.brand-logo:hover {
  opacity: 0.85;
}
.brand-logo:active {
  transform: scale(0.98);
}
.brand-logo:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 4px;
}

.diagram-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

.nav-select {
  background-color: #17233f;
  color: #f1f5f9;
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.nav-select:focus {
  border-color: var(--primary-blue);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  background: transparent;
  color: var(--text-light);
}

.btn-primary {
  background-color: var(--primary-blue);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-danger {
  background-color: #dc2626;
  color: #ffffff;
}
.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-outline {
  border-color: #334155;
  color: #cbd5e1;
}
.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.btn-secondary {
  background-color: #e2e8f0;
  color: #334155;
}
.btn-secondary:hover {
  background-color: #cbd5e1;
}

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

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
}

.btn-icon {
  padding: 6px;
  border-radius: 6px;
  color: #94a3b8;
}
.btn-icon:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-nav {
  padding: 6px 10px;
  color: #cbd5e1;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-nav:hover {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}
.btn-nav.active {
  background-color: rgba(37, 99, 235, 0.35) !important;
  color: #93c5fd !important;
  border-color: rgba(96, 165, 250, 0.6) !important;
}

.btn-profile {
  padding: 4px 10px 4px 6px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
}
.btn-profile:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #e00000);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.user-email-label {
  font-size: 12px;
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  background-color: #3b82f6;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 2px;
}

.zoom-controls {
  background-color: #17233f;
  border: 1px solid var(--border-dark);
  border-radius: 6px;
  padding: 2px;
  display: flex;
  align-items: center;
}

.zoom-indicator {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #94a3b8;
  padding: 0 8px;
  min-width: 44px;
  text-align: center;
}

.save-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #94a3b8;
  padding: 4px 6px;
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge-read-only {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.3);
  letter-spacing: 0.3px;
  user-select: none;
  flex-shrink: 0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.status-dot.saved {
  background-color: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}
.status-dot.saving {
  background-color: #f59e0b;
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* Dropdown Menu */
.dropdown {
  position: relative;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  min-width: 210px;
  z-index: 10001;
  padding: 6px 0;
}
.dropdown-menu.show {
  display: block;
}
.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  color: #334155;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
}
.dropdown-item:hover {
  background-color: #f1f5f9;
  color: var(--primary-blue);
}
.dropdown-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 4px 0;
}

/* ==========================================================================
   WORKSPACE LAYOUT (3-PANE)
   ========================================================================== */
.workspace-layout {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 100vw;
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  position: relative;
  overflow: hidden;
}

.sidebar-pane {
  background-color: var(--bg-sidebar);
  border-color: var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: width 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}

.left-pane {
  width: 290px;
  min-width: 290px;
  border-right: 1px solid var(--border-light);
}

.right-pane {
  width: 320px;
  min-width: 320px;
  border-left: 1px solid var(--border-light);
}

.sidebar-pane.collapsed {
  width: 0 !important;
  min-width: 0 !important;
  border: none;
}

.pane-header {
  height: 44px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background-color: #f8fafc;
}

.pane-tabs {
  display: flex;
  gap: 4px;
}
.pane-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.pane-tab:hover {
  color: #0f172a;
}
.pane-tab.active {
  background-color: #ffffff;
  color: var(--primary-blue);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.btn-toggle-pane {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
}
.btn-toggle-pane:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.pane-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.tab-content {
  display: none;
}
.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* Tree Component */
.tree-search-bar {
  margin-bottom: 10px;
}
.tree-search-bar input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 12px;
  outline: none;
}
.tree-search-bar input:focus {
  border-color: var(--primary-blue);
}

.tree-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.tree-item {
  display: flex;
  flex-direction: column;
}

.tree-node-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  color: #334155;
  transition: background-color 0.1s;
}
.tree-node-row:hover {
  background-color: #f1f5f9;
}
.tree-node-row.active {
  background-color: #eff6ff;
  color: var(--primary-blue);
  font-weight: 600;
}

.tree-toggle {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #94a3b8;
  cursor: pointer;
}

.tree-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tree-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-badge {
  font-size: 10px;
  color: #94a3b8;
  background-color: #f1f5f9;
  padding: 1px 4px;
  border-radius: 3px;
}

.tree-children {
  margin-left: 16px;
  border-left: 1px dashed #cbd5e1;
  padding-left: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Master Elements List */
.library-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.global-elements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.global-elem-card {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
  background-color: #ffffff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.global-elem-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.global-elem-card-title {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  justify-content: space-between;
}
.global-elem-card-meta {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

/* ==========================================================================
   CANVAS VIEWPORT & STAGE
   ========================================================================== */
.canvas-viewport {
  flex: 1;
  height: 100%;
  position: relative;
  background-color: #f8fafc;
  overflow: hidden;
  cursor: grab;
}

.canvas-viewport.panning {
  cursor: grabbing;
}

.canvas-stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  will-change: transform;
}

.grid-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible !important;
}

.connections-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 5000px;
  height: 5000px;
  pointer-events: none;
  z-index: 1;
  overflow: visible !important;
}

svg.connections-layer {
  overflow: visible !important;
}

.nodes-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 5000px;
  height: 5000px;
  z-index: 2;
  pointer-events: none; /* children enable pointer events */
  overflow: visible !important;
}

/* Floating Toolbar */
.canvas-floating-toolbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 5px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 30;
  user-select: none;
  max-width: calc(100vw - 16px);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: none;
}
.canvas-floating-toolbar::-webkit-scrollbar {
  display: none;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  background-color: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.tool-btn:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.tool-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.tool-divider {
  width: 1px;
  height: 18px;
  background-color: var(--border-light);
  flex-shrink: 0;
}

.tool-info {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-tool-align, .btn-line-up {
  color: #2563eb;
  border-color: #bfdbfe;
  background-color: #eff6ff;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-tool-align:hover, .btn-line-up:hover {
  background-color: #dbeafe;
  border-color: #3b82f6;
  color: #1d4ed8;
}

.btn-tool-order {
  color: #7c3aed;
  border-color: #ddd6fe;
  background-color: #f5f3ff;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-tool-order:hover {
  background-color: #ede9fe;
  border-color: #8b5cf6;
  color: #6d28d9;
}

.canvas-hud {
  position: absolute;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  left: 14px;
  background-color: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 30;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.3px;
  line-height: 1.3;
  user-select: none;
  transition: all 0.18s ease;
}

.canvas-hud:hover {
  background-color: rgba(15, 23, 42, 0.96);
  border-color: rgba(147, 197, 253, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.canvas-hud:active {
  transform: translateY(0);
}

.hud-auto-zoom-pill {
  margin-top: 3px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  cursor: pointer;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  transition: all 0.15s ease;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-auto-zoom-pill:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.hud-auto-zoom-pill.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #3b82f6;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.6);
}

.canvas-hud .hud-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.canvas-hud .hud-label {
  color: #94a3b8;
  font-weight: 500;
  width: 12px;
  min-width: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: lowercase;
}

.canvas-hud .hud-icon-label {
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.canvas-hud .hud-icon-label svg {
  display: block;
}

.canvas-hud #hudX,
.canvas-hud #hudY {
  color: #f8fafc;
  font-weight: 600;
}

.canvas-hud #hudMag {
  color: #93c5fd;
  font-weight: 600;
}

/* ==========================================================================
   BOWTIE DIAGRAM NODES (Styled accurately to bowtierisk.com screenshot)
   ========================================================================== */
.bowtie-node {
  position: absolute;
  pointer-events: auto;
  background-color: #ffffff;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, border-color 0.15s;
  cursor: grab;
  user-select: none;
  box-sizing: border-box;
  overflow: hidden;
  background-clip: padding-box;
}

.bowtie-node.node-top-event {
  overflow: visible;
}

/* Ensure simulation alert badges float on top of layer and are not clipped inside elements */
.bowtie-node.node-top-event,
.bowtie-node.has-sim-badge,
.bowtie-node:has(.sim-card-badge),
.bowtie-node.is-sim-active-threat,
.bowtie-node.is-sim-challenged,
.bowtie-node.is-sim-holding,
.bowtie-node.is-sim-outcome-holding,
.bowtie-node.is-sim-outcome-barrier-active,
.bowtie-node.is-sim-escalation-pulsing,
.bowtie-node.is-sim-mitigation-active,
.bowtie-node.is-sim-breached,
.bowtie-node.is-sim-contained,
.bowtie-node.is-sim-topevent-alarm {
  overflow: visible !important;
  z-index: 35 !important;
}

.bowtie-node.dragging {
  cursor: grabbing;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
  opacity: 0.95;
  z-index: 100 !important;
}

.bowtie-node.active-node {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}

/* Node Header */
.node-header {
  padding: 4px 8px;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.node-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: 4px;
}

.node-btn {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border: none;
  border-radius: 3px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.node-btn:hover {
  background-color: rgba(255, 255, 255, 0.45);
}

/* Node Body & Textarea */
.node-body {
  flex: 1;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
  background-color: #ffffff;
}

.node-textarea {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  resize: none;
  font-family: var(--font-sans);
  font-size: 11px;
  color: #0f172a;
  background: transparent;
  outline: none;
  line-height: 1.3;
  cursor: text;
  overflow-y: auto;
}
.node-textarea:focus {
  background-color: #f8fafc;
}
.node-textarea::placeholder {
  color: #94a3b8;
  opacity: 1;
  font-style: italic;
  font-weight: 400;
}
#inspectDesc::placeholder {
  color: #94a3b8;
  opacity: 1;
  font-style: italic;
}

/* SPECIFIC NODE TYPE DESIGNS MATCHING SCREENSHOT */
/* 1. Hazard: Yellow Border, White Body, Header */
.node-hazard {
  border: 2px solid #eab308;
  border-radius: 6px;
  text-align: center;
  background-color: #ffffff;
}
.node-hazard .node-header {
  background-color: transparent;
  color: #854d0e;
  border-bottom: 1px solid #fef08a;
  font-size: 10px;
  text-transform: uppercase;
  justify-content: center;
}
.node-hazard .node-textarea {
  text-align: center;
  font-weight: 500;
}

/* 2. Top Event: Rounded/Pill shape with Orange Border & Connection Pins */
.node-top-event {
  border: 3px solid #f97316;
  border-radius: 12px;
  text-align: center;
  background-color: #ffffff;
}
.node-top-event .node-header {
  background-color: transparent;
  color: #c2410c;
  justify-content: center;
  font-size: 11px;
  border-top-left-radius: 9px;
  border-top-right-radius: 9px;
}
.node-top-event .node-body {
  background-color: transparent;
  border-bottom-left-radius: 9px;
  border-bottom-right-radius: 9px;
}
.node-top-event .node-textarea {
  text-align: center;
  font-weight: 500;
}
/* Side connector pins for top event matching screenshot */
.node-pin-left, .node-pin-right {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 2px solid #f97316;
}
.node-pin-left { left: -5px; }
.node-pin-right { right: -5px; }

/* 3. Threat: Blue border & blue header */
.node-threat {
  border: 2px solid #2563eb;
  background-color: #2563eb;
}
.node-threat .node-header {
  background-color: #2563eb;
}

/* 4. Threat Barrier & Outcome Barrier: Slate header, grey border */
.node-threat-barrier, .node-outcome-barrier {
  border: 1.5px solid #cbd5e1;
  background-color: #334155;
}
.node-threat-barrier .node-header, .node-outcome-barrier .node-header {
  background-color: #334155;
}

/* 5. Outcome: Red border & red header */
.node-outcome {
  border: 2px solid #dc2626;
  background-color: #dc2626;
}
.node-outcome .node-header {
  background-color: #dc2626;
}

/* 6. Escalation Factor: Yellow border & yellow header */
.node-escalation-factor {
  border: 2px solid #eab308;
  background-color: #eab308;
}
.node-escalation-factor .node-header {
  background-color: #eab308;
  color: #451a03;
}
.node-escalation-factor .node-btn {
  background-color: rgba(0, 0, 0, 0.2);
}

/* 7. Mitigation: Slate border & slate header */
.node-mitigation {
  border: 1.5px solid #94a3b8;
  background-color: #64748b;
}
.node-mitigation .node-header {
  background-color: #64748b;
}

/* SVG Connection Lines */
.connection-wire {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.15s, stroke-width 0.15s;
}
.connection-wire:hover {
  stroke: #3b82f6;
  stroke-width: 3px;
}
.connection-wire.active-branch {
  stroke: #2563eb;
  stroke-width: 2.5px;
}

/* ==========================================================================
   RIGHT PANE: ELEMENT INSPECTOR
   ========================================================================== */
.inspector-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pane-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}
.node-type-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background-color: #334155;
  color: #ffffff;
  text-transform: uppercase;
}

.empty-selection {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 240px;
  color: #94a3b8;
  gap: 12px;
}
.empty-selection p {
  font-size: 12px;
  max-width: 200px;
}

.inspector-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: #0f172a;
  outline: none;
  background-color: #ffffff;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.form-row {
  display: flex;
  gap: 8px;
}
.col-half {
  flex: 1;
}

/* Global Linkage Box */
.global-link-section {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.section-badge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sub-label {
  font-size: 11px;
  font-weight: 700;
  color: #334155;
}
.status-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background-color: #e2e8f0;
  color: #475569;
  font-weight: 600;
}
.status-pill.linked {
  background-color: #dbeafe;
  color: #1e40af;
}
.global-actions-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.element-permissions-box {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 10px;
}
.permissions-mini-list {
  margin-top: 6px;
}

.inspector-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  margin-bottom: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
}

.inspector-actions .btn {
  min-height: 44px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
  cursor: pointer;
}

/* ==========================================================================
   MODALS & OVERLAYS
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show {
  display: flex;
}

.modal-box {
  background-color: #ffffff;
  border-radius: 10px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  width: 520px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.15s ease-out;
}
.modal-sm { width: 400px; }
.modal-lg { width: 750px; }

@keyframes modalPop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}
.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover {
  color: #0f172a;
}

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
}

#newDiagramForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#btnSubmitNewDiagram {
  margin-top: 14px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #f8fafc;
}

.flex-spacer { flex: 1; }
.w-full { width: 100%; }

/* Customization Settings Table */
.customization-table {
  width: 100%;
  border-collapse: collapse;
}
.customization-table th, .customization-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  text-align: left;
}
.customization-table th {
  color: #64748b;
  font-weight: 600;
}
.color-picker-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-input-native {
  width: 32px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  cursor: pointer;
}
.color-text-input {
  width: 80px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.node-preview-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

/* Audit Table */
.audit-table {
  width: 100%;
  border-collapse: collapse;
}
.audit-table th, .audit-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  text-align: left;
}
.audit-table th {
  color: #64748b;
  font-weight: 600;
}
.audit-log-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.audit-log-toolbar input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 12px;
}
.audit-log-container {
  max-height: 400px;
  overflow-y: auto;
}

/* Permissions Table */
.permissions-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.permissions-table th, .permissions-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  text-align: left;
}

.alert-info-box {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 10px 14px;
  color: #1e40af;
}

.radio-group {
  display: flex;
  gap: 16px;
  font-size: 13px;
  margin-top: 4px;
}
.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* Typography Utilities */
.text-muted { color: #64748b; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

/* ==========================================================================
   MOBILE & TOUCH RESPONSIVE STYLES
   ========================================================================== */
.mobile-toggle-btn {
  display: none;
}

.mobile-drawer-backdrop {
  display: none;
  position: fixed !important;
  top: calc(52px + env(safe-area-inset-top, 0px)) !important;
  left: 0 !important;
  width: 100vw !important;
  height: calc(100vh - 52px - env(safe-area-inset-top, 0px)) !important;
  height: calc(100dvh - 52px - env(safe-area-inset-top, 0px)) !important;
  background-color: rgba(15, 23, 42, 0.5) !important;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 990 !important;
}
.mobile-drawer-backdrop.show {
  display: block;
}

/* Touch Action on Canvas */
.canvas-viewport, .canvas-stage, .nodes-layer, .connections-layer, .grid-layer {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Touch Friendly Node Buttons */
.node-btn {
  width: 22px;
  height: 22px;
  font-size: 13px;
}

/* Tablet & Mobile Layout (max-width: 900px) */
@media (max-width: 900px) {
  .mobile-toggle-btn {
    display: inline-flex;
  }

  /* Compact responsive top navigation bar */
  .top-nav {
    height: calc(52px + env(safe-area-inset-top, 0px));
    min-height: calc(52px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: max(6px, env(safe-area-inset-left, 6px));
    padding-right: max(6px, env(safe-area-inset-right, 6px));
    padding-bottom: 0;
    gap: 4px;
    overflow: visible !important;
    position: relative;
    z-index: 1000;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .nav-left {
    gap: 4px;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    overflow: visible;
  }
  .brand-logo {
    display: flex !important;
    align-items: center;
    flex-shrink: 0;
    margin-right: 6px;
    cursor: pointer;
  }
  .brand-logo svg {
    height: 28px;
    width: auto;
    max-width: 110px;
    display: block;
  }
  .diagram-nav-controls {
    gap: 4px;
    margin-left: auto;
  }
  .diagram-nav-controls .save-status,
  .diagram-nav-controls .nav-control-spacer,
  .diagram-nav-controls #btnOpenHistory,
  .diagram-nav-controls .zoom-controls,
  .diagram-nav-controls #btnAutoBalance,
  .diagram-nav-controls #btnToggleAutoAlign,
  .diagram-nav-controls #btnOrderBarriersTime,
  .diagram-nav-controls #btnOpenCostAnalysis,
  .diagram-nav-controls #btnToggleSituationRunner,
  .diagram-nav-controls #btnOpenShare,
  .diagram-nav-controls .dropdown {
    display: none !important;
  }
  .diagram-nav-controls .history-dropdown-wrapper {
    position: static !important;
    display: contents !important;
  }
  .diagram-history-dropdown {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 92vw !important;
    max-width: 380px !important;
    max-height: 80vh !important;
    z-index: 10050 !important;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.35) !important;
  }
  .btn-mobile-burger {
    display: inline-flex !important;
  }
  .view-mode-tabs {
    margin-left: 0;
    padding: 2px;
    gap: 2px;
    flex-shrink: 0;
  }
  .view-mode-tabs .btn-view-tab {
    padding: 5px 6px;
    font-size: 11px;
    border-radius: 5px;
  }
  .view-mode-tabs .btn-view-tab span {
    display: none;
  }
  .diagram-selector-wrapper {
    margin-left: 2px;
    gap: 3px;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    overflow: visible;
  }
  .diagram-selector-wrapper select {
    max-width: 90px;
    min-width: 55px;
    font-size: 11px;
    padding: 4px 4px;
    flex-shrink: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    border-radius: 6px;
  }
  .diagram-selector-wrapper .btn-sm {
    padding: 4px 6px;
    font-size: 11px;
    flex-shrink: 0;
    border-radius: 6px;
  }
  .diagram-selector-wrapper #btnAddDiagram span {
    display: none;
  }

  .nav-center {
    display: none !important; /* Hide zoom controls and save status on mobile to free up space */
  }

  .nav-right {
    gap: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    overflow: visible;
    position: relative;
  }
  .nav-right #btnOpenHistory,
  .nav-right #btnOpenShare,
  .nav-right #btnOpenSettings {
    display: none !important;
  }
  .nav-right #btnExportMenu {
    padding: 5px 6px;
    border-radius: 6px;
    flex-shrink: 0;
  }
  .nav-right #btnExportMenu span {
    display: none;
  }
  .nav-right #exportDropdown {
    position: absolute !important;
    top: calc(100% + 4px) !important;
    right: 0 !important;
    left: auto !important;
    z-index: 10001 !important;
    min-width: 195px;
    max-width: calc(100vw - 16px);
  }
  .nav-right .collaborators-stack {
    padding: 2px 4px;
    gap: 3px;
    margin-right: 0;
    flex-shrink: 0;
  }
  @media (max-width: 440px) {
    .nav-right .collaborators-stack {
      display: none !important;
    }
  }
  .nav-right .btn-profile {
    padding: 2px;
    flex-shrink: 0;
  }
  .nav-right .btn-profile .user-email-label,
  .nav-right .btn-profile svg {
    display: none;
  }
  .nav-right .avatar {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }
  .nav-right #btnMobileToggleRight {
    display: inline-flex !important;
    padding: 5px 6px;
    border-radius: 6px;
    flex-shrink: 0;
  }

  /* Fixed drawer panels on mobile */
  .left-pane {
    position: fixed !important;
    top: calc(52px + env(safe-area-inset-top, 0px)) !important;
    left: 0 !important;
    bottom: 0 !important;
    height: calc(100vh - 52px - env(safe-area-inset-top, 0px)) !important;
    height: calc(100dvh - 52px - env(safe-area-inset-top, 0px)) !important;
    width: 320px !important;
    max-width: 85vw !important;
    z-index: 1000 !important;
    background-color: #ffffff !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25) !important;
    transform: translateX(-100%) !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .left-pane.drawer-open {
    transform: translateX(0) !important;
  }

  .right-pane {
    position: fixed !important;
    top: calc(52px + env(safe-area-inset-top, 0px)) !important;
    right: 0 !important;
    bottom: 0 !important;
    height: calc(100vh - 52px - env(safe-area-inset-top, 0px)) !important;
    height: calc(100dvh - 52px - env(safe-area-inset-top, 0px)) !important;
    width: 340px !important;
    max-width: 90vw !important;
    z-index: 1000 !important;
    background-color: #ffffff !important;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.25) !important;
    transform: translateX(100%) !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  .right-pane.drawer-open {
    transform: translateX(0) !important;
  }
  .right-pane .pane-body {
    padding-bottom: max(96px, calc(52px + env(safe-area-inset-bottom, 34px))) !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Floating toolbar on mobile */
  .canvas-floating-toolbar {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: calc(100vw - 16px);
    transform: none;
    padding: 4px 8px;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    justify-content: flex-start;
    scrollbar-width: none;
  }
  .canvas-floating-toolbar::-webkit-scrollbar {
    display: none;
  }
  .tool-group {
    gap: 5px;
    flex-shrink: 0;
  }
  .tool-btn {
    padding: 5px 8px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .tool-info {
    display: none;
  }

  .modal-box {
    width: 95vw;
    max-height: 90vh;
  }
  .customization-table-wrap, .permissions-table-wrap, .audit-log-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent iOS Safari / mobile browser forced auto-zoom on input focus */
  input,
  textarea,
  select,
  .node-textarea,
  .form-input,
  .form-textarea,
  .form-select,
  .sim-select,
  .tree-search-bar input {
    font-size: 16px !important;
  }

  /* Mobile Sidebar Edge Restore Tabs */
  .sidebar-edge-tab {
    position: fixed !important;
    top: calc(138px + env(safe-area-inset-top, 0px)) !important;
    transform: none !important;
    width: 24px !important;
    height: 36px !important;
    z-index: 950 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
  }
  .sidebar-edge-tab.edge-left {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
  }
  .sidebar-edge-tab.edge-right {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
  }
}

/* Coarse touch devices: ensure inputs are always >= 16px to prevent iOS auto-zoom */
@media (pointer: coarse) {
  .node-textarea,
  .form-input,
  .form-textarea,
  .form-select,
  .sim-select {
    font-size: 16px !important;
  }
}

/* Small phone screens (max-width: 500px) */
@media (max-width: 500px) {
  .top-nav {
    padding-left: max(4px, env(safe-area-inset-left, 4px));
    padding-right: max(4px, env(safe-area-inset-right, 4px));
    gap: 3px;
    overflow: visible !important;
  }
  .diagram-selector-wrapper select {
    max-width: 80px;
    min-width: 50px;
    font-size: 11px;
    padding: 3px 3px;
  }
  .btn-profile {
    padding: 1px;
  }
}

/* ==========================================================================
   VIEW MODE SWITCHER (DOCUMENTS vs CANVAS)
   ========================================================================== */
.view-mode-tabs {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px;
  border-radius: 8px;
  gap: 2px;
  margin-left: 8px;
}

.btn-view-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-view-tab:hover {
  color: #ffffff;
}

.btn-view-tab.active {
  background: var(--primary-blue);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   USER PROFILE DROPDOWN MENU
   ========================================================================== */
.user-profile-wrapper {
  position: relative;
}

.user-profile-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 280px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
  padding: 12px;
  z-index: 1000;
  display: none;
}

.user-profile-dropdown.show {
  display: block;
  animation: fadeInDown 0.15s ease;
}

.user-profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  max-width: 56px;
  max-height: 56px;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 600;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0 !important;
  overflow: hidden !important;
}

.user-profile-details {
  flex: 1;
  overflow: hidden;
}

.user-profile-name {
  font-weight: 600;
  font-size: 14px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-profile-email {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.user-profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.user-profile-meta .badge {
  font-size: 10px;
  padding: 2px 6px;
  background: #f1f5f9;
  color: #475569;
}

/* ==========================================================================
   AUTH TABS (SIGN IN & SIGN UP)
   ========================================================================== */
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 18px;
}

.auth-tab {
  flex: 1;
  padding: 10px 0;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab:hover {
  color: var(--primary-blue);
}

.auth-tab.active {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
}

.auth-form-pane {
  display: none;
}

.auth-form-pane.active {
  display: block;
}

/* ==========================================================================
   VERSION REVERT BUTTON
   ========================================================================== */
.btn-revert-version {
  font-size: 11px;
  padding: 3px 8px;
  border-color: #2563eb;
  color: #2563eb;
  background: transparent;
  transition: all 0.15s ease;
}

.btn-revert-version:hover {
  background: #2563eb;
  color: #ffffff;
}

/* ==========================================================================
   GOOGLE DRIVE STYLE DOCUMENTS LANDING PAGE
   ========================================================================== */
.documents-landing-view {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 100vw;
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  overflow: hidden;
  background: #f8fafc;
}

/* Drive Sidebar */
.drive-sidebar {
  width: 250px;
  min-width: 250px;
  background: #ffffff;
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 20px;
}

.drive-sidebar-header {
  padding: 0 8px;
}

.drive-sidebar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.drive-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drive-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.drive-nav-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.drive-nav-item.active {
  background: #eff6ff;
  color: var(--primary-blue);
  font-weight: 600;
}

.drive-storage-stats {
  margin-top: auto;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 8px;
}

.drive-storage-stats .stats-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.drive-storage-stats .stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
}

.drive-app-version {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  letter-spacing: 0.3px;
  user-select: none;
  cursor: pointer;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  transition: all 0.15s ease;
}

.drive-app-version:hover {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #cbd5e1;
}

.drive-app-version .version-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
  flex-shrink: 0;
}

.drive-app-version .version-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
}

/* Mobile version tag (hidden by default on desktop) */
.drive-mobile-version {
  display: none;
}

/* Drive Main Content */
.drive-main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 24px 32px;
  gap: 24px;
}

/* Drive Toolbar */
.drive-toolbar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.drive-toolbar-search-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.drive-toolbar-search-row .drive-search-box {
  flex: 1;
  max-width: 500px;
}

.drive-toolbar-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  flex-wrap: wrap;
}

.drive-toolbar-left,
.drive-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drive-breadcrumbs {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  gap: 4px;
  margin-left: 6px;
  white-space: nowrap;
}

.drive-breadcrumbs .breadcrumb-item {
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
}

.drive-breadcrumbs .breadcrumb-item:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.drive-breadcrumbs .breadcrumb-item.active {
  color: #0f172a;
  font-weight: 600;
  cursor: default;
}

.drive-breadcrumbs .breadcrumb-separator {
  color: #94a3b8;
}

.drive-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 6px 12px;
  width: 260px;
  color: #64748b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.drive-search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: #0f172a;
  width: 100%;
}

/* Sections */
.drive-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drive-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.2px;
}

/* Folders Grid */
.drive-folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  justify-content: center;
}

.drive-folder-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.drive-folder-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.07);
  transform: translateY(-1px);
}

.folder-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.folder-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.folder-meta {
  flex: 1;
  overflow: hidden;
}

.folder-name {
  font-weight: 600;
  font-size: 13px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-count {
  font-size: 11px;
  color: #64748b;
}

.folder-actions-btn {
  padding: 2px 6px;
  font-size: 16px;
  color: #94a3b8;
  border-radius: 4px;
  cursor: pointer;
}

.folder-actions-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Diagrams Grid - 4:3 Portrait Ratio (4 high : 3 wide) */
.drive-diagrams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 275px));
  gap: 20px;
  justify-content: center;
}

.drive-diagram-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  overflow: visible;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  aspect-ratio: 3 / 4;
  max-width: 280px;
  cursor: pointer;
}

.drive-diagram-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
  transform: translateY(-2px);
  z-index: 10;
}

.drive-diagram-card:has(.card-kebab-menu.show) {
  z-index: 30;
}

.diagram-card-preview {
  height: 155px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.diagram-thumbnail-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.diagram-card-preview-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  pointer-events: none;
  z-index: 5;
}

/* Mini Bowtie Graphic Badge */
.mini-bowtie-graphic {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #2563eb;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.mini-bowtie-graphic svg {
  flex-shrink: 0;
}

.card-folder-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  background: #ffffff !important;
  border: 1px solid #e2e8f0;
}

.badge-shared {
  font-size: 10px;
  padding: 2px 7px;
  background: #2563eb;
  color: #ffffff;
  border-radius: 4px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.diagram-card-body {
  padding: 12px 14px 10px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.diagram-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.diagram-card-desc {
  font-size: 11px;
  color: #64748b;
  line-height: 1.3;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.diagram-card-keynodes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

.keynode-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.hazard-pill {
  background: #eff6ff;
  color: #1d4ed8;
  border-left: 3px solid #2563eb;
}

.topevent-pill {
  background: #fef2f2;
  color: #b91c1c;
  border-left: 3px solid #dc2626;
}

/* Threats, Barriers, Outcomes stats pills snugly positioned under keynodes */
.diagram-card-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding-top: 0;
}

.stat-pill {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
}

.diagram-card-footer {
  padding: 8px 12px 9px 12px;
  background: #f8fafc;
  border-top: 1px solid var(--border-light);
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.author-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-sm {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #334155;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-action-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Drive List View Table */
.drive-diagrams-list {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
}

.drive-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.drive-table th {
  background: #f8fafc;
  padding: 10px 14px;
  font-weight: 600;
  color: #475569;
  border-bottom: 1px solid var(--border-light);
}

.drive-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: #334155;
}

.drive-table tr:hover td {
  background: #f8fafc;
}

.table-doc-title {
  display: flex;
  align-items: center;
  color: #0f172a;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drive-empty-card {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  background: #ffffff;
  border: 2px dashed var(--border-light);
  border-radius: 12px;
  color: #64748b;
}

.drive-empty-hint {
  padding: 16px;
  color: #94a3b8;
  font-size: 13px;
  font-style: italic;
}

/* Folder Context Menu */
.folder-context-menu {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  min-width: 190px;
  padding: 6px 0;
}

.folder-context-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #334155;
  text-align: left;
}

.folder-context-menu .dropdown-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Responsive Overrides */
@media (max-width: 900px) {
  .documents-landing-view {
    flex-direction: column;
    height: calc(100vh - 84px);
    height: calc(100dvh - 84px);
  }
  .drive-sidebar {
    width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding: 8px 12px;
    gap: 8px;
    flex-shrink: 0;
  }
  .drive-nav-list {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    width: 100%;
    padding: 2px 0;
  }
  .drive-nav-list::-webkit-scrollbar {
    display: none;
  }
  .drive-nav-item {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 10px;
    font-size: 12px;
    gap: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
  }
  .drive-nav-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
  }
  .drive-storage-stats {
    display: none;
  }
  .drive-sidebar .drive-app-version {
    display: none !important;
  }
  .drive-mobile-version {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 0 calc(16px + env(safe-area-inset-bottom, 0px)) 0;
    margin-top: auto;
    font-size: 11px;
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s ease;
  }
  .drive-mobile-version:hover,
  .drive-mobile-version:active {
    opacity: 0.8;
  }
  .drive-mobile-version .version-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
    flex-shrink: 0;
  }
  .drive-mobile-version .version-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
  }
  .drive-main-content {
    padding: 12px 14px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .drive-page-header {
    display: none;
  }
  .drive-toolbar {
    gap: 10px;
    padding-bottom: 12px;
  }
  .drive-toolbar-search-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  .drive-toolbar-search-row .drive-search-box {
    flex: 1;
    width: auto;
    max-width: none;
    min-width: 0;
  }
  .drive-toolbar-actions-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .drive-toolbar-left,
  .drive-toolbar-actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .drive-diagrams-grid {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    gap: 16px;
    justify-content: stretch;
  }
  .drive-folders-grid {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    gap: 12px;
    justify-content: stretch;
  }
  .drive-diagram-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    aspect-ratio: auto;
    min-height: auto;
    overflow: hidden;
  }
  .diagram-card-preview {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .diagram-card-preview-overlay {
    max-width: calc(100% - 16px);
    flex-wrap: wrap;
  }
  .card-folder-tag {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .diagram-card-body {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }
  .diagram-card-title,
  .diagram-card-desc {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .diagram-card-keynodes {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .keynode-pill {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
  .diagram-card-footer {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* ==========================================================================
   Real-Time Multi-User Collaboration & Collaborator Avatars (Google Docs Style)
   ========================================================================== */

.collaborators-stack {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  margin-right: 6px;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}

.collaborators-stack:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.2);
}

.collab-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.collab-avatars-list {
  display: flex;
  align-items: center;
  gap: -6px; /* overlapping avatars like Google Docs */
}

.collab-avatar-chip {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1e293b;
  border: 2px solid #2563eb;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, z-index 0.15s;
  position: relative;
  margin-left: -5px;
  color: #f8fafc;
}

.collab-avatar-chip:first-child {
  margin-left: 0;
}

.collab-avatar-chip:hover {
  transform: translateY(-2px) scale(1.15);
  z-index: 10;
}

.collab-self-tag {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0.2px;
}

/* Remote Cursors on Canvas */
.remote-canvas-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 999;
  transform: translate(0, 0);
  transition: left 0.08s ease-out, top 0.08s ease-out;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.remote-cursor-arrow {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}

.remote-cursor-label {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  margin-left: 12px;
  margin-top: -6px;
}

/* Remote Selected Node Highlight */
.remote-selected-node {
  box-shadow: 0 0 0 3px var(--remote-color, #2563eb), 0 0 14px var(--remote-color, #2563eb) !important;
  transition: box-shadow 0.2s ease;
}

.remote-user-tag {
  position: absolute;
  top: -18px;
  right: 0;
  padding: 1px 6px;
  border-radius: 3px;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  z-index: 50;
  animation: tag-pop 0.2s ease-out;
}

@keyframes tag-pop {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Node card attachment paperclip badge */
.node-card-att-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.12);
  color: inherit;
  padding: 1px 5px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
  margin-left: 4px;
  cursor: pointer;
  vertical-align: middle;
}

.node-card-att-badge:hover {
  background: rgba(15, 23, 42, 0.25);
}

/* ==========================================================================
   Element Document Attachments in Inspector
   ========================================================================== */

.element-attachments-box {
  margin-top: 14px;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 6px;
}

.attachment-upload-zone {
  margin-bottom: 8px;
}

.attachment-upload-zone.drag-over {
  border: 2px dashed #2563eb;
  background: #eff6ff;
}

.attachments-mini-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.attachment-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 11px;
  transition: border-color 0.15s;
}

.attachment-item-card:hover {
  border-color: #cbd5e1;
}

.attachment-item-card.uploading {
  opacity: 0.7;
  font-style: italic;
}

.att-icon-wrap {
  display: flex;
  align-items: center;
  margin-right: 6px;
  flex-shrink: 0;
}

.att-info-wrap {
  flex: 1;
  min-width: 0;
  margin-right: 6px;
}

.att-filename {
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.att-meta-line {
  font-size: 10px;
  color: #64748b;
  display: flex;
  gap: 4px;
}

.att-actions-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.btn-att-download,
.btn-att-delete {
  padding: 3px 5px !important;
  font-size: 10px !important;
  line-height: 1 !important;
}

/* ==========================================================================
   ACTIVE SITUATION RUNNER & INCIDENT SIMULATOR STYLES
   ========================================================================== */

/* Situation Runner HUD Toolbar Toggle Button */
.btn-tool-sim {
  position: relative;
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
  font-weight: 600;
}

.btn-tool-sim:hover {
  background: #0f172a;
  border-color: #f59e0b;
  color: #fbbf24;
}

.btn-tool-sim.active {
  background: #d97706;
  border-color: #f59e0b;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.sim-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
  margin-right: 2px;
}

.btn-tool-sim.active .sim-status-dot,
.sim-status-dot.running {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 1.2s infinite;
}

/* Inline Card Quick-Run Button */
.btn-node-sim {
  color: #fbbf24;
  font-size: 11px;
}
.btn-node-sim:hover {
  background: rgba(251, 191, 36, 0.2);
  color: #f59e0b;
}

/* Floating Situation Runner HUD */
.situation-runner-hud {
  position: absolute;
  top: 55px;
  right: 20px;
  width: 420px;
  max-width: calc(100vw - 40px);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  color: #f8fafc;
  z-index: 980 !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  touch-action: manipulation;
  -webkit-user-select: auto;
  user-select: auto;
  pointer-events: auto;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.15);
}

.situation-runner-hud * {
  touch-action: manipulation;
  pointer-events: auto;
}

/* Responsive button text spans */
.btn-text-full {
  display: inline;
}
.btn-text-short {
  display: none;
}

.situation-runner-hud.collapsed {
  width: 320px;
}

.situation-runner-hud.collapsed .sim-hud-body {
  display: none;
}

.situation-runner-hud.closed {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.situation-runner-hud.is-dragging {
  transition: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  box-shadow: 0 22px 48px -4px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(251, 191, 36, 0.35);
  cursor: grabbing !important;
}

.situation-runner-hud.is-moved {
  right: auto !important;
}

.sim-hud-header {
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.sim-hud-header:active,
.situation-runner-hud.is-dragging .sim-hud-header {
  cursor: grabbing;
}

.sim-drag-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  margin-right: 2px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s, color 0.15s;
}

.sim-hud-header:hover .sim-drag-grip {
  opacity: 1;
  color: #94a3b8;
}

.situation-runner-hud.is-dragging .sim-drag-grip {
  color: #fbbf24;
  opacity: 1;
}

.sim-hud-header-actions button {
  cursor: pointer;
  touch-action: manipulation;
}

.sim-hud-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.sim-radar-icon {
  font-size: 14px;
  color: #fbbf24;
  animation: pulse-dot 1.5s infinite;
}

.sim-hud-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #e2e8f0;
  white-space: nowrap;
}

.sim-mode-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  white-space: nowrap;
}

.sim-status-pill {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
  margin-right: 6px;
}

.sim-status-pill.idle {
  background: #334155;
  color: #cbd5e1;
}

.sim-status-pill.running {
  background: #15803d;
  color: #dcfce7;
  animation: pulse-dot 1.2s infinite;
}

.sim-status-pill.paused {
  background: #d97706;
  color: #fef3c7;
}

.sim-status-pill.breached {
  background: #b91c1c;
  color: #fee2e2;
}

.sim-status-pill.contained {
  background: #047857;
  color: #d1fae5;
}

.sim-hud-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  flex-shrink: 0;
}

.btn-sim-icon {
  background: none;
  border: none;
  color: #94a3b8;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.btn-sim-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sim-hud-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sim-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sim-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
}

.sim-sublabel {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  margin-right: 4px;
  white-space: nowrap;
}

.sim-select {
  flex: 1;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #f1f5f9;
  font-size: 11px;
  padding: 5px 8px;
  outline: none;
}

.sim-select:focus {
  border-color: #3b82f6;
}

/* Mode Pills */
.sim-pill-group {
  display: flex;
  gap: 4px;
  background: #1e293b;
  padding: 3px;
  border-radius: 6px;
  border: 1px solid #334155;
}

.sim-pill {
  flex: 1;
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  text-align: center;
}

.sim-pill:hover {
  color: #f1f5f9;
}

.sim-pill.active {
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
}

/* Speed Multipliers */
.sim-speed-group {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}

.sim-speed-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.sim-speed-btn:hover {
  background: #334155;
  color: #f8fafc;
}

.sim-speed-btn.active {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #0f172a;
  font-weight: 700;
}

/* Schedule Buttons */
.sim-sched-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
}

.sim-sched-btn:hover {
  color: #ffffff;
}

.sim-sched-btn.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
}

/* Clock Card */
.sim-clock-card {
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sim-clock-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 24px;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.05em;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.sim-clock-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sim-clock-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
}

.metric-label {
  color: #64748b;
}

.metric-val {
  color: #cbd5e1;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.metric-val.text-accent {
  color: #fbbf24;
  font-weight: 600;
  font-family: inherit;
}

/* Progress Track */
.sim-progress-track {
  width: 100%;
  height: 5px;
  background: #1e293b;
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.sim-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #f59e0b, #ef4444);
  transition: width 0.15s ease-out;
  border-radius: 9999px;
}

/* Transport Buttons */
.sim-transport-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.sim-transport-btn {
  flex: 1;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s;
}

.sim-transport-btn:hover:not(:disabled) {
  background: #334155;
  border-color: #475569;
}

.sim-transport-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-sim-play {
  background: #16a34a;
  border-color: #22c55e;
  color: #ffffff;
  flex: 1.5;
}

.btn-sim-play:hover:not(:disabled) {
  background: #15803d;
  border-color: #16a34a;
}

.btn-sim-pause {
  background: #d97706;
  border-color: #f59e0b;
  color: #ffffff;
}

.btn-sim-pause:hover:not(:disabled) {
  background: #b45309;
}

.btn-sim-reset {
  background: #334155;
}

.btn-sim-log-toggle {
  flex: 1;
  background: #1e293b;
}

/* Incident Log Drawer */
.sim-log-drawer {
  background: rgba(2, 6, 23, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px;
  margin-top: 4px;
  max-height: 200px;
  display: flex;
  flex-direction: column;
}

.sim-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  color: #94a3b8;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 6px;
}

.sim-log-actions {
  display: flex;
  gap: 4px;
}

.sim-log-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  max-height: 150px;
}

.sim-log-empty {
  color: #64748b;
  font-size: 11px;
  text-align: center;
  padding: 16px 8px;
}

.sim-log-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  line-height: 1.3;
}

.sim-log-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  color: #38bdf8;
  white-space: nowrap;
}

.sim-log-msg {
  color: #e2e8f0;
  word-break: break-word;
}

.sim-log-item.log-threat .sim-log-msg { color: #f87171; }
.sim-log-item.log-impact .sim-log-msg { color: #fbbf24; font-weight: 600; }
.sim-log-item.log-holding .sim-log-msg { color: #fde047; }
.sim-log-item.log-breached .sim-log-msg { color: #ef4444; font-weight: 700; }
.sim-log-item.log-contained .sim-log-msg { color: #4ade80; font-weight: 700; }
.sim-log-item.log-top-event .sim-log-msg { color: #f43f5e; font-weight: 700; }

/* Dynamic Card Simulation Badges */
.sim-card-badge {
  position: absolute;
  bottom: -12px;
  right: 8px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.25);
  z-index: 50 !important;
  pointer-events: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-threat-active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.8);
  animation: pulse-dot 1s infinite;
}

.badge-inbound {
  background: #3b82f6;
  color: #ffffff;
}

.badge-arming, .badge-escalating {
  background: #d97706;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.8);
  animation: pulse-dot 1s infinite;
}

.badge-holding {
  background: #eab308;
  color: #0f172a;
  animation: pulse-dot 1.2s infinite;
}

.badge-outcome-holding {
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.8);
  animation: pulse-dot 1.2s infinite;
}

.badge-mitigation-active {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.8);
  animation: pulse-dot 1.2s infinite;
}

.badge-breached {
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.8);
}

.badge-contained {
  background: #16a34a;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(22, 163, 74, 0.8);
}

.badge-topevent-breached {
  background: #991b1b;
  color: #fee2e2;
  box-shadow: 0 0 14px rgba(153, 27, 27, 1);
  animation: pulse-dot 0.8s infinite;
}

/* Visual Node Card States during simulation */
.is-sim-active-threat {
  border-color: #2563eb !important;
  animation: threat-aura-pulse 1.6s infinite !important;
  z-index: 35 !important;
  overflow: visible !important;
}

.is-sim-challenged {
  border-color: #f59e0b !important;
  animation: barrier-holding-pulse 1.4s infinite !important;
  z-index: 35 !important;
  overflow: visible !important;
}

.is-sim-impacted {
  animation: barrier-impact-shake 0.45s ease-out !important;
  z-index: 35 !important;
  overflow: visible !important;
}

.is-sim-holding {
  border-color: #f59e0b !important;
  animation: barrier-holding-pulse 1.4s infinite !important;
  z-index: 35 !important;
  overflow: visible !important;
}

/* Outcome Barriers: RED consequence containment pulse */
.is-sim-outcome-holding,
.is-sim-outcome-barrier-active {
  border-color: #ef4444 !important;
  animation: outcome-barrier-pulse 1.3s infinite !important;
  z-index: 35 !important;
  overflow: visible !important;
}

/* Escalation Factors: YELLOW/AMBER pulse */
.is-sim-escalation-pulsing {
  border-color: #eab308 !important;
  animation: escalation-factor-pulse 1.2s infinite !important;
  z-index: 35 !important;
  overflow: visible !important;
}

/* Mitigations: BLUE/CYAN pulse */
.is-sim-mitigation-active {
  border-color: #0284c7 !important;
  animation: mitigation-active-pulse 1.3s infinite !important;
  z-index: 35 !important;
  overflow: visible !important;
}

.is-sim-breached {
  border-color: #ef4444 !important;
  animation: barrier-breached-pulse 1.2s infinite !important;
  opacity: 0.95;
  z-index: 35 !important;
  overflow: visible !important;
}

.is-sim-contained {
  border-color: #10b981 !important;
  animation: barrier-contained-pulse 1.5s infinite !important;
  z-index: 35 !important;
  overflow: visible !important;
}

.is-sim-topevent-alarm {
  border-color: #dc2626 !important;
  animation: top-event-alarm 1s infinite !important;
  z-index: 35 !important;
  overflow: visible !important;
}

/* Animations Keyframes */
@keyframes threat-aura-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px #2563eb, 0 0 16px rgba(37, 99, 235, 0.7);
  }
  50% {
    box-shadow: 0 0 0 6px #3b82f6, 0 0 28px rgba(59, 130, 246, 0.95);
  }
}

@keyframes barrier-impact-shake {
  0% { transform: scale(1); filter: brightness(1); }
  25% { transform: scale(1.08); filter: brightness(1.4); }
  50% { transform: scale(0.96); filter: brightness(1.2); }
  75% { transform: scale(1.03); filter: brightness(1.1); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes barrier-holding-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px #f59e0b, 0 0 14px rgba(245, 158, 11, 0.5);
  }
  50% {
    box-shadow: 0 0 0 4px #fbbf24, 0 0 22px rgba(245, 158, 11, 0.75);
  }
}

@keyframes outcome-barrier-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px #ef4444, 0 0 16px rgba(239, 68, 68, 0.65);
  }
  50% {
    box-shadow: 0 0 0 5px #dc2626, 0 0 26px rgba(220, 38, 38, 0.9);
  }
}

@keyframes escalation-factor-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px #eab308, 0 0 14px rgba(234, 179, 8, 0.6);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 4px #f59e0b, 0 0 24px rgba(245, 158, 11, 0.85);
    transform: scale(1.02);
  }
}

@keyframes mitigation-active-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px #0284c7, 0 0 14px rgba(2, 132, 199, 0.6);
  }
  50% {
    box-shadow: 0 0 0 4px #38bdf8, 0 0 22px rgba(56, 189, 248, 0.85);
  }
}

@keyframes barrier-breached-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px #ef4444, 0 0 14px rgba(239, 68, 68, 0.6);
  }
  50% {
    box-shadow: 0 0 0 5px #dc2626, 0 0 24px rgba(239, 68, 68, 0.85);
  }
}

@keyframes barrier-contained-pulse {
  0%, 100% {
    box-shadow: 0 0 0 2px #10b981, 0 0 14px rgba(16, 185, 129, 0.6);
  }
  50% {
    box-shadow: 0 0 0 5px #059669, 0 0 24px rgba(16, 185, 129, 0.85);
  }
}

@keyframes top-event-alarm {
  0%, 100% {
    box-shadow: 0 0 0 4px #dc2626, 0 0 30px rgba(220, 38, 38, 0.8);
  }
  50% {
    box-shadow: 0 0 0 8px #ef4444, 0 0 50px rgba(239, 68, 68, 1);
  }
}

/* SVG Threat Traveling Ball & Shockwave */
.threat-ball-group {
  pointer-events: none;
}

.threat-ball-core {
  fill: #ffffff;
  stroke: #ef4444;
  stroke-width: 2.5;
}

.threat-ball-mid {
  fill: rgba(239, 68, 68, 0.65);
}

.threat-ball-aura {
  fill: rgba(239, 68, 68, 0.35);
  animation: threat-ball-travel-pulse 0.8s infinite alternate;
}

@keyframes threat-ball-travel-pulse {
  0% { r: 12px; fill-opacity: 0.25; }
  100% { r: 18px; fill-opacity: 0.55; }
}

.sim-shockwave-pulse {
  fill: none;
  stroke: #f59e0b;
  stroke-width: 3;
  animation: sim-expand-shockwave 0.65s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes sim-expand-shockwave {
  0% { r: 6px; stroke: #f59e0b; stroke-opacity: 1; stroke-width: 4px; }
  100% { r: 60px; stroke: #ef4444; stroke-opacity: 0; stroke-width: 1px; }
}

/* Inspector Simulation Timing Box */
.simulation-timing-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 12px;
}

.status-pill-sim {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 600;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 9999px;
}

/* Touch active feedback */
.sim-transport-btn:active:not(:disabled),
.sim-pill:active,
.sim-speed-btn:active,
.sim-sched-btn:active,
.btn-sim-icon:active {
  transform: scale(0.96);
  filter: brightness(1.2);
}

/* Mobile Responsiveness for Situation Runner HUD */
@media (max-width: 600px) {
  .situation-runner-hud {
    top: 54px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: calc(100vw - 16px);
    border-radius: 10px;
    z-index: 980 !important;
  }

  .situation-runner-hud.collapsed {
    left: 8px;
    right: 8px;
    width: auto;
  }

  .situation-runner-hud.is-moved {
    right: auto !important;
    width: min(420px, calc(100vw - 16px)) !important;
  }

  .situation-runner-hud.is-moved.collapsed {
    width: min(320px, calc(100vw - 16px)) !important;
  }

  .sim-hud-header {
    padding: 8px 12px;
    gap: 10px;
  }

  .sim-mode-tag {
    display: none;
  }

  .sim-hud-header-actions {
    margin-left: 12px;
  }

  .sim-hud-body {
    padding: 8px 10px;
    gap: 8px;
  }

  /* Wrap mode pills and speed onto two clean lines on small phones */
  .sim-row-mode {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .sim-speed-group {
    margin-left: 0;
    justify-content: flex-end;
  }

  /* Use compact button text on small screens */
  .btn-text-full {
    display: none;
  }
  .btn-text-short {
    display: inline;
  }

  .sim-transport-row {
    display: flex;
    gap: 4px;
  }

  .sim-transport-btn {
    padding: 7px 4px;
    font-size: 10px;
    gap: 2px;
  }

  .btn-sim-play {
    flex: 1.1;
  }

  .sim-clock-card {
    padding: 6px 10px;
    gap: 8px;
  }

  .sim-clock-display {
    font-size: 20px;
  }

  .btn-sim-icon {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }
}

/* ==========================================================================
   SITUATION RUNNER ELAPSED TIME & PAST ACTIVATION
   ========================================================================== */
.sim-schedule-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.sim-schedule-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sim-past-elapsed-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 6px;
  flex-wrap: wrap;
}

.sim-sublabel-accent {
  font-size: 11px;
  font-weight: 600;
  color: #60a5fa;
  white-space: nowrap;
}

.sim-time-field {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sim-time-input {
  width: 54px;
  background: #0f172a;
  border: 1px solid #334155;
  color: #f8fafc;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.sim-time-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.sim-unit {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
}

.sim-quick-elapsed-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.sim-quick-pill {
  background: #1e293b;
  border: 1px solid #475569;
  color: #93c5fd;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sim-quick-pill:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* ==========================================================================
   FINANCIAL COSTING & PROTECTION ANALYSIS
   ========================================================================== */
.financial-costing-box {
  margin-top: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #f8fafc;
}

.status-pill-cost {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
}

.cost-protection-metric-card {
  margin-top: 8px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.cost-protection-metric-card .metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  margin-bottom: 4px;
}

/* Modal: Cost vs Protection Matrix */
.cost-summary-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.cost-stat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
}

.cost-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 4px;
}

.cost-stat-val {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.cost-stat-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.cost-analysis-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.cost-analysis-table th {
  text-align: left;
  padding: 8px 10px;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  font-weight: 600;
  color: #334155;
  font-size: 11.5px;
  text-transform: uppercase;
}

.cost-analysis-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

.cost-analysis-table tr:hover td {
  background: #f8fafc;
}

/* Toolbar Buttons: Undo / Redo / Cost */
.btn-tool-undo,
.btn-tool-redo {
  font-size: 11.5px;
  gap: 5px;
}

.btn-tool-undo:disabled,
.btn-tool-redo:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(1);
}

.btn-tool-cost {
  color: #059669;
  border-color: rgba(5, 150, 105, 0.3);
}

.btn-tool-cost:hover {
  background: #ecfdf5;
  color: #047857;
  border-color: #059669;
}

/* History Toolbar Button and Dropdown */
.btn-tool-history {
  font-size: 11.5px;
  gap: 5px;
  position: relative;
}

.history-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 9999px;
  background: #3b82f6;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.diagram-history-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 10040;
}
@media (min-width: 901px) {
  .diagram-history-backdrop {
    display: none !important;
  }
}

.diagram-history-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 320px;
  max-height: 420px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.16), 0 4px 10px -2px rgba(0, 0, 0, 0.08);
  z-index: 10050;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.diagram-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  background: #f8fafc;
}

.history-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-header-title svg {
  color: #3b82f6;
}

.diagram-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
  max-height: 360px;
}

.history-entry-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 14px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  border-left: 3px solid transparent;
}

.history-entry-item:hover {
  background: #f1f5f9;
}

.history-entry-item.is-current {
  background: #eff6ff;
  border-left-color: #3b82f6;
  cursor: default;
}

.history-entry-item.is-redo {
  opacity: 0.75;
}

.history-entry-item.is-redo:hover {
  opacity: 1;
  background: #f8fafc;
}

.history-entry-icon {
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #f1f5f9;
  color: #64748b;
}

.history-entry-item.is-current .history-entry-icon {
  background: #3b82f6;
  color: #ffffff;
}

.history-entry-content {
  flex: 1;
  min-width: 0;
}

.history-entry-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.history-entry-sub {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.history-entry-time {
  color: #94a3b8;
  font-size: 10.5px;
  margin-left: auto;
  white-space: nowrap;
}

.history-empty-state {
  padding: 24px 16px;
  text-align: center;
  color: #64748b;
  font-size: 12px;
}

.history-empty-icon {
  margin-bottom: 8px;
  color: #94a3b8;
}

/* ==========================================================================
   Auth Wall Screen (Google Docs Style Secure Login Portal)
   ========================================================================== */
.auth-wall-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 99999;
  background: radial-gradient(circle at 50% 20%, #1e293b 0%, #0f172a 60%, #020617 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.auth-wall-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 40px rgba(37, 99, 235, 0.15);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  animation: authWallFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authWallFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-wall-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.auth-wall-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-wall-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.auth-wall-desc {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.45;
  margin: 0;
}

.auth-wall-tabs {
  display: flex;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 20px;
  gap: 4px;
}

.auth-wall-tab-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-wall-tab-btn.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.auth-wall-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 18px;
  line-height: 1.4;
}

.auth-wall-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 18px;
  line-height: 1.4;
}

.auth-link {
  color: #60a5fa;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.15s;
}

.auth-link:hover {
  color: #93c5fd;
}

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

.auth-wall-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.auth-wall-form .form-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #ffffff;
  font-size: 14px;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-wall-form .form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.auth-wall-form .btn-primary {
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s, transform 0.1s;
}

.auth-wall-form .btn-primary:hover {
  background: #1d4ed8;
}

.auth-wall-form .btn-primary:active {
  transform: scale(0.99);
}

/* ==========================================================================
   Document Tabs Bar (Desktop Multi-Tab Document Switcher)
   ========================================================================== */
.diagram-tabs-bar {
  display: flex;
  align-items: center;
  background: #0f172a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 12px;
  height: 38px;
  min-height: 38px;
  gap: 6px;
  overflow: hidden;
  z-index: 40;
}

.tabs-scroll-container {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  height: 100%;
  flex-wrap: nowrap;
}

.tabs-scroll-container::-webkit-scrollbar {
  display: none;
}

.diagram-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 30px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: #94a3b8;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  max-width: 220px;
  flex-shrink: 0;
}

.diagram-tab:hover {
  background: rgba(51, 65, 85, 0.8);
  color: #f1f5f9;
}

.diagram-tab.active {
  background: #1e293b;
  color: #ffffff;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.15) rgba(255, 255, 255, 0.15) transparent rgba(255, 255, 255, 0.15);
  position: relative;
}

.diagram-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #3b82f6;
  border-radius: 2px 2px 0 0;
}

.diagram-tab .tab-icon {
  flex-shrink: 0;
  color: #3b82f6;
}

.diagram-tab .tab-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diagram-tab .tab-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  transition: background 0.15s, color 0.15s;
}

.diagram-tab .tab-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.diagram-tab.doc-tab {
  padding: 0 10px;
  min-width: 38px;
  justify-content: center;
}

.diagram-tab.doc-tab .tab-icon {
  color: #3b82f6;
  width: 15px;
  height: 15px;
}

.diagram-tab.doc-tab:hover .tab-icon {
  color: #60a5fa;
}

.diagram-tab.doc-tab.active .tab-icon {
  color: #60a5fa;
}

.tab-btn-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin-left: 2px;
}

.tab-btn-add:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
}

/* Mobile responsive tabs scaling */
@media (max-width: 768px) {
  .diagram-tabs-bar {
    height: 36px;
    min-height: 36px;
    padding: 0 8px;
  }
  .tabs-scroll-container {
    -webkit-overflow-scrolling: touch;
    gap: 3px;
  }
  .diagram-tab {
    height: 28px;
    padding: 0 8px;
    font-size: 11.5px;
    max-width: 130px;
    gap: 5px;
  }
  .diagram-tab.doc-tab {
    padding: 0 8px;
    min-width: 32px;
  }
  .tab-btn-add {
    width: 22px;
    height: 22px;
  }
}

/* Top Navbar Diagram Navigation Controls Group */
.diagram-nav-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.diagram-nav-controls .btn-nav {
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  box-sizing: border-box;
  flex-shrink: 0;
}

#btnOpenHistory {
  position: relative;
}

#historyCountBadge {
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  background-color: #2563eb;
  color: #ffffff;
  margin-left: 3px;
}

.nav-control-spacer {
  width: 14px;
  height: 1px;
}

/* Sidebar Navigation Toggles (Top bar) */
.sidebar-nav-toggle-btn {
  color: #94a3b8;
  padding: 6px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.sidebar-nav-toggle-btn:hover,
.sidebar-nav-toggle-btn.active {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.1);
}

/* Sidebar Edge Restore Tabs (Floating on workspace boundaries when collapsed) */
.sidebar-edge-tab {
  position: absolute;
  top: calc(60px + env(safe-area-inset-top, 0px));
  width: 22px;
  height: 36px;
  background: #ffffff;
  border: 1px solid var(--border-light, #e2e8f0);
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  transition: all 0.15s ease;
  padding: 0;
}
.sidebar-edge-tab:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}
.sidebar-edge-tab.edge-left {
  left: 0;
  border-left: none;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}
.sidebar-edge-tab.edge-right {
  right: 0;
  border-right: none;
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

/* User Profile Avatar-Only Button */
.btn-profile-avatar-only {
  padding: 2px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.btn-profile-avatar-only:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
}
.user-email-label {
  display: none !important;
}

/* Mobile Diagram Menu Drawer Panel & Burger Button */
.btn-mobile-burger {
  display: none;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 5px 7px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.btn-mobile-burger:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.mobile-menu-drawer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  justify-content: flex-end;
}
.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}
.mobile-menu-content {
  position: relative;
  width: 320px;
  max-width: 85vw;
  height: 100%;
  background: #ffffff;
  box-shadow: -4px 0 25px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 1;
  animation: slideInRight 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-menu-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mobile-menu-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: #0f172a;
}
.mobile-menu-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-light, #e2e8f0);
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  line-height: 1;
}
.mobile-menu-close-btn:hover,
.mobile-menu-close-btn:active {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}
.btn-close-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all 0.15s ease;
}
.btn-close-subtle:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.mobile-menu-status {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light, #e2e8f0);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}
.mobile-menu-body {
  padding: 12px 14px 32px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mobile-menu-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  padding: 6px 4px 2px 4px;
}
.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}
.mobile-menu-item:hover,
.mobile-menu-item:active {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.mobile-menu-item.active {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.mobile-menu-item.active .mobile-menu-item-text .primary {
  color: #1d4ed8;
}
.mobile-menu-item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.mobile-menu-item-text .primary {
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
}
.mobile-menu-item-text .secondary {
  font-size: 11px;
  color: #64748b;
  line-height: 1.2;
}
.mobile-menu-divider {
  border: none;
  border-top: 1px solid var(--border-light, #e2e8f0);
  margin: 6px 0;
}
.mobile-zoom-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.mobile-zoom-btn {
  flex: 1;
  padding: 6px 4px !important;
  font-size: 12px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.mobile-zoom-indicator {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  min-width: 44px;
  text-align: center;
}
.mobile-export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px 0;
}
.mobile-action-chip {
  padding: 8px 6px !important;
  font-size: 12px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* Header Undo/Redo Buttons: Distinct tactile buttons, darker when disabled, light when active */
.undo-redo-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.undo-redo-controls .btn-undo-redo {
  padding: 6px 10px;
  height: 32px;
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: rgba(255, 255, 255, 0.05);
  transition: all 0.15s ease;
}
.undo-redo-controls button:disabled,
#btnHeaderUndo:disabled,
#btnHeaderRedo:disabled {
  opacity: 0.22 !important;
  color: #334155 !important;
  border-color: rgba(255, 255, 255, 0.04) !important;
  background-color: rgba(255, 255, 255, 0.02) !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}
.undo-redo-controls button:not(:disabled),
#btnHeaderUndo:not(:disabled),
#btnHeaderRedo:not(:disabled) {
  opacity: 1 !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  background-color: rgba(255, 255, 255, 0.06) !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}
.undo-redo-controls button:not(:disabled):hover,
#btnHeaderUndo:not(:disabled):hover,
#btnHeaderRedo:not(:disabled):hover {
  background-color: rgba(255, 255, 255, 0.14) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

/* Nav Bar Simulation Button */
.btn-nav-sim {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-nav-sim.active,
#btnToggleSituationRunner.active {
  background-color: rgba(16, 185, 129, 0.18) !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #6ee7b7 !important;
}
.btn-nav-sim.active .sim-status-dot,
#btnToggleSituationRunner.active .sim-status-dot {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 1.2s infinite;
}

/* Cloud Drive Page Header */
.drive-page-header {
  padding: 16px 28px 4px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drive-page-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.3px;
  margin: 0;
}

/* Document Card 3-dot Kebab Menu */
.card-kebab-wrapper {
  position: relative;
  display: inline-flex;
  z-index: 20;
}

.btn-card-kebab {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.btn-card-kebab:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.card-kebab-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  right: 0;
  min-width: 175px;
  background: #ffffff;
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  padding: 4px;
  z-index: 1000;
  display: none;
}

.card-kebab-menu.show {
  display: block;
}

.card-kebab-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 12px;
  color: #334155;
  border-radius: 5px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.card-kebab-menu .dropdown-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.card-kebab-menu .dropdown-item svg {
  flex-shrink: 0;
}

/* Interactive Collaborator Avatars on Document Cards */
.collaborators-avatars-mini {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  transition: transform 0.15s;
}

.collaborators-avatars-mini:hover {
  transform: scale(1.08);
}

/* Custom In-App Validation Highlight */
.form-input.input-error,
.form-textarea.input-error,
.form-select.input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25) !important;
}

/* ==========================================================================
   ENTERPRISE ADMIN PORTAL & USER MANAGEMENT STYLES
   ========================================================================== */
.btn-admin-nav {
  color: #7c3aed !important;
  border-color: rgba(124, 58, 237, 0.3) !important;
  background: rgba(124, 58, 237, 0.08) !important;
}

.btn-admin-nav:hover {
  background: rgba(124, 58, 237, 0.18) !important;
  border-color: rgba(124, 58, 237, 0.5) !important;
}

.badge-admin-chip {
  background: rgba(124, 58, 237, 0.15) !important;
  color: #7c3aed !important;
  border: 1px solid rgba(124, 58, 237, 0.3) !important;
  font-weight: 600;
}

.admin-portal-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 16px;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.admin-tab:hover {
  color: #7c3aed;
}

.admin-tab.active {
  color: #7c3aed;
  border-bottom-color: #7c3aed;
}

.admin-tab-pane {
  display: none;
}

.admin-tab-pane.active {
  display: block;
}

.admin-table-container {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.admin-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background: #faf5ff;
}

.badge-role-admin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.badge-role-user {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.badge-status-active {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge-status-disabled {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.admin-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
}

.admin-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.admin-card-header {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.admin-card-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.admin-card-body {
  padding: 14px;
}

/* ==========================================================================
   ADMIN ELEMENT SUGGESTIONS POOL GRID & CARDS
   ========================================================================== */
.admin-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.suggestion-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.suggestion-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
}

.suggestion-card-header {
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.suggestion-card-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.suggestion-card-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.suggestion-card-count {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  background: #edf2f7;
  padding: 2px 7px;
  border-radius: 10px;
}

.suggestion-card-desc {
  padding: 8px 14px 4px 14px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

.suggestion-card-body {
  padding: 10px 14px 14px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.suggestion-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 48px;
  max-height: 220px;
  overflow-y: auto;
  padding: 2px;
}

.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  font-size: 12px;
  color: #1e293b;
  line-height: 1.25;
  transition: all 0.15s ease;
}

.suggestion-chip:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.suggestion-chip-text {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  transition: all 0.15s ease;
}

.suggestion-remove-btn:hover {
  background: #fee2e2;
  color: #ef4444;
}

.suggestion-add-row {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.suggestion-add-input {
  flex: 1;
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s;
}

.suggestion-add-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.suggestion-add-btn {
  font-size: 12px;
  padding: 6px 12px;
  font-weight: 600;
  color: #ffffff;
  background: #7c3aed;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.suggestion-add-btn:hover {
  background: #6d28d9;
}

/* ==========================================================================
   COMPANY DIRECTORY AUTOCOMPLETE & DOCUMENT ACCESS STYLING
   ========================================================================== */
.user-autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.user-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1050;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 12px 24px -4px rgba(15, 23, 42, 0.15), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
  max-height: 230px;
  overflow-y: auto;
  animation: modalPop 0.12s ease-out;
}

.user-autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background 0.15s ease;
}

.user-autocomplete-item:last-child {
  border-bottom: none;
}

.user-autocomplete-item:hover,
.user-autocomplete-item.active {
  background: #f8fafc;
}

.user-autocomplete-info {
  flex: 1;
  min-width: 0;
}

.user-autocomplete-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-autocomplete-email {
  font-size: 11px;
  color: #64748b;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-autocomplete-role {
  font-size: 10px;
  font-weight: 600;
  color: #6d28d9;
  background: #ede9fe;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Document Access User Cards in Permissions Table */
.perm-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.perm-user-meta {
  display: flex;
  flex-direction: column;
}

.perm-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.perm-user-email {
  font-size: 11px;
  color: #64748b;
  font-family: monospace;
}

.perm-user-role-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: #475569;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
  margin-top: 2px;
  width: fit-content;
}

.collaborators-avatars-mini {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
}

.collaborator-avatar-dot {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: -6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  background: transparent;
  vertical-align: middle;
  position: relative;
  z-index: 1;
  transition: transform 0.15s ease, z-index 0.15s ease;
}

.collaborator-avatar-dot:hover {
  transform: scale(1.18);
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

.collaborator-avatar-dot:first-child {
  margin-left: 0;
}

.collaborator-avatar-dot .avatar,
.collaborator-avatar-dot .avatar-img {
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.author-avatar-wrap {
  width: 26px;
  height: 26px;
  min-width: 26px;
  min-height: 26px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.author-avatar-wrap .avatar,
.author-avatar-wrap .avatar-img {
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
}

.gdrive-user-avatar-wrap {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.gdrive-user-avatar-wrap .avatar,
.gdrive-user-avatar-wrap .avatar-img {
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
}

.user-autocomplete-avatar-wrap {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-autocomplete-avatar-wrap .avatar,
.user-autocomplete-avatar-wrap .avatar-img {
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
}

/* User Profile & Avatar Styles */
.avatar-preset-chip {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.avatar-preset-chip:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  transform: scale(1.1);
}

.avatar-preset-chip.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
  transform: scale(1.12);
}

.avatar,
.avatar-sm,
.avatar-lg,
.avatar-img,
.avatar-preview-box,
.collaborator-avatar-dot {
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  flex-shrink: 0 !important;
}

.avatar-img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  display: block !important;
  flex-shrink: 0 !important;
}

.admin-user-row-clickable {
  cursor: pointer;
  transition: background 0.12s ease;
}

.admin-user-row-clickable:hover td {
  background-color: #f8fafc;
}

.profile-avatar-editor {
  background: #f8fafc;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.avatar-preview-box {
  width: 72px;
  height: 72px;
  font-size: 28px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   GOOGLE DRIVE SHARING MODAL DESIGN & STYLING
   ========================================================================== */
.gdrive-share-modal {
  width: 540px !important;
  max-width: 95vw !important;
  border-radius: 20px !important;
  background: #ffffff !important;
  box-shadow: 0 20px 40px -8px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #1f2937;
  font-family: inherit;
}

.gdrive-share-header {
  padding: 22px 24px 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: none;
}

.gdrive-share-title-wrap {
  flex: 1;
  min-width: 0;
}

.gdrive-share-title {
  font-size: 20px !important;
  font-weight: 500 !important;
  color: #1f2937 !important;
  margin: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

.gdrive-share-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.gdrive-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #5f6368;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  font-size: 16px;
  padding: 0;
}

.gdrive-icon-btn:hover {
  background: #f1f3f4;
  color: #1f2937;
}

.gdrive-share-body {
  padding: 0 24px 12px 24px;
  max-height: calc(85vh - 145px);
  overflow-y: auto;
}

/* Outlined Search Box */
.gdrive-search-box-wrap {
  position: relative;
  margin-top: 4px;
  margin-bottom: 12px;
}

.gdrive-search-box {
  border: 1px solid #747775;
  border-radius: 8px;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  align-items: center;
}

.gdrive-search-box:focus-within {
  border-color: #0b57d0;
  box-shadow: 0 0 0 1px #0b57d0;
}

.gdrive-search-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: #1f2937;
  font-family: inherit;
}

.gdrive-search-input::placeholder {
  color: #444746;
  opacity: 1;
}

.gdrive-autocomplete {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
  background: #ffffff;
  z-index: 1200;
  max-height: 230px;
  overflow-y: auto;
}

/* Active Inviting / Add Panel */
.gdrive-invite-panel {
  border: 1px solid #c4c7c5;
  border-radius: 8px;
  padding: 12px 14px;
  background: #f8fafc;
  margin-bottom: 14px;
  animation: modalPop 0.12s ease-out;
}

.gdrive-invite-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.gdrive-recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #e8f0fe;
  color: #0b57d0;
  border-radius: 9999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 500;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-chip-remove {
  border: none;
  background: transparent;
  color: #0b57d0;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  line-height: 1;
}

.btn-chip-remove:hover {
  color: #d93025;
}

.gdrive-invite-selectors {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gdrive-role-dropdown {
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
  cursor: pointer;
  outline: none;
}

.gdrive-role-dropdown:focus {
  border-color: #0b57d0;
}

.gdrive-sub-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.gdrive-sub-label {
  font-size: 12px;
  font-weight: 500;
  color: #64748b;
  min-width: 55px;
}

.gdrive-message-wrap {
  margin-bottom: 10px;
}

.gdrive-message-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  background: #ffffff;
  color: #1f2937;
  outline: none;
}

.gdrive-message-input:focus {
  border-color: #0b57d0;
}

.gdrive-invite-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.btn-gdrive-cancel {
  height: 34px;
  padding: 0 16px;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: #5f6368;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-gdrive-cancel:hover {
  background: #f1f3f4;
  color: #1f2937;
}

.btn-gdrive-send {
  height: 34px;
  padding: 0 20px;
  border-radius: 9999px;
  border: none;
  background: #0b57d0;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-gdrive-send:hover {
  background: #0842a0;
}

/* Section Styling */
.gdrive-section {
  margin-top: 20px;
}

.gdrive-section-title {
  font-size: 14px !important;
  font-weight: 500 !important;
  color: #1f2937 !important;
  margin: 0 0 10px 0 !important;
}

/* People with access list */
.gdrive-user-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gdrive-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  gap: 12px;
}

.gdrive-user-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.gdrive-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.gdrive-user-name {
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gdrive-user-email {
  font-size: 12px;
  color: #5f6368;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gdrive-user-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.gdrive-owner-label {
  font-size: 13px;
  color: #5f6368;
  padding-right: 10px;
  font-weight: 400;
}

.gdrive-collaborator-role-select {
  border: 1px solid transparent;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: #1f2937;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.gdrive-collaborator-role-select:hover {
  background: #f1f3f4;
}

.gdrive-collaborator-role-select:focus {
  border-color: #0b57d0;
  background: #ffffff;
}

/* General access row */
.gdrive-general-access-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}

.gdrive-general-access-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f3f4;
  color: #444746;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gdrive-general-access-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.gdrive-general-access-header {
  display: flex;
  align-items: center;
}

.gdrive-access-selector {
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
  cursor: pointer;
  padding: 0;
  outline: none;
  width: fit-content;
}

.gdrive-access-selector:hover {
  text-decoration: underline;
}

.gdrive-general-access-desc {
  font-size: 12px;
  color: #5f6368;
  margin-top: 2px;
}

/* Footer Action Bar */
.gdrive-share-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 22px 24px;
  background: #ffffff;
  border-top: none;
}

.btn-gdrive-copy-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: 9999px;
  border: 1px solid #747775;
  background: transparent;
  color: #0b57d0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-gdrive-copy-link:hover {
  background: #f0f7ff;
  border-color: #0b57d0;
}

.btn-gdrive-done {
  height: 36px;
  padding: 0 24px;
  border-radius: 9999px;
  border: none;
  background: #0b57d0;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.btn-gdrive-done:hover {
  background: #0842a0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

/* ==========================================================================
   ADMIN PORTAL TAB VIEW & DRAGGABLE TAB REORDERING STYLES
   ========================================================================== */
.admin-portal-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  background: var(--bg-main, #f8fafc);
  padding: 24px 20px;
  min-height: 0;
}

.admin-portal-container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid var(--border-light, #e2e8f0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 24px;
}

.admin-portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-portal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-light, #e2e8f0);
  padding-top: 16px;
  margin-top: 20px;
}

/* Admin Tab Styling in Top Tab Bar */
.diagram-tab.admin-tab-item {
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.25);
  background: rgba(124, 58, 237, 0.03);
}

.diagram-tab.admin-tab-item:hover {
  background: rgba(124, 58, 237, 0.09);
  color: #6d28d9;
}

.diagram-tab.admin-tab-item.active {
  color: #7c3aed !important;
  background: #ffffff !important;
  border-bottom: 2px solid #7c3aed !important;
  font-weight: 600;
}

.diagram-tab.admin-tab-item.active .tab-icon {
  stroke: #7c3aed !important;
}

.tab-title-admin {
  color: #7c3aed !important;
  font-weight: 600 !important;
}

/* Draggable Tabs to Reorder */
.diagram-tab[draggable="true"] {
  cursor: grab;
  user-select: none;
}

.diagram-tab[draggable="true"]:active {
  cursor: grabbing;
}

.diagram-tab.tab-dragging {
  opacity: 0.45;
  cursor: grabbing;
  transform: scale(0.97);
}

.diagram-tab.drop-target-left {
  border-left: 3px solid var(--primary, #2563eb) !important;
}

.diagram-tab.drop-target-right {
  border-right: 3px solid var(--primary, #2563eb) !important;
}

.diagram-tab.admin-tab-item.drop-target-left {
  border-left: 3px solid #7c3aed !important;
}

.diagram-tab.admin-tab-item.drop-target-right {
  border-right: 3px solid #7c3aed !important;
}

