/* ====================================================================
   SUBEB Device Admin — React App Theme & Component Styles
   Supports Light & Dark modes matching /subebapp-js
   ==================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root, html.light {
  --radius: 0.625rem; /* 10px */
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);

  /* Light theme */
  --background: #f8faf8;
  --foreground: #0f172a;

  --card: #ffffff;
  --card-foreground: #0f172a;
  --popover: #ffffff;
  --popover-foreground: #0f172a;

  --primary: #16a34a;           /* SUBEB green */
  --primary-hover: #15803d;
  --primary-foreground: #ffffff;
  --primary-glow: #22c55e;

  --secondary: #f1f5f2;
  --secondary-foreground: #1e293b;

  --muted: #f1f5f2;
  --muted-foreground: #64748b;

  --accent: #e8f5ed;
  --accent-foreground: #14532d;

  --success: #16a34a;
  --success-bg: #dcfce7;
  --success-foreground: #14532d;

  --warning: #d97706;
  --warning-bg: #fef3c7;
  --warning-foreground: #78350f;

  --destructive: #dc2626;
  --destructive-bg: #fee2e2;
  --destructive-foreground: #991b1b;

  --border: #e2e8f0;
  --input: #e2e8f0;
  --ring: #16a34a;

  --sidebar: #14532d;          /* deep green sidebar */
  --sidebar-foreground: #f1f5f9;
  --sidebar-primary: #22c55e;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #15803d;
  --sidebar-accent-foreground: #ffffff;
  --sidebar-border: #166534;

  --gradient-hero: linear-gradient(135deg, #14532d 0%, #16a34a 100%);
  --gradient-primary: linear-gradient(135deg, #16a34a, #22c55e);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 4px 12px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.05);
}

html.dark {
  --background: #0b0f19;
  --foreground: #f8fafc;

  --card: #141a29;
  --card-foreground: #f8fafc;
  --popover: #141a29;
  --popover-foreground: #f8fafc;

  --primary: #22c55e;
  --primary-hover: #16a34a;
  --primary-foreground: #ffffff;
  --primary-glow: #4ade80;

  --secondary: #1e293b;
  --secondary-foreground: #f8fafc;

  --muted: #1e293b;
  --muted-foreground: #94a3b8;

  --accent: rgba(34, 197, 94, 0.15);
  --accent-foreground: #86efac;

  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.15);
  --success-foreground: #86efac;

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --warning-foreground: #fcd34d;

  --destructive: #ef4444;
  --destructive-bg: rgba(239, 68, 68, 0.15);
  --destructive-foreground: #fca5a5;

  --border: rgba(255, 255, 255, 0.1);
  --input: rgba(255, 255, 255, 0.15);
  --ring: #22c55e;

  --sidebar: #092e17;
  --sidebar-foreground: #f8fafc;
  --sidebar-primary: #22c55e;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #16a34a;
  --sidebar-accent-foreground: #ffffff;
  --sidebar-border: #14532d;

  --gradient-hero: linear-gradient(135deg, #092e17 0%, #14532d 100%);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 12px -2px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  font-size: 0.95rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: "Space Grotesk", system-ui, sans-serif;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--foreground);
  margin-top: 0;
}
h1 { font-size: 1.65rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

/* Theme Toggle Button */
.ln-icon-btn, .theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground);
  cursor: pointer;
  transition: all .15s ease;
  padding: 0;
  flex-shrink: 0;
}
.ln-icon-btn:hover, .theme-toggle-btn:hover {
  background: var(--secondary);
  color: var(--primary);
  border-color: var(--ring);
}

/* Theme toggle icon state */
html.dark .icon-sun { display: block; }
html.dark .icon-moon { display: none; }
html.light .icon-sun { display: none; }
html.light .icon-moon { display: block; }

