/* style.css — VR Safety Training Booking System (Polished UI v2) */

:root {
  /* Brand palette — indigo / purple / cyan */
  --primary:        #6366f1;
  --primary-dark:   #4f46e5;
  --primary-darker: #4338ca;
  --primary-light:  #eef2ff;
  --primary-soft:   #e0e7ff;
  --secondary:      #06b6d4;
  --secondary-light:#cffafe;
  --accent:         #a855f7;

  --success:        #10b981;
  --success-light:  #d1fae5;
  --warning:        #f59e0b;
  --warning-light:  #fef3c7;
  --danger:         #ef4444;
  --danger-light:   #fee2e2;

  --bg:        #f8fafc;
  --surface:   #ffffff;
  --surface-2: #fafbff;
  --border:    #e5e7eb;
  --border-soft:#f1f5f9;
  --text:      #0f172a;
  --text-muted:#64748b;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  --gradient-soft:    linear-gradient(135deg, #eef2ff 0%, #ecfeff 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
  --gradient-warm:    linear-gradient(135deg, #f59e0b 0%, #f43f5e 100%);

  /* Radius / shadows */
  --radius:    16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm: 0 2px 8px rgba(15,23,42,0.06);
  --shadow:    0 4px 14px rgba(15,23,42,0.06), 0 1px 3px rgba(15,23,42,0.04);
  --shadow-md: 0 10px 30px -8px rgba(15,23,42,0.10), 0 4px 12px -4px rgba(15,23,42,0.05);
  --shadow-lg: 0 24px 50px -12px rgba(99,102,241,0.20), 0 8px 20px -8px rgba(15,23,42,0.08);
  --glow-primary: 0 8px 24px -8px rgba(99,102,241,0.5);
  --glow-success: 0 8px 24px -8px rgba(16,185,129,0.5);
}

/* ---------- Themes (template variants) ---------- */
body.theme-ocean {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-darker: #075985;
  --primary-light: #e0f2fe;
  --primary-soft: #bae6fd;
  --secondary: #14b8a6;
  --accent: #06b6d4;
  --gradient-primary: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 50%, #14b8a6 100%);
  --gradient-soft: linear-gradient(135deg, #e0f2fe 0%, #ccfbf1 100%);
  --glow-primary: 0 8px 24px -8px rgba(14, 165, 233, 0.5);
}

body.theme-sunset {
  --primary: #f97316;
  --primary-dark: #ea580c;
  --primary-darker: #9a3412;
  --primary-light: #fff7ed;
  --primary-soft: #fed7aa;
  --secondary: #ec4899;
  --accent: #a855f7;
  --gradient-primary: linear-gradient(135deg, #f97316 0%, #ec4899 50%, #a855f7 100%);
  --gradient-soft: linear-gradient(135deg, #fff7ed 0%, #fce7f3 100%);
  --glow-primary: 0 8px 24px -8px rgba(249, 115, 22, 0.5);
}

body.theme-forest {
  --primary: #10b981;
  --primary-dark: #059669;
  --primary-darker: #065f46;
  --primary-light: #ecfdf5;
  --primary-soft: #a7f3d0;
  --secondary: #14b8a6;
  --accent: #84cc16;
  --gradient-primary: linear-gradient(135deg, #10b981 0%, #14b8a6 50%, #06b6d4 100%);
  --gradient-soft: linear-gradient(135deg, #ecfdf5 0%, #ccfbf1 100%);
  --glow-primary: 0 8px 24px -8px rgba(16, 185, 129, 0.5);
}

body.theme-minimal {
  --primary: #18181b;
  --primary-dark: #09090b;
  --primary-darker: #000000;
  --primary-light: #f4f4f5;
  --primary-soft: #d4d4d8;
  --secondary: #71717a;
  --accent: #52525b;
  --gradient-primary: linear-gradient(135deg, #18181b 0%, #3f3f46 100%);
  --gradient-soft: linear-gradient(135deg, #f4f4f5 0%, #fafafa 100%);
  --glow-primary: 0 4px 12px rgba(0, 0, 0, 0.18);
  background-image: none !important;
}
body.theme-minimal .hero h1,
body.theme-minimal .checkin-code {
  -webkit-text-fill-color: var(--text);
  color: var(--text);
}

body.theme-dark {
  --primary: #818cf8;
  --primary-dark: #6366f1;
  --primary-darker: #c7d2fe;
  --primary-light: rgba(99, 102, 241, 0.18);
  --primary-soft:  rgba(99, 102, 241, 0.30);
  --secondary: #22d3ee;
  --accent: #a78bfa;
  --success: #34d399;
  --success-light: rgba(16, 185, 129, 0.18);
  --warning: #fbbf24;
  --warning-light: rgba(245, 158, 11, 0.18);
  --danger: #f87171;
  --danger-light: rgba(239, 68, 68, 0.18);
  --bg:        #0f172a;
  --surface:   #1e293b;
  --surface-2: #1a2335;
  --border:    #334155;
  --border-soft:#1e293b;
  --text:      #f1f5f9;
  --text-muted:#94a3b8;
  --gradient-primary: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #22d3ee 100%);
  --gradient-soft:    linear-gradient(135deg, rgba(129,140,248,0.18) 0%, rgba(34,211,238,0.18) 100%);
  --glow-primary: 0 8px 24px -8px rgba(129, 140, 248, 0.6);
  background-image:
    radial-gradient(at 0% 0%,   hsla(238, 78%, 60%, 0.18) 0px, transparent 50%),
    radial-gradient(at 100% 0%, hsla(192, 90%, 60%, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, hsla(270, 78%, 60%, 0.10) 0px, transparent 50%) !important;
}
body.theme-dark .header { background: rgba(15, 23, 42, 0.78); border-bottom-color: rgba(51, 65, 85, 0.5); }
body.theme-dark .badge-available { color: #6ee7b7; }
body.theme-dark .badge-warning   { color: #fcd34d; }
body.theme-dark .badge-full      { color: #fca5a5; }
body.theme-dark .status-waiting   { color: #c7d2fe; }
body.theme-dark .status-completed { color: #6ee7b7; }
body.theme-dark .status-noshow    { color: #fca5a5; }
body.theme-dark .form-field input[readonly] { background: var(--surface-2); color: var(--text); }
body.theme-dark .form-field input, body.theme-dark .form-field select { color: var(--text); }
body.theme-dark tbody tr:hover { background: rgba(99, 102, 241, 0.10); }
body.theme-dark .modal-backdrop { background: rgba(0, 0, 0, 0.65); }
body.theme-dark .modal-footer { background: var(--surface-2); }
body.theme-dark .toolbar select,
body.theme-dark .toolbar input,
body.theme-dark .lookup-bar input,
body.theme-dark .pagination-size,
body.theme-dark .template-editor textarea,
body.theme-dark .template-editor input { background: var(--surface-2); color: var(--text); border-color: var(--border); }
body.theme-dark .notif-body { background: var(--surface-2); color: var(--text); }
body.theme-dark .notif-channel { background: var(--bg); border-color: var(--border); }
body.theme-dark .checkin-code { background: var(--primary-light); }

/* Dark mode — alerts need brighter text colors on translucent bg */
body.theme-dark .alert-error   { color: #fca5a5; border-color: rgba(239,68,68,0.35); }
body.theme-dark .alert-success { color: #6ee7b7; border-color: rgba(52,211,153,0.35); }
body.theme-dark .alert-warning { color: #fcd34d; border-color: rgba(251,191,36,0.35); }
body.theme-dark .alert-info    { color: #c7d2fe; border-color: rgba(99,102,241,0.45); }

/* Dark mode — notification body needs adjusting */
body.theme-dark .notif-body { background: var(--surface-2); color: var(--text); border-color: var(--border); }
body.theme-dark .notif-channel-head code { background: var(--surface-2); color: var(--text-muted); }

/* Dark mode — login card top accent bar still gradient but soft accent ring */
body.theme-dark .login-card { box-shadow: 0 24px 50px -12px rgba(0, 0, 0, 0.6); }

/* Dark mode — summary sidebar items */
body.theme-dark .summary-list li { background: var(--surface-2); border-left-color: var(--border); }

/* Dark mode — color preset border ring contrast */
body.theme-dark .color-preset { border-color: var(--surface); }
body.theme-dark .theme-card-swatch { border-color: var(--surface); }

/* Dark mode — input placeholder readability */
body.theme-dark input::placeholder, body.theme-dark textarea::placeholder { color: var(--text-muted); opacity: 0.7; }

/* Dark mode — color picker native input */
body.theme-dark .color-custom-wrap { background: var(--surface-2); }
body.theme-dark input[type="color"] { background: var(--surface-2); }

/* Dark mode — pagination size dropdown native option visibility */
body.theme-dark select option { background: var(--surface); color: var(--text); }

/* Dark mode — option:disabled */
body.theme-dark .option:disabled { background: var(--surface-2); }

/* ---------- Layouts ---------- */

/* Compact — denser everything */
body.layout-compact .container { padding: 0 16px; }
body.layout-compact .hero { padding: 28px 0 14px; }
body.layout-compact .hero h1 { font-size: 32px; }
body.layout-compact .hero p { font-size: 14px; }
body.layout-compact .hero-badge { margin-bottom: 10px; font-size: 12px; padding: 4px 10px; }
body.layout-compact .card { padding: 18px; margin-bottom: 12px; border-radius: 12px; }
body.layout-compact .card-title { font-size: 15px; margin-bottom: 12px; gap: 10px; }
body.layout-compact .step-num { width: 28px; height: 28px; font-size: 13px; border-radius: 8px; }
body.layout-compact .stats-grid { gap: 10px; margin-bottom: 16px; }
body.layout-compact .stat-card { padding: 14px; border-radius: 12px; }
body.layout-compact .stat-value { font-size: 24px; margin-top: 2px; }
body.layout-compact .stat-label, body.layout-compact .stat-sub { font-size: 11.5px; }
body.layout-compact .tabs { gap: 6px; margin-bottom: 14px; }
body.layout-compact .tab { padding: 10px 12px; gap: 10px; border-radius: 10px; }
body.layout-compact .tab-icon { width: 36px; height: 36px; font-size: 18px; border-radius: 9px; }
body.layout-compact .tab-label { font-size: 13.5px; }
body.layout-compact .tab-count { font-size: 11.5px; }
body.layout-compact .session-card { padding: 12px 16px; margin-bottom: 6px; gap: 14px; border-radius: 12px; }
body.layout-compact .session-title { font-size: 14px; }
body.layout-compact .session-meta { font-size: 12px; }
body.layout-compact th, body.layout-compact td { padding: 8px 12px; font-size: 13px; }
body.layout-compact .toolbar { padding: 8px; gap: 6px; margin-bottom: 12px; }
body.layout-compact .toolbar select, body.layout-compact .toolbar input { padding: 6px 10px; font-size: 13px; }
body.layout-compact .btn { padding: 8px 14px; font-size: 13px; }
body.layout-compact .btn-lg { padding: 11px 22px; font-size: 14px; }
body.layout-compact .btn-sm { padding: 6px 10px; font-size: 12px; }
body.layout-compact .form-grid { gap: 10px; margin-bottom: 12px; }
body.layout-compact .form-field input, body.layout-compact .form-field select { padding: 8px 11px; font-size: 14px; }
body.layout-compact .form-field label { font-size: 12.5px; }
body.layout-compact .option { padding: 11px 12px; border-radius: 10px; gap: 2px; }
body.layout-compact .option .opt-title { font-size: 14px; }
body.layout-compact .option .opt-sub { font-size: 12px; }
body.layout-compact .pagination { padding: 8px 12px; }
body.layout-compact .lookup-bar { padding: 12px 16px; }
body.layout-compact .checkin-code { font-size: 28px; letter-spacing: 6px; padding: 16px 22px; }
body.layout-compact .confirmation-icon { width: 76px; height: 76px; font-size: 38px; }
body.layout-compact .container { max-width: 1300px; }

/* Sidebar — vertical tab nav on left for admin page (≥900px) */
@media (min-width: 900px) {
  body.layout-sidebar main#adminContent {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    align-items: start;
    max-width: 1400px;
  }
  body.layout-sidebar main#adminContent > .flex-between,
  body.layout-sidebar main#adminContent > .stats-grid {
    grid-column: 1 / -1;
  }
  body.layout-sidebar main#adminContent > .tabs {
    grid-column: 1;
    grid-template-columns: 1fr;
    grid-auto-rows: min-content;
    position: sticky;
    top: 84px;
    margin-bottom: 0;
    height: -moz-fit-content;
    height: fit-content;
    gap: 8px;
  }
  body.layout-sidebar main#adminContent > .tab-panel {
    grid-column: 2;
    grid-row: 3;
  }
  body.layout-sidebar #adminContent .tab {
    padding: 12px 14px;
    border-radius: 12px;
  }
  body.layout-sidebar #adminContent .tab-icon {
    width: 40px; height: 40px;
    font-size: 20px;
    border-radius: 10px;
  }
}

/* Booking sidebar (index.html) — sticky summary on left */
.booking-sidebar { display: none; }

@media (min-width: 900px) {
  body.layout-sidebar main#bookingMain {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    align-items: start;
    max-width: 1400px;
  }
  body.layout-sidebar main#bookingMain > .hero,
  body.layout-sidebar main#bookingMain > .lookup-bar,
  body.layout-sidebar main#bookingMain > .footer,
  body.layout-sidebar main#bookingMain > .flex {
    grid-column: 1 / -1;
  }
  body.layout-sidebar main#bookingMain > .booking-sidebar {
    display: block;
    grid-column: 1;
    grid-row: 3;
    position: sticky;
    top: 84px;
  }
  body.layout-sidebar main#bookingMain > #bookingFlow,
  body.layout-sidebar main#bookingMain > #confirmation {
    grid-column: 2;
    grid-row: 3;
  }
}

.summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.summary-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border-left: 3px solid var(--border);
  transition: all 0.2s;
}
.summary-list li.done {
  background: var(--success-light);
  border-left-color: var(--success);
}
.summary-list li.current {
  background: var(--primary-light);
  border-left-color: var(--primary);
}
.summary-step {
  width: 26px; height: 26px;
  background: var(--border);
  color: var(--text);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.summary-list li.done .summary-step {
  background: var(--success);
  color: white;
}
.summary-list li.current .summary-step {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--glow-primary);
}
.summary-text { flex: 1; min-width: 0; }
.summary-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.summary-value {
  font-weight: 600;
  font-size: 14px;
  word-wrap: break-word;
}
.summary-value.pending { color: var(--text-muted); font-weight: 500; }

/* ---------- Theme picker UI ---------- */
.theme-btn {
  position: relative;
  background: var(--gradient-primary);
  color: white;
  border: none;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  line-height: 1;
  box-shadow: var(--glow-primary);
  overflow: visible;
  isolation: isolate;
}
.theme-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 14px 30px -8px rgba(99,102,241,0.55);
}
.theme-btn:active { transform: translateY(0) scale(1.0); }

.theme-btn-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}
.theme-btn-palette {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    #6366f1 0deg,
    #8b5cf6 72deg,
    #ec4899 144deg,
    #f59e0b 216deg,
    #10b981 288deg,
    #6366f1 360deg
  );
  animation: theme-palette-spin 6s linear infinite;
}
@keyframes theme-palette-spin {
  to { transform: rotate(360deg); }
}

.theme-btn-label {
  position: relative;
  z-index: 1;
}

.theme-btn-ring {
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  border: 2px solid var(--primary);
  opacity: 0.4;
  pointer-events: none;
  animation: theme-ring-pulse 2.6s ease-out infinite;
  z-index: -1;
}
@keyframes theme-ring-pulse {
  0%   { transform: scale(0.95); opacity: 0.5; }
  70%  { opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* Mobile — icon only, circular */
@media (max-width: 480px) {
  .theme-btn { padding: 4px; gap: 0; }
  .theme-btn-label { display: none; }
  .theme-btn-icon { width: 30px; height: 30px; }
}

/* Reduced motion — stop spinning + pulsing */
@media (prefers-reduced-motion: reduce) {
  .theme-btn-palette { animation: none; }
  .theme-btn-ring { animation: none; opacity: 0.3; }
}

.theme-section-title {
  font-size: 14px;
  font-weight: 700;
  margin-top: 18px;
  margin-bottom: 10px;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.theme-section-title:first-child { margin-top: 0; }

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 10px;
}
.theme-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  font-family: inherit;
  color: var(--text);
}
.theme-card:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: var(--shadow); }
.theme-card.active {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}
.theme-card.active::after {
  content: '✓';
  position: absolute;
}
.theme-card-name { font-weight: 700; font-size: 14px; }
.theme-card-desc { font-size: 12px; color: var(--text-muted); }
.theme-card-swatches { display: flex; gap: 4px; margin-top: 8px; }
.theme-card-swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.color-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.color-preset {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}
.color-preset:hover { transform: scale(1.1); }
.color-preset.active {
  box-shadow: 0 0 0 3px var(--primary), 0 2px 6px rgba(0,0,0,0.15);
  transform: scale(1.1);
}

.color-custom-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.color-custom-wrap input[type="color"] {
  width: 36px; height: 36px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: 8px;
}

.theme-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border-soft);
  align-items: center;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Tahoma', sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(at 0% 0%,   hsla(238, 78%, 70%, 0.10) 0px, transparent 50%),
    radial-gradient(at 100% 0%, hsla(192, 90%, 70%, 0.10) 0px, transparent 50%),
    radial-gradient(at 100% 100%, hsla(270, 78%, 76%, 0.08) 0px, transparent 50%),
    radial-gradient(at 0% 100%, hsla(196, 90%, 80%, 0.06) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(12px, 2.5vw, 24px);
}

/* ---------- Header ---------- */
.header {
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
  position: sticky; top: 0; z-index: 10;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(12px, 2.5vw, 24px);
  max-width: 1200px; margin: 0 auto; gap: 12px;
  flex-wrap: wrap;
}
.logo {
  display: flex; align-items: center; gap: 12px;
  font-weight: 700; font-size: 17px;
  color: var(--text); text-decoration: none;
}
.logo-icon {
  width: 40px; height: 40px;
  background: var(--gradient-primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  font-size: 18px; font-weight: 800;
  box-shadow: var(--glow-primary);
  letter-spacing: -0.5px;
  position: relative; overflow: hidden;
}
.logo-icon::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.25), transparent 50%);
  pointer-events: none;
}
.logo-sub { font-size: 11.5px; color: var(--text-muted); font-weight: 500; display: block; letter-spacing: 0.2px; }

.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  padding: 8px 14px; border-radius: 10px;
  text-decoration: none; color: var(--text-muted);
  font-weight: 600; font-size: 14px;
  transition: all 0.2s;
}
.nav a:hover { background: var(--primary-light); color: var(--primary-dark); }
.nav a.active {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--glow-primary);
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(24px, 4vw, 48px) 0 clamp(16px, 2vw, 28px);
  text-align: center;
  animation: fadeUp 0.6s ease-out;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--primary-soft);
  color: var(--primary-darker);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: clamp(11px, 1vw + 8px, 13px);
  font-weight: 600;
  margin-bottom: clamp(10px, 1.5vw, 18px);
  box-shadow: var(--shadow-xs);
}
.hero-badge-dot {
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(16,185,129,0.15);
  animation: pulse-dot 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(16,185,129,0.15); }
  50%      { box-shadow: 0 0 0 8px rgba(16,185,129,0.08); }
}
.hero h1 {
  font-size: clamp(22px, 4.5vw + 8px, 44px);
  font-weight: 800;
  margin-bottom: clamp(8px, 1.5vw, 14px);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.hero p {
  color: var(--text-muted);
  max-width: 660px;
  margin: 0 auto;
  font-size: clamp(13px, 0.6vw + 11px, 16px);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  border: 1px solid rgba(226, 232, 240, 0.7);
  animation: fadeUp 0.5s ease-out backwards;
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}
.step-num {
  width: 32px; height: 32px;
  background: var(--gradient-primary);
  color: white;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
  flex-shrink: 0;
  box-shadow: var(--glow-primary);
  transition: all 0.3s;
}
.step-num.done {
  background: var(--gradient-success);
  box-shadow: var(--glow-success);
}
.step-num.locked {
  background: var(--border);
  color: var(--text-muted);
  box-shadow: none;
}

/* ---------- Option grid ---------- */
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 12px;
}
.option {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}
.option:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.option.selected {
  border-color: var(--primary);
  background: var(--gradient-soft);
  box-shadow: var(--glow-primary);
}
.option.selected::before {
  content: '✓';
  position: absolute;
  top: 8px; right: 10px;
  width: 22px; height: 22px;
  background: var(--gradient-primary);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.option:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--bg);
}
.option .opt-title { font-weight: 700; font-size: 15px; color: var(--text); }
.option .opt-sub   { font-size: 13px; color: var(--text-muted); }

.badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  display: inline-block;
  font-weight: 600;
  align-self: flex-start;
  margin-top: 4px;
}
.badge-available { background: var(--success-light); color: #065f46; }
.badge-warning   { background: var(--warning-light); color: #78350f; }
.badge-full      { background: var(--danger-light); color: #7f1d1d; }
.badge-closed    { background: #e5e7eb; color: #475569; }

/* ---------- Form ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-weight: 600; font-size: 13px; color: var(--text); letter-spacing: 0.1px; }
.form-field input, .form-field select {
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  background: var(--surface-2);
  width: 100%;
  transition: all 0.2s;
  color: var(--text);
}
.form-field input:focus, .form-field select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}
.form-field input[readonly] { background: var(--bg); cursor: default; }
.form-hint { font-size: 12px; color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn {
  padding: 11px 22px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  letter-spacing: 0.1px;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--glow-primary);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -8px rgba(99,102,241,0.55);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}
.btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: var(--glow-success);
}
.btn-success:hover { transform: translateY(-1px); }
.btn-warning {
  background: var(--gradient-warm);
  color: white;
  box-shadow: 0 6px 18px -6px rgba(245, 158, 11, 0.5);
}
.btn-warning:hover { transform: translateY(-1px); }
.btn-danger  {
  background: linear-gradient(135deg, #ef4444 0%, #f43f5e 100%);
  color: white;
  box-shadow: 0 6px 18px -6px rgba(239, 68, 68, 0.5);
}
.btn-danger:hover { transform: translateY(-1px); }
.btn-ghost   {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Alert ---------- */
.alert {
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid;
}
.alert-error   { background: var(--danger-light);  color: #7f1d1d; border-color: #fecaca; }
.alert-success { background: var(--success-light); color: #065f46; border-color: #a7f3d0; }
.alert-info    { background: var(--primary-light); color: var(--primary-darker); border-color: var(--primary-soft); }
.alert-warning { background: var(--warning-light); color: #78350f; border-color: #fde68a; }

/* ---------- Emp info auto-fill card ---------- */
.emp-info-card {
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.emp-info-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--success);
}
.emp-info-card .form-field input { background: var(--surface); color: var(--text); }
.emp-info-email { grid-column: 1 / -1; }

body.theme-dark .emp-info-card { border-color: rgba(52, 211, 153, 0.4); }
body.theme-dark .emp-info-header { color: #6ee7b7; }

/* ---------- Confirmation ---------- */
.confirmation { text-align: center; padding: 24px 16px; animation: fadeUp 0.6s ease-out; }
.confirmation-icon {
  width: 92px; height: 92px;
  background: var(--gradient-success);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px;
  font-size: 46px;
  box-shadow: 0 16px 40px -8px rgba(16,185,129,0.55);
  animation: pulse-success 2s ease-in-out infinite;
}
@keyframes pulse-success {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
.checkin-code {
  background: var(--gradient-soft);
  color: var(--primary-darker);
  font-family: 'Courier New', monospace;
  font-weight: 800;
  font-size: 34px;
  letter-spacing: 8px;
  padding: 20px 32px;
  border-radius: 14px;
  display: inline-block;
  margin: 18px 0;
  border: 2px dashed var(--primary);
  box-shadow: var(--shadow-sm);
}
.detail-list {
  text-align: left;
  max-width: 460px;
  margin: 20px auto;
  background: var(--bg);
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.detail-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border: none; }
.detail-row dt { color: var(--text-muted); font-size: 14px; }
.detail-row dd { font-weight: 600; text-align: right; }

/* ---------- Tabs (Card-style) ---------- */
.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.tab {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1.5px solid var(--border-soft);
  border-radius: 16px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  color: var(--text);
}
.tab::before {
  content: '';
  position: absolute;
  top: -30%; right: -30%;
  width: 100px; height: 100px;
  background: var(--gradient-primary);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s;
}
.tab:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-soft);
}
.tab:hover::before { opacity: 0.05; }
.tab.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: var(--glow-primary), 0 12px 28px -10px rgba(99,102,241,0.4);
  transform: translateY(-3px);
}
.tab.active::before { opacity: 0; }
.tab.active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15), transparent 60%);
  pointer-events: none;
}

.tab-icon {
  font-size: 26px;
  width: 50px; height: 50px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-light);
  border-radius: 14px;
  flex-shrink: 0;
  transition: all 0.25s;
}
.tab:hover .tab-icon {
  transform: scale(1.05);
}
.tab.active .tab-icon {
  background: rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
.tab-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.tab-label {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
  line-height: 1.2;
}
.tab-count {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.tab-count strong {
  font-weight: 800;
  color: var(--primary-dark);
  font-size: 14px;
}
.tab.active .tab-count { color: rgba(255, 255, 255, 0.88); }
.tab.active .tab-count strong { color: white; }

.tab-panel { display: none; animation: fadeUp 0.4s ease-out; }
.tab-panel.active { display: block; }

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, 0.7);
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--gradient-primary);
}
.stat-card.success::before { background: var(--gradient-success); }
.stat-card.warning::before { background: var(--gradient-warm); }
.stat-card.danger::before  { background: linear-gradient(180deg, #ef4444, #f43f5e); }
.stat-card::after {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: var(--gradient-primary);
  opacity: 0.05;
  border-radius: 50%;
}
.stat-card.success::after { background: var(--gradient-success); opacity: 0.06; }
.stat-card.warning::after { background: var(--gradient-warm); opacity: 0.05; }
.stat-card.danger::after  { background: linear-gradient(135deg, #ef4444, #f43f5e); opacity: 0.05; }
.stat-label { color: var(--text-muted); font-size: 13px; font-weight: 600; }
.stat-value { font-size: 34px; font-weight: 800; margin-top: 4px; line-height: 1.1; letter-spacing: -1px; color: var(--text); }
.stat-sub   { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Table ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, 0.7);
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border-soft); }
th {
  background: var(--surface-2);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--primary-light); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- Status ---------- */
.status {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-waiting   { background: var(--primary-light); color: var(--primary-darker); }
.status-completed { background: var(--success-light); color: #065f46; }
.status-noshow    { background: var(--danger-light);  color: #7f1d1d; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  padding: 24px 16px;
  overflow-y: auto;
}
.modal-backdrop.active { display: flex; animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  margin: auto;
  border: 1px solid var(--border-soft);
  animation: scaleUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
.modal-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-title { font-size: 19px; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 26px;
  cursor: pointer; color: var(--text-muted);
  line-height: 1; padding: 4px 8px;
  border-radius: 8px;
  transition: all 0.2s;
}
.modal-close:hover { color: var(--text); background: var(--bg); }
.modal-body   { padding: 24px 28px; }
.modal-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border-soft);
  display: flex; gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  border: 1px solid rgba(226, 232, 240, 0.7);
}
.toolbar-grow { flex: 1; }
.toolbar select, .toolbar input[type="date"], .toolbar input[type="text"] {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s;
}
.toolbar select:focus, .toolbar input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ---------- Session card ---------- */
.session-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 22px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--primary);
  transition: all 0.2s;
}
.session-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.session-card.full   { border-left-color: var(--danger); }
.session-card.closed { border-left-color: #94a3b8; opacity: 0.78; }
.session-info { flex: 1; min-width: 240px; }
.session-title { font-weight: 700; font-size: 15px; color: var(--text); }
.session-meta  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.session-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Capacity bar */
.capacity {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  min-width: 170px;
}
.capacity-text { font-weight: 700; white-space: nowrap; }
.capacity-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  min-width: 60px;
}
.capacity-fill {
  height: 100%;
  background: var(--gradient-success);
  transition: width 0.4s ease-out;
  border-radius: 999px;
}
.capacity-fill.warning { background: var(--gradient-warm); }
.capacity-fill.full    { background: linear-gradient(90deg, #ef4444, #f43f5e); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.empty-icon { font-size: 56px; opacity: 0.35; margin-bottom: 8px; }

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-top: 10px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-soft);
}
.pagination-info { font-size: 13px; color: var(--text-muted); }
.pagination-controls { display: flex; align-items: center; gap: 6px; }
.pagination-page {
  font-size: 14px;
  padding: 0 12px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--text);
}
.pagination-size {
  padding: 7px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

/* ---------- Quick lookup ---------- */
.lookup-bar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid rgba(226, 232, 240, 0.7);
}
.lookup-bar input {
  flex: 1; min-width: 160px;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  background: var(--surface-2);
  transition: all 0.2s;
}
.lookup-bar input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ---------- Notifications cards / channels ---------- */
.notif-card {
  background: var(--gradient-soft);
  border: 1px solid var(--primary-soft);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.notif-card-title {
  font-weight: 700;
  color: var(--primary-darker);
  margin-bottom: 10px;
  font-size: 14px;
}
.notif-details summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  user-select: none;
  font-weight: 600;
}
.notif-details summary:hover { color: var(--primary); }
.notif-details[open] summary { margin-bottom: 8px; }
.notif-channel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
}
.notif-channel-head {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.notif-channel-head code {
  font-weight: 500;
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
}
.notif-subject { font-size: 13px; font-style: italic; color: var(--text-muted); margin-bottom: 4px; }
.notif-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Sarabun', sans-serif;
  font-size: 13px;
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 8px;
  margin: 0;
  line-height: 1.55;
  border: 1px solid var(--border-soft);
}

