/* Global City Dammam - Access ID System - v21 design system
   Sidebar app shell, card surfaces, light + dark themes.
   Every class name from earlier versions still works (form-box, people,
   stats, btn, badge, statusbadge, quotabar, portal-grid ...). */

/* ---------- Tokens ---------- */
:root {
  --blue: #2e67b1; --blue-dark: #235089; --blue-soft: #e8f0fb; --blue-ink: #1d4d8a;
  --ink: #111827; --ink-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --bg: #f3f5f9; --card: #ffffff; --card-2: #f8fafc; --line: #e5e9f0; --line-2: #eef1f6;
  --red: #dc2626; --red-soft: #fdecec; --red-ink: #991b1b;
  --orange: #f58220; --amber-soft: #fef3c7; --amber-ink: #92400e;
  --pink: #e0398e; --purple: #8e44ad; --sky: #3aa0db;
  --green: #16a34a; --green-soft: #e6f7ec; --green-ink: #166534;
  --brandbar: linear-gradient(90deg, #e23a3a, #f58220, #e0398e, #8e44ad, #2e67b1, #3da749);
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 20px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 40px rgba(16,24,40,.16);
  --r: 14px; --r-sm: 10px; --r-xs: 8px;
  --sidebar: 250px; --sidebar-min: 74px; --topbar: 62px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --focus: 0 0 0 3px rgba(46,103,177,.22);
}
html.theme-dark {
  --blue: #5b93d9; --blue-dark: #8ab7f0; --blue-soft: #1a2b45; --blue-ink: #a9c8f2;
  --ink: #e6ebf4; --ink-2: #c3cddc; --muted: #94a2b8; --faint: #6b7a91;
  --bg: #0f1420; --card: #161c2a; --card-2: #1b2232; --line: #263044; --line-2: #202a3c;
  --red: #f87171; --red-soft: #3a1d1d; --red-ink: #fca5a5;
  --amber-soft: #3a2e14; --amber-ink: #fcd34d;
  --green: #4ade80; --green-soft: #14301f; --green-ink: #9fe3b8;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 16px 48px rgba(0,0,0,.55);
  --focus: 0 0 0 3px rgba(91,147,217,.35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink);
  font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
h1 { font-size: 21px; font-weight: 700; margin: 0 0 14px; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 700; margin: 22px 0 10px; }
h3 { font-size: 14.5px; font-weight: 700; margin: 16px 0 8px; }
p { margin: 0 0 10px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }
.center { text-align: center; }
.mono { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; font-size: 13px; }
.small-note { font-size: 12px; }
.cellmain { font-weight: 600; }
.nophoto { color: var(--faint); }
.rowactions { white-space: nowrap; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--card);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 50;
  transition: width .18s ease, transform .2s ease; overflow: hidden; }
.sidebar::before { content: ""; display: block; height: 4px; background: var(--brandbar); }
.sb-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 18px 10px;
  text-decoration: none; color: inherit; min-height: 64px; overflow: hidden; }
.sb-brand img { height: auto; width: 100%; max-width: 168px; flex: none; display: block; }
.sb-brand .lg-dark, .sb-brand .lg-min { display: none; }
html.theme-dark .sb-brand .lg-light { display: none; }
html.theme-dark .sb-brand .lg-dark { display: block; }
.sb-brand .t1 { font-weight: 700; font-size: 12.5px; letter-spacing: .01em; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%; color: var(--ink-2); }
.sb-brand .t2 { font-weight: 500; color: var(--muted); }
.sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; scrollbar-width: thin; }
.sb-group { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); padding: 12px 10px 4px; white-space: nowrap; }
.sb-link { display: flex; align-items: center; gap: 11px; padding: 8px 11px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 14px;
  white-space: nowrap; transition: background .12s, color .12s; position: relative; }
