/* ==========================================================================
   CheckPoint — Brand System
   Security/Authority · Deep Navy + Gold
   ========================================================================== */

:root {
  /* Brand colors */
  --navy-950: #0A1628;
  --navy-900: #0F1F38;
  --navy-800: #15294B;
  --navy-700: #1E3A66;
  --navy-600: #2A4D85;
  --navy-500: #3B6BB0;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;

  --gold-600: #B8860B;
  --gold-500: #D4A017;
  --gold-400: #E5B53C;
  --gold-300: #F0CB66;
  --gold-100: #FBEDC4;

  --success: #10B981;
  --warning: #F59E0B;
  --danger:  #DC2626;
  --info:    #3B82F6;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.4);
  --shadow-gold: 0 0 24px rgba(212,160,23,0.25);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --font-display: 'Georgia', 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--navy-950);
  color: var(--slate-200);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--gold-400); text-decoration: none; }
a:hover { color: var(--gold-300); }

/* ==========================================================================
   LOGO MARK
   ========================================================================== */
.cp-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.cp-logo-mark {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  box-shadow: 0 4px 12px rgba(212,160,23,0.3), inset 0 1px 0 rgba(255,255,255,0.25);
  flex-shrink: 0;
}
.cp-logo-mark::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px solid var(--navy-950);
  border-radius: 4px;
}
.cp-logo-mark::after {
  content: "✓";
  position: relative;
  color: var(--navy-950);
  font-weight: 900;
  font-size: 18px;
  line-height: 1;
  z-index: 1;
  font-family: var(--font-body);
}
.cp-logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.5px;
  color: var(--slate-200);
}
.cp-logo-text .accent { color: var(--gold-400); }

/* Large variant for landing */
.cp-logo-xl .cp-logo-mark { width: 72px; height: 72px; border-radius: 14px; }
.cp-logo-xl .cp-logo-mark::before { inset: 9px; border-width: 3px; border-radius: 7px; }
.cp-logo-xl .cp-logo-mark::after { font-size: 36px; }
.cp-logo-xl .cp-logo-text { font-size: 38px; }

/* ==========================================================================
   LANDING PAGE
   ========================================================================== */
body.landing {
  background:
    radial-gradient(ellipse at top, rgba(212,160,23,0.08), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(59,107,176,0.1), transparent 60%),
    var(--navy-950);
}

.landing-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 60px 24px 80px;
}

.landing-header {
  display: flex; justify-content: center; margin-bottom: 56px;
}

.hero {
  text-align: center;
  margin-bottom: 56px;
}
.hero-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--gold-400);
  text-transform: uppercase;
  padding: 6px 14px;
  border: 1px solid rgba(212,160,23,0.3);
  border-radius: 20px;
  margin-bottom: 24px;
  background: rgba(212,160,23,0.05);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 56px);
  margin: 0 0 16px;
  line-height: 1.1;
  letter-spacing: -1px;
  color: var(--slate-200);
}
.hero h1 .accent {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-style: italic;
}
.hero-sub {
  font-size: 18px;
  color: var(--slate-400);
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.6;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 56px;
}
.role-card {
  display: block;
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  border: 1px solid rgba(212,160,23,0.15);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}
.role-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold-400), var(--gold-600));
  opacity: 0; transition: opacity 0.25s;
}
.role-card:hover {
  transform: translateY(-4px);
  border-color: rgba(212,160,23,0.4);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(212,160,23,0.15);
}
.role-card:hover::before { opacity: 1; }
.role-icon-wrap {
  width: 48px; height: 48px;
  background: rgba(212,160,23,0.1);
  border: 1px solid rgba(212,160,23,0.25);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  color: var(--gold-400);
}
.role-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-family: var(--font-display);
  color: var(--slate-200);
}
.role-card .role-desc {
  margin: 0 0 18px;
  color: var(--slate-400);
  font-size: 13px;
  line-height: 1.55;
}
.role-cta {
  color: var(--gold-400);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.trust-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  padding: 24px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
}
.trust-item {
  display: flex; align-items: center; gap: 12px;
}
.trust-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: rgba(212,160,23,0.08);
  border: 1px solid rgba(212,160,23,0.2);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-400);
  flex-shrink: 0;
}
.trust-text { font-size: 13px; color: var(--slate-300); line-height: 1.4; }
.trust-text strong { color: var(--slate-200); display: block; font-size: 14px; }

