/* LEOSS QSystem
   Type: Barlow (text) and Barlow Condensed (numbers), served from this server so the
   system also works on a network without internet access.
   Colour: LEOSS cyan on a deep teal; yellow is reserved for one thing only: a number that was just called. */

@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("fonts/barlow-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("fonts/barlow-latin-ext-400.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("fonts/barlow-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("fonts/barlow-latin-ext-500.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("fonts/barlow-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("fonts/barlow-latin-ext-600.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("fonts/barlow-condensed-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("fonts/barlow-condensed-latin-ext-600.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("fonts/barlow-condensed-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("fonts/barlow-condensed-latin-ext-700.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --deep: #08242F;
  --deep-2: #0B2E3B;
  --line-dark: #1E4B5B;
  --cyan: #00A6D3;
  --cyan-dark: #035E78;
  --yellow: #FECB31;
  --yellow-tint: #FEEBB2;
  --paper: #F8FAFC;
  --card: #FFFFFF;
  --ink: #0F172A;
  --muted: #475569;
  --line: #CBD5E1;
  --text-light: #E6F6FB;
  --danger: #B91C1C;
  --ok: #0F766E;

  --text: "Barlow", "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --digits: "Barlow Condensed", "Barlow", "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.15; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
p { margin: 0; }
a { color: var(--cyan-dark); }

:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- buttons and fields (desk, dashboard, admin, login) ---------- */

.btn {
  font: 600 1rem var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 46px; padding: 0 20px;
  border: 1.5px solid var(--cyan-dark); border-radius: var(--radius);
  background: var(--card); color: var(--cyan-dark);
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: #EAF7FB; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--cyan-dark); color: #fff; }
.btn-primary:hover { background: #024a5f; }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: .92rem; }

label.field { display: block; font-weight: 500; font-size: .95rem; }
label.field > span { display: block; margin-bottom: 5px; }
.field input, .field select {
  font: inherit; width: 100%; min-height: 46px; padding: 0 12px;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--cyan); outline: 3px solid rgba(0,166,211,.25); outline-offset: 0; }
/* label.field-check: must outrank 'label.field { display: block }' above, or the box sits over its text */
label.field-check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
label.field-check > span { margin-bottom: 0; }
.field-check input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; flex: none; }

.message { padding: 10px 14px; border-radius: var(--radius); font-weight: 500; }
.message-error { background: #FEE2E2; color: #7F1D1D; }
.message-ok { background: #CCFBF1; color: #134E4A; }

/* ---------- top bar of the working pages ---------- */

.bar {
  display: flex; align-items: center; gap: 20px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--deep); color: var(--text-light);
}
.bar img { height: 22px; width: auto; display: block; }
.bar .product { font: 600 1.15rem var(--digits); letter-spacing: .04em; color: #fff; }
.bar .spacer { flex: 1; }
.bar .who { font-size: .95rem; text-align: right; line-height: 1.25; }
.bar .who b { display: block; color: #fff; font-weight: 600; }
.bar a, .bar button.link { color: var(--text-light); font: inherit; background: none; border: 0; padding: 6px 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 640px) {
  .bar { gap: 6px 14px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .bar .product, .bar .who { display: none; }
}

.page { max-width: 1120px; margin: 0 auto; padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 60px; }

/* ---------- login ---------- */

.login {
  min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, 1fr);
}
.login-side {
  background: var(--deep); color: var(--text-light);
  padding: clamp(28px, 6vw, 72px); display: flex; flex-direction: column; justify-content: space-between; gap: clamp(20px, 5vh, 40px);
}
/* With the phone code the dark half fills from the top: the form beside it may be taller than the screen,
   and a code pushed to the bottom of that would again need scrolling. */
.login-side:has(.pair-box:not(.hidden):not(.pair-off)) { justify-content: flex-start; }
.login-side img { height: 26px; width: auto; align-self: flex-start; }
.login-side h1 { font: 700 clamp(3rem, 7vw, 5.6rem)/.92 var(--digits); color: #fff; letter-spacing: .01em; }
.login-side p { max-width: 30ch; font-size: 1.15rem; margin-top: 18px; }
.login-form { padding: clamp(28px, 6vw, 72px); display: flex; flex-direction: column; justify-content: center; gap: 18px; max-width: 520px; }
.login-form h2 { font-size: 1.6rem; margin-bottom: 4px; }
.login-stage { display: flex; flex-direction: column; gap: 18px; }
.login-code { font: 700 2rem var(--digits); letter-spacing: .3em; text-align: center; }
.login-form button.link { align-self: flex-start; background: none; border: 0; padding: 0; font: inherit; color: var(--cyan-dark); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pair-off { display: none !important; }
/* sign-in with a phone: the code a TV shows */
.pair-box { display: flex; align-items: center; gap: 22px; max-width: 560px; padding: 18px; background: #fff; color: var(--ink); border-radius: var(--radius); }
.pair-qr { flex: 0 0 auto; }
/* as large as the height allows: a TV is wide but low, and the code is read from across the room */
.pair-qr svg { display: block; width: clamp(140px, 30vh, 260px); height: clamp(140px, 30vh, 260px); }
.pair-box b { font-size: 1.15rem; }
.login-side .pair-box p { max-width: none; font-size: 1rem; margin-top: 6px; color: var(--muted); }
.login-side .pair-box .pair-code-small { color: var(--ink); }
.pair-code-small b { font: 700 1.25rem var(--digits); letter-spacing: .08em; }
@media (max-width: 700px) { .pair-box { display: none; } }
/* the page the phone opens */
.pair { max-width: 560px; display: grid; gap: 18px; }
.pair-code { display: flex; align-items: baseline; gap: 12px; padding: 12px 16px; border-radius: var(--radius); background: #E2E8F0; }
.pair-code b { font: 700 1.8rem var(--digits); letter-spacing: .08em; white-space: nowrap; }
.pair .btn-primary { min-height: 56px; font-size: 1.15rem; }
.pair-customers { display: grid; gap: 10px; }
.pair-customers .btn { min-height: 52px; justify-content: flex-start; }
.pair a.btn { justify-self: start; }
.lang-switch { display: flex; gap: 4px; margin-top: 12px; }
.lang-switch button { font: 500 .9rem var(--text); border: 0; background: none; color: var(--muted); padding: 6px 8px; cursor: pointer; border-radius: 6px; }
.lang-switch button[aria-pressed="true"] { color: var(--ink); background: #E2E8F0; }
@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-side { padding-bottom: 28px; gap: 24px; }
}

/* ---------- dashboard ---------- */

.station-group { margin-top: 36px; }
.station-group > h2 { margin-bottom: 4px; }
.station-group > p { margin-bottom: 16px; }
.station-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.station {
  display: block; padding: 20px 22px 22px; min-height: 124px;
  background: var(--card); border: 1.5px solid var(--line); border-left: 6px solid var(--cyan);
  border-radius: var(--radius); color: var(--ink); text-decoration: none;
}
.station:hover, .station:focus-visible { border-color: var(--cyan-dark); border-left-color: var(--cyan-dark); background: #F1FAFD; }
.station b { display: block; font-size: 1.25rem; font-weight: 600; line-height: 1.2; }
.station span { display: block; margin-top: 8px; color: var(--muted); font-size: .97rem; }
.empty { padding: 28px; border: 1.5px dashed var(--line); border-radius: var(--radius); background: #fff; max-width: 60ch; }
.empty p + p { margin-top: 8px; }

/* ---------- the ticket: the one shape that repeats on paper, kiosk, desk and TV ---------- */

.ticket {
  --notch: 18px;
  --tear: 68%;
  --behind: var(--paper);
  position: relative; background: #fff; color: var(--ink);
  border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column;
  /* Stated explicitly: the kiosk's big ticket is a <button>, and Android's browser gives buttons
     'align-items: flex-start', which shrank its two parts to the left edge. */
  align-items: stretch;
}
.ticket::before, .ticket::after {
  content: ""; position: absolute; top: var(--tear); width: calc(var(--notch) * 2); height: calc(var(--notch) * 2);
  margin-top: calc(var(--notch) * -1); border-radius: 50%; background: var(--behind); z-index: 2;
}
.ticket::before { left: calc(var(--notch) * -1); }
.ticket::after { right: calc(var(--notch) * -1); }
.ticket-main { flex: 0 0 var(--tear); display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
.ticket-stub {
  flex: 1; display: flex; align-items: center; justify-content: center; text-align: center;
  border-top: 3px dashed var(--line); margin: 0 calc(var(--notch) * 1.4); min-height: 0;
}
.ticket-number { font: 700 1em/.86 var(--digits); font-variant-numeric: tabular-nums; letter-spacing: .01em; }

/* ---------- desk ---------- */

.desk { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: clamp(20px, 4vw, 48px); align-items: start; }
.desk .ticket { height: 330px; border: 1.5px solid var(--line); --behind: var(--paper); }
.desk .ticket::before, .desk .ticket::after { border: 1.5px solid var(--line); }
.desk .ticket-number { font-size: 150px; }
.desk .ticket-caption { font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.desk .ticket-stub { font-weight: 600; font-size: 1.1rem; }
.desk .ticket.is-empty .ticket-number { color: var(--line); }
.desk-actions { display: grid; gap: 12px; }
.desk-actions .btn { min-height: 62px; font-size: 1.15rem; justify-content: flex-start; padding: 0 24px; }
.desk-actions .btn-next { min-height: 96px; font-size: 1.6rem; }
.desk-actions .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.desk-status { min-height: 46px; margin-top: 14px; }
/* paper left in the kiosk's printer; a warning from 10 % down */
.paper-state { margin-top: 16px; display: grid; gap: 8px; }
.paper-line { color: var(--muted); }
.paper-low { padding: 10px 14px; border-radius: var(--radius); background: #FEF3C7; color: #78350F; font-weight: 600; border-left: 6px solid #D97706; }
.waiting-box { margin-top: 26px; padding-top: 20px; border-top: 1.5px solid var(--line); }
.waiting-box h2 { display: flex; align-items: baseline; gap: 10px; }
.waiting-box h2 b { font: 700 1.7rem var(--digits); }
.waiting-numbers { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font: 600 1.5rem var(--digits); font-variant-numeric: tabular-nums; color: var(--cyan-dark); }
.waiting-numbers .more { color: var(--muted); font: 500 1rem var(--text); align-self: center; }
/* a waiting number that was sent to one specific point carries that point's name */
.waiting-numbers span small { margin-left: 5px; font: 600 .78rem var(--text); color: var(--muted); vertical-align: middle; }
.waiting-numbers span small.for-me { color: var(--ok); }
.waiting-numbers span.not-mine { color: var(--line); }
/* priority: red, on every list of waiting numbers */
.waiting-numbers span.prio, .history-line b.prio { color: var(--danger); }
.waiting-numbers span.prio.not-mine { color: #E9A3A3; }
.desk-priority { display: flex; align-items: center; gap: 10px; padding: 6px 4px; font-weight: 500; cursor: pointer; }
.desk-priority input { width: 22px; height: 22px; accent-color: var(--danger); }
.desk-priority:has(input:checked) { color: var(--danger); font-weight: 600; }
.desk-actions .row .btn-quiet { min-height: 46px; font-size: 1rem; }

dialog.history { width: min(680px, calc(100vw - 32px)); }
.history-body { padding: 26px 28px 24px; display: grid; gap: 14px; }
#history-list { display: grid; max-height: 56vh; overflow-y: auto; border-top: 1px solid #E2E8F0; }
.history-row { border-bottom: 1px solid #E2E8F0; padding: 8px 0; }
.history-line { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; }
.history-line b { font: 700 1.5rem var(--digits); font-variant-numeric: tabular-nums; }
.history-fix { display: grid; gap: 12px; margin: 10px 0 6px 76px; padding: 14px; background: #F1F5F9; border-radius: var(--radius); }
.history-fix .buttons, .history-body > .buttons { display: flex; justify-content: flex-end; gap: 10px; }
.desk-targets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 0 4px; }
.desk-targets .btn { min-height: 46px; font-size: 1rem; padding: 0 16px; }
@media (max-width: 800px) { .desk { grid-template-columns: 1fr; } .desk .ticket { height: 260px; } .desk .ticket-number { font-size: 120px; } }

/* ---------- kiosk ---------- */

body.kiosk { background: var(--deep); color: var(--text-light); overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.kiosk-screen { height: 100%; display: grid; grid-template-rows: auto 1fr auto; padding: clamp(18px, 3.5vmin, 44px); gap: clamp(16px, 3vmin, 36px); }
.kiosk-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: clamp(1rem, 2.4vmin, 1.5rem); }
.kiosk-head img { height: clamp(20px, 3.4vmin, 34px); width: auto; }
.kiosk-button {
  --behind: var(--deep); --notch: clamp(16px, 3.2vmin, 34px); --tear: 70%;
  width: 100%; height: 100%; border: 0; padding: 0; cursor: pointer; font: inherit; text-align: center;
  background: var(--cyan); color: var(--deep); border-radius: clamp(16px, 3vmin, 30px);
  transition: transform .12s ease, background .12s ease;
}
.kiosk-button:active { transform: scale(.985); background: #2BB9DF; }
.kiosk-button:disabled { cursor: default; }
.kiosk-button .ticket-main { gap: .2em; }
.kiosk-button .big { font: 700 clamp(3rem, 13vmin, 9.5rem)/.95 var(--digits); letter-spacing: .005em; color: #fff; text-shadow: 0 2px 0 rgba(3,94,120,.35); }
.kiosk-button .ticket-stub { border-top-color: rgba(8,36,47,.45); font: 600 clamp(1.1rem, 3.4vmin, 2.2rem) var(--text); }
/* two ways to a number: paper (the big ticket) and phone (the bar under it) */
.kiosk-choices { display: grid; grid-template-rows: minmax(0, 1fr); gap: clamp(12px, 2.4vmin, 28px); min-height: 0; }
.kiosk-choices.two { grid-template-rows: minmax(0, 1fr) auto; }
.kiosk-virtual {
  border: clamp(2px, .45vmin, 4px) solid var(--cyan); background: transparent; color: #fff; cursor: pointer; font: inherit;
  border-radius: clamp(14px, 2.6vmin, 26px); padding: clamp(14px, 3vmin, 34px);
  display: flex; flex-direction: column; align-items: center; gap: .25em;
}
.kiosk-virtual .big { font: 700 clamp(1.8rem, 6.4vmin, 4.6rem)/1 var(--digits); letter-spacing: .01em; }
.kiosk-virtual span + span { font: 500 clamp(1rem, 2.6vmin, 1.6rem) var(--text); color: #9CC9D8; }
.kiosk-virtual:active { background: rgba(0, 166, 211, .2); }
.kiosk-virtual:disabled { cursor: default; }

.virtual-panel { position: fixed; inset: 0; background: rgba(8,36,47,.96); display: grid; place-items: center; z-index: 20; padding: 3vmin; }
.virtual-card {
  background: #fff; color: var(--ink); border-radius: clamp(16px, 3vmin, 30px);
  width: min(94vw, 1040px); padding: clamp(20px, 4vmin, 48px);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(16px, 3.6vmin, 44px); align-items: center;
}
.virtual-card .v-left { text-align: center; min-width: 0; }
.virtual-card .ticket-caption { font: 500 clamp(1.1rem, 3vmin, 1.9rem) var(--text); color: var(--muted); }
.virtual-card .ticket-number { font-size: clamp(5rem, 24vmin, 13rem); }
.virtual-card .v-ahead { font: 500 clamp(1rem, 2.6vmin, 1.5rem) var(--text); margin-top: .5em; }
.virtual-card .qr { width: min(44vmin, 400px); aspect-ratio: 1; }
.virtual-card .qr svg { width: 100%; height: 100%; display: block; }
.virtual-card .v-right p { text-align: center; font: 600 clamp(1rem, 2.6vmin, 1.5rem) var(--text); margin-top: .5em; max-width: min(44vmin, 400px); }
.v-bar { grid-column: 1 / -1; height: clamp(6px, 1.1vmin, 10px); border-radius: 99px; background: #E2E8F0; overflow: hidden; }
.v-bar i { display: block; height: 100%; background: var(--cyan); transform-origin: left center; }
.v-actions { grid-column: 1 / -1; display: flex; gap: 14px; justify-content: space-between; }
.v-actions .btn { min-height: clamp(56px, 9vmin, 84px); font-size: clamp(1.1rem, 2.8vmin, 1.6rem); padding: 0 clamp(18px, 4vmin, 40px); }
.virtual-card.done { grid-template-columns: 1fr; text-align: center; justify-items: center; gap: clamp(8px, 2vmin, 20px); }
.virtual-card.done h2 { font-size: clamp(1.5rem, 4.4vmin, 2.8rem); }
.virtual-card.done p { font-size: clamp(1rem, 2.6vmin, 1.5rem); color: var(--muted); max-width: 30ch; }
@media (orientation: portrait) {
  .virtual-card { grid-template-columns: 1fr; justify-items: center; }
  .virtual-card .v-actions, .virtual-card .v-bar { justify-self: stretch; }
}

.kiosk-foot { display: flex; justify-content: space-between; gap: 20px; font-size: clamp(.95rem, 2.2vmin, 1.35rem); color: #9CC9D8; }
.kiosk-foot b { color: #fff; font: 600 1.25em var(--digits); font-variant-numeric: tabular-nums; }

.issued { position: fixed; inset: 0; background: rgba(8,36,47,.94); display: grid; place-items: center; z-index: 20; }
.issued .ticket {
  --behind: #0a2a37; --notch: clamp(14px, 2.6vmin, 26px); --tear: 66%;
  width: min(74vmin, 560px); height: min(86vmin, 660px);
  animation: ticket-out .55s cubic-bezier(.2,.9,.25,1) both;
}
.issued .ticket-caption { font: 500 clamp(1.1rem, 3.2vmin, 2rem) var(--text); color: var(--muted); }
.issued .ticket-number { font-size: clamp(7rem, 34vmin, 17rem); }
.issued .ticket-stub { flex-direction: column; gap: .3em; font: 500 clamp(1rem, 2.8vmin, 1.6rem) var(--text); }
.issued .ticket-stub b { font-weight: 600; }
@keyframes ticket-out { from { transform: translateY(-110vh); } to { transform: translateY(0); } }

/* the staff's "new roll?" question on the kiosk */
.paper-panel { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 4vmin; background: rgba(8, 36, 47, .88); }
.paper-card { background: #fff; color: #0F172A; border-radius: 18px; padding: clamp(24px, 5vmin, 56px); max-width: min(92vw, 900px); text-align: center; }
.paper-card h2 { font: 700 clamp(1.6rem, 4.5vmin, 3rem) var(--digits); }
.paper-card p { margin-top: 14px; font-size: clamp(1.05rem, 2.6vmin, 1.6rem); }
#paper-actions { display: grid; gap: clamp(14px, 2.6vmin, 26px); margin-top: clamp(20px, 4vmin, 40px); }
#paper-actions .btn { font-size: clamp(1.1rem, 2.8vmin, 1.7rem); padding: 16px 30px; }
.paper-wide { width: 100%; }
.paper-estimate { display: grid; gap: 12px; padding: clamp(14px, 2.6vmin, 24px); border: 1.5px solid var(--line); border-radius: 14px; text-align: left; }
.paper-estimate label { font: 600 clamp(1.05rem, 2.6vmin, 1.6rem) var(--text); }
.paper-slider { display: flex; align-items: center; gap: 18px; }
.paper-slider input { flex: 1; height: 44px; accent-color: var(--cyan-dark); }
.paper-slider b { min-width: 4.2em; text-align: right; font: 700 clamp(1.5rem, 4vmin, 2.6rem) var(--digits); }
.kiosk-error { position: fixed; left: 50%; bottom: 8vmin; transform: translateX(-50%); background: #fff; color: #7F1D1D; padding: 18px 28px; border-radius: 14px; font: 600 clamp(1.1rem, 3vmin, 1.7rem) var(--text); z-index: 30; max-width: 90vw; text-align: center; }

/* ---------- the virtual ticket on a patient's phone ---------- */

body.phone { background: var(--paper); }
.phone-page { max-width: 460px; margin: 0 auto; padding: 18px 18px 40px; min-height: 100%; display: flex; flex-direction: column; gap: 22px; }
.phone-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-weight: 500; color: var(--muted); }
.phone-head img { height: 18px; width: auto; }
.phone .ticket { --behind: var(--paper); --notch: 16px; --tear: 72%; height: min(62vh, 430px); border: 1.5px solid var(--line); }
.phone .ticket::before, .phone .ticket::after { border: 1.5px solid var(--line); }
.phone .ticket-caption { font-weight: 500; color: var(--muted); font-size: 1.15rem; }
.phone .ticket-number { font-size: min(46vw, 210px); }
.phone .ticket-stub { font-weight: 600; font-size: 1.2rem; color: var(--cyan-dark); }
.phone .ticket.is-now { background: var(--yellow); border-color: var(--yellow); }
.phone .ticket.is-now .ticket-stub { border-top-color: rgba(8,36,47,.4); color: var(--deep); }
.phone .ticket.is-over .ticket-number { color: var(--line); }
.phone-status { text-align: center; }
.phone-status h1 { font-size: 1.9rem; }
.phone-status p { margin-top: 8px; color: var(--muted); font-size: 1.1rem; }
.phone-status.is-now p { color: var(--ink); font-weight: 600; font-size: 1.5rem; }
.phone-sound { text-align: center; display: grid; gap: 8px; justify-items: center; }
.phone-sound .btn { min-height: 54px; padding: 0 26px; font-size: 1.1rem; }
.phone-sound p { font-size: .97rem; max-width: 34ch; }
.phone-note { text-align: center; color: var(--danger); font-weight: 500; }

/* ---------- TV displays: sized in --u so they fill any screen ---------- */

body.tv { --u: min(1vw, 1.78vh); background: var(--deep); color: var(--text-light); overflow: hidden; font-size: calc(var(--u) * 1.7); cursor: none; }
.tv-screen { height: 100%; display: grid; grid-template-rows: auto 1fr; padding: calc(var(--u) * 2.6) calc(var(--u) * 3.4) calc(var(--u) * 3.4); gap: calc(var(--u) * 2.4); }
.tv-head { display: flex; align-items: center; gap: calc(var(--u) * 2); }
.tv-head img { height: calc(var(--u) * 2.4); width: auto; }
.tv-head .place { font: 500 calc(var(--u) * 2) var(--text); color: #9CC9D8; }
.tv-head .spacer { flex: 1; }
.tv-head .clock { font: 600 calc(var(--u) * 3.4) var(--digits); color: #fff; font-variant-numeric: tabular-nums; }
.tv-head a.menu { color: #5F8D9C; font-size: calc(var(--u) * 1.4); text-decoration: none; padding: calc(var(--u) * .6); cursor: pointer; }
.tv-head a.menu:focus-visible { color: #fff; }

.tv .ticket { --behind: var(--deep); --notch: calc(var(--u) * 2.2); --tear: 74%; border-radius: calc(var(--u) * 1.8); height: 100%; }
.tv .ticket-stub { border-top-width: calc(var(--u) * .35); font: 600 calc(var(--u) * 3.6) var(--text); color: var(--cyan-dark); }
.tv .ticket-caption { font: 500 calc(var(--u) * 3) var(--text); color: var(--muted); }
.tv .ticket.is-empty .ticket-number { color: #D5DEE6; }
.tv .ticket.is-empty .ticket-stub { color: var(--muted); }

/* one service point: the number owns the screen */
.tv-single { display: grid; grid-template-rows: minmax(0, 1fr); justify-items: center; align-items: center; gap: calc(var(--u) * 2.2); min-height: 0; }
.tv-single.has-next { grid-template-rows: minmax(0, 1fr) auto; }
.tv-single.has-next .ticket-number { font-size: calc(var(--u) * 21); }
.tv-single.has-next .ticket-number.is-long { font-size: calc(var(--u) * 17); }
.tv-single.has-next .ticket-caption { font-size: calc(var(--u) * 2.6); }
.tv-single.has-next .ticket-stub { font-size: calc(var(--u) * 3); }

/* the waiting order under a single number: who is called next, left to right */
.tv-next { width: min(100%, calc(var(--u) * 72)); display: flex; align-items: baseline; gap: calc(var(--u) * 2.4); border-top: calc(var(--u) * .2) solid var(--line-dark); padding-top: calc(var(--u) * 1.4); white-space: nowrap; overflow: hidden; }
.tv-next h2 { font: 500 calc(var(--u) * 2.2) var(--text); color: #9CC9D8; }
.tv-next ol { list-style: none; margin: 0; padding: 0; display: flex; gap: calc(var(--u) * 2.2); font: 600 calc(var(--u) * 4.6)/1 var(--digits); font-variant-numeric: tabular-nums; color: #fff; }
.tv-next ol li:first-child { color: var(--cyan); }
.tv-next .more, .tv-next .nobody { color: #9CC9D8; font-size: calc(var(--u) * 2.2); }
.tv-next .more { margin-left: auto; }
.tv-single .ticket { width: min(100%, calc(var(--u) * 72)); }
.tv-single .ticket-number { font-size: calc(var(--u) * 30); }

/* several service points sharing a queue: who waits on the left, who goes where on the right */
.tv-multi { display: grid; grid-template-columns: minmax(0, 27fr) minmax(0, 73fr); gap: calc(var(--u) * 3); min-height: 0; }
.tv-waiting { border-right: calc(var(--u) * .2) solid var(--line-dark); padding-right: calc(var(--u) * 3); min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.tv-waiting h2 { font: 500 calc(var(--u) * 2.6) var(--text); color: #9CC9D8; display: flex; justify-content: space-between; align-items: baseline; }
.tv-waiting h2 b { font: 700 calc(var(--u) * 3.6) var(--digits); color: #fff; }
.tv-waiting .order-hint { margin-top: calc(var(--u) * .4); color: #6F9EAD; font-size: calc(var(--u) * 1.7); }
.tv-waiting ol { list-style: none; margin: calc(var(--u) * 1.6) 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(5, auto); grid-auto-flow: column; gap: calc(var(--u) * .4) calc(var(--u) * 2); font: 600 calc(var(--u) * 5)/1.1 var(--digits); font-variant-numeric: tabular-nums; color: #fff; }
.tv-waiting ol li:first-child { color: var(--cyan); }
/* priority numbers are red wherever they stand in the list (they are called first) */
.tv-waiting ol li.priority, .tv-waiting ol li.priority:first-child, .tv-legend .priority { color: #FF7A7A; }
.tv-legend { display: flex; gap: calc(var(--u) * 2.2); font-size: calc(var(--u) * 1.5); color: #9CC9D8; margin-right: calc(var(--u) * 2); white-space: nowrap; }
.tv-waiting ol li { display: flex; align-items: baseline; gap: calc(var(--u) * 1); min-width: 0; }
.tv-waiting ol li small { font: 500 calc(var(--u) * 1.7) var(--text); color: #9CC9D8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* numbers named for one point: one column, number + name of the point */
.tv-waiting ol.with-targets { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; font-size: calc(var(--u) * 4.4); }
.tv-waiting .more, .tv-waiting .nobody { margin-top: calc(var(--u) * 1.4); color: #9CC9D8; font-size: calc(var(--u) * 2); }
.tv-points { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: calc(var(--u) * 3); min-height: 0; }
.tv-points .ticket { container-type: inline-size; }
.tv-points .ticket-number { font-size: calc(var(--u) * 16); }
.tv-points.many .ticket-number { font-size: calc(var(--u) * 10); }
.tv-points.many .ticket-stub { font-size: calc(var(--u) * 2.6); }
/* Where the browser can measure the ticket itself, the number takes the width it really has. */
@supports (width: 1cqw) {
  .tv-points .ticket-number, .tv-points.many .ticket-number { font-size: min(calc(var(--u) * 24), 54cqw); }
  .tv-points .ticket-number.is-long, .tv-points.many .ticket-number.is-long { font-size: min(calc(var(--u) * 24), 41cqw); }
}
.tv-single .ticket-number.is-long { font-size: calc(var(--u) * 24); }
.tv .ticket.is-empty .ticket-caption { font-size: calc(var(--u) * 3.2); }

/* the single moment of motion: a number has just been called */
.ticket.is-called { animation: called-bg 9s ease-out both; }
.ticket.is-called .ticket-number { animation: called-pop .9s cubic-bezier(.2,.9,.25,1) both; }
@keyframes called-bg { 0%, 55% { background: var(--yellow); } 100% { background: #fff; } }
@keyframes called-pop { 0% { transform: scale(.72); opacity: .2; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }

.tv-note { position: fixed; left: 50%; bottom: calc(var(--u) * 2); transform: translateX(-50%); z-index: 10; background: var(--yellow); color: var(--deep); border: 0; border-radius: calc(var(--u) * 1); padding: calc(var(--u) * 1) calc(var(--u) * 2.2); font: 600 calc(var(--u) * 2) var(--text); cursor: pointer; }
.tv-note.offline { background: #FCA5A5; cursor: default; }

/* ---------- admin ---------- */

/* Which administrator is signed in. Violet = LEOSS (all customers), teal = one customer's administrator. */
.admin-mode { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 12px 16px; margin-bottom: 24px; border-radius: var(--radius); border-left: 6px solid; }
.admin-mode b { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .04em; }
.admin-mode-super { background: #EDE9FE; color: #4C1D95; border-color: #7C3AED; }
.admin-mode-tenant { background: #CCFBF1; color: #134E4A; border-color: #0D9488; }
.admin-section { margin-top: 40px; }
/* main administrator: choosing the customer, then the bar that names it */
.customer-search { width: 100%; font: inherit; font-size: 1.15rem; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff; }
.customer-search:focus { outline: 3px solid rgba(0, 166, 211, .35); border-color: var(--cyan-dark); }
.customer-list { display: grid; gap: 8px; margin-top: 12px; max-height: 60vh; overflow-y: auto; }
.customer-item { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; font: inherit; padding: 14px 16px; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.customer-item:hover, .customer-item:focus-visible { border-color: var(--cyan-dark); background: #F0FAFD; }
.customer-item b { font-size: 1.1rem; }
.customer-item.is-current { border-color: var(--cyan-dark); }
.customer-counts { margin-left: auto; color: var(--muted); font-size: .95rem; white-space: nowrap; }
.customer-current { color: var(--cyan-dark); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.customer-none { padding: 14px 4px; }
.customer-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.customer-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-top: 28px; padding: 16px 20px; background: #fff; border: 1.5px solid var(--line); border-left: 6px solid var(--cyan-dark); border-radius: var(--radius); }
.customer-bar-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.customer-bar-name b { font-size: 1.5rem; }
.admin-system { margin-top: 72px; padding-top: 28px; border-top: 1.5px solid var(--line); }
@media (max-width: 640px) { .customer-counts { display: none; } }
.admin-section > header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.admin-section > header p { margin-top: 4px; max-width: 62ch; }
table.grid { width: 100%; border-collapse: collapse; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.grid th { text-align: left; font-weight: 600; font-size: .9rem; color: var(--muted); padding: 10px 14px; border-bottom: 1.5px solid var(--line); background: #F1F5F9; }
table.grid td { padding: 10px 14px; border-bottom: 1px solid #E2E8F0; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid td.actions { text-align: right; white-space: nowrap; }
table.grid td.actions .btn { margin-left: 6px; }
.service-box { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 24px; }
.service-code { font: 700 2.6rem var(--digits); letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.logo-preview { display: block; max-width: 280px; max-height: 110px; background: #fff; border: 1px solid #E2E8F0; border-radius: 8px; padding: 10px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .85rem; font-weight: 600; background: #E2E8F0; color: var(--muted); }
.tag-on { background: #CCFBF1; color: #134E4A; }
.cell-note { display: block; margin-top: 3px; font-size: .85rem; color: var(--muted); word-break: break-all; font-weight: 400; }
.table-wrap { overflow-x: auto; }

dialog.form { border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(8,36,47,.35); }
dialog.form::backdrop { background: rgba(8,36,47,.55); }
dialog.form form { padding: 26px 28px 24px; display: grid; gap: 16px; }
dialog.form .buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
fieldset.checks { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 10px 14px 12px; margin: 0; display: grid; gap: 8px; }
fieldset.checks legend { font-weight: 500; font-size: .95rem; padding: 0 6px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50; background: var(--deep); color: #fff; padding: 12px 20px; border-radius: var(--radius); font-weight: 500; max-width: calc(100vw - 32px); }
.toast.error { background: #7F1D1D; }

/* ---------- paper ticket (browser printing) ---------- */

#print-ticket { display: none; }
@media print {
  @page { size: 80mm 90mm; margin: 4mm; }
  body > *:not(#print-ticket) { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  #print-ticket { display: block; text-align: center; font-family: var(--text); color: #000; }
  #print-ticket .p-logo { display: block; max-width: 56mm; max-height: 22mm; margin: 0 auto 3mm; }
  #print-ticket .p-tenant { font-size: 12pt; font-weight: 600; }
  #print-ticket .p-queue { font-size: 11pt; margin-top: 1mm; }
  #print-ticket .p-number { font: 700 64pt/1 var(--digits); margin: 4mm 0 3mm; }
  #print-ticket .p-meta { font-size: 10pt; }
  #print-ticket .p-foot { font-size: 8pt; margin-top: 4mm; }
}

@media (prefers-reduced-motion: reduce) {
  .ticket.is-called .ticket-number, .issued .ticket { animation: none; }
  .kiosk-button { transition: none; }
}
