
  :root {
    --teal-50: #E1F5EE; --teal-100: #9FE1CB; --teal-400: #1D9E75; --teal-600: #0F6E56; --teal-800: #085041;
    --blue-50: #E6F1FB; --blue-100: #B5D4F4; --blue-400: #378ADD; --blue-600: #185FA5; --blue-800: #0C447C;
    --amber-50: #FAEEDA; --amber-400: #BA7517; --amber-600: #854F0B;
    --red-50: #FCEBEB; --red-100: #F7C1C1; --red-400: #E24B4A; --red-600: #A32D2D;
    --green-50: #EAF3DE; --green-400: #639922; --green-600: #3B6D11;
    --gray-50: #F1EFE8; --gray-100: #D3D1C7; --gray-400: #888780; --gray-600: #5F5E5A; --gray-800: #444441;
    --bg: #f8f9fb; --surface: #ffffff; --border: rgba(0,0,0,0.09);
    --text: #1a1a1a; --muted: #6b7280; --radius: 14px;
    --shadow: 0 2px 12px rgba(0,0,0,0.07);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

  /* NAV */
  .nav { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 24px; display: flex; align-items: center; justify-content: space-between; height: 60px; position: sticky; top: 0; z-index: 100; }
  .logo { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; color: var(--teal-600); display: flex; align-items: center; gap: 8px; }
  .logo-dot { width: 8px; height: 8px; background: var(--teal-400); border-radius: 50%; }
  .nav-tabs { display: flex; gap: 4px; }
  .nav-tab { padding: 7px 16px; border-radius: 8px; border: none; background: none; font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--muted); transition: all 0.15s; }
  .nav-tab.active { background: var(--teal-50); color: var(--teal-600); }
  .nav-tab:hover:not(.active) { background: var(--gray-50); }
  .live-badge { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--green-600); font-weight: 500; }
  .live-dot { width: 7px; height: 7px; background: var(--green-400); border-radius: 50%; animation: pulse 1.5s infinite; }
  @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

  /* VIEWS */
  .view { display: none; padding: 28px 24px; max-width: 1100px; margin: 0 auto; }
  .view.active { display: block; }

  /* CARDS */
  .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
  .card-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--text); }

  /* GRID */
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
  .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

  /* STAT CARDS */
  .stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; }
  .stat-label { font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
  .stat-value { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800; }
  .stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
  .stat.teal .stat-value { color: var(--teal-600); }
  .stat.blue .stat-value { color: var(--blue-600); }
  .stat.amber .stat-value { color: var(--amber-600); }
  .stat.red .stat-value { color: var(--red-600); }

  /* FORMS */
  .form-group { margin-bottom: 16px; }
  .form-label { font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 6px; display: block; }
  input, select, textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-family: 'DM Sans', sans-serif; font-size: 14px; background: var(--surface); color: var(--text); outline: none; transition: border-color 0.15s; }
  input:focus, select:focus, textarea:focus { border-color: var(--teal-400); }
  textarea { resize: vertical; min-height: 80px; }

  /* BUTTONS */
  .btn { padding: 10px 20px; border-radius: 8px; border: none; font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.15s; display: inline-flex; align-items: center; gap: 8px; }
  .btn-primary { background: var(--teal-600); color: white; }
  .btn-primary:hover { background: var(--teal-800); }
  .btn-secondary { background: var(--gray-50); color: var(--text); border: 1px solid var(--border); }
  .btn-secondary:hover { background: var(--gray-100); }
  .btn-danger { background: var(--red-50); color: var(--red-600); border: 1px solid var(--red-100); }
  .btn-danger:hover { background: var(--red-100); }
  .btn-success { background: var(--green-50); color: var(--green-600); border: 1px solid #C0DD97; }
  .btn-success:hover { background: #C0DD97; }
  .btn-amber { background: var(--amber-50); color: var(--amber-600); border: 1px solid #FAC775; }
  .btn-sm { padding: 6px 12px; font-size: 12px; }
  .btn-full { width: 100%; justify-content: center; }

  /* QUEUE TABLE */
  .queue-table { width: 100%; border-collapse: collapse; font-size: 14px; }
  .queue-table th { background: var(--gray-50); padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); }
  .queue-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
  .queue-table tr:last-child td { border-bottom: none; }
  .queue-table tr:hover td { background: #fafafa; }
  .queue-table tr.serving td { background: var(--teal-50); }

  /* BADGES */
  .badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
  .badge-waiting { background: var(--blue-50); color: var(--blue-600); }
  .badge-serving { background: var(--teal-50); color: var(--teal-600); }
  .badge-done { background: var(--green-50); color: var(--green-600); }
  .badge-emergency { background: var(--red-50); color: var(--red-600); }
  .badge-skipped { background: var(--gray-50); color: var(--gray-600); }

  /* TOKEN DISPLAY */
  .token-hero { text-align: center; padding: 32px 20px; }
  .token-number { font-family: 'Syne', sans-serif; font-size: 72px; font-weight: 800; color: var(--teal-600); line-height: 1; }
  .token-label { font-size: 14px; color: var(--muted); margin-top: 6px; }
  .token-small { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 700; color: var(--teal-600); }

  /* PROGRESS BAR */
  .progress-bar { height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; margin-top: 10px; }
  .progress-fill { height: 100%; background: var(--teal-400); border-radius: 3px; transition: width 0.5s; }

  /* PATIENT TRACKER */
  .tracker-steps { display: flex; gap: 0; margin: 20px 0; }
  .tracker-step { flex: 1; text-align: center; position: relative; }
  .tracker-step::before { content: ''; position: absolute; top: 16px; left: -50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
  .tracker-step:first-child::before { display: none; }
  .tracker-step.done::before { background: var(--teal-400); }
  .step-circle { width: 32px; height: 32px; border-radius: 50%; background: var(--gray-100); border: 2px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--muted); position: relative; z-index: 1; }
  .tracker-step.done .step-circle { background: var(--teal-400); border-color: var(--teal-400); color: white; }
  .tracker-step.active .step-circle { background: var(--surface); border-color: var(--teal-400); color: var(--teal-600); box-shadow: 0 0 0 4px var(--teal-50); }
  .step-label { font-size: 11px; color: var(--muted); margin-top: 6px; display: block; }
  .tracker-step.active .step-label { color: var(--teal-600); font-weight: 600; }

  /* TOAST */
  .toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
  .toast { background: var(--text); color: white; padding: 12px 18px; border-radius: 10px; font-size: 14px; font-weight: 500; max-width: 320px; animation: slideIn 0.3s ease; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
  .toast.success { background: var(--teal-600); }
  .toast.error { background: var(--red-600); }
  .toast.info { background: var(--blue-600); }
  @keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

  /* MODAL BACKDROP */
  .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 200; align-items: center; justify-content: center; }
  .modal-overlay.open { display: flex; }
  .modal { background: var(--surface); border-radius: var(--radius); padding: 28px; width: 100%; max-width: 480px; box-shadow: 0 8px 40px rgba(0,0,0,0.15); }
  .modal-title { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 800; margin-bottom: 20px; }
  .modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

  /* BOOKING CONFIRMATION */
  .confirm-box { background: var(--teal-50); border: 1px solid var(--teal-100); border-radius: 12px; padding: 24px; text-align: center; }
  .confirm-token { font-family: 'Syne', sans-serif; font-size: 56px; font-weight: 800; color: var(--teal-600); }
  .confirm-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,0.06); font-size: 14px; }
  .confirm-row:last-child { border-bottom: none; }
  .confirm-row span:first-child { color: var(--muted); }
  .confirm-row span:last-child { font-weight: 600; }

  /* QUEUE POSITION CARD */
  .position-ring { width: 100px; height: 100px; border-radius: 50%; background: var(--teal-50); border: 4px solid var(--teal-400); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; flex-direction: column; }
  .position-num { font-family: 'Syne', sans-serif; font-size: 32px; font-weight: 800; color: var(--teal-600); line-height: 1; }
  .position-sub { font-size: 10px; color: var(--teal-600); font-weight: 600; }

  /* SECTION HEADER */
  .section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
  .section-title { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 800; }

  /* CLINIC BADGE */
  .clinic-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-50); color: var(--blue-600); font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px; border: 1px solid var(--blue-100); }

  /* NOTICE */
  .notice { background: var(--amber-50); border: 1px solid #FAC775; border-radius: 10px; padding: 12px 16px; font-size: 13px; color: var(--amber-600); margin-bottom: 16px; }

  /* DIVIDER */
  .divider { height: 1px; background: var(--border); margin: 20px 0; }

  /* RESPONSIVE */
  @media (max-width: 700px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
    .nav-tab span { display: none; }
  }
  @media (max-width: 480px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
  }

  .row { display: flex; gap: 12px; align-items: center; }
  .flex-1 { flex: 1; }
  .mt-1 { margin-top: 8px; }
  .mt-2 { margin-top: 16px; }
  .mb-1 { margin-bottom: 8px; }
  .text-muted { color: var(--muted); font-size: 13px; }
  .text-center { text-align: center; }
  .font-bold { font-weight: 700; }
  .gap-1 { gap: 8px; }

  select option { font-family: 'DM Sans', sans-serif; }
  .action-btns { display: flex; gap: 6px; }
  .scroll-x { overflow-x: auto; }
  .empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
  .empty-state svg { margin-bottom: 12px; opacity: 0.3; }
  .tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: var(--gray-50); color: var(--gray-600); }

  .time-slot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
  .time-slot { padding: 8px; border: 1px solid var(--border); border-radius: 8px; text-align: center; font-size: 13px; cursor: pointer; transition: all 0.15s; font-family: 'DM Sans', sans-serif; background: var(--surface); color: var(--text); }
  .time-slot:hover { border-color: var(--teal-400); color: var(--teal-600); background: var(--teal-50); }
  .time-slot.selected { background: var(--teal-400); color: white; border-color: var(--teal-400); font-weight: 600; }
  .time-slot.full { background: var(--gray-50); color: var(--gray-400); cursor: not-allowed; text-decoration: line-through; }

  /* Admin sidebar layout */
  .admin-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
  @media (max-width: 900px) { .admin-layout { grid-template-columns: 1fr; } }

  .now-serving-banner { background: linear-gradient(135deg, var(--teal-600), var(--teal-800)); color: white; border-radius: var(--radius); padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
  .now-serving-banner .token-large { font-family: 'Syne', sans-serif; font-size: 48px; font-weight: 800; line-height: 1; }
  .now-serving-banner .label { font-size: 12px; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
  .now-serving-banner .patient-name { font-size: 18px; font-weight: 600; margin-top: 4px; }
