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

:root {
  --bg-primary: #07070f;
  --bg-card: #0f0f1a;
  --bg-card2: #13131f;
  --border: #1c1c30;
  --border-glow: #2a2a4a;
  --accent: #00cfff;
  --accent-dim: rgba(0, 207, 255, 0.15);
  --accent-dim2: rgba(0, 207, 255, 0.07);
  --green: #00e676;
  --green-dim: rgba(0, 230, 118, 0.15);
  --orange: #ff9100;
  --orange-dim: rgba(255, 145, 0, 0.15);
  --red: #ff3d71;
  --red-dim: rgba(255, 61, 113, 0.15);
  --yellow: #ffd740;
  --yellow-dim: rgba(255, 215, 64, 0.15);
  --purple: #c084fc;
  --purple-dim: rgba(192, 132, 252, 0.15);
  --text: #e2e2f0;
  --text-dim: #8888aa;
  --text-faint: #44445a;
  --radius: 12px;
  --radius-sm: 8px;
}

html, body {
  height: 100%;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 3px; }

/* ─── Auth Pages ─── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 50% 0%, rgba(0,207,255,0.05) 0%, transparent 55%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 38px 34px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-dim);
  border: 1px solid rgba(0,207,255,0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-text .b-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.brand-text .b-sub {
  font-size: 10px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.auth-title { font-size: 21px; font-weight: 700; margin-bottom: 5px; }
.auth-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 26px; }

.form-group { margin-bottom: 15px; }

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13px;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,207,255,0.07);
}

.form-group input::placeholder, .form-group textarea::placeholder { color: var(--text-faint); }

.form-group select { cursor: pointer; }

.form-group select option { background: var(--bg-card); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
}

.btn-primary:hover { background: #33d9ff; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-sm {
  padding: 6px 12px;
  font-size: 11px;
  border-radius: 6px;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--bg-card2); color: var(--text); }

.btn-danger {
  background: var(--red-dim);
  border: 1px solid rgba(255,61,113,0.3);
  color: var(--red);
}

.btn-danger:hover { background: rgba(255,61,113,0.25); }

.btn-success {
  background: var(--green-dim);
  border: 1px solid rgba(0,230,118,0.3);
  color: var(--green);
}

.btn-success:hover { background: rgba(0,230,118,0.25); }

.btn-warn {
  background: var(--orange-dim);
  border: 1px solid rgba(255,145,0,0.3);
  color: var(--orange);
}

.btn-warn:hover { background: rgba(255,145,0,0.25); }

.btn-accent {
  background: var(--accent-dim);
  border: 1px solid rgba(0,207,255,0.3);
  color: var(--accent);
}

.btn-accent:hover { background: rgba(0,207,255,0.22); }

.auth-link {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.auth-link a { color: var(--accent); text-decoration: none; font-weight: 600; }

.auth-error {
  margin-top: 16px;
  padding: 16px 18px;
  background: rgba(255, 61, 113, 0.18);
  border: 2px solid #ff3d71;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: #ff3d71;
  display: none;
  line-height: 1.6;
  word-break: break-word;
}
.auth-error .err-code {
  display: block;
  font-size: 11px;
  font-weight: 400;
  opacity: 0.75;
  margin-top: 6px;
  font-family: monospace;
}

/* ─── Consent Overlay ─── */
.consent-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,7,15,0.97);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.consent-card {
  width: 100%;
  max-width: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.consent-card h2 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 6px;
}

.consent-intro {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 22px;
  line-height: 1.6;
}

.consent-item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.consent-item:last-of-type { border-bottom: none; margin-bottom: 20px; }

.consent-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.ci-loc { background: rgba(0,207,255,0.12); }
.ci-cam { background: rgba(0,230,118,0.12); }
.ci-mic { background: rgba(255,145,0,0.12); }
.ci-bat { background: rgba(255,215,64,0.12); }

.consent-text strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.consent-text span { font-size: 12px; color: var(--text-dim); }

.consent-actions { display: flex; gap: 10px; }
.consent-actions .btn { flex: 1; margin-top: 0; }
.consent-decline { background: var(--bg-primary); border: 1px solid var(--border); color: var(--text-dim); }

/* ─── App Layout ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  height: 54px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.tb-icon {
  width: 30px;
  height: 30px;
  background: var(--accent-dim);
  border: 1px solid rgba(0,207,255,0.25);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.tb-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.tb-sub {
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 600;
}

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

.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-dim);
}

.user-chip .udot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 5px var(--green);
}

.main-content {
  padding: 22px 18px;
  max-width: 860px;
  margin: 0 auto;
}

/* ─── Page header ─── */
.page-header { margin-bottom: 22px; }
.page-title { font-size: 17px; font-weight: 700; margin-bottom: 3px; }
.page-sub { font-size: 12px; color: var(--text-dim); }

/* ─── Stat cards ─── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.stat-icon-box {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.stat-meta { font-size: 11px; color: var(--text-faint); }

/* ─── Section header ─── */
.section-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Permission cards ─── */
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.perm-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 13px;
  transition: border-color 0.2s;
}