.sb-link svg { width: 19px; height: 19px; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.sb-link:hover { background: var(--card-2); color: var(--ink); }
.sb-link.active { background: var(--blue-soft); color: var(--blue-ink); font-weight: 600; }
.sb-link.active svg { opacity: 1; }
.sb-link .navcount { margin-left: auto; }
.sb-link.logout { color: var(--red); }
.sb-link.logout:hover { background: var(--red-soft); }
.sb-foot { border-top: 1px solid var(--line); padding: 8px 12px; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
  font-size: 13px; flex: none; letter-spacing: .02em; }
.sb-user .n { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.sb-user .r { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.sb-collapse { display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 10px; padding: 7px; cursor: pointer; font: inherit; font-size: 12.5px; }
.sb-collapse:hover { color: var(--ink); background: var(--card-2); }
.sb-collapse svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar); transition: margin .18s ease; }
.main.nosb, html.sb-min .main.nosb { margin-left: 0; }
.topbar { position: sticky; top: 0; z-index: 40; height: var(--topbar); display: flex;
  align-items: center; gap: 12px; padding: 0 22px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar .ttl { font-weight: 700; font-size: 16px; letter-spacing: -.01em; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sp { flex: 1; }
.tb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; min-width: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink-2); cursor: pointer; font: inherit; font-size: 13px;
  text-decoration: none; position: relative; }
.tb-btn:hover { background: var(--card-2); color: var(--ink); }
.tb-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; }
.tb-btn .navcount { position: absolute; top: -6px; right: -6px; margin: 0; }
.hamb { display: none; }
.gatebar { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.gatebar .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.gate-online { background: var(--green-soft); color: var(--green-ink); }
.gate-online .dot { background: #16a34a; }
.gate-errors { background: var(--amber-soft); color: var(--amber-ink); }
.gate-errors .dot { background: #f59e0b; }
.gate-never { background: var(--line-2); color: var(--muted); }
.gate-never .dot { background: #94a3b8; }
.gate-offline { background: var(--red-soft); color: var(--red-ink); }
.gate-offline .dot { background: #dc2626; }
main { max-width: 1480px; margin: 0 auto; padding: 22px 22px 40px; }

/* collapsed sidebar */
html.sb-min .sidebar { width: var(--sidebar-min); }
html.sb-min .main { margin-left: var(--sidebar-min); }
html.sb-min .sb-brand { align-items: center; padding-left: 0; padding-right: 0; }
html.sb-min .sb-brand .lg-light, html.sb-min .sb-brand .lg-dark, html.sb-min .sb-brand .t1 { display: none !important; }
html.sb-min .sb-brand .lg-min { display: block; width: 38px; height: 38px; }
html.sb-min .sb-group, html.sb-min .sb-link span,
html.sb-min .sb-user div, html.sb-min .sb-collapse span { display: none; }
html.sb-min .sb-group { height: 10px; padding: 0; }
html.sb-min .sb-link { justify-content: center; padding: 11px 0; }
html.sb-min .sb-link .navcount { position: absolute; top: 4px; right: 8px; }
html.sb-min .sb-user { justify-content: center; padding: 6px 0; }
html.sb-min .sb-link[title]:hover::after { content: attr(title); position: absolute; left: 100%;
  margin-left: 10px; background: var(--ink); color: var(--card); padding: 5px 10px;
  border-radius: 8px; font-size: 12.5px; white-space: nowrap; z-index: 70; }
.sb-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,20,32,.45);
  z-index: 45; }

/* display settings panel */
.uimenu { position: relative; }
.uipanel { position: absolute; right: 0; top: 46px; z-index: 60; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 230px;
  box-shadow: var(--shadow-lg); }
.uipanel .uigroup { margin-bottom: 10px; }
.uipanel .uigroup:last-child { margin-bottom: 0; }
.uipanel strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 6px; }
.uipanel button { border: 1px solid var(--line); background: var(--card); color: inherit;
  border-radius: 8px; padding: 5px 11px; margin-right: 4px; cursor: pointer; font: inherit;
  font-size: 13px; }
.uipanel button.sel { background: var(--blue); color: #fff; border-color: var(--blue); }
.uipanel a { display: block; padding: 7px 0 0; font-size: 13.5px; }

/* ---------- Flash & banners ---------- */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px;
  margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; }
.flash.ok { background: var(--green-soft); color: var(--green-ink); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.flash.ok::before { background: var(--green); }
.flash.error { background: var(--red-soft); color: var(--red-ink); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.flash.error::before { background: var(--red); }
.notifbanner { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between;
  background: var(--blue-soft); border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent);
  border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; flex-wrap: wrap; }
.notifbanner-item { font-size: 13.5px; margin-top: 4px; }
.notifbanner-actions { display: flex; gap: 8px; align-items: center; }
.noteitem { display: flex; gap: 14px; justify-content: space-between; align-items: flex-start;
  padding: 12px 6px; border-bottom: 1px solid var(--line); }
.noteitem.unread { background: var(--blue-soft); border-radius: 10px; }
.notetitle { font-weight: 700; }
.notebody { color: var(--ink-2); font-size: 14px; margin: 3px 0; }
.noteactions { display: flex; gap: 6px; white-space: nowrap; }
.notedot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red);
  margin-right: 6px; vertical-align: middle; }
.navcount { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px;
  background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700;
  text-align: center; line-height: 18px; vertical-align: middle; }

/* ---------- Cards & stats ---------- */
.form-box, .dash-card, .card { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 24px 26px; box-shadow: var(--shadow); margin-bottom: 18px; }
.form-box.narrow { max-width: 420px; }
.form-box.wide-box { max-width: 1440px; }
.dash-card h2, .card h2 { margin: 0 0 12px; font-size: 15px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2, .card-head h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px;
  margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--blue); opacity: .9; }