.footer-note {
  text-align: center;
  padding-top: 28px;
  border-top: 1px solid rgba(255,255,255,0.08);
  color: var(--slate-400);
  font-size: 13px;
}
.footer-note p { margin: 4px 0; }
.muted { color: rgba(148,163,184,0.6); font-size: 12px; }

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.manager-shell, .admin-shell { max-width: 100%; }
.admin-shell { background: var(--navy-950); }

.app-header {
  background: var(--navy-900);
  border-bottom: 1px solid rgba(212,160,23,0.15);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky; top: 0; z-index: 100;
}
.app-header .header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-header .header-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header .header-title .accent { color: var(--gold-400); }
.app-header .back {
  color: var(--slate-400);
  font-size: 14px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: 4px;
}
.app-header .back:hover { background: rgba(255,255,255,0.05); color: var(--slate-200); }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 4px 10px; border-radius: 20px;
  font-weight: 600; letter-spacing: 0.3px;
  text-transform: uppercase;
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.status-online {
  background: rgba(16,185,129,0.12); color: var(--success);
  border: 1px solid rgba(16,185,129,0.25);
}
.status-online .dot { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-offline {
  background: rgba(245,158,11,0.12); color: var(--warning);
  border: 1px solid rgba(245,158,11,0.3);
}
.status-offline .dot { background: var(--warning); }

.app-content { flex: 1; padding: 20px; }
.admin-shell .app-content { padding: 24px 32px; }

/* ==========================================================================
   FORMS & BUTTONS
   ========================================================================== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-300);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-input, .form-select {
  width: 100%;
  padding: 13px 16px;
  background: var(--navy-900);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  color: var(--slate-200);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.15s;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(212,160,23,0.15);
}
.form-input::placeholder { color: rgba(148,163,184,0.5); }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%; padding: 15px 20px;
  border: 1px solid var(--gold-600);
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  color: var(--navy-950);
  font-weight: 700; font-size: 15px;
  letter-spacing: 0.3px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(212,160,23,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(212,160,23,0.4); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%; padding: 13px 20px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: var(--slate-200);
  font-weight: 600; font-size: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.2); }

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #B91C1C);
  color: white;
  border-color: var(--danger);
  box-shadow: 0 4px 14px rgba(220,38,38,0.3);
}

.btn-small {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--gold-500);
  color: var(--navy-950);
  border: none;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  width: auto;
}
.btn-small:hover { background: var(--gold-400); }
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--slate-200);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); }

/* ==========================================================================
   OFFICER LOGIN & HOME
   ========================================================================== */
.login-screen {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 75vh; padding: 8px;
}
.login-brand { display: flex; flex-direction: column; align-items: center; margin-bottom: 32px; }
.login-brand .cp-logo-text { font-size: 24px; margin-top: 10px; }
.login-screen h2 {
  font-family: var(--font-display);
  font-size: 26px;
  margin-bottom: 6px;
  text-align: center;
}
.login-screen .hint {
  color: var(--slate-400);
  margin-bottom: 32px;
  text-align: center;
  font-size: 14px;
}

.welcome-banner {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700));
  border: 1px solid rgba(212,160,23,0.2);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.welcome-banner::before {
  content: "";
  position: absolute; top: 0; right: -20px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(212,160,23,0.15), transparent 70%);
  pointer-events: none;
}
.welcome-banner .greeting {
  color: var(--gold-400); font-size: 11px;
  font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase;
}
.welcome-banner .officer-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  margin-top: 4px;
}
.welcome-banner .badge-meta {
  color: var(--slate-400);
  font-size: 13px;
  margin-top: 4px;
  font-family: ui-monospace, 'SF Mono', monospace;
}