.perm-card.granted { border-color: rgba(0,230,118,0.3); }
.perm-card.denied { border-color: rgba(255,61,113,0.25); }
.perm-card.pending { border-color: rgba(255,215,64,0.25); }
.perm-card.active-req {
  border-color: rgba(255,145,0,0.5);
  animation: req-pulse 1.8s ease-in-out infinite;
}

@keyframes req-pulse {
  0%, 100% { border-color: rgba(255,145,0,0.4); box-shadow: none; }
  50% { border-color: rgba(255,145,0,0.8); box-shadow: 0 0 12px rgba(255,145,0,0.15); }
}

.perm-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.perm-body { flex: 1; min-width: 0; }

.perm-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.perm-desc { font-size: 11px; color: var(--text-dim); }

.perm-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
}

.badge-on { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,230,118,0.3); }
.badge-off { background: var(--red-dim); color: var(--red); border: 1px solid rgba(255,61,113,0.2); }
.badge-pending { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(255,215,64,0.3); }
.badge-req { background: var(--orange-dim); color: var(--orange); border: 1px solid rgba(255,145,0,0.3); }
.badge-online { background: var(--green-dim); color: var(--green); border: 1px solid rgba(0,230,118,0.3); }
.badge-offline { background: var(--bg-primary); color: var(--text-faint); border: 1px solid var(--border); }

/* ─── Location card ─── */
.location-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

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

.loc-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.coord-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.coord-box {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
}

.coord-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  margin-bottom: 3px;
}

.coord-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  font-family: 'Courier New', monospace;
}

.map-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 11px;
  background: var(--accent-dim2);
  border: 1px solid rgba(0,207,255,0.2);
  border-radius: 6px;
  transition: background 0.2s;
}

.map-link:hover { background: var(--accent-dim); }

/* ─── Battery bar ─── */
.battery-display {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bat-bar-wrap {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.bat-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s;
}

.bat-high { background: var(--green); }
.bat-med { background: var(--yellow); }
.bat-low { background: var(--red); box-shadow: 0 0 6px var(--red); }

.bat-pct { font-size: 12px; font-weight: 700; color: var(--text); min-width: 36px; text-align: right; }

/* ─── Request notification ─── */
/* ─── Active Monitoring Banner ─── */
.active-monitor-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  background: rgba(255, 61, 113, 0.12);
  border-bottom: 2px solid var(--red);
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
}

.active-monitor-banner.hidden { display: none; }

.active-monitor-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.active-monitor-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
  animation: pulse-red 1.2s ease-in-out infinite;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 61, 113, 0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(255, 61, 113, 0); }
}

.req-banner {
  position: fixed;
  bottom: 18px;
  right: 18px;
  max-width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--orange);
  border-radius: var(--radius);
  padding: 14px 15px;
  z-index: 500;
  display: none;
  animation: slide-in 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.req-banner.show { display: block; }

@keyframes slide-in {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.req-banner-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--orange);
  margin-bottom: 4px;
}

.req-banner-body {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 11px;
}

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

/* ─── Live Monitoring (device details page) ─── */
.live-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.live-conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(0, 230, 118, 0); }
}

.live-conn-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-faint);
}

.live-video-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  margin-bottom: 14px;
  position: relative;
}

.live-video-wrap video {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #000;
}

.live-video-label {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,0.75);
  background: rgba(0,0,0,0.5);
  padding: 3px 8px;
  border-radius: 20px;
}

.live-mic-active {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 145, 0, 0.1);
  border: 1px solid rgba(255, 145, 0, 0.3);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  color: var(--orange);
  margin-bottom: 14px;
}

.live-mic-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
  animation: pulse-orange 1.2s ease-in-out infinite;
}

@keyframes pulse-orange {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 145, 0, 0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(255, 145, 0, 0); }
}

.live-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

/* ─── Admin Layout ─── */
.admin-wrap {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 210px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 16px 15px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .sb-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.sidebar-brand .sb-sub {
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar-brand .sb-admin {
  display: inline-block;
  margin-top: 5px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 1px 7px;
  background: rgba(255,145,0,0.15);
  border: 1px solid rgba(255,145,0,0.3);
  color: var(--orange);
  border-radius: 10px;
}

.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }

.nav-group-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-faint);
  padding: 8px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.14s;
  margin-bottom: 1px;
}

.nav-item:hover { background: var(--bg-primary); color: var(--text); }
.nav-item.active { background: var(--accent-dim2); color: var(--accent); border: 1px solid rgba(0,207,255,0.12); }
.nav-item .ni { font-size: 14px; width: 18px; flex-shrink: 0; }

.nav-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 8px;
}

.sidebar-foot {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.admin-body {
  margin-left: 210px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  height: 54px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-topbar-title { font-size: 14px; font-weight: 700; }

.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: live-pulse 1.6s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,230,118,0.7); }
  50% { box-shadow: 0 0 0 5px rgba(0,230,118,0); }
}

.admin-main {
  flex: 1;
  padding: 22px;
}

/* ─── Admin stat row ─── */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

/* ─── Panels ─── */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
}

