@charset "utf-8";
/* =====================================================================
   Field cash collection — design system
   Every brand colour is a token below. A deployment overrides them in config.php;
   nothing outside this :root block should carry a brand hex value.
   Rule: green is used ONLY for approval (approve buttons, APPROVED banner)
   ===================================================================== */

@font-face { font-family: "Montserrat"; font-weight: 500; font-display: swap; src: url(fonts/montserrat-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-display: swap; src: url(fonts/montserrat-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url(fonts/montserrat-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 800; font-display: swap; src: url(fonts/montserrat-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "Open Sans"; font-weight: 400; font-display: swap; src: url(fonts/open-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Open Sans"; font-weight: 600; font-display: swap; src: url(fonts/open-sans-latin-600-normal.woff2) format("woff2"); }

:root {
  /* Default palette — deliberately neutral. Each deployment sets its own in config.php. */
  --p-50: #f4f6fb; --p-100: #e6ebf5; --p-200: #ccd6e8; --p-300: #a3b4d2; --p-400: #6f86b8;
  --p-500: #3f5a96; --p-600: #344c80; --p-700: #2a3d68; --p-800: #212f50;
  --p-850: #1a2642; --p-900: #131b30;
  --p-glow: #7f97c9; --p-glow-0: rgba(127,151,201,0);
  --p-shadow: rgba(63,90,150,.6); --p-shadow-2: rgba(63,90,150,.7); --p-ring: rgba(63,90,150,.12);
  --tint: #eef0f5; --tint-2: #e7eaf1;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --ink: #1d1728;
  --ink-2: #4a4458;
  --muted: #6b6479;
  --line: #e9ecf3;
  --line-2: #d8dde8;

  --approve: #0a7c4a; --approve-600: #086a3f; --approve-50: #e8f7ef;
  --danger: #c62835; --danger-50: #fdecee; --danger-100: #fad4d8;
  --warn: #b45309; --warn-50: #fff5e6;

  --radius-sm: 8px; --radius: 12px; --radius-lg: 18px; --radius-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(46, 18, 84, .06);
  --shadow: 0 1px 2px rgba(46, 18, 84, .05), 0 6px 20px -6px rgba(46, 18, 84, .10);
  --shadow-lg: 0 24px 60px -20px rgba(46, 18, 84, .35);

  --head: "Montserrat", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --body: "Open Sans", ui-sans-serif, system-ui, "Segoe UI", sans-serif;

  --sidebar-w: 256px;
  --topbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }
body { margin: 0; font: 400 15px/1.55 var(--body); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: var(--p-700); text-decoration: none; }
a:hover { color: var(--p-500); }
h1, h2, h3, h4 { font-family: var(--head); color: var(--ink); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0 0 12px; }
code, .mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .92em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
:focus-visible { outline: 3px solid var(--p-300); outline-offset: 2px; border-radius: 6px; }

.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ic-sm { width: 15px; height: 15px; }
.ic-lg { width: 22px; height: 22px; }
.ic-xl { width: 30px; height: 30px; }

/* ---------------------------------------------------------------- shell */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: linear-gradient(180deg, var(--p-900) 0%, var(--p-850) 55%, var(--p-700) 100%);
  color: #fff; display: flex; flex-direction: column; padding: 18px 14px;
}
.sb-brand { background: #fff; border-radius: var(--radius); padding: 10px 12px; display: flex; justify-content: center; margin-bottom: 10px; }
.sb-brand img { height: 46px; width: auto; display: block; }
.sb-app { font: 700 11px var(--head); letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.6); padding: 10px 10px 14px; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-nav a {
  display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.78);
  font: 600 14px var(--head); padding: 11px 12px; border-radius: 10px; position: relative;
  transition: background .15s, color .15s;
}
.sb-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sb-nav a.on { background: rgba(255,255,255,.14); color: #fff; }
.sb-nav a.on::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: #fff; }
.sb-nav .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--p-500); color: #fff; font-size: 12px; display: grid; place-items: center; }
.sb-nav .count.alert { background: var(--danger); }
.sb-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sb-install { display: none; align-items: center; gap: 10px; width: 100%; border: 1px dashed rgba(255,255,255,.35); background: transparent; color: #fff; font: 600 13px var(--head); padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.sb-install.show { display: flex; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(0,0,0,.18); }
.avatar-initials { width: 36px; height: 36px; border-radius: 50%; background: var(--p-100); color: var(--p-700); display: grid; place-items: center; font: 700 13px var(--head); flex: none; }
.sb-user .who { min-width: 0; flex: 1; }
.sb-user .who b { display: block; font: 600 13px var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user .who span { font-size: 12px; color: rgba(255,255,255,.6); }
.sb-user a { color: rgba(255,255,255,.75); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; }
.sb-user a:hover { background: rgba(255,255,255,.12); color: #fff; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 max(32px, calc((100% - 1400px) / 2 + 32px));
  background: rgba(246, 244, 250, .82); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .title { min-width: 0; }
.topbar .title h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title p { margin: 0; color: var(--muted); font-size: 13px; }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.tb-logo { display: none; }
.content { padding: 8px 32px 48px; max-width: 1400px; width: 100%; margin: 0 auto; }
.page-foot { margin: auto auto 0; padding: 16px 32px 24px; color: var(--muted); font-size: 12px; max-width: 1400px; width: 100%; }

.tabbar { display: none; }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-h { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; }
.card-h h2 { display: flex; align-items: center; gap: 10px; }
.card-h .sub { color: var(--muted); font-size: 13px; }
.card-h .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 18px 20px 20px; }
.card-b.flush { padding: 12px 0 6px; }
.content > .card + .card { margin-top: 20px; }
.section-gap { margin-top: 20px; }
.grid.eq { align-items: stretch; }
.grid.eq > .card { display: flex; flex-direction: column; }
.grid.eq > .card > .card-b { flex: 1; }
.chip-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--p-50); color: var(--p-500); flex: none; }
.chip-ic.danger { background: var(--danger-50); color: var(--danger); }
.chip-ic.warn { background: var(--warn-50); color: var(--warn); }

.grid { display: grid; gap: 20px; align-items: start; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.grid.cols-2-3 { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }

/* KPI */
.kpi { position: relative; padding: 18px 18px 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden; }
.kpi .k-top { display: flex; align-items: center; justify-content: space-between; }
.kpi .k-label { font: 600 12px var(--head); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.kpi .k-val { font: 800 28px/1.1 var(--head); margin-top: 12px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .k-val small { font-size: 14px; font-weight: 700; color: var(--muted); margin-left: 4px; }
.kpi .k-foot { margin-top: 6px; font-size: 12px; color: var(--muted); }
.kpi.brand { background: radial-gradient(120% 140% at 100% 0%, var(--p-400) 0%, var(--p-500) 38%, var(--p-700) 100%); border: 0; color: #fff; box-shadow: 0 14px 30px -14px var(--p-shadow); }
.kpi.brand .k-label, .kpi.brand .k-foot, .kpi.brand .k-val small { color: rgba(255,255,255,.78); }
.kpi.brand .chip-ic { background: rgba(255,255,255,.16); color: #fff; }
.kpi.alert .k-val { color: var(--danger); }
.kpi.alert { border-color: var(--danger-100); background: linear-gradient(180deg, #fff 0%, var(--danger-50) 100%); }

/* ---------------------------------------------------------------- lists (replace heavy tables) */
.list { list-style: none; margin: 0; padding: 0; }
.li { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li:hover { background: var(--surface-2); }
.li .main-t { min-width: 0; flex: 1; }
.li .t1 { font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .t2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .amt { font: 700 15px var(--head); font-variant-numeric: tabular-nums; white-space: nowrap; }
.li .meta { text-align: right; flex: none; }
a.li { color: inherit; }

.thumb { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; flex: none; background: var(--p-50); }
.thumb.round { border-radius: 50%; }
.thumb-initials { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--p-100); color: var(--p-700); font: 700 14px var(--head); flex: none; }

/* table (desktop) that becomes stacked cards on mobile */
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font: 600 11px var(--head); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table th:first-child { padding-left: 20px; } .table th:last-child { padding-right: 20px; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table td:first-child { padding-left: 20px; } .table td:last-child { padding-right: 20px; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- pills / badges */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font: 600 12px var(--head); white-space: nowrap; background: var(--p-50); color: var(--p-700); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.plain::before { display: none; }
.pill.neutral { background: var(--tint); color: var(--muted); }
.pill.danger { background: var(--danger-50); color: var(--danger); }
.pill.warn { background: var(--warn-50); color: var(--warn); }
.pill.live { background: var(--p-50); color: var(--p-600); }
.pill.live::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.ref { font: 600 12px ui-monospace, Menlo, Consolas, monospace; background: var(--p-50); color: var(--p-800); padding: 3px 8px; border-radius: 6px; letter-spacing: .03em; white-space: nowrap; }

/* countdown */
.countdown { font: 600 12.5px var(--head); color: var(--p-700); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.countdown.soon { color: var(--warn); }
.countdown.over { color: var(--muted); }

/* ---------------------------------------------------------------- buttons */
.btn {
  --b-bg: var(--surface); --b-fg: var(--ink); --b-bd: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--b-bd);
  background: var(--b-bg); color: var(--b-fg); font: 600 14px var(--head); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-2); color: var(--b-fg); border-color: var(--p-200); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.primary { --b-bg: var(--p-500); --b-fg: #fff; --b-bd: var(--p-500); box-shadow: 0 6px 16px -8px var(--p-shadow-2); }
.btn.primary:hover { background: var(--p-600); border-color: var(--p-600); }
.btn.approve { --b-bg: var(--approve); --b-fg: #fff; --b-bd: var(--approve); box-shadow: 0 6px 16px -8px rgba(10,124,74,.7); }
.btn.approve:hover { background: var(--approve-600); border-color: var(--approve-600); }
.btn.ghost { --b-bg: transparent; --b-bd: transparent; --b-fg: var(--ink-2); }
.btn.ghost:hover { background: var(--p-50); color: var(--p-700); }
.btn.danger { --b-fg: var(--danger); --b-bd: var(--danger-100); }
.btn.danger:hover { background: var(--danger-50); border-color: var(--danger); color: var(--danger); }
.btn.danger-solid { --b-bg: var(--danger); --b-fg: #fff; --b-bd: var(--danger); }
.btn.danger-solid:hover { background: #a91f2b; color: #fff; }
.btn.warn { --b-fg: var(--warn); --b-bd: #f6d7a8; }
.btn.warn:hover { background: var(--warn-50); color: var(--warn); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 52px; padding: 0 22px; font-size: 16px; border-radius: 14px; }
.btn.block { width: 100%; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
/* icons inside buttons scale with the button, never larger than the label */
.btn .ic { width: 16px; height: 16px; stroke-width: 2.2; vertical-align: 0; }
.btn.sm .ic { width: 14px; height: 14px; }
.btn.lg .ic { width: 18px; height: 18px; }
.btn.icon .ic { width: 18px; height: 18px; }
.btn.icon.sm .ic { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- forms */
.field { display: block; margin-bottom: 16px; }
.field > .lbl { display: block; font: 600 13px var(--head); color: var(--ink-2); margin-bottom: 6px; }
.field .help { display: block; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.control { position: relative; display: flex; align-items: center; }
.control > .ic { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.control > .suffix { position: absolute; right: 12px; font: 700 12px var(--head); color: var(--muted); pointer-events: none; }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: 400 15px var(--body); transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
textarea.input { height: auto; padding: 10px 14px; }
.control > .ic ~ .input { padding-left: 40px; }
.control > .suffix ~ .input, .input.has-suffix { padding-right: 58px; }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a7389' stroke-width='2' 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 12px center; padding-right: 38px; }
.input:hover { border-color: var(--p-200); }
.input:focus { outline: none; border-color: var(--p-500); box-shadow: 0 0 0 4px var(--p-ring); }
.input.xl { height: 58px; font: 600 22px var(--head); letter-spacing: .02em; border-radius: 14px; }
.input[type=file] { padding: 9px 12px; height: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--p-500); flex: none; }

/* segmented control */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); display: inline-flex; align-items: center; font: 600 13px var(--head); cursor: pointer; background: var(--surface); color: var(--ink-2); transition: all .15s; }
.seg label:hover { border-color: var(--p-300); }
.seg input:checked + label { background: var(--p-500); border-color: var(--p-500); color: #fff; }
.seg input:focus-visible + label { outline: 3px solid var(--p-300); outline-offset: 2px; }

/* tabs */
.tabs { display: inline-flex; gap: 2px; padding: 4px; background: var(--tint-2); border-radius: 12px; overflow-x: auto; max-width: 100%; }
.tabs a { padding: 7px 14px; border-radius: 9px; font: 600 13px var(--head); color: var(--ink-2); white-space: nowrap; }
.tabs a:hover { color: var(--p-700); }
.tabs a.on { background: var(--surface); color: var(--p-700); box-shadow: var(--shadow-sm); }
.tabs a .n { font-size: 11px; color: var(--muted); margin-left: 4px; }

/* combobox */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); max-height: 280px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; display: none; }
.combo.open .combo-list { display: block; }
.combo-opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.combo-opt:hover, .combo-opt.active { background: var(--p-50); }
.combo-opt .t2 { font-size: 12.5px; color: var(--muted); }
.combo-empty { padding: 12px; color: var(--muted); font-size: 13px; }
.combo-picked { display: none; align-items: center; gap: 12px; padding: 8px 10px 8px 12px; border: 1px solid var(--p-200); background: var(--p-50); border-radius: 10px; min-height: 44px; }
.combo.has-value .combo-picked { display: flex; }
.combo.has-value .control { display: none; }
.combo-picked .t1 { font-weight: 600; }
.combo-picked .t2 { font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------------- feedback */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--p-50); color: var(--p-900); font-size: 14px; border: 1px solid var(--p-100); }
.notice .ic { margin-top: 2px; color: var(--p-500); }
.notice.warn { background: var(--warn-50); border-color: #fbe0b8; color: #6b3a06; }
.notice.warn .ic { color: var(--warn); }
.notice.danger { background: var(--danger-50); border-color: var(--danger-100); color: #7a1620; }
.notice.danger .ic { color: var(--danger); }

.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty > .ic { width: 38px; height: 38px; color: var(--p-300); margin-bottom: 8px; }
.empty b { display: block; color: var(--ink); font: 700 15px var(--head); margin-bottom: 4px; }

#toasts { position: fixed; z-index: 90; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; background: var(--p-900); color: #fff; padding: 14px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 14px; animation: toast-in .25s ease-out; }
.toast .ic { margin-top: 1px; color: var(--p-200); }
.toast.bad { background: #5c0f17; } .toast.bad .ic { color: #ffb3ba; }
.toast.warn { background: #5a3104; } .toast.warn .ic { color: #ffd08a; }
.toast button { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.6); cursor: pointer; padding: 0; }
.toast.out { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }

/* modal */
dialog.modal { border: 0; padding: 0; border-radius: var(--radius-xl); width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog.modal::backdrop { background: rgba(29, 12, 52, .45); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-b { padding: 24px 24px 8px; }
.modal-b .chip-ic { width: 44px; height: 44px; border-radius: 14px; margin-bottom: 14px; }
.modal-b h3 { font-size: 17px; margin-bottom: 6px; }
.modal-b p { color: var(--ink-2); margin: 0; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 24px 22px; }

/* sheet (drawer) for forms */
.sheet-wrap { position: fixed; inset: 0; z-index: 70; display: none; }
.sheet-wrap.open { display: block; }
.sheet-bg { position: absolute; inset: 0; background: rgba(29, 12, 52, .45); backdrop-filter: blur(2px); animation: fade .2s; }
.sheet { position: absolute; right: 0; top: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide-in .25s cubic-bezier(.2,.8,.2,1); }
.sheet-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.sheet-b { padding: 22px; overflow: auto; flex: 1; }
.sheet-f { padding: 16px 22px calc(16px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }

/* timeline (activity) */
.tl { list-style: none; margin: 0; padding: 4px 0; }
.tl li { display: flex; gap: 14px; padding: 12px 20px; position: relative; }
.tl li::before { content: ""; position: absolute; left: 36px; top: 46px; bottom: -6px; width: 2px; background: var(--line); }
.tl li:last-child::before { display: none; }
.tl .dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--p-50); color: var(--p-500); position: relative; z-index: 1; }
.tl .dot.bad { background: var(--danger-50); color: var(--danger); }
.tl .dot.warn { background: var(--warn-50); color: var(--warn); }
.tl .dot.muted { background: var(--tint); color: var(--muted); }
.tl .body { min-width: 0; flex: 1; padding-top: 2px; }
.tl .t1 { font-weight: 600; }
.tl .t2 { font-size: 13px; color: var(--muted); }
.tl time { font-size: 12px; color: var(--muted); white-space: nowrap; padding-top: 4px; }

/* agent cards */
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.agent-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; transition: box-shadow .2s, transform .2s, border-color .2s; color: inherit; }
.agent-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--p-200); color: inherit; }
.agent-card .ph { aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--p-100), var(--p-50)); position: relative; }
.agent-card .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.agent-card .ph .init { position: absolute; inset: 0; display: grid; place-items: center; font: 800 44px var(--head); color: var(--p-300); }
.agent-card .ph .pill { position: absolute; top: 12px; left: 12px; background: rgba(255,255,255,.92); backdrop-filter: blur(4px); }
.agent-card .ph .pill.danger { background: rgba(253,236,238,.95); }
.agent-card .ph .pill.warn { background: rgba(255,245,230,.95); }
.agent-card .bd { padding: 14px 16px 16px; }
.agent-card .nm { font: 700 15px var(--head); }
.agent-card .sm { font-size: 13px; color: var(--muted); }
.agent-card.off .ph img { filter: grayscale(1); opacity: .7; }
.agent-new { border: 2px dashed var(--p-200); background: transparent; box-shadow: none; display: grid; place-items: center; min-height: 250px; color: var(--p-700); font: 700 14px var(--head); gap: 8px; text-align: center; cursor: pointer; border-radius: var(--radius-lg); }
.agent-new:hover { background: var(--p-50); border-color: var(--p-300); }

.profile { display: flex; gap: 18px; align-items: center; }
.profile .big { width: 96px; height: 116px; border-radius: 16px; object-fit: cover; background: var(--p-50); flex: none; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--p-200); }
.profile .big.init { display: grid; place-items: center; font: 800 36px var(--head); color: var(--p-300); }
.profile h2 { font-size: 20px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.danger-zone { border: 1px solid var(--danger-100); border-radius: var(--radius); padding: 16px; background: linear-gradient(180deg, #fff, var(--danger-50)); }
.danger-zone h3 { color: var(--danger); display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }

.search-bar { position: relative; min-width: 220px; }
.search-bar .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-bar .input { height: 40px; padding-left: 38px; }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--surface); }
.auth-art { position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(90% 70% at 85% 10%, var(--p-glow) 0%, var(--p-glow-0) 60%), radial-gradient(80% 80% at 0% 100%, var(--p-850) 0%, var(--p-glow-0) 70%), linear-gradient(135deg, var(--p-500) 0%, var(--p-700) 70%); }
.auth-art::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(180deg, transparent, #000 40%, transparent); pointer-events: none; }
.auth-art .brandplate { background: #fff; border-radius: 16px; padding: 12px 16px; display: inline-flex; align-self: flex-start; box-shadow: 0 10px 30px -10px rgba(0,0,0,.3); position: relative; z-index: 1; }
.auth-art .brandplate img { height: 54px; width: auto; display: block; }
.auth-art .pitch { position: relative; z-index: 1; max-width: 460px; }
.auth-art .pitch h2 { color: #fff; font-size: 34px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
.auth-art .pitch p { color: rgba(255,255,255,.82); font-size: 16px; margin-top: 14px; }
.auth-art .feats { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.auth-art .feats li { display: flex; gap: 12px; align-items: center; font-weight: 600; }
.auth-art .feats .chip-ic { background: rgba(255,255,255,.16); color: #fff; }
.auth-art .tag { position: relative; z-index: 1; font: 600 13px var(--head); color: rgba(255,255,255,.7); letter-spacing: .12em; text-transform: uppercase; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box .mobile-logo { display: none; height: 56px; width: auto; margin: 0 auto 24px; }
.auth-box h1 { font-size: 26px; font-weight: 800; }
.auth-box .lead { color: var(--muted); margin: 6px 0 28px; }
.auth-box .btn { margin-top: 8px; }
.auth-box .foot { margin-top: 32px; font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .grid.cols-2, .grid.cols-3-2, .grid.cols-2-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(72px + var(--safe-b)); }
  .topbar { padding: 0 16px; height: 62px; background: rgba(255,255,255,.9); border-bottom-color: var(--line); }
  .tb-logo { display: block; height: 34px; width: auto; }
  .topbar .title { display: none; }
  .content { padding: 16px 16px 32px; }
  .page-title-m { display: block !important; margin: 4px 0 16px; }
  .page-foot { padding: 8px 16px 16px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(255,255,255,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-b));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 12px; color: var(--muted); font: 600 10.5px var(--head); position: relative; }
  .tabbar a .ic { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--p-500); }
  .tabbar a.on .ic { background: var(--p-50); border-radius: 10px; padding: 3px; width: 34px; height: 28px; }
  .tabbar a .dot-n { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; }
  #toasts { left: 16px; right: 16px; bottom: calc(84px + var(--safe-b)); max-width: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .table.stack tr:last-child { border-bottom: 0; }
  .table.stack td { padding: 0 !important; border: 0; }
  .table.stack td[data-hide-m] { display: none; }
  .table.stack td.num { text-align: right; }
  .table.stack td.full-m { grid-column: 1 / -1; }
  .sheet { width: 100vw; top: auto; height: 92vh; border-radius: 22px 22px 0 0; animation: sheet-up .28s cubic-bezier(.2,.8,.2,1); }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-box .mobile-logo { display: block; }
  .hide-m { display: none !important; }
}
@media (min-width: 901px) { .page-title-m { display: none !important; } .show-m { display: none !important; } }
@media (max-width: 560px) {
  .agents-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .agents-grid .agent-new { display: none; }
  .agent-card .ph { aspect-ratio: 1 / 1; }
  .agent-card .ph .init { font-size: 34px; }
  .agent-card .bd { padding: 10px 12px 12px; }
  .agent-card .nm { font-size: 14px; }
  .agent-card .row { flex-direction: column; align-items: flex-start !important; gap: 6px; }
  .search-bar { flex: 1 1 auto; min-width: 0; width: 100%; }
  .row.wrap > .spacer { display: none; }
  .li .t1, .li .t2 { white-space: normal; }
  .li .amt { font-size: 14px; }
  .grid.kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .k-val { font-size: 22px; }
  .li { padding: 12px 16px; }
  .card-h { padding: 16px 16px 0; }
  .card-b { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ======================================================================
   CLIENT SCAN PAGE (v.php) — mobile-first
   ====================================================================== */
.scan { background: var(--bg); min-height: 100vh; }
.scan-top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.scan-top .in { max-width: 480px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; }
.scan-top img { height: 40px; width: auto; display: block; }
.lang { display: inline-flex; padding: 3px; background: var(--tint-2); border-radius: 10px; }
.lang a { padding: 5px 11px; border-radius: 8px; font: 700 12px var(--head); color: var(--muted); }
.lang a.on { background: #fff; color: var(--p-700); box-shadow: var(--shadow-sm); }
.scan-hero { background: radial-gradient(100% 120% at 100% 0%, var(--p-400) 0%, var(--p-500) 45%, var(--p-700) 100%); color: #fff; }
.scan-hero .in { max-width: 480px; margin: 0 auto; padding: 16px 16px 60px; }
.scan-hero h1 { color: #fff; font-size: 19px; display: flex; align-items: center; gap: 8px; }
.domain { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 99px; padding: 4px 12px 4px 8px; font-size: 12.5px; }
.domain b { font-family: var(--head); }
.steps { display: flex; gap: 6px; margin-top: 14px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: rgba(255,255,255,.28); }
.steps span.on { background: #fff; }
.scan-main { max-width: 480px; margin: -44px auto 0; padding: 0 16px 24px; position: relative; }
.scan-card { background: #fff; border-radius: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.scan-card + .scan-card { margin-top: 14px; }
.scan-pad { padding: 18px; }

.idcard { display: flex; gap: 16px; align-items: center; padding: 16px; }
.idcard .photo { width: 104px; height: 128px; border-radius: 16px; object-fit: cover; flex: none; background: var(--p-50); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--p-200); }
.idcard .photo.init { display: grid; place-items: center; font: 800 38px var(--head); color: var(--p-300); }
.idcard .lab { font: 700 11px var(--head); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.idcard .nm { font: 800 20px/1.2 var(--head); margin: 2px 0 8px; }
.idcard .verified { display: inline-flex; align-items: center; gap: 5px; font: 700 12px var(--head); color: var(--p-700); background: var(--p-50); padding: 4px 9px; border-radius: 99px; }
.idcard .cardno { font-size: 13px; color: var(--muted); margin-top: 6px; }
.photo-hint { display: flex; gap: 10px; align-items: center; padding: 12px 16px; background: var(--surface-2); border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.photo-hint .ic { color: var(--p-500); }

.result { padding: 26px 20px 22px; text-align: center; color: #fff; }
.result .ring { width: 76px; height: 76px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; margin: 0 auto 14px; animation: pop .35s ease-out; }
.result .ring .ic { width: 40px; height: 40px; stroke-width: 2.6; }
.result h2 { color: #fff; font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
.result p { margin: 10px 0 0; color: rgba(255,255,255,.9); font-size: 15px; }
.result.stop { background: linear-gradient(160deg, #e0414e, var(--danger) 60%, #9c1c27); }
.result.approved { background: linear-gradient(160deg, #13a064, var(--approve) 60%, #075c37); }
.result.done { background: linear-gradient(160deg, var(--p-400), var(--p-500) 50%, var(--p-700)); }

.facts { padding: 6px 18px; }
.fact { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.fact:first-child { border-top: 0; }
.fact span { color: var(--muted); font-size: 14px; }
.fact b { font-family: var(--head); text-align: right; }
.fact b.big { font-size: 22px; font-weight: 800; color: var(--p-900); }

.secword { margin: 0 18px 18px; border-radius: 16px; padding: 16px; text-align: center; background: var(--p-50); border: 2px dashed var(--p-300); }
.secword .lab { font: 700 11px var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--p-700); }
.secword .w { font: 800 32px var(--head); letter-spacing: .12em; color: var(--p-900); margin: 4px 0; }
.secword p { margin: 0; font-size: 13px; color: var(--ink-2); }

.scan-form { padding: 18px; }
.scan-form .lbl { font: 700 15px var(--head); display: block; margin-bottom: 8px; }
.scan-form .help { font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin: 8px 0 16px; }

.callbox { padding: 18px; text-align: center; }
.callbox p { font-weight: 600; margin-bottom: 12px; }
.callbox .btn { margin-top: 8px; }
.receipt-ref { font: 800 26px ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; color: var(--p-900); }
.scan-foot { text-align: center; font-size: 12px; color: var(--muted); padding: 10px 16px 28px; }
.scan-foot b { color: var(--p-700); font-family: var(--head); }
.is-stop .scan-hero { background: linear-gradient(135deg, var(--p-850), var(--p-900)); }

/* offline banner */
.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 100; background: var(--danger); color: #fff; text-align: center; font: 600 13px var(--head); padding: 8px 12px; display: none; }
body.is-offline .offline-bar { display: block; }

/* spinner */
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.page-title-m { display: none; }
.page-title-m h1 { font-size: 22px; }
.page-title-m p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- PWA / app mode */
[hidden] { display: none !important; }
.only-standalone { display: none; }
html.standalone .only-standalone { display: inline-flex; }
html.standalone body { overscroll-behavior-y: none; }
html.standalone .sidebar, html.standalone .tabbar, html.standalone .topbar { -webkit-user-select: none; user-select: none; }
a, button { -webkit-tap-highlight-color: transparent; }
[data-refresh].spinning .ic { animation: rot .7s linear infinite; }
button[data-offline] { opacity: .55; }

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
.sidebar { view-transition-name: sidebar; }
.tabbar { view-transition-name: tabbar; }

.toast-act { margin-left: auto; background: #fff; color: var(--p-800); border: 0; border-radius: 8px; padding: 6px 12px; font: 700 13px var(--head); cursor: pointer; white-space: nowrap; }
.toast-act + .toast-x { margin-left: 4px; }

.install-card { position: fixed; z-index: 60; right: 24px; bottom: 24px; width: min(460px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 16px; border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--p-900), var(--p-700) 60%, var(--p-500)); color: #fff; box-shadow: var(--shadow-lg);
  animation: toast-in .3s ease-out; }
.install-card img { width: 48px; height: 48px; border-radius: 12px; flex: none; box-shadow: 0 6px 16px -6px rgba(0,0,0,.4); }
.install-card b { display: block; font: 700 14px var(--head); }
.install-card span { font-size: 12.5px; color: rgba(255,255,255,.82); line-height: 1.4; display: block; }
.install-card .grow { flex: 1; min-width: 0; }
.install-card .btn.primary { --b-bg: #fff; --b-fg: var(--p-700); --b-bd: #fff; box-shadow: none; }
.install-card .btn.primary:hover { background: var(--p-50); color: var(--p-700); }
.install-card .btn.ghost { --b-fg: rgba(255,255,255,.8); position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; }
.install-card .btn.ghost .ic { width: 14px; height: 14px; }
.install-card .btn.ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.install-card .btn.primary { margin-right: 18px; }
.steps-list { margin: 12px 0 0; padding-left: 20px; color: var(--ink-2); display: grid; gap: 8px; font-size: 14px; }
.steps-list .ic { color: var(--p-500); }
@media (max-width: 900px) {
  .install-card { left: 12px; right: 12px; width: auto; bottom: calc(80px + var(--safe-b)); flex-wrap: wrap; }
  .install-card .grow { flex-basis: calc(100% - 80px); padding-right: 16px; }
  .install-card .btn.primary { flex: 1; margin-right: 0; }
}
.grid.eq > .card .empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; }
.grid.eq > .card > .card-b.flush { display: flex; flex-direction: column; }
.grid.eq > .card > .card-b.flush > .empty { flex: 1; }

/* install card sits bottom-left on desktop so it never overlaps notifications */
.install-card{left:calc(var(--sidebar-w) + 24px);right:auto}
@media (max-width:900px){.install-card{left:12px;right:12px}}

/* ---------------------------------------------------------------- pager (v5.1) */
.pager { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
