/* =========================================================
   QUEUE — LIGHT HEALTHCARE DESIGN SYSTEM
   ========================================================= */

:root {
  /* Canvas & Surfaces */
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #f8fafc;

  /* Typography Colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Primary Clinical Brand */
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --primary-light: #eff6ff;

  /* Healthcare Teal Accent */
  --teal: #0d9488;
  --teal-light: #f0fdfa;

  /* Restrained Semantic Status */
  --success: #059669;
  --success-light: #ecfdf5;

  --warning: #d97706;
  --warning-light: #fffbeb;

  --danger: #dc2626;
  --danger-light: #fef2f2;

  /* Borders */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-medium: #cbd5e1;

  /* Layered 21st.dev Elevation */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
  --shadow-xl: 0 20px 32px -6px rgba(15, 23, 42, 0.08), 0 8px 12px -4px rgba(15, 23, 42, 0.03);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Layout & System Bridges */
  --bg-foundation: var(--bg-primary);
  --bg-surface-1: var(--surface);
  --bg-surface-2: var(--bg-secondary);
  --bg-surface-3: #e2e8f0;
  --bg-surface-hover: var(--surface-hover);

  --border-subtle: var(--border-light);
  --border-medium: var(--border);
  --border-bright: #cbd5e1;
  --border-focus: var(--primary);

  --accent-cyan: var(--primary);
  --accent-cyan-glow: var(--primary-light);
  --accent-emerald: var(--success);
  --accent-emerald-glow: var(--success-light);
  --accent-blue: var(--primary);
  --accent-amber: var(--warning);
  --accent-amber-glow: var(--warning-light);
  --accent-red: var(--danger);
  --accent-red-glow: var(--danger-light);
  --accent-purple: #7c3aed;
  --accent-purple-glow: #f5f3ff;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Roboto Mono', monospace;

  --header-height: 68px;
  --max-width: 1240px;
  --max-width-content: 880px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =========================================================
   GLOBAL RESET & FOUNDATIONS
   ========================================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  text-shadow: none;
}

html {
  scroll-behavior: smooth;
  font-size: 15px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  padding-bottom: 76px; /* Space for simulation dock */
}

button,
input,
select,
textarea {
  font-family: inherit;
}

button {
  cursor: pointer;
}

/* =========================================================
   REMOVE "AI DASHBOARD" VISUAL LANGUAGE
   ========================================================= */

body,
main,
section {
  background-image: none !important;
}

.glow,
.neon,
.glow-effect {
  box-shadow: none !important;
  filter: none !important;
}

/* Typography Utilities */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.highlight-cyan { color: var(--primary); }
.highlight-emerald { color: var(--success); }
.highlight-amber { color: var(--warning); }
.highlight-white { color: var(--text-primary); }
.highlight-slate { color: var(--text-secondary); }

/* =========================================================
   HEADER
   ========================================================= */

header.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border) !important;
  box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.header-container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-symbol {
  width: 34px;
  height: 34px;
  background: var(--primary-light);
  border: 1px solid rgba(25, 118, 210, 0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.brand-text-col {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
}

.nav-link {
  color: var(--text-secondary) !important;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: var(--primary) !important;
}

.nav-link.active {
  color: var(--primary) !important;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.system-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--success);
  background: var(--success-light);
  border: 1px solid rgba(5, 150, 105, 0.2);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.system-status-indicator .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
}

/* =========================================================
   PAGE CONTAINER & TYPOGRAPHY HIERARCHY
   ========================================================= */

.page-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 36px 24px 60px;
  width: 100%;
}

.max-w-content {
  max-width: var(--max-width-content);
}

.page-header {
  margin-bottom: 28px;
}

.page-breadcrumb {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.page-breadcrumb a:hover {
  color: var(--primary);
}

.crumb-sep {
  color: var(--border-medium);
}

.page-title {
  font-size: 2rem;
  font-weight: 750;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 680px;
  line-height: 1.6;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary) !important;
  color: white !important;
  border: 1px solid var(--primary-dark) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px 0 rgba(15, 23, 42, 0.08);
}

.btn-primary:hover {
  background: var(--primary-dark) !important;
  border-color: #172554 !important;
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), var(--shadow-sm);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  background: var(--surface) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--surface-hover) !important;
  border-color: var(--border-medium) !important;
  color: var(--text-primary) !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:active {
  transform: translateY(0);
}

.btn-emerald {
  background: var(--success) !important;
  color: white !important;
  border: 1px solid #047857 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(15, 23, 42, 0.08);
}

.btn-emerald:hover {
  background: #047857 !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-danger {
  background: var(--danger) !important;
  color: white !important;
  border: 1px solid #b91c1c !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(15, 23, 42, 0.08);
}

.btn-danger:hover {
  background: #b91c1c !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-outline-danger {
  background: white !important;
  color: var(--danger) !important;
  border: 1px solid #fecaca !important;
  box-shadow: var(--shadow-xs);
}

.btn-outline-danger:hover {
  background: var(--danger-light) !important;
  border-color: #f87171 !important;
  transform: translateY(-1px);
}