/* Layout Shell */
.layout { display: flex; min-height: 100vh; background: var(--background); }
.sidebar {
  width: 256px; flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-foreground);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--sidebar-border);
  z-index: 50;
  overflow: hidden;
  transition: width .2s ease, min-width .2s ease, margin .2s ease, opacity .2s ease, border-width .2s ease;
}

.sidebar-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  height: 64px;
  min-height: 64px;
  padding: 0 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  box-sizing: border-box;
}
.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.sidebar-brand-link:hover { text-decoration: none; color: inherit; }
.brand-logo-img {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #ffffff;
  object-fit: contain;
  padding: 2px;
  flex-shrink: 0;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: var(--radius);
  background: var(--gradient-primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 1.15rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.brand-name { font-weight: 700; color: #ffffff; font-size: 0.9rem; line-height: 1.15; }
.brand-sub { font-size: 0.7rem; color: rgba(241, 245, 249, 0.7); margin-top: 1px; }

.sidebar-nav {
  padding: 1rem 0.75rem;
  flex: 1;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.nav-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.75rem; border-radius: var(--radius);
  color: rgba(241, 245, 249, 0.8); font-size: 0.88rem; font-weight: 500;
  transition: all .15s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.1); color: #ffffff; text-decoration: none; }
.nav-active { background: var(--sidebar-accent); color: #ffffff; font-weight: 600; }
.nav-ico { width: 18px; display: flex; justify-content: center; align-items: center; }
.nav-ico svg { width: 18px; height: 18px; stroke-width: 2; }

.sidebar-user {
  flex-shrink: 0;
  margin-top: auto;
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--sidebar);
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--sidebar-border);
  font-size: 0.85rem;
}
.user-gov-img {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #ffffff;
  object-fit: contain;
  padding: 2px;
  flex-shrink: 0;
}
.sidebar-user-name { color: #ffffff; font-weight: 600; font-size: 0.85rem; word-break: break-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: rgba(241, 245, 249, 0.7); font-size: 0.75rem; text-transform: capitalize; }
.sidebar-btn-logout {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  color: rgba(241, 245, 249, 0.85);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all .15s ease;
}
.sidebar-btn-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  text-decoration: none;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  background: var(--card);
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  position: sticky; top: 0; z-index: 40;
  height: 64px;
  min-height: 64px;
  box-sizing: border-box;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}
.topbar-title { font-weight: 700; color: inherit; display: none; align-items: center; gap: 0.5rem; }
.topbar-logo-img {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #ffffff;
  object-fit: contain;
  padding: 2px;
}
.menu-btn {
  display: none;
  background: transparent; border: 1px solid var(--sidebar-border);
  color: #ffffff; border-radius: var(--radius-sm);
  font-size: 1.1rem; padding: 0.35rem 0.65rem; cursor: pointer;
}
.sidebar-collapse-btn { display: inline-flex; }
html.sidebar-collapsed .icon-sidebar-close { display: none; }
html.sidebar-collapsed .icon-sidebar-open { display: block; }
html:not(.sidebar-collapsed) .icon-sidebar-close { display: block; }
html:not(.sidebar-collapsed) .icon-sidebar-open { display: none; }
@media (min-width: 901px) {
  html.sidebar-collapsed .sidebar {
    width: 0;
    min-width: 0;
    border-right-width: 0;
    opacity: 0;
    pointer-events: none;
  }
  html.sidebar-collapsed .content {
    max-width: none;
  }
}
.user-menu { position: relative; }
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  max-width: 240px;
  padding: 0.2rem 0.45rem 0.2rem 0.2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
}
.user-menu-btn:hover {
  border-color: var(--ring);
  background: var(--secondary);
}
.user-menu-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.user-menu-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
  padding-right: 0.35rem;
}
.user-menu-name {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-role {
  font-size: 0.68rem;
  color: var(--muted-foreground);
  text-transform: capitalize;
  line-height: 1.2;
}
.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  min-width: 220px;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 0.4rem;
  z-index: 60;
}
.user-menu-heading {
  padding: 0.55rem 0.7rem 0.65rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.3rem;
}
.user-menu-heading-name { font-weight: 650; font-size: 0.88rem; }
.user-menu-heading-email {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  color: var(--foreground);
  font-size: 0.85rem;
  font-weight: 500;
}
.user-menu-dropdown a:hover {
  background: var(--secondary);
  text-decoration: none;
}