.panel-actions { display: flex; gap: 7px; }

/* ─── User table ─── */
.u-table {
  width: 100%;
  border-collapse: collapse;
}

.u-table th {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-faint);
  padding: 9px 16px;
  text-align: left;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.u-table td {
  padding: 12px 16px;
  font-size: 12px;
  border-bottom: 1px solid rgba(28,28,48,0.5);
  vertical-align: middle;
}

.u-table tr:last-child td { border-bottom: none; }
.u-table tr:hover td { background: var(--bg-card2); }

.u-name-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}

.u-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(0,207,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.u-name { font-size: 12px; font-weight: 600; }
.u-email { font-size: 10px; color: var(--text-dim); }

.online-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-on { background: var(--green); box-shadow: 0 0 5px var(--green); }
.dot-off { background: var(--text-faint); }

.bat-mini {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  white-space: nowrap;
}

.action-btns { display: flex; gap: 5px; flex-wrap: wrap; }

/* ─── Location list ─── */
.loc-entry {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(28,28,48,0.4);
  font-size: 12px;
}

.loc-entry:last-child { border-bottom: none; }
.loc-entry:hover { background: var(--bg-card2); }

.loc-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.loc-body { flex: 1; min-width: 0; }
.loc-name { font-size: 12px; font-weight: 600; margin-bottom: 1px; }
.loc-coords { font-size: 10px; color: var(--text-dim); font-family: 'Courier New', monospace; }
.loc-time { font-size: 10px; color: var(--text-faint); text-align: right; white-space: nowrap; }

/* ─── Log feed ─── */
.log-feed { max-height: 300px; overflow-y: auto; }

.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid rgba(28,28,48,0.35);
  font-size: 11px;
}

.log-entry:last-child { border-bottom: none; }
.log-entry:hover { background: var(--bg-card2); }

.log-ts {
  color: var(--text-faint);
  white-space: nowrap;
  font-family: 'Courier New', monospace;
  min-width: 56px;
  padding-top: 1px;
  font-size: 10px;
}

.log-ico { font-size: 13px; padding-top: 1px; flex-shrink: 0; }

.log-msg { color: var(--text-dim); flex: 1; }
.log-msg strong { color: var(--text); font-weight: 600; }

.log-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
}

