/* Qura — design tokens + components.
   Calm, clinical-clean, modern. Great UI is a design achievement, not a framework one.
   Everything themable via CSS custom properties; dark mode via prefers-color-scheme. */

:root {
  /* Brand */
  --qura-primary: #0e7c86;      /* teal — "cura/care" */
  --qura-primary-600: #0a5f67;
  --qura-primary-050: #e6f4f5;
  --qura-accent: #f4a259;

  /* Neutrals (light) */
  --bg: #f6f8f9;
  --surface: #ffffff;
  --surface-2: #f0f3f4;
  --border: #dde3e6;
  --text: #16232a;
  --text-muted: #5c6b73;

  /* Status */
  --waiting: #6b7b83;
  --called: #f4a259;
  --serving: #0e7c86;
  --done: #3a9d4f;
  --danger: #c0453b;

  /* Scale */
  --radius: 12px;
  --radius-sm: 8px;
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px;
  --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-8: 48px;
  --shadow: 0 1px 2px rgba(16,35,42,.06), 0 6px 20px rgba(16,35,42,.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1518;
    --surface: #16232a;
    --surface-2: #1d2e36;
    --border: #2a3c44;
    --text: #eaf1f3;
    --text-muted: #9fb0b8;
    --qura-primary-050: #10343a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--qura-primary); }

.brand {
  display: flex; align-items: center; gap: var(--space-3);
  font-weight: 700; letter-spacing: .2px;
}
.brand .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--qura-primary); box-shadow: 0 0 0 4px var(--qura-primary-050);
}
.brand small { font-weight: 500; color: var(--text-muted); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--surface); border-bottom: 1px solid var(--border);
}

.container { max-width: 1080px; margin: 0 auto; padding: var(--space-5); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: var(--space-5);
}

.grid { display: grid; gap: var(--space-4); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: var(--space-1); }
input, select, button {
  font: inherit; color: inherit;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  padding: 10px 12px; background: var(--surface);
}
input:focus, select:focus { outline: 2px solid var(--qura-primary); outline-offset: 1px; }
.field { margin-bottom: var(--space-4); }

button {
  cursor: pointer; border: 1px solid transparent; background: var(--qura-primary);
  color: #fff; font-weight: 600; transition: background .15s ease, transform .05s ease;
}
button:hover { background: var(--qura-primary-600); }
button:active { transform: translateY(1px); }
button.secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
button.ghost { background: transparent; color: var(--qura-primary); border-color: transparent; }
button.danger { background: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }

.row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.muted { color: var(--text-muted); }
.error { color: var(--danger); font-size: 14px; min-height: 1.2em; }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  padding: 3px 10px; border-radius: 999px; background: var(--surface-2); font-weight: 600; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.waiting { color: var(--waiting); }
.pill.called  { color: var(--called); }
.pill.serving { color: var(--serving); }
.pill.done    { color: var(--done); }
.pill.skipped, .pill.transferred { color: var(--danger); }

/* Token list */
.token-row { display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.token-row:last-child { border-bottom: 0; }
.token-num { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; min-width: 96px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: var(--space-5); }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { margin: 0 0 var(--space-1); font-size: 22px; }
.login-card .sub { margin: 0 0 var(--space-5); color: var(--text-muted); }
.login-card button[type=submit] { width: 100%; padding: 12px; }
.brand-parent { font-weight: 600; color: var(--text-muted); }
.login-footer { text-align: center; color: var(--text-muted); font-size: 13px;
  padding: 0 var(--space-5) var(--space-6); }
.login-footer strong { color: var(--qura-primary); }
.login-card .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
@media (max-width: 420px) { .login-card .row-2 { grid-template-columns: 1fr; } }

/* Email | Mobile identifier switcher */
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: var(--space-4);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px; }
.auth-tab { background: transparent; color: var(--text-muted); border: none; border-radius: var(--radius-sm);
  padding: 8px 10px; font-weight: 600; font-size: 14px; cursor: pointer; transition: background .15s, color .15s; }
