/* ==========================================================================
   SupplyPass - design system (dark slate + mature green, professional)
   Brand: slate #1F2937 · green #2E7D5A · verified #22A06B · bg #F3F7F5 · text #6B7280
   Mobile-first. System font stack. No external CDNs.
   ========================================================================== */

:root {
  /* Brand - dark-slate structure with mature-green action/approval accents.
     Palette: slate #1F2937, green #2E7D5A, verified #22A06B, bg #F3F7F5, text #6B7280. */
  --navy: #1F2937;          /* legacy alias → slate */
  --navy-2: #2E7D5A;        /* legacy alias → green */
  --primary: #1F2937;       /* dark slate - primary buttons, active nav, brand */
  --primary-2: #111827;     /* slate hover */
  --accent: #2E7D5A;        /* mature green - links, focus, approval accent */
  --accent-strong: #22A06B; /* brighter green - link hover / emphasis */

  --tint: #e7f1ec;          /* soft green: icon chips, soft buttons, active tabs */
  --tint-2: #d6e8de;
  --ring: rgba(46, 125, 90, .26);

  --bg: #F3F7F5;
  --surface: #ffffff;
  --surface-2: #f4f8f6;
  --seg-bg: #e8efeb;
  --border: #e4ebe7;
  --border-2: #d4ddd8;

  --ink: #1F2937;           /* headings - slate */
  --text: #374151;          /* body text */
  --text-2: #6B7280;        /* neutral text */
  --muted: #9ba3af;

  --success: #22A06B;       /* brighter green - verified / authorized */
  --success-bg: #e5f6ed;
  --success-border: #bde6d1;
  --danger: #d8382f;
  --danger-bg: #fdecea;
  --danger-border: #f6cdc9;
  --warn: #b7791f;
  --warn-bg: #fbf1dc;
  --info: #475569;          /* neutral slate info (was blue) */
  --info-bg: #eef1f4;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(20, 40, 90, .05);
  --shadow: 0 1px 2px rgba(20, 40, 90, .04), 0 10px 26px rgba(20, 40, 90, .07);
  --shadow-md: 0 6px 16px rgba(20, 40, 90, .08), 0 18px 40px rgba(20, 40, 90, .10);
  --shadow-lg: 0 24px 60px rgba(20, 40, 90, .22);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

/* Dark theme: applied when the user (or system, via theme-init.js) selects it.
   The @media fallback only kicks in when JS is disabled (no data-theme set). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --navy: #e6ebf0; --navy-2: #7fd3aa;
    --primary: #2E7D5A; --primary-2: #22A06B; --accent: #4cc98d; --accent-strong: #6bd8a5;
    --tint: #16271f; --tint-2: #1d3a2c; --ring: rgba(76, 201, 141, .32);
    --bg: #0e141d; --surface: #182029; --surface-2: #121821; --seg-bg: #141d26;
    --border: #2a3540; --border-2: #38434f;
    --ink: #f1f5f9; --text: #cdd5de; --text-2: #97a1ad; --muted: #6b7580;
    --success: #35c98a; --success-bg: #10281d; --success-border: #1c4634;
    --danger: #f4776d; --danger-bg: #2a1414; --danger-border: #4a1f1d;
    --warn: #e0a94a; --warn-bg: #2a2110; --info: #94a3b8; --info-bg: #1b232d;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.5);
    --shadow: 0 1px 2px rgba(0,0,0,.5), 0 10px 26px rgba(0,0,0,.5);
    --shadow-md: 0 10px 30px rgba(0,0,0,.55); --shadow-lg: 0 24px 60px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
    --navy: #e6ebf0; --navy-2: #7fd3aa;
    --primary: #2E7D5A; --primary-2: #22A06B; --accent: #4cc98d; --accent-strong: #6bd8a5;
    --tint: #16271f; --tint-2: #1d3a2c; --ring: rgba(76, 201, 141, .32);
    --bg: #0e141d; --surface: #182029; --surface-2: #121821; --seg-bg: #141d26;
    --border: #2a3540; --border-2: #38434f;
    --ink: #f1f5f9; --text: #cdd5de; --text-2: #97a1ad; --muted: #6b7580;
    --success: #35c98a; --success-bg: #10281d; --success-border: #1c4634;
    --danger: #f4776d; --danger-bg: #2a1414; --danger-border: #4a1f1d;
    --warn: #e0a94a; --warn-bg: #2a2110; --info: #94a3b8; --info-bg: #1b232d;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.5);
    --shadow: 0 1px 2px rgba(0,0,0,.5), 0 10px 26px rgba(0,0,0,.5);
    --shadow-md: 0 10px 30px rgba(0,0,0,.55); --shadow-lg: 0 24px 60px rgba(0,0,0,.7);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.55;
  color: var(--text); background: var(--bg); min-height: 100vh;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
.icon { display: block; flex-shrink: 0; }

/* ---------- Brand mark ---------- */
.brand-mark {
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(150deg, var(--navy-2), var(--primary-2));
  box-shadow: 0 4px 12px rgba(31, 41, 55, .28);
}
.brand-mark .icon { width: 24px; height: 24px; }
/* Logo image mark (app bar). White plate in dark mode keeps the slate logo legible. */
.brand-mark-img { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; flex-shrink: 0; display: block; }
:root[data-theme="dark"] .brand-mark-img { background: #fff; padding: 3px; }

/* ---------- Icon chip ---------- */
.chip {
  display: grid; place-items: center; flex-shrink: 0;
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--tint); color: var(--primary);
}
.chip .icon { width: 24px; height: 24px; }
.chip-lg { width: 68px; height: 68px; border-radius: 20px; }
.chip-lg .icon { width: 34px; height: 34px; }

/* ---------- App bar ---------- */
.app-bar {
  position: sticky; top: 0; z-index: 50; background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; height: 64px; padding: 0 18px;
}
.app-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-brand:hover { text-decoration: none; }
/* Full SupplyPass lockup (box + wordmark) in the app bar. */
.brand-lockup { height: 30px; width: auto; display: block; }
:root[data-theme="dark"] .brand-lockup { background: #fff; padding: 5px 9px; border-radius: 9px; }
/* Org / workspace context, relocated beside the logo with a divider. */
.org-label {
  font-size: 13px; font-weight: 600; color: var(--text-2); line-height: 1.2;
  padding-left: 14px; border-left: 1px solid var(--border-2);
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-bar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-name { font-weight: 700; font-size: 14px; color: var(--ink); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
  background: var(--tint); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}

/* Icon buttons (theme toggle, hamburger) */
.icon-btn {
  display: grid; place-items: center; cursor: pointer;
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface); border: 1.5px solid var(--border-2); color: var(--text-2);
  transition: all .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .icon { width: 20px; height: 20px; }
/* Filled variant - stands apart from the neutral (ghost) edit icon button. */
.icon-btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.icon-btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
.nav-toggle { display: none; }

/* Mobile slide-down menu */
.mobile-menu {
  position: fixed; top: 60px; left: 0; right: 0; z-index: 60;
  background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-md); padding: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.mm-user { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.mm-user .mm-name { font-weight: 800; color: var(--ink); font-size: 16px; }
.mm-user .mm-sub { font-size: 13px; color: var(--text-2); }
.mm-link {
  display: block; padding: 12px 14px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 15px; color: var(--text);
}
.mm-link:hover { background: var(--surface-2); text-decoration: none; }
.mm-link.active { background: var(--tint); color: var(--primary); }
.mm-menu-signout { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border); }

/* ---------- Section nav (underline tabs) ---------- */
.subnav {
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 64px; z-index: 40;
}
.subnav-inner {
  max-width: 1040px; margin: 0 auto; padding: 0 18px;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
}
.subnav-inner::-webkit-scrollbar { display: none; }
.tab {
  position: relative; white-space: nowrap; cursor: pointer;
  padding: 14px 14px 13px; font-weight: 650; font-size: 14px;
  color: var(--text-2); border-bottom: 2.5px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Legacy segmented control (kept for any inline uses) */
.seg { display: flex; gap: 4px; background: var(--seg-bg); border-radius: 12px; padding: 4px; }
.seg > a, .seg > button {
  flex: 1; text-align: center; white-space: nowrap; cursor: pointer;
  padding: 9px 14px; border-radius: 9px; font-weight: 700; font-size: 14px;
  color: var(--text-2); background: transparent; border: none; font-family: var(--font);
}
.seg > a.active, .seg > button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-xs); }

/* ---------- Layout ---------- */
.container { max-width: 1040px; margin: 0 auto; padding: 26px 18px 90px; }
.container-narrow { max-width: 600px; }

.page-head { margin-bottom: 22px; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -.03em; color: var(--ink); }
.page-sub { font-size: 14px; color: var(--text-2); margin-top: 3px; }

.eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}

.stack-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.stack-head .wordmark { font-size: 20px; font-weight: 800; color: var(--navy); letter-spacing: -.02em; }
.stack-head .sub { font-size: 13px; color: var(--text-2); }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.back-link:hover { color: var(--ink); text-decoration: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px;
}
.card-lg { border-radius: var(--radius-lg); padding: 28px; }
.card-title { font-size: 15px; font-weight: 800; color: var(--ink); margin-bottom: 16px; letter-spacing: -.01em; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ---------- Stats ---------- */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
a.stat { display: block; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.stat:hover { border-color: var(--border-2); box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.stat-num { font-size: 32px; font-weight: 800; letter-spacing: -.03em; color: var(--ink); line-height: 1; }
.stat-label { color: var(--text-2); font-size: 13px; font-weight: 600; margin-top: 8px; }
.stat-label .icon { display: inline-block; vertical-align: -2px; color: var(--muted); opacity: 0; transition: opacity .15s, transform .15s; }
a.stat:hover .stat-label .icon { opacity: 1; color: var(--primary); transform: translateX(2px); }

/* ---------- Callout ---------- */
.callout { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; }
.callout .icon { width: 22px; height: 22px; flex-shrink: 0; }
.callout-title { font-weight: 800; font-size: 14px; }
.callout-sub { font-size: 13px; opacity: .85; }
.callout-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.callout-info { background: var(--info-bg); color: var(--info); border: 1px solid transparent; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 12px 14px; font-size: 15px; font-family: var(--font);
  color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--border-2); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 42px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 7px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 150px; }
select { cursor: pointer; }

/* ---------- Image upload (styled label opens the native picker) ---------- */
.file-upload { display: flex; align-items: center; gap: 14px; }
/* Logo preview is a rectangle with `contain`, so a square logo is centered (letterboxed)
   and a wide logo fills the width — neither is cropped or stretched. */
.file-preview { width: 104px; height: 66px; object-fit: contain; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); padding: 6px; flex-shrink: 0; }
/* Round variant (profile photo) fills a circle — cover is correct there. */
.file-preview.round { width: 66px; height: 66px; object-fit: cover; border-radius: 50%; padding: 0; }
.file-drop {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 12px 14px; border: 1.5px dashed var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 14px;
  transition: border-color .15s, background .15s, color .15s;
}
.file-drop:hover { border-color: var(--accent); background: var(--tint); color: var(--primary); }
.file-drop .icon { width: 20px; height: 20px; flex-shrink: 0; color: var(--primary); }
.file-drop .fd-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 700; }
.file-drop .fd-cta { flex-shrink: 0; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-pill); padding: 4px 12px; }
.file-drop:hover .fd-cta { border-color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; font-size: 15px; font-weight: 700; font-family: var(--font);
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; transition: all .15s; white-space: nowrap; color: #fff;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .icon { width: 19px; height: 19px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(31, 41, 55, .16); }
/* Slate button warms to the brand green on hover (background change, text stays white). */
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(46, 125, 90, .28); }
.btn-soft { background: var(--tint); color: var(--primary); }
.btn-soft:hover { background: var(--tint-2); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 22px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 8px 12px; font-size: 13px; }