.lt-loc { background: var(--accent-dim); color: var(--accent); }
.lt-cam { background: var(--green-dim); color: var(--green); }
.lt-mic { background: var(--orange-dim); color: var(--orange); }
.lt-auth { background: var(--purple-dim); color: var(--purple); }
.lt-sys { background: var(--bg-primary); color: var(--text-faint); border: 1px solid var(--border); }
.lt-device { background: rgba(0,207,255,0.12); color: var(--accent); }
.lt-gps { background: rgba(0,230,118,0.12); color: var(--green); }
.lt-camera { background: rgba(145,100,255,0.12); color: #9164ff; }
.lt-subscription { background: rgba(255,207,0,0.1); color: #d4af37; }
.lt-admin { background: rgba(0,207,255,0.15); color: var(--accent); }
.lt-error { background: rgba(255,61,113,0.12); color: var(--red); }

/* ─── Audit log entry ─── */
.audit-entry { align-items: flex-start !important; }
.audit-sev {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.sev-info { background: var(--accent); }
.sev-warn { background: var(--orange); }
.sev-critical { background: var(--red); box-shadow: 0 0 5px rgba(255,61,113,0.6); }
.audit-body { flex: 1; min-width: 0; line-height: 1.45; }
.audit-action { font-weight: 600; color: var(--text); font-size: 12px; }
.audit-meta { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.audit-details { font-size: 10px; color: var(--text-faint); margin-top: 2px; font-style: italic; }

/* ─── Empty / loading ─── */
.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
}

.empty-ico { font-size: 28px; margin-bottom: 8px; opacity: 0.35; }

.loading-row {
  padding: 28px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  z-index: 900;
  opacity: 0;
  transition: all 0.25s;
  white-space: nowrap;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.t-success { border-color: rgba(0,230,118,0.4); color: var(--green); }
.toast.t-error { border-color: rgba(255,61,113,0.4); color: var(--red); }
.toast.t-warn { border-color: rgba(255,145,0,0.4); color: var(--orange); }

/* ─── Spinner ─── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Utility ─── */
.hidden { display: none !important; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-accent { color: var(--accent); }
.text-orange { color: var(--orange); }
.text-dim { color: var(--text-dim); }
.text-yellow { color: var(--yellow); }

/* ─── Hamburger Menu ─── */
.menu-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.menu-toggle:hover { background: var(--bg-card2); }

.hm-anchor {
  position: relative;
}

.hamburger-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 200px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s, transform 0.15s;
  z-index: 300;
}
.hamburger-dropdown.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.hm-user {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  padding: 4px 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hm-role {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 400;
  margin-top: 2px;
}
.hm-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0 8px;
}
.hm-logout {
  width: 100%;
  background: rgba(255,61,113,0.08);
  border: 1px solid rgba(255,61,113,0.22);
  color: var(--red);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s;
  text-align: center;
  letter-spacing: 0.4px;
}
.hm-logout:hover { background: rgba(255,61,113,0.18); }

/* ─── Sidebar nav button ─── */
button.nav-item, button.nav-btn {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}

/* ─── QR Pairing Modal ─── */
.qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.qr-modal.hidden { display: none; }

.qr-modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.qr-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.qr-modal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.qr-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.qr-close-btn:hover { background: var(--bg-card2); color: var(--text); }

.qr-code-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
#qr-code-container {
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--accent);
  box-shadow: 0 0 24px rgba(0,229,255,0.18);
  line-height: 0;
}
.qr-placeholder {
  width: 200px;
  height: 200px;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  padding: 20px;
  box-sizing: border-box;
  line-height: 1.4;
}

.qr-meta {
  text-align: center;
  margin-bottom: 14px;
}
.qr-countdown {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  font-family: monospace;
  letter-spacing: 3px;
  line-height: 1;
}
.qr-countdown-label {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.qr-link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.qr-link-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

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

/* ─── Pair Page ─── */
.pair-body {
  min-height: 100vh;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.pair-screen { width: 100%; max-width: 420px; }

.pair-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.pair-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.pair-title { font-size: 18px; font-weight: 700; color: var(--text); }
.pair-sub {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-weight: 600;
  margin-top: 2px;
}

.pair-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.65;
  margin-bottom: 18px;
}

.pair-admin-badge {
  background: var(--accent-dim);
  border: 1px solid rgba(0,229,255,0.2);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  display: inline-block;
  margin-bottom: 16px;
}

.qr-reader-box {
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
}
#qr-reader video { display: block; width: 100% !important; border-radius: 0; }
#qr-reader__scan_region { border: 2px solid var(--accent) !important; }
#qr-reader__dashboard { display: none !important; }

.scan-status {
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.pair-error {
  background: rgba(255,61,113,0.08);
  border: 1px solid rgba(255,61,113,0.25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--red);
  margin-top: 8px;
}

.pair-consent-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--border);
}
.pair-consent-item { display: flex; align-items: flex-start; gap: 12px; }
.pci-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.pci-text { display: flex; flex-direction: column; gap: 2px; }
.pci-text strong { color: var(--text); font-size: 12px; font-weight: 600; }
.pci-text span { color: var(--text-dim); font-size: 11px; }

.pair-name-row { margin-bottom: 18px; }
.pair-label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}
.pair-input {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  box-sizing: border-box;
  font-family: inherit;
}
.pair-input:focus { outline: none; border-color: var(--accent); }

.pair-actions { display: flex; gap: 10px; }
.pair-actions .btn { flex: 1; justify-content: center; }

.pair-notif-pref {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 14px 12px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pair-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 4px 0;
}
.pair-radio-label input[type="radio"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}
.pair-notif-note {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.pair-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: pair-spin 0.8s linear infinite;
  margin: 24px auto 0;
}
@keyframes pair-spin { to { transform: rotate(360deg); } }

/* ─── Subscription Card ─── */
.sub-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color 0.2s;
}
.sub-card.sub-active  { border-color: rgba(0,230,118,0.35); }
.sub-card.sub-warning { border-color: rgba(255,145,0,0.35); }
.sub-card.sub-expired { border-color: rgba(255,61,113,0.35); }
.sub-card.sub-none    { border-style: dashed; }

.sub-icon { font-size: 28px; flex-shrink: 0; }
.sub-info { flex: 1; min-width: 0; }
.sub-plan-name { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.sub-meta { font-size: 12px; color: var(--text-dim); }
.sub-alert { font-size: 12px; color: var(--orange); margin-top: 6px; font-weight: 600; }
.sub-days {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  font-family: monospace;
  white-space: nowrap;
}

/* ─── Plans Grid ─── */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.plan-card:hover { border-color: rgba(0,229,255,0.25); }
.plan-card.plan-current {
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(0,229,255,0.1);
}
.plan-card.plan-inactive { opacity: 0.55; }
.plan-card.plan-popular {
  border-color: rgba(0,229,255,0.4);
  background: linear-gradient(160deg, var(--bg-card) 70%, rgba(0,229,255,0.04));
}

.plan-popular-badge {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 0 0 8px 8px;
}

.plan-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  margin-top: 6px;
}
.plan-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.plan-name { font-size: 15px; font-weight: 700; color: var(--text); }

.plan-price {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.plan-period { font-size: 14px; font-weight: 400; color: var(--text-dim); }

.plan-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}
.plan-features li { font-size: 12px; font-weight: 500; }
.feat-on { color: var(--green); }
.feat-off { color: var(--text-faint); text-decoration: line-through; }

.plan-card-footer { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.plan-card-footer .btn { width: 100%; justify-content: center; }
.plan-mgmt-row { display: flex; gap: 6px; }
.plan-mgmt-row .btn { flex: 1; justify-content: center; }

/* ─── Plan Edit Modal form ─── */
.pm-field { margin-bottom: 14px; }
.pm-label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-bottom: 6px;
}
.pm-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pm-checkboxes { display: flex; flex-direction: column; gap: 10px; }
.pm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.pm-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* ─── Extra small button ─── */
.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 5px;
  line-height: 1.4;
}

