/* ===========================================================================
   Collecto (mailroom) — admin theme
   A thin monochrome "zinc" layer on top of Bootstrap 5.
   No inline styles anywhere in the app; everything lives here.
   =========================================================================== */

/* ---- Inter (variable, SIL Open Font License — licenses/inter-OFL.txt) ---- */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --cl-bg:        #fbfbfb;
  --cl-surface:   #ffffff;
  --cl-ink:       #09090b;   /* near-black — used for text/headings */
  --cl-ink-soft:  #27272a;

  /* ---- Brand accent (default = Collecto amber). Admin can override via
         Settings → Design → theme colour; see theme_style_tag(). ------------- */
  --cl-primary:       #c2410c;   /* buttons, links, highlights, brand marks */
  --cl-primary-hover: #9a3412;
  --cl-primary-soft:  #fff7ed;   /* light accent surface (active nav, stat chips) */
  --cl-muted:     #71717a;
  --cl-faint:     #a1a1aa;
  --cl-line:      #e4e4e7;
  --cl-line-soft: #f1f1f3;
  --cl-zinc-50:   #fafafa;
  --cl-zinc-100:  #f4f4f5;
  --cl-zinc-200:  #e4e4e7;
  --cl-rose:      #e11d48;
  --cl-amber:     #b45309;
  --cl-green:     #15803d;
  --cl-rose-soft:  #fff1f2;
  --cl-rose-line:  #fecdd3;
  --cl-rose-ink:   #881337;
  --cl-green-soft: #f0fdf4;
  --cl-green-line: #bbf7d0;
  --cl-amber-soft: #fffbeb;
  --cl-amber-line: #fde68a;
  --cl-track:      #d4d4d8;
  --cl-sidebar-w: 248px;
  --cl-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --cl-radius: 8px;        /* controls: inputs, buttons */
  --cl-radius-lg: 12px;    /* cards, modals */
  --cl-shadow-sm: 0 1px 2px rgba(9, 9, 11, .05);
  --cl-shadow-md: 0 4px 16px -6px rgba(9, 9, 11, .12);
  /* Dark chrome (sidebar + brand panels) derived from the accent so it follows
     the admin's Settings colour. Static fallback first for older browsers. */
  --cl-sidebar-bg: #2b160b;      /* dark navy sidebar (fallback) */
  --cl-sidebar-bg: color-mix(in srgb, var(--cl-primary) 24%, #05121c);
  --cl-sidebar-bg2: #170b05;     /* deeper shade for gradients (fallback) */
  --cl-sidebar-bg2: color-mix(in srgb, var(--cl-primary) 13%, #030b12);

  /* Re-point Bootstrap's primary onto the brand accent so stock components match. */
  --bs-primary:        #c2410c;
  --bs-primary-rgb:    3, 105, 161;
  --bs-body-color:     #27272a;
  --bs-body-bg:        #fbfbfb;
  --bs-border-color:   #e4e4e7;
  --bs-link-color:     #c2410c;
  --bs-link-hover-color: #9a3412;
  --bs-focus-ring-color: rgba(194, 65, 12, .25);
}

/* ---- Dark mode ------------------------------------------------------------
   data-theme="dark" (user choice) or the system setting when the user has not
   chosen (no data-theme attribute). Only tokens change; components follow. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --cl-bg:        #0c0c11;
  --cl-surface:   #16161d;
  --cl-ink:       #f4f4f5;
  --cl-ink-soft:  #d4d4d8;
  --cl-primary-soft: color-mix(in srgb, var(--cl-primary) 22%, #16161d);
  --cl-muted:     #a1a1aa;
  --cl-faint:     #71717a;
  --cl-line:      #2a2a35;
  --cl-line-soft: #202029;
  --cl-zinc-50:   #191920;
  --cl-zinc-100:  #1f1f27;
  --cl-zinc-200:  #2a2a35;
  --cl-rose:      #fb7185;
  --cl-amber:     #fbbf24;
  --cl-green:     #4ade80;
  --cl-rose-soft:  rgba(244, 63, 94, .12);
  --cl-rose-line:  rgba(244, 63, 94, .35);
  --cl-rose-ink:   #fecdd3;
  --cl-green-soft: rgba(34, 197, 94, .12);
  --cl-green-line: rgba(34, 197, 94, .35);
  --cl-amber-soft: rgba(245, 158, 11, .12);
  --cl-amber-line: rgba(245, 158, 11, .35);
  --cl-track:      #3f3f4a;
  --bs-body-color:     #d4d4d8;
  --bs-body-bg:        #0c0c11;
  --bs-border-color:   #2a2a35;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --cl-bg:        #0c0c11;
    --cl-surface:   #16161d;
    --cl-ink:       #f4f4f5;
    --cl-ink-soft:  #d4d4d8;
    --cl-primary-soft: color-mix(in srgb, var(--cl-primary) 22%, #16161d);
    --cl-muted:     #a1a1aa;
    --cl-faint:     #71717a;
    --cl-line:      #2a2a35;
    --cl-line-soft: #202029;
    --cl-zinc-50:   #191920;
    --cl-zinc-100:  #1f1f27;
    --cl-zinc-200:  #2a2a35;
    --cl-rose:      #fb7185;
    --cl-amber:     #fbbf24;
    --cl-green:     #4ade80;
    --cl-rose-soft:  rgba(244, 63, 94, .12);
    --cl-rose-line:  rgba(244, 63, 94, .35);
    --cl-rose-ink:   #fecdd3;
    --cl-green-soft: rgba(34, 197, 94, .12);
    --cl-green-line: rgba(34, 197, 94, .35);
    --cl-amber-soft: rgba(245, 158, 11, .12);
    --cl-amber-line: rgba(245, 158, 11, .35);
    --cl-track:      #3f3f4a;
    --bs-body-color:     #d4d4d8;
    --bs-body-bg:        #0c0c11;
    --bs-border-color:   #2a2a35;
  }
}

* { -webkit-font-smoothing: antialiased; }

body {
  background: var(--cl-bg);
  color: var(--cl-ink-soft);
  font-family: var(--cl-font);
  font-feature-settings: "cv11", "ss01";   /* Inter: single-storey a, open digits */
  font-size: 14px;
  line-height: 1.55;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--cl-font); }

a { text-decoration: none; color: var(--cl-primary); }
a:hover { color: var(--cl-primary-hover); }
a.cell-main, .cell-main a { color: var(--cl-ink); }
a.cell-main:hover { color: var(--cl-primary); }

/* ---- App shell ---------------------------------------------------------- */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

.app-sidebar {
  width: var(--cl-sidebar-w);
  flex-shrink: 0;
  background: var(--cl-sidebar-bg);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; height: 100vh; }

.app-content { flex: 1 1 auto; overflow-y: auto; padding: 1.5rem; }
.content-wrap { max-width: 1500px; margin: 0 auto; }

/* ---- Sidebar brand ------------------------------------------------------ */
.sidebar-brand {
  height: 56px;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-brand .brand-mark {
  height: 30px; width: 30px;
  border-radius: 8px;
  background: var(--cl-primary);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
  box-shadow: 0 4px 10px -4px rgba(0,0,0,.4);
}
.sidebar-brand .brand-text {
  font-weight: 650; font-size: 14.5px; letter-spacing: -.01em; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-brand .brand-text span { color: rgba(255,255,255,.5); font-weight: 600; }
.sidebar-brand .brand-logo { max-height: 30px; max-width: 168px; object-fit: contain; }

/* ---- Sidebar nav -------------------------------------------------------- */
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 1.25rem .65rem; }
.sidebar-nav::-webkit-scrollbar { width: 0; }
.nav-group { margin-bottom: 1.4rem; }
.nav-group-label {
  padding: 0 .65rem; margin-bottom: .5rem;
  font-size: 10.5px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.42);
}
.nav-link-cl {
  display: flex; align-items: center; gap: .65rem;
  padding: 8px .65rem; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: rgba(255,255,255,.74);
  transition: background-color .12s, color .12s;
}
.nav-link-cl .bi { font-size: 15px; width: 18px; text-align: center; }
.nav-link-cl:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link-cl.active { background: var(--cl-primary); color: #fff; font-weight: 600;
  box-shadow: 0 6px 14px -8px rgba(0,0,0,.45); }
.nav-link-cl .nav-badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 6px; background: rgba(255,255,255,.16); color: #fff;
  font-size: 10px; font-weight: 700; display: inline-flex;
  align-items: center; justify-content: center;
}
.nav-link-cl.active .nav-badge { background: rgba(255,255,255,.26); }