.stat .num { font-size: 26px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.stat .lbl { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat.total::after { background: var(--purple); }
.stat.office-staff::after { background: var(--green); }
.stat.pavilion::after { background: var(--blue); }
.stat.exhibitor::after { background: var(--orange); }
.stat.fb-exhibitor::after { background: var(--pink); }
.stat.warn::after { background: var(--red); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 4px; }
.dash-grid .dash-card { margin-bottom: 0; }
.hbar { display: grid; grid-template-columns: 140px 1fr 48px; gap: 10px; align-items: center;
  margin: 8px 0; font-size: 13px; }
.hbar .track { background: var(--line-2); border-radius: 6px; height: 12px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 6px; background: var(--blue); min-width: 2px;
  transition: width .3s; }
.hbar .val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.vbars { display: flex; align-items: flex-end; gap: 5px; height: 130px; margin-top: 8px; }
.vbars .vb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 0; height: 100%; justify-content: flex-end; }
.vbars .vb .col { width: 100%; background: var(--blue); border-radius: 5px 5px 0 0; min-height: 2px;
  opacity: .9; }
.vbars .vb .dlbl { font-size: 9.5px; color: var(--muted); transform: rotate(-45deg);
  white-space: nowrap; margin-top: 8px; }
.fill.c-office-staff, .col.c-office-staff { background: var(--green); }
.fill.c-pavilion, .col.c-pavilion { background: var(--blue); }
.fill.c-exhibitor, .col.c-exhibitor { background: var(--orange); }
.fill.c-fb-exhibitor, .col.c-fb-exhibitor { background: var(--pink); }
.fill.s-active { background: var(--green); }
.fill.s-canceled { background: var(--faint); }
.fill.s-terminated { background: var(--orange); }
.fill.s-banned { background: var(--red); }

/* ---------- Forms ---------- */
input, select, textarea { padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; font-size: 14px; background: var(--card); color: var(--ink); min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: var(--focus); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 16px; height: 16px; accent-color: var(--blue); }
input[type=file] { padding: 7px; background: var(--card-2); }
label { display: block; margin-bottom: 13px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label input, label select, label textarea { display: block; width: 100%; margin-top: 5px; font-weight: 400; }
.inlineform { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inlineform label { margin: 0; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center;
  flex-wrap: wrap; margin-bottom: 14px; }
.search { display: flex; gap: 8px; flex-wrap: wrap; }
.search input { width: 240px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.portal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px 14px; align-items: end; }
.portal-grid label { display: flex; flex-direction: column; gap: 5px; margin: 0; min-width: 0; }
.portal-grid input, .portal-grid select { width: 100%; }
.portal-grid form { display: contents; }
.portal-submit { display: flex; align-items: flex-end; }
.portal-submit .btn { width: 100%; text-align: center; }
.rowphoto input[type=file] { max-width: 130px; font-size: 11px; }
.photo-block { border: 1px dashed var(--line); background: var(--card-2); border-radius: 12px;
  padding: 14px 16px; margin-top: 12px; }
.photo-block p.muted { margin: 6px 0 10px; }
.purposeboxes { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 6px 0; }
.purposebox { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0;
  white-space: nowrap; }
.field-hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card);
  color: var(--ink-2); cursor: pointer; font: inherit; font-size: 14px; font-weight: 600;
  text-decoration: none; line-height: 1.2; transition: background .12s, border-color .12s, transform .05s;
  white-space: nowrap; }
.btn:hover { background: var(--card-2); border-color: color-mix(in srgb, var(--line) 50%, var(--muted)); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.btn.danger:hover { background: var(--red-soft); }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }
.btnrow { display: inline-flex; gap: 6px; align-items: center; flex-wrap: nowrap; white-space: nowrap; }
.btnrow form { display: inline-flex; margin: 0; }
.issuedtag { background: var(--green-soft); color: var(--green-ink); border: 1px solid
  color-mix(in srgb, var(--green) 35%, transparent); border-radius: 999px; padding: 4px 10px;
  font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.issuedtag:disabled { cursor: default; }

/* ---------- Tables ---------- */
table.people { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: 13.5px; }
table.people th { background: var(--card-2); text-align: left; padding: 11px 14px; font-size: 11.5px;
  font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line); white-space: nowrap; }
table.people td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.people td.cellmain { white-space: nowrap; }
table.people tr:last-child td { border-bottom: none; }
table.people tbody tr:hover td, table.people tr:hover td { background: var(--card-2); }
tr.inactive td { opacity: .55; }
.thumb { width: 44px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
table.draftedit input, table.draftedit select { width: 100%; min-width: 0; padding: 6px 8px;
  margin: 0; font-size: 13px; min-height: 34px; }
table.draftedit td { padding: 7px 8px; }
table.draftedit td:first-child { width: 30px; }
table.draftedit select { min-width: 110px; }
table.draftedit td:nth-child(5) { min-width: 130px; }
.bulkbar { display: none; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--blue-soft);
  border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); border-radius: 10px;
  padding: 10px 14px; margin: 12px 0; }
