:root {
  /* Rajagiri Hospital brand: magenta cross #ED145A, navy wordmark #003F5E */
  --indigo: #ED145A; --indigo-light: #F43F76; --indigo-bg: #FFE4EE;
  --ink: #003F5E; --ink-2: #0C5578; --ink-3: #0A4A66; --ink-line: #14567A;
  --body: #1E293B; --slate: #475569; --grey: #64748B;
  --line: #E2E8F0; --line-soft: #F1F5F9; --bg: #F8FAFC; --white: #fff;
  --green: #16A34A; --green-bg: #F0FDF4; --amber: #D97706; --amber-bg: #FFFBEB;
  --red: #DC2626; --red-bg: #FEF2F2; --cyan: #0891B2; --cyan-bg: #ECFEFF;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
  --shadow: 0 4px 12px rgba(15,23,42,.07), 0 1px 3px rgba(15,23,42,.05);
  --shadow-lg: 0 18px 44px rgba(15,23,42,.16);
  --r: 12px; --r-sm: 8px; --r-lg: 18px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); background: var(--bg); color: var(--body);
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; color: var(--ink); letter-spacing: -.02em; font-weight: 600; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
p { margin: 0 0 10px; }
a { color: var(--indigo); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
.muted { color: var(--grey); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 4px; }
.mt-0 { margin-top: 0; } .mt { margin-top: 14px; } .mt-lg { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb { margin-bottom: 14px; }

/* ---------------------------------------------------------------- layout -- */
#app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  background: var(--ink); color: #fff; padding: 0 22px; height: 58px;
  display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--indigo-light), var(--cyan)); color: #fff;
  font-weight: 700; font-size: 13px; letter-spacing: -.5px;
}
.brand-logo { width: 30px; height: 30px; object-fit: contain; flex-shrink: 0; display: block; }
.brand-logo.lg { width: 40px; height: 40px; }
.brand-full { height: 30px; width: auto; object-fit: contain; display: block; }
.brand-text { line-height: 1.15; }
.brand-text b { font-size: 14px; font-weight: 600; letter-spacing: -.2px; }
.brand-text span { display: block; font-size: 10.5px; color: #94A3B8; }
.nav { display: flex; gap: 2px; margin-left: 12px; }
.nav button {
  background: transparent; border: 0; color: #CBD5E1; padding: 7px 12px;
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; transition: .15s;
  white-space: nowrap;
}
.nav button:hover { background: rgba(255,255,255,.09); color: #fff; }
.nav button.active { background: var(--indigo); color: #fff; }
.nav button .pill { background: rgba(255,255,255,.25); border-radius: 20px; padding: 0 6px; margin-left: 6px; font-size: 11px; }
.topbar-user { display: flex; align-items: center; gap: 9px; }
.topbar-user img { width: 30px; height: 30px; border-radius: 50%; background: #fff; }
.topbar-user .who { line-height: 1.2; text-align: right; }
.topbar-user .who b { font-size: 12.5px; font-weight: 600; color: #fff; }
.topbar-user .who span { display: block; font-size: 10.5px; color: #94A3B8; }
.link-btn { background: none; border: 0; color: #94A3B8; cursor: pointer; font-size: 12px; padding: 6px; }
.link-btn:hover { color: #fff; }

main { flex: 1; padding: 24px; max-width: 1240px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-head p { color: var(--grey); font-size: 13px; margin: 4px 0 0; max-width: 640px; }

/* ----------------------------------------------------------------- cards -- */
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-sm); padding: 18px;
}
.card.flush { padding: 0; }
/* let a table fill a padded card edge-to-edge */
.card > table.tbl:only-child { margin: -18px; width: calc(100% + 36px); }
.card-pad { padding: 18px; }
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.card-body { padding: 18px; }
.card-body.tight { padding: 12px 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g-main { grid-template-columns: minmax(0,1.65fr) minmax(0,1fr); }
@media (max-width: 940px) { .g2,.g3,.g4,.g-main { grid-template-columns: 1fr; } }

/* ----------------------------------------------------------------- stats -- */
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.stat .label { font-size: 11.5px; color: var(--grey); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat .value { font-size: 27px; font-weight: 650; color: var(--ink); letter-spacing: -.03em; line-height: 1.25; margin-top: 4px; }
.stat .sub { font-size: 12px; color: var(--grey); }
.stat.live { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-bg); }
.stat.live .value { color: var(--indigo); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* --------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--body);
  padding: 8px 14px; border-radius: var(--r-sm); cursor: pointer; font-weight: 550;
  font-size: 13px; transition: .14s; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #CBD5E1; background: var(--line-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #C60F4B; border-color: #C60F4B; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover:not(:disabled) { background: #14567A; }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.success:hover:not(:disabled) { background: #15803D; }
.btn.danger { background: #fff; border-color: #FCA5A5; color: var(--red); }
.btn.danger:hover:not(:disabled) { background: var(--red-bg); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--slate); }
.btn.ghost:hover:not(:disabled) { background: var(--line-soft); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.lg { padding: 12px 22px; font-size: 14px; }
.btn.block { width: 100%; }

/* --------------------------------------------------------------- badges --- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 20px; font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  background: var(--line-soft); color: var(--slate); border: 1px solid transparent;
}
.badge.green { background: var(--green-bg); color: #15803D; }
.badge.amber { background: var(--amber-bg); color: #B45309; }
.badge.red { background: var(--red-bg); color: #B91C1C; }
.badge.indigo { background: var(--indigo-bg); color: #C60F4B; }
.badge.cyan { background: var(--cyan-bg); color: #0E7490; }
.badge.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------------------------------------------------------------- forms --- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--slate); margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--grey); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; color: var(--body); outline: none; transition: .14s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-bg); }
.input:disabled, .select:disabled { background: var(--line-soft); color: var(--grey); }
.textarea { resize: vertical; min-height: 76px; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%2364748B' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--indigo); cursor: pointer; }

/* ---------------------------------------------------------------- table --- */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--grey); font-weight: 650; padding: 9px 14px; border-bottom: 1px solid var(--line);
  background: #FCFDFE; position: sticky; top: 0;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13px; vertical-align: middle; }
.tbl tbody tr:hover { background: #FCFDFE; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-y { max-height: 460px; overflow-y: auto; }

/* --------------------------------------------------------------- avatars -- */
.av { border-radius: 50%; background: var(--line-soft); flex-shrink: 0; object-fit: cover; }
.av-24 { width: 24px; height: 24px; } .av-32 { width: 32px; height: 32px; }
.av-40 { width: 40px; height: 40px; } .av-56 { width: 56px; height: 56px; }
.av-88 { width: 88px; height: 88px; } .av-120 { width: 120px; height: 120px; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .nm { font-weight: 600; color: var(--ink); font-size: 13px; }
.person .sub { font-size: 11.5px; color: var(--grey); }

/* -------------------------------------------------------------- requests -- */
.req {
  border: 1px solid var(--line); border-radius: var(--r); background: #fff;
  padding: 15px 16px; display: flex; gap: 14px; transition: .15s; position: relative;
}
.req:hover { border-color: #CBD5E1; box-shadow: var(--shadow); }
.req.selected { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-bg); }
.req-main { flex: 1; min-width: 0; }
.req-actions { display: flex; flex-direction: column; gap: 7px; justify-content: center; }
.req .msg {
  background: var(--line-soft); border-radius: var(--r-sm); padding: 9px 11px;
  font-size: 12.5px; color: var(--slate); margin-top: 9px; border-left: 3px solid var(--indigo-light);
}
.req .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; color: var(--grey); }
.req .meta b { color: var(--body); font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 11px; }

.empty { text-align: center; padding: 44px 20px; color: var(--grey); }
.empty .icon { font-size: 30px; opacity: .35; margin-bottom: 8px; }
.empty h3 { color: var(--slate); margin-bottom: 4px; }

/* ---------------------------------------------------------------- slots --- */
.daybar { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; }
.day {
  min-width: 66px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 6px;
  text-align: center; cursor: pointer; background: #fff; transition: .14s; flex-shrink: 0;
}
.day:hover:not(.off) { border-color: var(--indigo-light); }
.day.off { opacity: .42; cursor: not-allowed; background: var(--line-soft); }
.day.on { border-color: var(--indigo); background: var(--indigo-bg); }
.day .dw { font-size: 10.5px; text-transform: uppercase; color: var(--grey); font-weight: 650; letter-spacing: .04em; }
.day .dd { font-size: 17px; font-weight: 650; color: var(--ink); line-height: 1.3; }
.day .dm { font-size: 10.5px; color: var(--grey); }
.day.on .dd { color: var(--indigo); }
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slot {
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; background: #fff;
  cursor: pointer; text-align: center; min-width: 88px; transition: .14s;
}
.slot:hover:not(.full) { border-color: var(--indigo-light); background: var(--indigo-bg); }
/* keep the chosen slot readable even while the pointer is still on it */
.slot.on, .slot.on:hover:not(.full) { border-color: var(--indigo); background: var(--indigo); color: #fff; }
.slot.on .cap, .slot.on:hover .cap { color: rgba(255,255,255,.85); }
.slot.full { opacity: .48; cursor: not-allowed; background: var(--line-soft); }
.slot .t { font-weight: 650; font-size: 13px; }
.slot .cap { font-size: 10.5px; color: var(--grey); }

/* ----------------------------------------------------------------- pass --- */
.pass {
  border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: #fff;
  box-shadow: var(--shadow); max-width: 340px;
}
.pass-top { background: var(--ink); color: #fff; padding: 14px 18px; }
.pass-top .h { font-size: 13px; font-weight: 600; }
.pass-top .s { font-size: 11px; color: #94A3B8; }
.pass-body { padding: 20px; text-align: center; }
.pass-body img { width: 168px; height: 168px; display: block; margin: 0 auto 12px; }
.pass-code { font-family: var(--mono); font-size: 17px; font-weight: 650; letter-spacing: 1px; color: var(--ink); }
.pass-valid { font-size: 11.5px; color: var(--grey); margin-top: 8px; line-height: 1.6; }
.pass-foot { border-top: 1px dashed var(--line); padding: 13px 18px; background: #FCFDFE; font-size: 12px; }
.pass.expired { opacity: .95; }
.pass.expired .pass-body img { filter: grayscale(1); opacity: .35; }

/* ---------------------------------------------------------------- verdict - */
.verdict { border-radius: var(--r-lg); padding: 26px; text-align: center; color: #fff; }
.verdict.allow { background: linear-gradient(160deg, #16A34A, #15803D); }
.verdict.flagged { background: linear-gradient(160deg, #D97706, #B45309); }
.verdict.deny { background: linear-gradient(160deg, #DC2626, #B91C1C); }
.verdict.inside { background: linear-gradient(160deg, #0891B2, #0E7490); }
.verdict .mark { font-size: 46px; line-height: 1; margin-bottom: 6px; }
.verdict .head { font-size: 25px; font-weight: 650; letter-spacing: -.02em; }
.verdict .why { font-size: 13.5px; opacity: .92; margin-top: 6px; }
.verdict-card { background: rgba(255,255,255,.14); border-radius: var(--r); padding: 14px; margin-top: 18px; text-align: left; }
.verdict-card .row { justify-content: space-between; font-size: 13px; }
.verdict-card .k { opacity: .8; }
.scanbox {
  border: 2px dashed var(--line); border-radius: var(--r-lg); padding: 30px; text-align: center;
  background: #fff;
}
.scan-input {
  font-family: var(--mono); font-size: 21px; text-align: center; letter-spacing: 2px;
  padding: 14px; border: 1px solid var(--line); border-radius: var(--r-sm); width: 100%;
  text-transform: uppercase; outline: none;
}
.scan-input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-bg); }
#reader { border-radius: var(--r); overflow: hidden; }
#reader video { width: 100% !important; border-radius: var(--r); }

/* --------------------------------------------------------------- charts --- */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 46px; align-items: center; gap: 11px; font-size: 12.5px; }
.bar-track { height: 9px; background: var(--line-soft); border-radius: 20px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--indigo), var(--indigo-light)); transition: width .5s ease; }
.bar-fill.cyan { background: linear-gradient(90deg, var(--cyan), #22D3EE); }
.bar-label { color: var(--slate); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 84px; }
.spark div { flex: 1; background: var(--indigo-bg); border-radius: 3px 3px 0 0; min-height: 3px; position: relative; overflow: hidden; transition: .3s; }
.spark div .fill { position: absolute; bottom: 0; left: 0; right: 0; background: var(--indigo); border-radius: 3px 3px 0 0; }
.spark div:hover { background: #FBCFE0; }

/* ------------------------------------------------------------ timeline ---- */
.tl { position: relative; padding-left: 22px; }
.tl::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1.5px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 15px; }
.tl-item::before {
  content: ''; position: absolute; left: -20px; top: 5px; width: 9px; height: 9px;
  border-radius: 50%; background: #fff; border: 2px solid var(--indigo);
}
.tl-item.sys::before { border-color: var(--grey); }
.tl-item.deny::before { border-color: var(--red); }
.tl-item.ok::before { border-color: var(--green); }

/* ---------------------------------------------------------------- modal --- */
.overlay {
  position: fixed; inset: 0; background: rgba(9,9,11,.5); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  max-width: 620px; width: 100%; max-height: 90vh; display: flex; flex-direction: column;
  animation: rise .2s cubic-bezier(.2,.9,.3,1);
}
.modal.wide { max-width: 860px; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.modal-head { padding: 17px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; background: #FCFDFE; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.x { background: none; border: 0; font-size: 20px; color: var(--grey); cursor: pointer; line-height: 1; padding: 3px 6px; border-radius: 6px; }
.x:hover { background: var(--line-soft); color: var(--ink); }

/* --------------------------------------------------------------- toasts --- */
#toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg); font-size: 13px; max-width: 380px;
  animation: slide .2s cubic-bezier(.2,.9,.3,1); display: flex; gap: 9px; align-items: flex-start;
}
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

/* --------------------------------------------------------------- landing -- */
.landing { min-height: 100vh; background: var(--ink); color: #fff; display: flex; flex-direction: column; }
.landing-inner { max-width: 1100px; margin: 0 auto; padding: 40px 24px 56px; width: 100%; }
.landing-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 44px; }
.hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: 48px; align-items: center; margin-bottom: 46px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 28px; } }
.hero h1 { color: #fff; font-size: 40px; line-height: 1.12; letter-spacing: -.035em; margin-bottom: 14px; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--indigo-light), #22D3EE); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: #94A3B8; font-size: 15px; line-height: 1.65; max-width: 480px; }
.hero-stats { display: flex; gap: 26px; margin-top: 24px; flex-wrap: wrap; }
.hero-stats b { display: block; font-size: 21px; color: #fff; letter-spacing: -.02em; }
.hero-stats span { font-size: 11.5px; color: #64748B; text-transform: uppercase; letter-spacing: .05em; }
.qr-card { background: #fff; border-radius: var(--r-lg); padding: 22px; text-align: center; color: var(--body); }
.qr-card img { width: 172px; height: 172px; }
.roles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .roles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .roles { grid-template-columns: 1fr; } }
.role {
  background: #0A4A66; border: 1px solid #14567A; border-radius: var(--r); padding: 18px;
  cursor: pointer; transition: .16s; text-align: left;
}
.role:hover { border-color: var(--indigo); background: #0C5578; transform: translateY(-2px); }
.role .ic { font-size: 21px; margin-bottom: 9px; color: var(--indigo-light); }
.role h3 { color: #fff; font-size: 14px; margin-bottom: 4px; }
.role p { color: #94A3B8; font-size: 12px; line-height: 1.5; margin: 0; }
.role .go { color: var(--indigo-light); font-size: 12px; font-weight: 600; margin-top: 10px; }
.landing-foot { border-top: 1px solid #14567A; padding: 18px 24px; text-align: center; color: #94A3B8; font-size: 12px; }

.picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 560px) { .picker { grid-template-columns: 1fr; } }
.pick {
  display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: #fff; cursor: pointer; text-align: left; transition: .14s; width: 100%;
}
.pick:hover { border-color: var(--indigo); background: var(--indigo-bg); }

.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.step { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.step.done { background: var(--indigo); }

.kv { display: grid; grid-template-columns: 138px 1fr; gap: 7px 14px; font-size: 13px; }
.kv .k { color: var(--grey); }
.kv .v { color: var(--body); font-weight: 500; }

.note {
  border-left: 3px solid var(--indigo); background: var(--indigo-bg); padding: 11px 13px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 12.5px; color: #9D174D;
}
.note.amber { border-color: var(--amber); background: var(--amber-bg); color: #92400E; }
.note.red { border-color: var(--red); background: var(--red-bg); color: #991B1B; }
.note.green { border-color: var(--green); background: var(--green-bg); color: #166534; }

.email-frame { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--bg); }
.email-frame iframe { width: 100%; border: 0; display: block; min-height: 560px; }
.email-bar { padding: 9px 14px; background: #FCFDFE; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--grey); }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 14px;
  cursor: pointer; color: var(--grey); font-weight: 550; font-size: 13px; white-space: nowrap;
}
.tabs button:hover { color: var(--body); }
.tabs button.active { color: var(--indigo); border-bottom-color: var(--indigo); }

/* --------------------------------------------------------- token queue ---- */
.tok {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  background: var(--line-soft); color: var(--slate); font-variant-numeric: tabular-nums;
}
.tok.serving { background: var(--indigo); color: #fff; box-shadow: 0 0 0 3px var(--indigo-bg); }
.tok.present { background: var(--green-bg); color: #15803D; }
.tok.awaited { background: #fff; color: var(--grey); border: 1px dashed var(--line); }
.tok.done { background: var(--line-soft); color: #94A3B8; }
.tok.no_show { background: var(--red-bg); color: #B91C1C; }
.qrow {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: #fff; transition: .15s;
}
.qrow + .qrow { margin-top: 8px; }
.qrow.serving { border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-bg); }
.qrow.next { border-color: #86EFAC; background: #F6FEF9; }
.qrow.done, .qrow.no_show { opacity: .62; }
.qrow .who { flex: 1; min-width: 0; }
.now-serving {
  background: linear-gradient(135deg, var(--ink), #0C5578); color: #fff;
  border-radius: var(--r); padding: 16px 18px; display: flex; align-items: center; gap: 16px;
}
.now-serving .big { font-size: 34px; font-weight: 700; line-height: 1; }
.now-serving .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #94A3B8; }
.now-serving .nm2 { font-size: 16px; font-weight: 600; }

.loading { padding: 60px; text-align: center; color: var(--grey); }
.sp { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--indigo); border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media print {
  .topbar, .nav, .btn, .no-print { display: none !important; }
  body { background: #fff; }
}

/* ==================== admin-workflow additions ==================== */
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.card.soft { background: var(--bg); }
.card.list, .card .list { display: flex; flex-direction: column; }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); }
.li:last-child { border-bottom: 0; }
.li-dot { width: 9px; height: 9px; border-radius: 50%; background: #CBD5E1; flex-shrink: 0; }
.li-dot.green { background: var(--green); } .li-dot.amber { background: var(--amber); }
.li-dot.red { background: var(--red); } .li-dot.cyan { background: var(--cyan); }
.stack { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.row { display: flex; align-items: center; gap: 10px; }
.muted { color: var(--grey); } .tiny { font-size: 11.5px; } .small { font-size: 13px; }

/* KPI cards */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .kpi-row { grid-template-columns: 1fr 1fr; } }
.kpi { background: #fff; border: 1px solid var(--line); border-left: 4px solid #CBD5E1; border-radius: var(--r); padding: 16px 18px; }
.kpi b { display: block; font-size: 26px; font-weight: 750; color: var(--ink); line-height: 1; }
.kpi span { display: block; font-size: 12px; color: var(--grey); margin-top: 6px; }
.kpi.indigo { border-left-color: var(--indigo); } .kpi.green { border-left-color: var(--green); }
.kpi.amber { border-left-color: var(--amber); } .kpi.red { border-left-color: var(--red); } .kpi.cyan { border-left-color: var(--cyan); }
.stat-big b { font-size: 30px; font-weight: 750; color: var(--indigo); } .stat-big span { display: block; font-size: 12px; color: var(--grey); }

/* time-frame usage bars */
.tf-summary { display: flex; flex-direction: column; gap: 12px; }
.tf-row { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: 10px; font-size: 12.5px; }
.tf-row .bar { height: 9px; background: var(--line-soft); border-radius: 20px; overflow: hidden; }
.tf-row .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--indigo), var(--indigo-light)); border-radius: 20px; }
.days-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.daychip { font-size: 11.5px; background: var(--indigo-bg); color: #C60F4B; padding: 4px 9px; border-radius: 20px; font-weight: 600; }

/* sign-in */
.signin-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 24px; box-shadow: 0 10px 30px rgba(2,6,23,.06); }
.or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--grey); font-size: 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.demo-chips { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 6px; }
.chip { display: flex; flex-direction: column; align-items: flex-start; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: var(--r-sm); padding: 7px 11px; cursor: pointer; }
.chip:hover { border-color: var(--indigo); background: var(--indigo-bg); }
.chip b { font-size: 12px; color: var(--ink); } .chip span { font-size: 11px; color: var(--grey); }

/* booking / visit rows */
.visit-row { border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; background: #fff; }
.visit-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; }
.booking-card .booking-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.booking-actions { display: flex; gap: 8px; }
.visit-list { display: flex; flex-direction: column; gap: 8px; }
.visit-item { display: flex; align-items: center; gap: 12px; background: var(--bg); border-radius: var(--r-sm); padding: 9px 12px; }
.vi-doc { flex: 1; display: flex; flex-direction: column; } .vi-doc b { font-size: 13px; }
.vi-when { font-size: 12px; color: var(--slate); } .vi-token { font-weight: 700; color: var(--indigo); font-size: 13px; }

/* requests grouped */
.grp .grp-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; margin-bottom: 8px; border-bottom: 1px solid var(--line-soft); }
.req-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.req-row:last-child { border-bottom: 0; }
.req-main { flex: 1; min-width: 0; } .req-visits { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.req-actions { display: flex; gap: 8px; flex-shrink: 0; }
.vchip { display: inline-block; white-space: nowrap; font-size: 11.5px; background: var(--cyan-bg); color: #0E7490; padding: 3px 8px; border-radius: 6px; font-weight: 600; }
.grp-mini { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.grp-mini:last-child { border-bottom: 0; }

/* weekday grid + switch */
.wd-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.wd { display: flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 9px 4px; font-size: 12px; font-weight: 600; color: var(--slate); cursor: pointer; }
.wd.on { border-color: var(--indigo); background: var(--indigo-bg); color: #C60F4B; }
.wd input { display: none; }
/* sliding toggle switch */
.toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--slate); cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track { position: relative; width: 44px; height: 24px; border-radius: 999px; background: #CBD5E1; transition: background .18s ease; flex-shrink: 0; }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(2,6,23,.3); transition: transform .18s ease; }
.toggle input:checked + .track { background: var(--green); }
.toggle input:checked + .track .knob { transform: translateX(20px); }
.toggle input:focus-visible + .track { box-shadow: 0 0 0 3px var(--green-bg); }
.toggle .toggle-label { min-width: 108px; }

/* privacy */
.privacy-state { border-radius: var(--r-sm); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.privacy-state.on { background: var(--green-bg); } .privacy-state.off { background: var(--amber-bg); }
.privacy-state b { font-size: 13px; } .privacy-state .tiny { color: var(--grey); }
.btn.ghost.danger { color: var(--red); } .btn.ghost.danger:hover { background: var(--red-bg); }

/* gate pass */
.pass { text-align: center; padding: 18px; border-radius: var(--r); background: #fff; border: 2px solid var(--line); }
.pass.active { border-color: var(--green); box-shadow: 0 0 0 4px var(--green-bg); }
.pass.done { opacity: .6; }
.pass-qr { width: 220px; height: 220px; } .pass-code { font-family: ui-monospace, monospace; font-weight: 700; letter-spacing: 1px; margin-top: 8px; }
.pass-state { font-size: 12px; font-weight: 700; color: var(--grey); margin-top: 4px; } .pass-state.green { color: var(--green); }

/* scanner */
.scanner { position: relative; background: #0B1220; border-radius: var(--r); overflow: hidden; min-height: 220px; display: flex; align-items: center; justify-content: center; }
#scan-video { width: 100%; max-height: 320px; object-fit: cover; }
.scan-frame { position: absolute; width: 180px; height: 180px; border: 3px solid rgba(255,255,255,.85); border-radius: 16px; box-shadow: 0 0 0 4000px rgba(0,0,0,.35); }
.scan-status { text-align: center; margin-top: 8px; }

/* gate app */
.gate-wrap { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.gate-counter { display: flex; align-items: center; justify-content: center; gap: 24px; background: var(--ink); color: #fff; border-radius: var(--r); padding: 18px; }
.gc-item { text-align: center; } .gc-item b { display: block; font-size: 30px; font-weight: 750; } .gc-item span { font-size: 12px; opacity: .8; }
.gc-sep { width: 1px; height: 40px; background: rgba(255,255,255,.2); }
.gate-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gate-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 30px 16px; border-radius: var(--r); border: 0; cursor: pointer; color: #fff; }
.gate-btn.entry { background: var(--green); } .gate-btn.entry:hover { background: #15803D; }
.gate-btn.exit { background: var(--red); } .gate-btn.exit:hover { background: #B91C1C; }
.gb-arrow { font-size: 40px; line-height: 1; font-weight: 700; } .gb-label { font-size: 20px; font-weight: 750; letter-spacing: 1px; } .gb-sub { font-size: 12px; opacity: .9; }
.gate-manual { padding: 14px; }

/* scan result banner */
.scan-result { display: flex; gap: 14px; padding: 16px; border-radius: var(--r); border: 2px solid; }
.scan-result.ok { border-color: var(--green); background: var(--green-bg); }
.scan-result.warn { border-color: var(--amber); background: var(--amber-bg); }
.scan-result.bad { border-color: var(--red); background: var(--red-bg); }
.sr-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; color: #fff; flex-shrink: 0; }
.scan-result.ok .sr-icon { background: var(--green); } .scan-result.warn .sr-icon { background: var(--amber); } .scan-result.bad .sr-icon { background: var(--red); }
.sr-body { flex: 1; } .sr-head { font-size: 13px; font-weight: 750; letter-spacing: .5px; }
.sr-reason { font-size: 13px; color: var(--slate); margin: 3px 0 8px; }
.sr-rep { display: flex; align-items: center; gap: 10px; } .sr-rep b { font-size: 13px; }
.sr-visits { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* opd app */
.opd-wrap { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.opd-head h1 { margin: 0; } .opd-head p { margin: 6px 0 0; }
.opd-scan-btn { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px; border-radius: var(--r); border: 2px dashed var(--indigo); background: var(--indigo-bg); color: #C60F4B; cursor: pointer; }
.opd-scan-btn:hover { background: #FFD4E4; } .os-icon { font-size: 44px; } .os-label { font-size: 16px; font-weight: 700; }
.btn.block { width: 100%; }

/* ==================== v3 additions ==================== */
.note.amber { background: var(--amber-bg); border-left: 3px solid var(--amber); }
.note.red { background: var(--red-bg); border-left: 3px solid var(--red); color: #991B1B; }

/* sub-tabs */
.subtabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.subtab { border: 0; background: transparent; padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--slate); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.subtab.on { color: var(--indigo); border-bottom-color: var(--indigo); }
.subtab .cnt { font-size: 11px; background: var(--line-soft); color: var(--slate); border-radius: 20px; padding: 1px 7px; }
.subtab .cnt.hot { background: var(--amber-bg); color: #B45309; }

/* company request cards */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.co-req { padding: 16px; }

/* calendar */
.cal-wrap { display: flex; gap: 18px; flex-wrap: wrap; }
.cal { flex: 1; min-width: 240px; }
.cal-title { font-weight: 700; font-size: 13px; margin-bottom: 8px; color: var(--ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 10.5px; font-weight: 600; color: var(--grey); padding: 2px 0; }
.cal-day { text-align: center; padding: 8px 0; font-size: 12.5px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; user-select: none; }
.cal-day:not(.empty):not(.past):hover { background: var(--line-soft); }
.cal-day.empty { cursor: default; }
.cal-day.past { color: #CBD5E1; cursor: not-allowed; }
.cal-day.on { background: var(--indigo); color: #fff; font-weight: 700; }
.cal-day.on:hover { background: #C60F4B; }

/* OPD token badge */
.opd-token { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 18px; border-left: 2px solid rgba(0,0,0,.08); }
.opd-token span { font-size: 11px; color: var(--grey); } .opd-token b { font-size: 34px; font-weight: 750; color: var(--green); line-height: 1; }

/* ==================== v3.1 additions ==================== */
/* rep open-window chips (no counts) */
.window-chip { border: 1px solid var(--line); background: #fff; border-radius: var(--r-sm); padding: 9px 12px; font-weight: 600; font-size: 13px; color: var(--ink); }

/* company typeahead */
.typeahead { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: 0 10px 30px rgba(2,6,23,.12); z-index: 30; overflow: hidden; }
.ta-item { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 10px 12px; font-size: 13px; cursor: pointer; color: var(--ink); }
.ta-item:hover { background: var(--indigo-bg); color: #C60F4B; }
.ta-empty { padding: 10px 12px; font-size: 12.5px; color: var(--grey); }
.field .hint.err { color: var(--red); font-weight: 600; }

/* retired doctor rows */
.tbl tr.muted-row td { opacity: .6; }

/* ==================== grouped top-nav (dropdowns) ==================== */
.nav { align-items: center; flex-wrap: nowrap; }
.nav-group { position: relative; }
.nav-group-btn { display: inline-flex; align-items: center; gap: 5px; }
.nav-group-btn .caret { font-size: 9px; opacity: .7; transition: transform .15s; }
.nav-group.open .nav-group-btn .caret { transform: rotate(180deg); }
.nav-menu {
  position: absolute; top: 100%; left: 0; margin-top: 8px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 34px rgba(2,6,23,.20);
  padding: 6px; min-width: 200px; display: none; flex-direction: column; gap: 2px; z-index: 60;
}
.nav-group.open .nav-menu { display: flex; }
.nav-menu button { text-align: left; color: var(--slate); background: transparent; border: 0; padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; width: 100%; }
.nav-menu button:hover { background: var(--line-soft); color: var(--ink); }
.nav-menu button.active { background: var(--indigo); color: #fff; }
.nav-menu button .pill { background: var(--indigo-bg); color: #C60F4B; }
.nav-group-btn.has-alert { position: relative; }
.nav-group-btn.has-alert::after { content: ''; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--indigo); box-shadow: 0 0 0 2px var(--ink); }

/* ---- photographs loaded on demand (PR-032/PR-033) -----------------------
   Photographs are no longer embedded in list responses. A slot renders the
   subject's initials immediately and the image replaces it when it arrives,
   so tables paint without waiting on any image request. */
.av-slot { display: inline-flex; flex-shrink: 0; }
.av-initials {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--line-soft); color: var(--grey);
  font-weight: 600; letter-spacing: -.02em; user-select: none;
}
.av-initials.av-24 { font-size: 10px; } .av-initials.av-32 { font-size: 12px; }
.av-initials.av-40 { font-size: 14px; } .av-initials.av-56 { font-size: 19px; }
.av-initials.av-88 { font-size: 30px; } .av-initials.av-120 { font-size: 40px; }

/* ---- unread notification row ------------------------------------------ */
.li.unread { background: var(--indigo-bg, #EEF2FF); }
.li.unread .li-dot { box-shadow: 0 0 0 3px var(--indigo-bg, #EEF2FF); }

/* ---- an inline warning, for a pass that is outside its window ---------- */
.warn { color: var(--amber-ink, #92400E); }

/* ---- OP station typed-code fallback ----------------------------------- */
.opd-manual { margin-top: 14px; }

/* ---- engineering-mode diagnostics -------------------------------------- */
.diag-list { display: flex; flex-direction: column; gap: 2px; }
.diag-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 12px 4px; border-bottom: 1px solid var(--line-soft);
}
.diag-row:last-child { border-bottom: 0; }
.diag-row-main { flex: 1; min-width: 0; }
.diag-detail { min-height: 15px; }
.diag-row.diag-running { opacity: .55; }
.diag-row.diag-running .diag-row-main::after { content: ' …running'; color: var(--grey); }