/* ─── SA action row ─── */
.sa-action-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

/* ─── Secondary admin — blocked overlay ─── */
.sa-blocked-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 14, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}
.sa-blocked-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  max-width: 400px;
  width: 90%;
  text-align: center;
}
.sa-blocked-icon { font-size: 56px; margin-bottom: 16px; }
.sa-blocked-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.sa-blocked-msg { font-size: 14px; color: var(--text-dim); line-height: 1.6; }

/* ─── Secondary admin — expiry warning banner ─── */
.sa-expiry-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--orange);
  background: rgba(255,145,0,0.08);
  font-size: 13px;
  font-weight: 500;
}

/* ─── Sidebar subscription status block ─── */
.sidebar-sub-status {
  margin: 0 12px 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.sidebar-sub-label {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-bottom: 5px;
}

/* ─── Invite page form ─── */
.inv-field { margin-bottom: 14px; }
.inv-label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-bottom: 6px;
}
.inv-error {
  background: rgba(255,61,113,0.1);
  border: 1px solid rgba(255,61,113,0.3);
  color: var(--red);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 10px;
}

/* ─── Secondary admin invite modal ─── */
.sa-invite-info-row {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 10px;
  text-align: center;
  justify-content: center;
}

/* ─── Payment modal — plan selection ─── */
.pay-plans-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 4px;
}
.pay-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s;
}
.pay-plan-row:hover { border-color: rgba(0,229,255,0.3); }
.pay-plan-row-name { font-size: 14px; font-weight: 600; color: var(--text); }
.pay-plan-row-meta { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.pay-plan-row-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.pay-plan-row-price { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; }
.pay-empty { text-align: center; color: var(--text-faint); font-size: 13px; padding: 24px 0; margin: 0; }

/* ─── Payment modal — summary row ─── */
.pay-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(0,229,255,0.05);
  border: 1px solid rgba(0,229,255,0.2);
  border-radius: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.pay-summary-name { font-size: 14px; font-weight: 600; color: var(--text); }
.pay-summary-meta { font-size: 12px; color: var(--text-dim); }
.pay-summary-price { font-size: 18px; font-weight: 800; color: var(--accent); flex-shrink: 0; }

/* ─── Payment modal — PIX card ─── */
.pay-pix-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.pay-qr-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 220px;
  margin-bottom: 8px;
}
.pay-qr-img {
  width: 240px;
  height: 240px;
  border-radius: 10px;
  image-rendering: pixelated;
  display: block;
  background: #fff;
  padding: 10px;
  box-sizing: border-box;
}
#pay-qr-wrap .qr-placeholder {
  width: 240px;
  height: 240px;
}
.pay-scan-hint {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  margin: 0 0 10px;
  line-height: 1.4;
}
.pay-status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 6px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.pay-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pay-dot-pending  { background: var(--orange); animation: pay-pulse 1.4s ease-in-out infinite; }
.pay-dot-approved { background: var(--green); }
.pay-dot-rejected { background: var(--red); }
@keyframes pay-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.8); }
}
.pay-expire-row {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin: 4px 0 12px;
}
.pay-expire-label {
  font-size: 11px;
  color: var(--text-dim);
}
.pay-countdown-num {
  font-size: 14px;
  font-weight: 700;
  font-family: monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  color: var(--text);
  min-width: 38px;
}
.pay-code-row {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
}
.pay-code-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.pay-success-wrap {
  text-align: center;
  padding: 28px 16px;
}
.pay-success-icon {
  font-size: 52px;
  margin-bottom: 14px;
  line-height: 1;
}
.pay-success-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.pay-success-msg {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ─── Mobile ─── */
@media (max-width: 768px) {
  .admin-wrap { flex-direction: column; }
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-nav { display: flex; flex-wrap: wrap; padding: 8px; gap: 4px; }
  .nav-group-label { display: none; }
  .admin-body { margin-left: 0; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .u-table { display: block; overflow-x: auto; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .perm-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 26px 20px; }
  .consent-card { padding: 22px 18px; }
}

@media (max-width: 480px) {
  .admin-stats { grid-template-columns: 1fr 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .topbar-right .user-chip { display: none; }
}

/* ─── Device Details Page ─── */
.device-page {
  min-height: 100vh;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
}

.device-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.device-header-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
}

.device-back-btn {
  flex-shrink: 0;
  margin-top: 0;
  width: auto;
}

.device-main {
  padding: 24px 20px 48px;
  max-width: 700px;
  margin: 0 auto;
  width: 100%;
}

.device-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.device-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.device-subtitle {
  font-size: 12px;
  color: var(--text-dim);
}

.device-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.device-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.device-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.device-stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-faint);
}

.device-stat-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.device-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 10px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.device-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.device-info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  overflow: hidden;
}

.device-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.device-info-key {
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.device-info-val {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: right;
}

.device-id-val {
  font-family: monospace;
  font-size: 11px;
  color: var(--text-faint);
  word-break: break-all;
}

.device-realtime-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 8px;
  justify-content: center;
}