.content { padding: 1.75rem 2rem; max-width: 1280px; width: 100%; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { margin: 0; font-size: 1.65rem; }
.breadcrumbs { margin: 0 0 0.45rem; }
.breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem 0.2rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted-foreground);
}
.breadcrumbs a {
  color: var(--muted-foreground);
  text-decoration: none;
}
.breadcrumbs a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb-current {
  color: var(--foreground);
  font-weight: 600;
  max-width: 28rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.breadcrumb-divider { display: flex; align-items: center; color: var(--muted-foreground); opacity: 0.7; }
.breadcrumb-sep { display: block; }
.page-desc { color: var(--muted-foreground); margin: 0.25rem 0 0; font-size: 0.9rem; }
.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.page-actions .search-box { margin: 0; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1.25rem 1.5rem;
}
.card-hover { transition: all .15s ease; }
.card-hover:hover { border-color: rgba(22, 163, 74, 0.4); background: rgba(22, 163, 74, 0.02); text-decoration: none; transform: translateY(-1px); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat-label { color: var(--muted-foreground); font-size: 0.88rem; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.stat-value { font-size: 1.85rem; font-weight: 700; margin-top: 0.4rem; color: var(--foreground); }
.stat-ico { width: 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center; font-size: 1rem; font-weight: 600; }
.ico-green  { background: rgba(22, 163, 74, 0.12); color: var(--primary); }
.ico-amber  { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.ico-red    { background: rgba(239, 68, 68, 0.12); color: var(--destructive); }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; margin-top: 1.25rem; }

/* Tables */
.table-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th {
  text-align: left; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.05em; font-weight: 600;
  color: var(--muted-foreground); background: var(--secondary); padding: 0.75rem 1rem;
}
table.data td { padding: 0.75rem 1rem; border-top: 1px solid var(--border); vertical-align: middle; color: var(--foreground); }
table.data tr.clickable { cursor: pointer; transition: background .12s; }
table.data tr.clickable:hover td { background: rgba(22, 163, 74, 0.05); }
.empty { padding: 2.5rem; text-align: center; color: var(--muted-foreground); font-size: 0.9rem; }

/* Buttons & Inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 0.55rem 1.1rem; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  background: var(--primary); color: #ffffff;
  font-family: inherit; transition: all .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn:hover { background: var(--primary-hover); text-decoration: none; color: #ffffff; }
.btn-outline { background: var(--card); color: var(--foreground) !important; border-color: var(--border); }
.btn-outline:hover { background: var(--secondary); border-color: var(--border); color: var(--foreground) !important; text-decoration: none; }
.btn-danger { background: var(--destructive); color: #ffffff !important; }
.btn-danger:hover { background: #b91c1c; color: #ffffff !important; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.pagination-controls {
  display: flex;
  gap: .3rem;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}
.pagination-bar button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.pagination-ellipsis {
  min-width: 1.6rem;
  text-align: center;
  color: var(--muted-foreground);
  font-size: .9rem;
  user-select: none;
}
.pagination-meta {
  margin: 0;
  font-size: .85rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.dash-offline-section {
  padding-top: 2.25rem;
  padding-bottom: 2.25rem;
  scroll-margin-top: 80px;
}
.filtered-out { display: none !important; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.88;
}
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: '';
  box-sizing: border-box;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.05rem;
  height: 1.05rem;
  margin: -0.525rem 0 0 -0.525rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
}
.btn-outline.is-loading::after {
  border-color: color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
}
html.dark .btn.is-loading::after,
html.dark .btn-outline.is-loading::after {
  border-color: rgba(244, 246, 245, 0.28);
  border-top-color: #f4f6f5;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.75rem 0 0.3rem; color: var(--foreground); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=url], input[type=tel], select, textarea {
  width: 100%; padding: 0.55rem 0.75rem; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 0.9rem; font-family: inherit; background: var(--card); color: var(--foreground);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem 1rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem 1rem; }
@media (max-width: 768px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}
.form-grid .wide, .form-grid-3 .wide { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.8rem; }
.pref-alert-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 0.35rem;
}
@media (max-width: 900px) {
  .pref-alert-list { grid-template-columns: 1fr; }
}
.pref-check {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--card);
}
.pref-check input { width: auto; margin-top: 0.2rem; flex-shrink: 0; }
.pref-check strong { display: block; font-size: 0.95rem; }
.pref-check-desc {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted-foreground);
  line-height: 1.45;
}
.pref-check.is-disabled { opacity: 0.7; cursor: not-allowed; }
.settings-pref-note {
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--secondary);
  color: var(--foreground);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Badges & Flashes */
.badge { display: inline-flex; align-items: center; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: var(--success-bg); color: var(--success-foreground); }
.badge-warning { background: var(--warning-bg); color: var(--warning-foreground); }
.badge-danger  { background: var(--destructive-bg); color: var(--destructive-foreground); }
.badge-muted   { background: var(--secondary); color: var(--muted-foreground); }

.flash { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: 0.9rem; font-weight: 500; }
.flash-success { background: var(--success-bg); color: var(--success-foreground); border: 1px solid rgba(34, 197, 94, 0.25); }
.flash-error   { background: var(--destructive-bg); color: var(--destructive-foreground); border: 1px solid rgba(239, 68, 68, 0.25); }

/* --- React App Authentication Layouts --- */

.auth-grid-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--background);
}
@media (min-width: 1024px) {
  .auth-grid-page {
    grid-template-columns: 1fr 1fr;
  }
}

.auth-sidebar-banner {
  display: none;
  background: var(--gradient-hero);
  color: #ffffff;
  padding: 3rem;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
@media (min-width: 1024px) {
  .auth-sidebar-banner { display: flex; }
}

.auth-banner-brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: #fff; }
.auth-banner-logo { width: 38px; height: 38px; border-radius: 999px; background: #ffffff; object-fit: contain; padding: 2px; }
.auth-banner-title { font-weight: 700; font-size: 1.1rem; }

.auth-banner-content h2 { font-size: 2rem; font-weight: 700; color: #fff; line-height: 1.2; margin-bottom: 0.8rem; }
.auth-banner-content p { color: rgba(255,255,255,0.75); font-size: 1rem; line-height: 1.6; max-width: 420px; margin: 0; }
.auth-banner-footer { font-size: 0.8rem; color: rgba(255,255,255,0.5); }

.auth-form-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
}
.auth-form-box {
  width: 100%;
  max-width: 380px;
}
.auth-form-box h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.2rem; color: var(--foreground); }
.auth-form-sub { color: var(--muted-foreground); font-size: 0.9rem; margin-bottom: 1.5rem; }

.otp-footer-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}
.otp-text-form { margin: 0; }
.otp-text-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}
.otp-text-btn:hover:not(:disabled) { text-decoration: underline; }
.otp-text-btn:disabled {
  color: var(--muted-foreground);
  cursor: not-allowed;
  text-decoration: none;
}
.otp-text-btn-muted { color: var(--muted-foreground); font-weight: 600; }
.otp-text-btn-muted:hover { color: var(--foreground); }

