/* ══ VARIABLES ═══════════════════════════════════════════════ */
:root {
  --accent: #00e5c0;
  --accent-dim: rgba(0, 229, 192, 0.12);
  --accent-glow: rgba(0, 229, 192, 0.35);
  --accent-text: #00c4a7;
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.15);
  --red: #f43f5e;
  --red-dim: rgba(244, 63, 94, 0.15);
  --green: #10b981;
  --bg-base: #07080e;
  --bg-surface: #0c0e17;
  --bg-elevated: #111420;
  --bg-hover: #161a28;
  --bg-input: #0e1120;
  --border: #1a2033;
  --border-light: #222842;
  --text-primary: #dde3f0;
  --text-secondary: #5c6b88;
  --text-muted: #2e3a50;
  --sidebar-w: 260px;
  --nav-h: 52px;
  --radius: 6px;
  --radius-sm: 4px;
  --transition: 150ms ease;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Barlow', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ══ RESET & BASE ══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
input, select, textarea, button { font-family: inherit; }
button { cursor: pointer; border: none; background: none; }
input:focus, select:focus, textarea:focus { outline: none; }
.hidden { display: none !important; }

/* ══ SCROLLBARS ════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ══ LOGIN SCREEN ══════════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  background: var(--bg-base);
}
.login-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(0,229,192,0.04) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 20%, rgba(0,150,255,0.03) 0%, transparent 50%);
}
.login-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.4;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}
.login-card {
  position: relative; z-index: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.03);
  animation: fadeUp 0.4s ease;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.login-subtitle {
  font-size: 11px; font-weight: 500; letter-spacing: 1.5px;
  color: var(--text-secondary); text-transform: uppercase;
  margin-bottom: 28px;
}
.login-tabs {
  display: flex; gap: 4px;
  background: var(--bg-base); border-radius: var(--radius);
  padding: 3px; margin-bottom: 24px;
}
.login-tab {
  flex: 1; padding: 8px;
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text-secondary); border-radius: 4px;
  transition: all var(--transition);
}
.login-tab.active {
  background: var(--bg-elevated); color: var(--text-primary);
}
.login-tab:hover:not(.active) { color: var(--text-primary); }

/* ══ FORM ELEMENTS ═════════════════════════════════════════════ */
.login-form { display: flex; flex-direction: column; gap: 16px; }
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; color: var(--text-secondary); text-transform: uppercase;
}
.field-input {
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 10px 12px;
  color: var(--text-primary); font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field-input::placeholder { color: var(--text-muted); }
.field-select {
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 10px 12px;
  color: var(--text-primary); font-size: 14px;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235c6b88' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.field-select:focus { border-color: var(--accent); outline: none; }
.field-select-sm { padding: 6px 10px; font-size: 12px; padding-right: 28px; background-position: right 8px center; }
.form-error {
  font-size: 12px; color: var(--red);
  padding: 8px 12px; background: var(--red-dim);
  border-radius: var(--radius-sm); border: 1px solid rgba(244,63,94,0.25);
}

/* ══ BUTTONS ═══════════════════════════════════════════════════ */
.btn-primary {
  background: var(--accent); color: #00211c;
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  padding: 10px 20px; border-radius: var(--radius);
  transition: all var(--transition);
  border: 1px solid transparent;
}
.btn-primary:hover { background: #00f5d0; box-shadow: 0 0 16px var(--accent-glow); }
.btn-primary:active { background: #00c4a7; }
.btn-full { width: 100%; }
.btn-ghost {
  background: transparent; color: var(--text-secondary);
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  padding: 8px 16px; border-radius: var(--radius);
  border: 1px solid var(--border-light);
  transition: all var(--transition);
}
.btn-ghost:hover { border-color: var(--border); color: var(--text-primary); background: var(--bg-hover); }
.btn-danger {
  background: transparent; color: var(--red);
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  padding: 8px 16px; border-radius: var(--radius);
  border: 1px solid rgba(244,63,94,0.3);
  transition: all var(--transition);
}
.btn-danger:hover { background: var(--red-dim); border-color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn-icon {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); color: var(--text-secondary);
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger-hover:hover { color: var(--red); background: var(--red-dim); }

/* ══ NAVBAR ════════════════════════════════════════════════════ */
.app { display: flex; flex-direction: column; height: 100vh; }
.navbar {
  height: var(--nav-h); flex-shrink: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; gap: 16px;
  z-index: 100;
}
.navbar-left { display: flex; align-items: center; gap: 16px; }
.navbar-logo {
  display: flex; align-items: center; gap: 10px;
}
.navbar-brand {
  font-family: var(--font-display); font-size: 18px; font-weight: 700;
  letter-spacing: 2px; color: var(--text-primary);
}
.navbar-map-badge {
  display: flex; align-items: center; gap: 8px;
  background: var(--accent-dim); border: 1px solid rgba(0,229,192,0.2);
  border-radius: 20px; padding: 4px 12px;
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  letter-spacing: 0.5px; color: var(--accent-text);
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.8); }
}
.navbar-right { display: flex; align-items: center; gap: 8px; }
.online-indicator {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary);
  padding: 4px 10px;
}
.online-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted); transition: background 0.5s;
}
.online-dot.connected { background: var(--accent); animation: pulse-dot 2s infinite; }
.user-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 12px;
  font-size: 13px;
}
.user-chip-role {
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--accent); background: var(--accent-dim);
  border-radius: 3px; padding: 1px 5px;
}
.user-chip-name { color: var(--text-primary); font-weight: 500; }