.stat-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 18px;
}
.stat-card {
  background: var(--navy-900);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 16px;
}
.stat-label {
  color: var(--slate-400);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.stat-value {
  font-size: 30px;
  font-weight: 700;
  margin-top: 4px;
  font-family: var(--font-display);
  color: var(--slate-200);
}
.stat-pending { color: var(--warning); }
.stat-synced { color: var(--success); }

.scan-button {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 100%; padding: 38px 20px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  border: 1px solid var(--gold-600);
  border-radius: var(--radius-xl);
  color: var(--navy-950);
  cursor: pointer;
  margin-bottom: 18px;
  box-shadow: 0 12px 32px rgba(212,160,23,0.35), inset 0 1px 0 rgba(255,255,255,0.3);
  font-family: inherit;
  transition: all 0.15s;
}
.scan-button:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(212,160,23,0.45); }
.scan-button:active { transform: scale(0.98); }
.scan-button .scan-icon-wrap {
  width: 56px; height: 56px;
  background: var(--navy-950);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-400);
  margin-bottom: 12px;
}
.scan-button .scan-label {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-family: var(--font-display);
}
.scan-button .scan-sub {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 4px;
  font-weight: 600;
}

.action-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 8px;
}
.action-card {
  background: var(--navy-900);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  color: var(--slate-200);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}
.action-card:hover { border-color: rgba(212,160,23,0.3); }
.action-card .action-icon {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  margin: 0 auto 8px;
  background: rgba(212,160,23,0.1);
  border-radius: 8px;
  color: var(--gold-400);
}
.action-card:active { transform: scale(0.97); }

.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 28px 0 12px;
}

.log-list { display: flex; flex-direction: column; gap: 8px; }
.log-item {
  background: var(--navy-900);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
}
.log-item.unsynced { border-left: 3px solid var(--warning); }
.log-item.synced { border-left: 3px solid var(--success); }
.log-item .li-icon-wrap {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.log-item.synced .li-icon-wrap { background: rgba(16,185,129,0.12); color: var(--success); }
.log-item.unsynced .li-icon-wrap { background: rgba(245,158,11,0.12); color: var(--warning); }
.log-item.issue .li-icon-wrap { background: rgba(220,38,38,0.15); color: var(--danger); }
.log-item .li-body { flex: 1; min-width: 0; }
.log-item .li-loc { font-weight: 600; font-size: 14px; }
.log-item .li-meta { font-size: 12px; color: var(--slate-400); margin-top: 2px; }
.log-item .li-status {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.log-item.unsynced .li-status { background: rgba(245,158,11,0.12); color: var(--warning); }
.log-item.synced .li-status { background: rgba(16,185,129,0.12); color: var(--success); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--slate-400);
  background: var(--navy-900);
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
}
.empty-state .empty-icon {
  width: 48px; height: 48px;
  margin: 0 auto 12px;
  background: rgba(212,160,23,0.08);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-400);
}
.empty-state .empty-msg { font-size: 14px; }

/* ==========================================================================
   SCANNER
   ========================================================================== */
.scanner-screen {
  position: fixed; inset: 0;
  background: #000; z-index: 200;
  display: flex; flex-direction: column;
}
.scanner-header {
  padding: 14px 18px;
  background: rgba(10,22,40,0.95);
  display: flex; align-items: center; justify-content: space-between;
  color: white;
  border-bottom: 1px solid rgba(212,160,23,0.2);
}
.scanner-header span { font-weight: 600; font-size: 14px; }
.scanner-header .close-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
}
#qr-reader { flex: 1; background: #000; }
#qr-reader video { object-fit: cover !important; }
.scanner-hint {
  padding: 18px;
  text-align: center;
  background: rgba(10,22,40,0.95);
  border-top: 1px solid rgba(212,160,23,0.2);
}
.scanner-hint p { margin: 4px 0; font-size: 13px; color: var(--slate-300); }
.scanner-hint p strong { color: var(--gold-400); }

