:root {
  --bg-base: #060913;
  --bg-elevated: rgba(15, 23, 42, 0.72);
  --bg-glass: rgba(17, 25, 45, 0.65);
  --bg-glass-hover: rgba(30, 41, 69, 0.78);
  --bg-input: rgba(10, 15, 29, 0.75);
  --border-subtle: rgba(148, 163, 184, 0.14);
  --border-glow: rgba(99, 102, 241, 0.45);
  --text-main: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-2: #06b6d4;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --shadow-card: 0 12px 32px -4px rgba(0, 0, 0, 0.45), inset 0 1px 0 0 rgba(255, 255, 255, 0.07);
  --shadow-neon: 0 0 24px rgba(99, 102, 241, 0.38);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

[data-theme="light"] {
  --bg-base: #eef2f9;
  --bg-elevated: rgba(255, 255, 255, 0.86);
  --bg-glass: rgba(255, 255, 255, 0.78);
  --bg-glass-hover: rgba(241, 245, 249, 0.95);
  --bg-input: rgba(248, 250, 252, 0.92);
  --border-subtle: rgba(15, 23, 42, 0.09);
  --border-glow: rgba(79, 70, 229, 0.4);
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-2: #0284c7;
  --shadow-card: 0 10px 28px -6px rgba(15, 23, 42, 0.07), inset 0 1px 0 0 rgba(255, 255, 255, 0.8);
  --shadow-neon: 0 6px 20px rgba(79, 70, 229, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-main);
  font-size: 13.5px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

code, pre, .mono {
  font-family: 'JetBrains Mono', monospace;
}

.hidden { display: none !important; }

/* Ambient Mesh Background */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.32;
  animation: floatOrb 18s ease-in-out infinite alternate;
}

[data-theme="light"] .orb { opacity: 0.18; }

.orb-1 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #6366f1, transparent 70%);
  top: -140px;
  left: -100px;
}

.orb-2 {
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, #06b6d4, transparent 70%);
  bottom: -120px;
  right: 8%;
  animation-delay: -6s;
}

.orb-3 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, #10b981, transparent 70%);
  top: 35%;
  left: 42%;
  animation-delay: -11s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(35px, -25px) scale(1.08); }
}

/* App Shell */
.layout-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

.layout-shell.locked {
  filter: blur(18px);
  pointer-events: none;
  user-select: none;
  height: 100vh;
  overflow: hidden;
}

/* Full-Screen Login Gate */
.login-gate {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(6, 9, 19, 0.84);
  backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 420px;
  max-width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-glow);
  border-radius: 20px;
  padding: 28px 26px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75), var(--shadow-neon);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.login-brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.login-brand p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-submit {
  width: 100%;
  justify-content: center;
  padding: 11px;
  font-size: 14px;
  margin-top: 4px;
}

.login-error {
  background: rgba(244, 63, 94, 0.16);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #fb7185;
  padding: 8px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
}

.login-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.login-footer svg { width: 13px; height: 13px; }

/* Left Glass Sidebar */
.sidebar {
  background: var(--bg-elevated);
  backdrop-filter: blur(22px);
  border-right: 1px solid var(--border-subtle);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-logo {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-neon);
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--text-main), #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 10px 2px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }

.nav-item:hover {
  background: var(--bg-glass-hover);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.22), rgba(6, 182, 212, 0.08));
  border-color: var(--border-glow);
  color: var(--text-main);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.16);
}

