/* =========================================================
   KIOSK LẤY SỐ – QMS ĐA ĐIỂM (Bản demo giao diện)
   Canvas thiết kế: 1080 × 1920 px (màn hình 27" dọc, 9:16)
   Mọi kích thước tính theo canvas; JS tự scale cho vừa màn hình.
   ========================================================= */

:root {
  /* Bảng màu theo tài liệu đặc tả (mục V.1.1) */
  --cobalt: #0047AB;
  --cobalt-700: #003A8C;
  --cobalt-900: #002A66;
  --cobalt-100: #CFE0F7;
  --cobalt-50: #EAF1FB;
  --gold: #FFCC00;
  --orange: #FF8800;
  --orange-ink: #7A3E00;
  --orange-50: #FFF4E5;
  --red: #DA251D;
  --red-50: #FDECEA;
  --green: #1B873F;
  --green-50: #E7F5EC;
  --amber-ink: #7A4B00;
  --amber-50: #FFF6D6;

  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --line: #DCE3EC;
  --ink: #14213D;
  --ink-2: #4A5568;

  --font: "Be Vietnam Pro", "Roboto", "Inter", "Segoe UI", sans-serif;
  --num: "Oswald", "Roboto Condensed", sans-serif;

  --r-lg: 28px;
  --r-xl: 32px;
  --shadow: 0 2px 0 rgba(0, 40, 100, .04), 0 22px 44px -26px rgba(0, 40, 100, .45);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: radial-gradient(ellipse at 30% 20%, #16305E 0%, #0A1631 60%, #060D1F 100%);
  overflow: hidden;
  color: var(--ink);
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.ic { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Sân khấu demo & khung kiosk ---------- */
.stage { height: 100vh; display: flex; align-items: center; justify-content: center; gap: 28px; padding: 16px; }
.kiosk-frame { position: relative; flex: none; border-radius: 18px; box-shadow: 0 0 0 10px #1D2433, 0 0 0 12px #39445C, 0 40px 80px rgba(0,0,0,.55); }
body.is-kiosk .stage { padding: 0; }
body.is-kiosk .kiosk-frame { border-radius: 0; box-shadow: none; }
body.is-kiosk .demo-panel { display: none; }

.kiosk {
  position: absolute; top: 0; left: 0;
  width: 1080px; height: 1920px;
  transform-origin: 0 0;
  background: var(--bg);
  overflow: hidden;
  user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  border-radius: inherit;
  font-size: 32px; line-height: 1.45;
}

/* ---------- Header 160px ---------- */
.k-header {
  position: relative; z-index: 5;
  height: 160px; padding: 0 44px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: linear-gradient(100deg, var(--cobalt-900) 0%, var(--cobalt) 55%, #0A5BC9 100%);
  color: #fff;
  border-bottom: 6px solid var(--gold);
}
.k-header::after { /* hoa văn chấm mờ */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.09) 2px, transparent 2px);
  background-size: 22px 22px;
  mask-image: linear-gradient(90deg, transparent 40%, #000);
  -webkit-mask-image: linear-gradient(90deg, transparent 40%, #000);
}
.brand { flex: 1; display: flex; align-items: center; gap: 18px; position: relative; z-index: 1; min-width: 0; }
.logo {
  width: 100px; height: 100px; border-radius: 50%; flex: none;
  background: #fff; color: var(--cobalt); border: 4px solid var(--gold);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 46px;
}
.logo span { font-size: 15px; font-weight: 800; letter-spacing: .1em; line-height: 1; margin-top: 2px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 23px; font-weight: 800; line-height: 1.35; }
.brand-text .org2 { font-size: 23px; font-weight: 700; line-height: 1.35; color: #FFE27A; }
.net-pill {
  display: inline-flex; align-items: center; align-self: flex-start;
  margin-top: 6px; height: 34px; padding: 0 14px; border-radius: 17px;
  background: rgba(255,255,255,.14); font-size: 19px; font-weight: 500;
}
.net-pill i { width: 12px; height: 12px; border-radius: 50%; background: #4ADE80; margin-right: 10px; box-shadow: 0 0 0 4px rgba(74,222,128,.25); animation: pulseDot 2s infinite; }
.net-pill b { font-weight: 700; }
.kiosk.is-offline .net-pill { background: var(--gold); color: var(--cobalt-900); }
.kiosk.is-offline .net-pill i { background: var(--red); box-shadow: 0 0 0 4px rgba(218,37,29,.25); }

.hdr-right { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; flex: none; }
.clock { text-align: right; line-height: 1; }
.clock-time { display: block; font-family: var(--num); font-size: 54px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.clock-date { display: block; font-size: 20px; font-weight: 500; opacity: .85; margin-top: 6px; white-space: nowrap; }
.lang { display: flex; gap: 4px; padding: 6px; height: 76px; border-radius: 38px; border: 2px solid rgba(255,255,255,.45); background: rgba(255,255,255,.08); }
.lang span { min-width: 60px; height: 60px; border-radius: 30px; display: grid; place-items: center; font-size: 26px; font-weight: 800; transition: background .25s, color .25s; }
.lang span.on { background: #fff; color: var(--cobalt); }

/* ---------- Khung màn hình & chuyển cảnh ---------- */
.screens { position: absolute; top: 160px; left: 0; right: 0; bottom: 0; }
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: 36px 48px 32px;
  opacity: 0; visibility: hidden; transform: translateX(70px);
  transition: opacity .42s var(--ease), transform .42s var(--ease), visibility 0s linear .42s;
}
.screen.is-active { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.screen--center { align-items: center; justify-content: center; text-align: center; }

/* ---------- Tiêu đề bước ---------- */
.step-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; min-height: 128px; margin-bottom: 30px; }
.step-head h2 { font-size: 52px; font-weight: 800; line-height: 1.25; color: var(--cobalt-900); }
.step-head p { font-size: 30px; color: var(--ink-2); margin-top: 6px; }
.crumb { display: inline-flex; align-items: center; gap: 10px; font-size: 30px; font-weight: 700; color: var(--cobalt); margin-bottom: 6px; }
.steps { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; padding-bottom: 8px; }
.steps-label { font-size: 26px; font-weight: 600; color: var(--ink-2); }
.steps-bar { display: flex; gap: 10px; }
.steps-bar i { width: 54px; height: 12px; border-radius: 6px; background: var(--line); transition: background .4s; }
.steps[data-step="1"] i:nth-child(-n+1),
.steps[data-step="2"] i:nth-child(-n+2),
.steps[data-step="3"] i:nth-child(-n+3) { background: var(--cobalt); }

/* ---------- Hiệu ứng xuất hiện so le ---------- */
.screen.is-active .rise { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms + 80ms); }
@keyframes rise { from { opacity: 0; transform: translateY(36px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Hiệu ứng chạm (ripple) ---------- */
.pressable { position: relative; overflow: hidden; transition: transform .14s ease, box-shadow .2s, border-color .2s; }
.pressable.is-pressed { transform: scale(.97); }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%) scale(0); background: currentColor; opacity: .18; animation: ripple .6s ease-out forwards; }
@keyframes ripple { to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }

/* =========================================================
   S0. MÀN HÌNH CHỜ
   ========================================================= */
.screen--idle { padding: 0; background: linear-gradient(170deg, #0A57C2 0%, var(--cobalt) 40%, var(--cobalt-900) 100%); color: #fff; cursor: pointer; }
.idle-bg { position: absolute; inset: 0; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; }
.b1 { width: 620px; height: 620px; background: #2F80ED; top: -140px; left: -160px; animation: drift1 16s ease-in-out infinite alternate; }
.b2 { width: 520px; height: 520px; background: #00A3FF; top: 420px; right: -200px; animation: drift2 19s ease-in-out infinite alternate; }
.b3 { width: 420px; height: 420px; background: rgba(255, 204, 0, .55); bottom: 380px; left: 120px; animation: drift3 22s ease-in-out infinite alternate; opacity: .28; }
@keyframes drift1 { to { transform: translate(180px, 160px) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-220px, -120px) scale(.9); } }
@keyframes drift3 { to { transform: translate(260px, -140px) scale(1.2); } }
.skyline { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 560px; }
.river { animation: wave 6s ease-in-out infinite alternate; transform-origin: center bottom; }
@keyframes wave { to { transform: translateX(-30px) scaleY(1.4); } }

.idle-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 150px 64px 0; }
.idle-kicker { font-size: 34px; font-weight: 600; color: #FFE27A; letter-spacing: .04em; text-transform: uppercase; animation: rise .8s var(--ease) both .1s; }
.idle-title { font-size: 112px; font-weight: 800; line-height: 1.15; margin-top: 20px; text-wrap: balance; animation: rise .8s var(--ease) both .2s; }
.idle-sub { font-size: 32px; opacity: .9; margin-top: 28px; max-width: 760px; animation: rise .8s var(--ease) both .3s; }

.idle-cta { position: relative; margin-top: 110px; width: 760px; height: 200px; animation: rise .8s var(--ease) both .45s; }
.cta-core {
  position: relative; z-index: 2; height: 100%; border-radius: 100px;
  display: flex; align-items: center; justify-content: center; gap: 24px;
  background: var(--gold); color: var(--cobalt-900);
  font-size: 44px; font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 26px 50px -18px rgba(0, 0, 0, .55), inset 0 -6px 0 rgba(0, 0, 0, .1);
  animation: breathe 2.4s ease-in-out infinite;
}
.cta-core .ic { font-size: 64px; animation: tap 2.4s ease-in-out infinite; }
.ring { position: absolute; inset: 0; border-radius: 100px; border: 4px solid rgba(255, 204, 0, .8); animation: ring 2.4s ease-out infinite; }
.r2 { animation-delay: .8s; } .r3 { animation-delay: 1.6s; }
@keyframes ring { from { transform: scale(1); opacity: .9; } to { transform: scale(1.22, 1.6); opacity: 0; } }
@keyframes breathe { 50% { transform: scale(1.035); } }
@keyframes tap { 0%, 60%, 100% { transform: none; } 70% { transform: translateY(8px) scale(.92); } 80% { transform: none; } }

.idle-qr {
  position: absolute; z-index: 1; left: 48px; right: 48px; bottom: 48px;
  display: flex; align-items: center; gap: 28px;
  padding: 28px 32px; border-radius: var(--r-xl);
  background: rgba(255, 255, 255, .12); border: 2px solid rgba(255, 255, 255, .25);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.idle-qr-text { flex: 1; display: flex; flex-direction: column; }
.idle-qr-text strong { font-size: 36px; font-weight: 800; line-height: 1.3; }
.idle-qr-text span { font-size: 28px; opacity: .9; line-height: 1.4; }

/* ---------- Ô QR & mũi tên dùng chung ---------- */
.qr-ic { position: relative; flex: none; width: 128px; height: 128px; border-radius: 24px; background: #fff; color: var(--cobalt); display: grid; place-items: center; font-size: 84px; overflow: hidden; }
.qr-ic--light { width: 112px; height: 112px; font-size: 72px; }
.scanline { position: absolute; left: 12px; right: 12px; height: 4px; border-radius: 2px; background: var(--red); box-shadow: 0 0 14px 2px rgba(218, 37, 29, .7); animation: scan 2.2s ease-in-out infinite; }
@keyframes scan { 0%, 100% { top: 14px; } 50% { top: calc(100% - 18px); } }
.qr-arrow { flex: none; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; font-size: 48px; background: var(--cobalt); color: #fff; animation: bob 1.4s ease-in-out infinite; }
.idle-qr .qr-arrow { background: var(--gold); color: var(--cobalt-900); }
.qr-arrow--big { width: 120px; height: 120px; font-size: 64px; margin-top: 40px; }
@keyframes bob { 50% { transform: translateY(14px); } }

/* =========================================================
   S1. MENU LĨNH VỰC
   ========================================================= */
.tile-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 28px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  padding: 34px 34px 28px; border-radius: var(--r-lg);
  background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow);
  color: var(--ink);
}
.tile::after { content: ""; position: absolute; right: -90px; top: -90px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, var(--cobalt-50) 0%, transparent 70%); pointer-events: none; z-index: 0; }
.tile > *:not(.load):not(.tile-more):not(.ripple) { position: relative; z-index: 1; }
.tile .load, .tile .tile-more { z-index: 1; }
.tile.is-pressed { border-color: var(--cobalt); }
.tile-ic { width: 104px; height: 104px; border-radius: 26px; display: grid; place-items: center; font-size: 58px; color: #fff; background: linear-gradient(145deg, #1C6FE0, var(--cobalt) 60%, var(--cobalt-700)); box-shadow: 0 14px 26px -12px rgba(0, 71, 171, .75); }
.tile-name { margin-top: 24px; font-size: 44px; font-weight: 800; line-height: 1.25; color: var(--cobalt-900); text-transform: uppercase; }
.tile-dept { margin-top: 4px; font-size: 28px; line-height: 1.35; color: var(--ink-2); }
.tile-meta { margin-top: auto; width: 100%; padding-top: 18px; border-top: 2px dashed var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 28px; font-weight: 600; }
.tile-meta > span { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.tile-meta .ic { font-size: 32px; color: var(--cobalt); }
.tile-meta b { font-family: var(--num); font-size: 34px; font-weight: 600; font-variant-numeric: tabular-nums; display: inline-block; }
.tile-more { position: absolute; right: 30px; top: 132px; display: inline-flex; align-items: center; gap: 4px; font-size: 26px; font-weight: 700; color: var(--cobalt); }
.load { position: absolute; top: 34px; right: 30px; height: 46px; padding: 0 16px; border-radius: 23px; display: inline-flex; align-items: center; gap: 8px; font-size: 24px; font-weight: 700; }
.load::before { content: ""; width: 12px; height: 12px; border-radius: 50%; background: currentColor; }
.load--low { background: var(--green-50); color: var(--green); }
.load--mid { background: var(--amber-50); color: var(--amber-ink); }
.load--high { background: var(--red-50); color: #B01E17; }
.tick { animation: tick .7s var(--ease); }
@keyframes tick { 0% { transform: translateY(-10px); opacity: 0; color: var(--red); } 100% { transform: none; opacity: 1; } }

.tile--priority { background: var(--orange-50); border-color: #FFC97A; }
.tile--priority::after { background: radial-gradient(circle, #FFE2B8 0%, transparent 70%); }
.tile--priority .tile-ic { background: linear-gradient(145deg, #FFA53D, var(--orange) 60%, #E06F00); box-shadow: 0 14px 26px -12px rgba(255, 136, 0, .8); }
.tile--priority .tile-name { color: var(--orange-ink); }
.tile--priority .tile-meta { border-color: #FFD59C; color: var(--orange-ink); }
.tile--priority .tile-meta .ic { color: var(--orange); }
.tile--priority.is-pressed { border-color: var(--orange); }

.tile.is-out { background: #EEF1F5; border-style: dashed; box-shadow: none; }
.tile.is-out::after { display: none; }
.tile.is-out .tile-ic { background: #9AA6B6; box-shadow: none; }
.tile.is-out .tile-name { color: var(--ink-2); }
.tile.is-out .tile-meta { color: #B01E17; }

/* ---------- Dải QR (220px) ---------- */
.qr-band {
  flex: none; height: 220px; margin-top: 28px; border-radius: var(--r-lg);
  background: var(--gold); color: var(--cobalt-900); text-align: left;
  box-shadow: 0 22px 40px -22px rgba(170, 110, 0, .8), inset 0 -6px 0 rgba(0, 0, 0, .07);
}
.qr-band::before { /* vệt sáng chạy ngang */
  content: ""; position: absolute; top: 0; bottom: 0; width: 180px; left: -220px;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: sweep 4.5s ease-in-out infinite 1.5s;
}
@keyframes sweep { 0% { left: -220px; } 40%, 100% { left: 110%; } }
.qr-on, .qr-off { position: relative; z-index: 1; height: 100%; display: flex; align-items: center; gap: 30px; padding: 0 36px; }
.qr-off { display: none; }
.qr-text { flex: 1; display: flex; flex-direction: column; }
.qr-text strong { font-size: 40px; font-weight: 800; line-height: 1.25; }
.qr-text span { font-size: 28px; font-weight: 500; line-height: 1.4; margin-top: 6px; }
.kiosk.is-offline .qr-band { background: #E7EBF0; color: var(--ink-2); box-shadow: none; border: 2px dashed #B7C1CE; }
.kiosk.is-offline .qr-band::before { display: none; }
.kiosk.is-offline .qr-on { display: none; }
.kiosk.is-offline .qr-off { display: flex; }
.kiosk.is-offline .qr-off .qr-ic { color: var(--red); }
.kiosk.is-offline .idle-qr { opacity: .55; }

/* ---------- Chân trang điều hướng (120px) ---------- */
.k-foot { flex: none; height: 120px; margin-top: 28px; display: flex; align-items: center; gap: 24px; }
.nav-btn { height: 120px; min-width: 260px; padding: 0 36px; border-radius: 26px; border: 3px solid var(--cobalt); background: var(--surface); color: var(--cobalt); display: inline-flex; align-items: center; justify-content: center; gap: 14px; font-size: 32px; font-weight: 700; }
.nav-btn .ic { font-size: 44px; }
.hours { margin-left: auto; text-align: right; display: flex; flex-direction: column; font-size: 26px; color: var(--ink-2); line-height: 1.4; }
.hours b { color: var(--ink); font-weight: 700; }

/* =========================================================
   S2. CHỌN THỦ TỤC
   ========================================================= */
.svc-list { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 28px; }
.svc-row {
  display: flex; align-items: center; gap: 30px; min-height: 230px;
  padding: 30px 34px; border-radius: var(--r-lg); text-align: left;
  background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow);
}
.svc-row.is-pressed { border-color: var(--cobalt); }
.svc-code { flex: none; width: 136px; height: 136px; border-radius: 30px; display: grid; place-items: center; font-family: var(--num); font-size: 84px; font-weight: 600; color: #fff; background: linear-gradient(145deg, #1C6FE0, var(--cobalt) 60%, var(--cobalt-700)); }
.svc-main { flex: 1; min-width: 0; }
.svc-name { display: block; font-size: 40px; font-weight: 800; line-height: 1.3; color: var(--cobalt-900); }
.svc-sub { display: block; font-size: 28px; color: var(--ink-2); margin-top: 6px; }
.quota { display: flex; align-items: center; gap: 16px; white-space: nowrap; margin-top: 16px; font-size: 26px; font-weight: 600; color: var(--ink-2); }
.quota-bar { width: 200px; flex: none; height: 14px; border-radius: 7px; background: var(--line); overflow: hidden; }
.quota-bar i { display: block; height: 100%; border-radius: 7px; background: var(--cobalt); transform-origin: left; }
.screen.is-active .quota-bar i { animation: grow 1s var(--ease) both .4s; }
@keyframes grow { from { transform: scaleX(0); } }
.quota.is-low { color: #B01E17; }
.quota.is-low .quota-bar i { background: var(--red); }
.svc-stats { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; font-size: 28px; font-weight: 600; }
.svc-stats > span { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.svc-stats .ic { font-size: 32px; color: var(--cobalt); }
.svc-stats b { font-family: var(--num); font-size: 36px; font-weight: 600; }
.svc-go { flex: none; width: 72px; height: 72px; border-radius: 50%; background: var(--cobalt-50); color: var(--cobalt); display: grid; place-items: center; font-size: 40px; }
.svc-row.is-out { background: #EEF1F5; border-style: dashed; box-shadow: none; }
.svc-row.is-out .svc-code { background: #9AA6B6; }
.svc-row.is-out .svc-name { color: var(--ink-2); }
.svc-row.is-out .svc-go { display: none; }
.out-label { color: #B01E17; font-weight: 700; }

.ask-card { flex: none; margin-top: 28px; display: flex; align-items: center; gap: 20px; padding: 26px 32px; border-radius: 24px; background: var(--cobalt-50); color: var(--cobalt-900); font-size: 28px; font-weight: 500; }
.ask-card .ic { font-size: 48px; color: var(--cobalt); }

/* =========================================================
   S3. ĐỊNH DANH + IN PHIẾU
   ========================================================= */
.sel-card { flex: none; display: flex; align-items: center; gap: 28px; padding: 26px 30px; border-radius: var(--r-lg); background: var(--cobalt-50); border: 2px solid var(--cobalt-100); }
.sel-card .svc-code { width: 112px; height: 112px; font-size: 68px; border-radius: 26px; }
.sel-card .sel-label { display: block; font-size: 26px; font-weight: 600; color: var(--ink-2); }
.sel-card .sel-name { display: block; font-size: 36px; font-weight: 800; line-height: 1.3; color: var(--cobalt-900); }
.sel-card .sel-sub { display: block; font-size: 28px; color: var(--ink-2); margin-top: 2px; }
.sel-card.is-priority { background: var(--orange-50); border-color: #FFC97A; }
.sel-card.is-priority .svc-code { background: linear-gradient(145deg, #FFA53D, var(--orange)); font-size: 60px; }
.sel-card.is-priority .sel-name { color: var(--orange-ink); }

.id-panel { flex: 1; min-height: 0; margin-top: 28px; padding: 40px 48px 32px; border-radius: var(--r-xl); background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; text-align: center; }
.id-panel h3 { font-size: 38px; font-weight: 800; line-height: 1.3; color: var(--cobalt-900); }

.reader-ill { position: relative; width: 460px; height: 300px; margin: 28px 0 22px; }
.ill-reader { position: absolute; left: 30px; right: 30px; bottom: 0; height: 120px; border-radius: 26px; background: linear-gradient(180deg, #2A3550, #141B2C); box-shadow: 0 20px 30px -18px rgba(0, 0, 0, .6); }
.ill-reader .slot { position: absolute; left: 60px; right: 60px; top: 22px; height: 14px; border-radius: 7px; background: #05080F; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .8); }
.ill-reader .led { position: absolute; right: 40px; bottom: 26px; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold); animation: pulseDot 1.2s infinite; }
.ill-card { position: absolute; z-index: 1; left: 50%; top: 0; width: 300px; height: 190px; margin-left: -150px; border-radius: 18px; background: linear-gradient(135deg, #E9F1FF, #BFD6F7); border: 3px solid #8FB3E8; box-shadow: 0 16px 26px -14px rgba(0, 40, 100, .6); animation: insert 2.8s var(--ease) infinite; }
.ill-card .chip { position: absolute; left: 30px; top: 60px; width: 62px; height: 48px; border-radius: 8px; background: linear-gradient(135deg, #F3D46C, #C99A1E); }
.ill-card .l1, .ill-card .l2, .ill-card .l3 { position: absolute; left: 120px; height: 12px; border-radius: 6px; background: #8FB3E8; }
.ill-card .l1 { top: 56px; width: 140px; } .ill-card .l2 { top: 84px; width: 110px; } .ill-card .l3 { top: 112px; width: 128px; }
@keyframes insert { 0%, 15% { transform: translateY(-10px); } 55%, 80% { transform: translateY(95px); } 100% { transform: translateY(-10px); } }
.ill-reader { z-index: 2; } /* thân đầu đọc che phần thẻ đã cắm vào khe */
.ill-ok { position: absolute; z-index: 4; left: 50%; top: 40px; width: 120px; height: 120px; margin-left: -60px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 72px; transform: scale(0); transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); box-shadow: 0 0 0 14px rgba(27, 135, 63, .18); }
.reader-ill.is-read .ill-card { animation: none; transform: translateY(95px); }
.reader-ill.is-read .ill-ok { transform: scale(1); }
.reader-ill.is-reading .ill-card { animation: none; transform: translateY(95px); }
.reader-ill.is-reading .led { background: #4ADE80; box-shadow: 0 0 14px #4ADE80; animation-duration: .35s; }

.card-status { display: inline-flex; align-items: center; gap: 14px; min-height: 76px; padding: 10px 32px; border-radius: 38px; font-size: 30px; font-weight: 700; transition: background .3s, color .3s; }
.card-status .cs-ic { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.card-status[data-state="wait"] { background: var(--bg); color: var(--ink-2); }
.card-status[data-state="wait"] .cs-ic { border: 4px solid #9AA6B6; }
.card-status[data-state="reading"] { background: var(--cobalt-50); color: var(--cobalt); }
.card-status[data-state="reading"] .cs-ic { border: 4px solid var(--cobalt-100); border-top-color: var(--cobalt); animation: spin .8s linear infinite; }
.card-status[data-state="ok"] { background: var(--green-50); color: var(--green); }
.card-status[data-state="ok"] .cs-ic { background: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }

.or-line { width: 100%; display: flex; align-items: center; gap: 20px; margin: 26px 0 18px; font-size: 26px; font-weight: 600; color: var(--ink-2); }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 2px; background: var(--line); }
.vneid-line { display: flex; align-items: center; gap: 16px; font-size: 30px; font-weight: 600; color: var(--ink); }
.vneid-line .ic { font-size: 44px; color: var(--red); }
.privacy { margin-top: auto; padding-top: 18px; display: flex; align-items: flex-start; gap: 12px; font-size: 26px; line-height: 1.4; color: var(--ink-2); text-align: left; }
.privacy .ic { font-size: 30px; margin-top: 4px; }

.print-btn {
  flex: none; height: 200px; margin-top: 28px; border-radius: var(--r-xl);
  display: flex; align-items: center; justify-content: center; gap: 26px;
  background: linear-gradient(180deg, #0A5BC9, var(--cobalt) 60%, var(--cobalt-700)); color: #fff;
  box-shadow: 0 26px 44px -20px rgba(0, 71, 171, .9), inset 0 -8px 0 rgba(0, 0, 0, .15);
}
.print-btn .ic { font-size: 84px; position: relative; z-index: 1; }
.pb-text { position: relative; z-index: 1; display: flex; flex-direction: column; text-align: left; }
.pb-text b { font-size: 60px; font-weight: 800; line-height: 1.1; letter-spacing: .02em; }
.pb-text small { font-size: 26px; font-weight: 500; opacity: .9; margin-top: 6px; }
.shine { position: absolute; top: 0; bottom: 0; width: 200px; left: -260px; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent); animation: sweep 3.2s ease-in-out infinite 1s; }
.print-btn.is-priority { background: linear-gradient(180deg, #FFA53D, var(--orange) 60%, #E06F00); color: #3D1F00; box-shadow: 0 26px 44px -20px rgba(224, 111, 0, .9), inset 0 -8px 0 rgba(0, 0, 0, .1); }
.print-btn.is-busy { pointer-events: none; filter: saturate(.7); }

/* =========================================================
   Q1. KIỂM TRA QR
   ========================================================= */
.center-title { text-wrap: balance; font-size: 52px; font-weight: 800; line-height: 1.25; color: var(--cobalt-900); margin-top: 48px; max-width: 900px; }
.center-sub { font-size: 32px; color: var(--ink-2); margin-top: 18px; max-width: 860px; line-height: 1.45; }
.center-sub--sm { font-size: 28px; display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 36px; }
.center-sub--sm .ic { font-size: 36px; color: var(--cobalt); }

.phone-ill { position: relative; }
.phone { position: relative; width: 300px; height: 520px; border-radius: 48px; background: #141B2C; padding: 22px; box-shadow: 0 30px 60px -24px rgba(0, 20, 60, .7); animation: floatY 3s ease-in-out infinite; }
.phone::before { content: ""; position: absolute; top: 14px; left: 50%; width: 80px; height: 10px; margin-left: -40px; border-radius: 5px; background: #2A3550; }
.phone-qr { height: 100%; border-radius: 30px; background: #fff; display: grid; place-items: center; font-size: 210px; color: var(--ink); }
.laser { position: absolute; left: 10px; right: 10px; height: 6px; border-radius: 3px; background: var(--red); box-shadow: 0 0 22px 6px rgba(218, 37, 29, .55); animation: laser 1.6s ease-in-out infinite; }
@keyframes laser { 0%, 100% { top: 60px; } 50% { top: 450px; } }
@keyframes floatY { 50% { transform: translateY(-14px); } }

.check-list { list-style: none; margin-top: 40px; width: 720px; display: flex; flex-direction: column; gap: 18px; }
.check-list li { display: flex; align-items: center; gap: 22px; padding: 22px 30px; border-radius: 22px; background: var(--surface); border: 2px solid var(--line); font-size: 32px; font-weight: 600; text-align: left; opacity: .45; transition: opacity .3s, border-color .3s, background .3s; }
.check-list .cl-ic { width: 56px; height: 56px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 34px; border: 4px solid var(--line); color: transparent; }
.check-list li.is-run { opacity: 1; }
.check-list li.is-run .cl-ic { border-color: var(--cobalt-100); border-top-color: var(--cobalt); animation: spin .8s linear infinite; }
.check-list li.is-ok { opacity: 1; border-color: #A9DDB9; background: var(--green-50); }
.check-list li.is-ok .cl-ic { background: var(--green); border-color: var(--green); color: #fff; animation: pop .4s cubic-bezier(.3, 1.6, .5, 1); }
.check-list li.is-fail { opacity: 1; border-color: #F4B4AF; background: var(--red-50); }
.check-list li.is-fail .cl-ic { background: var(--red); border-color: var(--red); color: #fff; animation: pop .4s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.3); } }

/* =========================================================
   S4. ĐANG IN
   ========================================================= */
.printer-ill { position: relative; width: 520px; height: 560px; }
.printer-body { position: relative; z-index: 2; height: 170px; border-radius: 34px; background: linear-gradient(180deg, #2A3550, #141B2C); box-shadow: 0 26px 40px -22px rgba(0, 0, 0, .7); }
.p-slot { position: absolute; left: 70px; right: 70px; bottom: 34px; height: 18px; border-radius: 9px; background: #05080F; }
.p-led { position: absolute; right: 44px; top: 36px; width: 20px; height: 20px; border-radius: 50%; background: #4ADE80; box-shadow: 0 0 14px #4ADE80; animation: pulseDot .5s infinite; }
.paper-clip { position: absolute; left: 90px; right: 90px; top: 136px; bottom: 0; overflow: hidden; z-index: 1; }
.paper { position: relative; height: 400px; background: #fff; border-radius: 0 0 14px 14px; box-shadow: 0 18px 30px -16px rgba(0, 20, 60, .45); display: flex; flex-direction: column; align-items: center; padding-top: 48px; transform: translateY(-100%); }
.screen.is-active .paper { animation: feed 1.5s var(--ease) forwards .15s; }
@keyframes feed { to { transform: translateY(0); } }
.paper::after { content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 20px; background: radial-gradient(circle at 10px 0, transparent 10px, #fff 10.5px) repeat-x; background-size: 20px 20px; transform: rotate(180deg); }
.pp-num { font-family: var(--num); font-size: 96px; font-weight: 600; color: var(--red); line-height: 1; }
.pp-l { width: 220px; height: 14px; border-radius: 7px; background: var(--line); margin-top: 26px; }
.pp-l.s { width: 150px; margin-top: 14px; }
.pp-qr { width: 110px; height: 110px; margin-top: 28px; border-radius: 10px; background: repeating-conic-gradient(var(--ink) 0 25%, #fff 0 50%) 0 0 / 22px 22px; opacity: .85; }
@keyframes pulseDot { 50% { opacity: .35; } }

/* =========================================================
   S5. THÀNH CÔNG – PHIẾU ĐIỆN TỬ
   ========================================================= */
.ok-head { display: flex; align-items: center; gap: 28px; min-height: 128px; }
.ok-badge svg { width: 124px; height: 124px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ok-badge circle { stroke: var(--green); stroke-width: 4; fill: var(--green-50); stroke-dasharray: 151; stroke-dashoffset: 151; }
.ok-badge path { stroke: var(--green); stroke-width: 5; stroke-dasharray: 40; stroke-dashoffset: 40; }
.screen.is-active .ok-badge circle { animation: draw .6s ease-out forwards .1s; }
.screen.is-active .ok-badge path { animation: draw .4s ease-out forwards .6s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.ok-head h2 { font-size: 52px; font-weight: 800; line-height: 1.25; color: var(--cobalt-900); }
.ok-head p { font-size: 30px; color: var(--ink-2); margin-top: 4px; }

.ticket { position: relative; flex: none; margin-top: 30px; border-radius: var(--r-xl); background: var(--surface); box-shadow: 0 30px 60px -30px rgba(0, 40, 100, .55); border: 2px solid var(--line); overflow: hidden; }
.screen.is-active .ticket { animation: ticketIn .7s var(--ease) both .25s; }
@keyframes ticketIn { from { opacity: 0; transform: translateY(60px) rotate(-1.2deg); } }
.tk-top { display: flex; justify-content: space-between; align-items: center; padding: 24px 40px; background: var(--cobalt); color: #fff; font-size: 26px; font-weight: 700; letter-spacing: .03em; }
.tk-top #tkStamp { font-weight: 500; font-variant-numeric: tabular-nums; }
.tk-badge { display: none; margin: 30px auto 0; width: max-content; padding: 10px 28px; border-radius: 30px; background: var(--orange); color: #3D1F00; font-size: 28px; font-weight: 800; letter-spacing: .03em; }
.ticket.has-badge .tk-badge { display: block; }
.tk-number { font-family: var(--num); font-size: 232px; font-weight: 600; line-height: 1.05; text-align: center; color: var(--red); letter-spacing: .02em; font-variant-numeric: tabular-nums; margin-top: 14px; }
.screen.is-active .tk-number { animation: numIn .8s cubic-bezier(.25, 1.4, .5, 1) both .55s; }
@keyframes numIn { from { opacity: 0; transform: scale(.55); filter: blur(10px); } }
.tk-service { text-align: center; font-size: 34px; font-weight: 700; color: var(--cobalt-900); padding: 0 40px; line-height: 1.35; }
.tk-cut { position: relative; height: 2px; margin: 34px 0 0; border-top: 3px dashed var(--line); }
.tk-cut::before, .tk-cut::after { content: ""; position: absolute; top: -22px; width: 40px; height: 40px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line); }
.tk-cut::before { left: -22px; } .tk-cut::after { right: -22px; }
.tk-body { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--line); }
.tk-cell { background: var(--surface); padding: 26px 36px; display: flex; flex-direction: column; gap: 4px; }
.tk-cell span { font-size: 26px; color: var(--ink-2); font-weight: 500; }
.tk-cell b { font-size: 36px; font-weight: 800; color: var(--ink); line-height: 1.25; }
.tk-cell b.num { font-family: var(--num); font-size: 60px; font-weight: 600; color: var(--cobalt); line-height: 1.05; }
.tk-cell b.num small { font-family: var(--font); font-size: 28px; font-weight: 600; color: var(--ink-2); margin-left: 8px; }
.tk-steps { grid-column: 1 / -1; background: var(--surface); padding: 30px 40px; display: flex; flex-direction: column; gap: 22px; }
.tk-steps li { list-style: none; display: flex; align-items: flex-start; gap: 22px; font-size: 30px; line-height: 1.4; }
.tk-steps li i { flex: none; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--orange-50); color: var(--orange-ink); font-style: normal; font-weight: 800; font-size: 30px; border: 2px solid #FFC97A; }
.ticket.is-pending .tk-top { background: var(--orange); color: #3D1F00; }
.ticket.is-pending .tk-number { color: var(--orange-ink); font-size: 196px; }

.alert-card { flex: none; display: none; align-items: center; gap: 22px; margin-top: 26px; padding: 26px 32px; border-radius: 24px; background: var(--amber-50); border: 3px solid var(--gold); color: var(--amber-ink); font-size: 32px; font-weight: 800; }
.alert-card .ic { font-size: 56px; animation: nudge 1s ease-in-out infinite; }
.alert-card.is-on { display: flex; animation: rise .5s var(--ease) both .9s; }
@keyframes nudge { 50% { transform: translateY(10px); } }

.done-btn { flex: none; margin-top: auto; height: 150px; border-radius: var(--r-xl); display: flex; align-items: center; justify-content: center; gap: 20px; background: var(--green); color: #fff; font-size: 48px; font-weight: 800; box-shadow: 0 24px 40px -22px rgba(27, 135, 63, .9), inset 0 -8px 0 rgba(0, 0, 0, .12); }
.done-btn .ic { font-size: 64px; position: relative; z-index: 1; }
.done-btn > span:not(.done-progress), .done-btn small { position: relative; z-index: 1; }
.done-btn small { font-size: 28px; font-weight: 600; opacity: .9; font-variant-numeric: tabular-nums; }
.done-progress { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: rgba(255, 255, 255, .16); transform-origin: left; }

/* =========================================================
   LỖI / NGOÀI GIỜ
   ========================================================= */
.err-ic { width: 190px; height: 190px; border-radius: 50%; display: grid; place-items: center; font-size: 100px; background: var(--amber-50); color: #B07000; box-shadow: 0 0 0 22px rgba(255, 204, 0, .18); }
.screen.is-active .err-ic { animation: shake .6s ease both .2s; }
@keyframes shake { 20% { transform: rotate(-8deg); } 40% { transform: rotate(7deg); } 60% { transform: rotate(-5deg); } 80% { transform: rotate(3deg); } }
.err-ic.is-red { background: var(--red-50); color: var(--red); box-shadow: 0 0 0 22px rgba(218, 37, 29, .12); }
.err-ic--muted { background: #E7EBF0; color: var(--ink-2); box-shadow: 0 0 0 22px rgba(74, 85, 104, .08); }
.err-detail { margin-top: 40px; width: 860px; border-radius: 26px; background: var(--surface); border: 2px solid var(--line); overflow: hidden; }
.err-detail:empty { display: none; }
.err-detail > div { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 24px 34px; font-size: 30px; text-align: left; }
.err-detail > div + div { border-top: 2px solid var(--line); }
.err-detail span { color: var(--ink-2); }
.err-detail b { font-weight: 800; text-align: right; }
.err-detail b.bad { color: var(--red); }
.err-detail b.big { font-family: var(--num); font-size: 96px; font-weight: 600; color: var(--red); line-height: 1; }
.err-actions { margin-top: 52px; width: 860px; display: flex; flex-direction: column; gap: 24px; }
.big-btn { height: 150px; border-radius: var(--r-xl); display: flex; align-items: center; justify-content: center; gap: 18px; background: var(--cobalt); color: #fff; font-size: 44px; font-weight: 800; box-shadow: 0 24px 40px -22px rgba(0, 71, 171, .9); }
.big-btn--ghost { background: var(--surface); color: var(--cobalt); border: 3px solid var(--cobalt); box-shadow: none; height: 120px; font-size: 36px; }
.big-btn:empty { display: none; }
.screen--closed { background: linear-gradient(180deg, #EEF1F5, #E1E6ED); }

/* ---------- Thanh đếm thời gian không thao tác ---------- */
.timeout-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: rgba(0, 71, 171, .08); z-index: 6; opacity: 0; transition: opacity .3s; }
.timeout-bar i { display: block; height: 100%; background: var(--cobalt); opacity: .55; transform-origin: left; }
.timeout-bar.is-on { opacity: 1; }

/* ---------- Bảng hướng dẫn ---------- */
.modal { position: absolute; inset: 0; z-index: 20; background: rgba(6, 14, 32, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; visibility: hidden; transition: opacity .35s, visibility 0s .35s; display: flex; align-items: flex-end; }
.modal.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
.sheet { width: 100%; padding: 56px 48px 48px; border-radius: 44px 44px 0 0; background: var(--surface); transform: translateY(100%); transition: transform .45s var(--ease); }
.modal.is-open .sheet { transform: none; }
.sheet .big-btn { width: 100%; }
.sheet h3 { font-size: 48px; font-weight: 800; color: var(--cobalt-900); }
.help-steps { list-style: none; margin: 34px 0 40px; display: flex; flex-direction: column; gap: 26px; }
.help-steps li { display: flex; gap: 26px; align-items: flex-start; }
.hs-ic { flex: none; width: 96px; height: 96px; border-radius: 26px; display: grid; place-items: center; background: var(--cobalt-50); color: var(--cobalt); font-size: 52px; }
.help-steps b { display: block; font-size: 34px; font-weight: 800; line-height: 1.3; }
.help-steps div > span { display: block; font-size: 29px; color: var(--ink-2); line-height: 1.45; margin-top: 4px; }

/* ---------- Toast ---------- */
.toast { position: absolute; z-index: 30; left: 50%; bottom: 330px; max-width: 900px; padding: 28px 40px; border-radius: 28px; background: var(--cobalt-900); color: #fff; font-size: 30px; font-weight: 600; line-height: 1.4; text-align: center; box-shadow: 0 24px 50px -20px rgba(0, 0, 0, .6); transform: translate(-50%, 40px); opacity: 0; pointer-events: none; transition: transform .35s var(--ease), opacity .35s; }
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }

/* =========================================================
   BẢNG MÔ PHỎNG (ngoài kiosk)
   ========================================================= */
.demo-panel { width: 300px; flex: none; max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px; border-radius: 18px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); color: #DCE6F7; font-size: 14px; line-height: 1.45; }
.demo-panel h4 { font-size: 17px; font-weight: 700; color: #fff; }
.dp-note { margin-top: 6px; color: #A9B7D0; font-size: 13px; }
.dp-note code { color: var(--gold); }
.dp-group { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.dp-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--gold); }
.dp-group button { text-align: left; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); color: #fff; font-size: 14px; transition: background .2s; }
.dp-group button:hover { background: rgba(255, 255, 255, .16); }
.dp-group label { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 0; }
.dp-group input { width: 18px; height: 18px; accent-color: var(--gold); }

/* Giảm chuyển động khi hệ điều hành yêu cầu */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