/* ══ MAIN LAYOUT ═══════════════════════════════════════════════ */
.main-layout {
  display: flex; flex: 1; overflow: hidden;
}

/* ══ SIDEBAR ═══════════════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.sidebar-title {
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: 2px; color: var(--text-secondary); text-transform: uppercase;
}
.sidebar-count {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted); background: var(--bg-elevated);
  border-radius: 10px; padding: 1px 8px;
}
.map-list { flex: 1; overflow-y: auto; padding: 8px; }
.map-item {
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; margin-bottom: 2px;
  border: 1px solid transparent;
  transition: all var(--transition);
  display: flex; align-items: center; gap: 10px;
}
.map-item:hover { background: var(--bg-hover); border-color: var(--border); }
.map-item.active {
  background: var(--accent-dim); border-color: rgba(0,229,192,0.25);
}
.map-item-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  background: var(--bg-elevated); border-radius: 4px;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.map-item-icon img { width: 100%; height: 100%; object-fit: cover; }
.map-item-info { flex: 1; min-width: 0; }
.map-item-name {
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-item.active .map-item-name { color: var(--accent-text); }
.map-item-badge {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-muted);
}

/* ══ CONTENT ═══════════════════════════════════════════════════ */
.content {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
  position: relative;
}

/* ══ EMPTY STATE ════════════════════════════════════════════════ */
.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; padding: 40px;
}
.empty-title {
  font-family: var(--font-display); font-size: 20px; font-weight: 600;
  letter-spacing: 1px; color: var(--text-secondary);
}
.empty-sub {
  font-size: 13px; color: var(--text-muted); text-align: center;
  max-width: 360px; line-height: 1.7;
}

/* ══ WORKSPACE — see appended section below ═════════════════════ */
.workspace-toolbar {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-surface); flex-shrink: 0;
}
.toolbar-left { display: flex; align-items: center; gap: 10px; }
.toolbar-label {
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: 2px; color: var(--text-secondary); text-transform: uppercase;
}
.marker-count-badge {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: var(--accent); background: var(--accent-dim);
  border-radius: 10px; padding: 2px 10px;
  border: 1px solid rgba(0,229,192,0.2);
}
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.toggle-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 12px; color: var(--text-secondary);
  font-family: var(--font-display); font-weight: 600; letter-spacing: 0.5px;
}
.toggle-label input { display: none; }
.toggle-slider {
  width: 32px; height: 18px; background: var(--bg-elevated);
  border-radius: 9px; position: relative;
  border: 1px solid var(--border-light);
  transition: background var(--transition);
  flex-shrink: 0;
}
.toggle-slider::after {
  content: ''; position: absolute;
  width: 12px; height: 12px; background: var(--text-secondary);
  border-radius: 50%; top: 2px; left: 2px;
  transition: all var(--transition);
}
.toggle-label input:checked + .toggle-slider { background: var(--accent-dim); border-color: var(--accent); }
.toggle-label input:checked + .toggle-slider::after { left: 16px; background: var(--accent); }
.heatmap-canvas {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; opacity: 0.7;
}
.markers-layer {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}