.auth-centered-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: var(--background);
}

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 0.4rem 0.8rem; font-size: 0.9rem; }
.kv dt { color: var(--muted-foreground); font-weight: 500; }
.kv dd { margin: 0; color: var(--foreground); }
.pin-box {
  background: var(--sidebar); color: #fff; border-radius: var(--radius);
  padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.pin-digits { font-size: 1.85rem; font-weight: 800; letter-spacing: 0.35em; font-family: "JetBrains Mono", monospace; }

/* Contain Leaflet Map z-index below sidebar */
.leaflet-container {
  font-family: "Space Grotesk", system-ui, sans-serif;
  position: relative;
  z-index: 0;
}
.map-box {
  position: relative;
  z-index: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.leaflet-control-layers,
.leaflet-control-layers-expanded {
  background: var(--card) !important;
  color: var(--foreground) !important;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
}
.leaflet-control-layers-expanded {
  padding: 0.55rem 0.7rem;
}
.leaflet-control-layers label,
.leaflet-control-layers-expanded label,
.leaflet-control-layers label span {
  color: var(--foreground) !important;
  font-size: 0.82rem;
  font-weight: 600;
}
.leaflet-control-layers-separator {
  border-top-color: var(--border);
}

.leaflet-tooltip.device-label {
  white-space: normal !important;
  width: max-content;
  min-width: 8.5rem;
  max-width: 14rem;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  padding: 0.4rem 0.55rem;
}
.device-label-stack {
  display: block;
  line-height: 1.3;
  text-align: left;
}
.device-label-stack .dl-name,
.device-label-stack .dl-line {
  display: block;
  overflow-wrap: break-word;
  word-break: normal;
}
.device-label-stack .dl-name {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--foreground);
  margin-bottom: 0.15rem;
}
.device-label-stack .dl-line {
  font-size: 0.7rem;
  color: var(--muted-foreground);
}

.toolbar { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.25rem; align-items: center; }
.settings-tabs .btn { gap: 0.45rem; }
.settings-tabs .btn svg { width: 15px; height: 15px; }
.settings-panel-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.settings-panel-heading svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--primary);
}
.search-box { max-width: 380px; }
.table-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.table-section-head .search-box { margin: 0; }
@media (max-width: 720px) {
  .table-section-head .search-box {
    flex: 1 1 100%;
    max-width: none;
  }
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 1.25rem;
  align-items: start;
}
.settings-layout.is-busy {
  opacity: 0.6;
  pointer-events: none;
}
#settingsFlash:empty { display: none; }
#settingsFlash { margin-bottom: 1rem; }
.theme-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.6rem;
}
.theme-card-option {
  padding: 1.1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--card);
  transition: all .15s;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}