.device-row:hover td {
  background: var(--bg-card2);
}

@media (max-width: 600px) {
  .device-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .device-title-row { flex-direction: column; }
  .device-title-row .btn { width: 100%; }
}

/* ─── Alert Feed ─── */

.alert-feed {
  max-height: 520px;
  overflow-y: auto;
}

.alert-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  transition: background 0.15s;
}

.alert-entry:last-child { border-bottom: none; }

.alert-entry:not(.alert-read) {
  background: rgba(0, 207, 255, 0.025);
  border-left: 2px solid transparent;
}

.alert-entry.alert-read {
  opacity: 0.52;
}

.alert-sev-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.alert-dot-info     { background: var(--accent); }
.alert-dot-warning  { background: var(--orange); box-shadow: 0 0 5px rgba(255,145,0,0.5); }
.alert-dot-critical {
  background: var(--red);
  box-shadow: 0 0 6px rgba(255,61,113,0.7);
  animation: pulse-alert-dot 1.4s ease-in-out infinite;
}

@keyframes pulse-alert-dot {
  0%, 100% { box-shadow: 0 0 4px rgba(255,61,113,0.5); }
  50%       { box-shadow: 0 0 10px rgba(255,61,113,0.9); }
}

.alert-cat-ico {
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-body   { flex: 1; min-width: 0; }
.alert-msg    { font-size: 13px; font-weight: 500; color: var(--text); line-height: 1.4; }

.alert-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 3px;
}

.alert-right {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.alert-sev-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.sev-tag-info     { background: var(--accent-dim);  color: var(--accent);  }
.sev-tag-warning  { background: var(--orange-dim);  color: var(--orange);  }
.sev-tag-critical { background: var(--red-dim);     color: var(--red);     }

/* Alert filter buttons row */
.alert-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card2);
}

.alert-filter-label {
  font-size: 11px;
  color: var(--text-faint);
  align-self: center;
  margin-right: 2px;
}

/* Nav alert badge */
#nav-alert-badge,
#sa-nav-alert-badge {
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: auto;
  min-width: 16px;
  text-align: center;
}

/* ── Geofence UI ─────────────────────────────────────────────────────────────── */

/* Device checklist in geofence form modal */
.geo-devices-scroll {
  max-height: 150px;
  overflow-y: auto;
  padding: 4px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--bg-card2);
}

.geo-device-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
  cursor: pointer;
  color: var(--text);
  user-select: none;
}

.geo-device-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.geo-device-label:hover {
  color: var(--accent);
}


/* ── Notifications System ─────────────────────────────────────────────────── */

.notif-bell-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.notif-bell-btn {
  position: relative;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 8px;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 0;
  transition: background 0.15s;
  color: var(--text);
}

.notif-bell-btn:hover { background: var(--bg-card2); }

.notif-bell-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
}

/* Bell dropdown */
.notif-bell-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-width: 94vw;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.55);
  z-index: 9999;
  overflow: hidden;
}

.notif-drop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.notif-drop-header-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.notif-drop-view-all {
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
}
.notif-drop-view-all:hover { text-decoration: underline; }

.notif-drop-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-faint);
  font-size: 12px;
}

#notif-drop-list,
#sa-notif-drop-list {
  max-height: 360px;
  overflow-y: auto;
}

/* Dropdown items */
.notif-drop-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.12s;
}
.notif-drop-item:hover { background: var(--bg-card2); }
.notif-drop-item:last-child { border-bottom: none; }
.notif-drop-item-unread { background: rgba(0,207,255,0.04); }

.notif-drop-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.notif-drop-body {
  flex: 1;
  min-width: 0;
}