/* ══ MARKERS ════════════════════════════════════════════════════ */
.marker {
  position: absolute;
  /* Dot centre sits exactly at the clicked point */
  transform: translate(-50%, -12px);
  /* Only the dot hitzone triggers pointer events — see .marker-dot-wrap */
  pointer-events: none;
  cursor: default;
  z-index: 10;
}
/* Hovered marker always on top */
.marker:hover { z-index: 200; }

.marker-inner {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}

/* ── Dot wrap: the ONLY clickable area ── */
.marker-dot-wrap {
  position: relative; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: all; cursor: pointer;
  /* Invisible padding ring extends hit area ~3px beyond dot edge */
  padding: 3px;
  margin: -3px; /* compensate so visual size unchanged */
  border-radius: 50%;
}

.marker-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  position: relative; z-index: 2;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: 0 0 8px currentColor, 0 2px 4px rgba(0,0,0,0.4);
}
.marker-dot-wrap:hover .marker-dot {
  transform: scale(1.35);
  box-shadow: 0 0 14px currentColor, 0 2px 6px rgba(0,0,0,0.5);
}

.marker-svg-ring {
  position: absolute; top: 0; left: 0; width: 24px; height: 24px;
  transform: rotate(-90deg); pointer-events: none;
}
.ring-track { stroke: rgba(255,255,255,0.08); fill: none; }
.ring-progress { fill: none; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }

/* Labels — not interactive, sit below the dot */
.marker-channel,
.marker-label,
.marker-timer {
  pointer-events: none;
  border-radius: 3px; white-space: nowrap;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.marker-channel {
  background: rgba(0,0,0,0.55);
  padding: 1px 4px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  color: rgba(255,255,255,0.55);
  opacity: 0.7;
}
.marker-label {
  background: rgba(0,0,0,0.55);
  padding: 1px 5px;
  font-family: var(--font-display); font-size: 9px; font-weight: 600;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.3px;
  opacity: 0.7;
}
.marker-timer {
  background: rgba(0,0,0,0.75);
  padding: 1px 5px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--accent);
}

/* On dot-hover: elevate and sharpen all labels of THIS marker */
.marker-dot-wrap:hover ~ .marker-channel,
.marker-dot-wrap:hover ~ .marker-label,
.marker-dot-wrap:hover ~ .marker-timer {
  opacity: 1;
  background: rgba(0,0,0,0.88);
  color: #fff;
}
.marker-dot-wrap:hover ~ .marker-timer { color: var(--accent); }

.marker.warning .marker-timer { color: var(--amber); }
.marker.critical .marker-timer { color: var(--red); }
.marker.warning { animation: marker-pulse-amber 0.8s ease-in-out infinite; }
.marker.critical { animation: marker-pulse-red 0.5s ease-in-out infinite; }
@keyframes marker-pulse-amber {
  0%, 100% { filter: drop-shadow(0 0 4px var(--amber)); }
  50% { filter: drop-shadow(0 0 10px var(--amber)); }
}
@keyframes marker-pulse-red {
  0%, 100% { filter: drop-shadow(0 0 6px var(--red)); }
  50% { filter: drop-shadow(0 0 14px var(--red)); }
}
.marker-spawn-anim {
  animation: marker-spawn 0.3s ease;
}
@keyframes marker-spawn {
  from { opacity: 0; transform: translate(-50%, -12px) scale(0.3); }
  to   { opacity: 1; transform: translate(-50%, -12px) scale(1); }
}
/* ══ POPUPS ════════════════════════════════════════════════════ */
.popup {
  position: fixed; z-index: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.03);
  width: 280px; min-width: 250px;
  animation: popup-in 0.18s ease;
}
@keyframes popup-in {
  from { opacity: 0; transform: scale(0.95) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.popup-header {
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.popup-title-row { display: flex; align-items: center; gap: 8px; }
.marker-popup-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
}
.popup-title {
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-primary);
}
.popup-close {
  font-size: 18px; color: var(--text-secondary); line-height: 1;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  border-radius: 3px; transition: all var(--transition);
}
.popup-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.popup-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.popup-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; align-items: center;
}
.popup-coords {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-muted);
  text-align: center;
}
.marker-popup-meta {
  font-size: 12px; color: var(--text-secondary);
  display: flex; flex-direction: column; gap: 4px;
}
.meta-row { display: flex; justify-content: space-between; align-items: center; }
.meta-label { color: var(--text-muted); font-size: 11px; letter-spacing: 0.5px; }
.meta-value { color: var(--text-primary); font-weight: 500; }

