/* =====================================================================
   Astuut GatePass - single shared stylesheet (monochrome theme)
   Font: Poppins (self-hosted) · Base size: 16px
   ===================================================================== */

/* ---- Fonts ---- */
@font-face { font-family:"Poppins"; font-style:normal; font-weight:400; font-display:swap; src:url("../fonts/poppins-400.woff2") format("woff2"); }
@font-face { font-family:"Poppins"; font-style:normal; font-weight:500; font-display:swap; src:url("../fonts/poppins-500.woff2") format("woff2"); }
@font-face { font-family:"Poppins"; font-style:normal; font-weight:600; font-display:swap; src:url("../fonts/poppins-600.woff2") format("woff2"); }
@font-face { font-family:"Poppins"; font-style:normal; font-weight:700; font-display:swap; src:url("../fonts/poppins-700.woff2") format("woff2"); }

/* ---- Design tokens ---- */
:root{
  --bg:#f4f5f7;
  --surface:#ffffff;
  --ink:#1a1a1a;
  --ink-2:#565a61;
  --muted:#8b9098;
  --line:#e6e8ec;
  --line-2:#f0f1f3;
  --black:#141518;
  --black-hover:#000000;
  --grey-fill:#3a3f47;
  --radius:16px;
  --radius-sm:10px;
  --radius-pill:999px;
  --shadow:0 1px 2px rgba(17,19,24,.04), 0 8px 24px rgba(17,19,24,.06);
  --shadow-sm:0 1px 2px rgba(17,19,24,.06);
  --font:"Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw:1080px;
}

*,*::before,*::after{ box-sizing:border-box; }