.nav-item.active svg { color: #818cf8; }

.nav-pill {
  margin-left: auto;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.nav-pill.warn {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.sidebar-spacer { flex: 1; }

/* Health Card */
.health-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 6px;
}

.health-top {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.health-bar {
  height: 6px;
  background: rgba(148, 163, 184, 0.16);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}

.health-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #10b981);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.health-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

/* Sidebar User Switcher */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.18s ease;
}

.sidebar-user:hover {
  border-color: var(--border-glow);
  background: var(--bg-glass-hover);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #ec4899);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-badge { font-size: 11px; color: #818cf8; font-weight: 600; }
.user-chevron { width: 15px; height: 15px; color: var(--text-muted); }

/* Workspace & Topbar */
.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: var(--bg-elevated);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 400;
}

.topbar-search {
  position: relative;
  flex: 1;
  max-width: 520px;
}

.topbar-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.topbar-search input {
  width: 100%;
  padding: 9px 36px 9px 38px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.topbar-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.kbd-hint {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  transition: all 0.18s ease;
  text-decoration: none;
}

.btn svg { width: 15px; height: 15px; }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }

.btn-primary-neon {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 60%, #0ea5e9 100%);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  box-shadow: var(--shadow-neon);
}

.btn-primary-neon:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn-glow-subtle {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.35);
  color: #a5b4fc;
}

[data-theme="light"] .btn-glow-subtle { color: #4338ca; }
.btn-glow-subtle.active {
  background: #6366f1;
  color: #fff;
}

.btn-glass, .btn-icon-glass {
  background: var(--bg-glass);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-icon-glass { padding: 8px; }
.btn-glass:hover, .btn-icon-glass:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glow);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.45);
  color: #fb7185;
}
.btn-danger:hover { background: var(--rose); color: #fff; }

/* Filter Ribbon */
.filter-ribbon {
  padding: 10px 24px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-chip-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-icon { width: 15px; height: 15px; color: var(--text-muted); margin-right: 4px; }

.filter-chip-group select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: inherit;
  font-size: 12.5px;
  max-width: 195px;
}

.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 5px 8px;
}
.btn-reset:hover { color: var(--text-main); }
.btn-reset svg { width: 14px; height: 14px; }

.active-role-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.active-role-banner.readonly {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.active-role-banner svg { width: 13px; height: 13px; }

/* Draw Banner */
.draw-banner {
  margin: 12px 24px 0;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.2), rgba(99, 102, 241, 0.2));
  border: 1px solid rgba(245, 158, 11, 0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.draw-banner-text { display: flex; align-items: center; gap: 10px; }

/* Content Area */
.content-area {
  padding: 20px 24px 36px;
  flex: 1;
}

.view { display: none; animation: fadeIn 0.22s ease; }
.view.active { display: block; }

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

/* KPI Strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(165px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-tile {
  position: relative;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-tile::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--tile-color, #6366f1);
}

.kpi-tile.accent-cyan { --tile-color: #06b6d4; }
.kpi-tile.accent-blue { --tile-color: #3b82f6; }
.kpi-tile.accent-amber { --tile-color: #f59e0b; }
.kpi-tile.accent-purple { --tile-color: #8b5cf6; }
.kpi-tile.accent-emerald { --tile-color: #10b981; }

.kpi-tile.clickable { cursor: pointer; }
.kpi-tile.clickable:hover {
  transform: translateY(-3px);
  border-color: var(--tile-color);
}

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--tile-color);
  display: grid;
  place-items: center;
}

.kpi-icon svg { width: 17px; height: 17px; }

.kpi-num {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 6px 0 2px;
}

.kpi-foot {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Bento Grid (Map + 4 Charts) */
.bento-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.panel-header.compact { padding: 11px 15px; }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.panel-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-secondary); }
.panel-hint { font-size: 11px; color: var(--text-muted); }

.map-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.color-selector select {
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
  font-size: 12px;
}

.map-stage {
  position: relative;
  flex: 1;
  min-height: 560px;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 560px;
  z-index: 1;
}

.glass-legend {
  position: absolute;
  bottom: 14px;
  left: 14px;
  z-index: 400;
  background: var(--bg-elevated);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 13px;
  box-shadow: var(--shadow-card);
  max-height: 220px;
  overflow-y: auto;
  font-size: 11.5px;
  min-width: 175px;
}

.legend-title { font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); margin-bottom: 6px; }
.legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }

