/* Public screens: kiosk, queue display, token tracking, printed ticket */
:root {
  --navy-950: #0D1530;
  --navy-900: #142040;
  --navy-800: #1B2A50;
  --navy-700: #24376A;
  --blue-600: #1F62B5;
  --blue-500: #2E74C9;
  --accent: #D9472B;
  --line: #DFE3EA;
  --text: #18202F;
  --text-3: #6F788C;
  --font: 'Roboto', 'Noto Sans Arabic', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--text); -webkit-font-smoothing: antialiased; }
button { font-family: var(--font); }
[hidden] { display: none !important; }
[dir=rtl] { font-family: 'Noto Sans Arabic', var(--font); }

/* =================== KIOSK =================== */
body.kiosk {
  background: #F3F5F8; display: flex; flex-direction: column; min-height: 100vh;
  user-select: none; -webkit-user-select: none; touch-action: manipulation; overflow: hidden;
}
.k-head { background: var(--navy-900); color: #fff; display: flex; align-items: center; padding: 18px 36px; }
.k-brand { display: flex; align-items: center; gap: 16px; }
.k-mark, .d-mark {
  background: #fff; color: var(--navy-800); font-weight: 700; letter-spacing: .5px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center; position: relative;
}
.k-mark { font-size: 22px; height: 48px; padding: 0 13px; }
.k-mark::after, .d-mark::after { content: ''; position: absolute; top: 9px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.k-c1 { font-size: 19px; font-weight: 500; }
.k-c2 { font-size: 16px; color: #A9B4CB; margin-top: 2px; text-align: left; }
.k-time { margin-left: auto; text-align: right; display: flex; flex-direction: column; }
.k-time b { font-size: 30px; font-weight: 500; line-height: 1.1; }
.k-time span { font-size: 14px; color: #A9B4CB; }

.k-main { flex: 1; padding: 34px 48px; display: flex; flex-direction: column; overflow-y: auto; animation: kIn .25s ease-out; }
@keyframes kIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.k-foot { background: #fff; border-top: 1px solid var(--line); padding: 14px 36px; display: flex; align-items: center; gap: 24px; }
.k-steps { display: flex; gap: 6px; }
.k-steps span { font-size: 13px; padding: 6px 12px; border-radius: 3px; background: #EEF1F5; color: var(--text-3); }
.k-steps span.on { background: var(--navy-800); color: #fff; }
.k-help { margin-left: auto; font-size: 15px; color: var(--text-3); }

.k-welcome { text-align: center; margin: 4vh 0 5vh; }
.k-welcome h1 { font-size: 46px; font-weight: 300; margin: 0; color: var(--navy-900); }
.k-welcome p { font-size: 20px; color: var(--text-3); margin: 14px 0 0; }
.sep { color: #B8C0CE; margin: 0 6px; }
.k-langs { display: grid; grid-template-columns: repeat(3, minmax(0, 300px)); gap: 22px; justify-content: center; }
.k-langs button, .k-mode, .k-svc {
  background: #fff; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--text);
  box-shadow: 0 1px 2px rgba(20,32,64,.04); transition: transform .08s, box-shadow .15s, border-color .15s;
}
.k-langs button:active, .k-mode:active, .k-svc:active { transform: scale(.985); }
.k-langs button:hover, .k-mode:hover, .k-svc:hover { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(46,116,201,.12); }
.k-langs button { height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border-top: 5px solid var(--navy-800); }
.k-langs b { font-size: 40px; font-weight: 500; }
.k-langs span { font-size: 16px; color: var(--text-3); }

.k-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.k-back { display: inline-flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--line); background: #fff; border-radius: 6px; height: 52px; padding: 0 20px; font-size: 18px; cursor: pointer; color: var(--text); }
[dir=rtl] .k-back svg { transform: scaleX(-1); }
.k-lang-sw { background: none; border: 0; font-size: 16px; color: var(--blue-600); cursor: pointer; padding: 10px; }
.k-title { font-size: 34px; font-weight: 400; margin: 6px 0 26px; color: var(--navy-900); text-align: center; }

.k-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 420px)); gap: 26px; justify-content: center; margin-top: 3vh; }
.k-mode { height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.k-mode svg { color: var(--blue-600); }
.k-mode b { font-size: 28px; font-weight: 500; }
.k-mode span { font-size: 17px; color: var(--text-3); line-height: 1.4; }

.k-svcs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; max-width: 1300px; width: 100%; margin: 0 auto; }
.k-svc { min-height: 120px; display: flex; align-items: center; gap: 18px; padding: 18px 22px; text-align: start; border-inline-start: 6px solid var(--c); position: relative; }
.k-svc i { font-style: normal; width: 54px; height: 54px; flex: none; border-radius: 6px; background: var(--c); color: #fff; font-size: 26px; font-weight: 700; display: flex; align-items: center; justify-content: center; font-family: 'Roboto', sans-serif; }
.k-svc b { display: block; font-size: 22px; font-weight: 500; line-height: 1.3; }
.k-svc .en { display: block; font-size: 14px; color: var(--text-3); margin-top: 3px; font-family: 'Roboto', sans-serif; }
.k-svc.has-badge { padding-top: 34px; }
.k-svc em { position: absolute; top: 10px; inset-inline-end: 12px; font-style: normal; font-size: 12px; font-weight: 500; background: #C23B2A; color: #fff; padding: 2px 8px; border-radius: 3px; }

.k-appt { max-width: 520px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; align-items: stretch; }
.k-ref { height: 84px; border: 2px solid var(--navy-800); border-radius: 8px; background: #fff; display: flex; align-items: center; padding: 0 22px; font-size: 40px; font-weight: 500; letter-spacing: 2px; direction: ltr; font-family: 'Roboto', sans-serif; }
.k-ref .pre { color: var(--text-3); }
.k-ref .caret { width: 2px; height: 44px; background: var(--blue-600); margin-left: 3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.k-hint { font-size: 15px; color: var(--text-3); text-align: center; margin: 12px 0 8px; }
.k-err { background: #FBECEA; border: 1px solid #EBC4BE; color: #9E2E20; border-radius: 6px; padding: 12px 16px; font-size: 16px; text-align: center; margin: 6px 0 4px; }
.k-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 14px 0 16px; }
.k-pad button { height: 78px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 32px; font-weight: 500; cursor: pointer; color: var(--text); display: flex; align-items: center; justify-content: center; }
.k-pad button:active { background: #E9EEF5; }
.k-pad button.fn { font-size: 18px; color: var(--text-3); background: #F7F8FA; }
.k-primary { height: 76px; border: 0; border-radius: 8px; background: var(--blue-600); color: #fff; font-size: 24px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 12px; padding: 0 34px; }
.k-primary:active { background: #18508F; }
.k-secondary { height: 76px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); font-size: 20px; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; padding: 0 26px; }
.k-scan { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text-3); font-size: 15px; margin-top: 18px; }
.k-scan-in { position: absolute; left: -9999px; opacity: 0; }

.k-confirm { max-width: 640px; width: 100%; margin: 3vh auto 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 36px 40px; text-align: center; }
.k-confirm h2 { font-size: 28px; font-weight: 500; margin: 14px 0 22px; }
.k-ok { width: 64px; height: 64px; border-radius: 50%; background: #E8F4EE; color: #1E7F4F; display: inline-flex; align-items: center; justify-content: center; }
.k-confirm dl { display: grid; grid-template-columns: auto 1fr; gap: 12px 24px; text-align: start; font-size: 19px; margin: 0 0 30px; padding: 20px 0; border-top: 1px solid #ECEFF3; border-bottom: 1px solid #ECEFF3; }
.k-confirm dt { color: var(--text-3); }
.k-confirm dd { margin: 0; font-weight: 500; }
.k-confirm .k-primary { width: 100%; }

.k-printing { margin: auto; text-align: center; }
.k-printing h2 { font-weight: 400; font-size: 28px; color: var(--navy-900); margin-top: 24px; }
.k-paper { width: 150px; height: 120px; margin: 0 auto; border-radius: 6px 6px 0 0; background: #fff; border: 1px solid var(--line); border-bottom: 0; position: relative; overflow: hidden; animation: feed 1.1s ease-out forwards; transform-origin: top; }
.k-paper i { display: block; height: 8px; background: #E6EAF0; margin: 18px 20px 0; border-radius: 2px; }
.k-paper i:nth-child(2) { width: 60%; margin-left: auto; margin-right: auto; height: 22px; background: var(--navy-800); }
@keyframes feed { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }

.k-ticket { margin: 2vh auto 0; max-width: 760px; width: 100%; text-align: center; }
.k-tk-card { background: var(--navy-900); color: #fff; border-radius: 12px; padding: 34px 36px 0; overflow: hidden; }
.k-tk-card .lbl { font-size: 18px; color: #A9B4CB; letter-spacing: .5px; }
.k-token { font-size: 150px; font-weight: 700; line-height: 1.05; letter-spacing: 4px; margin: 6px 0 4px; font-family: 'Roboto', sans-serif; }
.k-tk-svc { font-size: 22px; color: #D5DCEA; margin-bottom: 26px; }
.k-tk-stats { display: grid; grid-template-columns: 1fr 1fr; margin: 0 -36px; background: rgba(255,255,255,.06); }
.k-tk-stats div { padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.k-tk-stats div + div { border-inline-start: 1px solid rgba(255,255,255,.1); }
.k-tk-stats span { font-size: 15px; color: #A9B4CB; }
.k-tk-stats b { font-size: 34px; font-weight: 500; }
.k-tk-stats small { font-size: 16px; font-weight: 400; }
.k-next { font-size: 20px; color: #3C465A; line-height: 1.5; margin: 26px 20px; }
.k-tk-actions { display: flex; gap: 14px; justify-content: center; }
.k-tk-actions .k-primary { min-width: 260px; }

@media (orientation: portrait) {
  .k-svcs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .k-langs { grid-template-columns: minmax(0, 520px); }
  .k-langs button { height: 150px; }
  .k-modes { grid-template-columns: minmax(0, 560px); }
  .k-mode { height: 240px; }
  .k-steps { display: none; }
}
@media (max-width: 900px) {
  .k-main { padding: 20px; }
  .k-svcs, .k-langs, .k-modes { grid-template-columns: 1fr; }
  .k-token { font-size: 96px; }
  .k-head { padding: 14px 18px; }
  .k-c2, .k-steps { display: none; }
}

/* printed thermal ticket (80 mm) */
#printArea { display: none; }
@media print {
  @page { size: 80mm auto; margin: 3mm; }
  body.kiosk { background: #fff; display: block; overflow: visible; }
  body.kiosk > *:not(#printArea) { display: none !important; }
  #printArea { display: block; }
}
.pt { width: 72mm; font-family: 'Roboto', Arial, sans-serif; color: #000; text-align: center; }
.pt-brand { font-size: 20pt; font-weight: 700; letter-spacing: 1px; }
.pt-c { font-size: 9pt; }
.pt-rule { border-top: 1px dashed #000; margin: 3mm 0; }
.pt-l { font-size: 8pt; letter-spacing: .5px; }
.pt-token { font-size: 46pt; font-weight: 700; line-height: 1.05; letter-spacing: 2px; }
.pt-svc { font-size: 10.5pt; font-weight: 500; }
.pt-row { display: flex; justify-content: space-between; font-size: 9pt; margin-top: 1.2mm; text-align: left; }
.pt-qr { width: 26mm; margin: 0 auto 1.5mm; }
.pt-qr svg { width: 100%; height: auto; display: block; }
.pt-small { font-size: 7.5pt; margin-top: 1mm; }

/* =================== DISPLAY =================== */
body.display {
  font-size: 0.8333vw; /* 16px at 1920px wide */
  background: var(--navy-950); color: #fff; height: 100vh; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto; cursor: none;
}
body.display:hover { cursor: default; }
.d-head { display: flex; align-items: center; padding: 1.4em 2.6em; background: var(--navy-900); border-bottom: .25em solid var(--blue-600); }
.d-brand { display: flex; align-items: center; gap: 1.1em; min-width: 30%; }
.d-mark { font-size: 2em; height: 2.2em; padding: 0 .55em; }
.d-mark::after { top: .45em; right: .35em; width: .28em; height: .28em; }
.d-c1 { font-size: 1.55em; font-weight: 500; }
.d-c2 { font-size: 1.25em; color: #A9B4CB; text-align: left; }
.d-title { flex: 1; text-align: center; font-size: 2em; font-weight: 300; letter-spacing: .02em; }
.d-clock { min-width: 30%; text-align: right; display: flex; flex-direction: column; }
.d-clock b { font-size: 3.2em; font-weight: 500; line-height: 1; }
.d-clock span { font-size: 1.15em; color: #A9B4CB; margin-top: .3em; }

.d-main { display: grid; grid-template-columns: 62fr 38fr; gap: 2em; padding: 2em 2.6em; min-height: 0; }
.d-serving { display: flex; flex-direction: column; min-height: 0; }
.d-th { display: grid; grid-template-columns: 1fr 1.3fr; padding: 0 1.6em .8em; font-size: 1.2em; color: #8E9AB3; text-transform: uppercase; letter-spacing: .08em; }
.d-th span { text-transform: none; letter-spacing: 0; margin-inline-start: .6em; color: #6F7C98; }
.d-rows { flex: 1; min-height: 0; display: grid; grid-template-rows: repeat(var(--rows, 7), minmax(0, 1fr)); gap: .6em; }
.d-row { display: grid; grid-template-columns: 1fr 1.3fr; align-items: center; background: var(--navy-800); border-radius: .4em; padding: 0 1.6em; border-inline-start: .45em solid transparent; min-height: 0; overflow: hidden; }
.d-tok { font-size: 4.2em; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.d-ctr span { font-size: 2.6em; font-weight: 500; display: block; line-height: 1.1; }
.d-ctr small { font-size: 1.35em; color: #A9B4CB; display: block; text-align: left; }
.d-row.latest { background: #fff; color: var(--navy-900); border-color: var(--accent); }
.d-row.latest .d-ctr small { color: #5B6680; }
.d-row.fresh .d-tok { animation: pulse 1s ease-in-out 6; }
@keyframes pulse { 50% { opacity: .25; } }
.d-empty { grid-row: 1 / -1; align-self: start; font-size: 2em; color: #8E9AB3; text-align: center; padding: 3em 1em; line-height: 1.6; background: var(--navy-900); border-radius: .4em; }

.d-side { display: flex; flex-direction: column; gap: 1.4em; min-height: 0; }
.d-queues { display: flex; flex-direction: column; gap: .9em; }
.d-q { background: var(--navy-900); border-radius: .4em; padding: 1.1em 1.4em; border: 1px solid rgba(255,255,255,.06); }
.d-q-h { display: flex; align-items: baseline; justify-content: space-between; }
.d-q-h b { font-size: 1.45em; font-weight: 500; }
.d-q-h span { font-size: 1.3em; color: #F2C46B; font-weight: 500; }
.d-q-next { display: flex; gap: .5em; align-items: center; margin-top: .8em; flex-wrap: wrap; }
.d-q-next em { font-style: normal; color: #8E9AB3; font-size: 1.1em; margin-inline-end: .3em; }
.d-q-next i { font-style: normal; font-size: 1.3em; font-weight: 500; background: rgba(255,255,255,.08); padding: .15em .55em; border-radius: .25em; }
.d-info { flex: 1; background: var(--blue-600); border-radius: .4em; min-height: 0; display: flex; }
.d-info-in { padding: 1.6em 1.8em; display: flex; flex-direction: column; width: 100%; }
.d-info-l { font-size: 1em; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.7); margin-bottom: .6em; }
.d-info p { font-size: 1.65em; line-height: 1.4; margin: 0 0 .6em; }
.d-info p.ar, .d-info p.ur { font-size: 1.5em; color: rgba(255,255,255,.88); }
.d-dots { margin-top: auto; display: flex; gap: .4em; }
.d-dots i { width: .5em; height: .5em; border-radius: 50%; background: rgba(255,255,255,.3); }
.d-dots i.on { background: #fff; }

.d-ticker { background: #fff; color: var(--navy-900); height: 3.6em; overflow: hidden; display: flex; align-items: center; border-top: .25em solid var(--accent); }
.d-ticker-in { display: flex; white-space: nowrap; animation: tick var(--dur, 60s) linear infinite; }
.d-ticker .seg { display: flex; align-items: center; flex: none; }
.d-ticker span { font-size: 1.5em; padding: 0 1.4em; }
.d-ticker b { color: var(--accent); font-size: 1.2em; }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.d-call { position: fixed; inset: 0; background: rgba(9,14,32,.82); display: flex; align-items: center; justify-content: center; z-index: 50; animation: fadeIn .25s; }
@keyframes fadeIn { from { opacity: 0; } }
.d-call-box { background: #fff; color: var(--navy-900); border-radius: .8em; padding: 2.6em 5em 3em; text-align: center; min-width: 50%; border-top: .8em solid var(--accent); animation: pop .35s cubic-bezier(.2,.9,.3,1.2); }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }
.d-call-l { font-size: 1.8em; color: #5B6680; text-transform: uppercase; letter-spacing: .1em; }
.d-call-l span { text-transform: none; letter-spacing: 0; margin-inline-start: .5em; }
.d-call-token { font-size: 11em; font-weight: 700; line-height: 1.05; letter-spacing: .03em; }
.d-call-arrow svg { width: 4em; height: 4em; color: var(--blue-600); }
.d-call-ctr { font-size: 5em; font-weight: 500; line-height: 1.1; }
.d-call-ctr-l { font-size: 2.4em; color: #5B6680; margin-top: .2em; }

.d-sound { position: fixed; right: 2.6em; bottom: 5em; background: #F2C46B; color: #3D2A05; border: 0; border-radius: .4em; padding: .8em 1.2em; font-size: 1.1em; font-weight: 500; display: flex; align-items: center; gap: .6em; cursor: pointer; z-index: 40; }
body.offline .d-head { border-bottom-color: #C23B2A; }

/* =================== TRACK =================== */
body.track { background: #F3F5F8; min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 24px 16px; }
.tr-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tr-top { background: var(--navy-900); color: #fff; padding: 22px 24px; text-align: center; }
.tr-top .k-mark { font-size: 16px; height: 34px; padding: 0 9px; }
.tr-top .k-mark::after { top: 7px; right: 6px; width: 4px; height: 4px; }
.tr-top p { margin: 10px 0 0; font-size: 13px; color: #A9B4CB; }
.tr-token { font-size: 72px; font-weight: 700; letter-spacing: 2px; line-height: 1.1; margin-top: 8px; }
.tr-svc { color: #D5DCEA; font-size: 15px; }
.tr-body { padding: 22px 24px; }
.tr-state { text-align: center; padding: 16px; border-radius: 8px; background: #EEF4FB; color: #18508F; font-size: 17px; font-weight: 500; }
.tr-state.called { background: #E8F4EE; color: #17633E; }
.tr-state.closed { background: #F0F1F4; color: #4F596C; }
.tr-state b { display: block; font-size: 30px; margin-top: 4px; }
.tr-dl { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 20px 0 0; font-size: 14px; }
.tr-dl dt { color: var(--text-3); }
.tr-dl dd { margin: 0; font-weight: 500; text-align: right; }
.tr-foot { font-size: 12px; color: var(--text-3); text-align: center; margin-top: 18px; }
