/* Dina ERP — design system (shell-owned). Modules inject their own CSS via DH.ui.css(). */

/* =============================================================== tokens */
:root {
  color-scheme: light;
  --brand-950: #0c1638;
  --brand-900: #13235a;
  --brand-800: #1e3a8a;
  --brand-600: #2b52c4;
  --brand-500: #3b63d9;
  --brand-100: #e6ecfb;
  --brand-50: #f2f5fd;

  --primary: #1e3a8a;
  --primary-hover: #19316f;
  --primary-active: #152a60;
  --primary-soft: #e8eefc;
  --accent: #f59e0b;
  --accent-strong: #d97706;
  --accent-soft: #fff4dc;
  --ring: 0 0 0 3px rgba(59, 99, 217, .30);
  --ring-red: 0 0 0 3px rgba(220, 38, 38, .22);

  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f0f3f7;
  --border: #e2e7ef;
  --border-strong: #cdd5e1;
  --divider: #edf0f5;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;

  --blue: #1d4ed8;   --blue-soft: #eaf1ff;
  --teal: #0f766e;   --teal-soft: #e3f5f2;
  --pink: #be185d;   --pink-soft: #fdeaf3;
  --green: #15803d;  --green-soft: #e7f6ec;
  --red: #dc2626;    --red-soft: #fdecec;
  --amber: #b45309;  --amber-soft: #fff3df;
  --violet: #6d28d9; --violet-soft: #f1ecfe;
  --slate: #475569;  --slate-soft: #eef1f5;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 6px 16px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, .18), 0 4px 12px rgba(15, 23, 42, .08);

  --font: 'Inter', 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', 'Noto Sans Bengali', 'Nirmala UI', 'Vrinda', Roboto, Arial, sans-serif;
  --font-bn: 'Hind Siliguri', 'Noto Sans Bengali', 'Nirmala UI', 'Vrinda', system-ui, sans-serif;
  --font-num: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* phone chrome (SPEC §17): bottom nav, page action bar, storage banner — set by the shell / DH.ui */
  --bnav-h: 64px;
  --abar-h: 0px;
  --banner-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  --sb-w: 248px;
  --sb-mini-w: 68px;
  --topbar-h: 56px;
  --view-pad-x: 24px;
  --view-pad-y: 20px;

  /* brand flourish: paint-swatch stripe */
  --swatch: linear-gradient(90deg, #e5383b 0 14.3%, #f77f00 14.3% 28.6%, #fcbf49 28.6% 42.9%, #2a9d8f 42.9% 57.2%, #3a86ff 57.2% 71.5%, #5a4fcf 71.5% 85.8%, #d63384 85.8% 100%);
}

/* =============================================================== base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
body.modal-open, body.drawer-lock, body.scan-open { overflow: hidden; }
body.has-banner { padding-top: var(--banner-h); }
html { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { line-height: 1.3; color: var(--text); }
a { color: var(--brand-600); text-underline-offset: 2px; }
a:hover { color: var(--primary); }
img, svg { vertical-align: middle; }
.icon { flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
::selection { background: rgba(59, 99, 217, .2); }
* { scrollbar-width: thin; scrollbar-color: #c3ccd9 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c9d1dd; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #aab5c5; }
::-webkit-scrollbar-track { background: transparent; }
.bn { font-family: var(--font-bn); }

/* =============================================================== boot */
.boot { position: fixed; inset: 0; z-index: 950; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 16px; }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; animation: fadeIn .3s ease-out; }
.boot-inner img { border-radius: 16px; box-shadow: var(--shadow-md); }
.boot-name { font: 700 22px/1.2 var(--font-num); margin-top: 10px; letter-spacing: -.01em; }
.boot-name b { color: var(--primary); }
.boot-sub { color: var(--muted); font-family: var(--font-bn); }
.boot-bar { width: 168px; height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; margin-top: 14px; }
.boot-bar span { display: block; width: 42%; height: 100%; border-radius: 4px; background: var(--swatch); animation: bootbar 1.1s ease-in-out infinite; }
.boot-card { max-width: 480px; margin: 10vh auto; background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 28px 24px; text-align: center; box-shadow: var(--shadow-md); }
.boot-card img { border-radius: 14px; }
.boot-card h2 { margin: 14px 0 6px; font-size: 19px; }
.boot-card p { color: var(--muted); margin: 0 0 12px; }

/* =============================================================== app layout */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.view { flex: 1 1 auto; min-width: 0; padding: var(--view-pad-y) var(--view-pad-x) 32px; outline: none; }
.page-host { min-width: 0; animation: pageIn .16s ease-out; }
.page { max-width: 1680px; margin: 0 auto; min-width: 0; }
.page-narrow { max-width: 920px; margin: 0 auto; }
/* full-height pages (POS): fills the area below the topbar, no page scroll */
.page-fill {
  margin: calc(-1 * var(--view-pad-y)) calc(-1 * var(--view-pad-x)) -32px;
  height: calc(100vh - var(--topbar-h) - var(--banner-h));
  height: calc(100dvh - var(--topbar-h) - var(--banner-h));
  display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}