.btn-sm {
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.btn-xs {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
}

.btn-lg {
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: var(--radius-md);
}

.btn-full {
  width: 100%;
}

/* =========================================================
   INPUTS & FORMS
   ========================================================= */

input,
select,
textarea {
  background: var(--surface) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  padding: 10px 14px;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12) !important;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

/* =========================================================
   CARDS & PANELS
   ========================================================= */

.card,
.panel,
.dashboard-card,
.hospital-card,
.queue-card,
.feature-card,
.how-card,
.live-kpi-card,
.department-card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  color: var(--text-primary) !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.card:hover,
.hospital-card:hover,
.queue-card:hover,
.department-card:hover {
  box-shadow: var(--shadow-md) !important;
  border-color: var(--border-medium) !important;
  transform: translateY(-1px);
}

/* =========================================================
   BIG QUEUE NUMBERS & STATS
   ========================================================= */

.queue-number,
.patient-count,
.big-number,
.kpi-giant-value {
  color: var(--primary) !important;
  font-family: var(--font-mono) !important;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.stat-value {
  color: var(--text-primary) !important;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.stat-label {
  color: var(--text-muted) !important;
}

/* Section labels & eyebrows */
.section-label,
.eyebrow,
.label,
.section-eyebrow,
.flow-step-eyebrow,
.kpi-label,
.cell-label,
.dept-metric-label,
.kpi-tag,
.token-hero-label,
.token-id-label,
.header-tag {
  color: var(--text-muted) !important;
  font-family: inherit !important;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* =========================================================
   TABLES
   ========================================================= */

table {
  background: var(--surface);
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

thead {
  background: #f8fafc;
}

th {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

td {
  color: var(--text-primary);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background: #f8fafc;
}

/* =========================================================
   LINKS & DIVIDERS
   ========================================================= */

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
}

/* =========================================================
   SCROLLBAR
   ========================================================= */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f4f7;
}

::-webkit-scrollbar-thumb {
  background: #cbd5df;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #aebbc9;
}

/* Subtle pulse dot */
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-block;
}

/* =========================================================
   CURSOR & POINTER EFFECTS
   Driven by cursor.js. Every rule here is inert until the
   script adds .has-custom-cursor to <html>, so if the script
   fails to load the normal cursor stays.
   ========================================================= */

:root {
  --cursor-rgb: 29, 78, 216;          /* --primary, as r, g, b for rgba() */
  --cursor-teal-rgb: 13, 148, 136;    /* --teal */
  --cursor-danger-rgb: 220, 38, 38;   /* --danger */
  --cursor-dot-size: 6px;
  --cursor-ring-size: 34px;
  --cursor-z: 9999;
  --spotlight-radius: 260px;
  --spotlight-alpha: 0.07;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hide the native cursor, but keep it where it carries meaning */
html.has-custom-cursor,
html.has-custom-cursor * {
  cursor: none !important;
}

html.has-custom-cursor input:not([type="radio"]):not([type="checkbox"]):not([type="button"]):not([type="submit"]):not([type="range"]),
html.has-custom-cursor textarea,
html.has-custom-cursor [contenteditable="true"] {
  cursor: text !important;
}

html.has-custom-cursor select {
  cursor: auto !important;
}

/* Follower: dot sits on the pointer, ring trails behind.
   The wrapper is moved with transform; the visible circle is ::before
   so it can scale without fighting the position. */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: var(--cursor-z);
  opacity: 0;
  will-change: transform;
  transition: opacity 0.2s ease;
}

.cursor-dot.is-visible,
.cursor-ring.is-visible {
  opacity: 1;
}

.cursor-dot.is-text,
.cursor-ring.is-text {
  opacity: 0;
}

.cursor-dot::before,
.cursor-ring::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  transition:
    transform 0.22s var(--ease-out),
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.cursor-dot::before {
  width: var(--cursor-dot-size);
  height: var(--cursor-dot-size);
  margin: calc(var(--cursor-dot-size) / -2) 0 0 calc(var(--cursor-dot-size) / -2);
  background: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.cursor-ring::before {
  width: var(--cursor-ring-size);
  height: var(--cursor-ring-size);
  margin: calc(var(--cursor-ring-size) / -2) 0 0 calc(var(--cursor-ring-size) / -2);
  border: 1.5px solid rgba(var(--cursor-rgb), 0.5);
  background: rgba(var(--cursor-rgb), 0.03);
}

/* Over something clickable */
.cursor-dot.is-active::before {
  transform: scale(0);
}

.cursor-ring.is-active::before {
  transform: scale(1.5);
  border-color: rgba(var(--cursor-teal-rgb), 0.85);
  background: rgba(var(--cursor-rgb), 0.08);
}

/* Over a disabled control */
.cursor-ring.is-disabled::before {
  border-color: rgba(var(--cursor-danger-rgb), 0.7);
  background: rgba(var(--cursor-danger-rgb), 0.06);
}

/* Mouse button held */
.cursor-ring.is-down::before {
  transform: scale(0.8);
}

.cursor-ring.is-active.is-down::before {
  transform: scale(1.2);
}

/* Cursor line: fading trail (canvas) */
.cursor-trail {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: calc(var(--cursor-z) - 1);
}

/* Cursor line: crosshair guides (lineMode: 'crosshair') */
.cursor-cross {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: calc(var(--cursor-z) - 1);
  opacity: 0;
  will-change: transform;
  transition: opacity 0.2s ease;
}

.cursor-cross.is-visible {
  opacity: 1;
}

.cursor-cross-x {
  width: 1px;
  height: 100vh;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(var(--cursor-rgb), 0.22) 30%,
    rgba(var(--cursor-rgb), 0.22) 70%,
    transparent
  );
}

.cursor-cross-y {
  width: 100vw;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(var(--cursor-rgb), 0.22) 30%,
    rgba(var(--cursor-rgb), 0.22) 70%,
    transparent
  );
}

/* Keyboard focus stays clearly visible whatever the mouse is doing */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
summary:focus-visible,
.choice-card:focus-within,
.visit-type-card:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Touch screens: none of this applies */
@media (hover: none), (pointer: coarse) {
  .cursor-dot,
  .cursor-ring,
  .cursor-trail,
  .cursor-cross {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor-dot,
  .cursor-ring,
  .cursor-trail,
  .cursor-cross {
    display: none !important;
  }
}