.settings-tips {
  position: sticky;
  top: 80px;
}
.settings-tips h3 { margin-bottom: 0.65rem; }
.settings-tips ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted-foreground);
  font-size: 0.88rem;
  line-height: 1.55;
}
.settings-tips li { margin: 0.45rem 0; }
.settings-tips li strong { color: var(--foreground); font-weight: 600; }
.settings-tips a { font-weight: 600; }

.twofa-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-top: 0.35rem;
}
.twofa-row p {
  margin: 0.25rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.88rem;
}
.twofa-form { margin-top: 0.85rem; }
.twofa-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  margin-top: 0.35rem;
}
.twofa-inline input { max-width: 280px; flex: 1; }

.otp-group { margin-top: 0.2rem; }
.otp-boxes {
  display: flex;
  gap: 0.45rem;
  flex-wrap: nowrap;
  justify-content: center;
}
.otp-box {
  width: 2.7rem !important;
  max-width: 2.7rem !important;
  height: 3.05rem;
  flex: 0 0 2.7rem;
  padding: 0 !important;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0;
  caret-color: var(--primary);
}
@media (max-width: 480px) {
  .otp-box {
    width: 2.3rem !important;
    max-width: 2.3rem !important;
    flex-basis: 2.3rem;
    height: 2.75rem;
    font-size: 1.15rem;
  }
  .otp-boxes { gap: 0.32rem; }
}
.twofa-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}
.twofa-setup {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  margin: 1rem 0;
}
.twofa-setup img {
  background: #fff;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.twofa-secret {
  display: inline-block;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
  padding: 0.4rem 0.55rem;
  background: var(--muted);
  border-radius: 6px;
}

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }
  .grid-2, .detail-grid, .form-grid, .settings-layout, .theme-card-grid { grid-template-columns: 1fr; }
  .settings-tips { position: static; }
  .topbar {
    background: var(--sidebar);
    color: var(--sidebar-foreground);
    border-bottom: 1px solid var(--sidebar-border);
    padding: 0 1rem;
    height: 64px;
    min-height: 64px;
  }
  .topbar-title { display: flex; color: #ffffff; }
  .topbar-logo-img { display: none; }
  .menu-btn { display: inline-flex; }
  .sidebar-collapse-btn { display: none; }
  html.sidebar-collapsed .sidebar {
    width: 270px;
    min-width: 270px;
    opacity: 1;
    pointer-events: auto;
    border-right-width: 1px;
  }
  html.sidebar-collapsed .content {
    max-width: none;
  }
  .topbar .ln-icon-btn,
  .topbar .theme-toggle-btn {
    color: #ffffff;
    border-color: var(--sidebar-border);
  }
  .topbar .ln-icon-btn:hover,
  .topbar .theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
  }
  .user-menu-btn {
    background: transparent;
    border-color: var(--sidebar-border);
    color: #ffffff;
    padding: 0;
    max-width: none;
  }
  .user-menu-meta { display: none; }
  .user-menu-dropdown { color: var(--foreground); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 50;
    width: 270px;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%); transition: transform .2s ease;
    overflow: hidden;
  }
  .sidebar-brand { flex-shrink: 0; }
  .sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }
  .sidebar-user {
    flex-shrink: 0;
    margin-top: auto;
    width: 100%;
    position: relative;
    z-index: 10;
    background: var(--sidebar);
    border-top: 1px solid var(--sidebar-border);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45;
  }
  .content { padding: 1rem 0.85rem; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .page-actions { width: 100%; justify-content: flex-start; }
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
  .stat-value { font-size: 1.3rem; }
  .kv { grid-template-columns: 110px 1fr; gap: 0.35rem 0.6rem; font-size: 0.85rem; }
  .kv dt { overflow-wrap: break-word; word-break: break-word; }
  .kv dd { overflow-wrap: anywhere; word-break: break-word; }
  .pin-digits { font-size: 1.35rem; letter-spacing: 0.2em; word-break: break-all; }
  .card { padding: 1rem; }
  .map-box { height: 260px !important; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 0.15rem 0; }
  .kv dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-foreground); margin-top: 0.4rem; }
  .kv dd { font-size: 0.88rem; margin-bottom: 0.25rem; }
}