/* --------------------------------------------------------------- sidebar */
.sidebar {
  position: sticky; top: var(--banner-h); z-index: 40;
  width: var(--sb-w); flex: 0 0 var(--sb-w); height: calc(100vh - var(--banner-h)); height: calc(100dvh - var(--banner-h));
  display: flex; flex-direction: column; overflow: hidden;
  background: linear-gradient(180deg, #172a6b 0%, var(--brand-900) 38%, #0f1d4c 100%);
  color: #c9d3ef;
  transition: width .18s ease, flex-basis .18s ease;
}
.swatch-stripe { height: 4px; background: var(--swatch); flex: none; }
.sb-brand { padding: 14px 14px 12px; border-bottom: 1px solid rgba(255, 255, 255, .08); flex: none; }
.sb-brand-link { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; min-width: 0; border-radius: 10px; }
.sb-brand-link:hover { color: #fff; }
.sb-logo { width: 36px; height: 36px; border-radius: 9px; flex: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 4px 10px rgba(0, 0, 0, .25); }
.sb-brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sb-name { font: 700 16.5px/1.2 var(--font-num); letter-spacing: -.01em; color: #fff; }
.sb-name b { color: var(--accent); font-weight: 700; }
.sb-shop { font-size: 12px; color: #9fb0dc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.sb-nav { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 8px 10px 16px; scrollbar-color: rgba(255, 255, 255, .16) transparent; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); background-clip: padding-box; }
.nav-group + .nav-group { margin-top: 4px; }
.nav-group-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: none; border: 0; color: #8193c6; cursor: pointer;
  font: 600 12px/1 var(--font); letter-spacing: .05em; text-transform: uppercase;
  padding: 12px 10px 6px; border-radius: 6px;
}
.nav-group-head:hover { color: #e4e9f8; }
.nav-group-head .icon { transition: transform .15s ease; opacity: .8; }
.nav-group.collapsed .nav-group-head .icon { transform: rotate(-90deg); }
.nav-group.collapsed .nav-items { display: none; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 10px; margin: 1px 0; border-radius: 8px;
  color: #c9d3ef; text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item:focus-visible { outline: 2px solid rgba(255, 255, 255, .6); outline-offset: -2px; }
.nav-item.active { background: rgba(255, 255, 255, .13); color: #fff; font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05); }
.nav-item.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-ic { width: 22px; display: inline-flex; justify-content: center; flex: none; opacity: .88; }
.nav-item.active .nav-ic { color: var(--accent); opacity: 1; }
.nav-label { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sb-foot { flex: none; padding: 8px 10px 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sb-mini-toggle {
  display: flex; align-items: center; gap: 11px; width: 100%; height: 36px; padding: 0 10px;
  background: none; border: 0; border-radius: 8px; color: #9fb0dc; cursor: pointer; font: 500 13px var(--font); white-space: nowrap;
}
.sb-mini-toggle .icon { width: 22px; transition: transform .18s ease; }
.sb-mini-toggle:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sb-ver { font-size: 11px; color: #6577ab; padding: 4px 10px 0; white-space: nowrap; font-family: var(--font-num); }
.sidebar-backdrop { display: none; }

@media (min-width: 961px) {
  .app.sb-mini .sidebar { width: var(--sb-mini-w); flex-basis: var(--sb-mini-w); }
  .app.sb-mini .sb-brand { padding: 14px 16px 12px; }
  .app.sb-mini .sb-brand-text, .app.sb-mini .nav-label, .app.sb-mini .nav-group-head, .app.sb-mini .sb-ver { display: none; }
  .app.sb-mini .nav-group.collapsed .nav-items { display: block; }
  .app.sb-mini .nav-group + .nav-group { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 4px; margin-top: 6px; }
  .app.sb-mini .nav-item { justify-content: center; padding: 0; }
  .app.sb-mini .nav-item.active::before { left: -10px; }
  .app.sb-mini .sb-mini-toggle { justify-content: center; padding: 0; }
  .app.sb-mini .sb-mini-toggle .icon { transform: rotate(180deg); }
}

/* --------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: var(--banner-h); z-index: 30; height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 10px; padding: 0 16px 0 12px;
  background: rgba(255, 255, 255, .9); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
}
.tb-menu { flex: none; color: var(--text-2); }
.topbar .tb-back, .topbar .tb-logo { display: none; flex: none; }
.tb-logo img { width: 32px; height: 32px; border-radius: 9px; box-shadow: 0 0 0 1px rgba(15, 23, 42, .06); }
.tb-title { display: none; min-width: 0; flex: 1 1 auto; }
.tb-h { margin: 0; font-size: 16.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search { position: relative; flex: 0 1 460px; min-width: 0; }
.tb-search input {
  width: 100%; height: 38px; padding: 0 74px 0 36px; border-radius: 10px;
  background: var(--surface-3); border: 1px solid transparent; outline: none; font-size: 14px;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.tb-search input::placeholder { color: var(--faint); }
.tb-search input:hover { border-color: var(--border); }
.tb-search input:focus { background: #fff; border-color: var(--brand-500); box-shadow: var(--ring); }
.tb-search input::-webkit-search-cancel-button { display: none; }
.tb-search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); display: flex; pointer-events: none; }
.tb-search-kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); pointer-events: none; opacity: .85; }
.tb-search input:focus ~ .tb-search-kbd { display: none; }
.topbar .tb-search-close, .topbar .tb-search-btn { display: none; }
.tb-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.tb-new { height: 36px; }
.tb-kbd { margin-left: 2px; }
.tb-net {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--border); background: #fff; cursor: pointer;
  font: 600 12.5px/1 var(--font); color: var(--text-2); white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.tb-net:hover { background: var(--surface-2); border-color: var(--border-strong); }
.net-dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .18); flex: none; }
.tb-net.has-ic .net-dot { display: none; }
.net-off .net-dot { background: #94a3b8; box-shadow: 0 0 0 3px rgba(148, 163, 184, .22); }
.net-err .net-dot { background: var(--red); box-shadow: 0 0 0 3px rgba(220, 38, 38, .2); }
.net-busy .net-dot { background: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .2); animation: pulse 1.1s ease-in-out infinite; }
.net-pend .net-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .22); }
.net-pend .icon { color: var(--amber); }
.net-ok .icon { color: var(--green); }
.net-off { color: var(--muted); background: var(--surface-3); border-color: var(--border); }
.net-off .icon { color: var(--muted); }
.net-err { color: var(--red); border-color: #f4c3c3; background: var(--red-soft); }
.net-busy .icon { color: var(--blue); animation: spin 1s linear infinite; }
.tb-lang { height: 34px; padding: 0 10px; gap: 5px; font-weight: 600; color: var(--text-2); }
.tb-user {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 3px 10px 3px 4px;
  border-radius: 999px; border: 1px solid var(--border); background: #fff; cursor: pointer; color: var(--muted);
  transition: background .12s, border-color .12s;
}
.tb-user:hover { background: var(--surface-2); border-color: var(--border-strong); }
.tb-user-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; max-width: 140px; }
.tb-user-text b { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-user-text small { font-size: 11.5px; color: var(--muted); }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--av, var(--primary)); color: #fff; font: 700 12.5px/1 var(--font); letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.avatar.xl { width: 64px; height: 64px; font-size: 23px; }

/* =============================================================== typography & utilities */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-blue { color: var(--blue); }
.small { font-size: 12.5px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mono { font-family: var(--mono); font-size: .92em; }
.num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.money.neg, .neg { color: var(--red); }
.center { text-align: center; }
.right { text-align: right; }
.spacer { flex: 1 1 auto; }
.divider { height: 1px; border: 0; background: var(--divider); margin: 12px 0; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.row-nowrap { flex-wrap: nowrap; }
.col { flex: 1 1 0; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack-sm { gap: 8px; }
.stack-lg { gap: 20px; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; min-width: 0; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); vertical-align: middle; flex: none; }
.swatch-lg { width: 40px; height: 40px; border-radius: 10px; }

/* --------------------------------------------------------------- page header */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; min-width: 0; }
.ph-text { min-width: 0; }
.ph-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.ph-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------- card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; min-height: 52px; border-bottom: 1px solid var(--divider); }
.card-head h2, .card-head h3, .card-title { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .muted { font-size: 13px; }
.card-body { padding: 16px; }
.card-body.p-0, .card-body.flush { padding: 0; }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--divider); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card > .table-wrap, .card-body.flush > .table-wrap { border: 0; border-radius: 0 0 var(--radius) var(--radius); }

/* --------------------------------------------------------------- buttons */
.btn {
  --h: 36px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--h); padding: 0 14px; border-radius: var(--radius); border: 1px solid transparent;
  font: 600 14px/1 var(--font); white-space: nowrap; cursor: pointer; text-decoration: none; user-select: none;
  background: var(--surface-3); color: var(--text-2);
  transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease, transform .06s ease;
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(30, 58, 138, .28), inset 0 1px 0 rgba(255, 255, 255, .08); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: #fff; }
.btn-primary:active:not(:disabled) { background: var(--primary-active); }
.btn-secondary { background: #fff; color: var(--text-2); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: #b5c0d0; color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 1px 2px rgba(220, 38, 38, .25); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; color: #fff; }
.btn-danger:focus-visible { box-shadow: var(--ring-red); }
.btn-success { background: #16a34a; color: #fff; box-shadow: 0 1px 2px rgba(22, 163, 74, .28); }
.btn-success:hover:not(:disabled) { background: #12813b; color: #fff; }
.btn-accent { background: var(--accent); color: #1f1300; }
.btn-accent:hover:not(:disabled) { background: var(--accent-strong); color: #fff; }
.btn-sm { --h: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; gap: 5px; }
.btn-lg { --h: 46px; padding: 0 20px; font-size: 15.5px; border-radius: 10px; }
.btn-xl { --h: 56px; padding: 0 24px; font-size: 18px; border-radius: 12px; }
.btn-icon { width: var(--h); padding: 0; }
.btn-block { display: flex; width: 100%; }
.btn kbd { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); color: inherit; }
.btn-secondary kbd, .btn-ghost kbd { background: var(--surface-2); border-color: var(--border-strong); color: var(--muted); }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .6s linear infinite;
}
.btn-group { display: inline-flex; }
.btn-group > .btn { border-radius: 0; }
.btn-group > .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.btn-group > .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group > .btn + .btn { margin-left: -1px; }

/* --------------------------------------------------------------- forms */
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 11px; min-width: 0;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: #fff; color: var(--text);
  font: 400 14px/1.4 var(--font); transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.textarea { height: auto; min-height: 76px; padding: 8px 11px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  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='%2364748b' 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 10px center; background-size: 16px;
}
.input:hover, .select:hover, .textarea:hover { border-color: #b5c0d0; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input[readonly], .textarea[readonly] { background: var(--surface-2); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; }
.input.num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.input.is-invalid, .field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--red); }
.input.is-invalid:focus, .field.has-error .input:focus, .field.has-error .select:focus, .field.has-error .textarea:focus { box-shadow: var(--ring-red); }
.input-sm, .select-sm { height: 32px; font-size: 13px; padding-left: 9px; }
.select-sm { padding-right: 28px; background-position: right 8px center; }
.input-lg { height: 46px; font-size: 16px; padding: 0 14px; border-radius: 10px; }
.input-color { width: 64px; padding: 3px; cursor: pointer; }
.input[type="date"] { font-family: var(--font-num); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
.input-affix { position: relative; display: flex; min-width: 0; }
.input-affix .affix {
  position: absolute; left: 1px; top: 1px; bottom: 1px; width: 32px; z-index: 1;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
  color: var(--muted); font-weight: 600; background: var(--surface-2); border-right: 1px solid var(--border);
  border-radius: calc(var(--radius) - 1px) 0 0 calc(var(--radius) - 1px);
}
.input-affix .input { padding-left: 42px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.req { color: var(--red); }
.hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.field-error { display: none; font-size: 12.5px; color: var(--red); font-weight: 500; line-height: 1.35; }
.field.has-error .field-error { display: block; }
.field.has-error .hint { display: none; }
.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; line-height: 1.45; user-select: none; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; cursor: pointer; }
.field-checkbox { justify-content: center; padding: 4px 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.cols-1, .modal-sm .form-grid { grid-template-columns: minmax(0, 1fr); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; grid-column: 1 / -1; margin-top: 4px; padding-bottom: 6px; border-bottom: 1px solid var(--divider); }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; flex: none; }
.seg button { border: 0; background: none; height: 30px; padding: 0 12px; border-radius: 7px; font: 600 13px/1 var(--font); color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.active, .seg button[aria-pressed="true"] { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* --------------------------------------------------------------- badges, chips, kbd */
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 999px;
  font: 600 12px/1 var(--font); white-space: nowrap; vertical-align: middle;
  background: var(--slate-soft); color: var(--slate);
}
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }
.badge-slate, .badge-gray { background: var(--slate-soft); color: var(--slate); }
.badge-solid { background: var(--primary); color: #fff; }
.tone-red { background: var(--red-soft); color: var(--red); }
.tone-green { background: var(--green-soft); color: var(--green); }
.tone-amber { background: var(--amber-soft); color: var(--amber); }
.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-slate { background: var(--slate-soft); color: var(--slate); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; flex: none;
  border-radius: 999px; border: 1px solid var(--border-strong); background: #fff; color: var(--text-2);
  font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { border-color: #b5c0d0; background: var(--surface-2); color: var(--text); }
.chip.active, .chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .swatch { width: 12px; height: 12px; border-radius: 50%; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: #fff; color: var(--muted);
  font: 600 11px/1 var(--font-num);
}
.kbd-group { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.kbd-plus { font-size: 11px; color: var(--faint); }

/* --------------------------------------------------------------- key/value list */
.kv { display: flex; flex-direction: column; }
.kv-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--divider); }
.kv-row:last-child { border-bottom: 0; }
.kv-row > :first-child { color: var(--muted); }
.kv-row > :last-child { font-weight: 600; text-align: right; }
.kv-row.total { border-top: 1px solid var(--border); border-bottom: 0; font-size: 16px; }
.kv-row.total > * { color: var(--text); font-weight: 700; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; text-align: right; font-weight: 600; min-width: 0; }

/* --------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 14px; margin-bottom: -1px;
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted);
  font: 600 14px/1 var(--font); cursor: pointer; white-space: nowrap; transition: color .12s, border-color .12s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(59, 99, 217, .35); border-radius: 6px 6px 0 0; }
.tab-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--slate-soft); color: var(--slate); font: 600 11.5px/20px var(--font-num); text-align: center; }
.tab.active .tab-badge { background: var(--primary-soft); color: var(--primary); }

/* --------------------------------------------------------------- empty, loading, stat */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-ic { width: 58px; height: 58px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text); }
.empty-text { font-size: 13.5px; margin-top: 4px; max-width: 440px; line-height: 1.55; }
.empty-action { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 32px; color: var(--muted); }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .7s linear infinite; flex: none; }
.stat {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 16px; min-width: 0; overflow: hidden;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs);
  --tone: var(--blue); --tone-soft: var(--blue-soft);
}
.stat.is-click { cursor: pointer; transition: box-shadow .14s ease, border-color .14s ease, transform .14s ease; }
.stat.is-click:hover { border-color: #c5cfdf; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat.is-click:focus-visible { outline: none; box-shadow: var(--ring); }
.stat-ic { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; background: var(--tone-soft); color: var(--tone); }
.stat-main { min-width: 0; flex: 1; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 500; line-height: 1.35; }
.stat-value { font: 700 22px/1.25 var(--font-num); letter-spacing: -.015em; color: var(--text); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat-blue { --tone: var(--blue); --tone-soft: var(--blue-soft); }
.stat-green { --tone: var(--green); --tone-soft: var(--green-soft); }
.stat-red { --tone: var(--red); --tone-soft: var(--red-soft); }
.stat-amber { --tone: var(--amber); --tone-soft: var(--amber-soft); }
.stat-violet { --tone: var(--violet); --tone-soft: var(--violet-soft); }
.stat-slate { --tone: var(--slate); --tone-soft: var(--slate-soft); }

/* --------------------------------------------------------------- tables */
.dt { min-width: 0; }
.dt-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.dt-search { position: relative; flex: 1 1 260px; max-width: 380px; min-width: 0; }
.dt-search .input { padding-left: 34px; }
.dt-search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); display: flex; pointer-events: none; }
.dt-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dt-count { margin-left: auto; font-size: 12.5px; white-space: nowrap; }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; min-width: 0; -webkit-overflow-scrolling: touch; }
.dt .table-wrap { max-height: var(--table-max-h, calc(100vh - 210px)); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  position: sticky; top: 0; z-index: 2; background: #f6f8fb; color: var(--text-2);
  font-weight: 600; font-size: 12.5px; text-align: left; padding: 9px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 9px 12px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.table tbody tr:nth-child(even) > td { background: #fbfcfe; }
.table tbody tr:hover > td { background: #f1f5ff; }
.table tbody tr:last-child > td { border-bottom: 0; }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.table tfoot td { position: sticky; bottom: 0; z-index: 2; background: #f6f8fb; font-weight: 700; padding: 10px 12px; border-top: 1px solid var(--border); white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.table th.num .th-in { flex-direction: row-reverse; }
.table th.center, .table td.center { text-align: center; }
.table-dense td { padding: 6px 10px; }
.table-dense th { padding: 7px 10px; }
.table .dt-empty-row td, .table .dt-empty-row:hover td { background: #fff; cursor: default; padding: 4px; }
.table td .sub, .cell-sub { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; }
.table td a { font-weight: 600; text-decoration: none; }
.table td a:hover { text-decoration: underline; }
.table tr.row-void > td, .table tr.row-muted > td { color: var(--faint); }
.table tr.row-void > td .num, .table tr.row-void > td.num { text-decoration: line-through; }
.table tr.row-warn > td { background: #fffaf0; }
.table tr.row-danger > td { background: #fff6f6; }
.th-in { display: inline-flex; align-items: center; gap: 4px; }
.table th.sortable { cursor: pointer; user-select: none; transition: color .12s; }
.table th.sortable:hover { color: var(--text); }
.table th.sortable:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.sort-ic { display: inline-block; width: 8px; height: 10px; opacity: .3; flex: none;
  background: linear-gradient(135deg, transparent 50%, currentColor 50%) 0 0 / 4px 4px no-repeat,
              linear-gradient(-135deg, transparent 50%, currentColor 50%) 4px 0 / 4px 4px no-repeat,
              linear-gradient(45deg, transparent 50%, currentColor 50%) 0 6px / 4px 4px no-repeat,
              linear-gradient(-45deg, transparent 50%, currentColor 50%) 4px 6px / 4px 4px no-repeat; }
.table th.sorted .sort-ic { opacity: 1; color: var(--primary);
  background: linear-gradient(135deg, transparent 50%, currentColor 50%) 0 2px / 4px 4px no-repeat,
              linear-gradient(-135deg, transparent 50%, currentColor 50%) 4px 2px / 4px 4px no-repeat; }
.table th.sorted.desc .sort-ic {
  background: linear-gradient(45deg, transparent 50%, currentColor 50%) 0 4px / 4px 4px no-repeat,
              linear-gradient(-45deg, transparent 50%, currentColor 50%) 4px 4px / 4px 4px no-repeat; }
.dt-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.dt-range { font-size: 12.5px; font-family: var(--font-num); }
.dt-pages { display: flex; align-items: center; gap: 3px; }
.dt-pages .btn-sm:not(.btn-icon) { min-width: 32px; padding: 0 8px; font-family: var(--font-num); }
.dt-gap { padding: 0 4px; color: var(--faint); }

/* --------------------------------------------------------------- date range */
.daterange { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.dr-ic { color: var(--muted); display: flex; }
.daterange .select { width: auto; min-width: 140px; }
.daterange .input { width: 142px; }
.dr-sep { color: var(--faint); }

/* --------------------------------------------------------------- modal */
#modal-root { position: relative; z-index: 1000; }
.modal-overlay {
  position: fixed; inset: 0; top: var(--banner-h); z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; overflow-y: auto; background: rgba(15, 23, 42, .48);
  animation: fadeIn .14s ease-out;
}
.modal-overlay.leaving { animation: fadeOut .14s ease-in forwards; pointer-events: none; }
.modal {
  position: relative; width: 100%; max-width: 580px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  display: flex; flex-direction: column; background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); outline: none;
  animation: popIn .18s cubic-bezier(.2, .8, .2, 1);
}
.modal-sm { max-width: 420px; }
.modal-md { max-width: 580px; }
.modal-lg { max-width: 840px; }
.modal-xl { max-width: 1140px; }
.modal-full { max-width: none; width: calc(100vw - 32px); height: calc(100vh - 48px); height: calc(100dvh - 48px); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 20px; border-bottom: 1px solid var(--divider); flex: none; }
.sheet-handle, .modal-back { display: none; }
.modal-title { margin: 0; flex: 1; min-width: 0; font-size: 17px; font-weight: 700; }
.modal-x { color: var(--muted); }
.modal-body { padding: 18px 20px 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 16px; flex: none; border-top: 1px solid var(--divider); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.modal.is-busy .modal-body { opacity: .65; pointer-events: none; transition: opacity .12s; }
.modal.nudge { animation: nudge .28s ease; }
.confirm-body { display: flex; gap: 14px; align-items: flex-start; }
.confirm-body p { margin: 2px 0 0; white-space: pre-line; line-height: 1.6; font-size: 14.5px; color: var(--text-2); }
.confirm-ic { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }
.confirm-body.is-danger .confirm-ic { background: var(--red-soft); color: var(--red); }

/* --------------------------------------------------------------- popovers & pickers */
.popover {
  position: fixed; z-index: 1100; min-width: 160px; overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  animation: dropIn .1s ease-out;
}
.popover.up { animation-name: dropUp; }
.picker { position: relative; min-width: 0; }
.picker .picker-input { padding-left: 38px; padding-right: 46px; }
.picker .picker-input.input-lg { padding-left: 42px; }
.picker-input::-webkit-search-cancel-button { cursor: pointer; }
.picker-ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); display: flex; pointer-events: none; }
.picker-hint { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.picker-input:focus ~ .picker-hint, .picker-input:not(:placeholder-shown) ~ .picker-hint { display: none; }
.picker-pop { padding: 4px; }
.pp-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; min-width: 0; }
.pp-item.hi { background: var(--primary-soft); }
.pp-sw { width: 32px; height: 32px; border-radius: 8px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.pp-sw-ic { display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--muted); box-shadow: none; }
.pp-item.hi .pp-sw-ic { background: #fff; color: var(--primary); }
.pp-main { flex: 1 1 auto; min-width: 0; }
.pp-name { font-weight: 600; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-bn { font-weight: 400; color: var(--muted); font-size: 13px; }
.pp-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; }
.pp-price { font: 600 13.5px/1.3 var(--font-num); font-variant-numeric: tabular-nums; color: var(--text); }
.pp-unit { color: var(--muted); font-weight: 400; font-size: 12px; }
.pp-stock { font-size: 12px; color: var(--green); font-weight: 500; }
.pp-stock.low { color: var(--amber); }
.pp-stock.out { color: var(--red); }
.pp-cost { font-size: 11.5px; color: var(--faint); font-family: var(--font-num); }
.pp-none { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 20px 12px; color: var(--muted); }
.gs-group { padding: 10px 10px 4px; font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.gs-group:first-child { padding-top: 6px; }
.pk-side { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; max-width: 60%; }
.pk-bal { font: 600 12px/1 var(--font); padding: 5px 8px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pk-clear { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; flex: none; border: 0; border-radius: 6px; background: none; color: var(--faint); cursor: pointer; }
.pk-clear:hover { color: var(--text); background: var(--surface-3); }
.party-picker.has-value .picker-input { padding-right: 168px; font-weight: 600; }
.pk-new {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 10px; margin-top: 4px;
  border: 0; border-top: 1px solid var(--divider); border-radius: 0 0 8px 8px; background: none;
  color: var(--primary); font: 600 14px/1.2 var(--font); cursor: pointer; text-align: left;
}
.pk-new:hover, .pk-new.hi { background: var(--primary-soft); }
.menu-pop { padding: 6px; }
.um-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--divider); }
.um-head b, .um-head small { display: block; }
.um-head b { font-size: 14px; }
.um-head small { color: var(--muted); font-size: 12px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px;
  border: 0; border-radius: 8px; background: none; color: var(--text-2); cursor: pointer;
  font: 500 14px/1 var(--font); text-align: left; white-space: nowrap;
}
.menu-item .icon { color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); color: var(--text); outline: none; }
.menu-item.danger, .menu-item.danger .icon { color: var(--red); }
.menu-item.danger:hover { background: var(--red-soft); }
.menu-sep { height: 1px; margin: 4px 2px; background: var(--divider); }

/* --------------------------------------------------------------- toasts */
#toast-root {
  position: fixed; right: 16px; bottom: 16px; z-index: 1200; display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  max-width: calc(100vw - 32px); pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px; min-width: 260px; max-width: 420px; padding: 11px 8px 11px 14px;
  border-radius: 10px; background: #111c33; color: #f1f5f9; box-shadow: var(--shadow-lg); pointer-events: auto;
  font-size: 14px; line-height: 1.45; opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast.leaving { opacity: 0; transform: translateY(6px); }
.toast-ic { display: flex; margin-top: 1px; }
.toast-success .toast-ic { color: #4ade80; }
.toast-error { background: #3a0f12; }
.toast-error .toast-ic { color: #fca5a5; }
.toast-warn .toast-ic { color: #fbbf24; }
.toast-info .toast-ic { color: #93c5fd; }
.toast-msg { flex: 1; min-width: 0; word-break: break-word; }
.toast-x { display: flex; padding: 3px; margin-top: -1px; border: 0; border-radius: 5px; background: none; color: #8b98ad; cursor: pointer; }
.toast-x:hover { color: #fff; background: rgba(255, 255, 255, .1); }
/* While a dialog is open its action footer sits at the bottom (bottom sheet on phones, tall dialogs on desktop):
   toasts move to the top so an error never covers Save / Cancel. */
body.modal-open #toast-root { top: 16px; bottom: auto; }
body.modal-open .toast:not(.show), body.modal-open .toast.leaving { transform: translateY(-8px); }

/* --------------------------------------------------------------- charts */
.chart { position: relative; width: 100%; min-width: 0; }
.c-svg { display: block; overflow: visible; }
.c-grid { stroke: #e9edf3; stroke-width: 1; shape-rendering: crispEdges; }
.c-base { stroke: #c4ccd8; stroke-width: 1; shape-rendering: crispEdges; }
.c-tick { font: 500 11px/1 var(--font-num); fill: #7b8698; }
.c-wash { fill: rgba(30, 58, 138, .06); }
.c-cross { stroke: #9aa6b8; stroke-width: 1; shape-rendering: crispEdges; }
.c-dot { stroke: #fff; stroke-width: 2; }
.c-seg { stroke: #fff; stroke-width: 2; transition: opacity .12s; }
.c-seg.dim { opacity: .3; }
.c-empty-ring { stroke: var(--surface-3); }
.c-center-val { font: 700 18px/1 var(--font-num); fill: var(--text); }
.c-center-label { font: 500 11.5px/1 var(--font); fill: var(--muted); }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 120px; white-space: nowrap;
  padding: 8px 10px; border-radius: 8px; background: #111c33; color: #fff; box-shadow: var(--shadow-md); font-size: 12.5px;
}
.ct-title { color: #b9c4d6; font-size: 11.5px; margin-bottom: 3px; }
.ct-row { display: flex; align-items: center; gap: 8px; line-height: 1.7; }
.ct-key { flex: none; }
.ct-key.line { width: 12px; height: 3px; border-radius: 2px; }
.ct-key.rect { width: 10px; height: 10px; border-radius: 3px; }
.ct-val { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 700; }
.ct-name { color: #b9c4d6; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); }
.cl-item { display: inline-flex; align-items: center; gap: 6px; }
.cl-key { display: inline-block; flex: none; }
.cl-key.rect { width: 10px; height: 10px; border-radius: 3px; }
.cl-key.line { width: 14px; height: 3px; border-radius: 2px; }
.donut { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.donut.wide { flex-direction: row; gap: 24px; }
.donut-legend { flex: 1 1 auto; width: 100%; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dl-row { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 38px; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; font-size: 13px; transition: opacity .12s; }
.dl-row:hover { background: var(--surface-2); }
.dl-row.dim { opacity: .4; }
.dl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.dl-val { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 600; }
.dl-pct { text-align: right; color: var(--muted); font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- misc helpers */
.sticky-bottom {
  position: sticky; bottom: 0; z-index: 5; padding: 12px 16px;
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--border); box-shadow: 0 -6px 16px rgba(15, 23, 42, .06);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.error-card { border-color: #f1c4c4; }
.ec-head { display: flex; gap: 14px; align-items: flex-start; }
.ec-head h2 { margin: 0 0 4px; font-size: 17px; }
.ec-head p { margin: 0; }
.ec-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--red-soft); color: var(--red); display: flex; align-items: center; justify-content: center; flex: none; }
.ec-pre { margin: 14px 0; padding: 10px 12px; max-height: 220px; overflow: auto; text-align: left; background: var(--surface-3); border: 1px solid var(--border); border-radius: 8px; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); border: 1px solid; font-size: 13.5px; line-height: 1.5; }
.alert-info { background: var(--blue-soft); border-color: #c9d9fb; color: #1e3a8a; }
.alert-warn { background: var(--amber-soft); border-color: #f6d8a4; color: #7c3d06; }
.alert-danger { background: var(--red-soft); border-color: #f4c3c3; color: #8f1d1d; }
.alert-success { background: var(--green-soft); border-color: #b8e3c6; color: #14532d; }
.print-root { position: fixed; width: 0; height: 0; overflow: hidden; }
.show-mobile { display: none; }

/* =============================================================== login / lock / setup */
.auth-root { position: fixed; inset: 0; top: var(--banner-h); z-index: 1150; overflow-y: auto; background: var(--bg); } /* above modals: lock must cover open dialogs */
.auth-root.is-setup { z-index: 990; } /* setup wizard is not a lock: its dialogs (restore, cloud connect) must show above it */
.auth-root.is-overlay { background: rgba(236, 240, 247, .86); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); animation: fadeIn .2s ease-out; }
.auth { display: grid; grid-template-columns: minmax(360px, 42%) minmax(0, 1fr); min-height: 100%; }
.auth-brand {
  position: relative; display: flex; flex-direction: column; overflow: hidden; color: #fff;
  background: radial-gradient(120% 70% at 10% 0%, #2c4fb5 0%, rgba(44, 79, 181, 0) 60%), linear-gradient(165deg, #1e3a8a 0%, #13235a 62%, #0d1840 100%);
}
.auth-brand::after {
  content: ''; position: absolute; right: -130px; bottom: -130px; width: 380px; height: 380px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(#e5383b, #f77f00, #fcbf49, #2a9d8f, #3a86ff, #5a4fcf, #d63384, #e5383b);
  -webkit-mask: radial-gradient(circle, transparent 54%, #000 55%); mask: radial-gradient(circle, transparent 54%, #000 55%);
  opacity: .16;
}
.auth-brand .swatch-stripe { height: 6px; }
.ab-inner { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 48px 52px 24px; }
.ab-logo { width: 72px; height: 72px; border-radius: 18px; box-shadow: 0 12px 32px rgba(0, 0, 0, .28), 0 0 0 1px rgba(255, 255, 255, .12); margin-bottom: 26px; }
.ab-text { min-width: 0; }
.ab-name { font: 700 30px/1.15 var(--font-num); letter-spacing: -.02em; }
.ab-name-bn { font: 600 22px/1.4 var(--font-bn); color: #cad6f6; margin-top: 6px; }
.ab-tag { margin-top: 14px; color: #9fb2e2; font-size: 14px; letter-spacing: .02em; }
.ab-clock { margin-top: 44px; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .12); max-width: 360px; }
.ab-time { font: 600 42px/1 var(--font-num); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ab-date { color: #b8c6ec; margin-top: 10px; font-size: 15px; }
.ab-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 16px 52px 26px; color: #8fa2d6; font-size: 13px; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 32px 20px; min-width: 0; }
.auth-card { width: 100%; max-width: 460px; padding: 30px 28px; background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-md); animation: popIn .2s ease-out; }
.auth-h { margin: 0; font-size: 22px; font-weight: 700; text-align: center; }
.auth-sub { margin: 4px 0 22px; text-align: center; color: var(--muted); }
.auth-foot { display: flex; gap: 8px; }
.user-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 12px; }
.user-tile {
  display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 18px 10px 14px; min-width: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 14px; cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.user-tile:hover { border-color: var(--brand-500); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.user-tile:focus-visible { outline: none; border-color: var(--brand-500); box-shadow: var(--ring); }
.ut-name { font-weight: 600; color: var(--text); text-align: center; line-height: 1.3; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ut-role { font-size: 12.5px; color: var(--muted); margin-top: -3px; }
.pin-step { position: relative; display: flex; flex-direction: column; align-items: center; }
.pin-back { position: absolute; left: -10px; top: -12px; }
.pin-user { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 10px; }
.pin-name { font-size: 19px; font-weight: 700; }
.pin-role { margin-top: -6px; color: var(--muted); font-size: 13.5px; }
.pin-dots { display: flex; gap: 14px; height: 16px; margin: 22px 0 8px; }
.pin-dots.shake { animation: shake .36s ease; }
.pin-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); transition: background .1s, border-color .1s, transform .1s; }
.pin-dot.on { background: var(--primary); border-color: var(--primary); transform: scale(1.08); }
.pin-msg { min-height: 21px; margin-bottom: 10px; color: var(--red); font-size: 13.5px; font-weight: 500; text-align: center; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; justify-content: center; }
.pin-key {
  display: flex; align-items: center; justify-content: center; width: 76px; height: 60px; border-radius: 16px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer;
  font: 600 24px/1 var(--font-num); transition: background .08s, transform .06s, border-color .1s, box-shadow .1s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.pin-key:hover { background: #fff; border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.pin-key:active { transform: scale(.95); background: var(--primary-soft); }
.pin-key:focus-visible { outline: none; box-shadow: var(--ring); }
.pin-fn { background: transparent; border-color: transparent; color: var(--muted); }
.pin-ok { background: var(--primary); border-color: var(--primary); color: #fff; }
.pin-ok:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.pin-ok:active { background: var(--primary-active); }
.pin-help { margin-top: 18px; font-size: 12.5px; text-align: center; }

.auth-root.is-setup { background: linear-gradient(180deg, #e3e9f8 0, var(--bg) 360px); }
.setup { min-height: 100%; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 32px; }
.setup-card { width: 100%; max-width: 740px; background: #fff; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-md); overflow: hidden; animation: popIn .22s ease-out; }
.setup-card .swatch-stripe { height: 6px; }
.setup-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 26px 28px 6px; }
.setup-head img { border-radius: 13px; box-shadow: var(--shadow-sm); flex: none; }
.setup-title { flex: 1 1 260px; min-width: 0; }
.setup-title h1 { margin: 0; font-size: 21px; font-weight: 700; }
.setup-title p { margin: 4px 0 0; color: var(--muted); }
.stepper { display: flex; gap: 8px; list-style: none; margin: 18px 28px 0; padding: 0; }
.stepper li { flex: 1 1 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; min-width: 0; background: var(--surface-2); border: 1px solid transparent; color: var(--muted); font-weight: 600; }
.stepper li.active { background: var(--primary-soft); border-color: #cfdaf7; color: var(--primary); }
.stepper li.done { color: var(--green); }
.st-n { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; background: #fff; border: 1px solid var(--border-strong); font: 700 13px/1 var(--font-num); }
.stepper li.active .st-n { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper li.done .st-n { background: var(--green); border-color: var(--green); color: #fff; }
.setup-body { position: relative; padding: 22px 28px 6px; min-height: 180px; }
.setup-bottom { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 18px 28px 24px; }
.setup-alt { display: flex; align-items: center; gap: 2px 4px; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.setup-alt-h { font-size: 12.5px; color: var(--faint); margin-right: 4px; }
.setup-foot { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.setup-restore { position: relative; cursor: pointer; color: var(--muted); }
.setup-busy { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .9); border-radius: 8px; }

/* =============================================================== phone-first components (SPEC §17)
   Visible on every size unless noted; the phone-only layout is in the (max-width: 767.98px) block below. */

/* --------------------------------------------------------------- storage banner (DB not saving) */
.db-banner {
  position: fixed; left: 0; right: 0; top: 0; z-index: 1250;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px;
  background: #b91c1c; color: #fff; font-size: 13.5px; line-height: 1.4; box-shadow: 0 2px 8px rgba(127, 29, 29, .3);
}
.dbb-ic { display: flex; flex: none; }
.dbb-t { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; }
.dbb-t b { font-size: 14.5px; }
.dbb-t span { opacity: .92; }
.dbb-acts { display: flex; gap: 8px; flex: none; }
.dbb-btn { height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .12); color: #fff; font: 600 13.5px/1 var(--font); cursor: pointer; white-space: nowrap; }
.dbb-btn:hover, .dbb-btn:active { background: rgba(255, 255, 255, .24); }
.howto { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; line-height: 1.55; color: var(--text-2); }

/* --------------------------------------------------------------- go-live strip (SPEC §19) */
.golive-strip {
  display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 9px 14px; border-radius: 10px;
  background: #fff7e6; border: 1px solid #fcd9a0; color: #8a4b00; font-size: 13.5px; line-height: 1.4; text-decoration: none;
}
.golive-strip:hover, .golive-strip:active { background: #ffefd1; }
.gls-ic { display: flex; flex: none; color: #d97706; }
.gls-t { flex: 1; min-width: 0; }
.gls-go { display: inline-flex; align-items: center; gap: 2px; flex: none; font-weight: 600; color: #b45309; }
@media (max-width: 767.98px) {
  .golive-strip { margin: 0 0 10px; border-radius: 0; border-left: 0; border-right: 0; font-size: 13px; }
}

/* --------------------------------------------------------------- page action bar + FAB */
.action-bar {
  position: fixed; z-index: 45; left: var(--sb-w); right: 0; bottom: 0;
  padding: 10px 24px calc(10px + var(--safe-b)); background: #fff; border-top: 1px solid var(--border);
  box-shadow: 0 -4px 14px rgba(15, 23, 42, .06);
}
.app.sb-mini .action-bar { left: var(--sb-mini-w); }
.abar-inner { max-width: 1680px; margin: 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; min-width: 0; }
body.has-abar .view { padding-bottom: calc(var(--abar-h) + 28px); }
.fab { display: none; }
.fab.fab-all {
  display: inline-flex; position: fixed; right: 24px; bottom: calc(24px + var(--abar-h)); z-index: 44;
}
.fab {
  align-items: center; justify-content: center; gap: 10px; height: 56px; min-width: 56px; padding: 0 16px;
  border: 0; border-radius: 16px; background: var(--primary); color: #fff; cursor: pointer;
  font: 600 15px/1 var(--font); box-shadow: 0 6px 16px rgba(30, 58, 138, .3), 0 1px 3px rgba(30, 58, 138, .2);
  transition: padding .16s ease, background .12s ease;
}
.fab:active { background: var(--primary-active); }
.fab-ext { padding: 0 20px 0 16px; }
.fab-ext.fab-mini { padding: 0 16px; }
.fab-ext.fab-mini .fab-label { display: none; }

/* --------------------------------------------------------------- filters (inline / sheet) */
.filter-host { min-width: 0; }
.filter-host:not(.is-collapsed) > .filter-body { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-btn { position: relative; }
.filter-btn.is-active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.filter-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: #fff; font: 700 11.5px/20px var(--font-num); text-align: center; }
.filter-sheet .filter-body { display: flex; flex-direction: column; gap: 14px; }
.filter-sheet .filter-body > * { width: 100%; }
.filter-sheet .filter-body .select, .filter-sheet .filter-body .input { width: 100%; }

/* --------------------------------------------------------------- date range as chips (phones) */
.daterange.dr-chips { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 8px; width: 100%; }
.dr-row { padding: 2px 0; scroll-padding: 0 16px; }
.dr-chips .chip { height: 36px; padding: 0 14px; font-size: 14px; }
.dr-pick .icon { margin-left: -2px; }
.dr-dates { display: none; align-items: center; gap: 8px; }
.daterange.show-dates .dr-dates { display: flex; }
.dr-dates .input { flex: 1 1 0; min-width: 0; }

/* --------------------------------------------------------------- table → cards (phones) */
.dt-cardbox { min-width: 0; }
.dt-cards { background: #fff; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.dc {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center;
  column-gap: 12px; row-gap: 2px; min-height: 60px; padding: 11px 10px 11px 14px; border-bottom: 1px solid var(--divider);
}
.dc:last-child { border-bottom: 0; }
.dc.has-lead { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.dc-click { cursor: pointer; }
.dc-click:active { background: var(--surface-3); }
.dc:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; }
.dc-lead { display: flex; align-items: center; }
.dc-l { min-width: 0; }
.dc-title { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.35; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dc-title a { text-decoration: none; }
.dc-sub { font-size: 13.5px; color: var(--text-2); margin-top: 1px; line-height: 1.4; overflow-wrap: anywhere; }
.dc-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.45; overflow-wrap: anywhere; }
.dc-dot { margin: 0 6px; color: var(--faint); }
.dc .sub, .dc .cell-sub { display: block; font-size: 12.5px; color: var(--muted); }
.dc-r { text-align: right; min-width: 0; max-width: 46vw; }
.dc-v { font: 700 15px/1.35 var(--font-num); font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.dc-v .badge { font-family: var(--font); }
.dc-v2 { font-size: 12.5px; color: var(--text-2); line-height: 1.45; white-space: nowrap; }
.dc-k { color: var(--muted); }
.dc-chev { display: flex; color: var(--faint); margin-right: -2px; }
.dc-kebab { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin: -6px -4px -6px 0; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; }
.dc-kebab:active, .dc.open .dc-kebab { background: var(--surface-3); color: var(--text); }
.dc-acts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; margin-top: 8px; border-top: 1px dashed var(--border); }
.dc-acts .btn { --h: 40px; }
.dc-acts .btn.has-label { width: auto; padding: 0 12px; gap: 6px; }
.dc.row-void .dc-title, .dc.row-void .dc-v { color: var(--faint); text-decoration: line-through; }
.dc.row-muted { opacity: .7; }
.dc.row-warn { background: #fffaf0; }
.dc.row-danger { background: #fff6f6; }
.dc-custom { display: block; }
.dc-empty { padding: 4px; }
.dt-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 10px; }
.dt-sum-i { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.dt-sum-k { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-sum-v { font: 700 17px/1.3 var(--font-num); font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-metarow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 2px 8px; min-height: 30px; }
.dt-ccount { font-size: 13px; color: var(--muted); font-family: var(--font-num); }
.dt-sortwrap { position: relative; display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); min-width: 0; }
.dt-sort-ic { display: flex; color: var(--muted); pointer-events: none; }
.dt-sort { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--text-2); font: 600 13.5px/1.2 var(--font); padding: 6px 2px; max-width: 52vw; text-overflow: ellipsis; cursor: pointer; }
.dt-sort:focus-visible { outline: 2px solid var(--brand-500); border-radius: 6px; }
.dt-more { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0 4px; }
.dt-more-btn { width: 100%; --h: 46px; }
.dt-more-n { font-size: 12.5px; color: var(--muted); }

/* --------------------------------------------------------------- product picker: camera button */
.picker-scan {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); z-index: 2;
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border: 0; border-radius: 9px; background: var(--primary-soft); color: var(--primary); cursor: pointer;
}
.picker-scan:active { background: #d6e0fa; }
.picker.has-scan .picker-input { padding-right: 50px; }
.picker.has-scan .picker-hint { display: none; }
.scan-why { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.scan-why p { margin: 0; color: var(--text-2); line-height: 1.55; }
.scan-why-ic { width: 42px; height: 42px; border-radius: 50%; background: var(--amber-soft); color: var(--amber); display: flex; align-items: center; justify-content: center; flex: none; }

/* --------------------------------------------------------------- camera scanner (full screen) */
.scan-screen { position: fixed; inset: 0; z-index: 1300; background: #000; color: #fff; overflow: hidden; animation: fadeIn .16s ease-out; }
.scan-screen.leaving { animation: fadeOut .16s ease-in forwards; }
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.scan-window { position: relative; width: min(78vw, 340px); height: min(44vw, 190px); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .55); }
.scan-window i { position: absolute; width: 28px; height: 28px; border: 4px solid #fff; }
.scan-window i:nth-child(1) { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-radius: 16px 0 0 0; }
.scan-window i:nth-child(2) { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-radius: 0 16px 0 0; }
.scan-window i:nth-child(3) { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-radius: 0 0 0 16px; }
.scan-window i:nth-child(4) { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-radius: 0 0 16px 0; }
.scan-line { position: absolute; left: 14px; right: 14px; top: 50%; height: 2px; border-radius: 2px; background: #ef4444; box-shadow: 0 0 10px #ef4444; animation: scanline 1.8s ease-in-out infinite; }
.scan-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) 10px 10px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); }
.scan-title { flex: 1; min-width: 0; font-size: 17px; font-weight: 600; text-align: center; }
.scan-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .16); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.scan-top .scan-btn[hidden] { display: flex !important; visibility: hidden; } /* keeps the title centred */
.scan-btn.on { background: #fde047; color: #111; }
.scan-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 16px calc(22px + var(--safe-b)); background: linear-gradient(transparent, rgba(0, 0, 0, .6)); }
.scan-hint { font-size: 15px; text-align: center; opacity: .95; }
.scan-manual { --h: 46px; background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .35); border-radius: 999px; padding: 0 20px; }

/* --------------------------------------------------------------- phone search screen */
.gs-screen { position: fixed; inset: 0; top: var(--banner-h); z-index: 1050; display: flex; flex-direction: column; background: #fff; animation: slideUp .18s cubic-bezier(.2, .8, .2, 1); }
.gs-screen.leaving { animation: fadeOut .15s ease-in forwards; pointer-events: none; }
.gs-head { display: flex; align-items: center; gap: 4px; height: 60px; padding: 0 6px; border-bottom: 1px solid var(--border); flex: none; }
.gs-box { flex: 1; min-width: 0; }
.gs-input { width: 100%; height: 46px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--surface-3); font: 400 16px/1.3 var(--font); color: var(--text); outline: none; }
.gs-input:focus { background: #eef2f8; box-shadow: inset 0 0 0 2px rgba(59, 99, 217, .35); }
.gs-input::-webkit-search-cancel-button { display: none; }
.gs-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px calc(16px + var(--safe-b)); }
.gs-body .gs-group { padding: 14px 10px 6px; }
.gs-item { min-height: 60px; padding: 8px 10px; border-radius: 12px; }
.gs-item:active { background: var(--surface-3); }
.gs-item .pp-sw { width: 40px; height: 40px; border-radius: 12px; }
.gs-item .pp-name { font-size: 15px; }
.gs-item .pp-meta { font-size: 13px; }
.gs-recent { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 8px 6px; }
.gs-recent .chip { height: 36px; font-size: 14px; max-width: 100%; }
.gs-recent .chip span { overflow: hidden; text-overflow: ellipsis; }
.gs-quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 2px 8px; }
.gs-q { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 80px; padding: 10px 6px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); text-decoration: none; font-size: 13px; font-weight: 600; text-align: center; line-height: 1.3; }
.gs-q:active { background: var(--primary-soft); }
.gs-q-ic { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); }
.gs-tip { margin: 18px 12px; color: var(--muted); font-size: 13px; line-height: 1.55; text-align: center; }

/* --------------------------------------------------------------- bottom nav (shown on phones only) */
.bnav { display: none; }
.bn-item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 0; height: var(--bnav-h); padding: 6px 2px 8px; border: 0; background: none; cursor: pointer;
  color: var(--muted); text-decoration: none; font: 600 12px/1.15 var(--font); -webkit-tap-highlight-color: transparent;
}
.bn-item:hover { color: var(--text); }
.bn-ic { display: flex; align-items: center; justify-content: center; width: 58px; height: 30px; border-radius: 999px; transition: background .14s ease, color .14s ease; }
.bn-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-item.active { color: var(--primary); }
.bn-item.active .bn-ic { background: var(--primary-soft); }
.bn-item:active .bn-ic { background: #dde5f8; }
.bn-new { color: var(--primary); }
.bn-fab {
  display: flex; align-items: center; justify-content: center; width: 54px; height: 54px; margin-top: -26px;
  border-radius: 50%; background: var(--primary); color: #fff;
  box-shadow: 0 0 0 5px #fff, 0 6px 14px rgba(30, 58, 138, .35);
}
.bn-new:active .bn-fab { background: var(--primary-active); transform: scale(.96); }

/* --------------------------------------------------------------- "আরো" sheet + account sheet */
.ms { display: flex; flex-direction: column; gap: 14px; }
.ms-user { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--border); border-radius: 16px; }
.ms-user-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ms-user-t b { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-user-t small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-net { border: 0; background: none; padding: 0; cursor: pointer; flex: none; }
.net-pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font: 600 12.5px/1 var(--font); white-space: nowrap; }
.net-pill.net-err { background: var(--red-soft); color: var(--red); }
.ms-search { position: relative; display: flex; align-items: center; }
.ms-search .icon { position: absolute; left: 14px; color: var(--faint); pointer-events: none; }
.ms-q { width: 100%; height: 46px; padding: 0 14px 0 42px; border: 1px solid var(--border); border-radius: 12px; background: #fff; font: 400 16px/1.3 var(--font); color: var(--text); outline: none; }
.ms-q:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
.ms-q::-webkit-search-cancel-button { cursor: pointer; }
.ms-gh { margin: 0 0 8px 4px; font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .01em; }
.ms-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ms-item {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 7px; min-width: 0; min-height: 92px;
  padding: 12px 6px 10px; background: #fff; border: 1px solid var(--border); border-radius: 14px;
  color: var(--text-2); text-decoration: none; text-align: center; font-size: 13px; font-weight: 600; line-height: 1.3;
}
.ms-item:hover { color: var(--text); border-color: var(--border-strong); }
.ms-item:active { background: var(--surface-3); }
.ms-item.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); color: var(--primary); }
.ms-item[hidden] { display: none; }
.ms-ic { width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex: none; }
.ms-ic.tone-teal { background: var(--teal-soft); color: var(--teal); }
.ms-ic.tone-pink { background: var(--pink-soft); color: var(--pink); }
.ms-ic.tone-violet { background: var(--violet-soft); color: var(--violet); }
.ms-label { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; max-width: 100%; }
.ms-list { background: #fff; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.ms-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 6px 14px;
  border: 0; border-bottom: 1px solid var(--divider); background: #fff; color: var(--text); cursor: pointer;
  font: 500 15px/1.3 var(--font); text-align: left;
}
.ms-row:last-child { border-bottom: 0; }
.ms-row:active { background: var(--surface-3); }
.ms-row > .icon { color: var(--faint); }
.ms-row-ic { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--text-2); flex: none; }
.ms-row-t { flex: 1; min-width: 0; }
.ms-row.danger, .ms-row.danger .ms-row-ic { color: var(--red); }
.ms-row.danger .ms-row-ic { background: var(--red-soft); }
.ms-lang { cursor: default; }
.ms-lang .seg button { height: 34px; padding: 0 14px; font-size: 14px; }
.ms-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 4px 8px; color: var(--faint); font: 500 12px/1.4 var(--font-num); text-align: center; }
.ms-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--amber-soft); color: #7c3d06; font: 500 12.5px/1.5 var(--font); text-align: left; }
.ms-note .icon { flex: none; margin-top: 2px; }
.acct-sheet { display: flex; flex-direction: column; }
.acct-sheet .um-head { padding: 4px 4px 14px; margin-bottom: 4px; }
.acct-sheet .ms-row { padding-left: 4px; padding-right: 4px; }
.pin-forgot { margin-top: 10px; border: 0; background: none; color: var(--brand-600); font: 600 13.5px/1.4 var(--font); cursor: pointer; padding: 8px 12px; border-radius: 8px; }
.pin-forgot:hover { background: var(--primary-soft); }

/* =============================================================== responsive */
@media (max-width: 1360px) {
  .tb-user-text, .tb-kbd { display: none; }
  .tb-user { padding-right: 8px; }
}
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-search { flex-basis: 360px; }
  .tb-search-kbd { display: none; }
  .tb-search input { padding-right: 12px; }
}
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .net-label { display: none; }
  .tb-net { width: 34px; padding: 0; justify-content: center; }
}
@media (max-width: 960px) {
  :root { --view-pad-x: 16px; --view-pad-y: 16px; }
  .sidebar {
    position: fixed; left: 0; top: var(--banner-h); bottom: 0; z-index: 60; height: auto;
    width: min(86vw, 300px); flex: none; transform: translateX(-102%); visibility: hidden; box-shadow: none;
    transition: transform .22s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .22s;
  }
  /* closed drawer: no shadow bleeding onto the page and its links are out of the tab order */
  .app.drawer-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 42, .46); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .app.drawer-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .sb-mini-toggle .icon { transform: none; }
  .tb-title { display: block; }
  .tb-search { flex: 1 1 260px; }
  .tb-h { font-size: 16px; }
  .action-bar, .app.sb-mini .action-bar { left: 0; }
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .ab-inner { flex-direction: row; align-items: center; gap: 14px; padding: 18px 20px; }
  .auth-brand .ab-inner { justify-content: flex-start; }
  .ab-logo { width: 50px; height: 50px; border-radius: 13px; margin: 0; flex: none; }
  .ab-name { font-size: 19px; }
  .ab-name-bn { font-size: 15px; margin-top: 2px; }
  .ab-tag, .ab-clock, .ab-foot, .auth-brand::after { display: none; }
  .auth-main { justify-content: flex-start; padding: 22px 16px 28px; }
}
@media (max-width: 760px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .ph-title { font-size: 19px; }
  .page-header { align-items: flex-start; }
}

/* =============================================================== PHONE (< 768 px) — the primary device (SPEC §17)
   Android Chrome, 360–412 px, one hand. Bottom navigation instead of the sidebar, a compact app bar, bottom
   sheets, card lists, 44 px+ tap targets, 16 px inputs (no zoom), and no blur / heavy shadows (low-end GPUs). */
@media (max-width: 767.98px) {
  :root {
    --topbar-h: 56px; --view-pad-x: 14px; --view-pad-y: 12px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md: 0 2px 8px rgba(15, 23, 42, .08);
    --shadow-lg: 0 8px 28px rgba(15, 23, 42, .18);
  }
  body { font-size: 15px; }
  /* Chrome on Android widens the layout viewport when anything overflows sideways — the fixed bottom nav and
     sheets would then sit off screen. A wide page element is clipped instead (it never scrolls the page). */
  .view { overflow-x: clip; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: initial; }

  /* ---- app bar */
  .topbar { gap: 2px; padding: 0 4px 0 6px; background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .tb-menu, .tb-search, .tb-new, .tb-lang, .tb-user-text, .tb-user > .icon { display: none !important; }
  .topbar .tb-logo { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; }
  .app.is-detail .topbar .tb-logo { display: none; }
  .app.is-detail .topbar .tb-back { display: inline-flex; }
  .tb-back { --h: 44px; color: var(--text); margin-right: 2px; }
  .tb-title { display: block; padding-left: 4px; }
  .tb-h { font-size: 18px; font-weight: 700; letter-spacing: -.005em; }
  .tb-actions { gap: 0; }
  .topbar .tb-search-btn { display: inline-flex; --h: 44px; color: var(--text-2); }
  .tb-net, .tb-net.has-ic { width: 40px; height: 44px; padding: 0; border: 0; background: none; justify-content: center; border-radius: 12px; }
  .tb-net .icon, .tb-net .net-label { display: none; }
  .tb-net.has-ic .net-dot, .tb-net .net-dot { display: block; width: 10px; height: 10px; }
  .net-ok .net-dot { background: #16a34a; }
  .tb-user { height: 44px; width: 44px; padding: 0; justify-content: center; border: 0; background: none; border-radius: 50%; }
  .tb-user .avatar { width: 34px; height: 34px; font-size: 13px; }

  /* ---- bottom navigation */
  .sidebar, .sidebar-backdrop { display: none !important; }
  .bnav {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 0 4px var(--safe-b); background: #fff; border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(15, 23, 42, .05);
  }
  body.no-bnav .bnav, .kb-open .bnav { display: none; }
  /* a page action bar sits right on the nav: the raised ＋ becomes a flat pill so it never covers the bar */
  body.has-abar .bn-fab { width: 52px; height: 32px; margin-top: 0; border-radius: 999px; box-shadow: none; }
  body.has-abar .bn-fab .icon { width: 22px; height: 22px; }
  .view { padding-bottom: calc(var(--bnav-h) + var(--safe-b) + 24px); }
  body.has-abar .view { padding-bottom: calc(var(--bnav-h) + var(--safe-b) + var(--abar-h) + 24px); }
  body.no-bnav .view { padding-bottom: calc(var(--safe-b) + 24px); }
  body.no-bnav.has-abar .view { padding-bottom: calc(var(--safe-b) + var(--abar-h) + 24px); }

  /* ---- page */
  .page-header { margin-bottom: 12px; gap: 8px; }
  .page-header .ph-title { display: none; } /* the app bar shows the title */
  .page-header:not(:has(.ph-sub)):not(:has(.ph-actions)) { display: none; }
  .ph-sub { margin-top: 0; font-size: 13.5px; }
  .ph-actions { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .ph-actions::-webkit-scrollbar { display: none; }
  .ph-actions > .btn { flex: none; }
  .grid { gap: 12px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { border-radius: 14px; }
  .card-head { padding: 12px 14px; min-height: 50px; }
  .card-body { padding: 14px; }
  .card-foot { padding: 12px 14px; border-radius: 0 0 14px 14px; }
  .stat { flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 14px; }
  .stat-ic { width: 34px; height: 34px; border-radius: 10px; }
  .stat-value { font-size: 19px; margin-top: 1px; }
  .stat.is-click:hover { transform: none; box-shadow: var(--shadow-xs); }
  .stat.is-click:active { background: var(--surface-2); }
  .empty { padding: 32px 12px; }
  .toolbar { gap: 8px; }
  .tabs { margin-bottom: 12px; }
  .tab { height: 46px; padding: 0 14px; font-size: 14.5px; }
  .kv-row { padding: 9px 0; }

  /* ---- controls: big targets, 16 px text (no zoom on focus), the right keyboard */
  .btn { --h: 44px; font-size: 15px; border-radius: 10px; }
  .btn-sm { --h: 38px; font-size: 14px; border-radius: 9px; padding: 0 12px; }
  .btn-lg { --h: 52px; font-size: 16.5px; border-radius: 12px; }
  .btn-xl { --h: 58px; }
  .btn:active:not(:disabled) { transform: scale(.98); }
  .input, .select, .textarea { height: 46px; font-size: 16px; border-radius: 10px; padding-left: 12px; }
  .select { padding-right: 34px; }
  .textarea { height: auto; padding: 10px 12px; }
  .input-sm, .select-sm { height: 40px; font-size: 15px; }
  .input-lg { height: 52px; font-size: 17px; }
  .input-affix .affix { width: 36px; }
  .input-affix .input { padding-left: 46px; }
  .input-pin { letter-spacing: .35em; font-family: var(--font-num); }
  .label { font-size: 14px; }
  .hint { font-size: 12.5px; }
  .field-error { font-size: 13px; }
  .check { font-size: 15px; gap: 12px; padding: 4px 0; }
  .check input { width: 22px; height: 22px; margin-top: 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .chip { height: 36px; padding: 0 14px; font-size: 14px; }
  .seg button { height: 34px; font-size: 14px; }
  .badge { height: 24px; font-size: 12.5px; }

  /* ---- tables: card list, sticky search */
  .dt-bar { gap: 8px; }
  .dt-bar.has-search { position: sticky; top: calc(var(--topbar-h) + var(--banner-h)); z-index: 6; margin: -8px calc(-1 * var(--view-pad-x)) 6px; padding: 8px var(--view-pad-x); background: var(--bg); }
  .card .dt-bar.has-search, .modal .dt-bar.has-search { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; background: var(--surface); }
  .modal .dt-bar.has-search { top: -4px; }
  .dt-search { flex: 1 1 100%; max-width: none; }
  .dt-search .input { height: 46px; border-radius: 12px; background: #fff; }
  .dt-tools { flex: 1 1 100%; }
  .dt.dt-cardmode .dt-count { display: none; }
  .dt .table-wrap { max-height: none; }
  .table { font-size: 14px; }
  .dt-pager { justify-content: center; }
  .dt-pager .dt-range { flex: 1 1 100%; text-align: center; }

  /* ---- date range: chips */
  .daterange { width: 100%; }
  .daterange:not(.dr-chips) .select { flex: 1 1 100%; }
  .daterange:not(.dr-chips) .input { flex: 1 1 0; width: auto; }
  .dr-row { margin: 0 calc(-1 * var(--view-pad-x)); padding-left: var(--view-pad-x); padding-right: var(--view-pad-x); }
  .card .dr-row, .modal .dr-row { margin: 0; padding-left: 0; padding-right: 0; }

  /* ---- dialogs → bottom sheets / full-screen pages */
  .modal-overlay { padding: 0; }
  .modal-overlay.is-sheet { align-items: flex-end; background: rgba(15, 23, 42, .5); }
  .modal-overlay.is-full { align-items: stretch; background: rgba(15, 23, 42, .3); }
  .is-sheet > .modal {
    width: 100%; max-width: none; max-height: calc(100dvh - var(--banner-h) - 28px); border-radius: 20px 20px 0 0;
    animation: sheetUp .24s cubic-bezier(.2, .8, .2, 1); transition: transform .2s cubic-bezier(.2, .8, .2, 1);
    box-shadow: 0 -6px 24px rgba(15, 23, 42, .14);
  }
  .is-full > .modal {
    width: 100%; max-width: none; height: calc(100dvh - var(--banner-h)); max-height: none; border-radius: 0;
    animation: slideUp .22s cubic-bezier(.2, .8, .2, 1); box-shadow: none;
  }
  .modal-overlay.leaving { animation: fadeOut .18s ease-in forwards; }
  .modal-overlay.is-sheet.leaving > .modal { animation: sheetDown .18s ease-in forwards; }
  .is-sheet .sheet-handle { display: flex; justify-content: center; padding: 8px 0 2px; flex: none; touch-action: none; cursor: grab; }
  .is-sheet .sheet-handle span { width: 40px; height: 5px; border-radius: 3px; background: #cfd6e2; }
  .is-sheet .modal-head { border-bottom: 0; padding: 2px 8px 4px 20px; min-height: 52px; touch-action: none; }
  .is-full .modal-head { padding: 0 8px 0 4px; height: 56px; gap: 4px; }
  .is-full .modal-back { display: inline-flex; --h: 44px; color: var(--text); }
  .is-full .modal-x { display: none; }
  .modal-x { --h: 44px; }
  .modal-title { font-size: 18px; }
  .modal-body { padding: 6px 20px 20px; overscroll-behavior: contain; }
  .is-full .modal-body { padding: 14px 16px 24px; }
  .modal-foot {
    flex-wrap: wrap; gap: 10px; padding: 10px 16px calc(10px + var(--safe-b));
    background: #fff; border-top: 1px solid var(--divider); border-radius: 0;
  }
  .modal-foot .btn { flex: 1 1 0; min-width: calc(33% - 10px); --h: 48px; white-space: normal; line-height: 1.2; text-align: center; }
  .modal-foot .btn-primary, .modal-foot .btn-danger, .modal-foot .btn-success { flex-grow: 1.6; }
  .modal-foot.one .btn { flex-basis: 100%; }
  .modal-confirm .modal-body { padding-top: 0; }
  .confirm-body p { font-size: 15.5px; }
  .modal.nudge { animation: none; }

  /* ---- "আরো" sheet (full height sheet on the grey page colour) */
  .modal.more-sheet { background: var(--bg); }
  .is-full > .modal.more-sheet { height: calc(100dvh - var(--banner-h)); }
  .more-sheet .modal-head { background: var(--bg); }
  .more-sheet .modal-body { padding: 4px 14px calc(24px + var(--safe-b)); }
  .menu-sheet .modal-body { padding-bottom: calc(16px + var(--safe-b)); }

  /* ---- popovers / pickers: finger sized */
  .popover { border-radius: 14px; }
  .pp-item { min-height: 52px; padding: 8px 10px; }
  .pp-name { font-size: 15px; }
  .pk-new { min-height: 50px; font-size: 15px; }
  .menu-item { height: 48px; font-size: 15px; }
  .party-picker.has-value .picker-input { padding-right: 130px; }

  /* ---- toasts above the bottom nav */
  #toast-root { left: 12px; right: 12px; bottom: calc(var(--bnav-h) + var(--safe-b) + var(--abar-h) + 34px); align-items: stretch; } /* clear of the raised ＋ */
  body.no-bnav #toast-root { bottom: calc(var(--safe-b) + var(--abar-h) + 12px); }
  body.modal-open #toast-root { top: calc(10px + env(safe-area-inset-top, 0px) + var(--banner-h)); bottom: auto; }
  .toast { min-width: 0; max-width: none; border-radius: 12px; font-size: 14.5px; }

  /* ---- page action bar + FAB */
  .action-bar { left: 0; bottom: calc(var(--bnav-h) + var(--safe-b)); padding: 10px 12px; box-shadow: 0 -2px 10px rgba(15, 23, 42, .06); }
  body.no-bnav .action-bar, .kb-open .action-bar { bottom: 0; padding-bottom: calc(10px + var(--safe-b)); }
  .kb-open .action-bar { padding-bottom: 10px; }
  .abar-inner { flex-wrap: nowrap; gap: 8px; }
  .abar-inner > .btn { flex: 1 1 0; min-width: 0; --h: 48px; }
  .abar-inner > .btn-primary, .abar-inner > .btn-success { flex-grow: 1.8; }
  .fab { display: inline-flex; position: fixed; right: 16px; bottom: calc(var(--bnav-h) + var(--safe-b) + var(--abar-h) + 16px); z-index: 44; }
  .fab.fab-all { right: 16px; bottom: calc(var(--bnav-h) + var(--safe-b) + var(--abar-h) + 16px); }
  body.no-bnav .fab { bottom: calc(var(--safe-b) + var(--abar-h) + 16px); }
  .kb-open .fab { display: none; }

  /* ---- misc: no blur on low-end GPUs */
  .sticky-bottom { -webkit-backdrop-filter: none; backdrop-filter: none; background: #fff; }
  .dbb-acts { width: 100%; }
  .dbb-btn { flex: 1; height: 38px; }

  /* ---- login / lock: thumb-friendly PIN pad */
  .auth-root.is-overlay { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--bg); }
  .auth { min-height: 100%; }
  .auth-brand .ab-inner { padding: 14px 18px; }
  .ab-logo { width: 46px; height: 46px; border-radius: 12px; }
  .ab-name { font-size: 18px; }
  .ab-name-bn { font-size: 14.5px; }
  .auth-main { padding: 12px 18px calc(16px + var(--safe-b)); gap: 8px; }
  .auth-main { flex: 1 1 auto; }
  .auth-card { flex: 1 0 auto; display: flex; flex-direction: column; max-width: 380px; padding: 16px 4px 8px; background: transparent; border: 0; box-shadow: none; animation: fadeIn .2s ease-out; }
  .auth-card > .auth-step { flex: 1 0 auto; }
  .pin-step .pin-pad { margin-top: auto; } /* the keys sit low, where the thumb is */
  .pin-msg { margin-bottom: 18px; }
  .auth-h { font-size: 21px; }
  .auth-sub { margin-bottom: 18px; }
  .user-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .user-tile { padding: 18px 8px 14px; border-radius: 16px; }
  .user-tile:hover { transform: none; box-shadow: none; }
  .user-tile:active { background: var(--primary-soft); border-color: var(--brand-500); }
  .pin-back { position: static; align-self: flex-start; margin: -8px 0 4px -6px; }
  .pin-user { margin-top: 2px; gap: 6px; }
  .pin-user .avatar.xl { width: 68px; height: 68px; font-size: 25px; }
  .pin-name { font-size: 20px; }
  .pin-dots { gap: 16px; height: 18px; margin: 20px 0 6px; }
  .pin-dot { width: 15px; height: 15px; }
  .pin-pad { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; width: 100%; max-width: 330px; }
  .pin-key { width: 100%; height: 66px; border-radius: 20px; font-size: 28px; font-weight: 500; background: #fff; border-color: var(--border); box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
  .pin-key:hover { background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); border-color: var(--border); }
  .pin-key:active { transform: scale(.94); background: var(--primary-soft); border-color: #c9d6f6; }
  .pin-fn, .pin-fn:hover { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
  .pin-ok, .pin-ok:hover { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(30, 58, 138, .28); }
  .pin-ok:active { background: var(--primary-active); }
  .pin-help { display: none; }
  .auth-foot .btn { --h: 40px; }

  /* ---- setup wizard: full screen, sticky Next */
  .auth-root.is-setup { background: #fff; }
  .setup { padding: 0; min-height: 100%; }
  .setup-card { display: flex; flex-direction: column; border-radius: 0; border: 0; box-shadow: none; min-height: 100vh; min-height: 100dvh; animation: none; }
  .setup-head { padding: 18px 16px 4px; gap: 12px; }
  .setup-head img { width: 44px; height: 44px; }
  .setup-title { flex-basis: 200px; }
  .setup-title h1 { font-size: 19px; }
  .setup-title p { font-size: 13.5px; }
  .stepper { margin: 14px 16px 0; }
  .stepper li { padding: 8px; font-size: 13px; }
  .setup-body { flex: 1 0 auto; padding: 18px 16px 6px; }
  .setup-bottom { display: block; padding: 0; }
  .setup-alt { justify-content: center; padding: 8px 16px 16px; flex-direction: column; gap: 2px; }
  .setup-alt-h { margin: 0 0 2px; }
  .setup-restore { width: 100%; justify-content: center; }
  .setup-foot { position: sticky; bottom: 0; z-index: 2; gap: 10px; margin: 0; padding: 10px 16px calc(10px + var(--safe-b)); background: #fff; border-top: 1px solid var(--divider); }
  .setup-foot .btn { flex: 1 1 0; --h: 50px; }
  .setup-foot .btn-primary { flex-grow: 1.8; }
}
@media (max-width: 380px) {
  :root { --view-pad-x: 12px; }
  .bn-ic { width: 50px; }
  .bn-item { font-size: 11.5px; }
  .ms-grid { gap: 6px; }
  .ms-item { font-size: 12.5px; padding-left: 4px; padding-right: 4px; }
  .pin-key { height: 60px; }
  .stat-value { font-size: 17px; }
}
/* touch screens: no sticky "hover" states after a tap */
@media (hover: none) {
  .btn-secondary:hover:not(:disabled) { background: #fff; border-color: var(--border-strong); color: var(--text-2); }
  .btn-ghost:hover:not(:disabled) { background: transparent; }
  .btn-ghost:active:not(:disabled) { background: var(--surface-3); }
  .table tbody tr:hover > td { background: inherit; }
  .chip:hover { background: #fff; border-color: var(--border-strong); color: var(--text-2); }
  .chip.active:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
}

/* =============================================================== motion */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes dropUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes sheetUp { from { transform: translate3d(0, 100%, 0); } to { transform: none; } }
@keyframes sheetDown { from { transform: none; } to { transform: translate3d(0, 100%, 0); } }
@keyframes slideUp { from { opacity: 0; transform: translate3d(0, 24px, 0); } to { opacity: 1; transform: none; } }
@keyframes scanline { 0%, 100% { transform: translateY(-62px); } 50% { transform: translateY(62px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes pageIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@keyframes nudge { 0%, 100% { transform: none; } 30% { transform: scale(1.012); } 60% { transform: scale(.996); } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes bootbar { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* =============================================================== print (in-page; documents print via DH.ui.printHTML iframe) */
@media print {
  @page { margin: 12mm; }
  html, body { background: #fff !important; }
  body { font-size: 12px; }
  .sidebar, .sidebar-backdrop, .topbar, #toast-root, #modal-root, .auth-root, .boot, .no-print,
  .bnav, .action-bar, .fab, .db-banner, .gs-screen, .scan-screen,
  .dt-bar, .dt-pager, .ph-actions, .btn, .tabs, .daterange, .picker { display: none !important; }
  .app, .main { display: block !important; min-height: 0; }
  .view { padding: 0 !important; }
  .page { max-width: none; }
  .page-fill { margin: 0; height: auto; overflow: visible; }
  .page-host { animation: none; }
  .card, .stat { box-shadow: none !important; border-color: #bbb; break-inside: avoid; }
  .stat-ic { display: none; }
  .table-wrap, .dt .table-wrap { max-height: none !important; overflow: visible !important; border-color: #bbb; }
  .table { font-size: 11px; }
  .table th { position: static; background: #eee !important; color: #000; }
  .table td { border-bottom-color: #ddd; }
  .table tbody tr:nth-child(even) > td { background: #f8f8f8 !important; }
  .table tfoot td { position: static; background: #eee !important; }
  .table tr { break-inside: avoid; }
  a { color: inherit !important; text-decoration: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
