/* MSP Visitor — layout: fixed navy rail + top bar + scrolling workspace; tokens below. */
:root {
  --navy: #0A2A47;          /* myservicepartner.net */
  --navy-2: #12385C;
  --blue: #0065B3;          /* MSP logo blue */
  --orange: #F55A22;        /* MSP logo orange */
  --brand: #0065B3;         /* overridden per customer */
  --brand-ink: #FFFFFF;
  --accent: #F55A22;        /* overridden per customer */
  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --line: #DCE3EC;
  --line-2: #E9EEF4;
  --fg: #12202E;
  --muted: #5B6B7C;
  --ok: #0E7C4A;   --ok-bg: #E3F4EA;
  --warn: #A35A00; --warn-bg: #FFF1DC;
  --bad: #B42318;  --bad-bg: #FDE7E5;
  --info: #0B5CAD; --info-bg: #E2EEFB;
  --shadow: 0 1px 2px rgba(10,42,71,.06), 0 4px 16px rgba(10,42,71,.06);
  --radius: 10px;
  --f-sans: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --f-ar: "IBM Plex Sans Arabic", "IBM Plex Sans", Tahoma, Arial, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --rail: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1622; --surface: #111F2E; --surface-2: #0F1B28; --line: #22364A; --line-2: #1A2B3C;
    --fg: #E6EDF5; --muted: #93A4B6; --navy: #071B2E; --navy-2: #0E2A45;
    --ok: #4CC38A; --ok-bg: #0F2E21; --warn: #F0B357; --warn-bg: #33250E; --bad: #F97066; --bad-bg: #3A1512;
    --info: #6AB0F5; --info-bg: #0E2740; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1622; --surface: #111F2E; --surface-2: #0F1B28; --line: #22364A; --line-2: #1A2B3C;
  --fg: #E6EDF5; --muted: #93A4B6; --navy: #071B2E; --navy-2: #0E2A45;
  --ok: #4CC38A; --ok-bg: #0F2E21; --warn: #F0B357; --warn-bg: #33250E; --bad: #F97066; --bad-bg: #3A1512;
  --info: #6AB0F5; --info-bg: #0E2740; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 14.5px/1.5 var(--f-sans); -webkit-font-smoothing: antialiased; }
html[lang="ar"] body { font-family: var(--f-ar); font-size: 15px; }
[hidden] { display: none !important; }
img { max-width: 100%; }
a { color: var(--brand); }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
.mono { font-family: var(--f-mono); letter-spacing: .02em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.boot { display: grid; place-items: center; height: 100vh; }
.boot img { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--navy); color: #C9D6E4; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.rail-brand { padding: 18px 18px 14px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.rail-brand .logo-box { width: 44px; height: 44px; border-radius: 10px; background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; }
.rail-brand .logo-box img { max-width: 40px; max-height: 40px; object-fit: contain; }
.rail-brand .logo-box .initials { font-weight: 700; color: var(--navy); font-size: 15px; }
.rail-brand .t-name { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.25; }
.rail-brand .t-sub { font-size: 11.5px; color: #8FA6BE; letter-spacing: .04em; text-transform: uppercase; }
.nav { padding: 10px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav .grp { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: #6E87A1; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: #C9D6E4; text-decoration: none; font-weight: 500; font-size: 13.8px; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.on { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
html[dir="rtl"] .nav a.on { box-shadow: inset -3px 0 0 var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .badge { margin-inline-start: auto; background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.rail-foot { padding: 14px 18px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.rail-foot a { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.rail-foot img { height: 22px; background: #fff; border-radius: 5px; padding: 2px 4px; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding-block: 10px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.topbar .menu-btn { display: none; }
.topbar h1 { font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .tools { display: flex; align-items: center; gap: 8px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.content { flex: 1; padding-block: 22px 28px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); width: 100%; max-width: 1440px; }
.app-foot { border-top: 1px solid var(--line); background: var(--surface); padding-block: 10px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.powered { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; }
.powered img { height: 18px; }
.powered b { color: var(--blue); font-weight: 600; }
.powered:hover b { text-decoration: underline; }

/* ---------- Building blocks ---------- */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.card { container-type: inline-size; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-h h2 { flex: 1; }
.card-b { padding: 16px; }
.card-b.flush { padding: 0; }
.page-h { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-h .lead { color: var(--muted); margin-top: 4px; max-width: 70ch; }
.page-h > div:first-child { flex: 1; min-width: 220px; }

.kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi .k-label { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.kpi .k-val { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .k-sub { font-size: 12px; color: var(--muted); }
.kpi.alert .k-val { color: var(--bad); }
.kpi .k-dot { position: absolute; inset-inline-end: 14px; top: 14px; width: 9px; height: 9px; border-radius: 50%; }

.btn { --b: var(--surface); --c: var(--fg); --bd: var(--line); display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--bd); background: var(--b); color: var(--c); font: 500 13.5px/1 inherit; font-family: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { --b: var(--brand); --c: var(--brand-ink); --bd: var(--brand); }
.btn.accent { --b: var(--accent); --c: #fff; --bd: var(--accent); }
.btn.ok { --b: var(--ok); --c: #fff; --bd: var(--ok); }
.btn.danger { --b: var(--surface); --c: var(--bad); --bd: var(--line); }
.btn.ghost { --b: transparent; --bd: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { width: 36px; padding: 0; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.8px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.s-checked_in { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.s-expected { background: var(--info-bg); color: var(--info); border-color: transparent; }
.pill.s-pending { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.s-rejected, .pill.s-blacklisted, .pill.s-overstay { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.pill.s-checked_out, .pill.s-cancelled { }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; }
.tag i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.field > span b { color: var(--bad); font-weight: 600; }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font: inherit; font-size: 14px; }
textarea.input { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
.input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
.input[readonly] { background: var(--surface-2); }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.section-t { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 6px 0 -4px; grid-column: 1 / -1; }
.search { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.search svg { position: absolute; inset-inline-start: 10px; top: 10px; width: 17px; height: 17px; color: var(--muted); }
.search .input { padding-inline-start: 34px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 34px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--brand); color: var(--brand-ink); }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: start; font-weight: 600; font-size: 11.8px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl .who-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.tbl .who-cell .avatar { width: 30px; height: 30px; font-size: 12px; background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); }
.tbl .act { text-align: end; white-space: nowrap; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty svg { width: 34px; height: 34px; opacity: .5; display: block; margin: 0 auto 8px; }

/* Charts */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 170px; padding-top: 8px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 38px; background: var(--brand); border-radius: 5px 5px 2px 2px; min-height: 2px; position: relative; }
.bar.today { background: var(--accent); }
.bar-col .v { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-col .d { font-size: 11.5px; color: var(--muted); }
.mix { display: flex; flex-direction: column; gap: 10px; }
.mix-row { display: grid; grid-template-columns: 120px 1fr 36px; gap: 10px; align-items: center; font-size: 13px; }
.mix-track { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.mix-track i { display: block; height: 100%; border-radius: 99px; }

/* Lists */
@container (max-width: 460px) {
  .li { flex-wrap: wrap; row-gap: 6px; }
  .li .grow { flex: 1 1 calc(100% - 50px); }
  .li > .small.muted { text-align: start !important; }
  .li > .small.muted br { display: none; }
}
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .t2 { font-size: 12.5px; color: var(--muted); }

/* Gate desk */
.gate-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.big-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.big-act { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: start; font: inherit; color: var(--fg); box-shadow: var(--shadow); }
.big-act:hover { border-color: var(--brand); }
.big-act .ic { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); }
.big-act.acc .ic { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.big-act .ic svg { width: 21px; height: 21px; }
.big-act b { font-size: 14.5px; }
.big-act span { font-size: 12.5px; color: var(--muted); }
.code-entry { display: flex; gap: 8px; }
.code-entry .input { font-family: var(--f-mono); letter-spacing: .15em; text-transform: uppercase; font-size: 18px; height: 46px; }

/* Document capture */
.doc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.shot { border: 1.5px dashed var(--line); border-radius: 10px; aspect-ratio: 1.58; display: grid; place-items: center; background: var(--surface-2); position: relative; overflow: hidden; cursor: pointer; text-align: center; color: var(--muted); font-size: 12.5px; max-width: 100%; }
.shot.face { aspect-ratio: 1.58; }
.shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.shot svg { width: 26px; height: 26px; display: block; margin: 0 auto 4px; }
.doc-types { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 13px; cursor: pointer; color: var(--fg); }
.chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.notice { display: flex; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--info-bg); color: var(--info); font-size: 13px; align-items: flex-start; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* Unit picker */
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; padding: 2px; }
.unit { height: 52px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--fg); }
.unit b { font-size: 15px; font-variant-numeric: tabular-nums; }
.unit small { font-size: 10.5px; color: var(--muted); }
.unit.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.unit.on small { color: inherit; opacity: .8; }

/* Modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(6,20,35,.55); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,.3); display: flex; flex-direction: column; max-height: none; }
.modal.wide { max-width: 980px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.modal-h h2 { flex: 1; font-size: 17px; }
.modal-b { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.modal-f { padding: 14px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 14px 14px; }
#toast-root { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); inset-inline-end: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 11px 14px; border-radius: 9px; font-size: 13.5px; box-shadow: var(--shadow); max-width: 360px; border-inline-start: 4px solid var(--ok); }
.toast.err { border-inline-start-color: #F97066; }

/* Visit detail */
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.timeline { display: flex; flex-direction: column; gap: 10px; border-inline-start: 2px solid var(--line); padding-inline-start: 14px; }
.timeline div { font-size: 13px; position: relative; }
.timeline div::before { content: ""; position: absolute; inset-inline-start: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.login-art { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; inset-inline-end: -200px; bottom: -200px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(245,90,34,.12); }
.login-art .lg { background: #fff; border-radius: 12px; padding: 12px 16px; display: inline-block; align-self: flex-start; }
.login-art .lg img { height: 40px; display: block; }
.login-art h2 { font-size: 34px; font-weight: 600; line-height: 1.2; max-width: 16ch; }
.login-art p { color: #B9C9DA; max-width: 46ch; font-size: 15px; }
.login-art ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 14px; color: #D7E2EE; }
.login-art li { display: flex; gap: 10px; align-items: center; }
.login-art li i { width: 8px; height: 8px; border-radius: 2px; background: var(--orange); flex: none; }
.login-form { display: flex; flex-direction: column; justify-content: center; padding-block: 40px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.login-form form { width: 100%; max-width: 380px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.login-form .foot { margin-top: 26px; text-align: center; }

/* Kiosk */
.kiosk { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.kiosk-top { background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding-block: 14px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.kiosk-top .logo-box { height: 52px; display: flex; align-items: center; }
.kiosk-top .logo-box img { max-height: 52px; }
.kiosk-top .t { font-size: 20px; font-weight: 600; flex: 1; }
.kiosk-body { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding-block: 28px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 20px; }
.kiosk h1 { font-size: 30px; }
.kiosk .units { max-height: 46vh; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.kiosk .unit { height: 68px; }
.kiosk .unit b { font-size: 20px; }
.kiosk .input { height: 52px; font-size: 18px; }
.kiosk .type-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kiosk .type-btn { height: 110px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 19px; font-weight: 600; cursor: pointer; color: var(--fg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; box-shadow: var(--shadow); }
.kiosk .type-btn i { width: 14px; height: 14px; border-radius: 4px; }
.steps { display: flex; gap: 6px; }
.steps i { height: 5px; flex: 1; border-radius: 99px; background: var(--line); }
.steps i.on { background: var(--brand); }

/* Visitor pass */
.pass-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding-block: 28px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); gap: 18px; }
.pass { width: 100%; max-width: 380px; background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.pass-h { background: var(--brand); color: var(--brand-ink); padding: 18px; display: flex; gap: 12px; align-items: center; }
.pass-h .logo-box { width: 52px; height: 52px; border-radius: 12px; background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; }
.pass-h .logo-box img { max-width: 48px; max-height: 48px; }
.pass-b { padding: 20px; display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; }
.pass-qr { width: 220px; height: 220px; display: grid; place-items: center; }
.pass-qr img, .pass-qr svg { width: 100%; height: 100%; }
.pass-code { font-family: var(--f-mono); font-size: 26px; letter-spacing: .2em; }
.pass .kv { text-align: start; width: 100%; grid-template-columns: 110px minmax(0, 1fr); }
.perf { border-top: 2px dashed var(--line); width: 100%; }

/* Responsive */
@media (max-width: 1100px) {
  .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gate-hero { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(280px, 86vw); z-index: 60; transform: translateX(-102%); transition: transform .2s; }
  html[dir="rtl"] .rail { transform: translateX(102%); }
  .shell.nav-open .rail { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; }
  .topbar .menu-btn { display: inline-flex; }
  .g2, .g3, .form-grid, .doc-grid, .big-actions { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 28px 24px; gap: 18px; }
  .login-art h2 { font-size: 24px; }
  .login-art ul { display: none; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .kiosk .type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .who .nm { display: none; }
  .mix-row { grid-template-columns: 90px 1fr 30px; }
}
@media (max-width: 520px) {
  .g4, .g5 { grid-template-columns: 1fr 1fr; }
  .kpi .k-val { font-size: 22px; }
}

/* Print (reports, passes) */
@media print {
  .rail, .topbar, .app-foot .no-print, .no-print, #toast-root { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