/* Notification channel toggle */
.channel-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
.channel-toggle:hover { border-color: var(--primary); background: var(--surface); }
.channel-toggle input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); }
.channel-toggle.on {
  border-color: var(--primary);
  background: var(--gradient-soft);
  box-shadow: var(--shadow-xs);
}
.channel-toggle .ch-icon { font-size: 22px; }

.template-editor {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 14px;
  margin-top: 8px;
  border: 1px solid var(--border-soft);
}
.template-editor label { font-weight: 600; font-size: 13px; margin-top: 10px; display: block; color: var(--text); }
.template-editor textarea {
  width: 100%;
  min-height: 64px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Sarabun', sans-serif;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  margin-top: 4px;
  transition: all 0.2s;
}
.template-editor textarea:focus,
.template-editor input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.template-vars {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
}
.template-vars code {
  background: var(--surface);
  color: var(--text);
  padding: 2px 7px;
  border-radius: 5px;
  margin-right: 4px;
  font-size: 11px;
  border: 1px solid var(--border-soft);
}

/* ---------- Login ---------- */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 32px 24px;
  animation: fadeUp 0.5s ease-out;
}
.login-card {
  max-width: 440px;
  width: 100%;
  margin: 0;
  padding: 36px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(226, 232, 240, 0.7);
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--gradient-primary);
}
.login-card .logo-icon {
  width: 64px;
  height: 64px;
  font-size: 26px;
  border-radius: 16px;
}
#adminBadge.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding: 4px 6px 4px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}
#adminBadge .admin-badge-icon { font-size: 16px; }
#adminBadge.hidden { display: none; }