html{ font-size:16px; -webkit-text-size-adjust:100%; }
body{
  margin:0;
  font-family:var(--font);
  font-size:1rem;
  line-height:1.55;
  color:var(--ink);
  background:var(--bg);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
img{ max-width:100%; display:block; }
a{ color:inherit; }

h1,h2,h3{ margin:0; font-weight:700; line-height:1.2; letter-spacing:-.01em; }
h1{ font-size:1.6rem; }
h2{ font-size:1.2rem; }
p{ margin:0 0 .6rem; }
p.cal-subtitle{margin: 0 0 0rem;}

.container{ width:100%; max-width:var(--maxw); margin:0 auto; padding:0 16px; }

/* ---- Top bar / navigation ---- */
.topbar{ display:flex; align-items:stretch; background:var(--surface); border-bottom:1px solid var(--line); position:sticky; top:0; z-index:40; height:62px; }
.topbar-brand{ position:relative; width:242px; flex:0 0 242px; display:flex; align-items:center; gap:12px; padding:0 12px 0 28px; }
.topbar-brand .brand{ padding:0; }
.topbar-main{ flex:1; min-width:0; display:flex; align-items:center; }
.topbar-main > .container{ display:flex; align-items:center; max-width:none; margin:0; }
.content > .container{ max-width:none; margin:0; }
/* Animated hamburger (morphs to an X) */
.hamburger{ position:static; flex:0 0 auto; width:28px; height:36px; padding:0; display:inline-flex; align-items:center; justify-content:center; background:none; border:none; cursor:pointer; border-radius:8px; }
.hamburger:hover{ background:var(--line-2); }
.hamburger-box{ position:relative; width:22px; height:16px; display:block; }
.hamburger-bar{ position:absolute; left:0; width:22px; height:2px; background:var(--ink); border-radius:2px; transition:transform .3s cubic-bezier(.4,0,.2,1), opacity .18s ease, top .3s cubic-bezier(.4,0,.2,1); }
.hamburger-bar:nth-child(1){ top:0; }
.hamburger-bar:nth-child(2){ top:7px; }
.hamburger-bar:nth-child(3){ top:14px; }
.hamburger.is-active .hamburger-bar:nth-child(1){ top:7px; transform:rotate(45deg); }
.hamburger.is-active .hamburger-bar:nth-child(2){ opacity:0; }
.hamburger.is-active .hamburger-bar:nth-child(3){ top:7px; transform:rotate(-45deg); }
.brand{ display:inline-flex; flex-direction:column; align-items:center; gap:3px; text-decoration:none; line-height:1; }
.brand-logo{ height:34px; width:auto; }   /* 35% larger */
.brand-sub{ font-weight:600; font-size:.66rem; letter-spacing:.16em; text-transform:uppercase; color:var(--muted); letter-spacing: 5px; }
.mainnav{ display:flex; align-items:center; gap:4px; margin-left:auto; flex:1; }
.nav-spacer{ flex:1; }
.navlink{ display:inline-flex; align-items:center; gap:8px; padding:9px 14px; border-radius:var(--radius-pill); font-size:.95rem; font-weight:500; color:var(--ink-2); text-decoration:none; background:transparent; border:none; cursor:pointer; font-family:inherit; }
.navlink:hover{ background:transparent; color:var(--ink); }
.navlink.active{ background:transparent; color:var(--ink); font-weight:600; position:relative; }
.navlink.active::after{ content:""; position:absolute; left:14px; right:14px; bottom:1px; height:2px; background:var(--ink); border-radius:2px; }
.navuser{ font-weight:600; color:var(--ink); }
.navuser .navuser-name{ max-width:140px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.logout-form{ margin:0; }
.logout-btn{ color:var(--muted); }
.logout-btn:hover{ background:var(--line-2); color:var(--ink); }
.pwa-install-btn{ color:var(--ink-2); border:1px solid var(--line); padding:7px 13px; }
.pwa-install-btn:hover{ color:var(--ink); border-color:var(--ink); background:transparent; }
.pwa-install-btn .icon{ width:17px; height:17px; }
.pwa-install-btn[hidden]{ display:none; }
@media (max-width:600px){ .pwa-install-btn .pwa-install-label{ display:none; } }

.nav-toggle{ display:none; margin-left:auto; width:42px; height:42px; border:1px solid var(--line); border-radius:12px; background:var(--surface); cursor:pointer; padding:0; flex-direction:column; align-items:center; justify-content:center; gap:4px; }
.nav-toggle span{ display:block; width:18px; height:2px; background:var(--ink); border-radius:2px; transition:.2s; }

/* ---- Role badges ---- */
.role-badge{ display:inline-block; font-size:.68rem; font-weight:600; letter-spacing:.06em; text-transform:uppercase; padding:3px 8px; border-radius:var(--radius-pill); }
.role-admin{ background:var(--ink); color:#fff; }
.role-staff{ background:var(--line); color:#3b3f45; }
.role-security{ background:var(--surface); color:var(--ink); border:1px solid var(--ink); }

/* ---- Main regions ---- */
.app-main{ padding:28px 0 56px; }
.auth-main{ min-height:100vh; display:flex; align-items:center; justify-content:center; padding:32px 0; }
.auth-main .container{ max-width:430px; }

/* ---- Flash & errors ---- */
.flash{ border-radius:var(--radius-sm); padding:12px 15px; margin-bottom:16px; font-size:.92rem; border:1px solid var(--line); background:var(--surface); box-shadow:var(--shadow-sm); }
.flash-success{ background:#e7f6ec; border-color:#aadcbb; color:#1b7a43; }
.flash-error{ background:#fdeaea; border-color:#f1b9b9; color:#b02a21; }
.flash-info{ background:#eef2f8; border-color:#cfd9e6; color:#39465a; }
.error-list{ margin:0; padding-left:18px; }
.error-list li{ margin:2px 0; }

/* ---- Auth (access) pages: dark background, borderless form ---- */
body.is-auth{ background:#000000; }
.auth-card{ background:transparent; border:none; border-radius:0; box-shadow:none; padding:0; }
.auth-brand{ display:flex; flex-direction:column; align-items:flex-start; gap:12px; margin-bottom:26px; }
.auth-logo{ height:38px; width:auto; }           /* 25% larger than before */
.auth-badge{ font-size:.72rem; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:#fff; padding:3px 9px; border:1px solid rgba(255,255,255,.4); border-radius:var(--radius-pill); }
.auth-title{ font-size:1.6rem; margin-bottom:4px; color:#fff; }
.auth-sub{ color:rgba(255,255,255,.72); margin-bottom:24px; }

/* Dark, transparent form controls with white text & borders */
.is-auth label{ color:#fff; }
.is-auth .opt{ color:rgba(255,255,255,.55); }
.is-auth .help{ color:rgba(255,255,255,.6); }
.is-auth .input{ background:transparent; color:#fff; border-color:#fff; }
.is-auth .input::placeholder{ color:rgba(255,255,255,.45); }
.is-auth .input:focus{ border-color:#fff; box-shadow:0 0 0 3px rgba(255,255,255,.16); }
.is-auth .input:-webkit-autofill{ -webkit-text-fill-color:#fff; -webkit-box-shadow:0 0 0 1000px #000 inset; caret-color:#fff; }
.is-auth .btn-primary{ background:#fff; color:#111; }
.is-auth .btn-primary:hover{ background:#e9e9ea; }
.is-auth .flash{ box-shadow:none; }
.is-auth .flash-success{ background:rgba(60,180,110,.18); border-color:rgba(130,225,170,.5); color:#cff4dd; }
.is-auth .flash-error{ background:rgba(225,80,80,.18); border-color:rgba(245,160,160,.55); color:#ffd7d7; }
.is-auth .flash-info{ background:rgba(255,255,255,.07); border-color:rgba(255,255,255,.3); color:#fff; }
.is-auth .auth-alt{ margin-top:18px; text-align:center; }
.is-auth .auth-alt a{ color:#fff; font-weight:600; text-decoration:none; font-size:.9rem; }
.is-auth .auth-alt a:hover{ text-decoration:underline; }
.is-auth .auth-alt .sep{ color:rgba(255,255,255,.4); margin:0 8px; }
.is-auth .auth-alt form{ display:inline; margin:0; }
.is-auth .auth-alt .linkish{ background:none; border:none; color:#fff; font:inherit; font-weight:600; font-size:.9rem; cursor:pointer; padding:0; }
.is-auth .auth-alt .linkish:hover{ text-decoration:underline; }

/* ---- Forms ---- */
.form .form-group{ margin-bottom:16px; }
.form-row{ display:flex; gap:14px; }
.form-row .form-group{ flex:1; }
label{ display:block; font-size:.86rem; font-weight:600; margin-bottom:6px; color:var(--ink); }
.opt{ font-weight:400; color:var(--muted); }
.input{ width:100%; font-family:inherit; font-size:1rem; color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-sm); padding:11px 13px; transition:border-color .15s, box-shadow .15s; }
.input::placeholder{ color:#b7bbc2; }
.input:focus{ outline:none; border-color:var(--ink); box-shadow:0 0 0 3px rgba(20,21,24,.08); }
.input:disabled{ background:var(--line-2); color:var(--muted); }
select.input{ appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23565a61' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 14px center; padding-right:36px; }
.input-code{ text-align:center; font-size:2rem; font-weight:700; letter-spacing:.5em; padding:16px 13px; }
.help{ font-size:.82rem; color:var(--muted); margin:6px 0 0; }

/* Password reveal toggle */
.pw-wrap{ position:relative; display:block; }
.pw-wrap .input{ padding-right:46px; }
.pw-toggle{ position:absolute; top:0; right:0; height:100%; width:44px; display:flex; align-items:center; justify-content:center; background:none; border:none; cursor:pointer; color:var(--muted); padding:0; }
.pw-toggle:hover{ color:var(--ink); }
.pw-toggle .icon{ width:20px; height:20px; }
.pw-toggle .icon-eye-off{ display:none; }
.pw-wrap.is-revealed .icon-eye{ display:none; }
.pw-wrap.is-revealed .icon-eye-off{ display:block; }
.is-auth .pw-toggle{ color:rgba(255,255,255,.65); }
.is-auth .pw-toggle:hover{ color:#fff; }

/* ---- Buttons ---- */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; font-family:inherit; font-size:.95rem; font-weight:600; line-height:1; padding:17px 20px; border-radius:var(--radius-pill); border:1px solid transparent; cursor:pointer; text-decoration:none; transition:background .15s, border-color .15s, color .15s, transform .05s; white-space:nowrap; }
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:var(--black); color:#fff; }
.btn-primary:hover{ background:var(--black-hover); }
.btn-dark{ background:var(--grey-fill); color:#fff; }
.btn-dark:hover{ background:#2b2f36; }
.btn-outline{ background:var(--surface); color:var(--ink); border-color:var(--line); }
.btn-outline:hover{ border-color:var(--ink); }
.btn-ghost{ background:transparent; color:var(--ink-2); }
.btn-ghost:hover{ background:var(--line-2); color:var(--ink); }
.btn-danger{ background:var(--surface); color:var(--ink); border-color:var(--line); }
.btn-danger:hover{ background:var(--ink); color:#fff; border-color:var(--ink); }
.btn-block{ display:flex; width:100%; }
.btn-sm{ padding:7px 13px; font-size:.84rem; }
.btn-icon{ padding:7px; }
.btn-icon .icon{ width:18px; height:18px; }
.btn.is-loading{ pointer-events:none; }
.btn.is-loading .icon{ display:none; }
.btn.is-loading::before{ content:""; width:16px; height:16px; flex-shrink:0; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; animation:btn-spin .6s linear infinite; }
@keyframes btn-spin{ to{ transform:rotate(360deg); } }
.form > .btn{ margin-top:1rem; }

/* ---- Page head ---- */
.page-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:22px; flex-wrap:wrap; }
.page-head h1{ margin-bottom:2px; }
.page-actions{ display:flex; gap:10px; flex-wrap:wrap; }
@media (max-width:620px){ .page-actions-split{ flex-wrap:nowrap; width:100%; } .page-actions-split .btn{ flex:1; } }
.muted{ color:var(--ink-2); }
.muted-sm{ color:var(--muted); font-size:.85rem; }
.link{ color:var(--ink); font-weight:600; text-decoration:none; font-size:.9rem; }
.link:hover{ text-decoration:underline; }
.empty{ color:var(--muted); padding:8px 0; }

/* ---- Cards & layout ---- */
.card{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); padding:22px; margin-bottom:20px; }
.card-narrow{ max-width:480px; }
.card-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:1rem; }
.card-title{ font-size:1.05rem; margin-bottom:1rem; }
.card-head .card-title{ margin-bottom:0; }
.card-cta{ display:flex; flex-direction:column; align-items:flex-start; gap:8px; }
.card-cta .btn{ margin-top:6px; }
.grid-2{ display:grid; grid-template-columns:1fr 1fr; gap:20px; align-items:start; }

/* ---- Stat grid ---- */
.stat-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:24px; }
.stat{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-sm); padding:18px 20px; }
.stat-num{ font-size:2rem; font-weight:700; line-height:1; letter-spacing:-.02em; }
.stat-label{ margin-top:6px; color:var(--muted); font-size:.85rem; }

/* ---- Visitor list ---- */
.visitor-list{ list-style:none; margin:0; padding:0; }
.visitor{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 0; border-top:1px solid var(--line-2); }
.visitor:first-child{ border-top:none; }
.visitor-main{ display:flex; flex-direction:column; min-width:0; }
.visitor-name{ font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.visitor-meta{ color:var(--muted); font-size:.85rem; }
.visitor-side{ display:flex; align-items:center; gap:10px; flex-shrink:0; }
.pass-code-sm{ font-variant-numeric:tabular-nums; font-weight:600; letter-spacing:.12em; color:var(--ink-2); font-size:.9rem; }

/* ---- Status badges ---- */
.badge{ display:inline-block; font-size:.7rem; font-weight:600; letter-spacing:.05em; text-transform:uppercase; padding:4px 9px; border-radius:var(--radius-pill); border:1px solid transparent; }
.badge-active{ background:var(--ink); color:#fff; }
.badge-used{ background:var(--line); color:#4b4f55; }
.badge-expired{ background:var(--surface); color:var(--muted); border-color:var(--line); }
.badge-revoked{ background:var(--surface); color:var(--muted); border:1px dashed #c7cbd1; }

/* ---- Pass result (generate) ---- */
.pass-result{ display:grid; grid-template-columns:1fr 1fr; gap:20px; align-items:start; }
.pass-card{ text-align:center; }
.pass-card-head .muted{ font-size:.82rem; text-transform:uppercase; letter-spacing:.08em; }
.pass-guest{ font-size:1.25rem; margin-top:2px; margin-bottom:14px; }
.pass-code{ display:block; width:100%; font-family:inherit; font-variant-numeric:tabular-nums; font-size:2.6rem; font-weight:700; letter-spacing:.28em; color:var(--ink); background:var(--line-2); border:1px dashed var(--line); border-radius:var(--radius-sm); padding:16px 10px 16px 20px; cursor:pointer; }
.pass-code:hover{ border-color:var(--ink); }
.qr-box{ display:flex; justify-content:center; margin:18px auto; }
.qr-box svg{ width:200px; height:200px; }
.pass-facts{ margin:4px 0 0; text-align:left; }
.pass-facts > div{ display:flex; justify-content:space-between; gap:16px; padding:9px 0; border-top:1px solid var(--line-2); }
.pass-facts > div:first-child{ border-top:none; }
.pass-facts dt{ color:var(--muted); font-size:.9rem; }
.pass-facts dd{ margin:0; font-weight:600; text-align:right; }
.share-card .share-actions{ display:flex; flex-direction:column; gap:10px; margin:14px 0; }
.share-card .btn-ghost{ margin-top:6px; }

/* ---- Verify ---- */
.verify-banner{ border-radius:var(--radius); padding:30px 24px; text-align:center; margin-bottom:20px; max-width:480px; }
.verify-ok{ background:var(--ink); color:#fff; }
.verify-deny{ background:var(--surface); color:var(--ink); border:2px solid var(--ink); }
.verify-icon{ width:62px; height:62px; margin:0 auto 12px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:2rem; line-height:1; }
.verify-ok .verify-icon{ background:#fff; color:var(--ink); }
.verify-deny .verify-icon{ background:var(--ink); color:#fff; }
.verify-head{ font-size:1.4rem; font-weight:700; }
.verify-sub{ margin-top:4px; opacity:.9; }
.verify-preview .pass-facts{ margin-bottom:16px; }
.verify-details{ margin-top:0; }

/* ---- Calendar ---- */
.calendar-card{ padding:18px; }
.cal-head{ display:flex; align-items:center; justify-content:center; gap:18px; margin-bottom:14px; }
.cal-title{ font-size:1.1rem; min-width:150px; text-align:center; }
.cal-nav{ width:38px; height:38px; border-radius:50%; border:1px solid var(--line); display:flex; align-items:center; justify-content:center; text-decoration:none; font-size:1.3rem; color:var(--ink); background:var(--surface); }
.cal-nav:hover{ border-color:var(--ink); }
.cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.cal-weekdays{ margin-bottom:6px; }
.cal-wd{ text-align:center; font-size:.72rem; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); padding:4px 0; }
.cal-cell{ position:relative; aspect-ratio:1/1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px; border:1px solid var(--line); border-radius:12px; text-decoration:none; color:var(--ink); background:var(--surface); transition:border-color .12s, background .12s; }
.cal-cell:hover{ border-color:var(--ink); }
.cal-empty{ border:none; background:transparent; pointer-events:none; }
.cal-daynum{ font-size:2rem; font-weight:600; }
.cal-count{ font-size:.66rem; font-weight:700; min-width:18px; height:18px; padding:0 5px; display:inline-flex; align-items:center; justify-content:center; border-radius:var(--radius-pill); background:var(--ink); color:#fff; }
.cal-cell.has-events{ background:#fbfbfc; }
.cal-cell.is-today{ border-color:var(--ink); border-width:2px; }
.cal-cell.is-selected{ background:var(--ink); color:#fff; }
.cal-cell.is-selected .cal-count{ background:#fff; color:var(--ink); }
#day-detail{ scroll-margin-top:78px; }
.cal-scroll{ overflow-x:auto; -webkit-overflow-scrolling:touch; }

/* ---- Tables ---- */
.table-wrap{ overflow-x:auto; -webkit-overflow-scrolling:touch; margin:0 -4px; }
.table-wrap::-webkit-scrollbar, .cal-scroll::-webkit-scrollbar{ height:6px; }
.table-wrap::-webkit-scrollbar-thumb, .cal-scroll::-webkit-scrollbar-thumb{ background:var(--line); border-radius:3px; }
.table{ width:100%; border-collapse:collapse; font-size:.92rem; }
.table thead th{ text-align:left; font-size:.72rem; font-weight:600; letter-spacing:.06em; text-transform:uppercase; color:var(--muted); padding:0 18px 14px; border-bottom:1px solid var(--line); white-space:nowrap; }
.table tbody td{ padding:17px 18px; border-bottom:1px solid var(--line-2); vertical-align:middle; white-space:nowrap; }
.table tbody tr{ transition:background .12s ease; }
.table tbody tr:hover{ background:var(--line-2); }
.table tbody tr:last-child td{ border-bottom:none; }
.table .sub{ display:block; color:var(--muted); font-size:.82rem; margin-top:2px; }
.mono{ font-variant-numeric:tabular-nums; letter-spacing:.1em; font-weight:600; }
.row-actions{ display:flex; gap:8px; justify-content:flex-end; flex-wrap:nowrap; }
.col-action{ text-align:right; }
.row-actions form{ margin:0; }
.tag{ display:inline-block; font-size:.66rem; font-weight:600; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); background:var(--line-2); border-radius:var(--radius-pill); padding:2px 8px; margin-left:6px; vertical-align:middle; }

/* ---- Filter bar & pager ---- */
.filter-bar{ display:flex; gap:10px; flex-wrap:wrap; margin-bottom:14px; }
.filter-bar .input{ width:auto; flex:1 1 180px; }
.filter-bar select.input{ flex:0 0 auto; }
.pager{ display:flex; align-items:center; justify-content:center; gap:14px; margin-top:18px; }
.pager-info{ color:var(--muted); font-size:.85rem; }
.btn.is-disabled{ opacity:.4; pointer-events:none; }
textarea.input{ resize:vertical; min-height:94px; line-height:1.5; font-family:inherit; }

/* ---- Credentials panel ---- */
.credentials-card{ border:1px solid var(--ink); }
.temp-pw{ font-size:1.1rem; letter-spacing:.08em; }

/* ---- Slide-in drawers ---- */
.drawer-overlay{ position:fixed; inset:0; background:rgba(17,19,24,.45); opacity:0; visibility:hidden; transition:opacity .3s ease, visibility .3s ease; z-index:60; }
.drawer-overlay.open{ opacity:1; visibility:visible; }
.drawer{ position:fixed; top:0; right:0; height:100%; width:35%; background:var(--bg); box-shadow:-12px 0 36px rgba(17,19,24,.18); transform:translateX(100%); transition:transform .38s cubic-bezier(.22,.61,.36,1); z-index:61; display:flex; flex-direction:column; }
.drawer.open{ transform:translateX(0); }
.drawer-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px 22px; background:var(--surface); border-bottom:1px solid var(--line); }
.drawer-title{ font-size:1.1rem; }
.drawer-close{ width:36px; height:36px; border-radius:50%; border:1px solid var(--line); background:var(--surface); cursor:pointer; display:flex; align-items:center; justify-content:center; color:var(--ink-2); padding:0; flex-shrink:0; }
.drawer-close:hover{ border-color:var(--ink); color:var(--ink); }
.drawer-close .icon{ width:18px; height:18px; }
.drawer-body{ flex:1; overflow-y:auto; padding:22px; }
.drawer-loading{ color:var(--muted); padding:20px 0; }
body.drawer-open{ overflow:hidden; }
.drawer-body .card{ border:none; box-shadow:none; padding:0; margin:0 0 18px; background:transparent; }
.drawer-body .card + .card{ border-top:1px solid var(--line); padding-top:18px; }
.drawer-body .page-head{ display:none; }
.drawer-body .pass-result{ grid-template-columns:1fr; gap:18px; }
.drawer-body .pass-card{ text-align:left; }
.drawer-body .qr-box{ justify-content:flex-start; }
@media (max-width:1024px){ .drawer{ width:55%; } }
@media (max-width:760px){ .drawer{ width:100%; } }

/* ---- Footer ---- */
.appfoot{ border-top:1px solid var(--line); padding:20px 0; margin-top:24px; }
.appfoot span{ color:var(--muted); font-size:.85rem; }

/* ---- Error page ---- */
.error-card{ text-align:center; max-width:420px; }
.error-code{ font-size:3rem; font-weight:700; letter-spacing:-.02em; }
.error-message{ color:var(--ink-2); margin:6px 0 18px; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width:900px){
  .pass-result{ grid-template-columns:1fr; }
  .grid-2{ grid-template-columns:1fr; }
}
@media (max-width:860px){
  .nav-toggle{ display:flex; }
  .mainnav{ position:absolute; top:62px; left:0; right:0; flex-direction:column; align-items:stretch; gap:2px; background:var(--surface); border-bottom:1px solid var(--line); box-shadow:var(--shadow); padding:10px 14px 16px; display:none; }
  .mainnav.is-open{ display:flex; }
  .nav-spacer{ display:none; }
  .navlink{ padding:11px 14px; }
  .navuser{ order:-1; justify-content:space-between; border-bottom:1px solid var(--line-2); border-radius:0; }
  .logout-form{ width:100%; }
  .logout-btn{ width:100%; justify-content:flex-start; }
}
@media (max-width:620px){
  h1{ font-size:1.4rem; }
  .stat-grid{ grid-template-columns:repeat(2,1fr); gap:12px; }
  .app-main{ padding:20px 0 48px; }
  .card{ padding:18px; }
  /* Text pairs stack, but short numeric pairs (dates/times/numbers) stay split. */
  .form-row{ flex-direction:column; gap:0; }
  .form-row.split-sm{ flex-direction:row; gap:12px; }
  /* Calendar scrolls horizontally so day cells stay a comfortable size. */
  .cal-scroll .cal-grid{ min-width:460px; }
  .cal-grid{ gap:4px; }
  .cal-cell{ border-radius:9px; }
  .cal-daynum{ font-size:1.4rem; }
  .cal-title{ min-width:auto; }
  .pass-code{ font-size:2rem; letter-spacing:.2em; }
  /* Tables stay tabular and scroll sideways (one line per cell) instead of stacking. */
  .table-wrap{ margin:0; }
}
@media (max-width:420px){
  .stat-grid{ grid-template-columns:1fr 1fr; }
  .share-actions .btn{ width:100%; }
}

/* =====================================================================
   Sidebar layout · avatar · settings · attendance
   ===================================================================== */
.topbar-right{ margin-left:auto; display:flex; align-items:center; gap:14px; }
.icon-btn{ width:40px; height:40px; border-radius:10px; border:1px solid var(--line); background:var(--surface); display:inline-flex; align-items:center; justify-content:center; cursor:pointer; color:var(--ink-2); padding:0; flex-shrink:0; }
.icon-btn:hover{ border-color:var(--ink); color:var(--ink); }
.icon-btn .icon{ width:20px; height:20px; }
.avatar-link{ display:inline-flex; text-decoration:none; border-radius:50%; }
.avatar{ display:inline-flex; align-items:center; justify-content:center; width:38px; height:38px; border-radius:50%; overflow:hidden; background:var(--ink); color:#fff; font-weight:600; font-size:.85rem; flex-shrink:0; line-height:1; }
.avatar-img{ width:100%; height:100%; object-fit:cover; display:block; }
.avatar-link:hover .avatar{ box-shadow:0 0 0 2px var(--line); }
.avatar-lg{ width:104px; height:104px; font-size:2rem; }

.layout{ display:flex; align-items:flex-start; }
.content{ flex:1; min-width:0; padding:28px 0 56px; }
.sidebar{ position:sticky; top:62px; align-self:flex-start; height:calc(100vh - 62px); width:242px; flex:0 0 242px; background:transparent; padding:18px 12px; overflow-y:auto; transition:width .2s ease, flex-basis .2s ease; }
.sidenav{ display:flex; flex-direction:column; gap:3px; }
.sidenav-link{ position:relative; display:flex; align-items:center; gap:13px; padding:11px 14px; border-radius:var(--radius-sm); color:var(--ink-2); text-decoration:none; font-weight:500; font-size:.95rem; white-space:nowrap; }
.sidenav-link:hover{ background:rgba(17,19,24,.05); color:var(--ink); }
.sidenav-link.active{ background:rgba(17,19,24,.06); color:var(--ink); font-weight:600; }
.sidenav-link.active::before{ content:""; position:absolute; left:3px; top:9px; bottom:9px; width:3px; border-radius:2px; background:var(--ink); }
.sidenav-icon{ display:inline-flex; flex-shrink:0; color:var(--muted); }
.sidenav-icon .icon{ width:20px; height:20px; }
.sidenav-link:hover .sidenav-icon, .sidenav-link.active .sidenav-icon{ color:var(--ink); }
.sidenav-label{ overflow:hidden; text-overflow:ellipsis; }
.sidebar-scrim{ display:none; }
.sidebar.collapsed{ width:66px; flex-basis:66px; }
.sidebar.collapsed .sidenav-label{ display:none; }
.sidebar.collapsed .sidenav-link{ justify-content:center; padding:11px 0; }
.sidebar.collapsed .sidenav-link.active::before{ display:none; }

/* Settings */
.settings-avatar-row{ display:flex; align-items:center; gap:18px; margin-bottom:18px; flex-wrap:wrap; }
.settings-avatar-row .avatar-upload{ display:flex; flex-direction:column; gap:8px; }
.field-hint{ color:var(--muted); font-size:.82rem; margin-top:4px; }
.file-input{ font-size:.9rem; }
.btn-row{ display:flex; gap:10px; flex-wrap:wrap; }
.mt-lg{ margin-top:22px; }

/* Attendance / check-in */
.checkin-card{ text-align:center; }
.checkin-icon{ width:62px; height:62px; border-radius:50%; background:var(--line-2); display:inline-flex; align-items:center; justify-content:center; color:var(--ink); margin:0 auto 12px; }
.checkin-icon .icon{ width:28px; height:28px; }
.checkin-done{ display:inline-flex; align-items:center; gap:8px; color:#1b7a43; font-weight:600; justify-content:center; }
.checkin-done .icon{ width:20px; height:20px; }
.att-note{ color:var(--muted); font-size:.85rem; margin-top:12px; }
.att-status{ min-height:1.2em; margin-top:12px; font-size:.9rem; color:var(--ink-2); }
.badge-present{ background:#e7f6ec; color:#1b7a43; border:1px solid #aadcbb; }
.badge-outside{ background:#fdeaea; color:#b02a21; border:1px solid #f1b9b9; }

@media (max-width:899px){
  .sidebar{ position:fixed; top:62px; left:0; height:calc(100vh - 62px); z-index:71; width:264px; flex-basis:264px; background:var(--surface); box-shadow:var(--shadow); transform:translateX(-100%); transition:transform .3s ease; padding:18px 14px; }
  .sidebar.open{ transform:translateX(0); }
  .sidebar.collapsed{ width:264px; flex-basis:264px; }
  .sidebar.collapsed .sidenav-label{ display:inline; }
  .sidebar.collapsed .sidenav-link{ justify-content:flex-start; padding:11px 14px; }
  .sidebar-scrim{ display:block; position:fixed; top:62px; left:0; right:0; bottom:0; background:rgba(17,19,24,.45); opacity:0; visibility:hidden; transition:opacity .3s, visibility .3s; z-index:70; }
  .sidebar-scrim.open{ opacity:1; visibility:visible; }
  body.nav-open{ overflow:hidden; }
  .content{ padding-top:22px; }
  .topbar-brand{ width:auto; flex:0 0 auto; padding:0 8px 0 14px; gap:8px; }
}

/* ---- Avatar upload + interactive cropper ---- */
.avatar-upload-name{ font-weight:600; margin:0 0 8px; }
.avatar-crop-modal{ position:fixed; inset:0; z-index:80; display:flex; overflow-y:auto; padding:20px; background:rgba(17,19,24,.55); }
.avatar-crop-modal[hidden]{ display:none; }
.cropper-dialog{ margin:auto; background:var(--surface); border-radius:var(--radius); box-shadow:0 20px 60px rgba(17,19,24,.35); width:100%; max-width:430px; padding:20px; }
.cropper-dialog-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.cropper-dialog-head .card-title{ margin:0; }
.cropper-canvas-wrap{ background:var(--line-2); border-radius:var(--radius-sm); overflow:hidden; height:320px; }
.cropper-canvas-wrap > img{ display:block; max-width:100%; }
.cropper-canvas-wrap .cropper-view-box, .cropper-canvas-wrap .cropper-face{ border-radius:50%; }
.cropper-zoom{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin:16px 0; }
.cropper-actions{ display:flex; gap:10px; justify-content:flex-end; }
body.modal-open{ overflow:hidden; }

/* ---- Confirmation modal ---- */
.confirm-modal{ position:fixed; inset:0; z-index:90; display:flex; align-items:center; justify-content:center; padding:20px; background:rgba(17,19,24,.55); opacity:0; transition:opacity .2s ease; }
.confirm-modal.is-open{ opacity:1; }
.confirm-modal[hidden]{ display:none; }
.confirm-card{ width:100%; max-width:400px; background:var(--surface); border-radius:var(--radius); box-shadow:0 24px 70px rgba(17,19,24,.4); padding:26px 24px 22px; text-align:center; transform:translateY(10px) scale(.97); transition:transform .24s cubic-bezier(.22,.61,.36,1); }
.confirm-modal.is-open .confirm-card{ transform:none; }
.confirm-ico{ width:50px; height:50px; margin:0 auto 14px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:var(--line-2); color:var(--ink); }
.confirm-ico .icon{ width:24px; height:24px; }
.confirm-title{ font-size:1.15rem; margin:0 0 8px; }
.confirm-msg{ color:var(--ink-2); font-size:.92rem; line-height:1.5; margin:0 0 22px; }
.confirm-actions{ display:flex; gap:10px; justify-content:center; }
.confirm-actions .btn{ flex:1; max-width:160px; }
@media (max-width:420px){ .confirm-actions{ flex-direction:column-reverse; } .confirm-actions .btn{ max-width:none; } }
.office-loc-grid{ display:flex; gap:18px; flex-wrap:wrap; align-items:flex-end; }
.office-loc-grid .form-group{ flex:1 1 180px; margin:0; }
.th-sort{ color:inherit; text-decoration:none; cursor:pointer; white-space:nowrap; }
.th-sort:hover{ text-decoration:underline; }
.scope-row{ margin-bottom:14px; }

/* ---- Segmented control (reception scope range) ---- */
.segmented{ display:inline-flex; gap:4px; max-width:100%; padding:4px; background:var(--line-2); border:1px solid var(--line); border-radius:var(--radius-pill); }
.segmented-item{ display:inline-flex; align-items:center; justify-content:center; padding:9px 18px; color:var(--ink-2); font-weight:600; font-size:.88rem; line-height:1; white-space:nowrap; text-decoration:none; border-radius:var(--radius-pill); transition:background .18s ease, color .18s ease, box-shadow .18s ease; }
.segmented-item:hover{ color:var(--ink); }
.segmented-item.is-active{ background:var(--surface); color:var(--ink); box-shadow:var(--shadow-sm); }
:root[data-theme="dark"] .segmented-item.is-active{ background:var(--line); }

/* ---- User profile (drawer / page) ---- */
.profile-head{ display:flex; align-items:center; gap:16px; margin-bottom:18px; }
.profile-name{ font-size:1.25rem; margin:0 0 8px; }
.profile-badges{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.profile-badges .tag{ margin-left:0; }
.profile-facts{ margin-top:0; }

/* ---- PWA install banner ---- */
.pwa-install{ position:fixed; left:16px; right:16px; bottom:16px; z-index:70; margin:0 auto; max-width:460px;
  display:flex; align-items:center; gap:14px; padding:14px 16px;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow);
  transform:translateY(160%); opacity:0; transition:transform .38s cubic-bezier(.22,.61,.36,1), opacity .3s ease; }
.pwa-install.is-visible{ transform:translateY(0); opacity:1; }
.pwa-install[hidden]{ display:none; }
.pwa-install-icon{ width:46px; height:46px; border-radius:11px; flex-shrink:0; }
.pwa-install-text{ display:flex; flex-direction:column; min-width:0; flex:1; }
.pwa-install-text strong{ font-size:.95rem; }
.pwa-install-text span{ color:var(--muted); font-size:.82rem; line-height:1.35; }
.ios-share-ico{ display:inline-flex; vertical-align:-3px; color:var(--ink-2); }
.ios-share-ico .icon{ width:16px; height:16px; }
.pwa-install-actions{ display:flex; gap:8px; flex-shrink:0; }
@media (max-width:520px){
  .pwa-install{ flex-wrap:wrap; gap:10px; }
  .pwa-install-actions{ width:100%; justify-content:flex-end; }
}

/* ---- Lazy-loaded tables (history & visitor logs) ---- */
.lazy-controls{ display:flex; flex-direction:column; align-items:center; gap:8px; margin-top:16px; }
.lazy-controls .lazy-status{ color:var(--muted); font-size:.85rem; }
.lazy-controls .btn[hidden]{ display:none; }
.lazy-sentinel{ width:100%; height:1px; }

/* ---- Theme toggle (Settings) ---- */
.theme-toggle{ display:inline-flex; gap:4px; background:var(--line-2); border:1px solid var(--line); border-radius:var(--radius-pill); padding:4px; }
.theme-toggle button{ display:inline-flex; align-items:center; gap:8px; padding:9px 18px; border:none; background:none; color:var(--ink-2); font:inherit; font-weight:600; font-size:.9rem; border-radius:var(--radius-pill); cursor:pointer; transition:background .15s, color .15s; }
.theme-toggle button .icon{ width:18px; height:18px; }
.theme-toggle button[aria-pressed="true"]{ background:var(--ink); color:var(--bg); }

/* ---- Dark theme ---- */
:root[data-theme="dark"]{
  --bg:#0f1115;
  --surface:#181b21;
  --ink:#f2f3f5;
  --ink-2:#aeb4bd;
  --muted:#7e858f;
  --line:#2b3038;
  --line-2:#232830;
  --black:#f2f3f5;
  --black-hover:#ffffff;
  --grey-fill:#c7ccd4;
  --shadow:0 1px 2px rgba(0,0,0,.5), 0 10px 28px rgba(0,0,0,.55);
  --shadow-sm:0 1px 2px rgba(0,0,0,.45);
}
/* Filled elements flip to a light fill in dark mode — give them dark text. */
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .btn-dark,
:root[data-theme="dark"] .badge-active,
:root[data-theme="dark"] .role-admin,
:root[data-theme="dark"] .avatar,
:root[data-theme="dark"] .cal-count,
:root[data-theme="dark"] .cal-cell.is-selected,
:root[data-theme="dark"] .verify-ok{ color:var(--bg); }
:root[data-theme="dark"] .btn-danger:hover{ color:var(--bg); }
:root[data-theme="dark"] .badge-used{ color:var(--ink-2); }
:root[data-theme="dark"] .verify-ok .verify-icon{ background:var(--bg); color:var(--ink); }
:root[data-theme="dark"] .cal-cell.is-selected .cal-count{ background:var(--bg); color:var(--ink); }
:root[data-theme="dark"] .cal-cell.has-events{ background:var(--line-2); }
/* The wordmark is a black PNG — invert it to read on the dark bar. */
:root[data-theme="dark"] .brand-logo{ filter:invert(1) brightness(1.8); }
/* Subtle interactive states tuned for dark surfaces. */
:root[data-theme="dark"] .sidenav-link:hover{ background:rgba(255,255,255,.06); }
:root[data-theme="dark"] .sidenav-link.active{ background:rgba(255,255,255,.08); }
:root[data-theme="dark"] .input:focus{ box-shadow:0 0 0 3px rgba(255,255,255,.12); }
:root[data-theme="dark"] .hamburger:hover{ background:var(--line-2); }