/* Staff photos in tables and forms */
.photo-sm {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  border-radius: 999px !important;
  object-fit: cover !important;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  border: 1px solid var(--border);
}
.photo-placeholder {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  border-radius: 999px !important;
  background: var(--accent);
  color: var(--accent-foreground);
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  vertical-align: middle;
  border: 1px solid var(--border);
}

/* Searchable Combobox Select */
.searchable-select {
  position: relative;
  width: 100%;
}
.combobox-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color .15s, box-shadow .15s;
}
.combobox-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}
.combobox-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  margin-top: 4px;
}
.combobox-item {
  padding: 0.6rem 0.85rem;
  font-size: 0.88rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  color: var(--foreground);
  transition: background .12s ease;
}
.combobox-item:last-child {
  border-bottom: none;
}
.combobox-item:hover, .combobox-item.active {
  background: var(--secondary);
  color: var(--primary);
}
.combobox-sub {
  font-size: 0.78rem;
  color: var(--muted-foreground);
  margin-left: 0.35rem;
}

/* Document container and pre/code block responsive overflow protection */
.doc {
  max-width: 100%;
  box-sizing: border-box;
}
.doc pre, pre {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}
.doc code, code {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-all;
}

/* ====================================================================
   Custom Delete Confirmation Modal Dialog System
   ==================================================================== */