.notif-drop-body .notif-drop-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-drop-msg {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-drop-time {
  font-size: 10px;
  color: var(--text-faint);
}

/* Severity pip (dot in dropdown) */
.notif-sev-pip {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
}
.notif-sev-critical { background: var(--red);    box-shadow: 0 0 5px var(--red); }
.notif-sev-warning  { background: var(--orange); }
.notif-sev-info     { background: var(--accent); }

/* Notification panel table */
.notif-row-unread { background: rgba(0,207,255,0.03); }
.notif-row-unread:hover { background: rgba(0,207,255,0.07) !important; }

.notif-read-pip {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.notif-read-pip-unread {
  background: var(--accent);
  box-shadow: 0 0 4px rgba(0,207,255,0.5);
}
.notif-read-pip-read { background: var(--border); }

/* Severity badges inside notification table */
.notif-badge-critical {
  background: rgba(255,61,113,0.15);
  color: var(--red);
  border: 1px solid rgba(255,61,113,0.3);
  border-radius: 5px;
  padding: 2px 6px;
}
.notif-badge-warning {
  background: rgba(255,145,0,0.12);
  color: var(--orange);
  border: 1px solid rgba(255,145,0,0.3);
  border-radius: 5px;
  padding: 2px 6px;
}
.notif-badge-info {
  background: rgba(0,207,255,0.10);
  color: var(--accent);
  border: 1px solid rgba(0,207,255,0.25);
  border-radius: 5px;
  padding: 2px 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PWA & Mobile Improvements
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Safe area insets (notch / home-bar phones) ──────────────────────────── */
:root {
  --safe-top:    env(safe-area-inset-top,    0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left,   0px);
  --safe-right:  env(safe-area-inset-right,  0px);
}

/* ── Global mobile touch improvements ────────────────────────────────────── */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Ensure minimum touch targets on mobile */
@media (max-width: 768px) {
  .btn {
    min-height: 44px;
    min-width: 44px;
  }
  .btn-xs {
    min-height: 36px;
  }
  .nav-item {
    min-height: 44px;
    padding: 10px 14px;
  }
}

/* ── Standalone / installed PWA mode ──────────────────────────────────────── */
@media (display-mode: standalone) {
  /* Add top padding for status bar on iOS */
  body {
    padding-top: var(--safe-top);
  }
  /* Bottom spacing for home bar */
  .sidebar,
  .main-content {
    padding-bottom: calc(var(--safe-bottom) + 8px);
  }
  /* Hide browser-style top bar spacing that looks weird standalone */
  .auth-page {
    padding-top: calc(var(--safe-top) + 24px);
  }
}

/* ── PWA Install Button ───────────────────────────────────────────────────── */
.pwa-install-btn {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  right: 20px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 28px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0, 207, 255, 0.35);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.3s;
  animation: pwa-btn-slide-in 0.4s ease both;
}
.pwa-install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 32px rgba(0, 207, 255, 0.5);
}
.pwa-install-btn:active {
  transform: translateY(0);
}
.pwa-install-btn--hidden {
  opacity: 0;
  pointer-events: none;
}
@keyframes pwa-btn-slide-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Notification Permission Modal ───────────────────────────────────────── */
.pwa-notif-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + var(--safe-bottom));
  animation: pwa-overlay-in 0.25s ease both;
}
.pwa-notif-overlay--out {
  animation: pwa-overlay-out 0.25s ease both;
}
@keyframes pwa-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pwa-overlay-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

.pwa-notif-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px 24px;
  max-width: 480px;
  width: 100%;
  animation: pwa-card-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes pwa-card-up {
  from { opacity: 0; transform: translateY(32px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pwa-notif-icon {
  font-size: 36px;
  margin-bottom: 12px;
  text-align: center;
}
.pwa-notif-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  text-align: center;
}
.pwa-notif-body {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 20px;
}
.pwa-notif-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pwa-notif-list li {
  padding: 6px 10px;
  background: var(--bg-primary);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}
.pwa-notif-note {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 10px;
  margin-bottom: 0;
}
.pwa-notif-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.pwa-notif-actions .btn {
  min-height: 44px;
}

/* ── Android / mobile layout polish ─────────────────────────────────────── */
@media (max-width: 480px) {
  /* Wider buttons on narrow screens */
  .pwa-install-btn {
    left: 20px;
    right: 20px;
    justify-content: center;
    border-radius: 14px;
  }
  /* Auth cards — remove extra top space on small screens */
  .auth-card {
    margin-top: 0;
  }
  /* Stat cards — 2 columns on mobile */
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Reports Center ────────────────────────────────────────────── */
.rpt-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.rpt-stat {
  flex: 1;
  min-width: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
}
.rpt-stat-label {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
  white-space: nowrap;
}
.rpt-stat-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}
.rpt-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.rpt-tab, .sa-rpt-tab {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
  font-family: inherit;
}
.rpt-tab:hover, .sa-rpt-tab:hover {
  background: var(--bg-card);
  color: var(--text-main);
}
.rpt-tab.active, .sa-rpt-tab.active {
  background: rgba(0,207,255,.1);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.rpt-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}
.rpt-toolbar > span { flex: 1; }
.rpt-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: inherit;
}
.rpt-date-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: inherit;
  max-width: 130px;
}
.rpt-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-faint);
  font-size: 13px;
}
.rpt-data-table th { white-space: nowrap; }
.rpt-data-table td { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) {
  .rpt-summary { gap: 8px; }
  .rpt-stat { min-width: 80px; padding: 8px 10px; }
  .rpt-stat-val { font-size: 18px; }
  .rpt-tabs { gap: 3px; padding: 8px 12px 6px; }
  .rpt-tab, .sa-rpt-tab { font-size: 11px; padding: 4px 9px; }
}

