:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --ink: #17201b;
  --muted: #5a665f;
  --line: #dfe4dd;
  --brand: #0f5f4b;
  --next: #15803d;
  --next-ink: #ffffff;
  --break: #b45309;
  --stop: #b91c1c;
  --info: #1d4ed8;
  --warn-bg: #fff7e6;
  --warn-line: #f2c46d;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 6%);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Tamil", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 17px; line-height: 1.45; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--brand); }

.demo-banner {
  background: #fff3cd; color: #5c4400; border-bottom: 1px solid #f0d67a;
  padding: 8px 16px; font-size: 14px; text-align: center;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 520px; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; justify-content: space-between; margin-bottom: 16px; }
.topbar h1 { font-size: 22px; margin: 0; }
.topbar .sub { color: var(--muted); font-size: 15px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h2 { font-size: 17px; margin: 0 0 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.stack { display: grid; gap: 16px; align-content: start; }
.qr { display: block; margin: 12px auto; width: 240px; max-width: 100%; height: auto; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 12px; font-size: 14px; font-weight: 600; border: 1px solid transparent; }
.chip::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.chip.ok { color: var(--next); background: #e8f6ec; border-color: #bfe5cb; }
.chip.pause { color: var(--break); background: #fff1e3; border-color: #f6cfa4; }
.chip.stop { color: var(--stop); background: #fdecec; border-color: #f4c2c2; }
.chip.muted { color: var(--muted); background: #eef1ed; }

.now { text-align: center; padding: 28px 20px; }
.now .label { color: var(--muted); font-size: 18px; }
.now .number { font-size: clamp(88px, 18vw, 168px); font-weight: 800; line-height: 1; letter-spacing: -.03em; margin: 6px 0; font-variant-numeric: tabular-nums; }
.now .who { font-size: 19px; color: var(--muted); min-height: 1.5em; }
.flip { animation: flip .45s ease; }
@keyframes flip { 0% { transform: rotateX(80deg); opacity: .2; } 100% { transform: rotateX(0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .flip { animation: none; } }

.btn { min-height: 52px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; }
.btn:hover { border-color: #b8c2b9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.next { width: 100%; min-height: 96px; font-size: 30px; background: var(--next); color: var(--next-ink); border: 0; border-radius: 18px; box-shadow: 0 6px 0 #0e5a2b; transition: transform .06s; }
.btn.next:active { transform: translateY(4px); box-shadow: 0 2px 0 #0e5a2b; }
.btn.break { color: var(--break); border-color: #f0c08f; }
.btn.stop { color: var(--stop); border-color: #efb4b4; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 15px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.tok { min-width: 56px; height: 44px; border-radius: 10px; background: #eef4f1; color: var(--brand); display: grid; place-items: center; font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.meta { color: var(--muted); font-size: 14px; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #eef1ed; color: var(--muted); }
.empty { color: var(--muted); padding: 8px 0; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: #f3f6f2; border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

.notice { border: 1px solid var(--warn-line); background: var(--warn-bg); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }
.notice.stop { border-color: #f4c2c2; background: #fdecec; }

.sheet-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / 35%); display: grid; place-items: end center; z-index: 20; }
.sheet { background: var(--surface); width: min(640px, 100%); border-radius: 20px 20px 0 0; padding: 20px; max-height: 90vh; overflow: auto; }
@media (min-width: 700px) { .sheet-backdrop { place-items: center; } .sheet { border-radius: 20px; } }
.sheet h3 { margin: 0 0 12px; font-size: 20px; }
.sheet section { margin-bottom: 16px; }
.sheet section > p { margin: 0 0 8px; color: var(--muted); font-size: 14px; font-weight: 600; }

.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.pad button { min-height: 60px; font-size: 24px; font-weight: 700; border-radius: 12px; border: 1px solid var(--line); background: #f8faf7; cursor: pointer; }
.phone-display { font-size: 30px; font-weight: 700; letter-spacing: .06em; text-align: center; min-height: 48px; font-variant-numeric: tabular-nums; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 600; }
.field input[type="text"], .field input[type="tel"], .field input[type="email"], .field input[type="password"] {
  min-height: 52px; border: 1px solid #c7d0c8; border-radius: 12px; padding: 10px 14px; background: #fff;
}
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 24px; height: 24px; margin-top: 2px; flex: none; }
.check label { font-weight: 400; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #17201b; color: #fff; border-radius: 14px; padding: 12px 16px; display: flex; gap: 14px; align-items: center; z-index: 30; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.toast.error { background: var(--stop); }
.toast button { background: #fff; color: #17201b; border: 0; border-radius: 10px; padding: 8px 14px; font-weight: 700; cursor: pointer; min-height: 40px; }

.sim { font-size: 14px; }
.sim li { padding: 6px 0; }

/* Patient pages */
.big-token { font-size: clamp(72px, 26vw, 140px); font-weight: 800; text-align: center; line-height: 1; margin: 8px 0; font-variant-numeric: tabular-nums; color: var(--brand); }
.status-line { text-align: center; font-size: 22px; font-weight: 700; margin: 8px 0; }
.range { text-align: center; font-size: 30px; font-weight: 800; }
.fine { color: var(--muted); font-size: 14px; text-align: center; }
.progress { height: 14px; background: #e4ebe6; border-radius: 999px; overflow: hidden; margin: 16px 0 6px; }
.progress > div { height: 100%; width: 0; background: var(--next); border-radius: 999px; transition: width .6s ease; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.pair .stat b { font-size: 34px; }

/* Board */
.board { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; background: #0f241d; color: #fff; }
.board header, .board footer { padding: 18px 28px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.board main { display: grid; place-items: center; text-align: center; }
.board .serving { font-size: clamp(120px, 28vw, 340px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.board .next-list { font-size: clamp(28px, 5vw, 56px); color: #b9d9cc; }

/* Poster */
.poster { max-width: 720px; margin: 0 auto; padding: 32px 24px; text-align: center; }
.poster h1 { font-size: 40px; margin: 0 0 6px; }
.poster .qr { width: min(420px, 80vw); margin: 18px auto; }
.poster .steps { text-align: left; max-width: 520px; margin: 0 auto; font-size: 20px; }
@media print { .no-print, .demo-banner { display: none !important; } body { background: #fff; } }
