/* VMS — single stylesheet. No inline styles (CSP style-src 'self'). */
:root {
  --bg: #f4f6fb; --card: #fff; --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e2e8f0; --line-2: #cbd5e1;
  --side: #0b1b33; --side-2: #12284a; --side-ink: #c9d5e8;
  --brand: #2f5bea; --brand-d: #2347c5; --brand-soft: #eaf0ff;
  --ok: #0f7a4a; --ok-soft: #e3f6ec; --warn: #a15c00; --warn-soft: #fff4dd; --bad: #c0261a; --bad-soft: #fde9e7;
  --visitor: #2563eb; --visitor-soft: #e6eefe; --vendor: #b45309; --vendor-soft: #fdf0dc; --contractor: #c2410c; --contractor-soft: #fde9dd;
  --r: 14px; --r-sm: 9px; --shadow: 0 1px 2px rgba(15,23,42,.05), 0 2px 8px rgba(15,23,42,.05);
  --side-w: 248px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--brand); }
h1 { font-size: 1.55rem; margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 1.02rem; margin: 0 0 .85rem; letter-spacing: -.005em; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
code { background: #eef2f7; padding: 0 .3em; border-radius: 4px; }
:focus-visible { outline: 3px solid #93b4ff; outline-offset: 2px; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }

/* ---------- app shell */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: linear-gradient(180deg, var(--side), #0a1830); color: var(--side-ink); display: flex; flex-direction: column; z-index: 40; }
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; padding: 1.1rem 1.1rem 1rem; }
.brand b { display: block; font-size: 1.05rem; letter-spacing: .01em; }
.brand small { display: block; font-size: .75rem; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.brand.dark { color: var(--ink); padding: 0; }
.logo { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #4f7cff, #2347c5); color: #fff; font-weight: 800; font-size: .95rem; box-shadow: 0 4px 12px rgba(47,91,234,.35); flex: none; }
.emblem { width: 42px; height: 42px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.public-top .emblem { width: 46px; height: 46px; filter: none; }
.auth-emblem { display: block; width: 72px; height: 72px; margin: 0 0 .75rem; filter: none; }
.org .emblem { width: 22px; height: 22px; vertical-align: middle; margin-right: .4rem; filter: none; }
.badge-card .org .emblem { width: 8mm; height: 8mm; margin-right: 1.5mm; }
.badge-card header .org { display: flex; align-items: center; }
.doc-title { display: flex; align-items: center; gap: .6rem; }
.doc-title .emblem { width: 48px; height: 48px; filter: none; }
.sidebar nav { flex: 1; overflow-y: auto; padding: .25rem .75rem 1rem; }
/* Slim, dark scrollbar for the side menu; it only shows while the pointer is over the menu. */
.sidebar nav { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.sidebar nav:hover, .sidebar nav:focus-within { scrollbar-color: rgba(255,255,255,.22) transparent; }
.sidebar nav::-webkit-scrollbar { width: 6px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }
.sidebar nav::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; }
.sidebar nav:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); }
.sidebar nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.4); }
.sidebar nav::-webkit-scrollbar-button { display: none; height: 0; }
.nav-label { margin: 1rem .6rem .35rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: #7f93b3; font-weight: 700; }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 9px; color: var(--side-ink); text-decoration: none; font-weight: 500; margin-bottom: 2px; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.on { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(47,91,234,.35); }
.me { display: flex; align-items: center; gap: .55rem; padding: .8rem .9rem; border-top: 1px solid rgba(255,255,255,.08); }
.me .initials { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--side-2); color: #fff; font-weight: 700; flex: none; }
.me-text { flex: 1; min-width: 0; }
.me-text b { display: block; color: #fff; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: #8ea2c2; font-size: .75rem; }
.me form { margin: 0; }
.icon-link { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: none; border: 0; color: inherit; cursor: pointer; }
.icon-link:hover { background: rgba(255,255,255,.08); }
.main-col { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .75rem; padding: .7rem 1.5rem; background: rgba(244,246,251,.88); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.menu-btn { display: none; color: var(--ink); }
.menu-btn:hover { background: #e8edf6; }
.global-search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: .5rem; background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 0 .75rem; color: var(--muted); }
.global-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.global-search input { border: 0; padding: .55rem 0; box-shadow: none; background: transparent; }
.global-search input:focus { outline: none; }
.new-pass-btn { flex: none; }
@media (max-width: 640px) { .new-pass-btn span { display: none; } .new-pass-btn { padding: .55rem .7rem; } }
.today-chip { margin-left: auto; display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .88rem; white-space: nowrap; }
.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }
.scrim { display: none; }

/* public pages */
.public-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; max-width: 1100px; margin: 0 auto; }
.public-top nav { display: flex; align-items: center; gap: 1rem; }
.public-top nav a:not(.btn) { color: var(--ink-2); text-decoration: none; font-weight: 500; }
.public-wrap { max-width: 1000px; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 1rem; }

/* ---------- page header */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; }
.page-head p { margin: .3rem 0 0; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 0 0 .25rem; }
.row-between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; }
.quick { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- grid + cards */
.grid { display: grid; gap: 1.1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.top { align-items: start; }
.grid.detail { grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); align-items: start; }
.span2 { grid-column: span 2; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.15rem 1.25rem; margin-bottom: 1.1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .85rem; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: .5rem; }
.card-head h2 .ic { color: var(--muted); }
.card > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: .5rem; }
.card > summary::-webkit-details-marker { display: none; }
.card[open] > summary { margin-bottom: 1rem; }
.count { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .45rem; border-radius: 999px; background: #eef2f7; color: var(--ink-2); font-size: .78rem; font-weight: 700; }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.block { display: block; }
.mt { margin-top: 1rem; }
.danger { color: var(--bad); }
.warn-text { color: var(--warn); }
.big { font-size: 1.25rem; font-weight: 600; }
.accent-warn { border-left: 4px solid #f0a500; }
.accent-ok { border-left: 4px solid var(--ok); }
.accent-bad { border-left: 4px solid var(--bad); }
.empty { text-align: center; color: var(--muted); padding: 1.5rem .5rem; }
.empty .ic { width: 30px; height: 30px; color: var(--line-2); display: block; margin: 0 auto .4rem; }

/* ---------- forms */
.form label, .filters label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .85rem; color: var(--ink-2); margin-bottom: .85rem; }
input, select, textarea { font: inherit; font-weight: 400; padding: .6rem .7rem; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; color: var(--ink); width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input:disabled { background: #f1f5f9; color: var(--muted); }
input[type=radio] { width: 1.1rem; height: 1.1rem; padding: 0; flex: none; accent-color: var(--brand); margin-top: .15rem; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; padding: 0; flex: none; accent-color: var(--brand); margin-top: .1rem; }
input[type=file] { padding: .4rem; background: #f8fafc; }
.upper { text-transform: uppercase; }
label.check { flex-direction: row !important; align-items: flex-start; gap: .6rem !important; font-weight: 400 !important; color: var(--ink) !important; font-size: .92rem !important; }
.hint { color: var(--muted); font-size: .84rem; font-weight: 400; margin: .2rem 0 .8rem; }
.notice { background: var(--warn-soft); border: 1px solid #f3d9a4; border-radius: var(--r-sm); padding: .75rem .95rem; margin: .75rem 0; font-size: .92rem; }
.notice.info { background: var(--brand-soft); border-color: #c9d7ff; }
.notice.danger { background: var(--bad-soft); border-color: #f6c0ba; color: var(--bad); }
.notice ul { margin: .35rem 0 0; padding-left: 1.2rem; }
fieldset { border: 1px dashed var(--line-2); border-radius: var(--r); padding: .85rem 1rem; margin: 0 0 1rem; min-width: 0; background: #fbfcfe; }
legend { font-weight: 700; padding: 0 .35rem; font-size: .9rem; }
.repeat .row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.repeat .row label { margin: 0; flex: 1 1 140px; }
.repeat .row label.grow { flex: 3 1 200px; }
.repeat .row label.xs { flex: 0 1 80px; }
.repeat .rows:empty { display: none; }
.icon-btn { border: 1px solid var(--line-2); background: #fff; border-radius: var(--r-sm); width: 2.5rem; height: 2.5rem; font-size: 1.2rem; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--bad); border-color: var(--bad); }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.filters label { margin: 0; flex: 1 1 140px; }
.filters label.grow, .form.inline label.grow { flex: 3 1 260px; }
.form.inline { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.form.inline label { margin: 0; }
.actions-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; }
.actions-row input[type=file] { flex: 1 1 220px; width: auto; }
input.xs { width: 5.5rem; }
.form-section { display: flex; gap: .9rem; padding: 1.1rem 0; border-top: 1px solid var(--line); }
.form-section:first-of-type { border-top: 0; padding-top: .2rem; }
.form-section > .num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; flex: none; }
.form-section > .body { flex: 1; min-width: 0; }
.form-section h2 { margin: .2rem 0 .85rem; }
.submit-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .58rem 1.05rem; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); font: inherit; font-weight: 600; font-size: .92rem; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, box-shadow .15s, transform .05s; }
.btn:hover { background: #f1f5f9; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(47,91,234,.25); }
.btn.primary:hover { background: var(--brand-d); }
.btn.success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: .32rem .7rem; font-size: .82rem; border-radius: 8px; }
.btn.big { padding: .85rem 1.5rem; font-size: 1.02rem; }
.btn.block { width: 100%; }
.btn.cat-visitor, .btn.cat-vendor, .btn.cat-contractor { color: #fff; border-color: transparent; }
.btn.cat-visitor:hover { background: #1d4fd8; } .btn.cat-vendor:hover { background: #9a4607; } .btn.cat-contractor:hover { background: #a8380a; }

/* ---------- flash, badges, chips */
.flash { padding: .75rem 1rem; border-radius: var(--r-sm); margin-bottom: 1rem; border: 1px solid; font-weight: 500; }
.flash.success { background: var(--ok-soft); border-color: #a7dcc0; color: var(--ok); }
.flash.error { background: var(--bad-soft); border-color: #f6c0ba; color: var(--bad); }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700; vertical-align: middle; background: #eef2f7; color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.st-approved { background: var(--brand-soft); color: var(--brand-d); }
.st-on-site { background: var(--ok-soft); color: var(--ok); }
.st-pending, .st-awaiting-details { background: var(--warn-soft); color: var(--warn); }
.st-rejected, .st-cancelled, .st-expired { background: var(--bad-soft); color: var(--bad); }
.cat { display: inline-block; padding: .06rem .5rem; border-radius: 6px; font-size: .7rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; vertical-align: middle; }
.cat-visitor { background: var(--visitor-soft); color: var(--visitor); }
.cat-vendor { background: var(--vendor-soft); color: var(--vendor); }
.cat-contractor { background: var(--contractor-soft); color: var(--contractor); }
.btn.cat-visitor, .cat-bg-visitor { background: var(--visitor); color: #fff; }
.btn.cat-vendor, .cat-bg-vendor { background: var(--vendor); color: #fff; }
.btn.cat-contractor, .cat-bg-contractor { background: var(--contractor); color: #fff; }
.cat-border-visitor { border-top: 6px solid var(--visitor); }
.cat-border-vendor { border-top: 6px solid var(--vendor); }
.cat-border-contractor { border-top: 6px solid var(--contractor); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chips a { padding: .38rem .85rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .88rem; }
.chips a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- avatars + person rows */
.av { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; object-fit: cover; font-weight: 800; font-size: .85rem; flex: none; background: #e2e8f0; color: var(--ink-2); }
.av.lg { width: 84px; height: 100px; border-radius: 16px; font-size: 1.7rem; }
.av.md { width: 52px; height: 52px; border-radius: 14px; font-size: 1rem; }
.av-visitor { background: var(--visitor-soft); color: var(--visitor); }
.av-vendor { background: var(--vendor-soft); color: var(--vendor); }
.av-contractor { background: var(--contractor-soft); color: var(--contractor); }
.plist { display: flex; flex-direction: column; }
.prow { display: flex; align-items: center; gap: .8rem; padding: .6rem .5rem; border-radius: 10px; color: inherit; text-decoration: none; }
.prow + .prow { border-top: 1px solid var(--line); }
.prow:hover { background: #f6f8fc; }
.prow-main { flex: 1; min-width: 0; }
.prow-main b { margin-right: .3rem; }
.prow-main small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow-right { text-align: right; font-size: .82rem; color: var(--muted); white-space: nowrap; }
.prow-right b { display: block; color: var(--ink); font-size: .9rem; }
.prow.overstay { background: var(--bad-soft); }

/* ---------- KPI tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { position: relative; display: flex; gap: .85rem; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; box-shadow: var(--shadow); color: inherit; text-decoration: none; }
a.tile:hover { border-color: var(--line-2); box-shadow: 0 4px 16px rgba(15,23,42,.08); }
.tile .tile-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: none; }
.tile .tile-ic .ic { width: 22px; height: 22px; }
.tile span.lbl { color: var(--muted); font-size: .82rem; font-weight: 600; }
.tile b { display: block; font-size: 1.9rem; line-height: 1.15; letter-spacing: -.02em; }
.tile small { color: var(--muted); font-size: .78rem; }
.ti-blue { background: var(--brand-soft); color: var(--brand); }
.ti-green { background: var(--ok-soft); color: var(--ok); }
.ti-amber { background: var(--warn-soft); color: var(--warn); }
.ti-red { background: var(--bad-soft); color: var(--bad); }
.ti-violet { background: #f1ebff; color: #6d28d9; }
.tile.alert { border-color: #f6c0ba; }
.tile.alert b { color: var(--bad); }
.mix { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: #eef2f7; margin-top: .45rem; }
.mix i { display: block; }
.w0{width:0}.w5{width:5%}.w10{width:10%}.w15{width:15%}.w20{width:20%}.w25{width:25%}.w30{width:30%}.w35{width:35%}.w40{width:40%}.w45{width:45%}.w50{width:50%}.w55{width:55%}.w60{width:60%}.w65{width:65%}.w70{width:70%}.w75{width:75%}.w80{width:80%}.w85{width:85%}.w90{width:90%}.w95{width:95%}.w100{width:100%}
.mix .m-visitor { background: var(--visitor); } .mix .m-vendor { background: var(--vendor); } .mix .m-contractor { background: var(--contractor); }

/* ---------- tables */
.tablewrap { overflow-x: auto; margin: 0 -.25rem; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: #f8fafc; }
.table tbody tr:hover td { background: #fafbfe; }
.table.compact th, .table.compact td { padding: .42rem .5rem; font-size: .88rem; }
.table tr.muted td { color: var(--muted); }
.row-danger td { background: var(--bad-soft) !important; }
.table td.actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.table.rules td:not(:first-child), .table.rules th:not(:first-child) { text-align: center; }
.cell-person { display: flex; align-items: center; gap: .65rem; color: inherit; text-decoration: none; }
a.cell-person:hover b { color: var(--brand); }
.cell-person small { display: block; color: var(--muted); }
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-top: 1rem; }
.thumb { width: 40px; height: 48px; object-fit: cover; border-radius: 8px; }
.ref { font: 600 .85rem ui-monospace, "Cascadia Mono", Consolas, monospace; }
td .menu { position: relative; }
td .menu > summary { list-style: none; cursor: pointer; }
td .menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; z-index: 20; top: calc(100% + 4px); right: 0; min-width: 280px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 32px rgba(15,23,42,.16); padding: .9rem; display: flex; flex-direction: column; gap: .6rem; }

/* ---------- pass detail */
.hero { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; padding: 1.25rem; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; }
.hero.cat-hero-visitor::before { background: var(--visitor); }
.hero.cat-hero-vendor::before { background: var(--vendor); }
.hero.cat-hero-contractor::before { background: var(--contractor); }
.hero-main { flex: 1; min-width: 220px; }
.hero-main h1 { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.crew-note { display: inline-flex; align-items: center; gap: .4rem; margin: .1rem 0 .35rem; padding: .2rem .65rem; border-radius: 999px; background: var(--contractor-soft); color: var(--contractor); font-size: .82rem; font-weight: 600; }
.crew-note a { color: inherit; }
.crew-note .ic { width: 15px; height: 15px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; margin-top: .45rem; color: var(--muted); font-size: .9rem; }
.hero-meta span { display: inline-flex; align-items: center; gap: .35rem; }
.steps { display: flex; list-style: none; margin: 0 0 1.1rem; padding: 1rem 1.1rem; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow-x: auto; }
.steps li { flex: 1; min-width: 110px; position: relative; text-align: center; font-size: .82rem; color: var(--muted); font-weight: 600; padding-top: 2.1rem; }
.steps li::before { content: ""; position: absolute; top: .95rem; left: -50%; right: 50%; height: 3px; background: var(--line); }
.steps li:first-child::before { display: none; }
.steps li .dot { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 3px solid var(--line-2); z-index: 1; font-size: .78rem; color: var(--muted); }
.steps li .dot .ic { width: 15px; height: 15px; }
.steps li.done { color: var(--ink); }
.steps li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.done::before, .steps li.current::before { background: var(--ok); }
.steps li.current { color: var(--brand); }
.steps li.current .dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 5px var(--brand-soft); }
.steps li.failed { color: var(--bad); }
.steps li.failed .dot { background: var(--bad); border-color: var(--bad); color: #fff; }
.steps small { display: block; font-weight: 400; font-size: .74rem; color: var(--muted); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .6rem; }
.checklist > li { border: 1px solid var(--line); border-radius: 12px; padding: .75rem .9rem; background: #fff; }
.checklist .ck-head { display: flex; align-items: center; gap: .75rem; }
.checklist .ck-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; flex: none; background: var(--warn-soft); color: var(--warn); }
.checklist li.ok .ck-ic { background: var(--ok-soft); color: var(--ok); }
.checklist .ck-text { flex: 1; min-width: 0; }
.checklist .ck-text small { display: block; color: var(--muted); }
.checklist .ck-state { font-size: .78rem; font-weight: 700; color: var(--warn); }
.checklist li.ok .ck-state { color: var(--ok); }
.checklist details { margin-top: .7rem; padding-top: .7rem; border-top: 1px dashed var(--line); }
.checklist summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: .9rem; }
.checklist form { margin-top: .6rem; }
/* Dots and connecting line are drawn inside each item, so the scrolling list never clips them. */
.timeline { list-style: none; padding: 0; margin: 0; max-height: 420px; overflow: auto; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; font-size: .88rem; line-height: 1.45; }
.timeline li::before { content: ""; position: absolute; left: 0; top: .3rem; width: 12px; height: 12px; box-sizing: border-box; border-radius: 50%; background: #fff; border: 3px solid var(--brand); z-index: 1; }
.timeline li::after { content: ""; position: absolute; left: 5px; top: 1rem; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline li:first-child::before { background: var(--brand); }
.timeline small { color: var(--muted); }
.camera video, .camera img { display: block; max-width: 100%; width: 340px; border-radius: 12px; background: #000; margin: .5rem 0; }
.camera img { background: none; }
.checkin-box { background: linear-gradient(180deg, #f6fff9, #fff); border: 1px solid #bfe6cf; border-radius: var(--r); padding: 1rem 1.1rem; }

/* ---------- category picker on forms */
.tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; margin-bottom: 1.1rem; }
.tab { display: flex; gap: .8rem; align-items: center; padding: .9rem 1rem; border-radius: var(--r); border: 2px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.tab:hover { border-color: var(--line-2); }
.tab .tab-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: none; }
.tab .tab-ic .ic { width: 22px; height: 22px; }
.tab b { display: block; }
.tab small { display: block; color: var(--muted); font-size: .8rem; }
.tab-visitor .tab-ic { background: var(--visitor-soft); color: var(--visitor); }
.tab-vendor .tab-ic { background: var(--vendor-soft); color: var(--vendor); }
.tab-contractor .tab-ic { background: var(--contractor-soft); color: var(--contractor); }
.tab.on.tab-visitor { border-color: var(--visitor); box-shadow: 0 0 0 4px var(--visitor-soft); }
.tab.on.tab-vendor { border-color: var(--vendor); box-shadow: 0 0 0 4px var(--vendor-soft); }
.tab.on.tab-contractor { border-color: var(--contractor); box-shadow: 0 0 0 4px var(--contractor-soft); }

/* ---------- public */
.pub-hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.5rem; align-items: center; margin: .5rem 0 1.5rem; }
.pub-hero h1 { font-size: 2rem; }
.howto { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.howto li { display: flex; gap: .6rem; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .6rem .75rem; font-size: .88rem; font-weight: 600; }
.howto li span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: .8rem; flex: none; }
.auth-page .public-top, .auth-page .foot { display: none; }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: radial-gradient(circle at 20% 20%, #2f5bea 0, transparent 45%), radial-gradient(circle at 80% 70%, #c2410c55 0, transparent 40%), linear-gradient(160deg, #0b1b33, #12284a); color: #e6edf9; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h2 { font-size: 2rem; line-height: 1.2; margin: 0 0 1rem; color: #fff; }
.auth-art ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .8rem; }
.auth-art li { display: flex; gap: .7rem; align-items: center; }
.auth-art li .ic { width: 22px; height: 22px; color: #8fb0ff; }
.auth-art .brand { padding: 0; }
.auth-form { display: grid; place-items: center; padding: 2rem 1.25rem; }
.auth-form .card { width: 100%; max-width: 410px; padding: 2rem; }
.epass { max-width: 420px; margin: 0 auto 1rem; padding: 0; overflow: hidden; }
.epass-head { display: flex; justify-content: space-between; align-items: center; color: #fff; padding: .9rem 1.1rem; font-weight: 600; }
.epass-body { padding: 1.1rem; }
.qr { display: block; margin: 1rem auto .5rem; image-rendering: pixelated; border-radius: 8px; }

/* ---------- registration wizard */
.wizard-head { max-width: 760px; margin: .5rem auto 1rem; }
.wizard-head h1 { font-size: 1.8rem; }
.wizard { max-width: 760px; margin: 0 auto; padding: 1.25rem 1.5rem 1rem; scroll-margin-top: 84px; }
fieldset.identity legend .muted { font-weight: 500; }
@media (max-width: 640px) { fieldset.identity legend { flex-wrap: wrap; } fieldset.identity legend .muted { flex-basis: 100%; font-size: .8rem; } }
.wizard-bar { display: flex; list-style: none; padding: 0; margin: 0 0 1.4rem; gap: .4rem; }
.wizard-bar li { flex: 1; display: flex; align-items: center; gap: .5rem; padding-bottom: .6rem; border-bottom: 3px solid var(--line); color: var(--muted); font-size: .85rem; }
.wizard-bar li span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #eef2f7; font-weight: 800; font-size: .8rem; flex: none; }
.wizard-bar li.current { border-color: var(--brand); color: var(--ink); }
.wizard-bar li.current span { background: var(--brand); color: #fff; }
.wizard-bar li.done { border-color: var(--ok); color: var(--ink-2); }
.wizard-bar li.done span { background: var(--ok); color: #fff; }
.wizard-step h2 { margin: 0 0 1rem; font-size: 1.15rem; }
.wizard:not(.wizard-on) .wizard-step + .wizard-step { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.wizard-nav { display: flex; align-items: center; gap: .75rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.wizard-nav [data-wizard-next], .wizard-nav [data-wizard-submit] { margin-left: auto; }
.wizard-count { color: var(--muted); font-size: .85rem; }
.wizard:not(.wizard-on) .wizard-count { display: none; }
.cat-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-bottom: 1.1rem; }
.cat-opt { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; padding: .8rem .9rem; border: 2px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: #fff; }
.cat-opt .ic { width: 24px; height: 24px; margin-bottom: .2rem; }
.cat-opt small { color: var(--muted); font-size: .78rem; line-height: 1.3; }
.cat-opt-visitor .ic { color: var(--visitor); } .cat-opt-vendor .ic { color: var(--vendor); } .cat-opt-contractor .ic { color: var(--contractor); }
.cat-opt-visitor.on { border-color: var(--visitor); background: var(--visitor-soft); }
.cat-opt-vendor.on { border-color: var(--vendor); background: var(--vendor-soft); }
.cat-opt-contractor.on { border-color: var(--contractor); background: var(--contractor-soft); }
.review { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; margin: 1rem 0; }
.review h3 { margin: 0 0 .6rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
@media (max-width: 640px) {
  .wizard-head h1 { font-size: 1.45rem; }
  .wizard { padding: 1rem .9rem 0; border-radius: 12px; }
  .wizard-bar li b { display: none; }
  .wizard-bar li { justify-content: center; }
  .cat-pick { grid-template-columns: repeat(3, 1fr); gap: .4rem; }
  .cat-opt { align-items: center; text-align: center; padding: .6rem .3rem; }
  .cat-opt small { display: none; }
  .wizard-on .wizard-nav { position: sticky; bottom: 0; background: #fff; margin: 1rem -.9rem 0; padding: .75rem .9rem calc(.75rem + env(safe-area-inset-bottom)); box-shadow: 0 -6px 16px rgba(15,23,42,.08); z-index: 5; }
  .wizard-nav .btn { padding: .7rem 1.1rem; }
  .public-wrap { padding: .75rem .6rem 1.5rem; }
  .upload-tile .grid.two { grid-template-columns: 1fr 1fr; }
}

/* ---------- visitor photo / ID upload */
fieldset.identity legend { display: flex; align-items: center; gap: .4rem; }
.upload-tile { border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: .9rem; display: flex; flex-direction: column; gap: .4rem; }
.upload-head { display: flex; gap: .6rem; align-items: center; }
.upload-head .ic { width: 22px; height: 22px; color: var(--brand); }
.upload-head small { display: block; color: var(--muted); font-size: .8rem; }
.upload-tile video, .upload-preview { width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; background: #0f172a; }
.upload-preview { background: #f1f5f9; }
.upload-tile .grid { gap: .6rem; }
.upload-tile label { margin-bottom: .2rem; }
.id-status { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: 1rem 0 .6rem; }
.id-status div { display: flex; align-items: center; gap: .4rem; padding: .5rem .7rem; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: .88rem; }
.id-status div.ok { background: var(--ok-soft); color: var(--ok); }
.submitted { display: flex; gap: .8rem; align-items: flex-start; margin-top: .7rem; padding: .7rem; border-radius: 10px; background: var(--brand-soft); }
.submitted img { width: 96px; height: 116px; object-fit: cover; border-radius: 10px; background: #fff; flex: none; }
.submitted form { margin: .4rem 0 0; }
.result { padding: 2rem 1.5rem; }
.result-ic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 1rem; }
.result-ic .ic { width: 32px; height: 32px; }
.result-ic.ok { background: var(--ok-soft); color: var(--ok); }
.result-ic.bad { background: var(--bad-soft); color: var(--bad); }

.mail-frame { width: 100%; height: 640px; border: 0; border-radius: 10px; background: #f4f6fb; }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; font: .85rem/1.5 ui-monospace, Consolas, monospace; margin: 0; color: var(--ink-2); }
.tile b.small-b { font-size: 1.2rem; }

dialog.lightbox { width: min(900px, calc(100vw - 2rem)); }
.lightbox .modal-body { padding: 1rem; text-align: center; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 10rem); border-radius: 10px; background: #f1f5f9; }

/* ---------- modal dialogs */
dialog.modal { width: min(640px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 24px 64px rgba(15,23,42,.3); color: var(--ink); }
dialog.modal::backdrop { background: rgba(15,23,42,.5); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-head h2 { margin: 0; }
.modal-head small { color: var(--muted); }
.modal-head .icon-link { color: var(--muted); font-size: 1rem; }
.modal-head .icon-link:hover { background: #f1f5f9; color: var(--ink); }
.modal-body { padding: .25rem 1.25rem 1rem; }
.modal-section { padding: 1rem 0; border-top: 1px solid var(--line); }
.modal-section:first-child { border-top: 0; }
.modal-section h3 { margin: 0 0 .75rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.modal-foot { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.25rem; border-top: 1px solid var(--line); background: #f8fafc; }
.type-pick { display: flex; flex-direction: column; gap: .65rem; padding-bottom: .5rem; }
.type-pick .tab { padding: 1rem 1.1rem; }
.type-pick .tab > span:nth-child(2) { flex: 1; }
.type-pick .tab .go { color: var(--muted); transition: transform .15s; }
.type-pick .tab:hover .go { transform: translateX(3px); color: var(--ink); }
.type-pick .tab-visitor:hover { border-color: var(--visitor); }
.type-pick .tab-vendor:hover { border-color: var(--vendor); }
.type-pick .tab-contractor:hover { border-color: var(--contractor); }
.section-title { margin: 1.4rem 0 .7rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.field-label { display: block; font-weight: 600; font-size: .85rem; color: var(--ink-2); margin-bottom: .3rem; }
.day-pick { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .85rem; }
.day-pick label { margin: 0 !important; display: block !important; cursor: pointer; }
.day-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.day-pick span { display: inline-block; padding: .45rem .65rem; border: 1px solid var(--line-2); border-radius: 9px; font-weight: 600; font-size: .85rem; color: var(--muted); background: #fff; }
.day-pick input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.day-pick input:focus-visible + span { outline: 3px solid #93b4ff; outline-offset: 2px; }
.confirm-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; padding-top: 1rem; margin-top: .5rem; border-top: 1px solid var(--line); }
.confirm-row label { flex: 1 1 240px; margin: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.inline-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; }
td.right { text-align: right; }
.role { display: inline-block; padding: .12rem .55rem; border-radius: 6px; font-size: .78rem; font-weight: 700; background: #eef2f7; color: var(--ink-2); }
.role-admin { background: #f1ebff; color: #6d28d9; }
.role-reception { background: var(--brand-soft); color: var(--brand-d); }
.role-guard { background: var(--ok-soft); color: var(--ok); }
.role-host { background: var(--warn-soft); color: var(--warn); }
.st-active { background: var(--ok-soft); color: var(--ok); }
.st-inactive { background: #eef2f7; color: var(--muted); }

/* ---------- verify */
.verdict { border-radius: var(--r); padding: 1.4rem; text-align: center; color: #fff; margin-bottom: 1.1rem; box-shadow: var(--shadow); }
.verdict h1 { font-size: 2.1rem; letter-spacing: .02em; display: flex; align-items: center; justify-content: center; gap: .6rem; }
.verdict h1 .ic { width: 34px; height: 34px; }
.verdict p { margin: .3rem 0 0; opacity: .92; }
.verdict.good { background: linear-gradient(135deg, #14935c, #0f7a4a); }
.verdict.bad { background: linear-gradient(135deg, #dc3b2f, #b3241a); }
.verdict.ready { background: linear-gradient(135deg, #2f5bea, #2347c5); }
.verify-card { display: flex; flex-wrap: wrap; gap: 1.4rem; align-items: flex-start; }
.verify-photos { display: flex; gap: .75rem; flex-wrap: wrap; }
.verify-photos figure { margin: 0; text-align: center; }
.verify-photos figcaption { font-size: .75rem; color: var(--muted); margin-top: .25rem; font-weight: 600; }
.verify-info { flex: 1; min-width: 240px; }
.verify-info h2 { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: 1.3rem; margin: 0; }
.id-thumb { display: block; margin-bottom: .9rem; text-decoration: none; color: var(--muted); font-size: .8rem; }
.id-thumb img { display: block; width: 100%; max-height: 200px; object-fit: contain; border-radius: 10px; background: #f1f5f9; border: 1px solid var(--line); margin-bottom: .3rem; }
.verify-photo { width: 180px; height: 220px; object-fit: cover; border-radius: 14px; }
.verify-photo.empty { display: grid; place-items: center; background: #eef2f7; color: var(--muted); }
.scan-box { max-width: 640px; margin: 0 auto; text-align: center; }
.scan-box .scan-ic { width: 64px; height: 64px; color: var(--brand); margin: .5rem auto 1rem; display: block; }
.center-row, .actions-row.center { justify-content: center; }
.scan-box .plist { text-align: left; }
.scan-form input[name=code] { font-size: 1.3rem; padding: .9rem 1rem; text-align: center; }
.scan-video { width: 100%; max-width: 420px; border-radius: 12px; margin: .75rem auto 0; display: block; }

/* ---------- printed badge (about 86 × 120 mm) */
.badge-card { width: 86mm; margin: 1rem auto; background: #fff; border: 1px solid #999; border-radius: 3mm; overflow: hidden; color: #000; box-shadow: var(--shadow); }
.badge-card header { display: flex; justify-content: space-between; align-items: center; padding: 2.5mm 3.5mm; color: #fff; }
.badge-card header .org { font-size: 9pt; font-weight: 600; }
.badge-card header .kind { font-size: 15pt; font-weight: 800; letter-spacing: .06em; }
.badge-main { display: flex; gap: 3mm; padding: 3mm 3.5mm 1mm; }
.badge-photo { width: 26mm; height: 32mm; object-fit: cover; border: 1px solid #ccc; flex: none; border-radius: 1.5mm; }
.badge-photo.empty { display: grid; place-items: center; font-size: 8pt; color: #777; }
.badge-who .name { font-size: 14pt; font-weight: 800; margin: 0 0 1mm; line-height: 1.15; }
.badge-who .company { font-size: 10pt; margin: 0 0 1.5mm; }
.badge-who .ref { font: 700 11pt ui-monospace, Consolas, monospace; margin: 0; }
.badge-kv { display: grid; grid-template-columns: max-content 1fr; gap: .5mm 2.5mm; margin: 0; padding: 1mm 3.5mm; font-size: 8.5pt; }
.badge-kv dt { color: #555; }
.badge-kv dd { margin: 0; }
.badge-card footer { display: flex; gap: 3mm; align-items: center; padding: 2mm 3.5mm 3mm; border-top: 1px dashed #bbb; margin-top: 1.5mm; }
.badge-qr { width: 24mm; height: 24mm; image-rendering: pixelated; flex: none; }
.badge-card footer p { font-size: 7.5pt; margin: 0; color: #333; }
.muster .tickbox { width: 10mm; border: 1px solid #000; }
.print-page .wrap { max-width: 900px; }

/* ---------- responsive */
@media (max-width: 1100px) {
  .grid.detail { grid-template-columns: 1fr; }
  .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; visibility: hidden; }
  body.nav-open .sidebar { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 35; }
  .main-col { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .pub-hero { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .wrap { padding: 1rem .9rem 2rem; }
  .topbar { padding: .6rem .9rem; }
  .today-chip { display: none; }
  h1 { font-size: 1.3rem; }
  .form-section > .num { display: none; }
  .howto { grid-template-columns: 1fr; }
  .public-top nav a:not(.btn) { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .tile { padding: .8rem; } .tile .tile-ic { display: none; } .tile b { font-size: 1.5rem; }
  .verdict h1 { font-size: 1.45rem; } .verdict h1 .ic { width: 26px; height: 26px; }
  .verify-photo { width: 140px; height: 170px; }
}

/* ---------- print */
@media print {
  @page { margin: 10mm; }
  body { background: #fff; }
  .no-print, .sidebar, .topbar, .foot, .flash, .public-top { display: none !important; }
  .main-col { margin: 0; }
  .wrap { padding: 0; max-width: none; }
  .badge-card { margin: 0; border-color: #000; box-shadow: none; }
  .cat-bg-visitor, .cat-bg-vendor, .cat-bg-contractor, .cat { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table th { background: none; }
  .table th, .table td { border-bottom: 1px solid #999; }
}