.custom-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.custom-modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}
.custom-modal-card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 460px;
  overflow: hidden;
  transform: scale(0.92) translateY(12px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.custom-modal-backdrop.active .custom-modal-card {
  transform: scale(1) translateY(0);
}
.custom-modal-header {
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.custom-modal-icon-badge {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  color: var(--destructive);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  border: 1px solid rgba(239, 68, 68, 0.25);
  animation: pulse-subtle 2s infinite;
}
@keyframes pulse-subtle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.custom-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--foreground);
  margin: 0 0 0.4rem 0;
}
.custom-modal-desc {
  font-size: 0.88rem;
  color: var(--muted-foreground);
  line-height: 1.5;
  margin: 0;
}
.custom-modal-body {
  padding: 0 1.5rem 1.25rem 1.5rem;
}
.custom-modal-input-group {
  margin-top: 0.8rem;
  text-align: left;
}
.custom-modal-input-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted-foreground);
  margin-bottom: 0.4rem;
}
.custom-modal-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font-family: inherit;
  font-size: 0.9rem;
  box-sizing: border-box;
}
.custom-modal-input:focus {
  outline: none;
  border-color: var(--destructive);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}
.custom-modal-footer {
  padding: 1rem 1.5rem 1.5rem 1.5rem;
  background: var(--secondary);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}
.custom-modal-btn {
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.custom-modal-btn-cancel {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border);
}
.custom-modal-btn-cancel:hover {
  background: var(--muted);
}
.custom-modal-icon-badge.is-warning {
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.3);
}
.custom-modal-btn-go {
  background: var(--primary);
  color: #ffffff;
}
.custom-modal-btn-go:hover {
  background: var(--primary-hover);
}
.form-modal-backdrop { z-index: 10000; }
.form-modal-card {
  max-width: 640px;
  max-height: min(92vh, 820px);
  overflow: auto;
  text-align: left;
}
.form-modal-head {
  padding: 1.35rem 1.5rem 0.35rem;
}
.form-modal-head h3 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
}
.form-modal-head p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted-foreground);
}
.form-modal-form { padding: 0.5rem 1.5rem 0; }
.form-modal-section {
  margin: 1.15rem 0 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
}
.form-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
  margin: 1.6rem -1.5rem 0;
  padding: 1.25rem 1.5rem 1.4rem;
  border-top: 1px solid var(--border);
}
.user-actions-menu {
  position: relative;
  display: inline-flex;
  justify-content: flex-end;
}
.user-actions-dropdown {
  min-width: 220px;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  padding: 0.4rem;
}
.user-actions-dropdown[hidden] {
  display: none !important;
}
.user-actions-dropdown form {
  display: block;
  margin: 0;
}
.user-action-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: none;
  background: none;
  border-radius: 8px;
  color: var(--foreground);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.user-action-item:hover {
  background: var(--secondary);
}
.user-action-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.user-action-item.is-danger {
  color: var(--destructive);
}
.user-actions-dropdown .user-action-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.3rem 0;
}
.user-role-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.user-role-form select,
select.user-role-select {
  width: auto;
  min-width: 0;
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
  line-height: 1.2;
  border-radius: var(--radius-sm);
  height: 2.05rem;
}
.custom-modal-btn-delete:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ====================================================================
   Geofence Enhancement Styles: High-Visibility Markers, Radius Badges,
   Search Autocomplete, and Map Controls
   ==================================================================== */

/* Custom High-Visibility HTML Marker Pin */
.geofence-marker-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  border: 2px solid #ffffff;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.geofence-marker-pin:hover {
  transform: rotate(-45deg) scale(1.15);
  z-index: 1000 !important;
}
.geofence-marker-pin svg {
  transform: rotate(45deg);
  width: 18px;
  height: 18px;
  color: #ffffff;
  flex-shrink: 0;
}

