/* Trang khách Lấy Số QR (/q/<mã>) — mobile-first (390 px), desktop căn giữa. */
:root {
  --brand: #0f766e;
  --brand-dark: #115e59;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --warn-bg: #fef3c7;
  --warn-ink: #92400e;
  --err-bg: #fee2e2;
  --err-ink: #991b1b;
  --ok-bg: #dcfce7;
  --ok-ink: #166534;
  --call: #b91c1c;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
[hidden] { display: none !important; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--brand); color: #fff;
}
.brand { color: #fff; font-weight: 700; text-decoration: none; letter-spacing: .2px; }
.conn {
  font-size: .85rem; background: #fde68a; color: #78350f; border-radius: 999px; padding: 2px 10px;
}

main { max-width: 480px; margin: 0 auto; padding: 16px 16px 40px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: .85rem; margin: 12px 0 0; }

.card {
  background: var(--card); border-radius: 16px; padding: 20px; box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
#v-loading { padding: 48px 0; }

.place h1 { font-size: 1.5rem; line-height: 1.25; margin: 4px 0 6px; overflow-wrap: anywhere; }
.place .meta { margin: 0 0 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.chip { display: inline-block; border-radius: 999px; padding: 2px 10px; font-weight: 600; font-size: .85rem; }
.chip.open { background: var(--ok-bg); color: var(--ok-ink); }
.chip.closed { background: var(--err-bg); color: var(--err-ink); }

.notice { border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.err { background: var(--err-bg); color: var(--err-ink); }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); margin-top: 14px; }
.hint { background: #e0f2fe; color: #075985; border-radius: 12px; padding: 10px 14px; font-size: .9rem; margin: 14px 0 0; }

.services { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.services legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.svc {
  display: flex; align-items: center; gap: 12px; background: var(--card); border: 2px solid var(--line);
  border-radius: 14px; padding: 14px; margin-bottom: 10px; cursor: pointer; min-height: 56px;
}
.svc input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; margin: 0; }
.svc .name { font-weight: 600; font-size: 1.05rem; overflow-wrap: anywhere; }
.svc .sub { color: var(--muted); font-size: .85rem; }
.svc:has(input:checked) { border-color: var(--brand); background: #f0fdfa; }

.btn {
  display: inline-block; border: 0; border-radius: 14px; padding: 12px 20px; font: inherit; font-weight: 600;
  background: var(--brand); color: #fff; cursor: pointer; min-height: 48px;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { background: #94a3b8; cursor: not-allowed; }
.btn.big { display: block; width: 100%; font-size: 1.35rem; padding: 18px; min-height: 64px; }
.btn.ghost { background: #e2e8f0; color: var(--ink); }
.btn.danger { background: var(--call); }
.link { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; padding: 10px; }
.link.danger { color: var(--call); }

.ticket {
  background: var(--card); border-radius: 20px; padding: 20px; margin-bottom: 16px; text-align: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08); border-top: 6px solid var(--brand);
}
.ticket .svc-name { color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }
.ticket .cap { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.ticket .num {
  font-size: clamp(3.5rem, 22vw, 5.5rem); font-weight: 800; line-height: 1.05; letter-spacing: 1px;
  font-variant-numeric: tabular-nums; margin: 2px 0 8px;
}
.ticket .status { font-size: 1.2rem; font-weight: 600; margin: 4px 0 14px; }
.ticket .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.ticket .cell { background: var(--bg); border-radius: 12px; padding: 10px 8px; }
.ticket .cell span { display: block; color: var(--muted); font-size: .8rem; }
.ticket .cell b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ticket.soon { border-top-color: #d97706; }
.ticket.soon .status { color: #b45309; }
.ticket.called { border-top-color: var(--call); background: #fff1f2; animation: pulse 1.2s ease-in-out 3; }
.ticket.called .status { color: var(--call); font-size: 1.5rem; }
.ticket.ended { border-top-color: #94a3b8; }
.ticket.ended .num { color: #94a3b8; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(185, 28, 28, .15); } }
@media (prefers-reduced-motion: reduce) { .ticket.called { animation: none; } }

/* Báo sắp tới lượt (Web Push, #900) */
.push { border-top: 1px dashed var(--line); margin: 10px 0 4px; padding-top: 12px; }
.btn.push-btn { width: 100%; background: #e0f2fe; color: #075985; font-size: 1rem; }
.btn.push-btn:hover { background: #bae6fd; }
.push-on { color: var(--ok-ink); font-weight: 600; margin: 0; }
.push-on .link { padding: 4px 8px; font-weight: 500; color: var(--muted); }
.push-note { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
.push-tip { text-align: left; background: #e0f2fe; color: #075985; border-radius: 12px; padding: 10px 14px; font-size: .9rem; }
.push-tip ol { margin: 6px 0 0; padding-left: 20px; }

dialog { border: 0; border-radius: 16px; padding: 20px; max-width: min(92vw, 400px); }
dialog::backdrop { background: rgba(15, 23, 42, .5); }
dialog h2 { margin: 0 0 8px; font-size: 1.25rem; }
dialog .row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }

@media (min-width: 768px) {
  main { padding-top: 32px; }
  .place h1 { font-size: 1.75rem; }
}
