:root {
  --bg-main: #070d18;
  --bg-header: #0f172a;
  --bg-card: #131e33;
  --bg-box: #0b1325;
  --border-color: #24344d;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --accent: #38bdf8;
  --my-color: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
header {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  z-index: 100;
}

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

.brand-icon {
  width: 34px;
  height: 34px;
  background: radial-gradient(circle, var(--accent) 0%, var(--primary) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
}

.brand span {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
}

.header-status-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-chip {
  background-color: #1e293b;
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: monospace;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-blue { background-color: var(--accent); }
.dot-yellow { background-color: var(--warning); }
.dot-green { background-color: var(--success); }
.dot-cyan { background-color: var(--my-color); }
.dot-orange { background-color: var(--warning); }

/* Unified Main Container */
.unified-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Sidebar */
.unified-sidebar {
  width: 420px;
  background-color: var(--bg-header);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 20;
  height: 100%;
  overflow: hidden;
}

/* Modern Tab Switcher Navigation */
.sidebar-tabs-nav {
  display: flex;
  background-color: #0b1325;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar-tab-btn {
  flex: 1;
  padding: 10px 4px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-tab-btn:hover {
  background-color: rgba(56, 189, 248, 0.04);
  color: #e2e8f0;
}

.sidebar-tab-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
  background-color: rgba(56, 189, 248, 0.08);
}

.sidebar-tab-btn .tab-icon {
  font-size: 1.05rem;
}

.sidebar-tab-btn .tab-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.tab-pill {
  position: absolute;
  top: 6px;
  right: 14px;
  background-color: var(--primary);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
}

/* Sidebar Tab Panes */
.sidebar-tab-pane {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-tab-pane.active {
  display: flex;
}

.tab-inner-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Compact Own Unit Strip (Tab 1) */
.my-device-mini-strip {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: 10px;
  margin: 10px 12px 6px 12px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.mini-strip-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-ring-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #06b6d4;
  box-shadow: 0 0 8px #06b6d4;
  display: inline-block;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(6, 182, 212, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

.mini-strip-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.mini-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

.mini-meta-row {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-id {
  font-family: monospace;
  color: #38bdf8;
}

.mini-sep {
  color: #475569;
}

.mini-coords {
  font-family: monospace;
  color: #94a3b8;
}

.btn-mini-target {
  background-color: rgba(2, 132, 199, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-mini-target:hover {
  background-color: var(--primary);
  color: #fff;
}

/* Glass Section Cards (Tab 2 & 3) */
.glass-section-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.card-header-styled {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.card-header-icon {
  font-size: 0.95rem;
}

.card-header-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.3px;
}

.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.form-group label {
  font-size: 0.7rem;
  color: #94a3b8;
  display: block;
  margin-bottom: 4px;
}

.info-alert-card {
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  font-size: 0.74rem;
  line-height: 1.4;
}

.info-alert-card.teal {
  background: rgba(13, 148, 136, 0.15);
  border: 1px solid rgba(20, 184, 166, 0.4);
  color: #99f6e4;
}

.alert-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.alert-content p {
  margin-top: 2px;
  color: #ccfbf1;
  font-size: 0.72rem;
}

.family-list-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

/* Header pill button */
.btn-header-pill {
  background: rgba(2, 132, 199, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-header-pill:hover {
  background: rgba(2, 132, 199, 0.4);
  border-color: #38bdf8;
  color: #fff;
}

.btn-icon-action {
  background: transparent;
  border: 1px solid var(--border-color);
  color: #94a3b8;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon-action:hover {
  background: #1e293b;
  color: #fff;
  border-color: var(--accent);
}

.box-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.meta-data-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-data-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(11, 19, 37, 0.6);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.74rem;
}

.meta-label {
  color: #94a3b8;
}

.meta-val.mono {
  font-family: monospace;
  color: #38bdf8;
  font-weight: 600;
}

.meta-val.highlight {
  color: #10b981;
  font-weight: 600;
}

.apk-features-box {
  background: rgba(11, 19, 37, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.apk-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.73rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.feat-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.feat-text b {
  color: #38bdf8;
}

.apk-setup-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.apk-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.72rem;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.6);
  padding: 6px 8px;
  border-radius: 6px;
  line-height: 1.4;
}

.step-num {
  background: #0284c7;
  color: #fff;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: bold;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Legacy widget support */
.my-device-box {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1.5px solid rgba(6, 182, 212, 0.4);
  border-radius: 12px;
  margin: 12px;
  padding: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.box-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--my-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.device-id-row {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.val-mono {
  font-family: monospace;
  font-weight: 600;
  color: #fff;
  margin-left: 4px;
}

/* Accuracy Gauge Meter */
.accuracy-gauge-container {
  background-color: rgba(11, 19, 37, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.accuracy-gauge-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.accuracy-gauge-header b {
  color: #38bdf8;
  font-family: monospace;
}

.accuracy-bar-track {
  width: 100%;
  height: 6px;
  background-color: #1e293b;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.accuracy-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b 0%, #10b981 70%, #06b6d4 100%);
  transition: width 0.4s ease;
}

.accuracy-tip {
  font-size: 0.68rem;
  color: #94a3b8;
}

.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.telemetry-item {
  background-color: rgba(11, 19, 37, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 10px;
}

.t-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  display: block;
}

.t-val {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.box-actions {
  display: flex;
  gap: 8px;
}

/* Widget 2: Device Registry List */
.device-registry-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 12px 12px 12px;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 4px;
}

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.badge-count {
  background-color: #1e293b;
  border: 1px solid var(--border-color);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
}

.search-wrapper {
  margin-bottom: 8px;
}

.search-box {
  width: 100%;
  padding: 8px 12px;
  background-color: #1e293b;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.8rem;
  outline: none;
}

.search-box:focus {
  border-color: var(--accent);
}

.device-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.device-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.device-card:hover, .device-card.selected {
  border-color: var(--accent);
  background-color: #1c2b45;
  transform: translateY(-1px);
}

.device-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 6px;
}

.device-id {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--accent);
}

.badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 8px;
}

.badge-online {
  background-color: rgba(16, 185, 129, 0.2);
  color: var(--success);
  border: 1px solid var(--success);
}

.badge-offline {
  background-color: rgba(239, 68, 68, 0.2);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.badge-real {
  background-color: rgba(2, 132, 199, 0.2);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.badge-qr {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid #10b981;
}

.badge-sim {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.badge-transmitting {
  background-color: rgba(6, 182, 212, 0.2);
  color: var(--my-color);
  border: 1px solid var(--my-color);
  animation: pulseBadge 1.5s infinite;
}

@keyframes pulseBadge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.device-ip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.device-ip {
  font-family: monospace;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
}

.delete-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.delete-btn:hover {
  background-color: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.device-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.sidebar-bottom-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

/* Buttons */
.btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.72rem;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-connect {
  background-color: #059669;
  color: #fff;
  border: 1px solid #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.btn-connect:hover {
  background-color: #047857;
}

.btn-calibrate {
  background-color: rgba(245, 158, 11, 0.2);
  border: 1px solid var(--warning);
  color: #fde68a;
}

.btn-calibrate:hover {
  background-color: var(--warning);
  color: #000;
}

.btn-danger {
  background-color: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: #fca5a5;
}

.btn-danger:hover {
  background-color: var(--danger);
  color: #fff;
}

.btn-secondary {
  background-color: #1e293b;
  border: 1px solid var(--border-color);
  color: #f8fafc;
}

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

/* Map Wrapper */
.map-wrapper {
  flex: 1;
  position: relative;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
}

/* Calibration Floating Banner */
.calibration-banner {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(15, 23, 42, 0.95);
  border: 1.5px solid var(--warning);
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 0.8rem;
  color: #fff;
  display: none;
  align-items: center;
  gap: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  z-index: 600;
  backdrop-filter: blur(6px);
}

.calibration-banner.active {
  display: flex;
}

/* Map Floating Legend */
.map-overlay-legend {
  position: absolute;
  bottom: 20px;
  right: 20px;
  background-color: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 500;
  backdrop-filter: blur(4px);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Pulsing CSS Marker for My Location */
.my-beacon-pulse {
  position: relative;
  width: 18px;
  height: 18px;
  background-color: #06b6d4;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.9);
  cursor: grab;
}

.my-beacon-pulse::after {
  content: '';
  position: absolute;
  top: -14px;
  left: -14px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid #06b6d4;
  animation: radarWave 2s infinite ease-out;
  pointer-events: none;
}

@keyframes radarWave {
  0% { transform: scale(0.3); opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* MODAL STYLING */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-card {
  background: #0f172a;
  border: 1.5px solid var(--border-color);
  border-radius: 16px;
  max-width: 580px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-close-btn:hover {
  color: #fff;
}

.qr-container {
  display: flex;
  gap: 20px;
  align-items: center;
}

.qr-image {
  width: 170px;
  height: 170px;
  background: #fff;
  padding: 8px;
  border-radius: 12px;
}

.enroll-live-status-box {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.status-waiting {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid #f59e0b;
  color: #fde68a;
}

.status-success {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  color: #a7f3d0;
}

.status-indicator-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: currentColor;
  animation: pulseIndicator 1.5s infinite;
}

@keyframes pulseIndicator {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}

.lan-url-box {
  background-color: #1e293b;
  border: 1px dashed var(--accent);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: monospace;
  font-weight: bold;
  color: #38bdf8;
  font-size: 0.85rem;
  cursor: pointer;
  margin: 8px 0;
  text-align: center;
  word-break: break-all;
}

.lan-url-box:hover {
  background-color: #24344d;
}

/* MOBILE ENROLLMENT OVERLAY FOR PHONES */
.mobile-enroll-overlay {
  position: fixed;
  inset: 0;
  background: #070d18;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.mobile-enroll-overlay.active {
  display: flex;
}

.mobile-enroll-card {
  background: #0f172a;
  border: 1.5px solid var(--border-color);
  border-radius: 20px;
  padding: 28px 20px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

.mobile-target-name-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #34d399;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 16px;
  display: inline-block;
}

@media (max-width: 820px) {
  .unified-container {
    flex-direction: column-reverse;
  }
  .unified-sidebar {
    width: 100%;
    height: 54%;
  }
  .map-wrapper {
    height: 46%;
  }
  .qr-container {
    flex-direction: column;
    text-align: center;
  }
  .calibration-banner {
    width: 90%;
    font-size: 0.72rem;
    flex-direction: column;
    gap: 6px;
  }
}

/* ==========================================================
   NETTRACK SENTINEL LOGIN & SIGN IN SCREEN (WITH GOOGLE)
   ========================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, #13233e 0%, #070d18 70%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(16px);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.login-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.92);
  border: 1.5px solid rgba(56, 189, 248, 0.3);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(2, 132, 199, 0.18);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #34d399, #38bdf8);
  background-size: 300% 100%;
  animation: barSlide 4s linear infinite;
}

@keyframes barSlide {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

.login-badge-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.login-card h2 {
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-card p.subtitle {
  font-size: 0.84rem;
  color: #94a3b8;
  line-height: 1.45;
  margin-bottom: 24px;
}

/* Tombol Login Google */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  background: #ffffff;
  color: #1f2937;
  border: 1.5px solid #dadce0;
  border-radius: 28px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.btn-google:hover {
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
}
  position: relative;
}

.btn-google:hover {
  background: #f9fafb;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(56, 189, 248, 0.3);
  border-color: #38bdf8;
}

.btn-google:active {
  transform: translateY(0);
}

.btn-google svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Pembatas Divider */
.login-divider {
  display: flex;
  align-items: center;
  margin: 22px 0;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #1e293b;
}

.login-divider span {
  padding: 0 12px;
}

/* Form Input Operator */
.login-form-group {
  margin-bottom: 14px;
  text-align: left;
}

.login-form-group label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 5px;
}

.login-input {
  width: 100%;
  padding: 11px 14px;
  background: #090f1d;
  border: 1px solid #1e293b;
  border-radius: 10px;
  color: #fff;
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
}

.login-input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.btn-login-submit {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #fff;
  border: 1px solid #38bdf8;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.btn-login-submit:hover {
  background: linear-gradient(135deg, #0369a1, #075985);
  box-shadow: 0 6px 18px rgba(2, 132, 199, 0.4);
}

.login-status-msg {
  font-size: 0.78rem;
  margin-top: 14px;
  min-height: 18px;
}

.login-status-msg.error {
  color: #f87171;
}

.login-status-msg.success {
  color: #34d399;
}

.login-footer-info {
  margin-top: 20px;
  font-size: 0.7rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Header User Profile Section */
.user-profile-section {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid #24344d;
  border-radius: 20px;
  padding: 4px 10px 4px 5px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #38bdf8;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  color: #fff;
}

.user-info-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.2;
}

.user-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f8fafc;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  font-size: 0.65rem;
  color: #38bdf8;
  font-family: monospace;
}

.btn-logout {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-logout:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