.analytics-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.chart-panel { min-height: 278px; }
.chart-stage {
  position: relative;
  flex: 1;
  padding: 10px 12px;
  min-height: 220px;
}

/* Neo Tables */
.table-container {
  overflow-x: auto;
  max-height: 68vh;
  overflow-y: auto;
}

.neo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.neo-table th {
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  white-space: nowrap;
  z-index: 2;
}

.neo-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.neo-table tbody tr {
  transition: background 0.14s ease;
}

.neo-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.09);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.row-actions { display: flex; gap: 5px; }

/* Planning & Matrix */
.stack-grid { display: flex; flex-direction: column; gap: 16px; }
.matrix-wrap { padding: 16px; overflow-x: auto; }
.matrix-table { width: 100%; border-collapse: collapse; text-align: center; }
.matrix-table th, .matrix-table td { padding: 10px 12px; border: 1px solid var(--border-subtle); }
.matrix-table th { background: rgba(148, 163, 184, 0.08); font-weight: 700; }
.matrix-cell { cursor: pointer; font-weight: 700; transition: transform 0.12s; }
.matrix-cell:hover { transform: scale(1.03); }

/* Quality */
.quality-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.quality-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 600;
}

/* Users & Cloudflare View */
.users-cloud-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  align-items: start;
}

.role-cards-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.role-explain-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 10px 12px;
}

.role-explain-card .role-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 12.5px;
  margin-bottom: 4px;
}
.role-explain-card .role-title svg { width: 15px; height: 15px; }
.role-explain-card p { margin: 0; font-size: 11.5px; color: var(--text-secondary); }

.cf-box { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.cf-step { display: flex; gap: 12px; align-items: flex-start; }
.cf-num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.cf-step p { margin: 3px 0 0; font-size: 12px; color: var(--text-secondary); }
.code-snippet {
  margin: 6px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: #38bdf8;
  overflow-x: auto;
}

.audit-list {
  padding: 12px 18px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-item {
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

/* Drawer */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 95vw;
  height: 100vh;
  background: var(--bg-elevated);
  backdrop-filter: blur(24px);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.5);
  z-index: 900;
  display: flex;
  flex-direction: column;
}

.drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.drawer-kicker { font-size: 11px; text-transform: uppercase; font-weight: 700; color: #818cf8; }
.drawer-header h2 { margin: 4px 0 0; font-size: 17px; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-item {
  background: var(--bg-input);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}
.detail-item.full { grid-column: 1 / -1; }
.detail-label { font-size: 10.5px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }
.detail-val { font-size: 13px; font-weight: 600; margin-top: 3px; word-break: break-word; }
.drawer-footer { padding: 14px 20px; border-top: 1px solid var(--border-subtle); display: flex; gap: 10px; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--bg-elevated);
  backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  width: 840px;
  max-width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.modal.modal-sm { width: 480px; }

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

.modal-header h2 { margin: 0; font-size: 17px; }
.modal-sub { font-size: 12px; color: var(--text-secondary); }
.modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }

.form-section { margin-bottom: 18px; }
.form-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #818cf8;
  margin: 0 0 10px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 5px;
}

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.span-2 { grid-column: span 2; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
}

.geom-box {
  margin-top: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px dashed var(--border-glow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.geom-info { display: flex; align-items: center; gap: 8px; }
.geom-actions { display: flex; gap: 8px; }

.modal-footer {
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

.spacer { flex: 1; }

/* User switcher cards in modal */
.user-switch-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.user-switch-option:hover, .user-switch-option.active {
  border-color: var(--border-glow);
  background: rgba(99, 102, 241, 0.14);
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-elevated);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glow);
  color: var(--text-main);
  padding: 11px 16px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-card);
}

.toast.success { border-color: var(--emerald); color: #34d399; }
.toast.error { border-color: var(--rose); color: #fb7185; }

@media (max-width: 1240px) {
  .layout-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .bento-grid, .users-cloud-grid { grid-template-columns: 1fr; }
}