/* ══ CHANNEL PICKER ════════════════════════════════════════════ */
.channel-picker {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.channel-btn {
  width: 36px; height: 28px;
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: var(--text-secondary); transition: all var(--transition);
}
.channel-btn:hover { border-color: var(--accent); color: var(--accent); }
.channel-btn.active {
  background: var(--accent-dim); border-color: var(--accent); color: var(--accent);
}

/* ══ TIMER ══════════════════════════════════════════════════════ */
.timer-display {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 8px 0;
}
.timer-ring-container {
  position: relative; width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
}
.timer-svg { position: absolute; top: 0; left: 0; transform: rotate(-90deg); }
.timer-track { stroke: var(--border-light); fill: none; }
.timer-progress {
  fill: none; stroke: var(--accent); stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}
.timer-countdown {
  font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: var(--accent);
  position: relative; z-index: 1;
}
.timer-input-section { display: flex; flex-direction: column; gap: 8px; }
.timer-input-row {
  display: flex; align-items: center; gap: 8px;
}
.timer-input-group {
  display: flex; align-items: center; gap: 4px;
}
.timer-field {
  width: 52px; text-align: center;
  padding: 8px 6px;
  font-family: var(--font-mono); font-size: 16px; font-weight: 700;
}
.timer-label {
  font-family: var(--font-display); font-size: 10px; font-weight: 600;
  letter-spacing: 0.5px; color: var(--text-muted); text-transform: uppercase;
}
.timer-sep { font-family: var(--font-mono); font-size: 18px; color: var(--text-muted); }

/* ══ ADMIN PANEL ════════════════════════════════════════════════ */
.admin-panel {
  flex: 1; display: flex; overflow: hidden;
}
.admin-nav {
  width: 200px; flex-shrink: 0;
  background: var(--bg-surface); border-right: 1px solid var(--border);
  padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.admin-nav-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  color: var(--text-secondary); transition: all var(--transition);
  letter-spacing: 0.3px;
}
.admin-nav-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.admin-nav-btn.active { background: var(--accent-dim); color: var(--accent-text); border: 1px solid rgba(0,229,192,0.15); }
.admin-nav-back { margin-top: auto; color: var(--text-muted); }
.admin-nav-back:hover { color: var(--text-secondary); }
.admin-content {
  flex: 1; overflow-y: auto; padding: 24px;
}

/* ══ ADMIN SECTIONS ═════════════════════════════════════════════ */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  font-family: var(--font-display); font-size: 20px; font-weight: 700;
  letter-spacing: 1px; color: var(--text-primary);
}
.admin-table {
  width: 100%; border-collapse: collapse;
  margin-bottom: 24px;
}
.admin-table th {
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-secondary);
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-primary);
  vertical-align: middle;
}
.admin-table tr:hover td { background: var(--bg-hover); }
.admin-table tr:last-child td { border-bottom: none; }
.rock-color-swatch {
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-block; vertical-align: middle;
  box-shadow: 0 0 6px currentColor;
}
.action-btns { display: flex; gap: 6px; }
.btn-action {
  padding: 4px 10px; border-radius: var(--radius-sm);
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  color: var(--text-secondary); transition: all var(--transition);
}
.btn-action:hover { border-color: var(--accent); color: var(--accent); }
.btn-action.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }

/* ══ ADMIN FORMS ════════════════════════════════════════════════ */
.admin-form {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  margin-bottom: 24px;
}
.admin-form-title {
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text-secondary);
  margin-bottom: 16px;
}
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .field-group { flex: 1; min-width: 140px; }
.color-input-wrap { display: flex; align-items: center; gap: 8px; }
.color-picker {
  width: 36px; height: 36px; padding: 2px;
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); cursor: pointer;
}
.map-thumbnail {
  width: 48px; height: 32px; object-fit: cover;
  border-radius: 3px; border: 1px solid var(--border);
}

/* ══ SETTINGS ═══════════════════════════════════════════════════ */
.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  max-width: 800px;
}
.settings-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.settings-card-title {
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent-text);
  margin-bottom: 16px;
}
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 13px; color: var(--text-primary); }
.setting-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ══ ROLE BADGE ═════════════════════════════════════════════════ */
.role-badge {
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; padding: 2px 7px; border-radius: 3px;
}
.role-admin { background: var(--accent-dim); color: var(--accent-text); border: 1px solid rgba(0,229,192,0.2); }
.role-user { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }

/* ══ OVERLAY & MODAL ════════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-card {
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 24px;
  width: 360px; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: popup-in 0.18s ease;
}
.modal-title {
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 12px;
}
.modal-body { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; }

/* ══ TOAST NOTIFICATIONS ════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 1000; pointer-events: none;
}
.toast {
  pointer-events: all;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 12px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 280px; max-width: 360px;
  animation: toast-in 0.25s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast.hiding { animation: toast-out 0.25s ease forwards; }
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}
.toast-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; margin-top: 1px;
}
.toast-success .toast-icon { background: rgba(16,185,129,0.2); color: var(--green); }
.toast-error .toast-icon { background: var(--red-dim); color: var(--red); }
.toast-warning .toast-icon { background: var(--amber-dim); color: var(--amber); }
.toast-info .toast-icon { background: var(--accent-dim); color: var(--accent); }
.toast-new_rock .toast-icon { background: var(--accent-dim); color: var(--accent); }
.toast-rock_expired .toast-icon { background: var(--red-dim); color: var(--red); }
.toast-rock_warning .toast-icon { background: var(--amber-dim); color: var(--amber); }
.toast-body { flex: 1; }
.toast-title {
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-primary);
  margin-bottom: 2px;
}
.toast-message { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.toast-close {
  font-size: 16px; color: var(--text-muted); flex-shrink: 0;
  width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
  border-radius: 3px;
}
.toast-close:hover { color: var(--text-primary); background: var(--bg-hover); }
.toast-left-bar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
}
.toast { position: relative; }
.toast-success .toast-left-bar { background: var(--green); }
.toast-error .toast-left-bar, .toast-rock_expired .toast-left-bar { background: var(--red); }
.toast-warning .toast-left-bar, .toast-rock_warning .toast-left-bar { background: var(--amber); }
.toast-info .toast-left-bar, .toast-new_rock .toast-left-bar { background: var(--accent); }

/* ══ MISC ═══════════════════════════════════════════════════════ */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.text-accent { color: var(--accent-text); }
.text-muted { color: var(--text-muted); }
.font-mono { font-family: var(--font-mono); }

/* ══ FILE INPUT ═════════════════════════════════════════════════ */
.file-input-wrap {
  border: 1px dashed var(--border-light); border-radius: var(--radius);
  padding: 12px; text-align: center; cursor: pointer;
  transition: all var(--transition); position: relative;
}
.file-input-wrap:hover { border-color: var(--accent); background: var(--accent-dim); }
.file-input-wrap input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.file-input-label { font-size: 12px; color: var(--text-secondary); pointer-events: none; }
.file-input-name { font-size: 11px; color: var(--accent-text); margin-top: 4px; font-family: var(--font-mono); }

/* ══ RESPONSIVE: Small screens ══════════════════════════════════ */
@media (max-width: 700px) {
  :root { --sidebar-w: 200px; }
  .settings-grid { grid-template-columns: 1fr; }
  .popup { width: 260px; }
}

/* ══ TOOLBAR ADDITIONS ══════════════════════════════════════════ */
.toolbar-divider {
  width: 1px; height: 20px;
  background: var(--border-light); flex-shrink: 0;
}
.zoom-level {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--text-secondary); min-width: 38px; text-align: center;
  user-select: none;
}