/* ---------- Badges & pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }
.badge .icon { width: 14px; height: 14px; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.auth-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: var(--radius-pill); font-weight: 800; font-size: 14px; background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.auth-pill.deny { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.auth-pill .icon { width: 18px; height: 18px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--surface); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 14px 16px; font-size: 14px; vertical-align: middle; }
thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
  color: var(--muted); font-weight: 700; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
tbody td { color: var(--text); border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
.cell-mono { font-family: var(--mono); font-size: 12.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
/* Timestamp cell: date reads primary, time steps back (secondary). */
.cell-when { font-size: 13px; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-when .t { color: var(--muted); }

/* Primary / secondary text stacked in one cell — e.g. distributor over branch,
   name over email. The secondary line is smaller and muted so hierarchy is obvious. */
.cp-name { font-weight: 600; color: var(--ink); line-height: 1.3; }
.cp-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.25; }

/* ---------- Flash ---------- */
.flash-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200; width: calc(100% - 32px); max-width: 480px; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 13px 16px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; border: 1px solid transparent; }
.flash-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.flash-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.flash-info { background: var(--info-bg); color: var(--info); }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 40px 32px; }
.auth-logo { text-align: center; margin-bottom: 26px; }
.auth-logo .brand-mark { width: 58px; height: 58px; border-radius: 17px; margin: 0 auto 14px; }
.auth-logo .brand-mark .icon { width: 32px; height: 32px; }
.auth-logo .logo-lockup { display: block; width: min(300px, 82%); height: auto; margin: 4px auto 16px; }
.auth-logo .logo-mark-img { width: 66px; height: 66px; object-fit: contain; display: block; margin: 0 auto 14px; border-radius: 16px; }
:root[data-theme="dark"] .auth-logo .logo-lockup { background: #fff; padding: 14px 18px; border-radius: 16px; width: min(320px, 90%); }
:root[data-theme="dark"] .auth-logo .logo-mark-img { background: #fff; padding: 7px; }
.auth-logo h1 { font-size: 23px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.auth-logo p { color: var(--text-2); font-size: 14px; margin-top: 6px; }
.auth-alt { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-2); }

/* ---------- Pass display ---------- */
.pass-card { max-width: 440px; margin: 0 auto; text-align: center; }
.pass-avatar { margin: 0 auto 16px; }
.pass-name { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.pass-org { color: var(--text-2); font-size: 15px; margin-top: 2px; }
.pass-pill-row { margin: 16px 0 20px; }
.pass-qr-box { position: relative; background: #fff; border-radius: var(--radius); padding: 16px; display: inline-block; box-shadow: var(--shadow-xs); border: 1px solid var(--border); }
.pass-qr-box img { display: block; width: 224px; height: 224px; image-rendering: pixelated; }
.pass-qr-box.stale img { filter: blur(6px); opacity: .35; }
.pass-scan-label { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 800; margin: 16px 0 4px; }
.pass-code { font-family: var(--mono); font-size: 44px; font-weight: 700; letter-spacing: .18em; color: var(--ink); }
.pass-code.stale { opacity: .3; }
.pass-timer { margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--primary); font-weight: 700; font-size: 14px; }
.pass-timer .icon { width: 17px; height: 17px; }
.timer-ring { --pct: 100; width: 20px; height: 20px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--border-2) 0);
  -webkit-mask: radial-gradient(circle 5.5px at center, transparent 98%, #000 100%);
          mask: radial-gradient(circle 5.5px at center, transparent 98%, #000 100%); }
.pass-note { margin-top: 16px; font-size: 13px; color: var(--muted); }
.pass-blocked { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); border-radius: var(--radius); padding: 24px; font-weight: 600; }

/* ---------- Verify ---------- */
.verify-branch-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.branch-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--tint); color: var(--primary); font-weight: 800; padding: 9px 15px; border-radius: var(--radius-pill); font-size: 14px; }
#scanner { width: 100%; max-width: 360px; margin: 0 auto 14px; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 1; display: none; }
#scanner video { width: 100% !important; height: 100% !important; object-fit: cover; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.code-input { font-family: var(--mono); font-size: 30px; text-align: center; letter-spacing: .3em; padding: 16px; color: var(--ink); }
.code-input::placeholder { letter-spacing: .3em; }

/* ---------- Verify result ---------- */
.result-card { text-align: center; padding: 28px 24px; }
.result-icon { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px; color: #fff; }
.result-icon svg { width: 46px; height: 46px; }
.result-authorized .result-icon { background: var(--success); box-shadow: 0 10px 24px rgba(15,138,95,.3); }
.result-denied .result-icon { background: var(--danger); box-shadow: 0 10px 24px rgba(216,56,47,.3); }
.result-title { font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.result-authorized .result-title { color: var(--success); }
.result-denied .result-title { color: var(--danger); }
.result-photo { width: 118px; height: 118px; border-radius: 50%; object-fit: cover; margin: 18px auto 10px; display: block; border: 4px solid var(--surface); box-shadow: var(--shadow-md); }
.result-name { font-size: 20px; font-weight: 800; color: var(--ink); }
.result-meta { color: var(--text-2); font-size: 15px; margin-top: 2px; }
.result-reason { margin-top: 12px; color: var(--text-2); font-size: 14px; }

/* ---------- Role cards (landing-style lists) ---------- */
.rolelist { display: flex; flex-direction: column; gap: 12px; }
.rolecard { display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; transition: all .15s; }
.rolecard:hover { text-decoration: none; border-color: var(--border-2); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.rolecard .rc-title { font-weight: 800; color: var(--ink); }
.rolecard .rc-sub { font-size: 13px; color: var(--text-2); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 25, 50, .5); backdrop-filter: blur(2px); z-index: 300; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; padding: 26px; }
.modal h3 { font-size: 18px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.modal p { color: var(--text-2); font-size: 14px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
[hidden] { display: none !important; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .search { flex: 1; min-width: 200px; }
.toggle-scope { display: inline-flex; background: var(--seg-bg); border-radius: var(--radius-sm); padding: 4px; }
.toggle-scope a { padding: 8px 14px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--text-2); }
.toggle-scope a:hover { text-decoration: none; color: var(--ink); }
.toggle-scope a.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-xs); }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 18px; flex-wrap: wrap; justify-content: center; }
.pagination a, .pagination span { padding: 9px 13px; border-radius: var(--radius-sm); font-weight: 700; font-size: 14px; border: 1px solid var(--border); color: var(--text-2); }
.pagination a:hover { text-decoration: none; background: var(--surface-2); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.text-sm { font-size: 13px; }
.mono { font-family: var(--mono); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.wrap { flex-wrap: wrap; }
.nowrap { white-space: nowrap; }

/* ---------- Table helpers: avatars, people, actions ---------- */
.cell-person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.avatar-sm {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: var(--tint); color: var(--primary); text-transform: uppercase;
}
/* Logo thumbnails: rounded square with `contain` (not a cropped circle). */
.avatar-sm.logo-thumb { border-radius: var(--radius-sm); object-fit: contain; background: var(--surface); border: 1px solid var(--border); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: var(--surface-2); }
.cell-link { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--primary); }
.cell-link .icon { width: 15px; height: 15px; }

/* ---------- Live pass status badge ---------- */
.pass-badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px;
  border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 700;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.pass-badge.live { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.pass-badge .pb-live { display: inline-flex; align-items: center; gap: 7px; }
.pass-badge .live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 0 rgba(15,138,95,.5); animation: livePulse 1.6s infinite;
}
.pass-badge .pb-count { font-variant-numeric: tabular-nums; }
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(15,138,95,.45); }
  70% { box-shadow: 0 0 0 6px rgba(15,138,95,0); }
  100% { box-shadow: 0 0 0 0 rgba(15,138,95,0); }
}

/* ---------- Detail page header ---------- */
.detail-head { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.detail-logo {
  width: 60px; height: 60px; border-radius: 16px; object-fit: cover; flex-shrink: 0;
  background: var(--tint); color: var(--primary); display: grid; place-items: center;
  font-weight: 800; font-size: 22px; border: 1px solid var(--border);
}
.detail-logo .icon { width: 30px; height: 30px; }
/* An actual logo image renders as a wide rectangle with `contain` (square logos are
   centered without filling the sides); the letter fallback stays a tinted square. */
img.detail-logo { width: 116px; height: 68px; object-fit: contain; background: var(--surface); padding: 7px; border-radius: 14px; }
.metrics { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 0; }
.metric-chip {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-pill);
  font-size: 13px; color: var(--text-2); font-weight: 600;
}
.metric-chip b { color: var(--ink); font-weight: 800; font-size: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.section-head h2 { font-size: 16px; font-weight: 800; color: var(--ink); letter-spacing: -.01em; }

/* ---------- Integrity panel ---------- */
.integrity-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.integrity-item {
  display: flex; align-items: center; gap: 13px; padding: 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.integrity-mark {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; color: #fff;
}
.integrity-mark .icon { width: 22px; height: 22px; }
.integrity-mark.ok { background: var(--success); }
.integrity-mark.bad { background: var(--danger); }
.integrity-item .ii-status { font-weight: 800; color: var(--ink); font-size: 14px; }
.integrity-item .ii-sub { font-size: 12.5px; color: var(--text-2); }
.explainer summary {
  cursor: pointer; list-style: none; font-weight: 700; font-size: 14px; color: var(--primary);
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 0;
}
.explainer summary::-webkit-details-marker { display: none; }
.explainer summary .icon { width: 17px; height: 17px; transition: transform .15s; }
.explainer[open] summary .icon { transform: rotate(90deg); }
.explainer .steps { margin: 14px 0 4px; display: grid; gap: 14px; }
.step { display: flex; gap: 13px; }
.step .step-num {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0; display: grid; place-items: center;
  background: var(--tint); color: var(--primary); font-weight: 800; font-size: 13px;
}
.step .step-body { font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.step .step-body b { color: var(--ink); font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .app-bar { height: 60px; padding: 0 14px; gap: 10px; }
  .brand-lockup { height: 24px; }
  :root[data-theme="dark"] .brand-lockup { padding: 4px 7px; }
  .page-title { font-size: 21px; }
  .pass-code { font-size: 38px; }
  .hide-sm { display: none !important; }
  .subnav { display: none; }          /* replaced by the hamburger menu */
  .nav-toggle { display: grid; }      /* hamburger visible on mobile */

  /* Pin auth to the top so the on-screen keyboard doesn't shove a centered card around. */
  .auth-wrap { align-items: flex-start; padding-top: 34px; }

  /* Compact tables so the grid fits without horizontal scrolling. */
  .container { padding: 20px 14px 80px; }
  th, td { padding: 11px 10px; font-size: 13px; }
  th { font-size: 10px; letter-spacing: .04em; }
  .cell-mono { font-size: 12px; }
  .row-actions { gap: 6px; }
  .row-actions .btn { padding: 7px 10px; font-size: 12.5px; }
}
@media (min-width: 641px) {
  .mobile-menu { display: none !important; }
}