.bulkbar.show { display: flex; }
.bulkbar .count { font-weight: 700; color: var(--blue-ink); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 600; color: #fff; white-space: nowrap; }
.badge.exhibitor { background: var(--orange); }
.badge.pavilion { background: var(--blue); }
.badge.office-staff { background: var(--green); }
.badge.fb-exhibitor { background: var(--pink); }
.statusbadge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 600; white-space: nowrap; }
.status-active, .status-approved, .status-ok { background: var(--green-soft); color: var(--green-ink); }
.status-canceled, .status-pending { background: var(--line-2); color: var(--ink-2); }
.status-terminated, .status-warn { background: var(--amber-soft); color: var(--amber-ink); }
.status-banned, .status-rejected, .status-full { background: var(--red-soft); color: var(--red-ink); }
.statusform select { padding: 4px 8px; font-size: 13px; border-radius: 999px; min-height: 30px; }
.dupbadge { background: var(--red-soft); color: var(--red-ink); border: 1px solid
  color-mix(in srgb, var(--red) 30%, transparent); border-radius: 999px; padding: 2px 9px;
  font-size: 11.5px; font-weight: 700; display: inline-block; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); }
.pill.blue { background: var(--blue-soft); color: var(--blue-ink); }
.pill.green { background: var(--green-soft); color: var(--green-ink); }
.pill.red { background: var(--red-soft); color: var(--red-ink); }
.pill.amber { background: var(--amber-soft); color: var(--amber-ink); }

