/* ══ RESET ══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
:root {
  --nav-h:    52px;
  --sb-w:     224px;
  --bg:       #0e0f11;
  --surface:  #13151a;
  --card:     #1c1f25;
  --border:   #2a2d36;
  --text:     #e8eaf0;
  --muted:    #6b7280;
  --accent:   #f59e0b;
  --accent-h: #d97706;
  --danger:   #ef4444;
  --success:  #22c55e;
}
body { display:flex; flex-direction:column; background:var(--bg); color:var(--text); font-family:'Segoe UI',system-ui,sans-serif; font-size:13px; }
.hidden { display:none !important; }

/* ══ NAVBAR ════════════════════════════════════════════ */
#navbar {
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 14px 0 10px; gap: 12px;
  flex-shrink: 0; z-index: 300;
  box-shadow: 0 1px 10px rgba(0,0,0,.35);
}
/* navbar only has hamburger + brand now */

#sidebar-toggle {
  background:none; border:1px solid var(--border);
  border-radius:6px; width:34px; height:34px;
  cursor:pointer; display:flex; align-items:center;
  justify-content:center; flex-shrink:0; transition:border-color .2s;
}
#sidebar-toggle:hover { border-color:var(--accent); }
.hamburger { display:flex; flex-direction:column; gap:4px; width:15px; }
.hamburger span { display:block; height:2px; background:var(--muted); border-radius:2px; transition:background .2s; }
#sidebar-toggle:hover .hamburger span { background:var(--accent); }

.brand          { display:flex; align-items:center; gap:10px; }
.brand-logo-img { width:30px; height:30px; object-fit:contain; border-radius:6px; flex-shrink:0; }
.brand-name     { font-weight:900; font-size:15px; color:var(--text); letter-spacing:2px; text-transform:uppercase; }

.view-toggle { display:flex; background:var(--card); border:1px solid var(--border); border-radius:8px; padding:3px; gap:3px; }
.toggle-btn  { padding:5px 16px; border-radius:6px; border:none; background:transparent; color:var(--muted); font-size:12px; font-weight:700; cursor:pointer; font-family:inherit; transition:all .2s; white-space:nowrap; }
.toggle-btn.active { background:var(--accent); color:#000; }
.toggle-btn:not(.active):hover { color:var(--text); }


/* ══ MAP TOOLBAR ══════════════════════════════════════════ */
#map-toolbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100% - 24px);
}

/* ── Row 1 ── */
#toolbar-main {
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: all;
  background: rgba(13,14,17,.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 5px 6px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  height: 44px;
}

/* Pill toggle (Outdoor/Indoor, Preview/Edit) */
.tb-pill {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.tb-pill-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: 6px; border: none;
  background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: all .2s; white-space: nowrap;
}
.tb-pill-btn svg { flex-shrink: 0; }
.tb-pill-btn.active { background: var(--accent); color: #000; }
.tb-pill-btn:not(.active):hover { color: var(--text); }

/* Separator */
.tb-sep {
  width: 1px; height: 24px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* Recenter button */
.tb-icon-btn {
  width: 34px; height: 34px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; color: var(--muted);
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; font-family: inherit;
  transition: all .15s; flex-shrink: 0;
}
.tb-icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Zoom group */
.tb-zoom {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.tb-zoom-btn {
  width: 34px; height: 34px;
  background: transparent; border: none;
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; font-family: inherit;
}
.tb-zoom-btn:hover { background: var(--border); color: var(--text); }
.tb-zoom-sep { width: 1px; background: var(--border); flex-shrink: 0; }

/* ── Row 2: Edit panel ── */
#toolbar-edit {
  pointer-events: all;
  background: rgba(13,14,17,.96);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  max-width: 100%;
}
.edit-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}
.edit-group { display: flex; flex-direction: column; gap: 5px; }
.edit-group-label {
  font-size: 9px; font-weight: 800;
  letter-spacing: 1px; color: var(--muted);
  text-transform: uppercase;
}
.edit-tools { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.edit-divider { width: 1px; min-height: 54px; background: var(--border); flex-shrink: 0; align-self: stretch; margin: 0 2px; }

/* Tool buttons */
.tool-btn {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 10px;
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; font-family: inherit;
  transition: all .15s; white-space: nowrap;
}
.tool-btn svg { flex-shrink: 0; color: inherit; }
.tool-btn:hover, .tool-btn.active {
  border-color: var(--accent); color: var(--accent);
  background: rgba(245,158,11,.08);
}
.tool-btn-danger { color: var(--danger) !important; border-color: rgba(239,68,68,.35) !important; }
.tool-btn-danger:hover { background: var(--danger) !important; color: #fff !important; border-color: var(--danger) !important; }
.add-zone-tool { border-style: dashed; }

/* Zone quick list */
#zone-quick-list { display: flex; gap: 4px; flex-wrap: wrap; }
.zone-quick-btn {
  display: flex; align-items: center; gap: 5px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 9px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  font-family: inherit; color: var(--text); transition: all .15s;
}
.zone-quick-btn:hover { border-color: var(--accent); color: var(--accent); }
.zone-quick-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Floating panels anchored over map */
.map-float-panel {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  width: 280px;
  box-shadow: 0 10px 36px rgba(0,0,0,.6);
  backdrop-filter: blur(8px);
}
.map-float-panel input[type="text"] {
  width: 100%; background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 13px;
  font-family: inherit; padding: 8px 10px; outline: none;
  text-transform: uppercase; font-weight: 700; margin-bottom: 8px;
  transition: border-color .2s;
}
.map-float-panel input[type="text"]:focus { border-color: var(--accent); }

/* ══ LAYOUT ════════════════════════════════════════════ */
#layout { flex:1; display:flex; overflow:hidden; min-height:0; }

/* ══ SIDEBAR ═══════════════════════════════════════════ */
#sidebar {
  width: 180px;
  min-width: 52px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width .25s cubic-bezier(.4,0,.2,1);
  z-index: 100;
}
/* Collapsed: icon-only strip — never fully hidden */
#sidebar.collapsed { width: 52px; }
#sidebar.collapsed .sb-tab {
  justify-content: center;
  padding: 0;
  margin: 4px auto;
  width: 40px;
  height: 40px;
  border-color: transparent;
  border-radius: 8px;
  gap: 0;
}
#sidebar.collapsed .sb-tab.active {
  background: rgba(245,158,11,.12);
  border-color: rgba(245,158,11,.3);
}
#sidebar.collapsed .sb-tab-label { display: none; }
#sidebar.collapsed .sb-tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#sidebar-inner {
  width: 100%;
  flex: 1; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
  padding-top: 8px;
}
#sidebar-inner::-webkit-scrollbar { width:3px; }
#sidebar-inner::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }

.sb-section-title {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 16px 4px;
  white-space: nowrap;
  overflow: hidden;
}
/* Hide section titles when sidebar is collapsed */
#sidebar.collapsed .sb-section-title { display: none; }

.sb-tab {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  border: 1px solid transparent;
  transition: all .15s;
  user-select: none;
  width: calc(100% - 16px);
}
.sb-tab:hover {
  color: var(--text);
  background: var(--card);
  border-color: var(--border);
}
.sb-tab.active {
  color: var(--accent);
  background: rgba(245,158,11,.08);
  border-color: rgba(245,158,11,.3);
}
.sb-tab-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}
.sb-tab-icon svg { display: block; }
.sb-tab-label {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  color: inherit;
}

.sb-section { border-bottom:1px solid var(--border); padding:12px; }
.sb-footer  { margin-top:auto; border-bottom:none; }

.sb-section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.sb-label { font-size:9px; font-weight:800; letter-spacing:1.2px; color:var(--muted); text-transform:uppercase; margin-bottom:8px; display:block; }
.sb-section-header .sb-label { margin-bottom:0; }

/* ══ TOOLS ═════════════════════════════════════════════ */
.tool-grid { display:grid; grid-template-columns:1fr 1fr; gap:5px; }
.tool-btn  { background:var(--card); border:1px solid var(--border); border-radius:7px; padding:8px 4px 7px; color:#9ca3af; cursor:pointer; display:flex; flex-direction:column; align-items:center; gap:3px; font-size:10px; font-weight:700; font-family:inherit; transition:all .15s; }
.tool-btn:hover, .tool-btn.active { border-color:var(--accent); color:var(--accent); background:rgba(245,158,11,.08); }
.tool-icon { font-size:16px; }

/* ══ ZONES ═════════════════════════════════════════════ */
.add-zone-btn { background:var(--card); border:1px solid var(--border); border-radius:5px; color:var(--accent); font-size:11px; font-weight:700; padding:2px 8px; cursor:pointer; font-family:inherit; transition:all .15s; }
.add-zone-btn:hover { background:rgba(245,158,11,.1); }

#new-zone-form { background:var(--card); border:1px solid var(--border); border-radius:7px; padding:9px; margin-bottom:8px; }
#new-zone-form input[type="text"] { width:100%; background:var(--bg); border:1px solid var(--border); border-radius:5px; color:var(--text); font-size:12px; font-weight:700; padding:6px 8px; outline:none; font-family:inherit; text-transform:uppercase; margin-bottom:7px; }
#new-zone-form input[type="text"]:focus { border-color:var(--accent); }

.zone-color-row { display:flex; align-items:center; gap:5px; margin-bottom:6px; flex-wrap:wrap; }
.color-swatches { display:flex; gap:4px; flex-wrap:wrap; }
.swatch { width:16px; height:16px; border-radius:50%; cursor:pointer; border:2px solid transparent; transition:border-color .15s, transform .15s; flex-shrink:0; }
.swatch:hover { transform:scale(1.2); }
.swatch.active { border-color:#fff; }
#zone-color-custom { width:20px; height:20px; border:none; background:none; cursor:pointer; border-radius:4px; flex-shrink:0; }

#zone-list { display:flex; flex-direction:column; gap:4px; margin-bottom:6px; }
.zone-row { display:flex; align-items:center; gap:6px; background:var(--card); border:1px solid var(--border); border-radius:6px; padding:6px 7px; }
.zone-dot { width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.zone-name { flex:1; font-size:10px; font-weight:700; color:var(--text); letter-spacing:.4px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.zone-name.undrawn { color:#4b5563; font-style:italic; }
.zone-actions { display:flex; gap:2px; flex-shrink:0; }
.zone-btn { background:none; border:1px solid var(--border); border-radius:4px; color:var(--muted); font-size:10px; padding:2px 4px; cursor:pointer; font-family:inherit; transition:all .15s; }
.zone-btn:hover { border-color:var(--accent); color:var(--accent); }
.zone-btn.danger:hover { border-color:var(--danger); color:var(--danger); }

#zone-draw-bar { background:var(--card); border:1px solid var(--border); border-radius:7px; padding:9px; margin-bottom:6px; }
#zone-draw-status { font-size:11px; font-weight:700; margin-bottom:5px; line-height:1.4; }

/* ══ UPLOAD / LEGEND / FOOTER ══════════════════════════ */
.upload-btn { display:block; width:100%; padding:8px; background:var(--card); border:1px dashed var(--border); border-radius:7px; color:#9ca3af; cursor:pointer; text-align:center; font-size:11px; font-weight:600; transition:all .2s; margin-bottom:4px; }
.upload-btn:hover { border-color:var(--accent); color:var(--accent); }
.hint-small { font-size:10px; color:#4b5563; }

.legend { display:flex; flex-direction:column; gap:6px; }
.legend-row { display:flex; align-items:center; gap:8px; font-size:11px; color:#9ca3af; }
.dot { width:9px; height:9px; border-radius:50%; flex-shrink:0; }
.dot.cam    { background:#ef4444; } .dot.wifi  { background:#3b82f6; }
.dot.switch { background:#8b5cf6; } .dot.router{ background:#06b6d4; }
.dot.server { background:#f97316; } .dot.panel { background:#f59e0b; }
.dot.access { background:#10b981; } .dot.other { background:#6b7280; }
.dot.tag    { background:#fff; border:1px solid #4b5563; }

.danger-btn { width:100%; background:transparent; border:1px solid rgba(239,68,68,.4); color:var(--danger); border-radius:6px; padding:8px; cursor:pointer; font-size:11px; font-weight:700; font-family:inherit; transition:all .2s; }
.danger-btn:hover { background:var(--danger); color:#fff; border-color:var(--danger); }

/* ══ MAP ════════════════════════════════════════════════ */
#map-wrapper  { flex:1; position:relative; overflow:hidden; min-width:0; min-height:0; }
#outdoor-view { position:absolute; inset:0; }
#indoor-view  { position:absolute; inset:0; }
#leaflet-map  { width:100%; height:100%; }

/* Recenter button on map */
#btn-recenter-map {
  position:absolute; bottom:90px; right:10px; z-index:500;
  background:var(--surface); border:1px solid var(--border);
  color:var(--text); border-radius:8px; padding:8px 14px;
  font-size:12px; font-weight:700; font-family:inherit;
  cursor:pointer; box-shadow:0 4px 14px rgba(0,0,0,.4);
  transition:all .2s; white-space:nowrap;
}
#btn-recenter-map:hover { border-color:var(--accent); color:var(--accent); }

#indoor-view { width:100%; height:100%; background:var(--bg); background-image:linear-gradient(rgba(255,255,255,.016) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.016) 1px,transparent 1px); background-size:36px 36px; position:relative; overflow:hidden; cursor:crosshair; }
#floor-container { position:relative; display:inline-block; transform-origin:top left; user-select:none; }
#map-canvas, #map-img { display:block; max-width:none; }
#markers-layer { position:absolute; top:0; left:0; width:100%; height:100%; pointer-events:none; }
#no-map-hint { position:absolute; bottom:24px; left:50%; transform:translateX(-50%); color:#374151; font-size:13px; font-style:italic; pointer-events:none; white-space:nowrap; }
/* indoor zoom now handled by toolbar buttons */

/* ══ MARKERS ════════════════════════════════════════════ */
.imarker { position:absolute; transform:translate(-50%,-50%); pointer-events:all; cursor:grab; z-index:5; display:flex; flex-direction:column; align-items:center; gap:3px; }
.imarker-circle { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:14px; box-shadow:0 2px 10px rgba(0,0,0,.5); border:2.5px solid rgba(255,255,255,.2); transition:transform .15s, box-shadow .15s; position:relative; }
.imarker:hover .imarker-circle { transform:scale(1.12); box-shadow:0 4px 16px rgba(0,0,0,.6); }
.imarker[data-status="active"] .imarker-circle::after { content:''; position:absolute; inset:-5px; border-radius:50%; border:2px solid currentColor; opacity:.25; animation:pulse 2s infinite; }
@keyframes pulse { 0%,100%{transform:scale(1);opacity:.25;}50%{transform:scale(1.15);opacity:.08;} }
.imarker[data-status="inactive"] .imarker-circle { opacity:.4; filter:grayscale(.6); }
.imarker[data-status="planned"]  .imarker-circle { border-style:dashed; opacity:.7; }
.imarker[data-type="camera"] .imarker-circle { background:#ef4444; color:#fff; }
.imarker[data-type="wifi"]   .imarker-circle { background:#3b82f6; color:#fff; }
.imarker[data-type="switch"] .imarker-circle { background:#8b5cf6; color:#fff; }
.imarker[data-type="router"] .imarker-circle { background:#06b6d4; color:#fff; }
.imarker[data-type="server"] .imarker-circle { background:#f97316; color:#fff; }
.imarker[data-type="panel"]  .imarker-circle { background:#f59e0b; color:#000; }
.imarker[data-type="access"] .imarker-circle { background:#10b981; color:#fff; }
.imarker[data-type="other"]  .imarker-circle { background:#6b7280; color:#fff; }
.imarker-label { background:rgba(14,15,17,.88); color:var(--text); font-size:10px; font-weight:700; padding:2px 6px; border-radius:4px; white-space:nowrap; max-width:130px; overflow:hidden; text-overflow:ellipsis; border:1px solid rgba(255,255,255,.07); }
.imarker-tag { background:rgba(0,0,0,.72); color:#fff; font-size:12px; font-weight:700; padding:3px 10px; border-radius:5px; white-space:nowrap; border:1px solid rgba(255,255,255,.13); }

.leaflet-marker-draggable { cursor:grab !important; }
.leaflet-marker-draggable:active { cursor:grabbing !important; }
.lmarker-wrap { display:flex; flex-direction:column; align-items:center; gap:2px; }
.lmarker-circle { width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:14px; box-shadow:0 2px 10px rgba(0,0,0,.45); border:2px solid rgba(255,255,255,.25); }
.lmarker-label { background:rgba(0,0,0,.82); color:#fff; font-size:10px; font-weight:700; padding:2px 6px; border-radius:4px; white-space:nowrap; max-width:120px; overflow:hidden; text-overflow:ellipsis; }
.lm-camera{background:#ef4444;}.lm-wifi{background:#3b82f6;}.lm-switch{background:#8b5cf6;}.lm-router{background:#06b6d4;}.lm-server{background:#f97316;}.lm-panel{background:#f59e0b;}.lm-access{background:#10b981;}.lm-other{background:#6b7280;}
.building-label { background:transparent!important;border:none!important;box-shadow:none!important;color:#fff!important;font-weight:800!important;font-size:12px!important;font-family:system-ui,sans-serif!important;letter-spacing:1px!important;text-shadow:0 1px 4px rgba(0,0,0,.9),0 0 8px rgba(0,0,0,.7)!important;pointer-events:none!important;white-space:nowrap!important; }
.building-label::before { display:none!important; }

/* ══ FLOATING PANELS ════════════════════════════════════ */
.floating-panel {
  position:fixed; top:var(--nav-h); right:0;
  width:280px; background:var(--surface);
  border-left:1px solid var(--border);
  border-bottom:1px solid var(--border);
  border-bottom-left-radius:12px;
  padding:16px; z-index:400;
  box-shadow:-8px 8px 24px rgba(0,0,0,.5);
}
.fp-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; font-weight:700; font-size:13px; }
.fp-header button { background:none; border:none; color:var(--muted); cursor:pointer; font-size:16px; font-family:inherit; }
.fp-header button:hover { color:var(--text); }
.fp-hint { font-size:12px; color:#9ca3af; line-height:1.5; margin-bottom:12px; }

.status-bar { font-size:11px; font-weight:600; color:var(--muted); padding:6px 9px; background:var(--card); border:1px solid var(--border); border-radius:6px; min-height:30px; line-height:1.5; margin-top:10px; }
.status-bar.drawing { color:var(--accent); border-color:rgba(245,158,11,.3); }
.status-bar.saved   { color:var(--success); border-color:rgba(34,197,94,.3); }

/* ══ MODAL ══════════════════════════════════════════════ */
#modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.65); z-index:1000; display:flex; align-items:center; justify-content:center; backdrop-filter:blur(3px); }
#modal { background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:24px; width:360px; box-shadow:0 24px 64px rgba(0,0,0,.7); }
.modal-title { font-size:16px; font-weight:800; color:var(--accent); margin-bottom:18px; }
.form-group { margin-bottom:13px; }
.form-row { display:flex; gap:10px; }
.flex-1 { flex:1; min-width:0; }
.form-group label { display:block; font-size:9px; font-weight:800; text-transform:uppercase; letter-spacing:.8px; color:var(--muted); margin-bottom:5px; }
.form-group input, .form-group textarea, .form-group select { width:100%; background:var(--card); border:1px solid var(--border); border-radius:6px; color:var(--text); font-size:13px; font-family:inherit; padding:8px 10px; outline:none; transition:border-color .2s; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color:var(--accent); }
.form-group textarea { min-height:68px; resize:vertical; line-height:1.5; }
.form-group select option { background:var(--card); }
.modal-actions { display:flex; gap:10px; margin-top:4px; }
.form-mini-row { display:flex; gap:5px; }

.btn-primary   { flex:1; background:var(--accent); color:#000; border:none; border-radius:7px; padding:10px; font-weight:800; font-size:13px; cursor:pointer; font-family:inherit; transition:background .2s; }
.btn-primary:hover { background:var(--accent-h); }
.btn-primary:disabled { opacity:.5; cursor:not-allowed; }
.btn-secondary { flex:1; background:transparent; color:#9ca3af; border:1px solid var(--border); border-radius:7px; padding:10px; font-weight:600; font-size:13px; cursor:pointer; font-family:inherit; transition:all .2s; }
.btn-secondary:hover { border-color:#6b7280; color:var(--text); }
.btn-secondary:disabled { opacity:.4; cursor:not-allowed; }

/* ══ POPOVER ════════════════════════════════════════════ */
#popover { position:fixed; background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:13px 14px; width:220px; box-shadow:0 10px 36px rgba(0,0,0,.6); z-index:600; }
.pop-header { display:flex; align-items:center; gap:8px; margin-bottom:6px; }
#pop-type-icon { font-size:20px; flex-shrink:0; }
#pop-title { font-weight:700; font-size:14px; color:var(--text); }
#pop-notes { font-size:12px; color:#9ca3af; margin-bottom:5px; line-height:1.5; min-height:14px; }
#pop-status { font-size:11px; margin-bottom:5px; }
.pop-drag-hint { font-size:10px; color:#4b5563; font-style:italic; margin-bottom:10px; }
.popover-actions { display:flex; gap:7px; }
.popover-actions button { flex:1; padding:6px; border-radius:5px; border:1px solid var(--border); background:var(--card); color:#c9cdd6; cursor:pointer; font-size:11px; font-family:inherit; transition:all .15s; }
.popover-actions button:hover { border-color:var(--accent); color:var(--accent); }
#pop-delete:hover { border-color:var(--danger)!important; color:var(--danger)!important; }

/* ══ TOOL BAR ═══════════════════════════════════════════ */
#tool-bar { position:fixed; top:calc(var(--nav-h) + 10px); left:50%; transform:translateX(-50%); background:rgba(245,158,11,.12); border:1px solid rgba(245,158,11,.35); color:var(--accent); padding:6px 18px; border-radius:20px; font-size:12px; font-weight:700; z-index:300; display:none; letter-spacing:.3px; backdrop-filter:blur(4px); pointer-events:none; }
#tool-bar.show { display:block; }

/* ══ LEAFLET ════════════════════════════════════════════ */
.leaflet-container { background:#1a1d23!important; font-family:inherit; }
.leaflet-control-zoom a { background:var(--surface)!important; color:#9ca3af!important; border-color:var(--border)!important; }
.leaflet-control-zoom a:hover { color:var(--accent)!important; }
.leaflet-popup-content-wrapper { background:var(--surface); color:var(--text); border:1px solid var(--border); border-radius:8px; box-shadow:0 8px 24px rgba(0,0,0,.5); }
.leaflet-popup-tip { background:var(--surface); }
.leaflet-popup-content { font-family:inherit; font-size:13px; }

.leaflet-control-attribution { display: none !important; }

/* ══ RIGHT EDIT PANEL ════════════════════════════════════ */
#edit-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 220px;
  background: rgba(13,14,17,.97);
  border-left: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 400;
  overflow-y: auto;
  transform: translateX(0);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
#edit-panel.hidden { transform: translateX(100%); display: block !important; }
#edit-panel::-webkit-scrollbar { width: 3px; }
#edit-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.edit-panel-inner { padding: 14px 12px; display: flex; flex-direction: column; gap: 0; }

.ep-section { padding: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.ep-label {
  font-size: 9px; font-weight: 800;
  letter-spacing: 1.2px; color: var(--muted);
  text-transform: uppercase;
}
.ep-tools { display: flex; flex-direction: column; gap: 4px; }
.ep-tools .tool-btn { justify-content: flex-start; width: 100%; }
.ep-actions { gap: 4px; }
.ep-add-btn { border-style: dashed; }
.ep-divider { height: 1px; background: var(--border); margin: 2px 0; }

/* ══ MOBILE ═══════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Sidebar: hidden → slides over as overlay ── */
  #sidebar {
    position: fixed;
    top: var(--nav-h); left: 0; bottom: 0;
    width: 0;
    z-index: 500;
    box-shadow: none;
    transition: width .25s ease;
  }
  #sidebar.open {
    width: 200px;
    box-shadow: 4px 0 32px rgba(0,0,0,.7);
  }
  #sidebar-backdrop {
    display: none; position: fixed; inset: 0;
    top: var(--nav-h); background: rgba(0,0,0,.5); z-index: 499;
  }
  #sidebar-backdrop.show { display: block; }

  /* ── Toolbar: compact single row that fits ── */
  #map-toolbar {
    top: 8px;
    width: calc(100% - 16px);
    max-width: none;
    left: 8px;
    transform: none;
  }
  #toolbar-main {
    width: 100%;
    height: 40px;
    padding: 3px 5px;
    gap: 4px;
    border-radius: 10px;
    overflow: hidden;
    justify-content: space-between;
  }

  /* Pill buttons: icon only, no text */
  .tb-pill { padding: 2px; gap: 2px; border-radius: 7px; }
  .tb-pill-btn {
    padding: 5px 9px;
    font-size: 0; /* hide text */
    gap: 0;
    border-radius: 5px;
    min-width: 32px;
  }
  .tb-pill-btn svg { display: block; }

  /* Recenter + zoom: compact */
  .tb-icon-btn { width: 30px; height: 30px; border-radius: 7px; }
  .tb-zoom { border-radius: 7px; }
  .tb-zoom-btn { width: 28px; height: 30px; }
  .tb-sep { margin: 0 2px; height: 20px; }

  /* ── Edit panel: slides up as bottom sheet ── */
  #edit-panel {
    position: fixed;
    right: 0; left: 0;
    top: auto; bottom: 0;
    width: 100%;
    height: 55vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    transform: translateY(0);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    z-index: 490;
  }
  #edit-panel.hidden { transform: translateY(100%); }

  .edit-panel-inner {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 14px 24px;
    align-items: flex-start;
    overflow-y: auto;
    max-height: calc(55vh - 20px);
  }
  .ep-section { flex: 1; min-width: 130px; }
  .ep-tools { flex-direction: row; flex-wrap: wrap; }
  .ep-tools .tool-btn { width: auto; }
  .ep-divider { display: none; }

  /* Drag handle on edit panel */
  #edit-panel::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 10px auto 0;
  }

  /* ── Modal: full width ── */
  #modal { width: calc(100vw - 32px); padding: 20px 16px; }
  #popover { width: calc(100vw - 48px); max-width: 280px; }

  /* ── Floating panels ── */
  .floating-panel {
    width: calc(100vw - 24px);
    right: 12px; left: 12px;
    border-radius: 10px;
  }
  .map-float-panel { width: calc(100vw - 32px); }

  /* ── Touch targets ── */
  .tool-btn { min-height: 40px; }
  .sb-tab   { min-height: 48px; }
}

/* ══ LOGIN OVERLAY ════════════════════════════════════════ */
#login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
#login-overlay.hidden { display: none; }

#login-card {
  display: flex; flex-direction: column;
  align-items: center; gap: 16px;
  padding: 48px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.6);
  width: 340px;
  text-align: center;
}
.login-logo {
  width: 72px; height: 72px;
  object-fit: contain; border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.login-title {
  font-size: 20px; font-weight: 900;
  letter-spacing: 3px; color: var(--text);
}
.login-sub { font-size: 12px; color: var(--muted); margin-top: -8px; }

/* ══ USER PROFILE CARD ════════════════════════════════════ */
#user-profile-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  margin-top: auto;
  min-height: 60px;
}
.upc-avatar {
  width: 34px; height: 34px;
  border-radius: 6px;
  background: var(--accent);
  color: #000; font-weight: 800; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.upc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.upc-info { flex: 1; min-width: 0; overflow: hidden; }
.upc-name {
  font-size: 12px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upc-role { font-size: 10px; color: var(--muted); margin-top: 1px; }
.upc-logout {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; color: var(--muted);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: all .15s;
}
.upc-logout:hover { border-color: var(--danger); color: var(--danger); }

/* Collapsed sidebar: show only avatar */
#sidebar.collapsed #user-profile-card { justify-content: center; padding: 10px 0; }
#sidebar.collapsed .upc-info,
#sidebar.collapsed .upc-logout { display: none; }

/* ══ SIDE CONTENT PANELS (Users / Dashboard) ══════════════ */
.side-content-panel {
  position: fixed;
  top: var(--nav-h);
  left: 180px; /* sidebar width */
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 200;
  overflow-y: auto;
  padding: 0;
}
#sidebar.collapsed ~ * .side-content-panel,
#sidebar.collapsed + #map-wrapper + .side-content-panel {
  left: 52px;
}
.side-content-panel::-webkit-scrollbar { width: 3px; }
.side-content-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.scp-header {
  font-size: 14px; font-weight: 800; color: var(--text);
  padding: 16px 16px 12px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.scp-section-title {
  font-size: 9px; font-weight: 800; letter-spacing: 1.2px;
  color: var(--muted); text-transform: uppercase;
  padding: 12px 16px 6px;
}
.scp-empty { padding: 20px 16px; color: var(--muted); font-size: 12px; }
.scp-add-btn {
  display: flex; align-items: center; gap: 6px;
  margin: 8px 16px;
  background: var(--card); border: 1px dashed var(--border);
  border-radius: 7px; padding: 8px 12px;
  color: var(--accent); font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.scp-add-btn:hover { border-color: var(--accent); }

/* User rows */
.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.user-row:hover { background: var(--card); }
.user-avatar-sm {
  width: 34px; height: 34px; border-radius: 6px;
  background: var(--accent); color: #000;
  font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.user-info { flex: 1; min-width: 0; }
.user-name-sm { font-size: 12px; font-weight: 700; color: var(--text); }
.user-email-sm { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-select {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text); font-size: 11px;
  font-family: inherit; padding: 4px 6px; cursor: pointer; outline: none;
}
.user-role-select:focus { border-color: var(--accent); }

/* Role rows */
.role-row { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.role-name { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.role-custom { font-size: 9px; color: var(--accent); font-weight: 600; letter-spacing: .5px; }
.role-perms { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-toggle {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--muted); cursor: pointer;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 5px; padding: 4px 8px; user-select: none;
}
.perm-toggle input { accent-color: var(--accent); cursor: pointer; }
.perm-toggle:has(input:disabled) { opacity: .5; cursor: not-allowed; }

/* Dashboard */
.dash-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 16px;
}
.dash-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 14px; text-align: center;
}
.dash-val { font-size: 28px; font-weight: 900; color: var(--accent); line-height: 1; }
.dash-label { font-size: 10px; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: .8px; }
.dash-placeholder {
  margin: 8px 16px 16px;
  padding: 20px; text-align: center;
  color: var(--muted); font-size: 12px;
  background: var(--card); border: 1px dashed var(--border);
  border-radius: 8px;
}

@media (max-width: 768px) {
  .side-content-panel { left: 0; width: 100%; }
}

/* ══ PROFILE CARD UPDATES ═════════════════════════════════ */
.upc-chevron {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 4px;
  flex-shrink: 0; transition: all .15s;
}
.upc-chevron:hover { color: var(--text); background: var(--card); }

#upc-menu {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0 8px 6px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.upc-menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 10px 14px;
  background: none; border: none;
  color: var(--text); font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: background .15s; text-align: left;
}
.upc-menu-item:hover { background: var(--border); }
.upc-menu-item.danger { color: var(--danger); }
.upc-menu-item.danger:hover { background: rgba(239,68,68,.1); }
.upc-menu-item + .upc-menu-item { border-top: 1px solid var(--border); }

/* Collapsed sidebar: hide menu and chevron */
#sidebar.collapsed .upc-chevron { display: none; }
#sidebar.collapsed #upc-menu    { display: none; }

/* ══ USERS PANEL TABS ═════════════════════════════════════ */
.scp-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 1;
  padding: 0 16px;
  gap: 0;
}
.scp-tab {
  padding: 12px 16px;
  background: none; border: none;
  color: var(--muted); font-size: 12px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: all .15s; white-space: nowrap;
}
.scp-tab:hover  { color: var(--text); }
.scp-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.scp-tab-body { padding: 0; }

/* ══ EDIT PANEL TABS ══════════════════════════════════════ */
.ep-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.ep-tab {
  flex: 1; padding: 10px 4px;
  background: none; border: none;
  color: var(--muted); font-size: 11px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  border-bottom: 2px solid transparent;
  transition: all .15s;
}
.ep-tab:hover  { color: var(--text); }
.ep-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.ep-tab-body {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.ep-tab-body::-webkit-scrollbar { width: 3px; }
.ep-tab-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.ep-section-label {
  font-size: 9px; font-weight: 800; letter-spacing: 1.1px;
  color: var(--muted); text-transform: uppercase; margin-bottom: 4px;
}
.ep-tool-grid { display: flex; flex-direction: column; gap: 4px; }
.ep-tool-grid .tool-btn { width: 100%; justify-content: flex-start; }
.ep-add-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--card); border: 1px dashed var(--border);
  border-radius: 7px; padding: 8px 10px; margin-top: 4px;
  color: var(--accent); font-size: 11px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .15s; width: 100%;
}
.ep-add-btn:hover { border-color: var(--accent); }
.ep-empty { font-size: 12px; color: var(--muted); padding: 12px 0; }

/* ══ ZONE EDIT LIST ═══════════════════════════════════════ */
.zone-edit-row {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 7px; padding: 9px 10px; gap: 7px;
  transition: border-color .15s;
}
.zone-edit-row:hover { border-color: var(--border); }
.ze-left { display: flex; align-items: center; gap: 7px; width: 100%; }
.ze-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ze-name { font-size: 11px; font-weight: 700; color: var(--text); white-space: normal; word-break: break-word; line-height: 1.3; }
.ze-undrawn { font-size: 9px; color: var(--muted); font-style: italic; margin-left: 2px; }
.ze-actions { display: flex; gap: 3px; flex-wrap: wrap; }
.ze-btn {
  width: 24px; height: 24px; border-radius: 5px;
  background: none; border: 1px solid var(--border);
  color: var(--muted); cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: all .15s;
}
.ze-btn:hover { border-color: var(--accent); color: var(--accent); }
.ze-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ══ CAMERA FOV CONTROLS ══════════════════════════════════ */
.fov-controls { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.fov-label { font-size: 10px; color: var(--muted); display: flex; justify-content: space-between; }
.fov-label span { color: var(--accent); font-weight: 700; }
.fov-range {
  width: 100%; height: 4px; accent-color: var(--accent);
  cursor: pointer; border-radius: 2px;
}

/* ══ CAMERA FOV CONTROLS ══════════════════════════════════ */
.fov-controls { display:flex; flex-direction:column; gap:6px; margin-top:4px; }
.fov-toggle-row { display:flex; align-items:center; justify-content:space-between; }
.fov-label { font-size:10px; color:var(--muted); display:flex; justify-content:space-between; }
.fov-label span { color:var(--accent); font-weight:700; }
.fov-range { width:100%; height:4px; accent-color:var(--accent); cursor:pointer; }
.fov-hint { font-size:9px; color:#4b5563; font-style:italic; text-align:center; margin-top:2px; }

.fov-toggle {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px;
  font-size: 10px; font-weight: 800; color: var(--muted);
  cursor: pointer; font-family: inherit; letter-spacing: .5px;
  transition: all .2s;
}
.fov-toggle.on {
  background: rgba(239,68,68,.15);
  border-color: rgba(239,68,68,.5);
  color: #ef4444;
}

/* SVG inside marker circles */
.imarker-circle svg { display:block; }
.lmarker-circle svg { display:block; }

/* ══ CAMERA EDIT LIST ═════════════════════════════════════ */
#camera-edit-list { display:flex; flex-direction:column; gap:6px; }

.camera-edit-row {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; display: flex;
  flex-direction: column; gap: 8px;
  transition: border-color .15s;
}
.camera-edit-row:hover { border-color: rgba(239,68,68,.4); }

.ce-header { display:flex; align-items:flex-start; justify-content:space-between; gap:8px; }
.ce-left   { display:flex; align-items:flex-start; gap:8px; flex:1; min-width:0; }
.ce-info   { display:flex; flex-direction:column; gap:2px; min-width:0; flex:1; }
.ce-name   { font-size:12px; font-weight:700; color:var(--text); word-break:break-word; }
.ce-meta   { font-size:10px; color:var(--muted); }
.ce-notes  { font-size:10px; color:#4b5563; font-style:italic; margin-top:1px; }
.ce-actions { display:flex; gap:3px; flex-shrink:0; }

.ce-fov { display:flex; flex-direction:column; gap:5px; padding-top:4px; border-top:1px solid var(--border); }
.ce-fov-row { display:grid; grid-template-columns:52px 1fr auto; align-items:center; gap:6px; }
.ce-fov-row label { font-size:10px; color:var(--muted); }
.ce-fov-row span  { font-size:10px; color:var(--accent); font-weight:700; text-align:right; }

/* ══ CAMERA TAB REDESIGN ══════════════════════════════════ */
.camera-place-btn {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; width: 100%;
  background: rgba(239,68,68,.08);
  border: 1.5px dashed rgba(239,68,68,.4);
  border-radius: 10px; padding: 12px;
  color: #ef4444; font-size: 13px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: all .2s; margin-bottom: 10px;
}
.camera-place-btn:hover { background: rgba(239,68,68,.15); border-color: #ef4444; }
.camera-place-btn.active { background: rgba(239,68,68,.2); border-style: solid; }

/* Camera card — bigger, more visual */
.camera-edit-row {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  transition: border-color .15s;
}
.camera-edit-row:hover { border-color: rgba(239,68,68,.4); }

.ce-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 10px 12px; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.ce-left { display:flex; align-items:center; gap:10px; flex:1; min-width:0; }

/* Camera icon badge */
.ce-icon-badge {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.3);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #ef4444;
}
.ce-info { flex:1; min-width:0; }
.ce-name { font-size:13px; font-weight:700; color:var(--text); }
.ce-meta { font-size:10px; color:var(--muted); margin-top:2px; display:flex; align-items:center; gap:5px; }
.ce-status-dot { width:6px; height:6px; border-radius:50%; display:inline-block; flex-shrink:0; }
.ce-status-dot.active   { background:#22c55e; }
.ce-status-dot.inactive { background:#ef4444; }
.ce-status-dot.planned  { background:#3b82f6; }
.ce-notes { font-size:10px; color:#4b5563; margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ce-actions { display:flex; gap:3px; flex-shrink:0; }

/* FOV section inside card */
.ce-fov {
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 7px;
  background: rgba(239,68,68,.03);
}
.ce-fov.hidden { display:none; }
.ce-fov-row {
  display: grid;
  grid-template-columns: 54px 1fr 32px;
  align-items: center; gap: 6px;
}
.ce-fov-row label { font-size:10px; color:var(--muted); }
.ce-fov-row span  { font-size:10px; color:#ef4444; font-weight:700; text-align:right; }

/* Empty state */
#camera-empty {
  text-align: center; color: var(--muted);
  font-size: 12px; line-height: 1.6;
  padding: 20px 10px;
  background: var(--card); border: 1px dashed var(--border);
  border-radius: 8px;
}

/* ══ VIEW AS PANEL ════════════════════════════════════════ */
.va-intro {
  font-size: 12px; color: var(--muted); line-height: 1.5;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.va-roles { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; }

.va-role-btn {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
  cursor: pointer; font-family: inherit;
  text-align: left; transition: all .15s; width: 100%;
}
.va-role-btn:hover  { border-color: var(--accent); }
.va-role-btn.active { border-color: var(--accent); background: rgba(245,158,11,.07); }

.va-role-name  { font-size: 14px; font-weight: 700; color: var(--text); }
.va-role-perms { display: flex; gap: 5px; flex-wrap: wrap; }
.va-perm {
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 10px; letter-spacing: .3px;
}
.va-perm.on  { background: rgba(34,197,94,.12);  color: #22c55e; }
.va-perm.off { background: rgba(107,114,128,.12); color: var(--muted); }

/* Preview active banner */
.viewas-notice {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(245,158,11,.1);
  border-bottom: 1px solid rgba(245,158,11,.3);
  font-size: 12px; font-weight: 700; color: var(--accent);
}
.viewas-exit-btn {
  background: var(--accent); color: #000;
  border: none; border-radius: 6px;
  padding: 4px 10px; font-size: 11px; font-weight: 700;
  cursor: pointer; font-family: inherit; white-space: nowrap;
}

/* ══ SYNC INDICATOR ═══════════════════════════════════════ */
.sync-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; transition: background .3s;
  margin-left: 2px;
}
.sync-dot.online  { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,.5); }
.sync-dot.offline { background: #6b7280; }
.sync-dot.syncing { background: #f59e0b; animation: pulse 1s infinite; }

/* ══ REQUESTS PANEL ════════════════════════════════════════ */
.req-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #ef4444; color: #fff;
  font-size: 9px; font-weight: 800;
  width: 16px; height: 16px; border-radius: 50%;
  margin-left: 4px; vertical-align: middle;
}

.req-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin: 8px 12px;
  display: flex; flex-direction: column; gap: 5px;
  transition: border-color .15s;
}
.req-card:hover { border-color: var(--accent); }

.req-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.req-type-badge {
  background: rgba(245,158,11,.12); color: var(--accent);
  border: 1px solid rgba(245,158,11,.3);
  font-size: 10px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; padding: 2px 8px; border-radius: 10px;
}
.req-status-badge { font-size: 11px; font-weight: 700; }
.req-meta   { font-size: 10px; color: var(--muted); }
.req-label  { font-size: 13px; font-weight: 700; color: var(--text); }
.req-notes  { font-size: 11px; color: #4b5563; font-style: italic; }
.req-location { font-size: 10px; color: var(--muted); }
.req-actions { display: flex; gap: 6px; margin-top: 4px; }

.req-btn {
  flex: 1; padding: 7px; border-radius: 7px;
  font-size: 11px; font-weight: 700; cursor: pointer;
  font-family: inherit; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  transition: all .15s;
}
.req-btn.approve { border-color: rgba(34,197,94,.4); color: #22c55e; }
.req-btn.approve:hover { background: rgba(34,197,94,.1); }
.req-btn.reject  { border-color: rgba(239,68,68,.4); color: #ef4444; }
.req-btn.reject:hover  { background: rgba(239,68,68,.1); }
.req-btn.delete  { border-color: rgba(239,68,68,.3); color: var(--muted); }
.req-btn.delete:hover  { color: #ef4444; border-color: #ef4444; }
.req-btn.edit:hover    { border-color: var(--accent); color: var(--accent); }

/* Toast notification */
.request-toast {
  position: fixed; bottom: 90px; left: 50%;
  transform: translateX(-50%);
  background: #22c55e; color: #fff;
  font-size: 13px; font-weight: 700;
  padding: 10px 20px; border-radius: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  z-index: 9000; animation: slideUp .3s ease;
}
@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

/* ══ AUDIT LOG ════════════════════════════════════════════ */
.audit-row {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 12px; transition: background .1s;
}
.audit-row:hover { background: var(--card); }
.audit-left  { display: flex; flex-direction: column; gap: 2px; }
.audit-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }
.audit-action { font-weight: 700; font-size: 11px; }
.audit-entity { color: var(--muted); font-size: 11px; }
.audit-actor  { font-weight: 600; color: var(--text); }
.audit-time   { color: var(--muted); font-size: 10px; }