/* Colors for Marker Pins */
.marker-pin-active {
  background: linear-gradient(135deg, #16a34a, #059669);
  border-color: #ffffff;
}
.marker-pin-autolock {
  background: linear-gradient(135deg, #dc2626, #991b1b);
  border-color: #fee2e2;
}
.marker-pin-draft {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #fffbeb;
  animation: marker-pulse-glow 2s infinite;
}
.marker-pin-inactive {
  background: linear-gradient(135deg, #64748b, #475569);
  border-color: #e2e8f0;
}

/* Pulsing radar ring around active or draft markers */
.geofence-pulse-ring {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  top: -3px;
  left: -3px;
  pointer-events: none;
  border: 2px solid #22c55e;
  animation: pulse-ring-anim 2.2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
.pulse-autolock {
  border-color: #ef4444;
}
.pulse-draft {
  border-color: #f59e0b;
}

@keyframes pulse-ring-anim {
  0% {
    transform: scale(0.6);
    opacity: 0.9;
  }
  70% {
    transform: scale(2.2);
    opacity: 0;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}
@keyframes marker-pulse-glow {
  0%, 100% {
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.8));
  }
  50% {
    filter: drop-shadow(0 0 14px rgba(245, 158, 11, 1));
  }
}

/* Permanent Map Tooltip Labels */
.geofence-map-label {
  background: rgba(15, 23, 42, 0.88) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  font-size: 0.8rem !important;
  padding: 0.25rem 0.6rem !important;
  border-radius: 6px !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
  white-space: nowrap !important;
}
.geofence-map-label::before {
  border-top-color: rgba(15, 23, 42, 0.88) !important;
}

/* Radius Preset Button Chips */
.radius-chips-row {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.4rem;
}
.radius-chip {
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--secondary);
  border: 1px solid var(--border);
  color: var(--foreground);
  cursor: pointer;
  transition: all 0.15s ease;
}
.radius-chip:hover {
  background: var(--muted);
  border-color: var(--primary);
  color: var(--primary);
}
.radius-chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Map Header Floating Overlay Bar */
.map-interactive-bar {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  box-shadow: var(--shadow-card);
}

/* On-Map Floating Info Card / Radius Indicator */
.map-boundary-indicator {
  position: absolute;
  bottom: 24px;
  left: 24px;
  z-index: 800;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: all 0.2s ease;
  max-width: calc(100% - 48px);
}
.map-boundary-indicator .boundary-metric {
  display: flex;
  flex-direction: column;
}
.map-boundary-indicator .metric-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.7);
}
.map-boundary-indicator .metric-val {
  font-weight: 700;
  font-size: 0.95rem;
  color: #22c55e;
  font-family: "JetBrains Mono", monospace;
}

/* Search Dropdown on Map Form */
.school-search-container {
  position: relative;
  width: 100%;
}
.school-search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.school-search-input-wrap input {
  padding-left: 2.2rem;
  padding-right: 2.2rem;
}
.school-search-icon {
  position: absolute;
  left: 0.75rem;
  pointer-events: none;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
}
.school-search-spinner {
  position: absolute;
  right: 0.75rem;
  display: none;
  animation: spin 1s linear infinite;
  color: var(--primary);
}
@keyframes spin {
  100% { transform: rotate(360deg); }
}
.school-results-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
  z-index: 999;
  display: none;
}
.school-result-item {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s ease;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.school-result-item:last-child {
  border-bottom: none;
}
.school-result-item:hover, .school-result-item.active {
  background: var(--secondary);
}
.school-result-item .item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(34, 197, 94, 0.15);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.school-result-item .item-title {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--foreground);
}
.school-result-item .item-sub {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 1px;
}

/* Edit Mode Banner */
.edit-mode-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--warning-foreground);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}