/* ---------- Quota bars ---------- */
.quotabar { width: 150px; max-width: 100%; height: 8px; background: var(--line-2); border-radius: 6px;
  margin-top: 5px; overflow: hidden; }
.quotafill { height: 8px; border-radius: 6px; background: var(--green); max-width: 100%; }
.quotafill.warn { background: var(--orange); }
.quotafill.full { background: var(--red); }
.quota-full { color: var(--red); font-weight: 700; }
.calcbox { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px;
  align-items: end; }
.calcbox label { margin: 0; font-size: 12px; }
.calcbox input { min-height: 36px; padding: 6px 10px; }
.formula { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px;
  color: var(--muted); }
.formula b { color: var(--ink); font-size: 14px; }
.formula .eq { font-size: 15px; font-weight: 800; color: var(--blue-ink); }
.unitinfo { font-size: 12.5px; margin-top: 5px; font-weight: 500; }
.unitinfo.ok { color: var(--green-ink); }
.unitinfo.full { color: var(--red-ink); }
.unitinfo.warn { color: var(--amber-ink); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px;
  overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--blue-ink); border-bottom-color: var(--blue); }
.tabs a:hover { color: var(--ink); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.help { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 16px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 14px; }
.help b { color: var(--ink); }

/* ---------- Print queue ---------- */
.printgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.printcard { display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px; cursor: pointer;
  background: var(--card); transition: border-color .15s, box-shadow .15s; text-align: center; }
.printcard:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.printcard:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.printcard img { width: 120px; height: auto; border: 1px solid var(--line); border-radius: 6px; }
.printcard .pc-name { font-weight: 700; font-size: 13.5px; margin-top: 2px; }

/* ---------- Login / auth pages ---------- */
body.loginpage { display: block; }
body.loginpage .app { display: block; }
body.loginpage main { max-width: none; width: 100%; margin: 0; padding: 0; }
.login-split { display: flex; width: 100%; min-height: 100vh; min-height: 100dvh; }
.login-visual { flex: 1.15; position: relative; overflow: hidden; color: #fff; padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: linear-gradient(135deg, #3b1d68 0%, #65247c 45%, #2e67b1 100%);
  background-size: 200% 200%; animation: bg-drift 18s ease-in-out infinite alternate; }
.login-visual::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Ccircle cx='60' cy='60' r='1.3' fill='white' fill-opacity='.16'/%3E%3C/svg%3E"); }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none;
  animation: blob-float 14s ease-in-out infinite alternate; }
