/* ==========================================================================
   Avenza — Application shell
   Connected Living. Simplified. · Shanix Digital Technologies
   Pattern: production web app (same craft as Orivex LMS)
   ========================================================================== */

:root {
  --ink: #0f172a;
  --ink-soft: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --field: #f8fafc;
  --surface: #ffffff;
  --page: #f1f5f9;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-dark: #1e40af;
  --brand-soft: rgba(37, 99, 235, 0.1);
  --brand-ring: rgba(37, 99, 235, 0.18);
  --accent: #14b8a6;
  --accent-soft: rgba(20, 184, 166, 0.12);
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --success: #059669;
  --success-soft: #ecfdf5;
  --info: #2563eb;
  --info-soft: #eff6ff;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
  --shadow-brand: 0 14px 32px rgba(37, 99, 235, 0.22);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Manrope", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Plus Jakarta Sans", "Manrope", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

::selection {
  background: rgba(37, 99, 235, 0.16);
  color: var(--ink);
}

/* Focus rings — keyboard only */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.nav-item:focus-visible,
.module-card:focus-visible,
.quick-card:focus-visible,
.guard-tile:focus-visible,
.tab:focus-visible,
.chip:focus-visible,
.menu-toggle:focus-visible,
.logout-btn:focus-visible,
.profile-trigger:focus-visible,
.fab-sos:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

body.is-overlay-open {
  overflow: hidden;
}

.material-symbols-rounded {
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
  font-size: 22px;
  line-height: 1;
  user-select: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* ─── Shell ─── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  height: 100dvh;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 40;
}

.sidebar-overlay.is-open {
  display: block;
}

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  min-height: 0;
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.sidebar-brand .role-badge {
  margin-top: 0;
  flex-shrink: 0;
}

/* Logo — free image, no box / no frame */
.brand-mark {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  width: auto;
  height: auto;
  overflow: visible;
}

.brand-mark img,
.brand-mark .brand-logo {
  width: auto;
  height: 36px;
  max-width: 140px;
  object-fit: contain;
  display: block;
}

.sidebar-brand .brand-mark img,
.sidebar-brand .brand-logo {
  height: 34px;
  max-width: 130px;
}

/* Hide text when logo-only brand is used */
.sidebar-brand-text.is-logo-only,
.brand-text.is-logo-only {
  display: none !important;
}

/* ─── Boot preloader (Preloder.png only) ─── */
.app-preloader {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #ffffff;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.app-preloader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-preloader__img {
  width: min(120px, 36vw);
  height: auto;
  object-fit: contain;
  animation: preloader-pulse 1.2s ease-in-out infinite;
}

.app-preloader__label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

@keyframes preloader-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.96); opacity: 0.85; }
}

body.desk-dark .app-preloader {
  background: #0b1220;
}

body.desk-dark .brand-mark {
  background: none;
  border: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-brand-text strong {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.sidebar-brand-text span {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: fit-content;
}

.role-badge.resident { background: var(--info-soft); color: var(--info); }
.role-badge.guard { background: var(--accent-soft); color: #0f766e; }
.role-badge.admin { background: var(--brand-soft); color: var(--brand); }
.role-badge.super { background: #f5f3ff; color: #7c3aed; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section {
  margin: 10px 8px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item .material-symbols-rounded {
  font-size: 20px;
  opacity: 0.9;
}

.nav-item:hover {
  background: var(--field);
  color: var(--ink-soft);
}

.nav-item.is-active {
  background: var(--brand-soft);
  color: var(--brand);
}

.nav-item .nav-count {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-item.is-active .nav-count {
  background: rgba(37, 99, 235, 0.18);
  color: var(--brand);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--field);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-meta {
  min-width: 0;
  flex: 1;
}

.user-meta strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.logout-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* Main */
.main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--page);
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
}

.page-title h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.page-title p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search {
  position: relative;
  width: min(280px, 32vw);
}

.search .material-symbols-rounded {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  font-size: 18px;
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 40px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  padding: 0 12px 0 38px;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.search input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--field);
  border-color: var(--line-strong);
}

.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface);
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 10px 0 6px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}

.profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.profile-info {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.profile-info strong {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.profile-info span {
  font-size: 11px;
  color: var(--muted);
}

@media (min-width: 900px) {
  .profile-info {
    display: flex;
  }
}

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 24px 32px;
}

.view {
  display: none;
  animation: fade-up 0.35s var(--ease) both;
}

.view.is-active,
.view.is-active:not([hidden]) {
  display: block;
}

/* When shell toggles [hidden], still show the active view */
.view.is-active[hidden] {
  display: none !important;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Cards & layout ─── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
}

.kpi-icon .material-symbols-rounded {
  font-size: 22px;
}

.kpi-icon.blue { background: var(--info-soft); color: var(--brand); }
.kpi-icon.teal { background: var(--accent-soft); color: #0f766e; }
.kpi-icon.amber { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.red { background: var(--danger-soft); color: var(--danger); }
.kpi-icon.green { background: var(--success-soft); color: var(--success); }
.kpi-icon.violet { background: #f5f3ff; color: #7c3aed; }

.kpi-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}

.kpi-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.kpi-delta {
  font-size: 11.5px;
  font-weight: 700;
}

.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }

.panel-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-grid.equal {
  grid-template-columns: 1fr 1fr;
}

.panel-grid.three {
  grid-template-columns: repeat(3, 1fr);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.panel-body {
  padding: 16px 18px;
}

.panel-body.flush {
  padding: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn .material-symbols-rounded {
  font-size: 18px;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}

.btn-primary:hover {
  background: var(--brand-hover);
  color: #fff;
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: #0d9488;
  color: #fff;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-outline {
  background: var(--surface);
  color: var(--ink-soft);
  border: 1.5px solid var(--line);
}

.btn-outline:hover {
  background: var(--field);
  border-color: var(--line-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--field);
  color: var(--ink);
}

.btn-soft {
  background: var(--brand-soft);
  color: var(--brand);
}

.btn-soft:hover {
  background: rgba(37, 99, 235, 0.16);
  color: var(--brand-dark);
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-lg {
  height: 48px;
  padding: 0 20px;
  font-size: 14.5px;
  border-radius: 12px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 40px;
  padding: 0;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-primary { background: var(--brand-soft); color: var(--brand); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-neutral { background: var(--field); color: var(--muted); }
.badge-accent { background: var(--accent-soft); color: #0f766e; }
.badge-violet { background: #f5f3ff; color: #7c3aed; }

/* Tables */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 12px 18px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--field);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: rgba(248, 250, 252, 0.8);
}

.cell-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cell-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.cell-user strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.cell-user span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

/* List rows */
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.list-row:last-child {
  border-bottom: 0;
}

.list-row:hover {
  background: var(--field);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
}

.field input,
.field select,
.field textarea {
  height: 42px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  padding: 0 12px;
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field textarea {
  height: auto;
  min-height: 100px;
  padding: 12px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.field-hint {
  font-size: 11.5px;
  color: var(--muted);
}

.field-error {
  font-size: 11.5px;
  color: var(--danger);
  font-weight: 600;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.field.has-error input:focus,
.field.has-error select:focus,
.field.has-error textarea:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

/* Alert / notice banner */
.alert {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
}

.alert .material-symbols-rounded {
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-info {
  background: var(--info-soft);
  border-color: #bfdbfe;
  color: #1e40af;
}

.alert-warning {
  background: var(--warning-soft);
  border-color: #fde68a;
  color: #92400e;
}

.alert-success {
  background: var(--success-soft);
  border-color: #a7f3d0;
  color: #065f46;
}

.alert-danger {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: #991b1b;
}

/* Visitor approval hero */
.approval-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 55%, #0f766e 100%);
  border-radius: var(--radius-lg);
  padding: 22px;
  color: #fff;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.approval-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(20, 184, 166, 0.18);
  pointer-events: none;
}

.approval-card > * {
  position: relative;
  z-index: 1;
}

.approval-card .eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
  margin: 0 0 10px;
}

.approval-card h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
}

.approval-card p {
  margin: 0 0 18px;
  font-size: 13.5px;
  opacity: 0.85;
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.approval-actions .btn {
  min-width: 120px;
}

/* Quick actions */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.quick-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.quick-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.quick-card .q-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}

.quick-card strong {
  font-size: 13.5px;
  font-weight: 750;
  font-family: var(--font-display);
}

.quick-card span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

/* Tabs */
.tabs {
  display: inline-flex;
  padding: 4px;
  border-radius: 12px;
  background: var(--field);
  border: 1px solid var(--line);
  gap: 4px;
  margin-bottom: 16px;
}

.tab {
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Chart */
.chart-wrap {
  position: relative;
  height: 260px;
  width: 100%;
}

.chart-wrap.short {
  height: 200px;
}

/* Empty */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty .material-symbols-rounded {
  font-size: 40px;
  opacity: 0.4;
  margin-bottom: 10px;
}

.empty strong {
  display: block;
  color: var(--ink);
  font-size: 14.5px;
  margin-bottom: 4px;
}

.empty p {
  margin: 0 auto 16px;
  max-width: 280px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--field);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--muted-2);
}

.empty-icon .material-symbols-rounded {
  font-size: 28px;
  opacity: 1;
  margin: 0;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--field) 25%, #eef2f7 50%, var(--field) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: 8px;
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-line {
  height: 12px;
  margin-bottom: 8px;
}

.skeleton-line.lg {
  height: 20px;
  width: 40%;
}

.skeleton-card {
  height: 96px;
  border-radius: var(--radius-lg);
}

/* ─── Toasts (final UX) ─── */
.toast-host {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: 24px;
  left: auto;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: min(400px, calc(100vw - 32px));
}

.toast {
  pointer-events: auto;
  min-width: min(280px, 100%);
  max-width: 400px;
  padding: 12px 12px 12px 14px;
  border-radius: 14px;
  background: #0f172a;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
  animation: toast-in 0.28s var(--ease) both;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.4;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-icon {
  font-size: 22px !important;
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.95;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-msg {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
}

.toast-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.toast-close .material-symbols-rounded {
  font-size: 16px;
}

.toast--success {
  background: linear-gradient(135deg, #047857, #059669);
}

.toast--danger {
  background: linear-gradient(135deg, #b91c1c, #dc2626);
}

.toast--warning {
  background: linear-gradient(135deg, #b45309, #d97706);
}

.toast--info {
  background: linear-gradient(135deg, #0f172a, #1e293b);
}

/* legacy class names still used in a few places */
.toast.success { background: linear-gradient(135deg, #047857, #059669); }
.toast.danger { background: linear-gradient(135deg, #b91c1c, #dc2626); }

@media (max-width: 560px) {
  .toast-host {
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }

  .toast {
    max-width: none;
    width: 100%;
  }
}

/* ─── Page flash banner ─── */
.page-flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid transparent;
  animation: fade-up 0.3s var(--ease) both;
}

.page-flash .material-symbols-rounded {
  flex-shrink: 0;
  font-size: 20px;
}

.page-flash span:nth-child(2) {
  flex: 1;
}

.page-flash-close {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  padding: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.page-flash-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.06);
}

.page-flash-close .material-symbols-rounded {
  font-size: 18px;
}

.page-flash--info {
  background: var(--info-soft);
  border-color: #bfdbfe;
  color: #1e40af;
}

.page-flash--success {
  background: var(--success-soft);
  border-color: #a7f3d0;
  color: #065f46;
}

.page-flash--warning {
  background: var(--warning-soft);
  border-color: #fde68a;
  color: #92400e;
}

.page-flash--danger {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: #991b1b;
}

.page-flash.is-leaving {
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* Demo onboarding cue */
.demo-cue {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff, #f0fdfa);
  border: 1px solid #bfdbfe;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  animation: fade-up 0.35s var(--ease) both;
}

.demo-cue strong {
  color: var(--brand);
  font-weight: 800;
}

.demo-cue > .material-symbols-rounded {
  color: var(--brand);
  font-size: 22px;
  flex-shrink: 0;
}

.demo-cue > span:nth-child(2) {
  flex: 1;
}

.demo-cue-close {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  padding: 0;
}

.demo-cue-close:hover {
  background: rgba(37, 99, 235, 0.1);
  color: var(--brand);
}

.demo-cue.is-leaving {
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Confirm dialog */
.av-confirm-backdrop {
  z-index: 100000;
}

.av-confirm-modal {
  width: min(420px, 100%) !important;
}

.av-confirm-text {
  margin: 0;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.55;
  font-weight: 500;
}

/* Modal */
/* Custom dialogs — scoped so Bootstrap's .modal { display:none } cannot hide them */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1055;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top, 0px)) 20px max(20px, env(safe-area-inset-bottom, 0px));
}

.modal-backdrop.is-open {
  display: flex !important;
}

/* Override Bootstrap .modal { display: none } when used inside our backdrop */
.modal-backdrop .modal,
.modal-backdrop.is-open .modal {
  display: flex !important;
  flex-direction: column;
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 1;
  width: min(480px, 100%);
  max-width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  transform: none;
  pointer-events: auto;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: fade-up 0.3s var(--ease) both;
  max-height: min(90vh, 720px);
  overflow: hidden;
  border: 1px solid var(--line);
  color: var(--ink);
}

.modal-backdrop .modal-head,
.modal-backdrop .modal-foot {
  flex-shrink: 0;
}

.modal-backdrop .modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Demo interactions (approve / remove / flash) — pure frontend, no server */
.demo-leave {
  opacity: 0 !important;
  transform: scale(0.98) translateY(-4px);
  max-height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-width: 0 !important;
  overflow: hidden !important;
  transition:
    opacity 0.28s var(--ease),
    transform 0.28s var(--ease),
    max-height 0.35s var(--ease),
    margin 0.35s var(--ease),
    padding 0.35s var(--ease);
  pointer-events: none;
}

.demo-ok {
  border-color: #a7f3d0 !important;
  background: linear-gradient(180deg, #ecfdf5 0%, #fff 60%) !important;
  box-shadow: 0 8px 28px rgba(5, 150, 105, 0.12) !important;
}

.demo-bad {
  border-color: #fecaca !important;
  background: linear-gradient(180deg, #fef2f2 0%, #fff 60%) !important;
}

.demo-hold {
  border-color: #fde68a !important;
  background: linear-gradient(180deg, #fffbeb 0%, #fff 60%) !important;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
}

.modal-body {
  padding: 20px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: var(--field);
}

/* QR visual */
.qr-box {
  width: 200px;
  height: 200px;
  margin: 12px auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(45deg, #0f172a 25%, transparent 25%) 0 0 / 12px 12px,
    linear-gradient(-45deg, #0f172a 25%, transparent 25%) 0 6px / 12px 12px,
    linear-gradient(45deg, transparent 75%, #0f172a 75%) 6px -6px / 12px 12px,
    linear-gradient(-45deg, transparent 75%, #0f172a 75%) -6px 0 / 12px 12px,
    #fff;
  opacity: 0.92;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Guard large action tiles */
.guard-actions {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.guard-tile {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
}

.guard-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--brand);
}

.guard-tile.primary {
  background: linear-gradient(145deg, var(--brand), var(--brand-dark));
  border: 0;
  color: #fff;
  box-shadow: var(--shadow-brand);
}

.guard-tile.primary:hover {
  border: 0;
}

.guard-tile .material-symbols-rounded {
  font-size: 32px;
}

.guard-tile strong {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
}

.guard-tile span {
  font-size: 13px;
  opacity: 0.8;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-grid,
  .panel-grid.equal,
  .panel-grid.three {
    grid-template-columns: 1fr;
  }

  .quick-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .guard-actions {
    grid-template-columns: 1fr 1fr;
  }

  .guard-tile.primary {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(var(--sidebar-w), 86vw);
    transform: translateX(-105%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: inline-flex;
  }

  .search {
    display: none;
  }

  .content {
    padding: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .quick-grid,
  .guard-actions {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 0 14px;
  }
}

/* ==========================================================================
   Avenza Premium — MyGate-comparable density components
   ========================================================================== */

.community-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: var(--field);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}
.community-chip .dot-live {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(5,150,105,.18);
  margin-left: 4px;
}

.live-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
  padding: 12px 16px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-sm);
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.live-strip strong { color: var(--ink); }
.live-strip .sep { width: 1px; height: 14px; background: var(--line); }

/* Visitor card (photo + OTP + timer) */
.visitor-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.visitor-card.urgent {
  border-color: #fde68a;
  background: linear-gradient(180deg, #fffbeb 0%, #fff 55%);
  box-shadow: 0 8px 28px rgba(217,119,6,.12);
}
.visitor-photo {
  width: 72px; height: 72px; border-radius: 16px;
  background: linear-gradient(145deg, #dbeafe, #e0f2fe);
  color: var(--brand);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 22px;
  border: 2px solid #fff; box-shadow: var(--shadow-sm); position: relative;
}
.visitor-photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px; }
.visitor-photo .cam-badge {
  position: absolute; bottom: -4px; right: -4px;
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--ink); color: #fff; display: grid; place-items: center;
  border: 2px solid #fff;
}
.visitor-photo .cam-badge .material-symbols-rounded { font-size: 12px; }
.visitor-meta h3 {
  margin: 0 0 4px; font-family: var(--font-display);
  font-size: 17px; font-weight: 800; letter-spacing: -.02em;
}
.visitor-meta .sub { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.visitor-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.visitor-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; min-width: 140px; }
.timer-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--warning-soft); color: var(--warning);
  font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.timer-pill .material-symbols-rounded { font-size: 16px; }
.otp-box {
  font-family: var(--font-display); font-weight: 800; font-size: 20px;
  letter-spacing: .2em; color: var(--ink);
  background: var(--field); border: 1.5px dashed var(--line-strong);
  border-radius: 10px; padding: 8px 14px;
}
.visitor-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.visitor-actions .btn { min-width: 100px; }

/* Feature module grid (home) */
.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.module-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  cursor: pointer; text-align: left; transition: .15s ease;
  box-shadow: var(--shadow-sm); color: var(--ink); position: relative;
}
.module-card:hover { border-color: #93c5fd; box-shadow: var(--shadow); transform: translateY(-2px); }
.module-card .mod-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
}
.module-card strong { font-family: var(--font-display); font-size: 13.5px; font-weight: 800; }
.module-card span { font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.35; }
.module-card .mod-count {
  position: absolute; top: 12px; right: 12px;
  min-width: 22px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 800; display: grid; place-items: center;
}

/* Daily help / staff cards */
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.help-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm);
}
.help-card .help-top {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.help-card .help-avatar {
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff;
}
.help-card h4 { margin: 0; font-size: 14px; font-weight: 800; font-family: var(--font-display); }
.help-card .role-line { font-size: 12px; color: var(--muted); margin-top: 2px; }
.help-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px;
}
.help-stat {
  background: var(--field); border-radius: 10px; padding: 10px;
  font-size: 11.5px; color: var(--muted); font-weight: 600;
}
.help-stat strong { display: block; font-size: 14px; color: var(--ink); font-weight: 800; margin-bottom: 2px; }
.attn-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 10px; background: var(--success-soft);
  font-size: 12px; font-weight: 700; color: var(--success); margin-bottom: 12px;
}
.attn-row.out { background: var(--field); color: var(--muted); }
.attn-row.pending { background: var(--warning-soft); color: var(--warning); }

/* Amenity booking */
.amenity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.amenity-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
  cursor: pointer; transition: .15s ease;
}
.amenity-card:hover { border-color: #93c5fd; box-shadow: var(--shadow); }
.amenity-hero {
  height: 88px; display: grid; place-items: center;
  color: #fff; position: relative;
}
.amenity-hero .material-symbols-rounded { font-size: 36px; opacity: .95; }
.amenity-body { padding: 14px; }
.amenity-body h4 { margin: 0 0 4px; font-family: var(--font-display); font-weight: 800; font-size: 14px; }
.amenity-body p { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.slot-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-pill {
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: var(--field); color: var(--muted); border: 1px solid var(--line);
}
.slot-pill.free { background: var(--success-soft); color: var(--success); border-color: #a7f3d0; }
.slot-pill.busy { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; text-decoration: line-through; }

/* Parcel / delivery cards */
.parcel-card {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.parcel-card:last-child { border-bottom: 0; }
.parcel-logo {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800; font-size: 11px;
  flex-shrink: 0;
}
.pickup-code {
  font-family: var(--font-display); font-weight: 800; letter-spacing: .12em;
  font-size: 15px; color: var(--brand);
  background: var(--info-soft); padding: 4px 10px; border-radius: 8px;
}

/* Poll bars */
.poll-option { margin-bottom: 12px; }
.poll-option-head {
  display: flex; justify-content: space-between; font-size: 13px; font-weight: 700;
  margin-bottom: 6px; color: var(--ink-soft);
}
.poll-bar {
  height: 10px; border-radius: 999px; background: var(--field); overflow: hidden;
  border: 1px solid var(--line);
}
.poll-bar > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

/* Timeline */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px;
  width: 2px; background: var(--line);
}
.tl-item { position: relative; padding: 0 0 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -18px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--brand-soft);
}
.tl-item.done::before { background: var(--success); box-shadow: 0 0 0 2px var(--success-soft); }
.tl-item .tl-time { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.tl-item strong { display: block; font-size: 13.5px; font-weight: 700; }
.tl-item p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

/* Notification drawer */
.notif-panel {
  position: fixed; top: 0; right: 0; width: min(380px, 100vw); height: 100%;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg); z-index: 80;
  transform: translateX(105%); transition: transform .28s var(--ease);
  display: flex; flex-direction: column;
}
.notif-panel.is-open { transform: translateX(0); }
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.notif-head h3 { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.notif-list { flex: 1; overflow-y: auto; }
.notif-item {
  display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .12s;
}
.notif-item:hover, .notif-item.unread { background: var(--field); }
.notif-item.unread { border-left: 3px solid var(--brand); }
.notif-item .n-icon {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
}
.notif-item strong { display: block; font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.notif-item span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.notif-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 70;
}
.notif-overlay.is-open { display: block; }

/* Floating SOS */
.fab-sos {
  position: fixed; bottom: 28px; right: 28px; z-index: 40;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(145deg, #ef4444, #b91c1c);
  color: #fff; border: 0; box-shadow: 0 12px 28px rgba(220,38,38,.4);
  display: grid; place-items: center; cursor: pointer;
  transition: transform .15s ease;
}
.fab-sos:hover { transform: scale(1.06); }
.fab-sos .material-symbols-rounded { font-size: 28px; font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24; }

/* Payment breakdown */
.pay-hero {
  background: linear-gradient(145deg, #0f172a, #1e3a5f 60%, #0f766e);
  border-radius: var(--radius-lg); padding: 24px; color: #fff; margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
}
.pay-hero .amount {
  font-family: var(--font-display); font-size: 40px; font-weight: 800;
  letter-spacing: -.03em; margin: 8px 0;
}
.pay-breakdown { display: grid; gap: 8px; margin: 16px 0; }
.pay-row {
  display: flex; justify-content: space-between; font-size: 13px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.1);
  opacity: .9;
}
.pay-row:last-child { border-bottom: 0; font-weight: 800; opacity: 1; }

/* Gate status strip (guard) */
.gate-status {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px;
}
.gate-stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; text-align: center; box-shadow: var(--shadow-sm);
}
.gate-stat .gs-val {
  font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -.02em;
}
.gate-stat .gs-lbl { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

/* Chip filters */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  height: 32px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface);
  font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.chip.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Stat ring */
.stat-pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px;
}
.stat-tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.stat-tile .label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-tile .value { font-family: var(--font-display); font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }

/* Directory cards */
.dir-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;
}
.dir-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow-sm);
}
.dir-card .avatar {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; flex-shrink: 0;
}

/* Segmented purpose pills */
.purpose-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.purpose-pill {
  padding: 8px 14px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 12.5px; font-weight: 700;
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.purpose-pill.is-active {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand);
}

/* Cab card */
.cab-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  margin-bottom: 10px; box-shadow: var(--shadow-sm);
}
.cab-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: #fff7ed; color: #c2410c; display: grid; place-items: center;
}
.cab-icon .material-symbols-rounded { font-size: 26px; }

/* Progress collection */
.collect-meter {
  height: 12px; border-radius: 999px; background: var(--field); overflow: hidden;
  border: 1px solid var(--line); margin: 10px 0;
}
.collect-meter > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--brand));
  border-radius: 999px;
}

/* Section intro */
.section-intro {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.section-intro h2 {
  margin: 0 0 4px; font-family: var(--font-display); font-size: 18px; font-weight: 800; letter-spacing: -.02em;
}
.section-intro p {
  margin: 0; font-size: 13.5px; color: var(--muted); max-width: 520px; line-height: 1.45;
}

/* Table action cells — clearer hit targets */
.data-table .btn-sm { min-height: 32px; }
.list-row .btn { flex-shrink: 0; }

/* Dense meta line */
.meta-line {
  display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--muted); font-weight: 600;
}
.meta-line span { display: inline-flex; align-items: center; gap: 4px; }
.meta-line .material-symbols-rounded { font-size: 14px; }

/* QR pass premium */
.pass-ticket {
  background: #fff; border: 1px solid var(--line); border-radius: 20px;
  overflow: hidden; box-shadow: var(--shadow-lg); max-width: 360px; margin: 0 auto;
}
.pass-ticket-head {
  background: linear-gradient(135deg, #0f172a, #1e40af); color: #fff; padding: 18px 20px;
}
.pass-ticket-body { padding: 20px; text-align: center; }
.pass-ticket-foot {
  border-top: 1px dashed var(--line); padding: 14px 20px;
  display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-weight: 700;
}

/* Mini spark */
.spark {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 800;
}
.spark.up { color: var(--success); }
.spark.down { color: var(--danger); }

/* Settings row */
.settings-list .set-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.settings-list .set-row:last-child { border-bottom: 0; }
.settings-list strong { display: block; font-size: 13.5px; font-weight: 700; }
.settings-list span { font-size: 12px; color: var(--muted); }
.toggle {
  width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong);
  position: relative; border: 0; cursor: pointer; flex-shrink: 0;
}
.toggle.on { background: var(--success); }
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: transform .15s ease; box-shadow: var(--shadow-sm);
}
.toggle.on::after { transform: translateX(18px); }

/* Large modal */
.modal.modal-lg { width: min(640px, 100%); }
.modal.modal-xl { width: min(800px, 100%); }

/* Guard dark accent */
.desk-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-radius: 14px; margin-bottom: 18px;
  background: linear-gradient(90deg, #0f172a, #134e4a); color: #fff;
}
.desk-banner strong { font-family: var(--font-display); font-size: 15px; font-weight: 800; }
.desk-banner span { font-size: 12.5px; opacity: .8; }

@media (max-width: 1100px) {
  .module-grid { grid-template-columns: repeat(2, 1fr); }
  .gate-status { grid-template-columns: repeat(3, 1fr); }
  .visitor-card { grid-template-columns: auto 1fr; }
  .visitor-side { align-items: flex-start; flex-direction: row; flex-wrap: wrap; grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .module-grid { grid-template-columns: 1fr 1fr; }
  .gate-status { grid-template-columns: repeat(2, 1fr); }
  .fab-sos {
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    right: calc(18px + env(safe-area-inset-right, 0px));
    width: 50px;
    height: 50px;
  }

  .visitor-card {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .visitor-photo {
    width: 56px;
    height: 56px;
  }

  .visitor-actions .btn {
    min-width: 0;
    flex: 1 1 auto;
  }

  .content {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  .page-title p {
    display: none;
  }
}

/* Scrollbars (subtle, production) */
.content,
.sidebar-nav,
.notif-list,
.modal {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.content::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar,
.notif-list::-webkit-scrollbar,
.modal::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.content::-webkit-scrollbar-thumb,
.sidebar-nav::-webkit-scrollbar-thumb,
.notif-list::-webkit-scrollbar-thumb,
.modal::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.content::-webkit-scrollbar-thumb:hover,
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: var(--muted-2);
  background-clip: padding-box;
  border: 2px solid transparent;
}

/* Tables: sticky header on scroll containers */
.table-wrap {
  -webkit-overflow-scrolling: touch;
  border-radius: inherit;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Chip / purpose pill focus */
.chip,
.purpose-pill,
.slot-pill {
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

/* Notif panel safe area */
.notif-panel {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Nav active fill for filled icons feel */
.nav-item.is-active .material-symbols-rounded {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

/* Topbar sticky feel on long pages */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.92);
}

/* Link-as-button consistency */
a.btn {
  text-decoration: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .view {
    animation: none;
  }
}

/* High contrast assist */
@media (prefers-contrast: more) {
  .btn-outline,
  .icon-btn,
  .field input,
  .field select,
  .field textarea,
  .search input {
    border-width: 2px;
  }

  .nav-item.is-active {
    outline: 2px solid var(--brand);
  }
}

/* Print: hide chrome */
@media print {
  .sidebar,
  .topbar,
  .fab-sos,
  .toast-host,
  .notif-panel,
  .notif-overlay,
  .sidebar-overlay,
  .menu-toggle {
    display: none !important;
  }

  .app {
    display: block;
  }

  .main,
  .content {
    overflow: visible;
  }

  body {
    overflow: visible;
    background: #fff;
  }
}

/* ==========================================================================
   UPGRADE PACK � Bootstrap-free utilities � Resident mobile � Guard dark desk
   ========================================================================== */

/* Layout utilities (replace Bootstrap) */
.d-flex { display: flex !important; }
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid { display: grid !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-1, .flex-grow-1 { flex: 1 1 auto !important; min-width: 0; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-end { justify-content: flex-end !important; }
.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }
.w-100 { width: 100% !important; }
.text-start { text-align: left !important; }
.text-center { text-align: center !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 16px !important; }
.mt-1 { margin-top: 4px !important; }
.mt-2 { margin-top: 8px !important; }
.mt-3 { margin-top: 12px !important; }
.mt-4 { margin-top: 16px !important; }
.me-2 { margin-right: 8px !important; }
.ms-2 { margin-left: 8px !important; }
.p-0 { padding: 0 !important; }
.p-3 { padding: 12px !important; }
.p-4 { padding: 16px !important; }

@media (min-width: 768px) {
  .d-md-none { display: none !important; }
  .d-md-flex { display: flex !important; }
  .d-md-inline-flex { display: inline-flex !important; }
  .d-md-block { display: block !important; }
}

/* Form controls without Bootstrap */
.form-control,
.form-select,
input.form-control,
select.form-select {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.form-control-sm,
.form-select-sm {
  height: 34px;
  font-size: 12.5px;
  padding: 0 10px;
}
textarea.form-control {
  height: auto;
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* --- Shared role mobile shell (resident · admin · vendor · guard) --- */
body.role-resident,
body.role-admin,
body.role-vendor,
body.desk-dark {
  --bottom-nav-h: 64px;
}

body.role-resident .bottom-nav,
body.role-admin .bottom-nav,
body.role-vendor .bottom-nav,
body.desk-dark .bottom-nav {
  display: none;
}

body.role-resident .fab-sos {
  bottom: 28px;
}

@media (max-width: 860px) {
  body.role-resident .bottom-nav,
  body.role-admin .bottom-nav,
  body.role-vendor .bottom-nav,
  body.desk-dark .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.06);
    align-items: stretch;
    justify-content: space-around;
    gap: 2px;
  }

  body.desk-dark .bottom-nav {
    background: rgba(12, 20, 36, 0.96);
    border-top-color: var(--line);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.35);
  }

  body.role-resident .bottom-nav button,
  body.role-admin .bottom-nav button,
  body.role-vendor .bottom-nav button,
  body.desk-dark .bottom-nav button {
    flex: 1;
    border: 0;
    background: transparent;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    padding: 6px 4px;
    min-width: 0;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }

  body.role-resident .bottom-nav button .material-symbols-rounded,
  body.role-admin .bottom-nav button .material-symbols-rounded,
  body.role-vendor .bottom-nav button .material-symbols-rounded,
  body.desk-dark .bottom-nav button .material-symbols-rounded {
    font-size: 24px;
  }

  body.role-resident .bottom-nav button.is-active,
  body.role-admin .bottom-nav button.is-active,
  body.role-vendor .bottom-nav button.is-active,
  body.desk-dark .bottom-nav button.is-active {
    color: var(--brand);
    background: var(--brand-soft);
  }

  body.role-vendor .bottom-nav button.is-active {
    color: #0f766e;
    background: var(--accent-soft);
  }

  body.role-resident .bottom-nav button.is-active .material-symbols-rounded,
  body.role-admin .bottom-nav button.is-active .material-symbols-rounded,
  body.role-vendor .bottom-nav button.is-active .material-symbols-rounded,
  body.desk-dark .bottom-nav button.is-active .material-symbols-rounded {
    font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
  }

  body.role-resident .bottom-nav .bn-dot,
  body.role-admin .bottom-nav .bn-dot,
  body.role-vendor .bottom-nav .bn-dot,
  body.desk-dark .bottom-nav .bn-dot {
    position: absolute;
    top: 6px;
    right: calc(50% - 14px);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--danger);
    border: 1.5px solid #fff;
  }

  body.desk-dark .bottom-nav .bn-dot {
    border-color: #0c1424;
  }

  body.role-resident .content,
  body.role-admin .content,
  body.role-vendor .content,
  body.desk-dark .content {
    padding-bottom: calc(var(--bottom-nav-h) + 28px + env(safe-area-inset-bottom, 0px));
  }

  body.role-resident .fab-sos {
    bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    width: 54px;
    height: 54px;
  }

  body.role-resident .search,
  body.role-admin .search,
  body.role-vendor .search {
    display: none;
  }

  body.role-resident .profile-trigger {
    display: none;
  }

  body.role-admin .topbar .btn-primary.btn-sm,
  body.role-vendor .topbar .btn-primary.btn-sm {
    display: none;
  }

  body.role-resident .visitor-card {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
    border-radius: 18px;
  }

  body.role-resident .visitor-photo {
    width: 64px;
    height: 64px;
    font-size: 20px;
  }

  body.role-resident .visitor-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  body.role-resident .visitor-actions .btn {
    min-width: 0;
    height: 46px;
    font-size: 14px;
  }

  body.role-resident .visitor-actions .btn-soft {
    grid-column: 1 / -1;
  }

  body.role-resident .visitor-side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  body.role-resident .module-grid,
  body.role-admin .module-grid,
  body.role-vendor .module-grid,
  body.desk-dark .module-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  body.role-resident .module-card,
  body.role-admin .module-card,
  body.role-vendor .module-card,
  body.desk-dark .module-card {
    min-height: 108px;
    padding: 14px;
  }

  body.role-resident .kpi-grid,
  body.role-admin .kpi-grid,
  body.role-vendor .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  body.role-resident .live-strip,
  body.role-admin .live-strip,
  body.role-vendor .live-strip {
    font-size: 12px;
    padding: 10px 12px;
  }

  body.role-resident .pay-hero .amount {
    font-size: 36px;
  }

  body.role-resident .toast-host,
  body.role-admin .toast-host,
  body.role-vendor .toast-host,
  body.desk-dark .toast-host {
    bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom, 0px));
  }

  /* Mobile data tables → stacked density */
  body.role-admin .table-wrap,
  body.role-vendor .table-wrap,
  body.desk-dark .table-wrap {
    margin: 0 -4px;
  }

  body.role-admin .data-table,
  body.role-vendor .data-table,
  body.desk-dark .data-table {
    font-size: 12.5px;
  }

  body.role-admin .panel-grid,
  body.role-vendor .panel-grid,
  body.desk-dark .panel-grid {
    grid-template-columns: 1fr;
  }

  body.role-admin .gate-status,
  body.desk-dark .gate-status {
    grid-template-columns: repeat(3, 1fr);
  }

  body.role-admin .chart-wrap {
    height: 180px;
  }

  /* Action / priority cards on mobile */
  .priority-card {
    border-radius: 18px;
    padding: 16px;
  }

  .priority-card .visitor-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
  }

  .priority-card .visitor-actions .btn {
    min-width: 0;
    height: 44px;
  }
}

/* Phone-first density for role home greetings */
.resident-hello,
.role-hello {
  margin-bottom: 14px;
}
.resident-hello h2,
.role-hello h2 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.resident-hello p,
.role-hello p {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 500;
}

/* Priority / attention hero card (admin · vendor · guard mobile) */
.priority-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.priority-card.urgent {
  border-color: rgba(245, 158, 11, 0.45);
  background: linear-gradient(165deg, #fffbeb 0%, var(--surface) 55%);
}
.priority-card.urgent::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--warning);
  border-radius: 4px 0 0 4px;
}
.priority-card.danger {
  border-color: rgba(239, 68, 68, 0.35);
  background: linear-gradient(165deg, #fef2f2 0%, var(--surface) 55%);
}
.priority-card.danger::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--danger);
}
.priority-card.teal {
  border-color: rgba(20, 184, 166, 0.35);
  background: linear-gradient(165deg, #f0fdfa 0%, var(--surface) 55%);
}
.priority-card.teal::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
}
body.desk-dark .priority-card {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}
body.desk-dark .priority-card.urgent {
  background: linear-gradient(165deg, rgba(251, 191, 36, 0.12) 0%, var(--surface) 60%);
}
.priority-card .pc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.priority-card .pc-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warning);
}
.priority-card.danger .pc-eyebrow { color: var(--danger); }
.priority-card.teal .pc-eyebrow { color: #0f766e; }
.priority-card h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.priority-card .pc-sub {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.4;
}
.priority-card .pc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.priority-card .visitor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* Collection hero (admin mobile) */
.collect-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.collect-hero .ch-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.collect-hero .ch-amount {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.collect-hero .ch-label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

/* Mobile ops timeline */
.ops-pulse {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* --- Guard dark desk mode --- */
body.desk-dark {
  color-scheme: dark;
  --ink: #f1f5f9;
  --ink-soft: #e2e8f0;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --line: #1e293b;
  --line-strong: #334155;
  --field: #0f172a;
  --surface: #111827;
  --page: #0b1220;
  --brand-soft: rgba(56, 189, 248, 0.12);
  --brand-ring: rgba(56, 189, 248, 0.22);
  --brand: #38bdf8;
  --brand-hover: #7dd3fc;
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --info-soft: rgba(56, 189, 248, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
}

body.desk-dark {
  background: var(--page);
  color: var(--ink);
}

body.desk-dark .sidebar {
  background: #0c1424;
  border-right-color: var(--line);
}

body.desk-dark .topbar {
  background: rgba(12, 20, 36, 0.92);
  border-bottom-color: var(--line);
}

body.desk-dark .panel,
body.desk-dark .kpi,
body.desk-dark .guard-tile,
body.desk-dark .gate-stat,
body.desk-dark .visitor-card,
body.desk-dark .list-row,
body.desk-dark .help-card,
body.desk-dark .user-chip,
body.desk-dark .search input,
body.desk-dark .icon-btn,
body.desk-dark .menu-toggle,
body.desk-dark .community-chip {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

body.desk-dark .data-table th {
  background: #0c1424;
  color: var(--muted);
}

body.desk-dark .data-table td {
  border-bottom-color: var(--line);
  color: var(--ink-soft);
}

body.desk-dark .data-table tbody tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}

body.desk-dark .nav-item:hover {
  background: rgba(56, 189, 248, 0.08);
  color: var(--ink);
}

body.desk-dark .nav-item.is-active {
  background: var(--brand-soft);
  color: var(--brand);
}

body.desk-dark .field input,
body.desk-dark .field select,
body.desk-dark .field textarea,
body.desk-dark .form-control,
body.desk-dark .form-select {
  background: #0b1220;
  border-color: var(--line-strong);
  color: var(--ink);
}

body.desk-dark .btn-outline {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

body.desk-dark .btn-outline:hover {
  background: rgba(255, 255, 255, 0.04);
}

body.desk-dark .btn-ghost {
  color: var(--muted);
}

body.desk-dark .btn-soft {
  background: var(--brand-soft);
  color: var(--brand);
}

body.desk-dark .notif-panel {
  background: #0c1424;
  border-left-color: var(--line);
}

body.desk-dark .modal-backdrop .modal {
  background: #111827 !important;
  border-color: var(--line) !important;
  color: var(--ink) !important;
}

body.desk-dark .modal-foot {
  background: #0c1424;
}

body.desk-dark .desk-banner {
  background: linear-gradient(100deg, #0ea5e9 0%, #0f766e 55%, #134e4a 100%);
  box-shadow: 0 12px 32px rgba(14, 165, 233, 0.2);
}

body.desk-dark .guard-tile.primary {
  background: linear-gradient(145deg, #0ea5e9, #0369a1);
  box-shadow: 0 14px 32px rgba(14, 165, 233, 0.28);
}

body.desk-dark .guard-tile {
  min-height: 150px;
}

body.desk-dark .gate-stat {
  border-width: 1.5px;
}

body.desk-dark .gate-stat .gs-val {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-display);
}

body.desk-dark .badge-neutral {
  background: #1e293b;
  color: #94a3b8;
}

body.desk-dark .demo-cue {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(45, 212, 191, 0.1));
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--ink-soft);
}

body.desk-dark .page-flash--info {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

body.desk-dark .page-flash--success {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
}

body.desk-dark .page-flash--warning {
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}

body.desk-dark .page-flash--danger {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

/* Large desk action strip */
.desk-quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.desk-quick button {
  height: 52px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
}
.desk-quick button:hover {
  border-color: var(--brand);
  color: var(--brand);
}
body.desk-dark .desk-quick button {
  background: #0f172a;
}

@media (max-width: 860px) {
  .desk-quick { grid-template-columns: 1fr 1fr; }
}