.auth-tab:hover { color: var(--text); }
.auth-tab.is-active { background: var(--surface); color: var(--qura-primary); box-shadow: var(--shadow); }

/* ---------- Corridor "calm board" ---------- */
.board-body { background: radial-gradient(1200px 600px at 50% -10%, var(--qura-primary-050), var(--bg)); min-height: 100vh; }
.board-head { text-align: center; padding: var(--space-6) var(--space-4) var(--space-3); }
.board-head h1 { margin: 0; font-size: clamp(24px, 4vw, 40px); }
.board-grid { display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  padding: 0 var(--space-5) var(--space-6); max-width: 1200px; margin: 0 auto; }
.counter-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--space-5);
  transition: box-shadow .3s ease; }
.counter-card .name { color: var(--text-muted); font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; font-size: 12px; }
.doctors { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: var(--space-2); }
.doctor { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.doctor-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.doctor-dot.online { background: var(--done); box-shadow: 0 0 0 2px color-mix(in srgb, var(--done) 25%, transparent); }
.doctor-dot.offline { background: var(--text-muted); opacity: .5; }
/* Calm pass: bigger digits, gentler settle-in motion (CSS transitions/keyframes only, no new JS animation). */
.now-serving { font-size: clamp(56px, 9vw, 108px); font-weight: 800; line-height: 1.02;
  font-variant-numeric: tabular-nums; margin: var(--space-3) 0; color: var(--qura-primary);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1); }
.now-serving.flash { animation: pop .8s cubic-bezier(.22, 1, .36, 1); }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.06); } 100% { transform: scale(1); } }
.up-next { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-3); }
.up-next .n { font-variant-numeric: tabular-nums; background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 4px 10px; font-weight: 600; }
.eta { color: var(--text-muted); font-size: 14px; margin-top: var(--space-2); }
.live-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--done); font-weight: 600; }
.live-dot::before { content:""; width:8px; height:8px; border-radius:50%; background: currentColor;
  animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* Board controls: locale switcher + voice mute toggle, pill-styled to match .pill above. */
.board-controls { display: flex; align-items: center; justify-content: center; gap: var(--space-3);
  flex-wrap: wrap; margin-top: var(--space-3); }
.board-lang-group { display: inline-flex; gap: 4px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-pill, 999px); padding: 4px; }
.board-lang-btn { background: transparent; color: var(--text-muted); border: none;
  border-radius: var(--radius-pill, 999px); padding: 6px 14px; font-size: 13px; font-weight: 600;
  transition: background .15s ease, color .15s ease; }
.board-lang-btn:hover { color: var(--text); }
.board-lang-btn.is-active { background: var(--surface); color: var(--qura-primary); box-shadow: var(--shadow); }
.board-voice-btn { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
  border-radius: var(--radius-pill, 999px); padding: 8px 16px; font-size: 13px; font-weight: 600;
  transition: background .15s ease, color .15s ease; }
.board-voice-btn:hover { color: var(--text); }
.board-voice-btn.is-active { background: var(--qura-primary-050); color: var(--qura-primary); border-color: var(--qura-primary); }

/* ---------- Insitea Ad Cards ---------- */
.ad-card {
  border-color: var(--qura-accent);
  background: linear-gradient(135deg, var(--surface), var(--qura-primary-050));
}
.ad-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--qura-accent);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ad-content h3,
.ad-content h4 {
  margin: 0 0 var(--space-2);
  color: var(--qura-primary);
}
.ad-content p {
  margin: 0 0 var(--space-3);
  color: var(--text);
}
.ad-content img {
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}
.ad-qr {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}
.ad-cta {
  display: inline-block;
  padding: 8px 16px;
  background: var(--qura-primary);
  color: white;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}
.ad-cta:hover {
  background: var(--qura-primary-600);
}