.blob.b1 { width: 460px; height: 460px; left: -120px; top: -140px; background: #e0398e; }
.blob.b2 { width: 380px; height: 380px; right: -100px; top: 30%; background: #f58220; animation-delay: -5s; }
.blob.b3 { width: 420px; height: 420px; left: 20%; bottom: -200px; background: #3da749; animation-delay: -9s; }
.login-brand { position: relative; z-index: 1; text-align: center; max-width: 520px;
  animation: rise-in .9s cubic-bezier(.2,.8,.2,1) both; }
.login-logo { width: min(360px, 70vw); height: auto; display: block; margin: 0 auto 26px;
  filter: drop-shadow(0 18px 40px rgba(0,0,0,.35)); animation: logo-float 7s ease-in-out 1s infinite; }
.login-visual .dots { display: flex; gap: 8px; justify-content: center; margin: 0 0 16px; }
.login-visual .dots span { width: 10px; height: 10px; border-radius: 50%; display: block; opacity: .95;
  animation: dot-pulse 2.4s ease-in-out infinite; }
.login-visual .dots span:nth-child(1) { background: #e23a3a; }
.login-visual .dots span:nth-child(2) { background: #f58220; animation-delay: .2s; }
.login-visual .dots span:nth-child(3) { background: #e0398e; animation-delay: .4s; }
.login-visual .dots span:nth-child(4) { background: #b76fe0; animation-delay: .6s; }
.login-visual .dots span:nth-child(5) { background: #3aa0db; animation-delay: .8s; }
.login-visual .dots span:nth-child(6) { background: #3da749; animation-delay: 1s; }
.login-visual h2 { font-size: 30px; margin: 0 0 6px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; }
.login-visual p { margin: 0; opacity: .88; font-size: 15.5px; }
.login-foot { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; font-size: 12px;
  opacity: .7; z-index: 1; padding: 0 20px; }
.login-panel { width: 480px; flex: none; background: var(--card); display: flex; align-items: center;
  justify-content: center; padding: 40px 44px; box-shadow: -8px 0 30px rgba(16,24,40,.10); }
.login-card { width: 100%; max-width: 380px; animation: rise-in .8s .15s cubic-bezier(.2,.8,.2,1) both; }
.login-mark { width: 190px; height: auto; display: block; margin-bottom: 22px; }
.login-card h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.login-card .sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.login-card .flash { margin-bottom: 14px; }
.login-card label { margin-bottom: 15px; }
.login-card input { min-height: 46px; font-size: 15px; }
.login-card .btn.primary.wide { min-height: 48px; font-size: 15.5px; margin-top: 6px;
  box-shadow: 0 8px 20px rgba(46,103,177,.28); }
.pwwrap { position: relative; display: block; margin-top: 5px; }
.pwwrap input { margin: 0; padding-right: 64px; }
.pwtoggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0;
  background: var(--line-2); color: var(--ink-2); border-radius: 8px; padding: 5px 10px; font: inherit;
  font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pwtoggle:hover { background: var(--line); }
.otp { display: block; width: 100%; text-align: center; font-size: 26px; letter-spacing: 8px;
  font-weight: 700; min-height: 56px; font-variant-numeric: tabular-nums; }
/* centred card pages (2FA verify / setup) */
.auth-wrap { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; align-items: center;
  justify-content: center; padding: 28px 16px; overflow: hidden;
  background: linear-gradient(135deg, #3b1d68 0%, #65247c 45%, #2e67b1 100%); }
.auth-wrap .blob { opacity: .45; }
.auth-card { position: relative; z-index: 1; background: var(--card); border-radius: 18px; padding: 34px 32px;
  box-shadow: 0 24px 70px rgba(0,0,0,.35); max-width: 420px; text-align: center; }
.auth-card.wide { max-width: 500px; }
.auth-card .login-mark { margin: 0 auto 18px; width: 170px; }
.auth-card .sub { margin-bottom: 18px; }
.auth-card label { text-align: left; }
.auth-card .steps { text-align: left; color: var(--ink-2); font-size: 14px; line-height: 1.65; padding-left: 22px;
  margin: 0 0 14px; }
.qrbox { background: var(--card-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 16px; }
.qrbox img { width: 200px; height: 200px; border-radius: 10px; background: #fff; display: block; margin: 0 auto; }
@keyframes rise-in { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes logo-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes dot-pulse { 0%, 100% { transform: scale(1); opacity: .7; } 50% { transform: scale(1.35); opacity: 1; } }
@keyframes blob-float { from { transform: translate(0, 0) scale(1); } to { transform: translate(40px, 30px) scale(1.12); } }
@keyframes bg-drift { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
@media (prefers-reduced-motion: reduce) {
  .login-visual, .blob, .login-logo, .login-visual .dots span, .login-brand, .login-card { animation: none !important; } }
@media (max-width: 860px) {
  .login-split { flex-direction: column; min-height: 100dvh; }
  .login-visual { flex: none; padding: 34px 20px 28px; min-height: 0; }
  .login-logo { width: min(220px, 55vw); margin-bottom: 14px; }
  .login-visual h2 { font-size: 21px; }
  .login-visual p { font-size: 13.5px; }
  .login-visual .dots { margin-bottom: 10px; }
  .login-foot { display: none; }
  .login-panel { width: 100%; padding: 28px 22px 36px; box-shadow: none; flex: 1; align-items: flex-start; }
  .login-card { max-width: 440px; margin: 0 auto; }
  .login-mark { display: none; }
  .auth-card { padding: 26px 20px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 1024px) {
  main { padding: 16px 14px 32px; }
  table.people { display: block; overflow-x: auto; }
  table.people td, table.people th { white-space: nowrap; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar); box-shadow: var(--shadow-lg); }
  html.sb-min .sidebar { width: var(--sidebar); }
  html.sb-open .sidebar { transform: none; }
  html.sb-open .sb-backdrop { display: block; }
  html.sb-min .sb-group, html.sb-min .sb-link span,
  html.sb-min .sb-user div, html.sb-min .sb-collapse span { display: initial; }
  html.sb-min .sb-brand .lg-light, html.sb-min .sb-brand .t1 { display: block !important; }
  html.theme-dark.sb-min .sb-brand .lg-light { display: none !important; }
  html.theme-dark.sb-min .sb-brand .lg-dark { display: block !important; }
  html.sb-min .sb-brand .lg-min { display: none; }
  html.sb-min .sb-link { justify-content: flex-start; padding: 8px 11px; }
  html.sb-min .sb-brand { align-items: flex-start; padding: 14px 18px 10px; }
  .sb-collapse { display: none; }
  .main, html.sb-min .main { margin-left: 0; }
  .hamb { display: inline-flex; }
  .topbar { padding: 0 12px; }
  .topbar .who { display: none; }
  .gatebar .gtxt { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .num { font-size: 21px; }
  .toolbar, .search, .actions { width: 100%; }
  .search input { width: 100%; flex: 1 1 100%; }
  .search select { flex: 1 1 45%; }
  .search .btn { flex: 1 1 100%; }
  .actions .btn { flex: 1 1 100%; }
  .actions form { flex: 1 1 100%; }
  .actions form .btn { width: 100%; }
  .form-box, .dash-card, .card { padding: 16px; border-radius: 12px; }
  .inlineform label { min-width: 100% !important; flex: 1 1 100%; }
  .inlineform input[type=file] { width: 100%; }
  .hbar { grid-template-columns: 100px 1fr 44px; }
  h1 { font-size: 19px; }
}
@media print {
  .sidebar, .topbar, .sb-backdrop { display: none !important; }
  .main { margin: 0 !important; }
  body { background: #fff; }
}

/* ---- v21.6 badge wallet ---- */
.wallet-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 8px; }
.wallet-cell { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.wallet-cell .num { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.wallet-cell .lbl { color: var(--muted); font-size: 12px; margin-top: 3px; }
.wallet-cell.hi { background: var(--purple-soft, rgba(101,36,124,.08)); border-color: transparent; }
.wallet-cell.hi .num { color: var(--purple); font-size: 26px; }
.wallet-cell.bad .num { color: var(--red-ink, #b42318); }
.wallet-bar { display: flex; height: 8px; border-radius: 999px; background: var(--green-soft, #e6f4ea); overflow: hidden; margin-top: 12px; }
.wallet-bar .used { background: var(--purple); }
.wallet-bar .unpaid { background: var(--red, #d92d20); }
.right { text-align: right; }
@media (max-width: 720px) { .wallet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