/* ==========================================================================
   MODAL & TOAST
   ========================================================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,22,40,0.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; padding: 20px;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--navy-800);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 440px;
  width: 100%;
  border: 1px solid rgba(212,160,23,0.2);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-family: var(--font-display);
  color: var(--slate-200);
}
.modal .modal-sub {
  color: var(--slate-300);
  margin-bottom: 18px;
  font-size: 14px;
  line-height: 1.5;
}
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions button { flex: 1; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-800);
  color: var(--slate-200);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  z-index: 400;
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.3s ease;
  max-width: calc(100% - 40px);
}
.toast-success { border-color: rgba(16,185,129,0.4); }
.toast-success .toast-icon { color: var(--success); }
.toast-error { border-color: rgba(220,38,38,0.4); }
.toast-error .toast-icon { color: var(--danger); }
.toast-info { border-color: rgba(212,160,23,0.4); }
.toast-info .toast-icon { color: var(--gold-400); }
.toast-icon { font-weight: 800; font-size: 16px; }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================================================
   MANAGER / ADMIN — DATA UI
   ========================================================================== */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 24px; flex-wrap: wrap; gap: 16px;
}
.page-title { font-family: var(--font-display); font-size: 28px; margin: 0; color: var(--slate-200); }
.page-subtitle { color: var(--slate-400); font-size: 14px; margin: 4px 0 0; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.dash-stat {
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.dash-stat::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gold-500);
  opacity: 0.5;
}
.dash-stat.danger::before  { background: var(--danger); }
.dash-stat.warning::before { background: var(--warning); }
.dash-stat.success::before { background: var(--success); }
.dash-stat.info::before    { background: #818CF8; }  /* violet for "Never Scanned" tier */

/* Clickable KPI cards (Checkpoints view) */
.clickable-kpis .dash-stat {
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.clickable-kpis .dash-stat:hover {
  transform: translateY(-2px);
  border-color: rgba(212,160,23,0.3);
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.clickable-kpis .dash-stat.filter-active {
  border-color: var(--gold-500);
  box-shadow: 0 0 0 1px var(--gold-500), 0 6px 18px rgba(212,160,23,0.2);
}
.clickable-kpis .dash-stat.filter-active::after {
  content: "✓ filtering";
  position: absolute;
  top: 10px; right: 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--gold-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(212,160,23,0.12);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(212,160,23,0.3);
}

/* Sortable column headers */
.data-table th.sortable-th {
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
}
.data-table th.sortable-th:hover {
  background: rgba(212,160,23,0.06);
  color: var(--gold-300);
}
.dash-stat .label {
  color: var(--slate-400);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.dash-stat .value {
  font-size: 36px;
  font-weight: 700;
  font-family: var(--font-display);
  margin-top: 8px;
  line-height: 1;
}
.dash-stat .sub { color: var(--slate-400); font-size: 12px; margin-top: 6px; }
.dash-stat .trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.dash-stat .trend.up { color: var(--success); }
.dash-stat .trend.down { color: var(--danger); }

.controls-bar {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 18px; align-items: center;
}
.controls-bar input, .controls-bar select {
  background: var(--navy-900);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--slate-200);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
}
.controls-bar input { flex: 1; min-width: 200px; }
.controls-bar input:focus, .controls-bar select:focus {
  outline: none; border-color: var(--gold-500);
}

.panel {
  background: var(--navy-900);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 18px;
}
.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.panel-title {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0;
  color: var(--slate-200);
}
.panel-sub { font-size: 12px; color: var(--slate-400); }

.data-table {
  width: 100%; border-collapse: collapse;
  background: var(--navy-900);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.data-table th, .data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}
.data-table th {
  background: var(--navy-950);
  color: var(--slate-400);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(212,160,23,0.03); }
.data-table td strong { color: var(--slate-200); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-issue   { background: rgba(220,38,38,0.15); color: #FCA5A5; }
.badge-ok      { background: rgba(16,185,129,0.12); color: #6EE7B7; }
.badge-warning { background: rgba(245,158,11,0.12); color: #FCD34D; }
.badge-info    { background: rgba(212,160,23,0.12); color: var(--gold-300); }
.badge-violet  { background: rgba(129,140,248,0.15); color: #A5B4FC; }
.badge-neutral { background: rgba(148,163,184,0.12); color: var(--slate-300); }

.table-wrap { overflow-x: auto; }
.table-wrap.scrollable {
  max-height: 480px;
  overflow-y: auto;
  border-radius: var(--radius-md);
}
.table-wrap.scrollable .data-table thead th {
  position: sticky; top: 0; z-index: 2;
}
.show-more-bar {
  text-align: center;
  padding: 10px;
  font-size: 12px;
  color: var(--slate-400);
  border-top: 1px solid rgba(255,255,255,0.04);
}
.show-more-bar button {
  background: transparent;
  color: var(--gold-400);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  font-size: 13px;
}
.show-more-bar button:hover { color: var(--gold-300); text-decoration: underline; }

/* ==========================================================================
   ADMIN PORTAL LAYOUT
   ========================================================================== */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.admin-sidebar {
  background: var(--navy-900);
  border-right: 1px solid rgba(212,160,23,0.1);
  padding: 20px 0;
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
}
.admin-sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 16px;
}
.admin-sidebar-header .cp-logo-text { font-size: 18px; }
.admin-sidebar-header .role-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold-400);
  text-transform: uppercase;
  margin-top: 6px;
  padding: 2px 8px;
  background: rgba(212,160,23,0.1);
  border-radius: 4px;
  border: 1px solid rgba(212,160,23,0.25);
}

.admin-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.admin-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--slate-300);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.12s;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.admin-nav-item:hover { background: rgba(255,255,255,0.04); color: var(--slate-200); }
.admin-nav-item.active {
  background: rgba(212,160,23,0.1);
  color: var(--gold-300);
  border-left: 3px solid var(--gold-500);
  padding-left: 11px;
}
.admin-nav-item .nav-icon { display: flex; align-items: center; }
.admin-nav-section {
  font-size: 10px;
  font-weight: 700;
  color: var(--slate-400);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 16px 14px 8px;
}

.admin-main {
  padding: 28px 36px;
  background: var(--navy-950);
  min-width: 0;
}

.admin-topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.admin-topbar .breadcrumb {
  font-size: 12px;
  color: var(--slate-400);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.admin-topbar h1 {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 4px 0 0;
}

.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--navy-900);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 20px;
  min-height: 280px;
}
.chart-card canvas {
  max-width: 100%;
  max-height: 320px !important;
}
.chart-card .chart-canvas-wrap {
  position: relative;
  height: 280px;
  width: 100%;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 90px repeat(24, 1fr);
  gap: 2px;
  font-size: 10px;
  color: var(--slate-400);
  max-width: 100%;
}
.heatmap-label { padding: 4px 6px; line-height: 22px; }
.heatmap-cell {
  height: 22px;          /* fixed compact row height */
  min-width: 0;
  border-radius: 2px;
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: transform 0.1s;
}
.heatmap-cell:hover { transform: scale(1.5); z-index: 5; position: relative; }
.heatmap-cell.h1 { background: rgba(212,160,23,0.2); }
.heatmap-cell.h2 { background: rgba(212,160,23,0.4); }
.heatmap-cell.h3 { background: rgba(212,160,23,0.6); }
.heatmap-cell.h4 { background: rgba(212,160,23,0.8); }
.heatmap-cell.h5 { background: var(--gold-500); }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--slate-400); margin-top: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 3px; }

/* ==========================================================================
   QR GENERATOR
   ========================================================================== */
.generator-form {
  background: var(--navy-900);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}
.generator-form h3 {
  font-family: var(--font-display);
  margin-top: 0;
  color: var(--slate-200);
}

.qr-output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.qr-card {
  background: white;
  color: var(--navy-950);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  border: 2px solid var(--navy-950);
  position: relative;
  overflow: hidden;
}
.qr-card-header {
  background: var(--navy-950);
  color: var(--gold-400);
  margin: -18px -18px 14px;
  padding: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.qr-card .qr-label {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--navy-950);
  font-family: var(--font-display);
}
.qr-card canvas, .qr-card img { max-width: 100%; height: auto; display: inline-block; }
.qr-canvas-wrap { display: flex; justify-content: center; align-items: center; min-height: 180px; }
.qr-canvas-wrap canvas, .qr-canvas-wrap img { display: block; }
.qr-card .qr-id {
  font-size: 11px;
  color: #64748B;
  margin-top: 10px;
  font-family: ui-monospace, monospace;
  letter-spacing: 1px;
}
.qr-card .qr-venue {
  font-size: 10px;
  color: #94A3B8;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.qr-card .qr-instruction {
  font-size: 11px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #CBD5E1;
  color: var(--navy-700);
  font-weight: 600;
}

.print-banner {
  background: rgba(212,160,23,0.08);
  border: 1px solid rgba(212,160,23,0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 18px;
  font-size: 14px;
  color: var(--gold-100);
  display: flex; align-items: flex-start; gap: 10px;
}
.print-banner-icon { color: var(--gold-400); flex-shrink: 0; }

/* ==========================================================================
   AUTH / LOCK SCREEN
   ========================================================================== */
.auth-screen {
  min-height: 80vh;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  border: 1px solid rgba(212,160,23,0.2);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(212,160,23,0.08);
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold-400), var(--gold-600));
}
.auth-brand {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 24px;
}
.auth-role-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gold-400);
  text-transform: uppercase;
  margin-top: 10px;
  padding: 4px 12px;
  background: rgba(212,160,23,0.1);
  border: 1px solid rgba(212,160,23,0.3);
  border-radius: 20px;
}
.auth-title {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 0 0 6px;
  text-align: center;
  color: var(--slate-200);
}
.auth-hint {
  color: var(--slate-400);
  text-align: center;
  font-size: 14px;
  margin-bottom: 24px;
}
.auth-error {
  background: rgba(220,38,38,0.1);
  border: 1px solid rgba(220,38,38,0.4);
  color: #FCA5A5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  font-weight: 500;
}
.auth-footer {
  text-align: center;
  margin-top: 16px;
}
.auth-back {
  font-size: 13px;
  color: var(--slate-400);
}
.auth-back:hover { color: var(--gold-400); }
.auth-demo-card {
  margin-top: 28px;
  padding: 14px 16px;
  background: rgba(212,160,23,0.06);
  border: 1px dashed rgba(212,160,23,0.3);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.auth-demo-card strong {
  display: block;
  color: var(--gold-300);
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.5px;
}
.demo-creds { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.demo-creds > div { color: var(--slate-300); display: flex; gap: 8px; align-items: center; }
.demo-creds > div span { color: var(--slate-400); min-width: 60px; }
.demo-creds code {
  background: var(--navy-950);
  color: var(--gold-300);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: ui-monospace, monospace;
}
.demo-note {
  color: var(--slate-400);
  font-size: 11px;
  font-style: italic;
  margin-top: 6px;
}

.session-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(212,160,23,0.08);
  border: 1px solid rgba(212,160,23,0.25);
  padding: 4px 10px 4px 8px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--slate-300);
}
.session-pill .session-name {
  font-weight: 600;
  color: var(--gold-300);
}
.session-pill .session-role {
  color: var(--slate-400);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-left: 1px solid rgba(255,255,255,0.1);
  padding-left: 8px;
  margin-left: 2px;
}
.session-pill button {
  background: transparent;
  border: none;
  color: var(--slate-400);
  cursor: pointer;
  padding: 2px 6px;
  margin-left: 2px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
}
.session-pill button:hover { color: var(--gold-300); background: rgba(255,255,255,0.04); }

.role-lock {
  position: absolute;
  top: 12px; right: 12px;
  width: 22px; height: 22px;
  background: rgba(212,160,23,0.15);
  border: 1px solid rgba(212,160,23,0.3);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-400);
}

@media print {
  body { background: white; color: black; }
  .app-header, .controls-bar, .print-banner, .btn-primary, .btn-secondary,
  .generator-form, .admin-sidebar, .admin-topbar { display: none !important; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-main { padding: 0; }
  .qr-output-grid { grid-template-columns: repeat(2, 1fr); }
  .qr-card { border: 2px solid black; page-break-inside: avoid; }
  .qr-card-header { background: black; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 768px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(212,160,23,0.1);
  }
  .admin-sidebar-header { padding-bottom: 12px; }
  .admin-nav { flex-direction: row; overflow-x: auto; padding: 0 12px; }
  .admin-nav-item { flex-shrink: 0; }
  .admin-nav-section { display: none; }
  .admin-main { padding: 20px; }
  .chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .hero h1 { font-size: 34px; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 10px 8px; }
  .app-content { padding: 16px; }
}