/* ── Financial Dashboard ────────────────────────────────────────── */
.fin-filter-bar { display:flex; gap:3px; flex-wrap:wrap; }
.fin-filter-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.fin-filter-btn:hover { background: var(--bg-card); color: var(--text-main); }
.fin-filter-btn.active { background: rgba(0,207,255,.12); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.fin-section-head {
  padding: 10px 16px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  margin-top: 2px;
}
.fin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 16px 14px;
}
.fin-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color .2s;
}
.fin-kpi-accent { border-color: rgba(0,207,255,.35); background: rgba(0,207,255,.04); }
.fin-kpi-icon { font-size: 18px; margin-bottom: 4px; line-height: 1; }
.fin-kpi-val { font-size: 18px; font-weight: 800; color: var(--text-main); line-height: 1.15; word-break: break-all; }
.fin-kpi-big { font-size: 22px; color: var(--accent) !important; }
.fin-kpi-label { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .4px; margin-top: 3px; }
.fin-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 10px 16px 14px;
}
.fin-chart-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  position: relative;
}
.fin-chart-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.fin-chart-box canvas { height: 200px !important; width: 100% !important; }
.fin-sub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px 16px 14px;
}
.fin-sub-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 14px;
  text-align: center;
  transition: border-color .2s;
}
.fin-sub-card.fin-sub-warn   { border-color: rgba(255,215,64,.35); }
.fin-sub-card.fin-sub-orange { border-color: rgba(255,145,0,.35); }
.fin-sub-card.fin-sub-red    { border-color: rgba(255,61,113,.35); }
.fin-sub-card.fin-sub-green  { border-color: rgba(0,230,118,.35); }
.fin-sub-val { font-size: 30px; font-weight: 800; color: var(--text-main); line-height: 1; }
.fin-sub-label { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .4px; margin-top: 5px; }
.fin-sub-card.fin-sub-warn   .fin-sub-val { color: var(--yellow); }
.fin-sub-card.fin-sub-orange .fin-sub-val { color: var(--orange); }
.fin-sub-card.fin-sub-red    .fin-sub-val { color: var(--red); }
.fin-sub-card.fin-sub-green  .fin-sub-val { color: var(--green); }
.fin-metrics-wrap { padding: 10px 16px 14px; }
.fin-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.fin-metric-row:last-child { border-bottom: none; }
.fin-metric-label { font-size: 13px; color: var(--text-dim); }
.fin-metric-val { font-size: 15px; font-weight: 700; color: var(--accent); text-align: right; max-width: 60%; word-break: break-word; }
.fin-reports-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.fin-reports-bar > span { flex: 1; min-width: 120px; }
@media (max-width: 900px) {
  .fin-charts-grid { grid-template-columns: 1fr; }
  .fin-sub-grid    { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .fin-kpi-grid  { grid-template-columns: repeat(2, 1fr); }
  .fin-sub-grid  { grid-template-columns: repeat(2, 1fr); }
  .fin-kpi-val   { font-size: 15px; }
  .fin-kpi-big   { font-size: 18px; }
  .fin-sub-val   { font-size: 24px; }
  .fin-filter-btn { font-size: 10px; padding: 3px 8px; }
}

/* ── Invoice section ─────────────────────────────────────────────── */
.fin-invoice-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 4px;
  flex-wrap: wrap;
}
.fin-search-input {
  flex: 1;
  min-width: 200px;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  transition: border-color .15s;
}
.fin-search-input::placeholder { color: var(--text-faint); }
.fin-search-input:focus { border-color: rgba(0,207,255,.5); }

/* ── Payment plan: current-plan highlight ─── */
.pay-plan-row-current {
  border: 1px solid rgba(0,207,255,.4);
  background: rgba(0,207,255,.04);
  border-radius: 8px;
}
.pay-plan-current-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--accent);
  background: rgba(0,207,255,.12);
  border: 1px solid rgba(0,207,255,.3);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Payment method choice ───────────────────────────────────────── */
.pay-method-options {
  display: flex;
  gap: 12px;
  margin-bottom: 4px;
}
.pay-method-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 12px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  color: var(--text-main);
}
.pay-method-btn:hover {
  border-color: var(--accent);
  background: rgba(0,207,255,.06);
}
.pay-method-icon { font-size: 28px; }
.pay-method-name { font-size: 14px; font-weight: 700; }
.pay-method-desc { font-size: 11px; color: var(--text-dim); text-align: center; }

/* ── Card payment form ───────────────────────────────────────────── */
.pay-card-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.pay-card-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.pay-card-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.pay-card-field-wide { flex: 2; }
.pay-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .4px;
}
/* MercadoPago.js v2 mounts iframes into these divs.
   IMPORTANT: no padding and no overflow:hidden — both break iframe rendering.
   The iframe fills 100%×100% of the container; padding would shift/clip it. */
.pay-card-secure {
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color .15s;
  box-sizing: border-box;
  position: relative;
  overflow: visible;
}
/* Ensure MP-injected iframes fill the container exactly */
.pay-card-secure iframe {
  display: block;
  width: 100% !important;
  height: 100% !important;
  border: none !important;
  border-radius: 8px;
}
.pay-card-secure:focus-within { border-color: rgba(0,207,255,.6); }
.pay-card-input {
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
}
.pay-card-input::placeholder { color: var(--text-faint); }
.pay-card-input:focus { border-color: rgba(0,207,255,.6); }
.pay-card-error {
  background: rgba(255,59,48,.1);
  border: 1px solid rgba(255,59,48,.4);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
}
.pay-card-note {
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  margin: 10px 0 0;
  line-height: 1.5;
}
.pay-field-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pay-field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .04em;
  text-transform: uppercase;
}