/* ══ CHANNEL FILTER BAR ═════════════════════════════════════════ */
.channel-filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.channel-filter-btns { display: flex; gap: 4px; flex-wrap: nowrap; }
.channel-filter-btn {
  width: 34px; height: 26px;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  color: var(--text-muted); transition: all var(--transition); cursor: pointer;
}
.channel-filter-btn.active {
  background: var(--accent-dim); border-color: var(--accent);
  color: var(--accent);
}
.channel-filter-all, .channel-filter-none {
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: 0.5px; padding: 3px 8px;
  background: transparent; border: 1px solid var(--border-light);
  border-radius: var(--radius-sm); color: var(--text-muted);
  transition: all var(--transition); cursor: pointer;
}
.channel-filter-all:hover { border-color: var(--accent); color: var(--accent); }
.channel-filter-none:hover { border-color: var(--red); color: var(--red); }

/* Channel-hidden markers */
.marker.channel-hidden { display: none; }

/* ══ WORKSPACE BODY WITH FEED ═══════════════════════════════════ */
.workspace { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.workspace-body {
  flex: 1; display: flex; overflow: hidden; position: relative;
}
.map-viewport {
  flex: 1; overflow: hidden; position: relative;
  background: var(--bg-base);
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 24px 24px;
  cursor: crosshair;
}
/* The zoom/pan wrapper — transform applied here */
.map-zoom-wrap {
  position: absolute; top: 0; left: 0;
  transform-origin: 0 0;
  cursor: crosshair;
  user-select: none;
}
.map-zoom-wrap.is-panning { cursor: grabbing; }
.map-container {
  position: relative; display: inline-block;
  border: 1px solid var(--border-light);
  border-radius: 4px; overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
#map-image {
  display: block;
  user-select: none; pointer-events: none;
}

/* ══ ACTIVITY FEED ══════════════════════════════════════════════ */
.activity-feed {
  width: 280px; flex-shrink: 0;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  animation: feed-slide-in 0.2s ease;
}
@keyframes feed-slide-in {
  from { width: 0; opacity: 0; }
  to   { width: 280px; opacity: 1; }
}
.feed-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.feed-title {
  font-family: var(--font-display); font-size: 10px; font-weight: 700;
  letter-spacing: 2px; color: var(--text-secondary); text-transform: uppercase;
}
.feed-list {
  flex: 1; overflow-y: auto; padding: 6px 0;
}
.feed-item {
  padding: 8px 14px; display: flex; gap: 10px; align-items: flex-start;
  border-bottom: 1px solid var(--border);
  animation: feed-item-in 0.2s ease;
  transition: background var(--transition);
}
.feed-item:hover { background: var(--bg-hover); }
@keyframes feed-item-in {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: translateX(0); }
}
.feed-item:last-child { border-bottom: none; }
.feed-icon {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; margin-top: 1px;
}
.feed-icon-new    { background: var(--accent-dim); color: var(--accent); }
.feed-icon-timer  { background: rgba(99,102,241,0.15); color: #818cf8; }
.feed-icon-warn   { background: var(--amber-dim); color: var(--amber); }
.feed-icon-expire { background: var(--red-dim); color: var(--red); }
.feed-icon-clear  { background: var(--bg-elevated); color: var(--text-secondary); }
.feed-body { flex: 1; min-width: 0; }
.feed-msg {
  font-size: 12px; color: var(--text-primary); line-height: 1.4;
  word-break: break-word;
}
.feed-msg strong { color: var(--accent-text); font-weight: 600; }
.feed-time {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-muted);
  margin-top: 2px;
}
.feed-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  margin-top: 7px;
}

/* Feed unread indicator */
.feed-unread-dot {
  position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 1.5s infinite;
}
#feed-toggle-btn { position: relative; }

/* ══ TIMER PRESETS ══════════════════════════════════════════════ */
.timer-presets {
  display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap;
}
.preset-btn {
  padding: 4px 10px;
  background: var(--bg-input); border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  color: var(--text-secondary);
  transition: all var(--transition); cursor: pointer;
}
.preset-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
