/* ==========================================================================
   NunuaNet — ISP platform application stylesheet
   Mobile-first, app-like design system on top of Bootstrap 5.3
   ========================================================================== */

:root {
  /* Brand palette */
  --brand: #0EA85C;
  --brand-strong: #087C43;
  --brand-ink: #101D35;
  --brand-ink-2: #172B4D;
  --brand-soft: #DDFBEA;
  --brand-soft-2: #F1FFF7;

  --success: #0EA85C;
  --success-soft: #DDFBEA;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --info: #0284c7;
  --info-soft: #e0f2fe;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-muted: #6b7280;

  --radius: 0.875rem;
  --radius-sm: 0.625rem;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.14);

  --topbar-h: 60px;
  --topbar-h-mobile: 56px;
  --sidebar-w: 272px;
  --sidebar-w-collapsed: 84px;
  --bottomnav-h: 64px;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --brand-glow: rgba(25, 211, 122, 0.22);

  --font: Inter, system-ui, "Segoe UI", Arial, sans-serif;
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--brand-strong); }
a:hover { color: var(--brand); }

/* Safe-area aware app body */
.app-body {
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--topbar-h);
  background: var(--brand-ink);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
.topbar-inner {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  margin: 0;
}
/* Authenticated pages anchor the hamburger to the true left edge of the
   workspace. Public pages keep their normal left gutter. */