/* ---------- Footer ---------- */
.footer {
  margin-top: 72px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- Responsive ---------- */

/* Ultrawide (≥1600px) — let admin sidebar use more space */
@media (min-width: 1600px) {
  .container { max-width: 1320px; }
  body.layout-sidebar main.container,
  body.layout-compact .container { max-width: 1500px; }
}

/* 4K+ (≥2200px) — modest expansion */
@media (min-width: 2200px) {
  body { font-size: 16px; }
  .container { max-width: 1440px; }
}

/* Tablet (≤1024px) */
@media (max-width: 1024px) {
  .stat-value { font-size: 30px; }
  .tabs { gap: 10px; }
}

/* Tablet portrait & large mobile (≤768px) */
@media (max-width: 768px) {
  /* Header — hide sub-label, compact nav */
  .logo-sub { display: none; }
  .logo { font-size: 16px; }
  .nav a { padding: 7px 11px; font-size: 13px; }
  #adminBadge.admin-badge { padding: 3px 4px 3px 10px; font-size: 13px; }

  /* Hero — tighter */
  .hero h1 br { display: none; }

  /* Cards — tighter padding */
  .card { padding: 20px; }
  .card-title { font-size: 16px; margin-bottom: 14px; }

  /* Tab cards — more compact */
  .tabs { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 18px; }
  .tab { padding: 12px 14px; gap: 10px; border-radius: 12px; }
  .tab-icon { width: 42px; height: 42px; font-size: 22px; border-radius: 11px; }
  .tab-label { font-size: 14px; }
  .tab-count { font-size: 12px; }

  /* Stat cards more compact */
  .stat-card { padding: 18px; }
  .stat-value { font-size: 28px; }

  /* Form grid stacks single column */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Toolbar wraps neatly */
  .toolbar { padding: 10px; gap: 6px; }
  .toolbar select, .toolbar input[type="date"], .toolbar input[type="text"] {
    flex: 1 1 130px; min-width: 0;
  }

  /* Session card stacks vertically */
  .session-card { flex-direction: column; align-items: stretch; padding: 14px 16px; gap: 12px; }
  .session-info { width: 100%; min-width: 0; }
  .capacity { width: 100%; min-width: 0; }
  .session-actions { width: 100%; justify-content: flex-start; }

  /* Modal — near full-width */
  .modal { border-radius: var(--radius); }
  .modal-header, .modal-body, .modal-footer { padding-left: 18px; padding-right: 18px; }
  .modal-header { padding-top: 16px; padding-bottom: 16px; }
  .modal-body { padding-top: 18px; padding-bottom: 18px; }

  /* Tables more compact */
  th, td { padding: 10px 12px; font-size: 13px; }

  /* Admin dashboard header */
  .flex-between h1 { font-size: 22px !important; }
}

/* Mobile (≤640px) */
@media (max-width: 640px) {
  body { font-size: 14px; }
  .header-inner { padding: 10px 14px; gap: 8px; }

  /* Smaller logo */
  .logo { font-size: 14px; }
  .logo-icon { width: 36px; height: 36px; font-size: 15px; border-radius: 10px; }

  /* Hero handled via clamp() already */
  .hero h1 { letter-spacing: -0.6px; }

  /* Cards tighter */
  .card { padding: 18px; border-radius: 14px; }
  .card-title { font-size: 15px; gap: 10px; }
  .step-num { width: 28px; height: 28px; font-size: 13px; border-radius: 8px; }

  /* Options — auto-fit smaller min */
  .option-grid { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 8px; }
  .option { padding: 12px; border-radius: 10px; }
  .option .opt-title { font-size: 14px; }
  .option .opt-sub { font-size: 12px; }

  /* Tabs — flexible 2 per row, drops to 1 on tiny */
  .tabs { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 8px; }
  .tab { padding: 10px 12px; gap: 8px; }
  .tab-icon { width: 36px; height: 36px; font-size: 20px; }
  .tab-label { font-size: 13px; }
  .tab-count { font-size: 11px; }

  /* Stat cards */
  .stat-card { padding: 16px; border-radius: 12px; }
  .stat-value { font-size: 24px; }
  .stat-label { font-size: 12px; }
  .stat-sub { font-size: 11px; }

  /* Confirmation */
  .confirmation { padding: 16px 4px; }
  .confirmation-icon { width: 72px; height: 72px; font-size: 36px; }
  .checkin-code {
    font-size: 22px; letter-spacing: 4px; padding: 14px 18px;
    border-radius: 12px;
  }
  .detail-list { padding: 14px; }
  .detail-row { flex-direction: column; align-items: flex-start; padding: 6px 0; gap: 2px; }
  .detail-row dd { text-align: left; font-size: 14px; }

  /* Forms */
  .form-field input, .form-field select { padding: 10px 12px; font-size: 14px; }

  /* Buttons */
  .btn { padding: 10px 18px; font-size: 13.5px; }
  .btn-lg { padding: 12px 22px; font-size: 15px; }
  .btn-sm { padding: 6px 12px; font-size: 12.5px; }

  /* Lookup bar */
  .lookup-bar { padding: 14px; gap: 8px; }
  .lookup-bar input { flex: 1 1 100%; }

  /* Pagination — stack vertically */
  .pagination { padding: 10px 12px; gap: 8px; flex-direction: column; align-items: stretch; }
  .pagination-info { text-align: center; font-size: 12px; }
  .pagination-controls { justify-content: center; flex-wrap: wrap; }
  .pagination-page { font-size: 13px; padding: 0 6px; }
  .pagination-size { font-size: 12px; padding: 6px 10px; }

  /* Modal */
  .modal-backdrop { padding: 12px 8px; }
  .modal-header, .modal-body, .modal-footer { padding-left: 14px; padding-right: 14px; }

  /* Channel toggles */
  .channel-toggle { padding: 10px 14px; font-size: 14px; }

  /* Notification cards */
  .notif-card { padding: 12px 14px; }
  .notif-body { font-size: 12px; padding: 8px 10px; }
  .notif-channel { padding: 10px 12px; }

  /* Template editor */
  .template-editor { padding: 12px; }
  .template-editor textarea { font-size: 12px; }
  .template-vars { font-size: 11px; padding: 8px 10px; }

  /* Login */
  .login-container { padding: 20px 12px; min-height: calc(100vh - 60px); }
  .login-card { padding: 24px; border-radius: 16px; }
  .login-card .logo-icon { width: 52px; height: 52px; font-size: 22px; }

  /* Empty states */
  .empty { padding: 40px 16px; }
  .empty-icon { font-size: 44px; }

  /* Footer */
  .footer { margin-top: 48px; padding: 18px; font-size: 12px; }

  /* Admin dashboard header — stack */
  .flex-between { flex-direction: column; align-items: stretch; }
  .flex-between > div:last-child { display: flex; flex-wrap: wrap; gap: 6px; }
}

/* Tiny mobile (≤380px) */
@media (max-width: 380px) {
  .hero-badge { font-size: 11px; }
  .checkin-code { font-size: 18px; letter-spacing: 3px; padding: 12px 14px; }
  .tab { padding: 12px 14px; }
  .stat-value { font-size: 22px; }
  .nav a { padding: 6px 8px; font-size: 12px; }
  .theme-btn { padding: 5px 9px; font-size: 13px; }
  th, td { padding: 8px 10px; font-size: 12px; }
  .logo-icon { width: 32px; height: 32px; font-size: 14px; }
  .confirmation-icon { width: 64px; height: 64px; font-size: 32px; }
  .hero p { font-size: 12.5px; }
}

/* Print — flatten for paper */
@media print {
  .header, .nav, .theme-btn, .footer, .pagination,
  .toolbar, .modal-backdrop, .session-actions,
  #resetDataBtn, #clearAllBtn, #exportAllBtn,
  .btn { display: none !important; }
  body { background: white !important; color: black !important; }
  .card, .session-card, .table-wrap { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* Touch-friendly tweaks (any size) */
@media (hover: none) {
  .btn:hover, .tab:hover, .option:hover, .session-card:hover, .stat-card:hover {
    transform: none !important;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