/* ---- Sidebar user block ------------------------------------------------- */
.sidebar-user { border-top: 1px solid rgba(255,255,255,.08); padding: .65rem; flex-shrink: 0; }
.sidebar-user .user-avatar {
  height: 32px; width: 32px; border-radius: 8px; background: var(--cl-primary);
  color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-user .user-name { font-size: 13.5px; font-weight: 600; color: #fff; line-height: 1.2; }
.sidebar-user .user-role { font-size: 11px; color: rgba(255,255,255,.5); text-transform: capitalize; }
.sidebar-user .btn-cl-ghost { color: rgba(255,255,255,.6); }
.sidebar-user .btn-cl-ghost:hover { color: #fff; background: rgba(255,255,255,.1); }

/* ---- Topbar ------------------------------------------------------------- */
.app-topbar {
  height: 56px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: 0 1.5rem;
  background: var(--cl-surface);
  border-bottom: 1px solid var(--cl-line);
}
.breadcrumbs { display: flex; align-items: center; gap: .45rem; min-width: 0;
  font-size: 13.5px; font-weight: 500; }
.breadcrumbs a { color: var(--cl-muted); }
.breadcrumbs a:hover { color: var(--cl-ink); }
.breadcrumbs .sep { color: var(--cl-faint); }
.breadcrumbs .current { color: var(--cl-ink); font-weight: 600; }
.breadcrumbs a, .breadcrumbs .sep { white-space: nowrap; flex-shrink: 0; }
.breadcrumbs .current { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Phones: keep only the parent page and the current page. */
@media (max-width: 575.98px) {
  .breadcrumbs > a:not(:nth-last-child(3)), .breadcrumbs > .sep:not(:nth-last-child(2)) { display: none; }
}
.topbar-link {
  font-size: 13.5px; font-weight: 500;
  color: var(--cl-muted); display: inline-flex; align-items: center; gap: .35rem;
}
.topbar-link:hover { color: var(--cl-ink); }

/* Sidebar drawer toggle (mobile) */
.sidebar-toggle { background: none; border: 0; color: var(--cl-muted); font-size: 20px; padding: 0; }

/* ---- Cards -------------------------------------------------------------- */
.cl-card { background: var(--cl-surface); border: 1px solid var(--cl-line);
  border-radius: var(--cl-radius-lg); box-shadow: var(--cl-shadow-sm); }
.cl-card-pad { padding: 1.25rem; }
.cl-card-head {
  padding: .9rem 1.25rem; border-bottom: 1px solid var(--cl-line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
}
.cl-card-head h2, .cl-card-head h3 {
  font-size: 15px; font-weight: 600; letter-spacing: -.005em; color: var(--cl-ink); margin: 0;
  display: flex; align-items: center; gap: .5rem;
}

/* ---- Stat cards (label · icon chip · big number · mini progress bar) ----- */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (min-width: 992px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: var(--cl-surface); border: 1px solid var(--cl-line);
  border-radius: var(--cl-radius-lg); padding: 1.15rem 1.25rem 1.2rem; box-shadow: var(--cl-shadow-sm); }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.stat-card .stat-label { font-size: 13px; font-weight: 500; color: var(--cl-muted); line-height: 1.3; }
.stat-card .stat-icon { height: 40px; width: 40px; border-radius: 10px;
  background: var(--cl-primary-soft); color: var(--cl-primary); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--cl-ink);
  line-height: 1; margin-top: .7rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mini-track { height: 5px; background: var(--cl-zinc-100); border-radius: 10px; margin-top: 1rem; overflow: hidden; }
.mini-fill { height: 100%; background: var(--cl-primary); border-radius: 10px; }

/* ---- Dashboard greeting hero ------------------------------------------- */
.dash-hero { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1.5rem 1.7rem; margin-bottom: 1.5rem; border-radius: 16px; color: #fff;
  background: linear-gradient(150deg, #2b160b 0%, color-mix(in srgb, var(--cl-primary) 55%, #1a0802) 100%);
  background: radial-gradient(620px 320px at 92% -50%, var(--cl-primary) 0%, transparent 60%),
    linear-gradient(150deg, var(--cl-sidebar-bg) 0%, color-mix(in srgb, var(--cl-primary) 42%, #0c0b1a) 100%); }
.dash-hero h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 3px 0; color: #fff; }
.dash-hero-eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: color-mix(in srgb, var(--cl-primary) 45%, #fff); margin: 0; }
.dash-hero-sub { font-size: 14px; color: #c7c8e8; margin: 0; }
.btn-cl-light { background: #fff; color: var(--cl-primary); border: 1px solid #fff; }
.btn-cl-light:hover { background: #fff7ed; color: var(--cl-primary); }
.mini-fill.is-stub { width: 18px; }
.w-fill-0 { width: 0; } .w-fill-10 { width: 10%; } .w-fill-20 { width: 20%; }
.w-fill-30 { width: 30%; } .w-fill-40 { width: 40%; } .w-fill-50 { width: 50%; }
.w-fill-60 { width: 60%; } .w-fill-70 { width: 70%; } .w-fill-80 { width: 80%; }
.w-fill-90 { width: 90%; } .w-fill-100 { width: 100%; }

/* ---- Page header -------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em;
  color: var(--cl-ink); margin: 0; }
.page-head .page-sub { font-size: 14px; color: var(--cl-muted); margin-top: .25rem; }

/* ---- Buttons ------------------------------------------------------------ */
.btn-cl { display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 36px; font-family: var(--cl-font); font-size: 13.5px; font-weight: 600; letter-spacing: 0;
  line-height: 1.2; border-radius: var(--cl-radius); padding: .5rem .95rem; border: 1px solid transparent;
  white-space: nowrap; cursor: pointer; transition: background-color .12s, color .12s, border-color .12s, box-shadow .12s; }
.btn-cl .bi { font-size: 15px; }
.btn-cl:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--bs-focus-ring-color); }
.btn-cl-primary { background: var(--cl-primary); color: #fff; box-shadow: var(--cl-shadow-sm); }
.btn-cl-primary:hover { background: var(--cl-primary-hover); color: #fff; }
.btn-cl-outline { background: var(--cl-surface); color: var(--cl-ink-soft); border-color: var(--cl-line);
  box-shadow: var(--cl-shadow-sm); }
.btn-cl-outline:hover { background: var(--cl-zinc-50); color: var(--cl-ink); }
.btn-cl-ghost { background: transparent; color: var(--cl-muted); }
.btn-cl-ghost:hover { background: var(--cl-zinc-100); color: var(--cl-ink); }
.btn-cl-danger { background: transparent; color: var(--cl-rose); border-color: var(--cl-rose-line); }
.btn-cl-danger:hover { background: var(--cl-rose-soft); }
.btn-cl-sm { min-height: 30px; padding: .35rem .7rem; font-size: 12.5px; }
.btn-cl-sm .bi { font-size: 13.5px; }

/* ---- Forms -------------------------------------------------------------- */
.form-label-cl { display: block; font-size: 13px; font-weight: 500; color: var(--cl-ink-soft); margin-bottom: .35rem; }
.form-control-cl, .form-select-cl {
  width: 100%; min-height: 38px; padding: .5rem .75rem; background: var(--cl-surface);
  border: 1px solid var(--cl-line); border-radius: var(--cl-radius); font-family: var(--cl-font); font-size: 14px;
  box-shadow: var(--cl-shadow-sm);
  color: var(--cl-ink); transition: border-color .12s, box-shadow .12s; }
.form-control-cl::placeholder { color: var(--cl-faint); }
.form-control-cl:focus, .form-select-cl:focus {
  outline: none; border-color: var(--cl-primary);
  box-shadow: 0 0 0 3px var(--bs-focus-ring-color); background: var(--cl-surface); }
.form-control-cl.is-error, .form-select-cl.is-error { border-color: #fda4af; }
textarea.form-control-cl { resize: vertical; min-height: 90px; }
/* Larger input for kiosk touch screens. */
.form-control-lg-cl { height: 52px; font-size: 1.05rem; padding: 0 14px; }
.field-error { color: var(--cl-rose); font-size: 12.5px; margin-top: .3rem; }
.form-hint { color: var(--cl-muted); font-size: 12.5px; margin-top: .3rem; }

/* Custom select — hide the native arrow, draw our own chevron. */
.form-select-cl {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  cursor: pointer; padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 14px; }
.form-select-cl::-ms-expand { display: none; }

/* Custom file / image picker — the native input is hidden inside the label. */
.file-drop { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem;
  border: 1px dashed var(--cl-line); border-radius: var(--cl-radius); background: var(--cl-surface);
  cursor: pointer; transition: border-color .12s, background-color .12s; margin: 0; }
.file-drop:hover { border-color: var(--cl-faint); background: var(--cl-surface); }
.file-drop input[type=file] { position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.file-drop .file-icon { height: 36px; width: 36px; border-radius: 10px; background: var(--cl-surface);
  border: 1px solid var(--cl-line); display: inline-flex; align-items: center; justify-content: center;
  color: var(--cl-muted); font-size: 17px; flex-shrink: 0; }
.file-drop .file-body { min-width: 0; line-height: 1.3; }
.file-drop .file-text { font-size: 13px; color: var(--cl-ink-soft); font-weight: 600;
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-drop .file-sub { font-size: 11.5px; color: var(--cl-faint); }
.file-drop.is-error { border-color: #fda4af; }

/* Searchable select (progressive enhancement over a native <select>). */
.ss { position: relative; display: block; width: 100%; }
.ss-native { position: absolute !important; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.ss-control { display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  width: 100%; min-height: 38px; padding: .5rem .75rem; background: var(--cl-surface); border: 1px solid var(--cl-line);
  border-radius: var(--cl-radius); font-size: 14px; color: var(--cl-ink); cursor: pointer; box-shadow: var(--cl-shadow-sm);
  transition: border-color .12s, box-shadow .12s; }
.ss-control:focus, .ss.open > .ss-control { outline: none; border-color: var(--cl-primary);
  box-shadow: 0 0 0 3px var(--bs-focus-ring-color); background: var(--cl-surface); }
.ss-control .ss-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-control .ss-value.is-placeholder { color: var(--cl-faint); }
.ss-control .ss-caret { color: var(--cl-faint); flex-shrink: 0; font-size: 12px; display: inline-flex; }
.ss.is-error > .ss-control { border-color: #fda4af; }
.ss-panel { position: absolute; z-index: 1090; background: var(--cl-surface); border: 1px solid var(--cl-line);
  border-radius: 10px; box-shadow: 0 8px 26px rgba(9,9,11,.14); overflow: hidden; min-width: 170px; }
.ss-search-wrap { padding: 6px; border-bottom: 1px solid var(--cl-line-soft); }
.ss-search { width: 100%; padding: .4rem .55rem; border: 1px solid var(--cl-line); border-radius: var(--cl-radius);
  font-size: 13px; background: var(--cl-zinc-50); outline: none; }
.ss-search:focus { border-color: var(--cl-faint); background: var(--cl-surface); }
.ss-options { max-height: 240px; overflow-y: auto; padding: 4px; }
.ss-option { padding: .45rem .6rem; border-radius: 6px; font-size: 14px; color: var(--cl-ink-soft);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ss-option:hover, .ss-option.active { background: var(--cl-zinc-100); color: var(--cl-ink); }
.ss-option.selected { font-weight: 600; color: var(--cl-ink); }
.ss-empty { padding: .65rem; text-align: center; color: var(--cl-faint); font-size: 12.5px; }

/* ---- Tables ------------------------------------------------------------- */
.table-cl { width: 100%; border-collapse: collapse; }
.table-cl thead th {
  padding: .7rem 1.1rem; text-align: left; font-size: 12.5px; font-weight: 600;
  color: var(--cl-muted);
  background: var(--cl-zinc-50); border-bottom: 1px solid var(--cl-line); white-space: nowrap; }
.table-cl tbody td { padding: .8rem 1.1rem; font-size: 14px; color: var(--cl-ink-soft);
  border-bottom: 1px solid var(--cl-line-soft); vertical-align: middle; }
.table-cl tbody tr { transition: background-color .1s ease; }
.table-cl tbody tr:last-child td { border-bottom: 0; }
.table-cl tbody tr:hover { background: var(--cl-zinc-50); }
.table-cl td.tabnum, .table-cl th.tabnum { font-variant-numeric: tabular-nums; }
/* Two-line cell: a primary value with a muted sub-line beneath it. */
.cell-main { font-weight: 600; color: var(--cl-ink); }
.cell-sub { display: block; font-size: 12.5px; color: var(--cl-muted); margin-top: 1px; }
.cell-sub.tabnum { font-variant-numeric: tabular-nums; }
/* Tables sit flush inside a card; round the card so header/footer corners follow. */
.cl-card > .table-responsive:first-child .table-cl thead th:first-child { border-top-left-radius: var(--cl-radius-lg); }
.cl-card > .table-responsive:first-child .table-cl thead th:last-child { border-top-right-radius: var(--cl-radius-lg); }

/* ---- Badges ------------------------------------------------------------- */
.badge-cl { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem;
  border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0;
  border: 1px solid transparent; line-height: 1.45; white-space: nowrap; }
.badge-zinc  { background: var(--cl-zinc-100); color: var(--cl-ink-soft); border-color: var(--cl-line); }
.badge-amber { background: var(--cl-amber-soft); color: var(--cl-amber); border-color: var(--cl-amber-line); }
.badge-green { background: var(--cl-green-soft); color: var(--cl-green); border-color: var(--cl-green-line); }
.badge-blue { background: color-mix(in srgb, #2563eb 10%, var(--cl-surface)); color: #2563eb; border-color: color-mix(in srgb, #2563eb 28%, var(--cl-surface)); }
:root[data-theme="dark"] .badge-blue { color: #93b4fb; }
.badge-rose  { background: var(--cl-rose-soft); color: var(--cl-rose); border-color: var(--cl-rose-line); }

/* ---- Flash messages ----------------------------------------------------- */
.flash-stack { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: .6rem; }
.flash { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem;
  border-radius: var(--cl-radius); font-size: 14px; border: 1px solid transparent; }
.flash .bi { font-size: 17px; flex-shrink: 0; }
.flash-success { background: var(--cl-green-soft); color: var(--cl-green); border-color: var(--cl-green-line); }
.flash-danger  { background: var(--cl-rose-soft); color: var(--cl-rose); border-color: var(--cl-rose-line); }
.flash-warning { background: var(--cl-amber-soft); color: var(--cl-amber); border-color: var(--cl-amber-line); }
.flash-info    { background: var(--cl-zinc-50); color: var(--cl-ink-soft); border-color: var(--cl-line); }
.flash .flash-close { margin-left: auto; background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; }
.flash .flash-close:hover { opacity: 1; }

/* ---- Empty state -------------------------------------------------------- */
.empty-state { text-align: center; padding: 3rem 1.25rem; color: var(--cl-muted); font-size: 14px; }
.empty-state .bi { font-size: 22px; color: var(--cl-primary); display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; margin: 0 auto .75rem; border-radius: 12px; background: var(--cl-primary-soft); }

/* ---- Confirm modal ------------------------------------------------------ */
.cl-modal-backdrop { position: fixed; inset: 0; z-index: 1080; display: none;
  align-items: center; justify-content: center; padding: 1rem;
  background: rgba(9,9,11,.35); backdrop-filter: blur(2px); }
.cl-modal-backdrop.show { display: flex; }
.cl-modal { background: var(--cl-surface); border: 1px solid var(--cl-line); border-radius: var(--cl-radius-lg);
  box-shadow: 0 20px 50px rgba(9,9,11,.25); width: 100%; max-width: 420px; overflow: hidden; }
.cl-modal-body { padding: 1.25rem; display: flex; gap: .8rem; align-items: flex-start; }
.cl-modal-body .icon { height: 38px; width: 38px; border-radius: 10px; background: var(--cl-rose-soft);
  color: var(--cl-rose); display: inline-flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0; }
.cl-modal-body h3 { font-size: 16px; font-weight: 600; color: var(--cl-ink); margin: 0; }
.cl-modal-body p { font-size: 14px; color: var(--cl-muted); margin: .25rem 0 0; }
.cl-modal-foot { display: flex; justify-content: flex-end; gap: .5rem;
  padding: .75rem 1.25rem; border-top: 1px solid var(--cl-line-soft); background: var(--cl-zinc-50); }

/* ---- Bootstrap modal — zinc skin (used for create/edit forms) ----------- */
.modal-content {
  border: 1px solid var(--cl-line); border-radius: var(--cl-radius-lg); overflow: hidden;
  box-shadow: 0 20px 50px rgba(9,9,11,.22); background: var(--cl-surface); color: var(--cl-ink-soft);
}
.modal-header { border-bottom: 1px solid var(--cl-line-soft); padding: 1rem 1.25rem; }
.modal-title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; color: var(--cl-ink); }
.modal-body { padding: 1.25rem; }
.modal-footer { border-top: 1px solid var(--cl-line-soft); padding: .85rem 1.25rem;
  background: var(--cl-zinc-50); gap: .5rem; }

/* ---- Form switch (status toggles) --------------------------------------- */
.form-switch-cl { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; }
.form-switch-cl input { position: absolute; opacity: 0; width: 0; height: 0; }
.form-switch-cl .track { width: 38px; height: 21px; background: var(--cl-track); border-radius: 999px;
  position: relative; transition: background-color .15s; flex-shrink: 0; }
.form-switch-cl .track::after { content: ''; position: absolute; top: 2px; left: 2px;
  width: 17px; height: 17px; background: var(--cl-surface); border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.form-switch-cl input:checked + .track { background: var(--cl-primary); }
.form-switch-cl input:checked + .track::after { transform: translateX(17px); }
.form-switch-cl .switch-text { font-size: 14px; color: var(--cl-ink-soft); }

/* ---- List page header (title + search + action) ------------------------- */
.list-head { display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.list-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--cl-ink); margin: 0; }
.list-head .page-sub { font-size: 14px; color: var(--cl-muted); margin: .25rem 0 0; max-width: 760px; }
.list-head-controls { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.list-search { position: relative; }
.list-search .bi { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%);
  color: var(--cl-faint); font-size: 14px; pointer-events: none; }
.list-search input { width: 240px; max-width: 100%; padding-left: 2rem; }

/* ---- Table footer + pagination ------------------------------------------ */
.table-foot { display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 1rem; border-top: 1px solid var(--cl-line-soft); flex-wrap: wrap; }
.foot-summary { font-size: 13px; font-weight: 500; color: var(--cl-muted); margin: 0; }
.pager { display: inline-flex; align-items: center; gap: .15rem; }
.pager-btn { display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 .55rem; border-radius: var(--cl-radius);
  font-size: 13px; font-weight: 500; color: var(--cl-muted); transition: background-color .12s, color .12s; }
.pager-btn:hover { background: var(--cl-zinc-100); color: var(--cl-ink); }
.pager-btn.active { background: var(--cl-primary); color: #fff; font-weight: 600; }
.pager-gap { padding: 0 .35rem; color: var(--cl-faint); }

/* ---- Row action buttons ------------------------------------------------- */
.row-actions { display: inline-flex; gap: .1rem; white-space: nowrap; justify-content: flex-end; }
.icon-btn-cl { display: inline-flex; align-items: center; justify-content: center;
  height: 30px; width: 30px; border: 0; background: transparent; border-radius: 10px;
  color: var(--cl-faint); cursor: pointer; transition: background-color .12s, color .12s; }
.icon-btn-cl:hover { background: var(--cl-zinc-100); color: var(--cl-ink); }
.icon-btn-cl.danger:hover { background: var(--cl-rose-soft); color: var(--cl-rose); }
.col-actions { text-align: right; }

/* ---- Auth pages --------------------------------------------------------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; background: var(--cl-bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand .brand-mark { height: 44px; width: 44px; border-radius: 10px; background: var(--cl-primary);
  color: #fff; font-size: 22px; display: inline-flex; align-items: center; justify-content: center; }
.auth-brand .auth-logo { max-height: 56px; max-width: 220px; object-fit: contain; }
.auth-brand h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--cl-ink); margin: .75rem 0 .15rem; }
.public-logo { max-height: 34px; max-width: 160px; object-fit: contain; }
.auth-brand p { font-size: 14px; color: var(--cl-muted); margin: 0; }

/* Split-screen login: indigo brand panel + form */
.auth-split { min-height: 100vh; display: flex; }
.auth-aside { display: none; flex: 1 1 0; position: relative; color: #fff; padding: 52px 56px;
  flex-direction: column; justify-content: space-between;
  background: linear-gradient(165deg, #2b160b 0%, #170b05 100%);
  background: radial-gradient(720px 420px at 82% -12%, var(--cl-primary) 0%, transparent 60%),
    linear-gradient(165deg, var(--cl-sidebar-bg) 0%, var(--cl-sidebar-bg2) 100%); }
@media (min-width: 900px) { .auth-aside { display: flex; } }
.auth-aside .a-brand { display: flex; align-items: center; gap: 12px; }
.auth-aside .a-mk { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  font-size: 23px; color: #fff; background: linear-gradient(155deg, var(--cl-primary), var(--cl-primary-hover));
  box-shadow: 0 14px 26px -10px rgba(0,0,0,.45); }
.auth-aside .a-logo { max-height: 40px; max-width: 200px; object-fit: contain; }
.auth-aside .a-name { font-size: 22px; font-weight: 800; letter-spacing: -.01em; color: #fff; }
.auth-aside .a-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: color-mix(in srgb, var(--cl-primary) 45%, #fff); margin: 0 0 16px; }
.auth-aside .a-head { font-size: 38px; font-weight: 850; letter-spacing: -.025em; line-height: 1.1; color: #fff; margin: 0 0 30px; }
.auth-aside .a-head span { color: color-mix(in srgb, var(--cl-primary) 45%, #fff); }
.auth-aside .a-feats { list-style: none; display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; }
.auth-aside .a-feats li { display: flex; align-items: center; gap: 13px; font-size: 16px; font-weight: 500; line-height: 1.35; color: #dcddf2; }
.auth-aside .a-feats li i { color: color-mix(in srgb, var(--cl-primary) 45%, #fff); font-size: 19px; flex: 0 0 auto; }
.auth-aside .a-foot { font-size: 13px; color: #f5c9a8; font-weight: 600; }
.auth-main { flex: 1 1 0; display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--cl-bg); }
.auth-main .auth-card { width: 100%; max-width: 400px; }

/* ---- Filter bar --------------------------------------------------------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-bottom: 1.25rem; }
.filter-bar .filter-field { display: flex; flex-direction: column; gap: .3rem; }
.filter-bar .filter-field .form-label-cl { margin-bottom: 0; }
.filter-bar .form-control-cl, .filter-bar .form-select-cl, .filter-bar .ss { min-width: 170px; }
.filter-bar .filter-grow { flex: 1 1 200px; }
.filter-bar .filter-field .ss-control { padding-top: .5rem; padding-bottom: .5rem; }
.filter-bar .filter-actions { display: flex; gap: .5rem; align-items: flex-end; }

/* ---- Form layout (full-page forms) -------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.1rem 1.25rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }
.form-section-title { font-size: 15px; font-weight: 600; letter-spacing: -.005em;
  color: var(--cl-ink); margin: 0 0 .75rem; }

/* ---- Photo upload preview ----------------------------------------------- */
.photo-preview { width: 100%; max-width: 220px; aspect-ratio: 1; border: 1px solid var(--cl-line);
  border-radius: 10px; object-fit: cover; background: var(--cl-zinc-50); }
.photo-drop { border: 1px dashed var(--cl-line); border-radius: 10px; padding: 1rem; background: var(--cl-zinc-50); }

/* ---- Detail view -------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; }
@media (max-width: 800px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-photo { width: 100%; border-radius: 10px; border: 1px solid var(--cl-line); object-fit: cover; }
.detail-photo-empty { width: 100%; aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--cl-line);
  background: var(--cl-zinc-50); display: flex; align-items: center; justify-content: center;
  color: var(--cl-faint); font-size: 34px; }
.field-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.5rem; }
@media (max-width: 600px) { .field-list { grid-template-columns: 1fr; } }
.field-list .span-2 { grid-column: 1 / -1; }
.field-item .field-key { font-size: 13px; font-weight: 500; color: var(--cl-muted); margin-bottom: .15rem; }
.field-item .field-val { font-size: 14px; color: var(--cl-ink-soft); }
.detail-ref { font-size: 12px; font-weight: 600; color: var(--cl-muted); font-variant-numeric: tabular-nums; }

/* ---- Utilities ---------------------------------------------------------- */
.text-muted-cl { color: var(--cl-muted) !important; }
.text-faint-cl { color: var(--cl-faint) !important; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.form-narrow { max-width: 860px; }
.divider-cl { height: 1px; background: var(--cl-line); margin: 1.25rem 0; }
.thumb-sm { height: 40px; width: 40px; border-radius: 10px; object-fit: cover; border: 1px solid var(--cl-line); }
.chart-box { position: relative; height: 280px; }
.tab-nav-cl { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--cl-line); margin-bottom: 1.25rem; }
.tab-nav-cl a { padding: .65rem 0; font-size: 14px; font-weight: 500; color: var(--cl-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab-nav-cl a:hover { color: var(--cl-ink); }
.tab-nav-cl a.active { color: var(--cl-primary); border-bottom-color: var(--cl-primary); font-weight: 600; }

/* ---- Signature pad ------------------------------------------------------ */
.signature-wrap { border: 1px solid var(--cl-line); border-radius: 10px; background: #fff; overflow: hidden; }
.signature-pad { width: 100%; height: 180px; display: block; touch-action: none; cursor: crosshair; background: #fff; }
.signature-bar { display: flex; align-items: center; justify-content: space-between;
  padding: .4rem .6rem; border-top: 1px solid var(--cl-line-soft); background: var(--cl-zinc-50); }
.signature-bar span { font-size: 11.5px; color: var(--cl-faint); }

/* ---- Public pages ------------------------------------------------------- */
.public-body { background: var(--cl-bg); min-height: 100vh; display: flex; flex-direction: column; }
.public-header { background: var(--cl-surface); border-bottom: 1px solid var(--cl-line); }
.public-header .public-bar { max-width: 920px; margin: 0 auto; padding: .9rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.public-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--cl-ink); }
.public-brand .brand-mark { height: 30px; width: 30px; border-radius: 10px; background: var(--cl-primary);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.public-nav { display: flex; gap: .4rem; }
.public-main { flex: 1 1 auto; padding: 2rem 1.25rem; }
.public-wrap { max-width: 720px; margin: 0 auto; }
.public-hero h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; color: var(--cl-ink); margin: 0 0 .4rem; }
.public-hero p { color: var(--cl-muted); margin: 0 0 1.5rem; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.result-box { text-align: center; padding: 2.5rem 1.5rem; }
.result-box .result-icon { height: 56px; width: 56px; border-radius: 10px; background: var(--cl-green-soft);
  color: var(--cl-green); display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; margin-bottom: 1rem; }
.result-ref { display: inline-block; margin-top: .5rem; padding: .5rem 1rem; border-radius: 10px;
  background: var(--cl-zinc-100); font-weight: 700; font-size: 18px; letter-spacing: .04em; color: var(--cl-ink); }

/* ---- Mobile sidebar drawer --------------------------------------------- */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(9,9,11,.3);
  z-index: 1040; display: none; }
@media (max-width: 991.98px) {
  .app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1050;
    transform: translateX(-100%); transition: transform .25s ease; }
  .app-shell.drawer-open .app-sidebar { transform: translateX(0); }
  .app-shell.drawer-open .sidebar-overlay { display: block; }
}
@media (min-width: 992px) {
  .sidebar-toggle { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
}

/* Public demo banner */
.demo-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .55rem 1rem;
  font-size: .85rem;
  text-align: center;
  color: var(--cl-ink);
  background: var(--cl-primary-soft);
  border-bottom: 1px solid color-mix(in srgb, var(--cl-primary) 20%, transparent);
}
.demo-banner i { color: var(--cl-primary); }

/* Demo one-click role logins (login page, demo mode only) */
.demo-logins-title {
  margin: 0 0 .5rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cl-muted);
}
.demo-logins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: .5rem;
}
.demo-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .65rem .5rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--cl-ink);
  background: var(--cl-surface);
  border: 1px solid var(--cl-line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.demo-login i { font-size: 1.15rem; color: var(--cl-primary); }
.demo-login:hover,
.demo-login:focus-visible { border-color: var(--cl-primary); background: var(--cl-primary-soft); outline: none; }

/* ---- Webcam capture (visitor photo) ------------------------------------- */
.webcam { display: flex; flex-direction: column; gap: .5rem; }

/* ---- Visit timeline ----------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.5rem; border-left: 2px solid var(--cl-line); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ''; position: absolute; left: -6px; top: 2px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--cl-primary);
}
.timeline .tl-time { color: var(--cl-muted); font-size: 12px; }

/* ---- Inline checkbox (agreement acceptance) ----------------------------- */
.form-check-cl { display: flex; align-items: flex-start; gap: .5rem; font-size: 14px; cursor: pointer; }
.form-check-cl input[type="checkbox"] { margin-top: .15rem; flex: 0 0 auto; }
.form-check-cl.is-error span { color: var(--cl-rose); }

/* ---- Detail definition lists (record views) ----------------------------- */
.detail-list { display: grid; grid-template-columns: 130px 1fr; gap: .4rem .75rem; margin: 0; }
.detail-list dt { color: var(--cl-muted); font-size: 13px; font-weight: 500; }
.detail-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; color: var(--cl-ink-soft); font-size: 14px; }
@media (max-width: 480px) { .detail-list { grid-template-columns: 1fr; gap: .1rem; } .detail-list dd { margin-bottom: .5rem; } }

/* ---- Dashboard: on-site-by-location list -------------------------------- */
.site-count-list { list-style: none; margin: 0; padding: 0; }
.site-count-list li { display: flex; align-items: center; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--cl-line-soft); font-size: 14px; }
.site-count-list li:last-child { border-bottom: 0; }

.signature-view { max-width: 280px; background: #fff; }

/* ---- Badge scan bar (fast check-in/out) --------------------------------- */
.scan-bar {
  border: 1px solid var(--cl-line);
  border-radius: var(--cl-radius-lg);
  background: var(--cl-surface);
  padding: 16px 18px;
  box-shadow: var(--cl-shadow-sm);
}
.scan-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.scan-title { font-size: 15px; font-weight: 600; color: var(--cl-ink); display: inline-flex; align-items: center; gap: 8px; }
.scan-title .bi { color: var(--cl-primary); }
.scan-note { font-size: 13px; color: var(--cl-muted); }

/* Scan field (icon + input), then the camera and Go buttons. */
.scan-group { display: flex; align-items: stretch; gap: 8px; }
.scan-field { position: relative; flex: 1 1 auto; min-width: 0; }
.scan-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 1.15rem; color: var(--cl-faint); pointer-events: none;
}
.scan-input {
  width: 100%; height: 48px; padding: 0 14px 0 42px;
  font-family: var(--cl-font); font-size: 1rem; letter-spacing: .2px;
  color: var(--cl-ink); background: var(--cl-surface);
  border: 1px solid var(--cl-line); border-radius: var(--cl-radius);
  box-shadow: var(--cl-shadow-sm); outline: none; transition: border-color .12s, box-shadow .12s;
}
.scan-input::placeholder { color: var(--cl-faint); font-size: .95rem; letter-spacing: 0; }
.scan-input:focus { border-color: var(--cl-primary); box-shadow: 0 0 0 3px var(--bs-focus-ring-color); }
.scan-field:focus-within .scan-icon { color: var(--cl-primary); }
.scan-cam, .scan-go { height: 48px; padding: 0 18px; font-size: 14.5px; }
.scan-go .bi { font-size: 1.2rem; }
@media (max-width: 560px) {
  .scan-group { flex-wrap: wrap; }
  .scan-field { flex-basis: 100%; }
  .scan-cam, .scan-go { flex: 1 1 0; }
  .scan-cam .d-none { display: inline !important; }
}

/* ---- Webcam face guide + 3-2-1 countdown -------------------------------- */
/* The stage must hug the video (not stretch to the column) so the overlays
   center over the picture. align-self stops the flex parent from stretching it. */
.webcam-stage { position: relative; align-self: flex-start; width: 100%; max-width: 320px; line-height: 0; overflow: hidden; border-radius: 10px; }
.webcam-guide { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 52%; height: 78%; border: 2px dashed rgba(255,255,255,.9); border-radius: 50%;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.18); pointer-events: none; }
.webcam-count { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 4rem; font-weight: 800; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.6); pointer-events: none; }

/* ---- Button loading state (double-submit guard) ------------------------- */
.btn-cl.is-loading { opacity: .6; pointer-events: none; }

/* ---- Privacy / consent note (public + kiosk forms) --------------------- */
.privacy-note { color: var(--cl-faint); font-size: 12px; margin-top: .75rem; text-align: center; }

/* ---- Kiosk background image (optional { position: relative; background-size: cover; background-position: center; }

/* ===========================================================================
   Printable HTML visitor badge (views/badge/card.php) — full-colour { background: #e9eaee; min-height: 100vh; padding: 28px 16px; }
/* Centred as a block { align-self: center; text-align: left; display: inline-block; margin-top: 18px; }
/* Big, scan-friendly barcode (taller bars { width: 84px; height: 84px; margin: 10px auto 2px; display: block; flex: 0 0 auto; }

/* ---- Badge accent colour input ------------------------------------------ */
.form-color-cl { width: 46px; height: 38px; padding: 2px; border: 1px solid var(--cl-line);
  border-radius: 10px; background: var(--cl-surface); cursor: pointer; vertical-align: middle; }

/* Preset colour swatches (theme picker quick-select). */
.color-presets { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.color-presets button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--cl-line); cursor: pointer; padding: 0; transition: transform .08s; }
.color-presets button:hover { transform: scale(1.12); }
.color-presets .tc0 { background: #c2410c; }
.color-presets .tc1 { background: #09090b; }
.color-presets .tc2 { background: #ea580c; }
.color-presets .tc3 { background: #4f46e5; }
.color-presets .tc4 { background: #7c3aed; }
.color-presets .tc5 { background: #0d9488; }
.color-presets .tc6 { background: #059669; }
.color-presets .tc7 { background: #e11d48; }

/* ---- Print: one full-bleed card per page, exactly like the PDF ---------- */
@media print {
  html, body { background: #fff !important; padding: 0 !important; margin: 0 !important; min-height: 0 !important; }
  @page { size: 3.4375in 5.7292in; margin: 0; }
}

/* ---- Theme toggle (topbar) ------------------------------------------------ */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border: 1px solid var(--cl-line); border-radius: 10px; background: var(--cl-surface); color: var(--cl-muted); cursor: pointer; }
.theme-toggle:hover { color: var(--cl-ink); border-color: var(--cl-faint); }
.theme-toggle .bi-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .bi-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .bi-moon-stars { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .bi-sun { display: inline; }
  :root:not([data-theme="light"]) .theme-toggle .bi-moon-stars { display: none; }
}

/* ---- Two-factor authentication ------------------------------------------- */
.otp-input { font-size: 1.4rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.qr-box { display: inline-block; padding: 10px; background: #fff; border: 1px solid var(--cl-line); border-radius: 12px; line-height: 0; }
.qr-box img, .qr-box svg { width: 180px; height: 180px; }
.secret-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; letter-spacing: .06em;
  padding: .4rem .6rem; background: var(--cl-zinc-100); border-radius: 8px; word-break: break-all; }

/* Long visitor names: smaller type { font-size: 20px; line-height: 1.1; }

/* ---- Camera QR scanner overlay --------------------------------------------- */
.qr-scan-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(9, 9, 11, .88);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; }
.qr-scan-box { position: relative; width: min(420px, 92vw); aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: #000; }
.qr-scan-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.qr-scan-frame { position: absolute; inset: 14%; border: 3px solid rgba(255, 255, 255, .92); border-radius: 16px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .28); pointer-events: none; }
.qr-scan-msg { color: #fff; font-size: 15px; margin: 0; text-align: center; }
.scan-cam { flex: 0 0 auto; }
.result-box .result-icon.result-icon-rose { background: var(--cl-rose-soft); color: var(--cl-rose); }
.result-box .result-icon.result-icon-muted { background: var(--cl-zinc-100); color: var(--cl-muted); }
.cf-field[hidden] { display: none !important; }

/* ---- CSV import -------------------------------------------------------------- */
.import-choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.import-choice { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .8rem; border: 1px solid var(--cl-line);
  border-radius: 10px; cursor: pointer; font-size: 13.5px; background: var(--cl-surface); }
.import-choice:has(input:checked) { border-color: var(--cl-primary); background: var(--cl-primary-soft); }
.import-summary { display: flex; flex-wrap: wrap; gap: .4rem; }
.import-issues { margin: .75rem 0 0; padding-left: 1.1rem; font-size: 13px; color: var(--cl-ink-soft); }

.ms-switch-indent { margin-top: -.25rem; }
.form-grid.gap-sm { gap: .75rem; }

.file-drop-sm { min-height: 38px; padding: .3rem .55rem; }
.file-drop-sm .file-icon { width: 28px; height: 28px; font-size: 14px; border-radius: 6px; }
.form-control-cl:disabled, .form-select-cl:disabled { background: var(--cl-zinc-100); color: var(--cl-muted); cursor: not-allowed; box-shadow: none; }
.form-switch-cl input:disabled + .track { opacity: .5; }

/* ---- Insights ------------------------------------------------------------------ */
.seg-control { display: inline-flex; padding: 3px; border: 1px solid var(--cl-line); border-radius: var(--cl-radius); background: var(--cl-surface); box-shadow: var(--cl-shadow-sm); }
.seg-control a { padding: .35rem .75rem; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--cl-muted); white-space: nowrap; }
.seg-control a:hover { color: var(--cl-ink); }
.seg-control a.active { background: var(--cl-primary-soft); color: var(--cl-primary); font-weight: 600; }
.chart-box-sm { height: 260px; }
.rank-row { display: grid; grid-template-columns: 22px minmax(0, 1.2fr) 1fr 40px; align-items: center; gap: 12px; padding: .7rem 1.25rem; border-bottom: 1px solid var(--cl-line-soft); }
.rank-row:last-child { border-bottom: 0; }
.rank-n { color: var(--cl-faint); font-size: 12.5px; font-weight: 600; }
.rank-name { font-weight: 500; color: var(--cl-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-bar { height: 6px; border-radius: 6px; background: var(--cl-zinc-100); overflow: hidden; }
.rank-bar i { display: block; height: 100%; background: var(--cl-primary); border-radius: 6px; }
.rank-c { text-align: right; font-weight: 600; color: var(--cl-ink-soft); }

/* ---- Solid red button (destructive confirmations) ---------------------------- */
.btn-cl-solid-danger { background: #dc2626; color: #fff; box-shadow: var(--cl-shadow-sm); }
.btn-cl-solid-danger:hover { background: #b91c1c; color: #fff; }
.cl-modal-backdrop.is-neutral .cl-modal-body .icon { background: var(--cl-primary-soft); color: var(--cl-primary); }
.cl-modal-body .cl-modal-note { font-size: 12.5px; color: var(--cl-rose); margin-top: .4rem; }

/* ---- Collapsible sidebar groups ---------------------------------------------- */
.nav-group-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; background: none; border: 0;
  cursor: pointer; text-align: left; padding: 0 .65rem; }
.nav-group-toggle .bi { font-size: 11px; transition: transform .15s; }
.nav-group-toggle:hover { color: rgba(255,255,255,.75); }
.nav-group.is-collapsed .nav-group-items { display: none; }
.nav-group.is-collapsed .nav-group-toggle .bi { transform: rotate(-90deg); }
.tab-nav-cl a .bi { margin-right: 4px; }

/* ---- Checkboxes and radios (consistent on every browser and in dark mode) -------- */
.app-shell input[type=checkbox]:where(:not(.form-switch-cl input)),
.public-body input[type=checkbox], .auth-split input[type=checkbox],
.app-shell input[type=radio], .public-body input[type=radio] {
  appearance: none; -webkit-appearance: none; flex: 0 0 auto;
  width: 18px; height: 18px; margin: 0; vertical-align: -3px; cursor: pointer;
  border: 1.5px solid var(--cl-faint); background: var(--cl-surface);
  display: inline-grid; place-content: center; transition: background-color .12s, border-color .12s, box-shadow .12s;
}
.app-shell input[type=checkbox]:where(:not(.form-switch-cl input)), .public-body input[type=checkbox], .auth-split input[type=checkbox] { border-radius: 5px; }
.app-shell input[type=radio], .public-body input[type=radio] { border-radius: 50%; }
/* :is(…) keeps these above the per-layout base rules above (same specificity + one). */
input[type=checkbox]:checked,
:is(.app-shell, .public-body, .auth-split) input[type=checkbox]:checked { background: var(--cl-primary); border-color: var(--cl-primary); }
input[type=checkbox]:checked::after {
  content: ""; width: 10px; height: 10px; background: #fff;
  clip-path: polygon(14% 44%, 0 59%, 40% 100%, 100% 22%, 85% 8%, 39% 69%);
}
input[type=radio]:checked, :is(.app-shell, .public-body) input[type=radio]:checked { border-color: var(--cl-primary); }
input[type=radio]:checked::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cl-primary); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--bs-focus-ring-color); }
.form-switch-cl input[type=checkbox] { position: absolute; opacity: 0; width: 0; height: 0; }
.form-check-cl { display: inline-flex; align-items: flex-start; gap: .55rem; cursor: pointer; font-size: 14px; color: var(--cl-ink-soft); }
.form-check-cl input { margin-top: 2px; }
.import-choice input[type=radio] { width: 16px; height: 16px; }

/* Native date/time pickers follow dark mode. */
:root[data-theme="dark"] input[type=date]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type=datetime-local]::-webkit-calendar-picker-indicator,
:root[data-theme="dark"] input[type=time]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.75); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) input[type=date]::-webkit-calendar-picker-indicator,
  :root:not([data-theme="light"]) input[type=datetime-local]::-webkit-calendar-picker-indicator,
  :root:not([data-theme="light"]) input[type=time]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.75); }
}
.table-cl .nowrap { white-space: nowrap; }

.stat-hint { margin-top: .55rem; font-size: 12.5px; color: var(--cl-muted); font-weight: 500; }
.stat-hint.is-up { color: var(--cl-green); }
.stat-hint.is-down { color: var(--cl-muted); }
.stat-hint.is-warn { color: var(--cl-amber); }
.stat-card .stat-value { margin-top: .55rem; }

/* ---- Dashboard "today" lists -------------------------------------------------- */
.today-list { list-style: none; margin: 0; padding: 0; }
.today-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--cl-line-soft); }
.today-list li:last-child { border-bottom: 0; }
.today-main { display: flex; flex-direction: column; min-width: 0; color: inherit; }
.today-main:hover .cell-main { color: var(--cl-primary); }
.today-main .cell-main { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-main .cell-main .badge-cl { margin-left: 4px; font-size: 11px; }
.today-time { flex: 0 0 auto; font-size: 13px; color: var(--cl-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.today-time.is-late { color: var(--cl-amber); font-weight: 600; }
.empty-state.empty-sm { padding: 2rem 1rem; }
.text-primary-cl { color: var(--cl-primary); }
.text-amber { color: var(--cl-amber); }

/* ---- Detail pages ------------------------------------------------------------- */
.head-avatar { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; }
.detail-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; margin: 0; }
.detail-grid-2 dt, .detail-label { font-size: 12.5px; font-weight: 500; color: var(--cl-muted); margin: 0 0 .15rem; }
.detail-grid-2 dd { margin: 0; font-size: 14px; color: var(--cl-ink); overflow-wrap: anywhere; }
@media (max-width: 560px) { .detail-grid-2 { grid-template-columns: 1fr; } }
.timeline-v2 { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline-v2 li { display: flex; gap: .75rem; position: relative; padding-bottom: 1rem; }
.timeline-v2 li:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--cl-line); }
.tl-dot { width: 28px; height: 28px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; font-size: 13px;
  background: var(--cl-primary-soft); color: var(--cl-primary); }
.timeline-v2 li.is-muted .tl-dot { background: var(--cl-zinc-100); color: var(--cl-muted); }
.timeline-v2 li.is-warn .tl-dot { background: var(--cl-amber-soft); color: var(--cl-amber); }
.tl-text { font-size: 14px; font-weight: 500; color: var(--cl-ink); }
.tl-meta { font-size: 12.5px; color: var(--cl-muted); }
.signature-view { max-width: 280px; background: #fff; border: 1px solid var(--cl-line); border-radius: 10px; }

/* ---- Toasts --------------------------------------------------------------------- */
.toast-stack { position: fixed; top: 16px; right: 16px; z-index: 1100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast-cl { background: var(--cl-surface); color: var(--cl-ink); border: 1px solid var(--cl-line); box-shadow: 0 12px 32px -12px rgba(9, 9, 11, .3);
  animation: toast-in .22s ease-out; transition: opacity .25s, transform .25s; }
.toast-cl.flash-success .bi:first-child { color: var(--cl-green); }
.toast-cl.flash-info .bi:first-child { color: var(--cl-primary); }
.toast-cl.is-leaving { opacity: 0; transform: translateY(-6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast-cl { animation: none; } }

.copy-field { display: flex; gap: 8px; }
.copy-field .form-control-cl { min-width: 0; }
.btn-cl.is-copied { color: var(--cl-green); border-color: var(--cl-green-line); }
.secret-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* ---- Sortable headers + clickable rows ------------------------------------------ */
.table-cl th.sortable a { color: inherit; display: inline-flex; align-items: center; gap: .3rem; }
.table-cl th.sortable a:hover, .table-cl th.is-sorted a { color: var(--cl-ink); }
.table-cl th.sortable .bi { font-size: 11px; opacity: .45; }
.table-cl th.is-sorted .bi { opacity: 1; color: var(--cl-primary); }
.table-cl tr[data-href] { cursor: pointer; }

/* ---- Notification bell ------------------------------------------------------------ */
.bell-btn { position: relative; }
.bell-count { position: absolute; top: -5px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #dc2626; color: #fff; font-size: 10.5px; font-weight: 700; display: inline-grid; place-items: center; border: 2px solid var(--cl-surface); }
.bell-panel { width: 360px; max-width: calc(100vw - 24px); padding: 0; border: 1px solid var(--cl-line); border-radius: var(--cl-radius-lg);
  box-shadow: 0 18px 44px -14px rgba(9, 9, 11, .3); background: var(--cl-surface); overflow: hidden; }
.bell-head { padding: .8rem 1rem; font-weight: 600; font-size: 15px; color: var(--cl-ink); border-bottom: 1px solid var(--cl-line-soft); display: flex; align-items: center; gap: .5rem; }
.bell-list { max-height: 420px; overflow-y: auto; }
.bell-item { display: flex; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid var(--cl-line-soft); color: inherit; }
.bell-item:last-child { border-bottom: 0; }
.bell-item:hover { background: var(--cl-zinc-50); color: inherit; }
.bell-item.is-new { background: var(--cl-primary-soft); }
.bell-item.is-new .bell-title::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: .4rem; border-radius: 50%; background: var(--cl-primary); vertical-align: middle; }
.bell-icon { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; display: grid; place-items: center; font-size: 15px; }
.bell-icon.is-amber { background: var(--cl-amber-soft); color: var(--cl-amber); }
.bell-icon.is-green { background: var(--cl-green-soft); color: var(--cl-green); }
.bell-icon.is-primary { background: var(--cl-primary-soft); color: var(--cl-primary); }
.bell-icon.is-rose { background: var(--cl-rose-soft); color: var(--cl-rose); }
.bell-icon.is-muted { background: var(--cl-zinc-100); color: var(--cl-muted); }
.bell-title { display: block; font-size: 13.5px; font-weight: 600; color: var(--cl-ink); }
.bell-time { font-weight: 400; color: var(--cl-faint); font-size: 12px; margin-left: 4px; }
.bell-text { display: block; font-size: 13px; color: var(--cl-muted); line-height: 1.4; }
.bell-empty { padding: 2rem 1rem; text-align: center; color: var(--cl-muted); display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.bell-empty .bi { font-size: 26px; color: var(--cl-green); }

/* ---- Row action menu ("⋯") ----------------------------------------------------------- */
.row-menu { position: relative; display: inline-block; }
.row-menu-toggle { width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--cl-muted);
  display: inline-grid; place-items: center; font-size: 17px; cursor: pointer; }
.row-menu-toggle:hover, .row-menu.open .row-menu-toggle { background: var(--cl-zinc-100); color: var(--cl-ink); border-color: var(--cl-line); }
.row-menu-panel { display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 190px; padding: 4px;
  background: var(--cl-surface); border: 1px solid var(--cl-line); border-radius: 10px; box-shadow: 0 14px 32px -12px rgba(9, 9, 11, .28); }
.row-menu.drop-up .row-menu-panel { top: auto; bottom: calc(100% + 4px); }
.row-menu.open .row-menu-panel { display: block; }
.row-menu-panel form { margin: 0; }
.row-menu-item { display: flex !important; align-items: center; gap: .55rem; width: 100%; height: auto !important; padding: .5rem .65rem !important;
  border: 0 !important; border-radius: 6px; background: transparent !important; color: var(--cl-ink-soft) !important; font-size: 13.5px; text-align: left; cursor: pointer; }
.row-menu-item:hover { background: var(--cl-zinc-100) !important; color: var(--cl-ink) !important; }
.row-menu-item .bi { font-size: 15px; width: 16px; }
.row-menu-item.is-danger { color: #dc2626 !important; }
.row-menu-item.is-danger:hover { background: var(--cl-rose-soft) !important; }
.table-cl td:has(.row-menu) { width: 1%; text-align: right; }

/* ---- Mobile card tables ----------------------------------------------------------------- */
@media (max-width: 640px) {
  .table-cl.table-cards thead { display: none; }
  .table-cl.table-cards, .table-cl.table-cards tbody, .table-cl.table-cards tr, .table-cl.table-cards td { display: block; width: 100%; }
  .table-cl.table-cards tbody tr { padding: .75rem 1rem; border-bottom: 1px solid var(--cl-line); }
  .table-cl.table-cards tbody tr:last-child { border-bottom: 0; }
  .table-cl.table-cards tbody td { border: 0; padding: .2rem 0; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .table-cl.table-cards tbody td::before { content: attr(data-label); color: var(--cl-muted); font-size: 12.5px; text-align: left; flex: 0 0 auto; }
  .table-cl.table-cards tbody td:first-child { display: block; text-align: left; padding-bottom: .35rem; }
  .table-cl.table-cards tbody td:first-child::before { content: none; }
  .table-cl.table-cards tbody td:not([data-label])::before, .table-cl.table-cards tbody td[data-label=""]::before { content: none; }
  .table-cl.table-cards td:has(.row-menu) { width: 100%; justify-content: flex-end; }
  .table-responsive { overflow-x: visible; }
  .table-cl.table-cards .cell-stack { text-align: right; min-width: 0; }
}
.row-menu-item { justify-content: flex-start !important; text-transform: none; letter-spacing: 0; min-height: 0; }
@media (max-width: 640px) { .table-cl.table-cards td:has(.row-menu)::before { content: none; } }

/* ---- Full-height app layout --------------------------------------------------------
   The body is a column: the optional demo banner takes its own height and the app
   shell fills exactly the rest, so the sidebar footer (signed-in user) is always
   visible and only the content area scrolls. dvh = visible height on mobile. */
.app-body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.app-body > .demo-banner { flex: 0 0 auto; }
.app-body > .app-shell { flex: 1 1 auto; min-height: 0; height: auto; }
.app-body .app-sidebar, .app-body .app-main { height: auto; align-self: stretch; min-height: 0; }
.app-body .sidebar-nav { min-height: 0; }
@media (max-width: 991.98px) {
  .app-body .app-sidebar { height: auto; }
}

/* ---- System: health, tasks, error log ---------------------------------------------------- */
.min-w-0 { min-width: 0; }
.health-icon { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 22px; flex: 0 0 auto; }
.health-icon.is-green { background: var(--cl-green-soft, #ecfdf5); color: var(--cl-green); }
.health-icon.is-amber { background: var(--cl-amber-soft); color: var(--cl-amber); }
.health-icon.is-rose { background: var(--cl-rose-soft); color: var(--cl-rose); }
.health-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
@media (max-width: 991px) { .health-grid { grid-template-columns: 1fr; } }
.health-list { list-style: none; margin: 0; padding: 0; }
.health-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .7rem 1.25rem; border-top: 1px solid var(--cl-line-soft); }
.health-list li:first-child { border-top: 0; }
.health-label { font-size: 13.5px; color: var(--cl-ink); font-weight: 500; overflow-wrap: anywhere; }
.health-value { font-size: 12.5px; color: var(--cl-muted); overflow-wrap: anywhere; }
.health-list .badge-cl { flex: 0 0 auto; }
.log-view { margin: 0; max-height: 560px; overflow: auto; padding: 1rem 1.25rem; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--cl-ink-soft); background: var(--cl-zinc-50); border-top: 1px solid var(--cl-line-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.log-view span { display: block; }
.log-view .is-error { color: var(--cl-rose); }
.log-view .is-warn { color: var(--cl-amber); }
.maint-page { max-width: 460px; margin: 4rem auto; text-align: center; padding: 0 1rem; }
.maint-icon { width: 56px; height: 56px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; font-size: 26px; background: var(--cl-primary-soft); color: var(--cl-primary); margin-bottom: 1.25rem; }
.maint-page h1 { font-size: 1.5rem; font-weight: 600; color: var(--cl-ink); margin-bottom: .5rem; }
.maint-page p { color: var(--cl-muted); margin-bottom: 1.5rem; }
.tab-nav-cl { overflow-x: auto; scrollbar-width: none; }
.tab-nav-cl::-webkit-scrollbar { display: none; }
.tab-nav-cl a { white-space: nowrap; flex: 0 0 auto; }
.mail-preview { display: block; width: 100%; height: 70vh; border: 0; background: #fff; }
.text-rose-cl { color: var(--cl-rose) !important; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Kiosk / phone check-in language buttons */
.kiosk-lang { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--cl-line); border-radius: 999px; background: var(--cl-surface); box-shadow: var(--cl-shadow-sm); margin-left: auto; margin-right: 1.25rem; }
.kiosk-lang a { padding: .4rem .9rem; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--cl-muted); text-decoration: none; min-height: 36px; display: inline-flex; align-items: center; }
.kiosk-lang a.active { background: var(--cl-primary); color: #fff; }
@media (max-width: 640px) { .kiosk-lang { margin-right: .5rem; } .kiosk-lang a { padding: .35rem .65rem; font-size: 13px; } }

.result-icon.is-muted { background: var(--cl-zinc-100); color: var(--cl-muted); }
.kiosk-lang-sm { margin-right: .75rem; box-shadow: none; }
.kiosk-lang-sm a { min-height: 28px; padding: .2rem .6rem; font-size: 12.5px; font-weight: 600; }

/* ---- Evacuation: live banner, roll-call { display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border: 1px solid var(--cl-rose-line, #fecdd3); background: var(--cl-rose-soft); border-radius: var(--cl-radius-lg); color: var(--cl-ink); text-decoration: none; flex-wrap: wrap; }
@keyframes evacPulse { 0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, .5); } 70% { box-shadow: 0 0 0 9px rgba(225, 29, 72, 0); } 100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); } }

.btn-cl:disabled, .btn-cl[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }
@media (max-width: 520px) {
  .public-nav .btn-cl-ghost { display: none; }
  .kiosk-lang-sm { margin-right: .4rem; }
  .kiosk-lang-sm a { padding: .2rem .45rem; }
}
@media (max-width: 350px) { .kiosk-lang-sm { display: none; } }
/* Bootstrap's .text-dark is near-black; follow the theme's ink colour instead. */
.text-dark { color: var(--cl-ink) !important; }

/* ---- Loading feedback: busy buttons, page progress bar, shimmer placeholders ------- */
.btn-cl.is-loading { position: relative; pointer-events: none; opacity: .85; }
.btn-cl.is-loading > .bi { visibility: hidden; }
.btn-cl.is-loading::before { content: ""; position: absolute; left: .85em; top: 50%; width: 1em; height: 1em; margin-top: -.5em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin-cl .7s linear infinite; }
.btn-cl.is-loading:not(:has(> .bi)) { padding-left: 2.3em; }
@keyframes spin-cl { to { transform: rotate(360deg); } }
.nav-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 3000; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .2s; }
.nav-progress::before { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--cl-primary); border-radius: 0 3px 3px 0; animation: navbar-cl 1.1s ease-in-out infinite; }
body.is-navigating .nav-progress { opacity: 1; }
@keyframes navbar-cl { 0% { left: -40%; width: 40%; } 60% { left: 50%; width: 45%; } 100% { left: 100%; width: 20%; } }
.shimmer { position: relative; overflow: hidden; }
.shimmer::after { content: ""; position: absolute; inset: 0; border-radius: var(--cl-radius); pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--cl-zinc-100) 80%, transparent) 50%, transparent 100%), var(--cl-zinc-50);
  background-size: 200% 100%, auto; animation: shimmer-cl 1.3s ease-in-out infinite; }
@keyframes shimmer-cl { 0% { background-position: 150% 0, 0 0; } 100% { background-position: -50% 0, 0 0; } }
.shimmer-line { height: .8em; border-radius: 4px; background: var(--cl-zinc-100); margin: .45em 0; }
@media (prefers-reduced-motion: reduce) { .btn-cl.is-loading::before, .nav-progress::before, .shimmer::after { animation-duration: 3s; } }

/* ---- Desktop: collapsible sidebar (icon rail), remembered in a cookie ------------- */
.sidebar-collapse-btn { display: none; background: none; border: 0; padding: 0; width: 32px; height: 32px; border-radius: 8px; color: var(--cl-muted); font-size: 18px; align-items: center; justify-content: center; }
.sidebar-collapse-btn:hover { background: var(--cl-zinc-100); color: var(--cl-ink); }
@media (min-width: 992px) {
  .sidebar-collapse-btn { display: inline-flex; }
  .app-sidebar { transition: width .2s ease; }
  .app-shell.sidebar-collapsed .app-sidebar { width: 68px; }
  .app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
  .app-shell.sidebar-collapsed .sidebar-brand .brand-text { display: none; }
  .app-shell.sidebar-collapsed .sidebar-brand .brand-logo { max-width: 40px; }
  .app-shell.sidebar-collapsed .sidebar-nav { padding: 1rem .55rem; }
  .app-shell.sidebar-collapsed .nav-group { margin-bottom: .6rem; padding-bottom: .6rem; border-bottom: 1px solid rgba(255,255,255,.07); }
  .app-shell.sidebar-collapsed .nav-group-label { display: none; }
  .app-shell.sidebar-collapsed .nav-group.is-collapsed .nav-group-items { display: block; }
  .app-shell.sidebar-collapsed .nav-link-cl { justify-content: center; padding: 9px 0; position: relative; }
  .app-shell.sidebar-collapsed .nav-link-cl > span { display: none; }
  .app-shell.sidebar-collapsed .nav-link-cl .bi { font-size: 17px; width: auto; }
  .app-shell.sidebar-collapsed .nav-link-cl .nav-badge { position: absolute; top: 3px; right: 5px; min-width: 16px; height: 16px; font-size: 9px; padding: 0 4px; margin: 0; }
  .app-shell.sidebar-collapsed .sidebar-user > div { flex-direction: column; gap: .4rem !important; }
  .app-shell.sidebar-collapsed .sidebar-user .min-w-0 { display: none !important; }
}

/* ---- Person cells (avatar initials + name + sub-line) in tables ------------------- */
.person-cell { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.person-dot { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--cl-primary); background: var(--cl-primary-soft); }
.person-dot.is-muted { color: var(--cl-muted); background: var(--cl-zinc-100); }
.table-cl td.nowrap, .table-cl th.nowrap { white-space: nowrap; }
.table-cl td:has(> a.cell-main:only-child) { white-space: nowrap; }
.person-dot.sm { width: 26px; height: 26px; font-size: 10px; }

/* ---- Stat cards (final): icon tile + label / value / hint, any number per row ------ */
.stats-grid { display: grid; gap: .85rem; margin-bottom: 1.5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); } }
.stat-card { display: flex; align-items: flex-start; gap: .9rem; padding: 1.05rem 1.15rem; min-height: 0; min-width: 0;
  background: var(--cl-surface); border: 1px solid var(--cl-line); border-radius: var(--cl-radius-lg); box-shadow: var(--cl-shadow-sm); }
.stat-card .stat-icon { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 19px; background: var(--cl-primary-soft); color: var(--cl-primary); margin: 0; }
.stat-card.tone-down .stat-icon { background: var(--cl-rose-soft); color: var(--cl-rose); }
.stat-card.tone-warn .stat-icon { background: var(--cl-amber-soft); color: var(--cl-amber); }
.stat-card .stat-body { min-width: 0; flex: 1 1 auto; }
.stat-card .stat-label { font-size: 12.5px; font-weight: 500; color: var(--cl-muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; color: var(--cl-ink); margin: .2rem 0 0; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .stat-hint { margin-top: .3rem; font-size: 12px; font-weight: 500; color: var(--cl-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .stat-hint.is-up { color: var(--cl-green); }
.stat-card .stat-hint.is-down { color: var(--cl-rose); }
.stat-card .stat-hint.is-warn { color: var(--cl-amber); }
.stat-card .stat-card-top, .stat-card .mini-track { display: none; }
@media (max-width: 575.98px) {
  .stat-card { padding: .85rem; gap: .65rem; flex-direction: column; }
  .stat-card .stat-icon { width: 34px; height: 34px; font-size: 16px; border-radius: 9px; }
  .stat-card .stat-value { font-size: 22px; }
}
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); } }
.stat-card { container-type: inline-size; }
.stat-card .stat-label { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.stat-card .stat-value { overflow: visible; text-overflow: clip; }
.stat-card .stat-hint.is-down { color: var(--cl-muted); }
@container (max-width: 205px) {
  .stat-body { padding-top: .1rem; }
}
.stats-grid > .stat-card { flex-direction: row; }
@media (min-width: 768px) {
  .stat-card { container-type: inline-size; }
}
.stats-grid > .stat-card { display: block; container-type: inline-size; }
.stat-inner { display: flex; align-items: flex-start; gap: .9rem; }
@container (max-width: 210px) {
  .stat-inner { flex-direction: column; gap: .6rem; }
  .stat-card .stat-value { font-size: 24px; }
}
@media (max-width: 575.98px) { .stat-inner { flex-direction: column; gap: .55rem; } }
.person-dot.lg { width: 52px; height: 52px; font-size: 18px; }

/* ---- Mobile: filters fold behind a "Filters" button (search stays) -------- */
.filter-toggle { display: none; }
@media (max-width: 767.98px) {
  .js .filter-bar:not(.is-open) > .filter-field:not(.filter-grow) { display: none; }
  .js .filter-bar .filter-toggle { display: inline-flex; }
  .filter-bar .filter-grow { flex-basis: 100%; }
  .filter-bar .filter-field:not(.filter-grow) { flex: 1 1 calc(50% - .4rem); min-width: 0; }
  .filter-bar .form-control-cl, .filter-bar .form-select-cl, .filter-bar .ss { min-width: 0; width: 100%; }
  .filter-bar .filter-actions { flex-basis: 100%; }
  .filter-toggle .filter-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; background: currentColor; }
  .filter-toggle .filter-count span { color: #fff; }
}
@media (max-width: 575.98px) {
  .stats-grid { gap: .6rem; margin-bottom: 1rem; }
  .stat-card { padding: .75rem .85rem; }
  .stat-card .stat-inner { gap: .55rem; }
  .stat-card .stat-icon { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }
  .stat-card .stat-value { font-size: 20px; }
}

/* Bell: per-alert read state + "Mark all as read" */
.bell-head { justify-content: space-between; }
.bell-head > span { display: inline-flex; align-items: center; gap: .5rem; }
.bell-read-all { border: 0; background: transparent; padding: 0; font-size: 12.5px; font-weight: 600; color: var(--cl-primary); }
.bell-read-all:hover { text-decoration: underline; }
.bell-item:not(.is-new) .bell-title { font-weight: 500; color: var(--cl-ink-soft); }
.bell-item { position: relative; padding-right: 2rem !important; }
.bell-item.is-new .bell-title::after { display: none; }
.bell-item.is-new::after { content: ""; position: absolute; right: 14px; top: 1.15rem; width: 8px; height: 8px; border-radius: 50%; background: var(--cl-primary); }
[data-install-app][hidden] { display: none !important; }
.app-icon-preview { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; border: 1px solid var(--cl-line); flex: 0 0 auto; }

/* Dashboard "waiting for approval": stacked card rows on phones */

/* ---- Collecto-only rules carried over from v1.0 -------------------------- */

.upgrade-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: var(--cl-primary-soft); color: var(--cl-primary); font-size: 26px; }

/* Match score reasons ("Same colour · Found the same day") */
.match-reasons { display: block; margin-top: 4px; font-size: 12px; color: var(--cl-muted); line-height: 1.35; max-width: 340px; }

/* Match inbox */
.match-list { display: grid; gap: 12px; }
.match-score { grid-area: score; display: flex; flex-direction: column; align-items: center; justify-content: center; align-self: stretch; border-radius: 10px; background: var(--cl-primary-soft); color: var(--cl-primary); }
.match-score-num { font-size: 22px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.match-score-num small { font-size: 12px; font-weight: 600; margin-left: 1px; }
.match-score-label { font-size: 11px; margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; opacity: .8; }
.match-side { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.match-side:nth-of-type(2) { grid-area: lost; }
.match-side:nth-of-type(3) { grid-area: found; }
.match-kicker { font-size: 11px; color: var(--cl-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.match-why { grid-area: why; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.match-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--cl-zinc-100); color: var(--cl-ink); }
.match-chip i { color: var(--cl-primary); }
.match-actions { grid-area: actions; display: flex; flex-direction: column; gap: 6px; }
.match-actions .btn-cl { width: 100%; justify-content: center; }
@media (max-width: 767.98px) {
  .match-score-num { font-size: 18px; }
  .match-actions { flex-direction: row; }
  .match-actions form { flex: 1; }
}
.match-ai { display: block; margin-top: 4px; font-size: 12px; color: var(--cl-primary); max-width: 340px; line-height: 1.35; }
.is-ai-filled { background: var(--cl-primary-soft) !important; border-color: color-mix(in srgb, var(--cl-primary) 45%, transparent) !important; }

/* Owner page: progress steps, pickup code, pickup/delivery choice */
.owner-steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; margin: 0 0 1rem; counter-reset: s; }
.owner-steps li { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; color: var(--cl-muted); text-align: center; position: relative; }
.owner-steps li::before { content: ""; position: absolute; top: 14px; left: -50%; width: 100%; height: 2px; background: var(--cl-line); z-index: 0; }
.owner-steps li:first-child::before { display: none; }
.owner-steps li.is-done::before, .owner-steps li.is-current::before { background: var(--cl-primary); }
.owner-steps li span { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; background: var(--cl-surface); border: 2px solid var(--cl-line); color: var(--cl-muted); }
.owner-steps li.is-done span { background: var(--cl-primary); border-color: var(--cl-primary); color: #fff; }
.owner-steps li.is-current span { border-color: var(--cl-primary); color: var(--cl-primary); }
.owner-steps li.is-current { color: var(--cl-ink); font-weight: 600; }
.owner-code { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-color: color-mix(in srgb, var(--cl-primary) 40%, var(--cl-line)); background: var(--cl-primary-soft); }
.owner-code-num { font-size: 34px; font-weight: 700; letter-spacing: .14em; font-variant-numeric: tabular-nums; color: var(--cl-ink); }
.owner-code-qr { width: 120px; flex: 0 0 auto; border-radius: 8px; overflow: hidden; }
.owner-code-qr svg { display: block; width: 100%; height: auto; }
@media (max-width: 520px) { .owner-code { flex-direction: column; align-items: flex-start; } }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .choice-grid { grid-template-columns: 1fr; } }
.choice-card { position: relative; cursor: pointer; margin: 0; }
.choice-card input { position: absolute; opacity: 0; }
.choice-card > span { display: flex; flex-direction: column; gap: 3px; padding: 14px; border: 1.5px solid var(--cl-line); border-radius: 10px; height: 100%; transition: border-color .15s, background .15s; }
.choice-card > span i { font-size: 20px; color: var(--cl-primary); margin-bottom: 4px; }
.choice-card small { color: var(--cl-muted); font-size: 12.5px; }
.choice-card input:checked + span { border-color: var(--cl-primary); background: var(--cl-primary-soft); }
.choice-card input:focus-visible + span { outline: 2px solid var(--cl-primary); outline-offset: 2px; }
.owner-check { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.owner-check > span { padding: 10px 12px; border-radius: 8px; background: var(--cl-zinc-50); border: 1px solid var(--cl-line-soft); }
.evidence-thumb { max-width: 160px; max-height: 120px; border-radius: 8px; border: 1px solid var(--cl-line); object-fit: cover; }
.approval-card { border-color: color-mix(in srgb, var(--cl-amber) 45%, var(--cl-line)); background: var(--cl-amber-soft); }
.ship-start > summary { list-style: none; cursor: pointer; }
.ship-start > summary::-webkit-details-marker { display: none; }
.ship-start:not([open]) > summary { border-bottom: 0; }
.owner-ship { border-color: color-mix(in srgb, var(--cl-primary) 30%, var(--cl-line)); }
.owner-pay { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.owner-pay-amount { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--cl-ink); line-height: 1.2; }
.owner-pay-qr { width: 132px; height: 132px; object-fit: contain; border: 1px solid var(--cl-line); border-radius: 8px; background: #fff; padding: 6px; flex: 0 0 auto; }
.pre-line { white-space: pre-line; }
@media (max-width: 520px) { .owner-pay { flex-direction: column; } }
.photo-strip { display: flex; flex-wrap: wrap; gap: 6px; }
.photo-strip-item { position: relative; width: 58px; height: 58px; border-radius: 8px; overflow: hidden; border: 1px solid var(--cl-line); display: block; cursor: pointer; }
.photo-strip-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-strip-item.is-active { outline: 2px solid var(--cl-primary); outline-offset: 1px; }
.photo-strip-item input { position: absolute; top: 4px; right: 4px; width: 16px; height: 16px; accent-color: var(--cl-rose); }
.photo-strip-item:has(input:checked) img { opacity: .35; }
.col-check { width: 34px; }
.col-check input { width: 16px; height: 16px; accent-color: var(--cl-primary); vertical-align: middle; }
.bulk-bar { position: sticky; bottom: 16px; z-index: 20; margin: 12px auto 0; width: fit-content; max-width: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px 8px 16px; border-radius: 12px; background: var(--cl-surface); border: 1px solid var(--cl-line); box-shadow: 0 10px 30px rgba(0,0,0,.14); }
.bulk-bar .disabled { opacity: .45; pointer-events: auto; cursor: not-allowed; }

/* ---- Public navigation and front page (v2.0) ---------------------------- */
.public-header .public-bar { max-width: 1080px; flex-wrap: wrap; }
.public-nav { flex-wrap: wrap; gap: 2px; }
.public-nav-link { padding: 7px 11px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--cl-muted); text-decoration: none; white-space: nowrap; }
.public-nav-link:hover { color: var(--cl-ink); background: var(--cl-zinc-100); }
.public-nav-link.active { color: var(--cl-primary); background: var(--cl-primary-soft); }
@media (max-width: 760px) {
  .public-nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -4px; padding-bottom: 2px; scrollbar-width: none; }
  .public-nav::-webkit-scrollbar { display: none; }
}
.public-wrap-wide { max-width: 1080px; }
.home-hero { position: relative; overflow: hidden; border-radius: 18px; padding: 48px 40px; margin-bottom: 28px;
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--cl-primary) 22%, transparent) 0%, transparent 55%), var(--cl-surface);
  border: 1px solid var(--cl-line); }
.home-hero h1 { font-size: clamp(28px, 4.4vw, 44px); line-height: 1.08; letter-spacing: -.03em; font-weight: 750; color: var(--cl-ink); margin: 0 0 12px; max-width: 640px; }
.home-hero p.lead-cl { font-size: 17px; color: var(--cl-muted); max-width: 560px; margin: 0 0 24px; }
.home-search { display: flex; gap: 8px; max-width: 620px; background: var(--cl-surface); border: 1px solid var(--cl-line); border-radius: 14px; padding: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.06); }
.home-search input { flex: 1 1 auto; border: 0; outline: 0; background: transparent; font-size: 16px; padding: 10px 12px; color: var(--cl-ink); min-width: 0; }
.home-search button { flex: 0 0 auto; }
.home-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 32px; }
.home-action { display: flex; flex-direction: column; gap: 6px; padding: 22px; border-radius: 14px; border: 1px solid var(--cl-line); background: var(--cl-surface); color: var(--cl-ink); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.home-action:hover { border-color: color-mix(in srgb, var(--cl-primary) 45%, var(--cl-line)); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.06); color: var(--cl-ink); }
.home-action .ha-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; background: var(--cl-primary-soft); color: var(--cl-primary); margin-bottom: 6px; }
.home-action strong { font-size: 16px; }
.home-action span { font-size: 13.5px; color: var(--cl-muted); }
.home-action .ha-go { margin-top: auto; padding-top: 8px; font-size: 13px; font-weight: 600; color: var(--cl-primary); }
.home-section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--cl-muted); font-weight: 600; margin: 0 0 12px; }
.home-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 32px; counter-reset: hs; }
.home-step { padding: 18px 20px; border-radius: 14px; background: var(--cl-zinc-50); border: 1px solid var(--cl-line-soft); }
.home-step::before { counter-increment: hs; content: counter(hs); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--cl-ink); color: var(--cl-surface); font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.home-step strong { display: block; margin-bottom: 4px; }
.home-step span { font-size: 13.5px; color: var(--cl-muted); }
.home-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.found-list { list-style: none; padding: 0; margin: 0; }
.found-list li { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--cl-line-soft); }
.found-list li:first-child { border-top: 0; }
.found-list .fl-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--cl-zinc-100); color: var(--cl-muted); display: grid; place-items: center; flex: 0 0 auto; }
.found-list .fl-main { flex: 1 1 auto; min-width: 0; }
.found-list .fl-main strong { display: block; font-weight: 600; color: var(--cl-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.found-list .fl-main small { color: var(--cl-muted); font-size: 12.5px; }
.home-place { padding: 12px 16px; border-top: 1px solid var(--cl-line-soft); }
.home-place:first-of-type { border-top: 0; }
@media (max-width: 860px) { .home-actions, .home-steps { grid-template-columns: 1fr; } .home-grid { grid-template-columns: 1fr; } .home-hero { padding: 32px 22px; } }

/* Storage map */
.age-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--cl-muted); margin-bottom: 8px; }
.age-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.age-dot.is-fresh, .shelf-bar .is-fresh { background: var(--cl-green); }
.age-dot.is-ageing, .shelf-bar .is-ageing { background: var(--cl-amber); }
.age-dot.is-due, .shelf-bar .is-due { background: var(--cl-rose); }
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.shelf { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--cl-line); background: var(--cl-surface); color: var(--cl-ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.shelf:hover { border-color: color-mix(in srgb, var(--cl-primary) 40%, var(--cl-line)); box-shadow: 0 6px 18px rgba(0,0,0,.05); color: var(--cl-ink); }
.shelf.has-due { border-color: color-mix(in srgb, var(--cl-rose) 40%, var(--cl-line)); }
.shelf.is-empty { opacity: .65; }
.shelf-head { font-size: 13px; font-weight: 600; color: var(--cl-muted); }
.shelf-count { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.shelf-count small { font-size: 13px; font-weight: 500; color: var(--cl-muted); }
.shelf-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--cl-zinc-100); gap: 2px; }
.shelf-bar i { display: block; min-width: 0; }
.shelf-meta { font-size: 12.5px; color: var(--cl-muted); }
.shelf.has-due .shelf-meta { color: var(--cl-rose); font-weight: 600; }

/* CSV import */
.import-choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.import-choice { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .8rem; border: 1px solid var(--cl-line);
  border-radius: 10px; cursor: pointer; font-size: 13.5px; background: var(--cl-surface); }
.import-choice:has(input:checked) { border-color: var(--cl-primary); background: var(--cl-primary-soft); }
.import-summary { display: flex; flex-wrap: wrap; gap: .4rem; }
.import-issues { margin: .75rem 0 0; padding-left: 1.1rem; font-size: 13px; color: var(--cl-ink-soft); }

.import-choice input[type=radio] { width: 16px; height: 16px; }

.mini-progress { display: inline-block; vertical-align: middle; width: 64px; height: 6px; border-radius: 99px; background: var(--cl-zinc-100); overflow: hidden; margin-right: .45rem; }
.mini-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--cl-primary); }
/* Six stat cards (Insights): 3 + 3, or one row on wide screens */
@media (min-width: 768px) { .stats-grid:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1440px) { .stats-grid:has(> :nth-child(6):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
/* Period switcher scrolls sideways on phones instead of being cut off */
@media (max-width: 575.98px) { .list-head-controls .seg-control { max-width: 100%; overflow-x: auto; scrollbar-width: none; } .list-head-controls .seg-control::-webkit-scrollbar { display: none; } }

/* =========================================================================
   Detail pages (v2.0): hero, grouped facts, side panel, timeline, print
   ========================================================================= */
.dv-hero { display: grid; grid-template-columns: 300px 1fr; gap: 24px; padding: 20px; margin-bottom: 16px; }
.dv-gallery-main { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--cl-zinc-100); border: 1px solid var(--cl-line-soft); }
.dv-gallery-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dv-gallery-main.is-empty { display: grid; place-items: center; color: var(--cl-faint); font-size: 42px; }
.dv-gallery-main .dv-photo-count { position: absolute; right: 8px; bottom: 8px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: rgba(0,0,0,.6); color: #fff; }
.dv-gallery .photo-strip { margin-top: 8px; }
.dv-gallery .photo-strip-item { width: 52px; height: 52px; }
.dv-head { min-width: 0; display: flex; flex-direction: column; }
.dv-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.dv-title { font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; color: var(--cl-ink); margin: 0 0 4px; word-break: break-word; }
.dv-ref { font-size: 13px; color: var(--cl-muted); font-variant-numeric: tabular-nums; letter-spacing: .02em; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.dv-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 0 0 18px; }
.dv-fact { padding: 10px 12px; border-radius: 10px; background: var(--cl-zinc-50); border: 1px solid var(--cl-line-soft); min-width: 0; }
.dv-fact small { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--cl-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.dv-fact strong { display: block; font-size: 14.5px; font-weight: 600; color: var(--cl-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-head .owner-steps { margin-top: auto; margin-bottom: 0; }
.owner-steps li.is-stop span { background: var(--cl-zinc-100); border-color: var(--cl-line); color: var(--cl-muted); }
.owner-steps li.is-stop { color: var(--cl-muted); }
.dv-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.dv-main { display: grid; gap: 16px; min-width: 0; }
.dv-side { display: grid; gap: 16px; position: sticky; top: 76px; }
.dv-section .cl-card-head h3 { display: flex; align-items: center; gap: 8px; }
.dv-section .cl-card-head h3 i { color: var(--cl-primary); font-size: 15px; }
.dl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; margin: 0; padding: 18px 20px; }
.dl-grid > div { min-width: 0; }
.dl-grid .span-2 { grid-column: 1 / -1; }
.dl-grid dt { font-size: 12px; font-weight: 500; color: var(--cl-muted); margin: 0 0 3px; }
.dl-grid dd { margin: 0; font-size: 14.5px; color: var(--cl-ink); word-break: break-word; line-height: 1.5; }
.dl-grid dd .muted { color: var(--cl-faint); }
.side-actions { display: grid; gap: 8px; padding: 16px; }
.side-actions .btn-cl { width: 100%; justify-content: flex-start; }
.side-actions .btn-cl i { width: 18px; text-align: center; }
.side-actions hr { margin: 4px 0; border-color: var(--cl-line-soft); opacity: 1; }
.side-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 16px 16px; }
.side-tools a, .side-tools button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 10px; border: 1px solid var(--cl-line); background: var(--cl-surface); color: var(--cl-ink); font-size: 12px; font-weight: 500; text-decoration: none; cursor: pointer; }
.side-tools a:hover, .side-tools button:hover { border-color: color-mix(in srgb, var(--cl-primary) 45%, var(--cl-line)); color: var(--cl-primary); }
.side-tools i { font-size: 17px; color: var(--cl-primary); }
.link-card { display: block; padding: 14px 16px; color: var(--cl-ink); text-decoration: none; }
.link-card:hover { background: var(--cl-zinc-50); color: var(--cl-ink); }
.link-card + .link-card { border-top: 1px solid var(--cl-line-soft); }
.link-card .lc-kicker { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--cl-muted); margin-bottom: 4px; }
.link-card .lc-title { font-weight: 600; display: block; }
.link-card .lc-sub { font-size: 13px; color: var(--cl-muted); display: block; margin-top: 2px; }
.side-note { padding: 12px 16px; font-size: 13px; color: var(--cl-muted); border-top: 1px solid var(--cl-line-soft); }
/* Timeline */
.tl { list-style: none; margin: 0; padding: 16px 20px 6px; }
.tl li { position: relative; padding: 0 0 16px 28px; }
.tl li::before { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 2px; background: var(--cl-line-soft); }
.tl li:last-child::before { display: none; }
.tl .tl-dot { position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--cl-surface); border: 2px solid var(--cl-primary); }
.tl li.tone-green .tl-dot { border-color: var(--cl-green); background: var(--cl-green); }
.tl li.tone-rose .tl-dot { border-color: var(--cl-rose); }
.tl li.tone-muted .tl-dot { border-color: var(--cl-line); }
.tl .tl-text { font-size: 14px; color: var(--cl-ink); }
.tl .tl-meta { font-size: 12.5px; color: var(--cl-muted); margin-top: 1px; }
@media (max-width: 1199.98px) { .dv-body { grid-template-columns: 1fr; } .dv-side { position: static; grid-row: 1; } }
@media (max-width: 767.98px) {
  .dv-hero { grid-template-columns: 1fr; padding: 14px; gap: 16px; }
  .dv-title { font-size: 22px; }
  .dl-grid { grid-template-columns: 1fr; padding: 14px 16px; gap: 12px; }
  .dv-side { grid-row: auto; }
}

/* ---- Print: any staff page prints as a clean document ------------------- */
.print-only { display: none; }
@media print {
  @page { margin: 14mm; }
  html, body { background: #fff !important; }
  body { font-size: 12px; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .app-sidebar, .app-header, .app-topbar, .topbar, .sidebar-backdrop, .demo-banner, .flash-stack, .toast-stack, .no-print,
  .page-head .d-flex.gap-2, .side-actions, .side-tools, .bulk-bar, .modal, .cl-modal-backdrop, .breadcrumb, .row-actions, form button { display: none !important; }
  .app-shell, .app-main, .app-content, main { margin: 0 !important; padding: 0 !important; width: auto !important; max-width: none !important; display: block !important; }
  .print-only { display: block; }
  .print-head { display: flex !important; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--cl-primary); padding-bottom: 6px; margin-bottom: 12px; font-size: 12px; }
  .print-head strong { font-size: 15px; }
  .cl-card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  .dv-body { grid-template-columns: 1fr 1fr !important; }
  .dv-side { position: static !important; }
  .dv-hero { grid-template-columns: 180px 1fr !important; padding: 12px !important; }
  .dl-grid { padding: 10px 12px !important; gap: 8px 16px !important; }
  a { color: #000 !important; text-decoration: none !important; }
  .badge-cl { border: 1px solid #999 !important; }
}
.signature-img { max-width: 260px; max-height: 120px; border: 1px solid var(--cl-line); border-radius: 8px; background: #fff; padding: 6px; }
/* Dashboard "to do" tiles */
.todo-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin: -4px 0 20px; }
.todo-tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--cl-line); background: var(--cl-surface); color: var(--cl-ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.todo-tile:hover { border-color: color-mix(in srgb, var(--cl-primary) 45%, var(--cl-line)); box-shadow: 0 6px 16px rgba(0,0,0,.05); color: var(--cl-ink); }
.todo-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; background: var(--cl-primary-soft); color: var(--cl-primary); font-size: 17px; }
.todo-tile.tone-amber .todo-icon { background: var(--cl-amber-soft); color: var(--cl-amber); }
.todo-tile.tone-rose .todo-icon { background: var(--cl-rose-soft); color: var(--cl-rose); }
.todo-text { flex: 1 1 auto; font-size: 13px; color: var(--cl-muted); line-height: 1.25; min-width: 0; }
.todo-text strong { display: block; font-size: 20px; color: var(--cl-ink); font-variant-numeric: tabular-nums; }
.todo-go { color: var(--cl-faint); }
.hover-photo { position: fixed; z-index: 1080; width: 240px; height: 240px; border-radius: 12px; overflow: hidden; background: var(--cl-surface); border: 1px solid var(--cl-line); box-shadow: 0 16px 40px rgba(0,0,0,.18); pointer-events: none; }
.hover-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* =========================================================================
   Dashboard (v2.0)
   ========================================================================= */
.dash-hero { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap;
  padding: 26px 28px; margin-bottom: 18px; border-radius: 16px; color: #fff;
  background: radial-gradient(90% 140% at 100% 0%, color-mix(in srgb, var(--cl-primary) 70%, #fbbf24) 0%, transparent 60%),
              linear-gradient(135deg, var(--cl-sidebar-bg) 0%, color-mix(in srgb, var(--cl-primary) 80%, #000) 100%); }
.dash-hero::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 260px; height: 260px; border-radius: 50%; border: 36px solid rgba(255,255,255,.05); pointer-events: none; }
.dash-hero-text { position: relative; z-index: 1; min-width: 0; }
.dash-date { margin: 0 0 6px; font-size: 13px; color: rgba(255,255,255,.72); }
.dash-hero h1 { margin: 0 0 4px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; color: #fff; }
.dash-sub { margin: 0 0 16px; color: rgba(255,255,255,.82); font-size: 14.5px; }
.dash-quick { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-cl-glass { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.22); }
.btn-cl-glass:hover { background: rgba(255,255,255,.2); color: #fff; }
.dash-hero-stats { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; }
.dash-hero-stats > a, .dash-hero-stats > div { min-width: 128px; padding: 12px 16px; border-radius: 12px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); color: #fff; text-decoration: none; transition: background .15s; }
.dash-hero-stats a:hover { background: rgba(255,255,255,.18); color: #fff; }
.dash-hero-stats strong { display: block; font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dash-hero-stats span { font-size: 12.5px; color: rgba(255,255,255,.75); }
.todo-row { margin: 0 0 18px; }
.todo-tile.tone-green .todo-icon { background: var(--cl-green-soft); color: var(--cl-green); }
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.dash-recent { grid-column: span 8; }
.dash-month { grid-column: span 4; }
.dash-matches { grid-column: span 7; }
.dash-shelves { grid-column: span 5; }
.dash-chart { grid-column: span 7; }
.dash-activity { grid-column: span 5; }
.dash-setup { grid-column: span 7; }
.dash-grid > .dash-activity:only-child { grid-column: span 12; }
@media (max-width: 1199.98px) { .dash-recent, .dash-month, .dash-matches, .dash-shelves, .dash-chart, .dash-activity, .dash-setup { grid-column: span 12; } }
.item-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; padding: 16px; }
.item-tile { display: flex; flex-direction: column; gap: 2px; color: var(--cl-ink); text-decoration: none; min-width: 0; }
.item-tile-img { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--cl-zinc-100); border: 1px solid var(--cl-line-soft); margin-bottom: 6px; display: grid; place-items: center; }
.item-tile-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.item-tile:hover .item-tile-img img { transform: scale(1.04); }
.item-tile-img.is-empty i { font-size: 30px; color: var(--cl-faint); }
.item-tile-badge { position: absolute; left: 6px; top: 6px; font-size: 10.5px; }
.item-tile-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-tile:hover .item-tile-title { color: var(--cl-primary); }
.item-tile-meta { font-size: 12px; color: var(--cl-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-kpis { display: grid; gap: 4px; padding: 10px 16px 16px; }
.dash-kpi { display: flex; align-items: center; gap: 14px; padding: 10px 4px; border-bottom: 1px solid var(--cl-line-soft); }
.dash-kpi:last-child { border-bottom: 0; }
.dash-kpi strong { display: block; font-size: 18px; color: var(--cl-ink); font-variant-numeric: tabular-nums; }
.dash-kpi small { color: var(--cl-muted); font-size: 12.5px; }
.dash-kpi-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--cl-primary-soft); color: var(--cl-primary); font-size: 19px; flex: 0 0 auto; }
.dash-ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: conic-gradient(var(--cl-primary) calc(var(--p) * 1%), var(--cl-zinc-100) 0); }
.dash-ring span { width: 50px; height: 50px; border-radius: 50%; background: var(--cl-surface); display: grid; place-items: center; font-weight: 700; font-size: 14px; color: var(--cl-ink); }
.dash-kpi .dash-ring + div strong { font-size: 15px; }
.pair-list { list-style: none; margin: 0; padding: 0; }
.pair-list li + li { border-top: 1px solid var(--cl-line-soft); }
.pair-row { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: var(--cl-ink); text-decoration: none; }
.pair-row:hover { background: var(--cl-zinc-50); color: var(--cl-ink); }
.pair-lost, .pair-img { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; background: var(--cl-zinc-100); color: var(--cl-muted); }
.pair-lost { background: var(--cl-amber-soft); color: var(--cl-amber); }
.pair-img img { width: 100%; height: 100%; object-fit: cover; }
.pair-text { flex: 1 1 0; min-width: 0; }
.pair-text strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pair-text small { display: block; font-size: 12px; color: var(--cl-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pair-arrow { color: var(--cl-faint); flex: 0 0 auto; }
@media (max-width: 575.98px) { .pair-arrow, .pair-lost { display: none; } }
.shelf-list { list-style: none; margin: 0; padding: 8px 0; }
.shelf-list a { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 16px; color: var(--cl-ink); text-decoration: none; }
.shelf-list a:hover { background: var(--cl-zinc-50); color: var(--cl-ink); }
.shelf-list-name strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shelf-list-name small { font-size: 12px; color: var(--cl-muted); }
.shelf-list-bar { position: relative; height: 8px; border-radius: 99px; background: var(--cl-zinc-100); overflow: hidden; }
.shelf-list-bar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--cl-primary); }
.shelf-list-bar span.is-due { background: var(--cl-rose); }
.shelf-list-n { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; text-align: right; min-width: 32px; }
.shelf-list-n em { display: block; font-style: normal; font-weight: 500; font-size: 11.5px; color: var(--cl-rose); }
.chart-box-sm { height: 220px; }
.tl-compact { padding-top: 12px; }
.tl-compact li { padding-bottom: 12px; }
.tl .tl-text a { color: var(--cl-ink); }
.tl .tl-text a:hover { color: var(--cl-primary); }
@media (max-width: 767.98px) {
  .dash-hero { padding: 20px 18px; }
  .dash-hero h1 { font-size: 23px; }
  .dash-hero-stats { width: 100%; }
  .dash-hero-stats > a, .dash-hero-stats > div { flex: 1 1 0; min-width: 0; padding: 10px 12px; }
  .dash-hero-stats strong { font-size: 21px; }
  .item-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px; }
}
@media (max-width: 767.98px) { .todo-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .todo-tile { padding: 10px; gap: 8px; } .todo-icon { width: 30px; height: 30px; font-size: 15px; } .todo-go { display: none; } .todo-text strong { font-size: 18px; } }
@media (min-width: 1400px) { .item-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---- Public forms (v2.0) ------------------------------------------------ */
.pub-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--cl-primary); background: var(--cl-primary-soft); padding: 4px 10px; border-radius: 99px; margin: 0 0 10px; }
.public-hero h1 { font-size: clamp(26px, 3.4vw, 34px); }
.pub-form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.public-wrap:has(.pub-form-layout) { max-width: 1040px; }
.pub-form { padding: 6px 24px 22px; }
.form-step { border: 0; padding: 18px 0 20px; margin: 0; border-bottom: 1px solid var(--cl-line-soft); }
.form-step:last-of-type { border-bottom: 0; }
.form-step legend { display: flex; align-items: center; gap: 10px; float: none; width: auto; font-size: 16px; font-weight: 600; color: var(--cl-ink); margin: 0 0 14px; padding: 0; }
.form-step legend span { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; background: var(--cl-primary); color: #fff; }
.pub-form-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 6px; }
.btn-cl-lg { padding: 11px 20px; font-size: 15px; }
.pub-aside { display: grid; gap: 14px; position: sticky; top: 16px; }
.pub-aside-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--cl-muted); margin: 0 0 12px; }
.pub-steps { list-style: none; counter-reset: ps; margin: 0; padding: 0; display: grid; gap: 14px; }
.pub-steps li { counter-increment: ps; position: relative; padding-left: 36px; }
.pub-steps li::before { content: counter(ps); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--cl-primary-soft); color: var(--cl-primary); }
.pub-steps strong { display: block; font-size: 14px; color: var(--cl-ink); }
.pub-steps span { font-size: 13px; color: var(--cl-muted); }
.pub-aside-link { display: flex; align-items: center; gap: 12px; color: var(--cl-ink); text-decoration: none; }
.pub-aside-link:hover { border-color: color-mix(in srgb, var(--cl-primary) 45%, var(--cl-line)); color: var(--cl-ink); }
.pub-aside-link i { font-size: 22px; color: var(--cl-primary); }
.pub-aside-link strong { display: block; font-size: 14px; }
.pub-aside-link small { color: var(--cl-primary); font-size: 13px; font-weight: 600; }
.pub-place { display: flex; gap: 10px; padding: 6px 0; }
.pub-place i { color: var(--cl-primary); margin-top: 2px; }
.pub-place strong { display: block; font-size: 14px; }
.pub-place small { color: var(--cl-muted); font-size: 12.5px; }
@media (max-width: 860px) { .pub-form-layout { grid-template-columns: 1fr; } .pub-aside { position: static; } .pub-form { padding: 4px 16px 18px; } }
.track-card { max-width: 460px; margin: 10px auto 0; padding: 32px 30px; text-align: center; }
.track-card h1 { font-size: 24px; font-weight: 700; margin: 0 0 6px; color: var(--cl-ink); }
.track-icon { width: 56px; height: 56px; border-radius: 16px; display: inline-grid; place-items: center; background: var(--cl-primary-soft); color: var(--cl-primary); font-size: 26px; margin-bottom: 14px; }
@media (max-width: 520px) { .track-card { padding: 24px 18px; } }
.pub-footer { background: var(--cl-surface); border-top: 1px solid var(--cl-line); margin-top: 32px; }
.pub-footer-inner { max-width: 1080px; margin: 0 auto; padding: 24px 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.pub-footer-brand strong { display: block; color: var(--cl-ink); font-size: 14px; }
.pub-footer-brand span { color: var(--cl-muted); font-size: 12.5px; }
.pub-footer-links { display: flex; gap: 6px 18px; flex-wrap: wrap; }
.pub-footer-links a { color: var(--cl-muted); font-size: 13px; text-decoration: none; }
.pub-footer-links a:hover { color: var(--cl-primary); }
.pub-footer-meta { display: flex; gap: 14px; align-items: center; font-size: 12.5px; color: var(--cl-faint); }
.pub-footer-meta a { color: var(--cl-muted); text-decoration: none; }
.pub-footer-meta a:hover { color: var(--cl-primary); }
@media (max-width: 760px) { .pub-footer-inner { flex-direction: column; align-items: flex-start; } }
.form-step { padding: 22px 0 20px; }
.form-step legend { margin: 0 0 4px; line-height: 1.3; }
.found-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.found-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 14px; border: 1px solid var(--cl-line); background: var(--cl-surface); transition: border-color .15s, box-shadow .15s; }
.found-card:hover { border-color: color-mix(in srgb, var(--cl-primary) 35%, var(--cl-line)); box-shadow: 0 8px 20px rgba(0,0,0,.05); }
.found-card-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--cl-primary-soft); color: var(--cl-primary); font-size: 20px; }
.found-card-body { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; }
.found-card-body strong { font-size: 15px; color: var(--cl-ink); margin-bottom: 4px; }
.found-card-body span { font-size: 12.5px; color: var(--cl-muted); display: flex; gap: 6px; align-items: center; }
.found-card-body span i { color: var(--cl-faint); }
.found-card-btn { width: 100%; justify-content: center; }
.public-wrap h2 { font-weight: 600; letter-spacing: -.01em; }
.owner-item { display: flex; gap: 18px; align-items: flex-start; }
.owner-item-photo { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; border: 1px solid var(--cl-line); flex: 0 0 auto; }
.owner-item-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--cl-primary-soft); color: var(--cl-primary); font-size: 22px; flex: 0 0 auto; }
.owner-bring { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; font-size: 13.5px; color: var(--cl-ink-soft, var(--cl-ink)); }
.owner-bring i { color: var(--cl-primary); margin-right: 6px; }
@media (max-width: 520px) { .owner-item-photo { width: 84px; height: 84px; } }
.form-step-h { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; color: var(--cl-ink); margin: 0 0 14px; }
.form-step-h span { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; background: var(--cl-primary-soft); color: var(--cl-primary); flex: 0 0 auto; }
.handover-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 16px; flex-wrap: wrap; }
.handover-item-img { width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--cl-zinc-100); display: grid; place-items: center; color: var(--cl-faint); font-size: 22px; flex: 0 0 auto; }
.handover-item-img img { width: 100%; height: 100%; object-fit: cover; }
.handover-item strong { display: block; font-size: 16px; }
.handover-item .min-w-0 { display: flex; flex-direction: column; }
.match-side-found { position: relative; padding-left: 0; }
.match-side-found:has(.match-photo) { padding-left: 64px; }
.match-photo { position: absolute; left: 0; top: 0; width: 52px; height: 52px; border-radius: 10px; object-fit: cover; border: 1px solid var(--cl-line); }
/* Buttons inside empty states keep normal icons */
.empty-state .btn-cl i, .empty-state .btn-cl .bi { width: auto; height: auto; display: inline-block; background: none; border: 0; border-radius: 0; margin: 0; font-size: 1em; color: inherit; box-shadow: none; }
.empty-state h1, .empty-state .h4 { color: var(--cl-ink); }

/* =========================================================================
   Print (v2.0, final): A4 is ~720px wide, which would trigger the phone
   layout, and the app shell scrolls inside a fixed-height box. Undo both.
   ========================================================================= */
@media print {
  @page { size: A4; margin: 12mm 12mm 14mm; }
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; }
  .app-shell, .app-main, .app-content { display: block !important; height: auto !important; overflow: visible !important; padding: 0 !important; margin: 0 !important; }
  .app-sidebar, .app-topbar, .nav-progress, .flash, .bulk-bar, .no-print, .dash-quick, .todo-go, .dv-photo-count,
  .cl-card-head .btn-cl, .list-head-controls, .filter-bar, .pagination-cl, .pagination, .side-tools, .side-actions, .side-note { display: none !important; }
  body { font-size: 11px; }
  .cl-card { break-inside: avoid; page-break-inside: avoid; box-shadow: none !important; border: 1px solid #d4d4d8 !important; }
  .dv-section, .dash-grid > * { break-inside: avoid; }
  /* Detail pages */
  .dv-hero { display: grid !important; grid-template-columns: 150px 1fr !important; gap: 16px !important; padding: 12px !important; }
  .dv-title { font-size: 20px !important; }
  .dv-facts { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 6px !important; margin-bottom: 10px !important; }
  .dv-fact { padding: 6px 8px !important; }
  .dv-fact strong { font-size: 12px !important; white-space: normal !important; }
  .dv-body { display: block !important; }
  .dv-main, .dv-side { display: block !important; position: static !important; }
  .dv-main > *, .dv-side > * { margin-bottom: 10px; }
  .dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; padding: 8px 12px !important; gap: 6px 18px !important; }
  .dl-grid dd { font-size: 11.5px; }
  .owner-steps { margin-top: 8px !important; }
  .owner-steps li span { width: 22px; height: 22px; }
  .tl { padding: 8px 12px 0 !important; }
  .tl li { padding-bottom: 8px !important; }
  /* Lists, stats, dashboard */
  .stats-grid, .stats-grid:has(> :nth-child(6):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 8px !important; }
  .stats-grid:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .todo-row { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; gap: 6px !important; }
  .dash-hero { color: #000 !important; background: none !important; border: 1px solid #d4d4d8; padding: 12px !important; }
  .dash-hero::after { display: none; }
  .dash-hero h1, .dash-hero-stats a, .dash-date, .dash-sub { color: #000 !important; }
  .dash-hero-stats > a, .dash-hero-stats > div { background: #f4f4f5 !important; border-color: #e4e4e7 !important; }
  .dash-hero-stats span { color: #52525b !important; }
  .dash-grid { display: block !important; }
  .dash-grid > * { margin-bottom: 10px; }
  .item-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .row { display: flex !important; flex-wrap: wrap !important; }
  .table-cl { font-size: 10.5px; }
  .table-responsive { overflow: visible !important; }
  .print-head { display: flex !important; }
  a[href]::after { content: none !important; }
}
@media print { details.ship-start { display: none !important; } }

/* App shell fills the screen *below* the demo banner (no double scroll, no cut-off sidebar) */
@media screen {
  body.app-body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  body.app-body > .app-shell { flex: 1 1 auto; min-height: 0; height: auto; }
  body.app-body > .app-shell > .app-sidebar, body.app-body > .app-shell > .app-main { height: auto; min-height: 0; }
}
@media screen and (max-width: 991.98px) {
  body.app-body > .app-shell > .app-sidebar { height: 100vh; height: 100dvh; }
}
@media print { body.app-body { display: block !important; height: auto !important; overflow: visible !important; } }
.pub-pager { margin-top: 16px; background: var(--cl-surface); border: 1px solid var(--cl-line); border-radius: 12px; }
/* Public header: phone menu, compact search cards */
.pub-menu-btn { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--cl-line); background: var(--cl-surface); color: var(--cl-ink); font-size: 20px; align-items: center; justify-content: center; }
@media (max-width: 760px) {
  .public-header .public-bar { flex-wrap: wrap; padding: .7rem 1rem; }
  .pub-menu-btn { display: inline-flex; margin-left: auto; }
  .public-nav { display: none; order: 3; width: 100%; flex-direction: column; flex-wrap: nowrap; overflow: visible; margin: 6px 0 2px; padding: 6px 0 0; border-top: 1px solid var(--cl-line-soft); gap: 2px; }
  .public-nav.is-open { display: flex; }
  .public-nav-link { padding: 11px 12px; font-size: 15px; }
  .public-main { padding: 1.25rem 1rem; }
  .found-grid { grid-template-columns: 1fr; gap: 8px; }
  .found-card { display: grid; grid-template-columns: 40px 1fr; gap: 4px 12px; padding: 12px 14px; }
  .found-card-icon { width: 40px; height: 40px; font-size: 18px; grid-row: span 2; }
  .found-card-body { gap: 1px; }
  .found-card-body strong { margin-bottom: 1px; font-size: 14.5px; }
  .found-card-body span:nth-of-type(3) { display: none; }
  .found-card-btn { grid-column: 2; width: auto; justify-self: start; margin-top: 6px; }
}
/* Filters: tighter fields so a full row fits; breathing room after notices */
@media (min-width: 768px) {
  .filter-bar .form-control-cl, .filter-bar .form-select-cl, .filter-bar .ss { min-width: 128px; }
  .filter-bar input[type=date].form-control-cl { min-width: 0; width: 150px; }
  .filter-bar .filter-grow { flex: 1 1 180px; }
}
.app-content > .flash, .app-content > a.flash { margin-bottom: 1rem; }
.app-content > .flash + .filter-bar, .app-content > a.flash + .filter-bar { margin-top: .25rem; }
.flash + .filter-bar, .flash + form.filter-bar { margin-top: 1rem !important; }
/* Public form steps: float the legend so it obeys the fieldset padding */
.form-step { padding: 24px 0 24px; }
.form-step:first-of-type { padding-top: 22px; }
.form-step > legend { float: left; width: 100%; margin: 0 0 16px; padding: 0; line-height: 1.3; }
.form-step > legend + * { clear: both; }
.form-step .form-grid { row-gap: 16px; }
.form-step .form-hint { margin-top: 6px; }
@media (max-width: 860px) { .form-step { padding: 20px 0; } .form-step > legend { margin-bottom: 14px; font-size: 15.5px; } }
/* Legal hold + chain of custody */
.hold-banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 16px; border-radius: 12px; background: var(--cl-rose-soft); border: 1px solid var(--cl-rose-line); color: var(--cl-ink); flex-wrap: wrap; }
.hold-banner > i { font-size: 22px; color: var(--cl-rose); }
.hold-banner strong { display: block; color: var(--cl-rose); }
.hold-banner span { display: block; font-size: 13px; color: var(--cl-muted); }
.custody { list-style: none; margin: 0; padding: 14px 20px 6px; }
.custody li { position: relative; display: flex; gap: 12px; padding-bottom: 14px; }
.custody li:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--cl-line-soft); }
.custody-dot { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; background: var(--cl-primary-soft); color: var(--cl-primary); font-size: 14px; }
.custody .kind-returned .custody-dot { background: var(--cl-green-soft); color: var(--cl-green); }
.custody .kind-released .custody-dot { background: var(--cl-zinc-100); color: var(--cl-muted); }
.custody-body { min-width: 0; padding-top: 4px; }
.custody-route { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.custody-route span { color: var(--cl-muted); }
.custody-route i { color: var(--cl-faint); font-size: 12px; }
.custody-meta { font-size: 12.5px; color: var(--cl-muted); margin-top: 2px; }
.btn-cl.disabled, .btn-cl[aria-disabled=true] { opacity: .5; cursor: not-allowed; pointer-events: none; }
/* Reports: report picker cards */
.report-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 4px 0 18px; }
.report-pick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--cl-line); background: var(--cl-surface); color: var(--cl-ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.report-pick:hover { border-color: color-mix(in srgb, var(--cl-primary) 40%, var(--cl-line)); color: var(--cl-ink); }
.report-pick.active { border-color: var(--cl-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cl-primary) 14%, transparent); }
.report-pick-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--cl-zinc-100); color: var(--cl-muted); font-size: 17px; flex: 0 0 auto; }
.report-pick.active .report-pick-icon { background: var(--cl-primary); color: #fff; }
.report-pick-text strong { display: block; font-size: 14px; }
.report-pick-text small { color: var(--cl-muted); font-size: 12px; }
@media (max-width: 575.98px) { .report-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Empty states: a soft illustrated badge instead of a plain icon tile */
.empty-state:not(.empty-sm) > .bi:first-child, .empty-state:not(.empty-sm) > .empty-icon .bi {
  width: 84px; height: 84px; font-size: 32px; border-radius: 50%; margin-bottom: 1rem; position: relative;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--cl-primary) 22%, var(--cl-surface)), var(--cl-primary-soft) 70%);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--cl-primary) 6%, transparent), 0 0 0 9px color-mix(in srgb, var(--cl-primary) 18%, transparent);
  outline: 2px dashed color-mix(in srgb, var(--cl-primary) 22%, transparent); outline-offset: 16px; }
.empty-state:not(.empty-sm) { padding: 3.5rem 1.25rem 3rem; font-size: 14.5px; }
.empty-state.empty-sm .bi { width: 36px; height: 36px; font-size: 17px; border-radius: 50%; }
/* Detail pages on phones: sticky action bar at the bottom; actions after the content */
.dv-mobilebar { display: none; }
@media (max-width: 767.98px) {
  .dv-mobilebar { display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--cl-surface) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--cl-line); box-shadow: 0 -6px 20px rgba(0,0,0,.08); }
  .dv-mobilebar .btn-cl { flex: 1 1 0; justify-content: center; padding-top: 11px; padding-bottom: 11px; }
  .dv-mobilebar .btn-cl-outline { flex: 0 0 auto; }
  .app-content:has(.dv-mobilebar) { padding-bottom: 88px !important; }
  .dv-body .dv-side { grid-row: auto !important; }
}

/* ---- Dashboard setup checklist ---- */
.setup-list { list-style: none; margin: 0; padding: .25rem 1.25rem 1rem; }
.setup-list li a { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--cl-line); color: inherit; text-decoration: none; }
.setup-list li:last-child a { border-bottom: 0; }
.setup-list li a span { flex: 1; }
.setup-list li a > i:first-child { color: var(--cl-primary); font-size: 1.1rem; }
.setup-list li.is-done a { color: var(--cl-muted); }
.setup-list li.is-done a span { text-decoration: line-through; }
.setup-list li.is-done a > i:first-child { color: #16a34a; }

/* ---- Recipient typeahead ---- */
.ta-list { position: absolute; z-index: 30; left: 0; right: 0; margin-top: 4px; background: var(--cl-surface); border: 1px solid var(--cl-line); border-radius: var(--cl-radius); box-shadow: var(--cl-shadow-md); overflow: hidden; }
.ta-item { display: block; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: none; color: inherit; }
.ta-item + .ta-item { border-top: 1px solid var(--cl-line-soft); }
.ta-item strong { display: block; font-weight: 600; font-size: 14px; }
.ta-item small { display: block; color: var(--cl-muted); font-size: 12px; }
.ta-item:hover, .ta-item.is-active { background: var(--cl-primary-soft); }

/* ---- Recipient import ---- */
.code-sample { margin: 0; padding: 12px 14px; border-radius: var(--cl-radius); background: var(--cl-zinc-50); border: 1px solid var(--cl-line); font-size: 12.5px; line-height: 1.6; white-space: pre; overflow-x: auto; color: var(--cl-ink-soft); }
.radio-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.radio-row input { accent-color: var(--cl-primary); width: 16px; height: 16px; }
.import-errors { margin: 0; padding-left: 18px; color: var(--cl-rose-ink); font-size: 13px; columns: 2; column-gap: 32px; }
@media (max-width: 767.98px) { .import-errors { columns: 1; } }

/* ---- Intake (packages/intake) ---- */
.intake { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.intake-form { overflow: visible; }
.intake-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--cl-line); }
.intake-head h1 { font-size: 20px; margin: 0; }
.intake-site { width: auto; max-width: 220px; }
.intake-site-name { color: var(--cl-muted); font-size: 13px; }
.intake-body { padding: 18px 20px; display: grid; gap: 16px; }
.intake-foot { padding: 14px 20px 18px; border-top: 1px solid var(--cl-line); position: sticky; bottom: 0; background: var(--cl-surface); border-radius: 0 0 var(--cl-radius-lg) var(--cl-radius-lg); }
.intake-foot kbd { margin-left: 8px; font-size: 11px; background: rgba(255,255,255,.18); color: inherit; border-radius: 4px; padding: 1px 6px; }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn .form-control-cl { flex: 1; min-width: 0; }
.input-with-btn .btn-cl { flex: none; }
#tracking_no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; }
.intake-hint { min-height: 22px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.intake-hint .chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; background: var(--cl-primary-soft); color: var(--cl-primary); font-weight: 600; }
.intake-hint .dup-warn { color: var(--cl-amber); }
.intake-picked { margin-top: 8px; padding: 8px 12px; border-radius: var(--cl-radius); background: var(--cl-green-soft); border: 1px solid var(--cl-green-line); font-size: 14px; }
.intake-picked i.bi-person-check { color: var(--cl-green); }
.intake-picked small { color: var(--cl-muted); margin-left: 4px; }
.btn-link-cl { border: 0; background: none; padding: 0; color: var(--cl-primary); font-size: 13px; font-weight: 500; }
.btn-link-cl:hover { text-decoration: underline; }
.quick-add { margin-top: 10px; padding: 12px; border: 1px dashed var(--cl-line); border-radius: var(--cl-radius); background: var(--cl-zinc-50); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-opt input, .flag-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span, .flag-opt span { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px solid var(--cl-line); border-radius: var(--cl-radius); background: var(--cl-surface); cursor: pointer; font-size: 14px; font-weight: 500; user-select: none; transition: border-color .12s, background .12s; }
.seg-opt input:checked + span { border-color: var(--cl-primary); background: var(--cl-primary-soft); color: var(--cl-primary); box-shadow: inset 0 0 0 1px var(--cl-primary); }
.seg-opt input:focus-visible + span, .flag-opt input:focus-visible + span { outline: 2px solid var(--cl-primary); outline-offset: 2px; }
.flag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.flag-opt input:checked + span { border-color: var(--cl-rose); background: var(--cl-rose-soft); color: var(--cl-rose-ink); }
.intake-more summary { cursor: pointer; color: var(--cl-muted); font-size: 13.5px; font-weight: 500; }
.intake-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.intake-side .cl-card-head h2 { display: flex; align-items: center; gap: 8px; }
.intake-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.intake-list li { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--cl-line-soft); }
.intake-list li.is-new { animation: il-in .5s ease; }
@keyframes il-in { from { background: var(--cl-green-soft); } to { background: transparent; } }
.intake-list a { flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.il-main { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.il-sub { display: block; color: var(--cl-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.il-time { color: var(--cl-faint); font-size: 12px; font-variant-numeric: tabular-nums; }
@media (max-width: 991.98px) {
  .intake { grid-template-columns: 1fr; }
  .intake-side { position: static; max-height: none; }
}
@media (max-width: 575.98px) {
  .intake-head, .intake-body, .intake-foot { padding-left: 14px; padding-right: 14px; }
  .seg-opt span, .flag-opt span { padding: 8px 11px; font-size: 13.5px; }
}
@media (prefers-reduced-motion: reduce) { .intake-list li.is-new { animation: none; } }

/* ---- Packages list ---- */
.tab-nav-cl { overflow-x: auto; scrollbar-width: none; }
.tab-nav-cl a { white-space: nowrap; }
.tab-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--cl-zinc-100); color: var(--cl-muted); font-size: 11.5px; font-weight: 600; text-align: center; }
.tab-nav-cl a.active .tab-count { background: var(--cl-primary-soft); color: var(--cl-primary); }
.fs-12 { font-size: 12px; }

/* ---- Shelves (packages/storage) ---- */
.section-title { font-size: 15px; font-weight: 600; margin: 0 0 10px; color: var(--cl-ink-soft); }
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.shelf-tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--cl-line); border-radius: var(--cl-radius-lg); background: var(--cl-surface); color: inherit; text-decoration: none; transition: border-color .12s, box-shadow .12s; }
.shelf-tile:hover { border-color: var(--cl-primary); box-shadow: var(--cl-shadow-md); color: inherit; }
.shelf-tile.is-empty { opacity: .7; }
.shelf-name { font-weight: 600; }
.shelf-desc { color: var(--cl-muted); font-size: 12px; }
.shelf-count { margin-top: 6px; color: var(--cl-muted); font-size: 13px; }
.shelf-count strong { font-size: 24px; color: var(--cl-ink); font-variant-numeric: tabular-nums; margin-right: 2px; }
.shelf-bar { height: 5px; border-radius: 99px; background: var(--cl-zinc-100); overflow: hidden; }
.shelf-bar span { display: block; height: 100%; background: var(--cl-primary); border-radius: 99px; }
.shelf-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; min-height: 18px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pkg-photo { display: block; width: 100%; max-height: 320px; object-fit: contain; border-radius: var(--cl-radius); background: var(--cl-zinc-50); }
.dash-full { grid-column: span 12; }

/* ---- Recipient portal (views/p) ---- */
.portal { max-width: 620px; margin: 0 auto; padding: 8px 0 24px; }
.portal-narrow { max-width: 440px; padding-top: 32px; }
.portal-hello h1 { font-size: 26px; margin: 0 0 4px; }
.portal-hello { margin-bottom: 16px; }
.portal-code { display: flex; gap: 20px; align-items: center; padding: 20px; margin-bottom: 16px; border-color: color-mix(in srgb, var(--cl-primary) 35%, var(--cl-line)); }
.portal-qr { flex: none; width: 132px; height: 132px; padding: 8px; background: #fff; border-radius: 10px; border: 1px solid var(--cl-line); }
.portal-qr svg { width: 100%; height: 100%; display: block; }
.portal-label { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--cl-muted); }
.portal-digits { margin: 2px 0 6px; font: 700 34px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; color: var(--cl-ink); }
@media (max-width: 480px) {
  .portal-code { flex-direction: column; text-align: center; }
  .portal-qr { width: 170px; height: 170px; }
}
.placeholder-list { display: flex; flex-wrap: wrap; gap: 6px; }
.placeholder-list code { padding: 2px 7px; border-radius: 6px; background: var(--cl-zinc-100); color: var(--cl-ink-soft); font-size: 12px; cursor: help; }

/* ---- Pickup desk ---- */
.pickup-start, .pickup { max-width: 640px; margin: 0 auto; }
.pickup-who { margin-bottom: 16px; }
.code-input { font: 600 24px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .15em; text-align: center; }
.or-line { display: flex; align-items: center; gap: 12px; color: var(--cl-faint); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin: 4px 0 16px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--cl-line); }
.pickup-group { margin: 12px 20px 0; font-size: 12px; font-weight: 600; color: var(--cl-muted); text-transform: uppercase; letter-spacing: .05em; }
.pickup-list { list-style: none; margin: 0; padding: 0; }
.pickup-list label { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--cl-line-soft); cursor: pointer; }
.pickup-list input { width: 20px; height: 20px; accent-color: var(--cl-primary); flex: none; }
.pickup-list .pl-main { flex: 1; min-width: 0; font-weight: 600; }
.pickup-list .pl-sub { display: block; font-weight: 400; color: var(--cl-muted); font-size: 12.5px; }
.pickup-list .pl-shelf { font-size: 13px; color: var(--cl-ink-soft); white-space: nowrap; }
.pickup-list li.is-held { opacity: .6; }
.pickup-foot { position: sticky; bottom: 12px; z-index: 5; }
.done-tick { width: 64px; height: 64px; margin: 4px auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--cl-green-soft); color: var(--cl-green); font-size: 34px; }
.sig-img { max-width: 240px; max-height: 100px; display: block; border: 1px solid var(--cl-line); border-radius: 6px; background: #fff; }
.pickup { padding-bottom: 72px; }

/* ---- Reports ---- */
.range-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.range-custom { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.range-custom .form-control-cl { width: auto; }
.dash-half { grid-column: span 6; }
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.glance > div { padding: 16px 20px; border-right: 1px solid var(--cl-line-soft); }
.glance > div:last-child { border-right: 0; }
.glance strong { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.glance span { color: var(--cl-muted); font-size: 13px; }
.mini-bar { display: block; height: 4px; margin-top: 4px; border-radius: 99px; background: var(--cl-zinc-100); max-width: 220px; overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: var(--cl-primary); border-radius: 99px; }
@media (max-width: 1199.98px) { .dash-half { grid-column: span 12; } .range-custom { margin-left: 0; } }
.courier-bars { list-style: none; margin: 0; padding: 8px 20px 16px; }
.courier-bars li { display: grid; grid-template-columns: 120px 1fr 36px; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; }
.courier-bars .mini-bar { max-width: none; margin: 0; height: 8px; }
.courier-bars strong { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- AI label reading (intake) ---- */
.ai-label-btn { position: relative; cursor: pointer; }
.ai-result { margin-top: 8px; padding: 10px 12px; border-radius: var(--cl-radius); border: 1px solid color-mix(in srgb, var(--cl-primary) 30%, var(--cl-line)); background: var(--cl-primary-soft); font-size: 14px; }
.ai-result.is-error { border-color: var(--cl-rose-line); background: var(--cl-rose-soft); color: var(--cl-rose-ink); }
.ai-head i { color: var(--cl-primary); }
.ai-matches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-match { text-align: left; padding: 6px 10px; border: 1px solid var(--cl-line); border-radius: var(--cl-radius); background: var(--cl-surface); }
.ai-match strong { display: block; font-size: 13.5px; } .ai-match small { color: var(--cl-muted); font-size: 11.5px; }
.ai-match.is-picked { border-color: var(--cl-green); box-shadow: inset 0 0 0 1px var(--cl-green); }
.ai-note { margin: 6px 0 0; color: var(--cl-muted); font-size: 12.5px; }