.has-sidebar .topbar-inner { padding-left: 0; }
.topbar-brand-group {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 0 1 auto;
}
.topbar-toggle-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.topbar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 0.625rem;
  background: transparent;
  color: rgba(255,255,255,0.85);
  font-size: 1.4rem;
}
.topbar-toggle:hover { background: rgba(255,255,255,0.1); color: #fff; }
.topbar-collapse {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 2px solid var(--brand-ink);
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 0.62rem;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(15,23,42,0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(0.8);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease,
    background 0.18s ease, color 0.18s ease;
}
.topbar-collapse.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
}
.topbar-collapse:hover { background: var(--brand-strong); }
.topbar-collapse:focus-visible { outline: 2px solid #5eead4; outline-offset: 2px; }
.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.topbar-brand:hover { color: #fff; }
.topbar-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 0.55rem;
  background: rgba(94, 234, 212, 0.14);
}
.topbar-brand-icon i { color: #5eead4; font-size: 1.2rem; line-height: 1; }
.topbar-brand-icon img { display: block; width: 28px; height: 28px; object-fit: contain; }
.topbar-brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-actions { min-width: 0; flex: 0 0 auto; }
.topbar-nav { display: none; }
.topbar-link {
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  white-space: nowrap;
}
.topbar-link:hover { color: #fff; background: rgba(255,255,255,0.1); }
.topbar-link.active { color: #5eead4; }
.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.4rem;
  border: 0;
  border-radius: 0.625rem;
  background: transparent;
  color: #fff;
}
.topbar-user:hover { background: rgba(255,255,255,0.08); }
.topbar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(94,234,212,0.18);
  color: #5eead4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  flex-shrink: 0;
}
.topbar-user-name { font-size: 0.9rem; font-weight: 500; }

/* ---------- Public mobile nav (hamburger menu) ---------- */
.public-mobile-menu {
  background: var(--brand-ink-2);
  border-top: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow);
}
.public-mobile-menu nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
}
.public-mobile-menu a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 0.8rem 0.75rem;
  font-size: 1rem;
  border-radius: 0.5rem;
  min-height: 44px;
}
.public-mobile-menu a:hover,
.public-mobile-menu a:focus { background: rgba(255,255,255,0.08); color: #fff; }
.public-mobile-menu a.active { color: #5eead4; }
.public-mobile-menu a.public-mobile-cta {
  margin-top: 0.5rem;
  background: var(--brand);
  color: #fff;
  justify-content: center;
  font-weight: 600;
}
.public-mobile-menu a.public-mobile-cta:hover { background: var(--brand-strong); color: #fff; }

/* ---------- Sidebar (off-canvas on mobile, static on desktop) ---------- */
.sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  max-width: 84vw;
  z-index: 1045;
  background: var(--brand-ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  box-shadow: none;
  overscroll-behavior: contain;
}
.sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
  -webkit-overflow-scrolling: touch;
}
.sidebar-nav .nav-item-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.1rem;
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-size: 0.95rem;
  border-left: 3px solid transparent;
  min-height: 44px;
}
.sidebar-nav .nav-item-link i { width: 22px; text-align: center; font-size: 1.1rem; flex-shrink: 0; }
.sidebar-nav .nav-item-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav .nav-item-link.active {
  color: #fff;
  background: rgba(13,148,136,0.22);
  border-left-color: #2dd4bf;
}
/* ---------------------------------------------------------------------------
   Platform Admin — visually distinct from the business dashboard.
   The admin panel uses an indigo accent (business uses teal).
   --------------------------------------------------------------------------- */
.admin-badge {
  display: inline-flex;
  align-items: center;
  margin: 0.6rem 1rem 0.25rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.4);
}
.sidebar-nav .nav-section {
  padding: 0.85rem 1.1rem 0.3rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.7);
}
.app-body.admin-context .sidebar { background: #10142a; }
.app-body.admin-context .sidebar-nav .nav-item-link.active {
  background: rgba(99, 102, 241, 0.24);
  border-left-color: #818cf8;
}
.app-body.admin-context .topbar { background: var(--brand-ink); color: #fff; }
.app-body.admin-context .app-main { background: #f5f6fb; }
.admin-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin: 1.6rem 0 0.75rem;
}

.sidebar-overlay {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  background: rgba(15,23,42,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(1px);
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

/* ---------- Main content ---------- */
.app-main {
  min-height: calc(100vh - var(--topbar-h));
  padding-top: 0; /* topbar is sticky */
}
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1rem calc(var(--bottomnav-h) + 1.5rem + env(safe-area-inset-bottom));
}
.app-main--public .app-container {
  padding-bottom: calc(2rem + env(safe-area-inset-bottom));
}

/* ---------- Bottom navigation (mobile) ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1030;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  box-shadow: 0 -4px 20px rgba(15,23,42,0.06);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.68rem;
  min-height: 52px;
  position: relative;
}
.bottom-nav a i { font-size: 1.35rem; line-height: 1; }
.bottom-nav a.active { color: var(--brand-strong); font-weight: 600; }
.bottom-nav a.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 2px;
  background: var(--brand);
  border-radius: 0 0 2px 2px;
}

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
.card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  padding: 0.875rem 1.1rem;
}
.card-header:first-child { border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.card-body { padding: 1.1rem; }

/* KPI / stat cards */
.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.1rem;
  height: 100%;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card .stat-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}
.stat-card .stat-foot { margin-top: 0.5rem; font-size: 0.8rem; }
.stat-icon.primary { background: var(--brand-soft); color: var(--brand-strong); }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.info { background: var(--info-soft); color: var(--info); }
.stat-icon.danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- Tables ---------- */
.table { margin-bottom: 0; }
.table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.table td { vertical-align: middle; font-size: 0.9rem; border-color: var(--border); }
.table > :not(caption) > * > * { padding: 0.7rem 0.9rem; }
.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
.table-hover > tbody > tr:hover > * { background: var(--brand-soft-2); }

/* ---------- Badges & status ---------- */
.badge { font-weight: 500; letter-spacing: 0.01em; }
.badge-soft-success { background: var(--success-soft); color: #047857; }
.badge-soft-danger { background: var(--danger-soft); color: #b91c1c; }
.badge-soft-warning { background: var(--warning-soft); color: #b45309; }
.badge-soft-info { background: var(--info-soft); color: #0369a1; }
.badge-soft-muted { background: #eef2f7; color: #475569; }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; font-size: 0.875rem; color: var(--text); margin-bottom: 0.35rem; }
.form-control, .form-select {
  border-color: var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.18rem rgba(13,148,136,0.15);
}
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.required::after { content: " *"; color: var(--danger); }

/* ---------- Buttons ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 500; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-outline-primary { color: var(--brand-strong); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Alerts / toasts ---------- */
.alert { border: 1px solid transparent; border-radius: var(--radius-sm); }
.alert-success { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }
.alert-danger { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.alert-warning { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }
.alert-info { background: var(--info-soft); color: #075985; border-color: #bae6fd; }

/* ---------- Empty state / loading ---------- */
.empty-state { text-align: center; padding: 3rem 1rem; }
.empty-state i { font-size: 3rem; color: #cbd5e1; margin-bottom: 0.75rem; }
.empty-state h5 { color: var(--text-muted); }
.empty-state p { color: var(--text-muted); }

.skeleton {
  background: linear-gradient(90deg, #eef2f7 25%, #e2e8f0 50%, #eef2f7 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: 0.5rem;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Auth ---------- */
.auth-body { background: linear-gradient(160deg, var(--brand-ink) 0%, #134e4a 100%); min-height: 100vh; }
.auth-card {
  background: var(--surface);
  border: 0;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-header .breadcrumb { margin: 0; }
.page-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.app-footer { border-top: 1px solid var(--border); margin-top: 1rem; }
.app-footer .app-container { padding-top: 1rem; padding-bottom: calc(1rem + var(--bottomnav-h) + env(safe-area-inset-bottom)); }
@media (min-width: 992px) {
  .app-footer .app-container { padding-bottom: 1rem; }
}

/* ---------- Offline toast ---------- */
.offline-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 0.75rem);
  transform: translateX(-50%);
  z-index: 2000;
  background: var(--brand-ink);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 2rem;
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Public marketing navigation uses full links from tablet landscape upward;
   keep the hamburger for compact screens only. */
@media (min-width: 768px) {
  .topbar-nav { display: flex; }
  .topbar-link { padding: 0.35rem 0.5rem; font-size: 0.875rem; }
}

/* ---------- Desktop (>= 992px): static sidebar ---------- */
@media (min-width: 992px) {
  .sidebar {
    transform: translateX(0);
    width: var(--sidebar-w);
    box-shadow: none;
    border-right: 1px solid rgba(255,255,255,0.06);
  }
  .sidebar-overlay { display: none !important; }
  .app-main:not(.app-main--public) { margin-left: var(--sidebar-w); }
  .bottom-nav { display: none; }
  .app-container { padding-bottom: 2rem; }
  .topbar-inner { padding: 0 1.25rem; }
}

/* ---------- Mobile form/touch ergonomics ---------- */
@media (max-width: 575.98px) {
  .form-control, .form-select { font-size: 16px; } /* prevent iOS zoom */
  .btn { min-height: 40px; }
  .table td, .table th { font-size: 0.84rem; }
  .page-header h1 { font-size: 1.25rem; }
  .stat-card .stat-value { font-size: 1.3rem; }
  .app-container { padding: 0.875rem 0.875rem calc(var(--bottomnav-h) + 1.25rem + env(safe-area-inset-bottom)); }
}

/* ---------- Accessibility ---------- */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* ---------- Print ---------- */
@media print {
  .topbar, .sidebar, .sidebar-overlay, .bottom-nav, .btn, .no-print { display: none !important; }
  .app-main { margin-left: 0; }
}

/* ---------- Public hero (landing) responsive ---------- */
.hero .container { padding-top: 2rem; padding-bottom: 2rem; }
.hero h1.display-4 { font-size: 2rem; line-height: 1.2; }
.hero p.lead { font-size: 1.05rem; line-height: 1.65; }
.hero .bi-wifi.display-1 { font-size: 3rem; }
.hero .d-flex a.btn { flex: 1 1 100%; }
@media (min-width: 576px) {
  .hero .container { padding-top: 3rem; padding-bottom: 3rem; }
  .hero h1.display-4 { font-size: 2.5rem; }
  .hero .d-flex a.btn { flex: 0 1 auto; }
}
@media (min-width: 992px) {
  .hero h1.display-4 { font-size: 3.5rem; }
  .hero p.lead { font-size: 1.25rem; }
  .hero .bi-wifi.display-1 { font-size: 5rem; }
  .hero .container { padding-top: 4rem; padding-bottom: 4rem; }
}

/* ---------- Utilities ---------- */
.cursor-pointer { cursor: pointer; }
.text-xs { font-size: 0.75rem; }
.rounded-lg { border-radius: var(--radius); }
.border-left-primary { border-left: 4px solid var(--brand); }
.border-left-success { border-left: 4px solid var(--success); }
.border-left-warning { border-left: 4px solid var(--warning); }
.border-left-info { border-left: 4px solid var(--info); }

/* ==========================================================================
   NunuaNet - premium dashboard refresh
   Customers, sessions, navigation and shared card/table/filter primitives.
   Appended after the base design system so existing pages keep working.
   ========================================================================== */

/* ---------- App shell: hamburger + collapsible sidebar ---------- */
.topbar-toggle {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: background 0.18s ease, color 0.18s ease;
}
.topbar-toggle i { font-size: 1.45rem; line-height: 1; }
.topbar-toggle[aria-expanded="true"] { background: rgba(255,255,255,0.12); color: #fff; }

.sidebar {
  --sidebar-item-active: rgba(13,148,136,0.24);
  width: var(--sidebar-w);
  background:
    radial-gradient(120% 55% at 0% 0%, rgba(20,184,166,0.16) 0%, rgba(15,23,42,0) 55%),
    linear-gradient(180deg, #0b1220 0%, #0f172a 58%, #0b1220 100%);
  transition: transform 0.24s ease, width 0.22s ease, box-shadow 0.24s ease;
  overflow: hidden;
}
.sidebar-nav { padding: 0.45rem 0 0.75rem; overflow-x: hidden; }
.sidebar-nav .nav-section {
  padding: 0.9rem 1.1rem 0.3rem;
  color: rgba(148,163,184,0.62);
  font-size: 0.63rem;
  letter-spacing: 0.11em;
  white-space: nowrap;
  overflow: hidden;
  transition: height 0.18s ease, padding 0.18s ease, opacity 0.15s ease;
}
.sidebar-nav .nav-item-link {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  column-gap: 0.8rem;
  margin: 0.08rem 0.55rem;
  padding: 0.62rem 0.72rem;
  border-left: 0;
  border-radius: 0.62rem;
  color: rgba(226,232,240,0.74);
  font-size: 0.915rem;
  overflow: hidden;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.sidebar-nav .nav-item-link .nav-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: width 0.18s ease, opacity 0.15s ease, visibility 0.15s ease;
}
.sidebar-nav .nav-item-link i {
  width: 22px;
  font-size: 1.08rem;
  color: rgba(148,163,184,0.9);
  transition: color 0.16s ease;
}
.sidebar-nav .nav-item-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  transform: translateX(1px);
}
.sidebar-nav .nav-item-link:hover i { color: #5eead4; }
.sidebar-nav .nav-item-link.active {
  color: #fff;
  background: var(--sidebar-item-active);
  box-shadow: inset 0 0 0 1px rgba(45,212,191,0.18);
}
.sidebar-nav .nav-item-link.active i { color: #5eead4; }
.sidebar-nav .nav-item-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 24%;
  bottom: 24%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #2dd4bf;
}
.sidebar-tooltip {
  position: fixed;
  z-index: 2200;
  padding: 0.42rem 0.62rem;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 0.45rem;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 10px 24px rgba(15,23,42,0.25);
  opacity: 0;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.sidebar-tooltip.show { opacity: 1; transform: translateY(-50%) translateX(0); }

@media (min-width: 992px) {
  .sidebar { width: var(--sidebar-w); transform: translateX(0); }
  .app-main:not(.app-main--public) {
    margin-left: var(--sidebar-w);
    transition: margin-left 0.22s ease;
  }
  body.sidebar-collapsed { --sidebar-w: var(--sidebar-w-collapsed); }
  body.sidebar-collapsed .sidebar,
  .sidebar.is-collapsed { width: var(--sidebar-w-collapsed); }

  /* Collapsed layout is driven by the sidebar grid, not by individually
     hiding unrelated page elements. Text tracks collapse to zero width and
     fade out; the icon column stays centred and never overflows. */
  body.sidebar-collapsed .sidebar-nav .nav-section,
  .sidebar.is-collapsed .sidebar-nav .nav-section {
    height: 0;
    min-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  body.sidebar-collapsed .admin-badge,
  .sidebar.is-collapsed .admin-badge {
    width: 36px;
    height: 28px;
    margin: 0.65rem auto 0.25rem;
    padding: 0;
    justify-content: center;
    overflow: hidden;
  }
  body.sidebar-collapsed .admin-badge span,
  .sidebar.is-collapsed .admin-badge span {
    width: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
  }
  body.sidebar-collapsed .sidebar-nav .nav-item-link,
  .sidebar.is-collapsed .sidebar-nav .nav-item-link {
    grid-template-columns: 22px;
    justify-content: center;
    column-gap: 0;
    padding: 0.7rem 0.5rem;
    margin: 0.14rem 0.6rem;
  }
  body.sidebar-collapsed .sidebar-nav .nav-label,
  .sidebar.is-collapsed .sidebar-nav .nav-label {
    display: none;
  }
  body.sidebar-collapsed .sidebar-nav .nav-item-link i,
  .sidebar.is-collapsed .sidebar-nav .nav-item-link i { width: 22px; font-size: 1.16rem; }
  body.sidebar-collapsed .sidebar-nav .nav-item-link.active::before,
  .sidebar.is-collapsed .sidebar-nav .nav-item-link.active::before {
    top: 26%; bottom: 26%; left: -0.6rem;
  }
}
@media (max-width: 991.98px) {
  .sidebar { max-width: min(86vw, 330px); }
  .sidebar.open { box-shadow: 0 24px 60px rgba(2,6,23,0.45); }
  .sidebar-overlay { background: rgba(2,6,23,0.58); backdrop-filter: blur(2px); }
  body.sidebar-open { overflow: hidden; }
}

/* ---------- Page header / actions ---------- */
.page-header { margin-bottom: 1.1rem; align-items: flex-start; }
.page-header h1 { font-size: 1.55rem; letter-spacing: -0.025em; }
.page-header .breadcrumb { font-size: 0.8rem; }
.page-header .breadcrumb a { text-decoration: none; color: var(--text-muted); }
.page-header-actions .btn { box-shadow: var(--shadow-sm); }

/* ---------- Stat cards ---------- */
.stats-grid { margin-bottom: 1.1rem; }
.stat-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 1rem 1.05rem;
  overflow: hidden;
}
.stat-card .stat-label {
  font-size: 0.68rem;
  letter-spacing: 0.075em;
  margin-bottom: 0.42rem;
}
.stat-card .stat-value { font-size: 1.6rem; letter-spacing: -0.03em; }
.stat-card .stat-foot { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.32rem; }
.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 0.8rem;
  font-size: 1.2rem;
  flex: 0 0 42px;
}
.stat-card.stat-link { color: inherit; text-decoration: none; }
.stat-card.stat-link:hover { color: inherit; border-color: rgba(13,148,136,0.35); }
.stat-card.is-active { border-color: rgba(13,148,136,0.48); box-shadow: 0 0 0 3px rgba(13,148,136,0.08); }

/* ---------- Filter toolbar ---------- */
.filter-card { margin-bottom: 1rem; overflow: hidden; }
.filter-card .card-body { padding: 0.85rem 1rem; }
.filter-toolbar { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; }
.filter-search { position: relative; flex: 1 1 260px; min-width: 220px; }
.filter-search .bi-search {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.9rem;
  pointer-events: none;
}
.filter-search .form-control { padding-left: 2.2rem; }
.filter-toolbar .form-select { flex: 0 1 165px; min-width: 140px; }
.filter-toolbar .date-input { flex: 0 1 150px; min-width: 135px; }
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border);
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.3;
  transition: all 0.15s ease;
}
.filter-chip:hover { border-color: rgba(13,148,136,0.4); color: var(--brand-strong); }
.filter-chip.active {
  border-color: var(--brand);
  background: var(--brand-soft-2);
  color: var(--brand-strong);
  box-shadow: 0 0 0 2px rgba(13,148,136,0.08);
}
.filter-chip .count { color: #94a3b8; font-weight: 600; }
.filter-chip.active .count { color: var(--brand-strong); }

/* ---------- Avatar & identity ---------- */
.avatar {
  --avatar-size: 40px;
  width: var(--avatar-size);
  height: var(--avatar-size);
  flex: 0 0 var(--avatar-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: hsl(var(--avatar-hue, 174), 58%, 42%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22);
}
.avatar.avatar-sm { --avatar-size: 32px; font-size: 0.72rem; }
.avatar.avatar-lg { --avatar-size: 62px; font-size: 1.15rem; }
.avatar.is-guest { background: hsl(var(--avatar-hue, 30), 22%, 48%); }
.identity-cell { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.identity-meta { min-width: 0; }
.identity-name {
  display: block;
  font-weight: 600;
  font-size: 0.91rem;
  color: #0f172a;
  text-decoration: none;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.identity-name:hover { color: var(--brand-strong); }
.identity-sub {
  display: block;
  margin-top: 0.1rem;
  color: #64748b;
  font-size: 0.76rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.identity-sub .bi { font-size: 0.72rem; color: #94a3b8; margin-right: 0.12rem; }

/* ---------- Status pills ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  padding: 0.27rem 0.58rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 6px;
}
.status-pill.active { color: #047857; background: #d1fae5; border-color: #a7f3d0; }
.status-pill.pending { color: #b45309; background: #fef3c7; border-color: #fde68a; }
.status-pill.expired { color: #475569; background: #eef2f7; border-color: #e2e8f0; }
.status-pill.revoked { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }
.status-pill.danger { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }
.status-pill.info { color: #0369a1; background: #e0f2fe; border-color: #bae6fd; }
.status-pill.neutral { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.status-pill.guest { color: #6b7280; background: #f3f4f6; border-color: #e5e7eb; }
.status-pill.registered { color: #0f766e; background: #ccfbf1; border-color: #99f6e4; }
.status-pill.active::before { animation: status-pulse 2s ease-in-out infinite; }
@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(5,150,105,0.35); }
  50% { box-shadow: 0 0 0 4px rgba(5,150,105,0); }
}

/* ---------- Modern table ---------- */
.table-card { overflow: hidden; }
.table-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.05rem;
}
.table-card .card-header h2 { font-size: 0.98rem; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.table-card .card-header .table-count { font-size: 0.78rem; color: var(--text-muted); }
.table-modern { margin-bottom: 0; }
.table-modern > :not(caption) > * > * { padding: 0.8rem 0.95rem; }
.table-modern thead th {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  letter-spacing: 0.065em;
  color: #64748b;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}
.table-modern tbody tr { transition: background 0.14s ease; }
.table-modern tbody tr:hover { background: #f8fdfc; }
.table-modern tbody td { border-color: #eef2f7; font-size: 0.86rem; }
.table-modern .muted { color: var(--text-muted); font-size: 0.78rem; }
.cell-stack { display: flex; flex-direction: column; gap: 0.12rem; min-width: 0; }
.cell-strong { font-weight: 600; color: #1e293b; }
.cell-sub { color: #64748b; font-size: 0.76rem; }

.usage-cell { min-width: 145px; }
.usage-numbers { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.usage-numbers strong { font-size: 0.84rem; }
.usage-numbers span { font-size: 0.7rem; color: #94a3b8; }
.usage-bar {
  height: 5px;
  margin-top: 0.38rem;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}
.usage-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #14b8a6, #0d9488);
  transition: width 0.4s ease;
}
.usage-bar.is-high > span { background: linear-gradient(90deg, #f59e0b, #d97706); }
.usage-bar.is-full > span { background: linear-gradient(90deg, #ef4444, #dc2626); }
.usage-split { font-size: 0.68rem; color: #94a3b8; margin-top: 0.22rem; white-space: nowrap; }

/* ---------- Action buttons ---------- */
.action-group { display: inline-flex; align-items: center; gap: 0.28rem; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: #fff;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1;
  text-decoration: none;
  transition: all 0.14s ease;
}
.icon-btn:hover { border-color: rgba(13,148,136,0.45); background: var(--brand-soft-2); color: var(--brand-strong); }
.icon-btn.danger:hover { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.icon-btn.warning:hover { border-color: #fde68a; background: #fffbeb; color: #b45309; }
.icon-btn.success:hover { border-color: #a7f3d0; background: #ecfdf5; color: #047857; }
.icon-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* ---------- Empty states ---------- */
.empty-state {
  padding: 3.25rem 1.25rem;
  text-align: center;
}
.empty-state .empty-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  background: var(--surface-3);
  color: #94a3b8;
  font-size: 1.65rem;
}
.empty-state h5 { font-size: 1rem; font-weight: 700; color: #334155; margin-bottom: 0.35rem; }
.empty-state p { max-width: 390px; margin: 0 auto 1rem; font-size: 0.86rem; color: #64748b; }

/* ---------- Customer detail ---------- */
.detail-hero {
  position: relative;
  overflow: hidden;
  padding: 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 180% at 0% 0%, rgba(20,184,166,0.16), rgba(255,255,255,0) 55%),
    #fff;
  box-shadow: var(--shadow-sm);
}
.detail-hero-top { display: flex; align-items: center; gap: 0.85rem; }
.detail-hero h2 { font-size: 1.15rem; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.detail-hero .detail-sub { color: #64748b; font-size: 0.82rem; margin-top: 0.18rem; }
.detail-meta { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.75rem; margin-top: 1rem; }
.detail-meta-item { min-width: 0; }
.detail-meta-item .label {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 0.16rem;
}
.detail-meta-item .value { font-size: 0.84rem; color: #1e293b; word-break: break-word; }
.mini-stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0.6rem; }
.mini-stat {
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #fff;
}
.mini-stat .label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #94a3b8; }
.mini-stat .value { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 0.15rem; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.detail-actions .btn { flex: 0 1 auto; }

.nav-tabs { border-bottom-color: var(--border); gap: 0.15rem; }
.nav-tabs .nav-link {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.6rem 0.8rem;
  color: #64748b;
  font-size: 0.84rem;
  font-weight: 600;
}
.nav-tabs .nav-link:hover { color: var(--brand-strong); border-bottom-color: rgba(13,148,136,0.3); }
.nav-tabs .nav-link.active { color: var(--brand-strong); background: transparent; border-bottom-color: var(--brand); }
.tab-pane > .table-responsive { border: 1px solid var(--border); border-radius: 0.75rem; background: #fff; }

/* ---------- Session details ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.info-list { display: flex; flex-direction: column; gap: 0.58rem; margin: 0; }
.info-list .info-row { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: 0.58rem; border-bottom: 1px dashed #eef2f7; }
.info-list .info-row:last-child { padding-bottom: 0; border-bottom: 0; }
.info-list dt { color: #64748b; font-size: 0.78rem; font-weight: 500; margin: 0; }
.info-list dd { color: #1e293b; font-size: 0.83rem; font-weight: 600; margin: 0; text-align: right; word-break: break-word; }
.gateway-state {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: #047857;
}
.gateway-state.offline { color: #b45309; }

/* ---------- Loading / alerts ---------- */
.page-loading { display: none; }
.page-loading.is-visible { display: block; }
.skeleton-row { height: 44px; margin: 0.45rem 0; }
.app-main .alert { box-shadow: var(--shadow-sm); }

/* ---------- Responsive table cards ---------- */
@media (max-width: 767.98px) {
  .responsive-table thead { display: none; }
  .responsive-table tbody,
  .responsive-table tbody tr,
  .responsive-table tbody td { display: block; width: 100%; }
  .responsive-table tbody tr {
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    margin: 0.65rem;
    padding: 0.35rem 0.1rem;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }
  .responsive-table tbody tr:hover { background: #fff; }
  .responsive-table tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border: 0;
    border-bottom: 1px dashed #eef2f7;
    padding: 0.58rem 0.75rem !important;
    text-align: right;
  }
  .responsive-table tbody td:last-child { border-bottom: 0; }
  .responsive-table tbody td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    text-align: left;
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding-top: 0.12rem;
  }
  .responsive-table tbody td[data-label="Customer"] { display: block; text-align: left; }
  .responsive-table tbody td[data-label="Customer"]::before { display: none; }
  .responsive-table tbody td[data-label="Customer"] .identity-name,
  .responsive-table tbody td[data-label="Customer"] .identity-sub { max-width: none; white-space: normal; }
  .responsive-table tbody td .identity-cell { text-align: left; }
  .responsive-table tbody td[data-label="Actions"] .action-group { margin-left: auto; }
  .responsive-table tbody td[data-label="Actions"]::before { padding-top: 0.45rem; }
  .responsive-table .cell-stack { align-items: flex-end; }
  .responsive-table td[data-label="Customer"] .cell-stack { align-items: flex-start; }
  .responsive-table .usage-cell { min-width: 0; width: 58%; }
  .responsive-table .usage-numbers { justify-content: flex-end; }
  .responsive-table tbody tr:has(td[colspan]) { border: 0; box-shadow: none; margin: 0; }
  .responsive-table tbody td[colspan] { display: block; text-align: center; }
  .responsive-table tbody td[colspan]::before { display: none; }
}

@media (max-width: 575.98px) {
  .page-header h1 { font-size: 1.28rem; }
  .filter-toolbar .form-select,
  .filter-toolbar .date-input { flex: 1 1 calc(50% - 0.3rem); min-width: 0; }
  .filter-toolbar .btn { flex: 1 1 100%; }
  .detail-meta { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .identity-name, .identity-sub { max-width: 62vw; }
  .stat-card { padding: 0.85rem 0.8rem; }
  .stat-card .stat-value { font-size: 1.35rem; }
  .stat-card .stat-icon { width: 36px; height: 36px; flex-basis: 36px; font-size: 1rem; }
}

@media (min-width: 768px) {
  .detail-meta { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (min-width: 1200px) {
  .detail-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
}

/* ==========================================================================
   Unified SaaS design system - shared across every dashboard section
   ========================================================================== */

/* Cohesive status badges for legacy `bg-*` and `text-bg-*` markup. */
.badge.bg-success, .badge.text-bg-success { background: #d1fae5 !important; color: #047857 !important; border: 1px solid #a7f3d0; }
.badge.bg-warning, .badge.text-bg-warning { background: #fef3c7 !important; color: #b45309 !important; border: 1px solid #fde68a; }
.badge.bg-danger, .badge.text-bg-danger { background: #fee2e2 !important; color: #b91c1c !important; border: 1px solid #fecaca; }
.badge.bg-info, .badge.text-bg-info { background: #e0f2fe !important; color: #0369a1 !important; border: 1px solid #bae6fd; }
.badge.bg-primary, .badge.text-bg-primary { background: #ccfbf1 !important; color: #0f766e !important; border: 1px solid #99f6e4; }
.badge.bg-secondary, .badge.text-bg-secondary { background: #eef2f7 !important; color: #475569 !important; border: 1px solid #e2e8f0; }
.badge.bg-dark, .badge.text-bg-dark { background: #1e293b !important; color: #f8fafc !important; border: 1px solid #334155; }
.badge.bg-light { background: #f1f5f9 !important; color: #475569 !important; border: 1px solid #e2e8f0; }

/* Tables: every legacy table gets the modern rhythm. */
.table > thead > tr > th { background: #f8fafc; color: #64748b; }
.table > tbody > tr > td { border-color: #eef2f7; }
.table-hover > tbody > tr:hover > * { background: #f8fdfc; }
.table code { padding: 0.12rem 0.38rem; border-radius: 0.35rem; background: #f1f5f9; color: #0f766e; font-size: 0.82em; }
.card-footer { border-top: 1px solid var(--border); background: #fff; padding: 0.8rem 1.05rem; }
.bg-light { background-color: var(--surface-2) !important; }

/* Dashboard hero and quick actions. */
.dashboard-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(20,184,166,0.18), rgba(255,255,255,0) 58%),
    linear-gradient(135deg, #ffffff 0%, #f7fdfb 100%);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}
.dashboard-hero h2 { margin: 0 0 0.25rem; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.025em; }
.dashboard-hero p { margin: 0; color: var(--text-muted); font-size: 0.86rem; }
.dashboard-hero .hero-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.quick-action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.55rem; }
.quick-action {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  background: #fff;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}
.quick-action i { color: var(--brand-strong); font-size: 1.05rem; }
.quick-action:hover { border-color: rgba(13,148,136,0.42); background: var(--brand-soft-2); color: var(--brand-strong); transform: translateY(-1px); }

/* Revenue and activity chart (pure CSS, no external dependency). */
.revenue-chart { display: flex; align-items: flex-end; gap: 0.4rem; height: 86px; margin-top: 0.9rem; }
.revenue-chart .bar {
  flex: 1;
  min-width: 6px;
  border-radius: 0.35rem 0.35rem 0.1rem 0.1rem;
  background: linear-gradient(180deg, #2dd4bf, #0d9488);
  opacity: 0.9;
}
.revenue-chart .bar.muted { background: #e2e8f0; }
.chart-legend { display: flex; justify-content: space-between; margin-top: 0.4rem; color: #94a3b8; font-size: 0.66rem; }

/* Section headings inside cards. */
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.section-heading h2 { margin: 0; font-size: 1rem; font-weight: 700; letter-spacing: -0.015em; }
.section-heading p { margin: 0.2rem 0 0; color: var(--text-muted); font-size: 0.8rem; }

/* Card lists / compact stats used by gateways, routers and hotspots. */
.entity-card .card-header { background: #fff; }
.entity-card .entity-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.6rem;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 1rem;
}
.entity-card .entity-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.65rem; }
.entity-card .entity-row { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.32rem 0; border-bottom: 1px dashed #eef2f7; font-size: 0.8rem; }
.entity-card .entity-row:last-child { border-bottom: 0; }
.entity-card .entity-row dt { color: #64748b; margin: 0; font-weight: 500; }
.entity-card .entity-row dd { color: #1e293b; margin: 0; font-weight: 600; text-align: right; word-break: break-word; }

/* Inline tab / segmented filters used on list pages. */
.filter-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.filter-tabs .filter-chip { border-radius: 0.55rem; }

/* Forms and settings panels. */
.form-card .card-header { padding: 1rem 1.25rem; }
.form-card .card-body { padding: 1.35rem; }
.form-section + .form-section { margin-top: 1.5rem; padding-top: 1.35rem; border-top: 1px solid var(--border); }
.form-section-title { font-size: 0.95rem; font-weight: 700; margin: 0 0 0.2rem; letter-spacing: -0.01em; }
.form-section-desc { color: var(--text-muted); font-size: 0.8rem; margin: 0 0 1rem; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* Detail cards reuse the info list. */
.detail-card .card-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.detail-label { color: #94a3b8; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.detail-value { color: #1e293b; font-size: 0.86rem; font-weight: 600; word-break: break-word; }

/* Modal + dropdown polish. */
.modal-content { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--border); }
.dropdown-menu { border-color: var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 0.4rem; }
.dropdown-item { border-radius: 0.4rem; font-size: 0.85rem; padding: 0.5rem 0.6rem; }
.dropdown-item:hover { background: var(--brand-soft-2); color: var(--brand-strong); }

/* Pagination */
.pagination { gap: 0.25rem; margin-top: 1rem; }
.pagination .page-link { border-radius: 0.5rem !important; border-color: var(--border); color: #475569; font-size: 0.8rem; }
.pagination .page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .page-item.disabled .page-link { background: #f8fafc; color: #cbd5e1; }

/* Admin context keeps the same system with a subtle indigo accent. */
.app-body.admin-context { --brand: #0EA85C; --brand-strong: #087C43; --brand-soft: #DDFBEA; --brand-soft-2: #F1FFF7; --brand-glow: rgba(25,211,122,0.22); }
.app-body.admin-context .sidebar { background: radial-gradient(120% 55% at 0% 0%, rgba(99,102,241,0.18) 0%, rgba(15,23,42,0) 55%), linear-gradient(180deg, #0b1220 0%, #10142a 58%, #0b1220 100%); }
.app-body.admin-context .sidebar-nav .nav-item-link.active { background: rgba(99,102,241,0.24); }
.app-body.admin-context .sidebar-nav .nav-item-link.active i { color: #a5b4fc; }
.app-body.admin-context .stat-icon.primary { background: #e0e7ff; color: #4338ca; }
.app-body.admin-context .quick-action i { color: #4338ca; }

/* Compact responsive fixes for legacy grids. */
@media (max-width: 767.98px) {
  .dashboard-hero { padding: 1rem; }
  .dashboard-hero h2 { font-size: 1.12rem; }
  .quick-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-card .card-header { align-items: flex-start; }
  .entity-card .card-footer { flex-wrap: wrap; }
}

/* ==========================================================================
   App-shell geometry sync
   The header spans the full application width so the hamburger and collapse
   control never move. The fixed sidebar starts below the header and owns the
   left rail; only the main workspace follows the rail width.
   ========================================================================== */
.app-body { overflow-x: clip; }

@media (min-width: 992px) {
  .has-sidebar > .topbar {
    margin-left: 0;
    width: 100%;
  }
  .has-sidebar > .app-main:not(.app-main--public) {
    margin-left: var(--sidebar-w);
    min-width: 0;
    transition: margin-left 0.22s ease;
  }
}

@media (max-width: 991.98px) {
  .has-sidebar > .topbar,
  .has-sidebar > .app-main:not(.app-main--public) {
    margin-left: 0;
    width: 100%;
  }
}

/* Small-phone header fit: keep the hamburger, X, Wi-Fi icon and app name
   together without pushing the profile off-screen. */
@media (max-width: 575.98px) {
  .topbar-inner { gap: 0.35rem; padding-right: 0.5rem; }
  .topbar-brand-group { gap: 0.5rem; }
  .topbar-toggle { width: 38px; height: 38px; }
  .topbar-collapse { top: -5px; right: -5px; width: 18px; height: 18px; font-size: 0.56rem; }
  .topbar-brand { gap: 0.4rem; font-size: 1rem; }
  .topbar-brand-icon { width: 32px; height: 32px; flex-basis: 32px; }
  .topbar-brand-icon i { font-size: 1.1rem; }
}

/* Business-owner Hotspot navigation group */
.sidebar-group { margin: 0.06rem 0; }
.sidebar-group > summary { list-style: none; cursor: pointer; }
.sidebar-group > summary::-webkit-details-marker { display: none; }
.sidebar-group-toggle {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) 16px; align-items: center;
  column-gap: 0.8rem; margin: 0.08rem 0.55rem; padding: 0.7rem 1.1rem;
  border-radius: 0.65rem; color: rgba(255,255,255,0.72); font-size: 0.86rem;
  font-weight: 600; transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-group-toggle:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-group-toggle i { width: 22px; text-align: center; font-size: 1.04rem; color: rgba(148,163,184,0.9); }
.sidebar-group-toggle .nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-group-chevron { font-size: 0.7rem !important; transition: transform 0.18s ease; }
.sidebar-group[open] .sidebar-group-chevron { transform: rotate(180deg); }
.sidebar-subnav { position: relative; margin: 0.1rem 0.55rem 0.25rem 1.55rem; padding-left: 0.55rem; border-left: 1px solid rgba(148,163,184,0.2); }
.sidebar-subnav .nav-item-link { margin: 0.04rem 0; padding: 0.52rem 0.65rem; font-size: 0.8rem; border-radius: 0.55rem; }
.sidebar-subnav .nav-item-link i { font-size: 0.92rem; }
.sidebar-subnav .nav-item-link.active { background: rgba(13,148,136,0.22); color: #fff; }
@media (max-width: 991.98px) {
  .sidebar-group-toggle { padding: 0.6rem 0.9rem; }
  .sidebar-subnav { margin-left: 1.2rem; }
}

/* ==========================================================================
   Dashboard chart components (shared by business + admin dashboards)
   ========================================================================== */
.chart-box { position: relative; width: 100%; }
.chart-box canvas { display: block; max-width: 100%; }
.chart-card .card-body { padding: 1.1rem 1.25rem; }
.chart-empty {
  display: flex; align-items: center; justify-content: center; height: 100%;
  min-height: 160px; flex-direction: column; gap: 0.5rem;
  color: var(--text-muted); font-size: 0.85rem; text-align: center;
}
.chart-period { display: inline-flex; gap: 2px; background: var(--surface-3); border-radius: 0.5rem; padding: 2px; }
.chart-period-btn {
  border: none; background: transparent; color: var(--text-muted);
  font-size: 0.72rem; font-weight: 600; padding: 0.3rem 0.62rem;
  border-radius: 0.4rem; cursor: pointer; line-height: 1.2;
}
.chart-period-btn:hover { color: var(--brand-strong); }
.chart-period-btn.active { background: var(--surface); color: var(--brand-strong); box-shadow: var(--shadow-sm); }
.chart-header-actions { display: flex; align-items: center; gap: 0.75rem; }
.live-pill { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.68rem; font-weight: 600; color: var(--brand-strong); }
.live-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--success); animation: status-pulse 2s ease-in-out infinite; }

/* ==========================================================================
   Theme toggle (sits on the always-dark topbar)
   ========================================================================== */
.theme-toggle {
  width: 40px; height: 40px; border-radius: 0.6rem;
  border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85); display: grid; place-items: center; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease; font-size: 1rem; flex: 0 0 auto;
}
.theme-toggle:hover { background: rgba(255,255,255,0.14); color: #fff; }
.theme-toggle:focus-visible { outline: 2px solid #5eead4; outline-offset: 2px; }
.theme-toggle .theme-icon { display: block; width: 21px; height: 21px; }
.theme-toggle .theme-icon--sun { display: none; }
[data-bs-theme="dark"] .theme-toggle .theme-icon--moon { display: none; }
[data-bs-theme="dark"] .theme-toggle .theme-icon--sun { display: block; }

/* ==========================================================================
   Dark theme — overrides CSS variables + Bootstrap 5.3 color mode
   ========================================================================== */
[data-bs-theme="dark"] {
  --bg: #0b1220;
  --surface: #111827;
  --surface-2: #1e293b;
  --surface-3: #1f2937;
  --border: #243044;
  --border-strong: #334155;
  --text: #e5e7eb;
  --text-muted: #94a3b8;
  --brand: #19D37A;
  --brand-strong: #0EA85C;
  --brand-soft: rgba(25, 211, 122, 0.18);
  --brand-soft-2: rgba(25, 211, 122, 0.10);
  --brand-glow: rgba(25, 211, 122, 0.22);
  --success: #19D37A;
  --success-soft: rgba(25, 211, 122, 0.16);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.16);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.16);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
[data-bs-theme="dark"].app-body.admin-context {
  --brand: #19D37A;
  --brand-strong: #0EA85C;
  --brand-soft: rgba(25, 211, 122, 0.18);
  --brand-soft-2: rgba(25, 211, 122, 0.10);
  --brand-glow: rgba(25, 211, 122, 0.22);
}
/* Hardcoded light colors that need explicit dark overrides. */
[data-bs-theme="dark"] .table-modern thead th,
[data-bs-theme="dark"] .table > thead > tr > th { background: #1e293b; color: #94a3b8; }
[data-bs-theme="dark"] .table-modern tbody tr:hover { background: rgba(13, 148, 136, 0.08); }
[data-bs-theme="dark"] .table-modern tbody td { border-color: #1f2937; }
[data-bs-theme="dark"] .cell-strong { color: #e5e7eb; }
[data-bs-theme="dark"] .cell-sub { color: #94a3b8; }
[data-bs-theme="dark"] .detail-value { color: #e5e7eb; }
[data-bs-theme="dark"] .mini-stat .label { color: #94a3b8; }
[data-bs-theme="dark"] .entity-card .card-header { background: #111827; }
[data-bs-theme="dark"] .pagination .page-link { color: #cbd5e1; background: transparent; }
[data-bs-theme="dark"] .pagination .page-item.disabled .page-link { background: #1e293b; color: #475569; }
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select { background-color: #0f172a; border-color: #243044; color: #e5e7eb; }
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus { background-color: #0f172a; color: #e5e7eb; }
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .dropdown-menu { background: #111827; }
