:root {
  --primary: #1d4ed8;
  --primary-600: #1e40af;
  --secondary: #475569;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0284c7;
  --background: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --sidebar: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #1d4ed8;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 12px;
  --navbar-h: 64px;
  --sidebar-w: 248px;
  --sidebar-collapsed: 76px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --ctrl-h: 32px;

  /* ============================================================
     THEME TOKENS — single source of truth for the whole system.
     Never hardcode a colour on a page; use one of these.
     ============================================================ */
  --primary-hover: var(--primary-600);
  --primary-soft: color-mix(in srgb, var(--primary) 12%, var(--surface));
  --secondary-hover: color-mix(in srgb, var(--secondary) 18%, var(--surface-2));
  --surface-secondary: var(--surface-2);
  --text-primary: var(--text);
  --text-secondary: #475569;
  --input-background: var(--surface);
  --input-border: #64748b;
  --input-placeholder: var(--text-muted);
  --table-header: var(--surface-2);
  --table-row: var(--surface);
  --table-row-hover: color-mix(in srgb, var(--primary) 5%, var(--surface));
  --sidebar-background: var(--sidebar);
  --header-background: var(--surface);
  --modal-overlay: color-mix(in srgb, #0f172a 55%, transparent);

  /* status / badge palette (light) */
  --badge-success-fg: #0f7a45;
  --badge-success-bg: rgba(25, 135, 84, .16);
  --badge-success-bd: rgba(25, 135, 84, .22);
  --badge-neutral-fg: #5c636a;
  --badge-neutral-bg: rgba(108, 117, 125, .16);
  --badge-neutral-bd: rgba(108, 117, 125, .22);
  --badge-warning-fg: #8a6d00;
  --badge-warning-bg: rgba(255, 193, 7, .22);
  --badge-warning-bd: rgba(255, 193, 7, .35);
  --badge-primary-fg: #0b5ed7;
  --badge-primary-bg: rgba(13, 110, 253, .14);
  --badge-primary-bd: rgba(13, 110, 253, .22);
  --badge-danger-fg: #c43c4b;
  --badge-danger-bg: rgba(220, 53, 69, .14);
  --badge-danger-bd: rgba(220, 53, 69, .22);

  /* Bootstrap bridge: every bootstrap component inherits our palette */
  --bs-body-font-family: var(--font);
  --bs-font-sans-serif: var(--font);
  --bs-body-bg: var(--background);
  --bs-body-bg-rgb: 241, 245, 249;
  --bs-body-color: var(--text);
  --bs-body-color-rgb: 15, 23, 42;
  --bs-emphasis-color: var(--text);
  --bs-secondary-color: var(--text-muted);
  --bs-tertiary-bg: var(--surface-2);
  --bs-border-color: var(--border);
  --bs-border-color-translucent: color-mix(in srgb, var(--border) 70%, transparent);
  --bs-heading-color: var(--text);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 29, 78, 216;
  --bs-secondary: var(--secondary);
  --bs-secondary-rgb: 71, 85, 105;
  --bs-success: var(--success);
  --bs-success-rgb: 5, 150, 105;
  --bs-danger: var(--danger);
  --bs-danger-rgb: 220, 38, 38;
  --bs-warning: var(--warning);
  --bs-warning-rgb: 217, 119, 6;
  --bs-info: var(--info);
  --bs-info-rgb: 2, 132, 199;
  --bs-link-color: var(--primary);
  --bs-link-color-rgb: 29, 78, 216;
  --bs-link-hover-color: var(--primary-600);
  --bs-border-radius: 8px;
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: 12px;
  --bs-focus-ring-color: color-mix(in srgb, var(--primary) 25%, transparent);
  --bs-backdrop-bg: var(--modal-overlay);
  --bs-backdrop-opacity: 1;
  --bs-secondary-bg: var(--surface-2);
  --bs-secondary-color: var(--text-muted);
  --bs-table-bg: var(--surface);
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: var(--surface-2);
  --bs-table-hover-bg: var(--surface-2);
  --bs-table-active-bg: var(--surface-2);
}

[data-theme="dark"] {
  --primary: #60a5fa;
  --primary-600: #3b82f6;
  --secondary: #94a3b8;
  --success: #34d399;
  --danger: #f87171;
  --warning: #fbbf24;
  --info: #38bdf8;
  --background: #0b1220;
  --surface: #111827;
  --surface-2: #1f2937;
  --text: #e5e7eb;
  --text-muted: #94a3b8;
  --border: #243044;
  --sidebar: #070b14;
  --sidebar-text: #94a3b8;
  --sidebar-active: #2563eb;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

  /* theme tokens (dark) */
  --primary-hover: var(--primary-600);
  --text-secondary: #a1aec3;
  --input-background: var(--surface);
  --input-border: #3d4c63;
  --table-header: var(--surface-2);
  --table-row: var(--surface);
  --table-row-hover: color-mix(in srgb, var(--primary) 8%, var(--surface));
  --modal-overlay: rgba(2, 6, 23, 0.72);
  --badge-success-fg: #34d399;
  --badge-success-bg: rgba(52, 211, 153, .14);
  --badge-success-bd: rgba(52, 211, 153, .26);
  --badge-neutral-fg: #94a3b8;
  --badge-neutral-bg: rgba(148, 163, 184, .14);
  --badge-neutral-bd: rgba(148, 163, 184, .24);
  --badge-warning-fg: #fbbf24;
  --badge-warning-bg: rgba(251, 191, 36, .14);
  --badge-warning-bd: rgba(251, 191, 36, .26);
  --badge-primary-fg: #60a5fa;
  --badge-primary-bg: rgba(96, 165, 250, .14);
  --badge-primary-bd: rgba(96, 165, 250, .26);
  --badge-danger-fg: #f87171;
  --badge-danger-bg: rgba(248, 113, 113, .14);
  --badge-danger-bd: rgba(248, 113, 113, .26);

  /* bootstrap bridge (dark) */
  --bs-body-bg-rgb: 11, 18, 32;
  --bs-body-color-rgb: 229, 231, 235;
  --bs-primary-rgb: 96, 165, 250;
  --bs-secondary-rgb: 148, 163, 184;
  --bs-success-rgb: 52, 211, 153;
  --bs-danger-rgb: 248, 113, 113;
  --bs-warning-rgb: 251, 191, 36;
  --bs-info-rgb: 56, 189, 248;
  --bs-link-color-rgb: 96, 165, 250;
  --bs-secondary-bg: var(--surface-2);
  --bs-secondary-color: var(--text-muted);
  --bs-body-bg: var(--background);
  --bs-body-color: var(--text);
  --bs-emphasis-color: var(--text);
  --bs-border-color: var(--border);
  --bs-tertiary-bg: var(--surface-2);
  --bs-table-bg: var(--surface);
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: var(--surface-2);
  --bs-table-hover-bg: var(--surface-2);
  --bs-table-active-bg: var(--surface-2);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; max-width: 100%; }
html { font-size: 15px; overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  background: var(--background);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6,
.page-title, .brand, .stat-card .value {
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text);
}
button, input, select, textarea, .btn, .form-control, .form-select,
.badge, .dropdown-menu, .swal2-popup, .select2-container, table {
  font-family: inherit;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background: var(--background);
}
.login-lines {
  position: absolute; inset: 0; pointer-events: none;
  background:
    repeating-linear-gradient(18deg, transparent, transparent 72px, color-mix(in srgb, var(--primary) 14%, transparent) 72px, color-mix(in srgb, var(--primary) 14%, transparent) 73px),
    repeating-linear-gradient(-22deg, transparent, transparent 90px, color-mix(in srgb, var(--success) 12%, transparent) 90px, color-mix(in srgb, var(--success) 12%, transparent) 91px);
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
}
.login-theme {
  position: absolute;
  top: 20px; right: 20px;
  z-index: 2;
}
.login-card {
  width: min(400px, 92vw);
  background: var(--surface);
  border: none;
  border-radius: 20px;
  box-shadow: 0 16px 50px rgba(15, 23, 42, 0.08);
  padding: 36px 32px 24px;
  position: relative;
  z-index: 1;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 22px;
}
.login-brand .brand-logo {
  max-height: 112px;
  max-width: min(220px, 72vw);
  width: auto;
  height: auto;
  object-fit: contain;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}
.login-brand .brand-mark {
  width: 88px;
  height: 88px;
  font-size: 32px;
  border-radius: 20px;
}
.login-title {
  text-align: center;
  font-size: 1.45rem;
  margin: 0 0 4px;
}
.login-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 22px;
}
.login-card .form-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.login-alert {
  margin: -6px 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}
.login-input {
  position: relative;
  margin-bottom: 14px;
}
.login-input-password { margin-bottom: 4px; }
.login-input-code .form-control {
  letter-spacing: 0.35em;
  text-align: center;
  font-weight: 700;
  font-size: 20px;
}
.login-input > i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.login-input .form-control {
  padding-left: 36px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.login-eye {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  border: 0; background: none;
  color: var(--text-muted);
  width: 32px; height: 32px;
}
.password-input {
  position: relative;
}
.password-input .form-control {
  padding-right: 42px;
}
.password-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
}
.password-eye:hover { color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, transparent); }
.dash-kpis .stat-card.is-pos,
.dash-kpis .stat-card.is-neg {
  background: var(--surface);
  border-color: var(--border);
}
.dash-kpis .stat-card.is-pos::before,
.dash-kpis .stat-card.is-neg::before {
  background: var(--primary);
}
.dash-kpis .amt-pill {
  background: transparent;
  color: inherit;
  padding: 0;
  font-weight: inherit;
}
.login-forgot-row {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0 18px;
}
.login-forgot {
  font-size: 12px;
  text-decoration: none;
  color: var(--primary);
  font-weight: 500;
}
.login-btn { height: 46px; font-weight: 600; margin-top: 0; border-radius: 999px; }
.login-card .btn-light {
  height: 46px;
  border-radius: 999px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
}
.login-foot {
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  line-height: 1.6;
}
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 700;
  flex-shrink: 0;
}
.brand-mark.sm { width: 32px; height: 32px; font-size: 14px; }
.brand-logo {
  max-height: 56px;
  max-width: 180px;
  object-fit: contain;
}
.brand-logo.sm { max-height: 32px; max-width: 120px; }

.app-shell { min-height: 100vh; width: 100%; max-width: 100%; overflow-x: clip; }
.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar-background);
  color: var(--sidebar-text);
  overflow: auto;
  z-index: 1040;
  transition: width .2s ease, transform .2s ease;
  scrollbar-color: color-mix(in srgb, var(--sidebar-text) 35%, transparent) transparent;
  scrollbar-width: thin;
  border-right: 1px solid color-mix(in srgb, var(--sidebar-text) 14%, transparent);
  box-shadow: 4px 0 24px rgba(0, 0, 0, .12);
}
.sidebar .brand {
  height: var(--navbar-h);
  display: flex; align-items: center; justify-content: center;
  padding: 0 16px; color: #fff; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--sidebar-text) 12%, transparent);
}
.sidebar .brand-text { display: none; }
.sidebar .brand .brand-logo,
.sidebar .brand .brand-logo.sm {
  max-height: 46px;
  max-width: 168px;
  display: block;
  margin: 0 auto;
  padding: 0;
  background: transparent;
}
.sidebar .brand .brand-mark,
.sidebar .brand .brand-mark.sm {
  width: 40px; height: 40px; font-size: 16px;
}
.nav-section {
  padding: 16px 20px 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 600;
  color: color-mix(in srgb, var(--sidebar-text) 72%, transparent);
}
.sidebar nav {
  padding: 4px 10px 16px;
}
.sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px 9px 14px; margin: 2px 0;
  border-radius: 10px;
  color: var(--sidebar-text); text-decoration: none; font-size: 13.5px; font-weight: 500;
  position: relative;
  transition: background .15s ease, color .15s ease;
}
.sidebar a i { font-size: 1.05rem; width: 1.25rem; text-align: center; flex-shrink: 0; opacity: .92; }
.sidebar a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.active {
  background: color-mix(in srgb, var(--primary) 22%, rgba(255, 255, 255, .08));
  color: #fff;
  font-weight: 600;
}
.sidebar a.active::before {
  content: "";
  position: absolute;
  left: 0; top: 7px; bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
  box-shadow: 0 0 10px color-mix(in srgb, var(--primary) 65%, transparent);
}
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  min-width: 0;
  width: auto;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  transition: margin-left .2s ease;
}
.topbar {
  min-height: var(--navbar-h);
  background: var(--header-background);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 8px 20px;
  position: sticky; top: 0; z-index: 1030;
  flex-wrap: nowrap;
}
.topbar-menu-btn { flex-shrink: 0; }
@media (min-width: 993px) {
  .topbar-menu-btn { display: none; }
}
.topbar-context {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
  flex: 0 0 auto;
}
.ctx-company {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ctx-company i { color: var(--text-muted); flex-shrink: 0; }
.ctx-field {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0;
  min-width: 0;
}
.ctx-field span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1;
}
.ctx-field .form-select {
  width: 148px;
  padding: 3px 28px 3px 8px;
  font-size: 12.5px;
  min-height: 30px;
  border: 1px solid var(--border);
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.topbar-search {
  position: relative;
  flex: 1 1 auto;
  max-width: min(440px, 100%);
  min-width: 160px;
  margin: 0 auto;
}
.topbar-search > i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.topbar-search input,
.topbar-search .search-input {
  padding-left: 38px;
  border-radius: 10px;
  background: var(--surface-2);
  border-color: var(--border);
  min-height: 38px;
  height: 38px;
}
.topbar-search input:focus {
  background: var(--surface);
  border-color: var(--primary);
}
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 1060;
  max-height: 360px; overflow: auto;
  padding: 8px;
}
.search-results a { color: var(--text); text-decoration: none; border-radius: 6px; padding: 6px 8px; }
.search-results a:hover { background: var(--surface-2); color: var(--primary); }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  position: relative;
}
.btn-icon:hover { background: var(--surface-2); color: var(--primary); }
.notif-btn { overflow: visible; }
.notif-badge,
.notif-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
  pointer-events: none;
}
.user-avatar,
.user-avatar-fallback {
  width: 32px; height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--primary) 16%, var(--surface-2));
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 200px;
  padding: 3px 8px 3px 3px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
}
.user-chip:hover { background: var(--surface-2); }
.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
  line-height: 1.15;
}
.user-chip .uname {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; font-size: 13px;
}
.user-chip .urole {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; color: var(--text-muted);
}
.user-caret { font-size: 11px; color: var(--text-muted); }
.page { padding: 20px 22px 32px; flex: 1; min-width: 0; width: 100%; max-width: 100%; overflow-x: hidden; }
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head-left { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.page-title { font-size: 1.35rem; margin: 0; line-height: 1.25; }
.page-sub { color: var(--text-muted); font-size: 13px; margin: 2px 0 0; }
.page-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 2px;
}
.page-tabs-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  -webkit-overflow-scrolling: touch;
}
.page-pills,
.page-tabs {
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 8px 12px;
  margin-bottom: 0;
}
.page-tabs .nav-link,
.page-pills .nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  padding: 8px 14px;
}
.page-tabs .nav-link:hover,
.page-pills .nav-link:hover { color: var(--primary); }
.page-tabs .nav-link.active,
.page-pills .nav-link.active {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--border) var(--border) var(--surface);
  box-shadow: inset 0 2px 0 var(--primary);
}
.card-soft {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat-card { padding: 12px 14px; }
.stat {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stat-label { color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.35rem; font-weight: 700; margin-top: 4px; }
.card-soft.p-3 { padding: 0.85rem !important; }
.card-soft.p-4 { padding: 1.1rem !important; }
.stat-card .label { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-card .value { font-size: 1.45rem; font-weight: 700; margin-top: 4px; }
.table-wrap { overflow: auto; }
.table {
  color: var(--text);
  margin-bottom: 0;
  border-collapse: collapse;
  border: 1px solid var(--border);
  --bs-table-bg: var(--surface);
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-striped-bg: var(--surface-2);
  --bs-table-hover-bg: var(--surface-2);
  --bs-table-active-bg: var(--surface-2);
}
.table thead th {
  background: var(--table-header);
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  border: 1px solid var(--border);
  vertical-align: middle;
}
.badge-status { font-weight: 600; letter-spacing: .02em; text-transform: capitalize; }
.form-label { font-weight: 500; font-size: 12.5px; color: var(--text); letter-spacing: 0; margin-bottom: .25rem; }
.modal-title { letter-spacing: 0; }
.req-star { color: var(--danger); font-weight: 700; margin-left: 2px; }
.form-control, textarea.form-control {
  background: var(--input-background);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  min-height: var(--ctrl-h);
  height: var(--ctrl-h);
  padding: .2rem .65rem;
  font-size: 13.5px;
  line-height: 1.3;
}
.form-select {
  background-color: var(--input-background);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  min-height: var(--ctrl-h);
  height: var(--ctrl-h);
  padding: .2rem 2rem .2rem .65rem;
  font-size: 13.5px;
  line-height: 1.3;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 14px 10px;
}
[data-theme="dark"] .form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
textarea.form-control {
  height: auto;
  min-height: 58px;
  padding: .4rem .65rem;
}
.form-control-sm, .form-select-sm {
  min-height: 28px;
  height: 28px;
  padding: .12rem .5rem;
  font-size: 12.5px;
}
.input-group-text {
  min-height: var(--ctrl-h);
  padding: .2rem .55rem;
  font-size: 13px;
}
.form-control:focus, .form-select:focus {
  background: var(--input-background);
  color: var(--text);
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--primary) 22%, transparent);
}
.form-control::placeholder { color: var(--input-placeholder); }
.form-control:disabled,
.form-control[disabled] {
  background-color: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
  opacity: 1;
}
.form-select:disabled,
.form-select[disabled] {
  background-color: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
  opacity: 1;
  cursor: not-allowed;
}
[data-theme="dark"] select.form-select option,
[data-theme="dark"] select.form-control option {
  background: var(--surface);
  color: var(--text);
}
.form-control[type="file"] {
  height: auto;
  min-height: var(--ctrl-h);
  padding: .22rem .5rem;
}
.login-input .form-control {
  height: 44px;
  min-height: 44px;
  padding-left: 36px;
  font-size: 15px;
  border-radius: 10px;
}
.login-input-code .form-control {
  font-size: 20px;
  letter-spacing: 0.35em;
}
.btn { font-weight: 500; border-radius: 8px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-info { background: var(--info); border-color: var(--info); color: #fff; }
.btn-outline-secondary, .btn-outline-primary {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}
.btn-outline-primary:hover { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--primary); border-color: var(--primary); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--text); }
.modal-content { background: var(--surface); color: var(--text); border-color: var(--border); border-radius: 14px; }
.modal-header, .modal-footer { border-color: var(--border); }
.btn-close { filter: var(--text); }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%); }
.dropdown-menu {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
}
.dropdown-item { color: var(--text); font-size: 14px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: var(--text); }
.dropdown-header { color: var(--text-muted); }
.sidebar-backdrop { display: none; }
.user-chip .user-avatar,
.user-chip .user-avatar-fallback {
  border-radius: 50%;
}
.user-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
.user-rt-dot {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid var(--surface);
  background: var(--text-muted);
  box-shadow: 0 0 0 1px var(--border);
  pointer-events: none;
  flex: 0 0 auto;
}
.user-rt-dot.rt-success { background: var(--success); animation: rtPulse 2.2s ease-in-out infinite; }
.user-rt-dot.rt-info { background: var(--info); }
.user-rt-dot.rt-warning { background: var(--warning); animation: rtPulse 1.4s ease-in-out infinite; }
.user-rt-dot.rt-danger { background: var(--danger); }
.user-rt-dot.rt-muted { background: var(--text-muted); }
.user-ctx-menu { min-width: 240px; }
.user-ctx-picker .form-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.user-menu { min-width: 260px; }
.empty-state { padding: 48px 16px; text-align: center; color: var(--text-muted); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 16px; }
@keyframes sk { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.pos-item { cursor: pointer; border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--surface); }
.pos-item:hover { border-color: var(--primary); }
.erp-alerts {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  right: auto;
  z-index: 20100; /* above Bootstrap modal (~1055) and select2 (~20050) */
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(560px, calc(100vw - 24px));
  max-width: min(560px, calc(100vw - 24px));
  padding: 0;
  margin: 0;
  pointer-events: none;
  box-sizing: border-box;
}
body:has(.app-shell) .erp-alerts {
  top: 12px;
}
body:has(.app-shell.sidebar-collapsed) .erp-alerts,
body.app-ready .erp-alerts {
  top: 12px;
}
.erp-alerts:empty {
  display: none;
  padding: 0;
}
.erp-alerts .alert,
.erp-alerts .erp-alert-toast {
  pointer-events: auto;
  width: 100%;
  margin: 0;
  box-shadow: var(--shadow, 0 8px 24px rgba(0,0,0,.18));
  border-radius: 10px;
  border-width: 1.5px;
  padding: 0.9rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 500;
  gap: 0.35rem;
}
.erp-alerts .erp-alert-toast .bi,
.erp-alerts .erp-alert-toast svg.bi {
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
}
.erp-alerts .alert-success {
  background: #ecfdf3;
  color: #027a48;
  border-color: #abefc6;
}
.erp-alerts .alert-danger {
  background: #fef3f2;
  color: #b42318;
  border-color: #fecdca;
}
.erp-alerts .alert-warning {
  background: #fffaeb;
  color: #b54708;
  border-color: #fedf89;
}
.erp-alerts .alert-primary,
.erp-alerts .alert-info {
  background: #eff8ff;
  color: #175cd3;
  border-color: #b2ddff;
}
.alert {
  border-radius: 10px;
  border: 1px solid transparent;
}
.alert .bi { color: inherit; }
.alert-primary {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  color: var(--text);
  border-color: color-mix(in srgb, var(--primary) 32%, var(--border));
}
.alert-success {
  background: color-mix(in srgb, var(--success) 14%, var(--surface));
  color: var(--text);
  border-color: color-mix(in srgb, var(--success) 32%, var(--border));
}
.alert-warning {
  background: color-mix(in srgb, var(--warning) 16%, var(--surface));
  color: var(--text);
  border-color: color-mix(in srgb, var(--warning) 36%, var(--border));
}
.alert-danger {
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  color: var(--text);
  border-color: color-mix(in srgb, var(--danger) 32%, var(--border));
}
.alert-info {
  background: color-mix(in srgb, var(--info) 14%, var(--surface));
  color: var(--text);
  border-color: color-mix(in srgb, var(--info) 32%, var(--border));
}
.page-link { background: var(--surface); color: var(--text); border-color: var(--border); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link:hover { background: var(--surface-2); color: var(--primary); }
.nav-pills .nav-link { color: var(--text-muted); }
.nav-pills .nav-link.active { background: var(--primary); color: #fff; }
.nav-tabs .nav-link { color: var(--text-muted); }
.nav-tabs .nav-link.active { background: var(--surface); color: var(--text); border-color: var(--border) var(--border) var(--surface); }

/* =========================
   DATATABLE
========================= */

.dataTables_wrapper,
div.dt-container {
  width: 100%;
  color: var(--text);
  font-family: inherit;
  background: transparent;
  box-shadow: none;
  border: none;
}

.dataTables_wrapper .table {
  margin-bottom: 0 !important;
}

.table thead th {
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  vertical-align: middle;
}

.table tbody td {
  vertical-align: middle;
  font-size: 13px;
}

.table-hover tbody tr:hover {
  cursor: pointer;
  background: var(--table-row-hover, var(--surface-2));
}

#medicineTable.table-hover tbody tr,
#medicineTable.table-hover tbody tr:hover {
  cursor: default;
}

.dataTables_wrapper .dt-bar,
.dataTables_wrapper .dt-foot,
div.dt-container .dt-bar,
div.dt-container .dt-foot,
div.dt-container .dt-layout-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0;
}
div.dt-container .dt-left,
div.dt-container .dt-right,
div.dt-container .dt-layout-cell {
  width: auto !important;
  padding: 0 !important;
  flex: 0 0 auto;
}
div.dt-container .dt-right {
  margin-left: auto;
}
div.dt-container .dt-length,
div.dt-container .dt-search {
  text-align: left !important;
  float: none !important;
}
div.dt-container .dt-search input {
  margin-left: 8px;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-family: inherit;
}

table.dataTable { font-family: inherit; color: var(--text); border-collapse: collapse !important; }
table.dataTable thead th,
table.dataTable > thead > tr > th,
table.dataTable > thead > tr > td {
  background: var(--surface-2) !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}
table.dataTable > tbody > tr > th,
table.dataTable > tbody > tr > td,
table.dataTable tbody td {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}
table.dataTable.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-bg-type: var(--surface-2); }
table.dataTable > tbody > tr:hover > * { --bs-table-hover-bg: var(--surface-2); }
div.dt-buttons { display: none !important; }
.dataTables_wrapper .dataTables_info { color: var(--text-muted); font-size: 13px; }
.dataTables_wrapper .dataTables_processing {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 10px 16px;
}
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before { background-color: var(--primary); }

.page-tabs-wrap + .row,
.page-tabs-wrap + .table-shell,
.page-tabs-wrap + .card-soft,
.page-tabs-wrap + #privList,
.page-tabs-wrap + .money-subnav,
.page-tabs-wrap + .report-summary {
  margin-top: 0;
}

.table-card,
.table-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 0 0 8px;
}

.table-shell .table,
.table-shell table.dataTable {
  background: var(--table-row);
  border-left: 0;
  border-right: 0;
  width: 100% !important;
}

.table-shell table.dataTable thead th,
.table-shell table.dataTable > thead > tr > th,
.table-shell .table thead th {
  background: var(--surface-2) !important;
}

.table-shell table.dataTable > tbody > tr > td,
.table-shell .table tbody td {
  background: var(--surface) !important;
}

.table-shell tfoot.report-tfoot-totals td {
  border-top: 2px solid var(--border, #dee2e6);
  background: var(--surface-2, #f8f9fa) !important;
  vertical-align: middle;
}

.table-shell .dt-bar,
.table-shell .dt-foot,
.table-shell .table-toolbar {
  padding-left: 16px;
  padding-right: 16px;
}

.page-tabs + #privList {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 0;
  padding: 16px;
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 8px;
}

.table-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  padding: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.table-filters > div,
.table-filters > button,
.table-filters > input,
.table-filters > select {
  flex: 0 0 auto;
}

.table-filters .form-select,
.table-filters .form-control {
  min-width: 132px;
  max-width: 200px;
  width: auto;
}

.dt-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--text-muted);
}

.dt-empty i {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.dt-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
  flex-shrink: 0;
}

/* Status badge */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status-active,
.status-in-stock,
.status-paid,
.status-received,
.status-delivered {
  background: var(--badge-success-bg);
  color: var(--badge-success-fg);
  border-color: var(--badge-success-bd);
}
.status-posted,
.status-ledger {
  background: var(--badge-primary-bg);
  color: var(--badge-primary-fg);
  border-color: var(--badge-primary-bd);
}
.status-unpaid {
  background: var(--badge-danger-bg);
  color: var(--badge-danger-fg);
  border-color: var(--badge-danger-bd);
}
.status-overdue {
  background: var(--badge-warning-bg);
  color: var(--badge-warning-fg);
  border-color: var(--badge-warning-bd);
}
.erp-inv-status-cols {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}
.erp-inv-status-detail {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.35rem;
}
/* Invoice list: DOC + PAYMENT badge colors */
.status-badge.status-paid {
  background: rgba(22, 163, 74, 0.14);
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.35);
}
.status-badge.status-partial {
  background: rgba(234, 88, 12, 0.14);
  color: #c2410c;
  border-color: rgba(234, 88, 12, 0.35);
}
.status-badge.status-unpaid {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.32);
}
.status-badge.status-overdue {
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.38);
}
.status-badge.status-posted,
.status-badge.status-ledger {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.3);
}
.status-badge.status-draft {
  background: #f8fafc;
  color: #64748b;
  border-color: #e2e8f0;
}
[data-theme="dark"] .status-badge.status-paid {
  background: rgba(52, 211, 153, 0.16);
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.35);
}
[data-theme="dark"] .status-badge.status-partial {
  background: rgba(251, 146, 60, 0.16);
  color: #fb923c;
  border-color: rgba(251, 146, 60, 0.35);
}
[data-theme="dark"] .status-badge.status-unpaid {
  background: rgba(248, 113, 113, 0.16);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
}
[data-theme="dark"] .status-badge.status-overdue {
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}
[data-theme="dark"] .status-badge.status-posted,
[data-theme="dark"] .status-badge.status-ledger {
  background: rgba(96, 165, 250, 0.16);
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.35);
}
[data-theme="dark"] .status-badge.status-draft {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.28);
}
.status-inactive,
.status-archived,
.status-draft:not(.status-badge) {
  background: var(--badge-neutral-bg);
  color: var(--badge-neutral-fg);
  border-color: var(--badge-neutral-bd);
}
.status-pending,
.status-low,
.status-counting {
  background: var(--badge-warning-bg);
  color: var(--badge-warning-fg);
  border-color: var(--badge-warning-bd);
}
.status-partial:not(.status-badge) {
  background: var(--badge-warning-bg);
  color: var(--badge-warning-fg);
  border-color: var(--badge-warning-bd);
}
.status-approved,
.status-in_transit,
.status-reserved,
.status-converted {
  background: var(--badge-primary-bg);
  color: var(--badge-primary-fg);
  border-color: var(--badge-primary-bd);
}
.status-cancelled,
.status-expired,
.status-out,
.status-rejected,
.status-locked,
.status-void {
  background: var(--badge-danger-bg);
  color: var(--badge-danger-fg);
  border-color: var(--badge-danger-bd);
}

/* Reference chip — same look on every table / detail sheet */
.ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ref-chip i { font-size: 11px; color: var(--text-muted); }
.ref-chip.is-muted { color: var(--text-muted); font-weight: 500; background: transparent; }

/* Action buttons */

.table-actions {
  display: inline-flex;
  gap: 4px;
  white-space: nowrap;
  align-items: center;
}

.table-actions .btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.table-actions .dropdown-menu {
  min-width: 200px;
}

.table-more-menu {
  z-index: 2000;
}

.table-shell td.dt-actions,
.table-shell th.dt-actions {
  white-space: nowrap;
  vertical-align: middle;
}

.view-kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  font-size: 14px;
}

.view-kv dt { color: var(--text-muted); font-weight: 500; margin: 0; }
.view-kv dd { margin: 0; font-weight: 600; }

.offcanvas, .offcanvas-header, .offcanvas-body {
  background: var(--surface);
  color: var(--text);
}

.offcanvas-header { border-bottom: 1px solid var(--border); }

/* Print */

@media print {
  .no-print,
  .sidebar,
  .navbar,
  .topbar,
  .contextbar,
  .dt-buttons,
  .dataTables_filter,
  .dataTables_length,
  .dataTables_paginate,
  .dataTables_info,
  .page-head-actions,
  .table-filters,
  .table-actions {
    display: none !important;
  }

  .sidebar, .main { position: static !important; margin: 0 !important; width: 100% !important; }
  .table-card { border: none; box-shadow: none; }
  .table { font-size: 11px; }
}

/* SweetAlert2 + toasts */
.swal2-popup, .swal2-popup.erp-swal, .swal2-popup.erp-toast {
  font-family: var(--font) !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.swal2-title { color: var(--text) !important; font-weight: 600; }
.swal2-html-container { color: var(--text-muted) !important; }
.erp-swal-actions { gap: 8px !important; }
.swal2-validation-message {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface)) !important;
  color: var(--danger) !important;
}
.swal2-popup.erp-toast { box-shadow: var(--shadow) !important; padding: 12px 16px !important; }
.erp-toast .swal2-timer-progress-bar { background: var(--primary); }
.erp-toast-success .swal2-timer-progress-bar { background: var(--success); }
.erp-toast-error .swal2-timer-progress-bar { background: var(--danger); }
.erp-toast-warning .swal2-timer-progress-bar { background: var(--warning); }
.erp-toast-info .swal2-timer-progress-bar { background: var(--info); }
.swal2-icon.swal2-success {
  border-color: var(--success) !important;
  color: var(--success) !important;
}
/* Ring = outline only; lines = the ✓ (do NOT fill the ring or the check vanishes) */
.swal2-icon.swal2-success .swal2-success-ring {
  border-color: color-mix(in srgb, var(--success) 40%, transparent) !important;
  background-color: transparent !important;
}
.swal2-icon.swal2-success [class^=swal2-success-line] {
  background-color: var(--success) !important;
}
.swal2-icon.swal2-error { border-color: var(--danger) !important; }
.swal2-icon.swal2-error [class^=swal2-x-mark-line] { background-color: var(--danger) !important; }
.swal2-icon.swal2-warning { border-color: var(--warning) !important; color: var(--warning) !important; }
.swal2-icon.swal2-info { border-color: var(--info) !important; color: var(--info) !important; }

/* Select2 + lookup add */
.lookup-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}
.lookup-row > select,
.lookup-row .select2-container {
  flex: 1 1 0% !important;
  width: auto !important;
  min-width: 0;
  max-width: none;
}
.lookup-add {
  flex: 0 0 auto;
  white-space: nowrap;
  height: var(--ctrl-h);
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 3;
  font-size: 12.5px;
}
.col-md-4 .lookup-add {
  width: var(--ctrl-h);
  min-width: var(--ctrl-h);
  padding: 0;
  justify-content: center;
  font-size: 0;
  gap: 0;
}
.col-md-4 .lookup-add i { font-size: 13px; }
.lookup-row:has(.form-select-sm) .lookup-add {
  height: 31px;
  font-size: 12px;
  padding: 0 8px;
}
.lookup-row:has(.form-select-sm) .select2-container--default .select2-selection--single {
  height: 31px;
}
.lookup-row:has(.form-select-sm) .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 29px;
}
#erpQuickModal { z-index: 2000; }
body:has(#erpQuickModal.show) .modal-backdrop:last-child { z-index: 1990; }
.select2-container { font-family: var(--font); z-index: 2; }
.select2-container--open { z-index: 1090; }
.select2-container--default .select2-selection--single {
  height: var(--ctrl-h);
  background: var(--input-background);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: 6px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text);
  line-height: calc(var(--ctrl-h) - 2px);
  padding-left: 10px;
  font-size: 13.5px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: calc(var(--ctrl-h) - 2px);
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--text-muted); }
.select2-dropdown {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  z-index: 20050;
}
.select2-container--open { z-index: 20050 !important; }
.select2-search--dropdown .select2-search__field {
  pointer-events: auto !important;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
  background: var(--input-background); color: var(--text); border: 1px solid var(--input-border);
  border-radius: 6px;
  height: var(--ctrl-h);
  min-height: var(--ctrl-h);
  padding: .2rem .65rem;
  font-size: 13.5px;
}
.select2-container--default .select2-results__option--highlighted {
  background: var(--primary) !important;
  color: #fff !important;
}
.select2-container--default .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted) {
  background: var(--surface-2);
  color: var(--text);
}
.select2-results__option { padding: 8px 12px; }
.s2-opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
}
.s2-opt-title { font-weight: 600; }
.s2-opt-sub {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  opacity: 1;
}
.select2-results__option--highlighted .s2-opt-title,
.select2-results__option--highlighted[aria-selected] .s2-opt-title {
  color: #fff;
}
.select2-results__option--highlighted .s2-opt-sub,
.select2-results__option--highlighted[aria-selected] .s2-opt-sub {
  color: rgba(255, 255, 255, .92) !important;
  opacity: 1;
}
.quote-line-meta { line-height: 1.3; margin-top: 2px; }

.erp-modal .modal-content {
  overflow: hidden;
  max-height: calc(100vh - 1.5rem);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 24px 56px rgba(15, 23, 42, .16);
}
[data-theme="dark"] .erp-modal .modal-content {
  box-shadow: 0 24px 56px rgba(0, 0, 0, .45);
}
.erp-modal .modal-dialog.modal-dialog-scrollable {
  height: auto;
  max-height: calc(100vh - 1.5rem);
}
.erp-modal .modal-content > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: inherit;
}
.erp-modal .modal-header {
  padding: 1rem 1.15rem;
  align-items: center;
  flex: 0 0 auto;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border-bottom: 1px solid var(--border);
}
.erp-modal .modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.erp-modal .modal-title::before {
  content: "";
  width: 4px;
  height: 1.05em;
  border-radius: 4px;
  background: var(--primary);
  flex-shrink: 0;
}
.erp-modal .modal-body {
  padding: 1rem 1.15rem 1.05rem;
  flex: 0 1 auto;
  overflow-y: auto;
  min-height: 0;
  background: var(--background);
}
.erp-modal .modal-footer {
  padding: .85rem 1.15rem;
  gap: 10px;
  flex: 0 0 auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.erp-modal .modal-footer .btn {
  padding: .3rem .85rem;
  min-height: 32px;
  font-size: 13.5px;
}
.erp-modal .form-label {
  display: block;
  font-weight: 600;
  font-size: 12px;
  margin-bottom: .2rem;
  color: var(--text);
}
.erp-modal .erp-field { margin-bottom: .65rem; }
.erp-modal .erp-field:last-child { margin-bottom: 0; }
.erp-modal .erp-field .lookup-row { margin-bottom: 0; }
.erp-modal .form-control {
  width: 100%;
  min-height: 38px;
  height: 38px;
  border-radius: 10px;
  border-color: var(--input-border);
  background: var(--input-background);
}
.erp-modal .form-select {
  width: 100%;
  min-height: 38px;
  height: 38px;
  border-radius: 10px;
  border-color: var(--input-border);
  background-color: var(--input-background);
}
.erp-modal .form-select.form-select-sm,
.erp-modal .inv-pay-block .form-control.form-control-sm,
.erp-modal .inv-pay-block .form-select {
  min-height: 32px;
  height: 32px;
  font-size: 13px;
  border-radius: 8px;
}
.erp-modal textarea.form-control {
  height: auto;
  min-height: 76px;
  padding-top: .55rem;
}
.erp-modal .lookup-row { margin-bottom: 0; }
.erp-modal .select2-container { width: 100% !important; }
.erp-modal .lookup-row .select2-container { width: auto !important; }
.erp-modal .g-3 {
  --bs-gutter-x: .7rem;
  --bs-gutter-y: .5rem;
}
.erp-modal .g-2 {
  --bs-gutter-x: .6rem;
  --bs-gutter-y: .4rem;
}
.prod-form-sec {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 10px 12px 8px;
  margin-bottom: 8px;
  background: var(--surface);
}
.prod-form-sec:last-child { margin-bottom: 0; }
.prod-form-sec h6 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.erp-modal .prod-form-sec {
  background: var(--surface-2);
  border-color: var(--border);
}
.erp-modal .prod-form-hint {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(96, 165, 250, .08);
  border: 1px solid var(--border);
}
[data-theme="dark"] .erp-modal .prod-form-hint {
  background: rgba(96, 165, 250, .1);
}
.erp-modal .prod-form-batch {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: var(--surface);
}
.erp-modal .prod-form .form-check-label {
  color: var(--text);
  font-size: 13px;
}
.erp-modal .prod-form .form-text {
  color: var(--text-muted);
}
.erp-modal-prod.modal-dialog {
  max-width: 720px;
}
.modal-dialog.modal-md { max-width: 560px; }
.modal-dialog.erp-modal-sm {
  max-width: 480px;
  height: auto;
}
.modal-dialog.erp-modal-doc { max-width: 980px; }
.modal-dialog.erp-modal-doc-compact { max-width: 820px; }
.modal-dialog.erp-modal-doc-compact .quote-lines {
  min-height: 160px;
  max-height: min(38vh, 320px);
}
.modal-dialog.erp-modal-doc-sales {
  max-width: 980px;
}
.erp-modal-doc-sales .form-control:not(.quote-unit-read),
.erp-modal-doc-sales .form-select,
.erp-modal-doc-sales .lookup-row .select2-container .select2-selection--single {
  min-height: 28px;
  height: 28px;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
  font-size: 0.875rem;
}
.erp-modal-doc-sales .lookup-row .select2-container .select2-selection__rendered {
  line-height: 26px;
}
.erp-modal-doc-sales .lookup-row .select2-container .select2-selection__arrow {
  height: 26px;
}
.erp-modal-doc-sales .quote-composer-add .btn {
  height: 28px;
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}
.erp-modal-doc-sales .quote-unit-read {
  min-height: 28px;
  height: 28px;
  line-height: 1.2;
}
.erp-modal-doc-sales #quoteQtyStock {
  font-size: 0.8125rem;
}

/* Sales → New/Edit invoice: fixed desktop field widths */
.erp-modal-sales-invoice .si-w-date,
.erp-modal-sales-invoice .si-w-due {
  width: 160px;
  max-width: 100%;
}
.erp-modal-sales-invoice .si-field-date-wrap,
.erp-modal-sales-invoice .si-field-due-wrap {
  flex: 0 0 auto;
}
.erp-modal-sales-invoice .quote-composer-sale {
  grid-template-columns: minmax(0, 1fr) 100px 90px 100px auto;
}
.erp-modal-sales-invoice .si-w-unit {
  width: 100px;
  max-width: 100%;
}
.erp-modal-sales-invoice .si-w-qty {
  width: 90px;
  max-width: 100%;
}
.erp-modal-sales-invoice .si-w-price {
  width: 100px;
  max-width: 100%;
}
.erp-modal-sales-invoice .si-field-price-wrap {
  max-width: 100px;
}
.erp-modal-sales-invoice .inv-pay-fields {
  flex-wrap: wrap;
}
.erp-modal-sales-invoice .si-w-received {
  width: 150px;
  max-width: 100%;
}
.erp-modal-sales-invoice .si-w-onacct {
  width: 150px;
  max-width: 100%;
}
.erp-modal-sales-invoice .si-w-receive-into {
  width: 220px;
  max-width: 100%;
}
.erp-modal-sales-invoice #invPayNow.form-check-input {
  border: 1px solid #000;
}
.erp-modal-sales-invoice #invPayNow.form-check-input:focus {
  border-color: #000;
  box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.15);
}
.erp-modal-sales-invoice #invPayNow.form-check-input:checked {
  border-color: #000;
}

.erp-modal-buried {
  pointer-events: none;
}
.erp-modal-buried .modal-footer {
  visibility: hidden;
}
.erp-stack-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(15, 23, 42, .62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
  overflow: auto;
  pointer-events: auto;
}
.erp-stack-card,
.erp-stack-card input,
.erp-stack-card select,
.erp-stack-card textarea,
.erp-stack-card button,
.erp-stack-card .select2-container {
  pointer-events: auto;
}
.erp-stack-card {
  width: min(460px, 100%);
  margin: auto;
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .28);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 1.5rem);
  pointer-events: auto;
}
.erp-stack-card > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: inherit;
}
.erp-stack-head,
.erp-stack-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.65rem 0.9rem;
  flex: 0 0 auto;
}
.erp-stack-head {
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.erp-stack-body {
  padding: 0.75rem 0.9rem;
  overflow-y: auto;
  min-height: 0;
}
.erp-stack-foot {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding-bottom: max(0.9rem, env(safe-area-inset-bottom));
}
.erp-stack-overlay .select2-container { width: 100% !important; }
.select2-container--open { z-index: 20050 !important; }
body > .select2-container { z-index: 20060 !important; }

@media (max-width: 768px) {
  .modal-dialog,
  .erp-modal .modal-dialog,
  .erp-modal .modal-dialog.modal-dialog-centered,
  .erp-modal .modal-dialog.modal-xl,
  .erp-modal .modal-dialog.modal-lg,
  .erp-modal .modal-dialog.erp-modal-doc,
  .erp-modal .modal-dialog.erp-modal-sm {
    width: calc(100% - 0.7rem);
    max-width: calc(100% - 0.7rem);
    margin: 0.35rem auto;
    max-height: calc(100dvh - 0.7rem);
  }
  .erp-modal .modal-content,
  .modal-content {
    max-height: calc(100dvh - 0.7rem);
    border-radius: 12px;
  }
  .erp-modal .modal-header,
  .erp-modal .modal-footer {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }
  .erp-modal .modal-body {
    padding: 0.8rem 0.85rem 0.7rem;
    -webkit-overflow-scrolling: touch;
  }
  .erp-modal .modal-footer {
    padding-bottom: max(0.7rem, env(safe-area-inset-bottom));
    flex-wrap: wrap;
  }
  .erp-modal .modal-footer .btn {
    min-height: 42px;
  }
  .erp-modal .form-control,
  .erp-modal .form-select,
  .erp-modal .select2-selection,
  .erp-modal .select2-search__field,
  .swal2-popup input,
  .swal2-popup textarea {
    font-size: 16px !important;
  }
  .quote-lines {
    min-height: 180px;
    max-height: 38vh;
  }
  .quote-notes textarea {
    min-height: 34px;
    max-height: 46px;
  }
  .quote-composer,
  .pi-composer,
  .pi-composer-qty {
    grid-template-columns: 1fr 1fr;
  }
  .lookup-row {
    flex-wrap: wrap;
  }
  .lookup-row .select2-container {
    width: 100% !important;
    flex: 1 1 100%;
  }
  .swal2-popup.erp-swal {
    width: calc(100% - 1.2rem) !important;
    max-width: calc(100% - 1.2rem) !important;
    margin: 0.4rem auto !important;
  }
  .select2-container--open .select2-dropdown {
    max-width: calc(100vw - 1.2rem);
  }
}

.quote-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: visible;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.quote-panel-head {
  font-weight: 650;
  font-size: 0.9rem;
  padding: 0.8rem 1rem 0;
}
.quote-composer {
  display: grid;
  grid-template-columns: minmax(200px, 1.8fr) 88px 110px 100px 88px auto;
  gap: 0.65rem 0.7rem;
  align-items: end;
  padding: 0.7rem 1rem 0.9rem;
}
.quote-composer-sale {
  /* Product · Unit · Qty · Sales price · Add (6+2+2+2 of 12) */
  grid-template-columns: minmax(0, 6fr) minmax(0, 2fr) minmax(0, 2fr) minmax(0, 2fr) auto;
}
.quote-composer-sale > * {
  min-width: 0;
}
.quote-composer-sale .quote-composer-unit .quote-unit-read {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  text-align: center;
  background: var(--surface-2);
  cursor: default;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.quote-composer-sale.quote-composer-no-unit {
  grid-template-columns: minmax(0, 8fr) minmax(0, 2fr) minmax(0, 2fr) auto;
}
.quote-composer-pick-only {
  grid-template-columns: minmax(0, 1fr);
}
.quote-composer-pick-only .quote-composer-extra {
  display: none !important;
}
.quote-line-edit {
  min-width: 5.5rem;
  max-width: 7rem;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}
.quote-line-edit .form-control-sm {
  min-height: 32px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.quote-composer-add .btn {
  height: var(--ctrl-h);
  white-space: nowrap;
}
.quote-lines {
  border-top: 1px solid var(--border);
  flex: 1 1 auto;
  min-height: 260px;
  max-height: min(52vh, 480px);
  overflow: auto;
}
.quote-lines .table {
  margin: 0;
  border: 0;
  border-radius: 0;
  --bs-table-bg: var(--surface);
  --bs-table-color: var(--text);
  --bs-table-striped-bg: var(--surface);
  --bs-table-hover-bg: var(--surface-2);
  background: var(--surface);
}
.quote-lines .table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2) !important;
  color: var(--text-muted) !important;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.quote-lines .table thead th.col-no,
.quote-lines .table tbody td.col-no {
  width: 3rem;
  color: var(--text-muted) !important;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.quote-lines .table tbody td {
  background: var(--surface) !important;
  color: var(--text);
  border-color: var(--border);
}
.quote-lines .quote-empty td {
  background: var(--surface) !important;
  color: var(--text-muted) !important;
}
[data-theme="dark"] .quote-lines .table tbody td {
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .quote-lines .table tbody .text-muted,
[data-theme="dark"] .quote-lines .table tbody td.col-no {
  color: var(--text-muted) !important;
}
.erp-field-readonly {
  display: flex;
  align-items: center;
  min-height: var(--ctrl-h, 38px);
  padding: 0 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  background: var(--surface-2);
}
.quote-lines .table td,
.quote-lines .table th {
  border-left: 0;
  border-right: 0;
}
.quote-empty td {
  padding: 1.15rem !important;
  background: var(--surface) !important;
}
.quote-lines .quote-row-below-cost > td {
  color: #b42318;
  background: #fef3f2;
  border-color: #fecdca;
  box-shadow: inset 3px 0 0 #f04438;
}
.quote-lines .quote-row-below-cost .text-muted {
  color: #f97066 !important;
}
.quote-lines .quote-row-error > td,
.pi-sheet-lines tr.row-error > td {
  color: #b42318;
  background: #fef3f2;
  border-color: #fecdca;
  box-shadow: inset 3px 0 0 #f04438;
}
.quote-error-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  color: #b42318;
  background: #fee4e2;
  border: 1px solid #fecdca;
}
.quote-below-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #b42318;
  background: #fee4e2;
  border: 1px solid #fda29b;
  border-radius: 0.25rem;
  vertical-align: middle;
}
.quote-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem 1.25rem;
  align-items: start;
  padding: 0.55rem 1rem 0.7rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.quote-totals {
  text-align: right;
  min-width: 210px;
  display: grid;
  gap: 0.2rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.quote-totals .quote-grand {
  color: var(--text);
  font-size: 1rem;
  margin-top: 0.15rem;
}
.quote-notes textarea { min-height: 36px; max-height: 52px; resize: vertical; }
.pi-typeahead { position: relative; min-width: 0; }
.pi-typeahead .lookup-row { width: 100%; }
.pi-typeahead .form-control { flex: 1; min-width: 0; }
.pi-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  max-height: 240px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.pi-suggest-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 12px;
  color: var(--text);
}
.pi-suggest-item:hover,
.pi-suggest-item.active { background: var(--surface-2); }
.pi-suggest-empty { padding: 10px 12px; color: var(--text-muted); font-size: 13px; }
.pi-composer {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) 100px 120px auto;
  gap: 0.65rem 0.7rem;
  align-items: end;
  padding: 0.7rem 1rem 0.9rem;
}
.pi-composer-qty { grid-template-columns: minmax(220px, 1.8fr) 100px auto; }
.pi-disc-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}
.pi-disc-row .form-control { width: 110px; text-align: right; }
.pi-sheet {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
.pi-foot-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}
.pi-stamp-slot .inv-status-stamp {
  display: inline-block;
  transform: rotate(-10deg);
  border: 3px double #c41e3a;
  color: #c41e3a;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.85rem;
  opacity: 0.88;
  border-radius: 4px;
  font-family: Arial, Helvetica, sans-serif;
  text-transform: uppercase;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.1);
}
.pi-stamp-slot .inv-status-stamp.inv-stamp-paid { color: #b91c1c; border-color: #b91c1c; }
.pi-stamp-slot .inv-status-stamp.inv-stamp-partial { color: #c2410c; border-color: #ea580c; font-size: 0.95rem; }
.pi-stamp-slot .inv-status-stamp.inv-stamp-overdue { color: #991b1b; border-color: #991b1b; }
.pi-stamp-slot .inv-status-stamp.inv-stamp-posted { color: #c2410c; border-color: #c2410c; }
.pi-stamp-slot .inv-status-stamp.inv-stamp-unpaid { color: #c2410c; border-color: #ea580c; }
.public-invoice-wrap { max-width: 960px; }
.public-invoice-sheet .sheet { box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08); border: 1px solid var(--border, #e2e8f0); border-radius: 8px; padding: 16px; background: #fff; }
.pi-sheet-foot .pi-foot-right { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: flex-end; gap: 12px 20px; }
.pi-sheet-foot .inv-sum-block { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: flex-end; gap: 12px 20px; }
.pi-stamp-slot .inv-status-stamp.inv-stamp-void { color: #64748b; border-color: #64748b; opacity: 0.75; }
.pi-stamp-slot .inv-status-stamp.inv-stamp-draft { color: #475569; border-color: #64748b; }
.pi-sheet-lines {
  overflow: auto;
  max-height: min(55vh, 560px);
}
.pi-sheet-lines .table { margin: 0; }
.pi-sheet-lines thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
}
.pi-sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--border);
}
.pi-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.pi-supplier { font-size: 1.15rem; font-weight: 700; }
.pi-meta { display: grid; gap: 0.35rem; min-width: 180px; }
.pi-meta > div { display: flex; justify-content: space-between; gap: 1.5rem; font-size: 0.875rem; }
.pi-meta span { color: var(--text-muted); }
.pi-view-qr { flex: 0 0 auto; align-self: flex-start; text-align: center; }
.pi-view-qr-inner { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.pi-view-qr-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}
.pi-view-qr-hint { max-width: 8rem; line-height: 1.25; }
.report-preset-static { cursor: default; opacity: 0.92; }
.pi-sheet-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 0.9rem 1.2rem 1.1rem;
  background: var(--surface-2);
}
.pi-totals { min-width: 220px; display: grid; gap: 0.25rem; text-align: right; }
.pi-totals > div { display: flex; justify-content: space-between; gap: 2rem; color: var(--text-muted); }
.pi-totals .pi-grand { color: var(--text); font-size: 1.05rem; margin-top: 0.2rem; }
.pi-grn-preview { border: 1px dashed var(--border); border-radius: 10px; padding: 0.75rem; }
@media (max-width: 900px) {
  .pi-composer, .pi-composer-qty { grid-template-columns: 1fr 1fr; }
  .pi-composer > :first-child,
  .pi-composer .quote-composer-add { grid-column: 1 / -1; }
  .pi-sheet-foot { grid-template-columns: 1fr; }
  .pi-totals { text-align: left; min-width: 0; }
}
@media (max-width: 900px) {
  .quote-composer {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .quote-composer > :first-child,
  .quote-composer-add { grid-column: 1 / -1; }
  .quote-foot { grid-template-columns: 1fr; }
  .quote-totals { text-align: left; min-width: 0; }
}

body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .sidebar .brand-text,
body.sidebar-collapsed .sidebar .nav-section,
body.sidebar-collapsed .sidebar a span { display: none; }
body.sidebar-collapsed .sidebar .brand .brand-logo,
body.sidebar-collapsed .sidebar .brand .brand-logo.sm {
  max-height: 36px;
  max-width: 52px;
}
body.sidebar-collapsed .sidebar a { justify-content: center; padding: 12px 8px; }
body.sidebar-collapsed .main { margin-left: var(--sidebar-collapsed); }

@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    width: min(var(--sidebar-w), 86vw);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.open { transform: none; }
  body.sidebar-collapsed .sidebar { width: min(var(--sidebar-w), 86vw); }
  body.sidebar-collapsed .sidebar .nav-section,
  body.sidebar-collapsed .sidebar a span { display: unset; }
  body.sidebar-collapsed .sidebar .brand .brand-logo,
  body.sidebar-collapsed .sidebar .brand .brand-logo.sm {
    max-height: 46px;
    max-width: 168px;
  }
  body.sidebar-collapsed .sidebar a { justify-content: flex-start; padding: 9px 14px; }
  .sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1035;
  }
  .main, body.sidebar-collapsed .main {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }
  body.nav-open { overflow: hidden; }
  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "toggle search actions"
      "context context context";
    gap: 8px 8px;
    align-items: center;
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .topbar > #sbToggle { grid-area: toggle; }
  .topbar-search {
    grid-area: search;
    min-width: 0;
    max-width: none;
    width: 100%;
    flex: none;
  }
  .topbar-context {
    grid-area: context;
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    flex: none;
  }
  .topbar-actions {
    grid-area: actions;
    gap: 6px;
    justify-self: end;
    margin-left: auto;
  }
  .ctx-company { display: none; }
  .user-chip {
    max-width: none;
    padding: 2px;
    border-radius: 10px;
  }
  .user-chip .user-meta,
  .user-chip .user-caret { display: none; }
  .ctx-field { width: 100%; }
  .ctx-field span { display: none; }
  .ctx-field .form-select { width: 100%; }
  .page { padding: 12px; }
  .page-head { margin-bottom: 12px; }
  .page-title { font-size: 1.18rem; }
  .page-sub { font-size: 12px; }
  .table-filters .form-select,
  .table-filters .form-control {
    min-width: 0;
    flex: 1 1 calc(50% - 8px);
    max-width: none;
  }
  .table-shell,
  .card-soft { max-width: 100%; }
  .table-shell {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .table-shell .dt-scroll,
  .table-shell .dt-scroll-body,
  .table-shell .dataTables_scroll,
  .table-shell .dataTables_scrollBody {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .table-shell table.dataTable,
  .table-shell .table {
    width: 100% !important;
    min-width: 100%;
  }
  .table-shell table.dataTable thead th,
  .table-shell table.dataTable tbody td,
  .table-shell .table th,
  .table-shell .table td {
    white-space: nowrap;
  }
  .stat-card { padding: 10px 12px; }
  .stat-card .value { font-size: 1.05rem; }
  .report-summary { margin-bottom: 10px; }
  .report-groups {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin-bottom: 10px;
    gap: 6px;
  }
  .report-group { flex: 0 0 auto; white-space: nowrap; padding: 8px 10px; }
  .report-filters > div { min-width: 130px; flex: 0 0 auto; }
  #repBody { min-width: 0; }
}

@media (max-width: 576px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "toggle . actions"
      "search search search"
      "context context context";
    padding: 8px 10px;
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .topbar-actions { justify-self: end; }
  .topbar-search input { font-size: 16px; }
  .topbar-actions #themeQuick { display: none; }
  .page-head-actions .btn span,
  .page-head-actions .btn .me-1 { margin-right: 0 !important; }
  .dt-foot,
  div.dt-container .dt-layout-row:not(:has(.dt-scroll)):not(:has(table)) {
    flex-wrap: wrap;
  }
  div.dt-container .dt-right { margin-left: 0; }
  div.dt-container .dt-search,
  div.dt-container .dt-search input {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }
}

/* POS */
body.pos-mode .main { height: 100vh; height: 100dvh; overflow: hidden; }
body.pos-mode .page { padding: 0; overflow: hidden; min-height: 0; display: flex; flex-direction: column; }
.pos-app {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--background);
}
.pos-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  overflow: hidden;
}
.pos-cats {
  overflow: auto;
  padding: 12px 8px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  min-height: 0;
}
.pos-cat {
  width: 100%;
  border: 0;
  background: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
}
.pos-cat-img {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface-2);
  font-size: 18px;
  color: var(--text);
}
.pos-cat.active { color: var(--primary); }
.pos-cat.active .pos-cat-img {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  color: var(--primary);
}
.pos-stage { min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding: 10px 14px 0; }
.pos-stage-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.pos-meta {
  display: flex;
  align-items: center;
  gap: 10px 14px;
  min-width: 0;
}
.pos-hello { margin: 0; font-weight: 600; font-size: 13px; line-height: 1.2; }
.pos-hello span { color: var(--primary); }
.pos-date { font-size: 12px; color: var(--text-muted); }
.pos-clock {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  font-size: 12px;
  color: var(--text);
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
}
.pos-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.pos-search { position: relative; flex: 1 1 auto; min-width: 0; }
.pos-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.pos-search .form-control { padding-left: 36px; border-radius: 10px; height: 38px; }
.pos-unit-select,
.pos-sort-select,
.pos-letter-select {
  width: auto;
  max-width: 132px;
  flex: 0 0 auto;
  border-radius: 10px;
  height: 38px;
}
.pos-unit-select { max-width: 118px; }
.pos-letter-select { max-width: 72px; }
.pos-sort-select { max-width: 108px; }
.pos-toolbar .select2-container { width: 118px !important; flex: 0 0 118px; }
.pos-toolbar .select2-selection { height: 38px !important; border-radius: 10px !important; }
.pos-grid {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  grid-auto-rows: max-content;
  gap: 12px;
  align-items: stretch;
  align-content: start;
  padding: 0 2px 16px;
}
.pos-card {
  position: relative;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  color: var(--text);
  overflow: visible;
}
[data-theme="dark"] .pos-card { color: var(--text); border-color: var(--border); }
.pos-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.pos-picked { position: absolute; top: 8px; right: 8px; color: var(--success); font-size: 1.05rem; z-index: 1; }
.pos-card-img {
  width: 100%;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 10px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 28px;
  margin-bottom: 8px;
}
.pos-card-avatar { font-size: 0; }
[data-theme="dark"] .pos-card-img { background: var(--surface-2); color: var(--text-muted); }
.pos-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pos-card-letter {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
}
.pos-card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.pos-card h6 {
  font-size: 12px;
  font-weight: 650;
  color: inherit;
  margin: 0 0 6px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.pos-card-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: auto;
  min-width: 0;
}
.pos-price { color: var(--primary); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.pos-card .pos-step {
  width: 100%;
  justify-content: space-between;
  min-width: 0;
  padding: 3px;
  gap: 4px;
}
.pos-step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 2px;
  min-width: 88px;
}
.pos-step button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  line-height: 1;
  flex: 0 0 28px;
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--border);
}
.pos-step button:hover { color: var(--primary); border-color: var(--primary); }
.pos-step span { min-width: 20px; text-align: center; font-size: 13px; font-weight: 700; }
.pos-qty {
  flex: 1 1 auto;
  width: 2.5ch;
  min-width: 2.5ch;
  max-width: 4.5ch;
  height: 28px;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  padding: 0;
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}
.pos-qty::-webkit-outer-spin-button,
.pos-qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pos-qty:focus {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 28%, transparent);
}
.pos-ticket {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  min-width: 420px;
  max-width: 480px;
  width: min(36vw, 480px);
  overflow: hidden;
}
.pos-ticket-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px 6px;
  flex-shrink: 0;
}
.pos-ticket-head h5 { margin: 0; font-size: 1rem; }
.pos-ord { color: var(--primary); font-weight: 700; font-size: 13px; }
.pos-ticket-block { padding: 6px 16px; flex-shrink: 0; }
.pos-cust-row { display: flex; gap: 6px; align-items: center; }
.pos-cust-row select { flex: 1; min-width: 0; }
.pos-cust-row .select2-container { flex: 1; min-width: 0; }
.pos-cust-row .select2-container--default .select2-selection--single {
  min-height: 32px;
  border-radius: 8px;
}
.pos-lines {
  flex: 1 1 0;
  min-height: 160px;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 16px 10px;
  scroll-behavior: smooth;
  border-bottom: 1px solid var(--border);
}
.pos-ticket-foot {
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(48vh, 400px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 -6px 16px rgba(15, 23, 42, .04);
}
.pos-ticket-foot-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  padding-bottom: 4px;
}
.pos-ticket-foot .pos-ticket-block { padding: 8px 16px 6px; }
.pos-ticket-foot .form-label { margin-bottom: 2px; }
.pos-ticket-adjust .form-control-sm { height: 32px; }
.pos-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px auto 58px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  min-height: 52px;
}
.pos-line-meta { min-width: 0; }
.pos-line-name {
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pos-line-sub {
  font-size: 10px;
  line-height: 1.35;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}
.pos-line .amt { font-weight: 700; min-width: 0; text-align: right; padding-top: 0; font-variant-numeric: tabular-nums; font-size: 13px; }
.pos-line .pos-step { margin-top: 0; width: auto; justify-content: center; min-width: 96px; }
.pos-line .pos-qty { width: 2.75ch; flex: 0 0 2.75ch; min-width: 2.75ch; max-width: 4ch; }
.pos-line-price {
  width: 100%;
  max-width: 72px;
  margin-top: 0;
  padding: 4px 6px;
  height: 30px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.pos-line-price.is-invalid { border-color: var(--danger); }
.pos-line-cost { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.pos-line-err { font-size: 11px; color: var(--danger); margin-top: 1px; }
.pos-sum { padding: 6px 16px 4px; flex-shrink: 0; }
.pos-sum-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.pos-total { font-size: 1.2rem; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.pos-ticket-pay { padding: 4px 16px 6px; flex-shrink: 0; min-height: 0; }
.pos-pays {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: none;
  overflow: visible;
  padding-right: 2px;
  padding-bottom: 6px;
}
.pos-pay {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  display: flex; align-items: center; gap: 8px;
  text-align: left;
  min-width: 0;
}
.pos-pay span { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.2; }
.pos-pay small { font-weight: 500; opacity: .65; font-size: 10px; }
.pos-pay i { color: var(--primary); flex-shrink: 0; }
.pos-pay.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--primary); }
.pos-actions-row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 8px; padding: 8px 16px 12px; flex-shrink: 0; background: var(--surface); }
.pos-actions-row .btn { min-height: 44px; font-weight: 600; }
.pos-actions-extra { display: none; }
.pos-dock {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 8px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.hold-list { display: grid; gap: 8px; text-align: left; }
.hold-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.hold-resume {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  color: inherit;
}
.hold-resume:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.hold-del {
  width: 38px;
  min-width: 38px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  color: var(--danger);
}
.hold-del:hover { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.pos-ticket-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.pos-ticket-close {
  display: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pos-mobile-tools { display: none; }
.pos-cart-bar,
.pos-cart-scrim { display: none; }

@media (max-width: 1100px) {
  body.pos-mode .topbar-search,
  body.pos-mode .topbar-context { display: none; }
  body.pos-mode .topbar {
    display: flex;
    grid-template-areas: none;
    padding: 6px 10px;
  }
  .pos-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
  .pos-stage {
    grid-row: 1;
    padding: 8px 8px 0;
  }
  .pos-app.has-cart .pos-stage {
    padding-bottom: 78px;
  }
  .pos-stage-head { margin-bottom: 8px; gap: 6px; }
  .pos-mobile-tools {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .pos-mobile-tools .btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-weight: 600;
    font-size: 12px;
    border-radius: 10px;
    white-space: nowrap;
  }
  .pos-mobile-tools .btn i { font-size: 1rem; }
  .pos-toolbar { flex-wrap: nowrap; }
  .pos-search { flex: 1 1 auto; min-width: 120px; }
  .pos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: max-content;
    gap: 10px;
    padding-bottom: 12px;
  }
  .pos-ticket {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1045;
    width: 100%;
    max-width: none;
    min-width: 0;
    max-height: min(88dvh, 760px);
    height: auto;
    display: flex;
    flex-direction: column;
    border-left: 0;
    border-top: 0;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px rgba(15, 23, 42, .22);
    transform: translateY(110%);
    transition: transform .28s ease;
    overflow: hidden;
    background: var(--surface);
  }
  .pos-ticket.is-open { transform: translateY(0); }
  .pos-ticket-close { display: inline-flex; }
  .pos-ticket-head { padding: 10px 14px 6px; }
  .pos-ticket-block { padding: 4px 14px; }
  .pos-lines {
    flex: 1 1 auto;
    height: auto;
    max-height: none;
    min-height: 120px;
    padding: 2px 14px 8px;
  }
  .pos-ticket-foot {
    flex: 0 1 auto;
    max-height: min(52vh, 420px);
    overflow: hidden;
  }
  .pos-line { padding: 5px 0; min-height: 44px; }
  .pos-pays { grid-template-columns: 1fr 1fr; }
  .pos-cart-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(15, 23, 42, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
  }
  .pos-cart-scrim.is-open {
    opacity: 1;
    pointer-events: auto;
  }
  .pos-cart-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    align-items: center;
    gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #102a43;
    color: #fff;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, .2);
  }
  .pos-cart-bar[hidden] { display: none !important; }
  .pos-cart-bar-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.15;
  }
  .pos-cart-bar-info strong { font-size: 13px; font-weight: 700; }
  .pos-cart-bar-info span { font-size: 15px; font-weight: 800; color: #7dd3a7; }
  .pos-cart-bar .btn {
    flex-shrink: 0;
    font-weight: 700;
    min-height: 40px;
    padding-inline: 12px;
  }
  .pos-cart-bar .btn-success {
    background: #16a34a;
    border-color: #16a34a;
  }
  body.pos-cart-open .pos-cart-bar { display: none !important; }
  .pos-dock { display: none; }
  .pos-actions-extra {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    padding: 4px 16px 0;
  }
  .pos-actions-extra .btn { min-height: 36px; }
}
@media (max-width: 1680px) {
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
}
@media (max-width: 1400px) {
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
@media (max-width: 1100px) {
  .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .pos-meta .pos-date { display: none; }
  .pos-unit-select,
  .pos-sort-select { max-width: 92px; }
  .pos-letter-select { max-width: 64px; }
  .pos-toolbar .select2-container { width: 92px !important; flex: 0 0 92px; }
}

.notif-menu {
  width: min(380px, calc(100vw - 24px));
  padding: 0;
  overflow: hidden;
}
.notif-menu-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px 8px;
  font-size: 13px;
}
.notif-preview { max-height: 360px; overflow: auto; }
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text);
  border-top: 1px solid var(--border);
}
.notif-item:hover { background: var(--surface-2); color: var(--text); }
.notif-item.is-read { opacity: .65; }
.notif-ico {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.tone-info { background: color-mix(in srgb, var(--info) 16%, var(--surface)); color: var(--info); }
.tone-warning { background: color-mix(in srgb, var(--warning) 16%, var(--surface)); color: var(--warning); }
.tone-danger { background: color-mix(in srgb, var(--danger) 16%, var(--surface)); color: var(--danger); }
.tone-success { background: color-mix(in srgb, var(--success) 16%, var(--surface)); color: var(--success); }
.notif-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-title { font-weight: 600; font-size: 13px; }
.notif-msg { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-time { font-size: 11px; color: var(--text-muted); }
.notif-viewall {
  display: block;
  text-align: center;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-top: 1px solid var(--border);
  color: var(--primary);
}
.notif-viewall:hover { background: var(--surface-2); color: var(--primary); }
.alert-list { display: flex; flex-direction: column; }
.alert-list .notif-item { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; background: var(--surface); }
.alert-list .notif-msg { white-space: normal; }

.import-steps {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.import-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted); font-weight: 500;
}
.import-step-n {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); font-size: 12px; font-weight: 700;
}
.import-step.active { color: var(--primary); }
.import-step.active .import-step-n { background: var(--primary); color: #fff; }
.import-step.done .import-step-n { background: var(--success); color: #fff; }
.import-step-line { flex: 1; min-width: 16px; height: 1px; background: var(--border); }
.import-types {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}
.import-type {
  text-align: left; border: 1px solid var(--border); background: var(--surface);
  border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 4px;
}
.import-type i { font-size: 22px; color: var(--primary); }
.import-type strong { font-size: 14px; }
.import-type span { font-size: 12px; color: var(--text-muted); }
.import-type.active, .import-type:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.import-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-height: 160px; border: 1.5px dashed var(--border); border-radius: 16px;
  cursor: pointer; background: var(--surface-2);
}
.import-drop i { font-size: 28px; color: var(--primary); }
.import-map-help {
  margin: 0 0 16px;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 13px;
}
.import-map-help li { margin-bottom: 4px; }
.import-map-help strong { color: var(--text); }
body.import-busy { overflow: hidden; }
body.import-busy #app { pointer-events: none; user-select: none; }
.import-lock {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: color-mix(in srgb, #0f172a 55%, transparent);
  display: grid;
  place-items: center;
  cursor: wait;
}
.import-lock-card {
  width: min(440px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px 24px 24px;
  text-align: center;
}
.import-lock-card .pct {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}
.import-lock-card p {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 16px;
}
.import-lock-bar {
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.import-lock-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
  border-radius: inherit;
  transition: width .25s ease;
}

/* =========================
   DESIGN SYSTEM
========================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0;
  padding: .35em .65em;
  border-radius: 999px;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0;
  padding: .35em .7em;
  border-radius: 999px;
  line-height: 1.2;
  white-space: nowrap;
}
.status-active, .status-in-stock, .status-received, .status-delivered { background: color-mix(in srgb, var(--success) 18%, var(--surface)); color: var(--success); }
.status-paid { background: color-mix(in srgb, #16a34a 18%, var(--surface)); color: #15803d; }
.status-posted, .status-ledger { background: color-mix(in srgb, #2563eb 16%, var(--surface)); color: #1d4ed8; }
.status-unpaid { background: color-mix(in srgb, #dc2626 16%, var(--surface)); color: #dc2626; }
.status-overdue { background: color-mix(in srgb, #d97706 18%, var(--surface)); color: #b45309; }
.status-inactive, .status-archived, .status-draft { background: color-mix(in srgb, var(--secondary) 16%, var(--surface)); color: var(--secondary); }
.status-pending, .status-low, .status-near { background: color-mix(in srgb, var(--warning) 20%, var(--surface)); color: var(--warning); }
.status-partial { background: color-mix(in srgb, #ea580c 20%, var(--surface)); color: #c2410c; }
.status-approved, .status-reserved { background: color-mix(in srgb, var(--primary) 16%, var(--surface)); color: var(--primary); }
.status-cancelled, .status-expired, .status-out, .status-rejected, .status-locked, .status-void { background: color-mix(in srgb, var(--danger) 16%, var(--surface)); color: var(--danger); }
.txn-in, .qty-pos { color: var(--success); font-weight: 600; }
.txn-out, .qty-neg { color: var(--danger); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: nowrap;
}
.table-actions .btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}
.table thead th, .table tbody td { padding: .7rem .85rem; }
.table thead th.num, .table tbody td.num { text-align: right; }

.page-tabs .nav-link,
.page-pills .nav-link {
  white-space: nowrap;
}
.report-body { min-width: 0; max-width: 100%; }
.report-body .table-shell { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.report-summary { margin-bottom: 14px; }
.report-summary .stat-card {
  padding: 10px 12px;
}
.report-summary .stat-card .value {
  font-size: 1.12rem;
  font-weight: 650;
  color: var(--text);
}
.report-summary .stat-card .label {
  font-size: 11px;
  letter-spacing: 0.05em;
}
.stat-card-icon {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  line-height: 1;
}
.stat-card-icon .bi {
  font-size: 1.15rem;
  line-height: 1;
}
.stat-card-icon.stat-icon-primary {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
}
.stat-card-icon.stat-icon-success {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, var(--surface));
}
.stat-card-icon.stat-icon-warning {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 18%, var(--surface));
}
.stat-card-icon.stat-icon-danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
}
.stat-card-icon.stat-icon-secondary,
.stat-card-icon.stat-icon-muted {
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text-muted) 12%, var(--surface));
}
.stat-card-icon.stat-icon-info {
  color: var(--info, var(--primary));
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}
.report-summary .stat-card .stat-card-icon .bi {
  color: inherit;
  font-size: 1.15rem;
}
.report-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.report-shell-solo { grid-template-columns: 1fr; }
.report-nav {
  position: sticky;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.report-nav-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 4px 8px 8px;
}
.report-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.report-nav-item i { color: var(--primary); font-size: 15px; flex: 0 0 auto; }
.report-nav-item span:first-of-type { flex: 1; min-width: 0; }
.report-nav-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  background: color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: 999px;
  padding: 1px 7px;
}
.report-nav-item:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); color: var(--primary); }
.report-nav-item.active {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
}
.report-main { min-width: 0; }
.report-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.report-crumbs a { color: var(--text-muted); text-decoration: none; }
.report-crumbs a:hover { color: var(--primary); }
.report-crumbs .active { color: var(--text); font-weight: 600; }
.report-subbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.report-subbar-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
}
.report-subbar-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.report-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.report-pill:hover { border-color: var(--primary); color: var(--primary); }
.report-pill.active {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border-color: var(--primary);
  color: var(--primary);
}
.report-submenu {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 12px;
}
.report-submenu-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.report-submenu-list { display: flex; flex-direction: column; }
.report-submenu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  font-size: 13px;
  font-weight: 600;
}
.report-submenu-item:last-child { border-bottom: 0; }
.report-submenu-item:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); color: var(--primary); }
.report-submenu-item.active {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--primary);
}
.report-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.report-group {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.report-group i { color: var(--primary); font-size: 16px; }
.report-group:hover { border-color: var(--primary); color: var(--primary); }
.report-group.active {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border-color: var(--primary);
  color: var(--primary);
}
.report-subs { margin-bottom: 12px; }
@media (max-width: 992px) {
  .report-shell { grid-template-columns: 1fr; }
  .report-nav {
    position: static;
    max-height: none;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
  }
  .report-nav-title { display: none; }
  .report-nav-item { flex: 0 0 auto; white-space: nowrap; }
  .report-nav-count { display: none; }
}
.report-statement td { padding: .55rem .9rem; }
.report-indent td:first-child { padding-left: 1.75rem; color: var(--text-muted); }

/* Financial statement reports (balance sheet, P&L, …) — grid columns like accounting paper */
.report-statement-shell {
  background: color-mix(in srgb, var(--surface) 92%, #f5f0e6);
  border: 1px solid var(--border);
  border-radius: var(--radius, 8px);
  overflow: auto;
}
.report-fin-table {
  border-collapse: collapse !important;
  --fin-border: color-mix(in srgb, var(--border) 55%, #64748b);
}
.report-fin-table thead th {
  background: var(--surface-2);
  border: 1px solid var(--fin-border) !important;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 12px;
  vertical-align: bottom;
}
.report-fin-table tbody td {
  border: 1px solid var(--fin-border) !important;
  padding: 7px 12px;
  vertical-align: middle;
}
.report-fin-table tbody td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 108px;
}
.report-fin-table tbody tr.report-fin-section td {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--surface-2) 85%, transparent);
  color: var(--text);
}
.report-fin-table tbody tr.report-fin-section td.num {
  background: color-mix(in srgb, var(--surface-2) 85%, transparent);
}
.report-fin-table tbody tr.report-fin-total td {
  font-weight: 600;
}
.report-fin-table tbody tr.report-fin-total td.num {
  border-top: 2px solid color-mix(in srgb, var(--text) 35%, var(--fin-border)) !important;
  font-weight: 700;
}
.report-fin-table tbody tr.report-fin-grand td.num {
  border-top: 3px double color-mix(in srgb, var(--text) 50%, var(--fin-border)) !important;
  font-weight: 700;
}
.report-fin-table tbody tr.report-indent td:first-child {
  padding-left: 1.5rem;
  font-weight: 400;
  color: var(--text);
}
.inv-profit-head .fw-semibold { font-size: 1.05rem; }
#repTable td.num { text-align: right; font-variant-numeric: tabular-nums; }
.report-statement-shell .dataTables_wrapper .dataTables_paginate,
.report-statement-shell .dataTables_wrapper .dataTables_info,
.report-statement-shell .dataTables_wrapper .dataTables_length,
.report-statement-shell .dataTables_wrapper .dataTables_filter {
  display: none !important;
}
.filter-card { padding: 14px 16px; margin-bottom: 14px; }
.filter-card .form-label { margin-bottom: 4px; font-size: 12px; color: var(--text-muted); }
.filter-card-summary:not(:empty) { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.filter-card-summary .report-summary { margin-bottom: 0; }
.doc-status-presets {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr));
  margin-bottom: 0;
}
.doc-status-presets .report-preset {
  cursor: pointer;
  min-height: 88px;
}
.doc-status-presets .report-preset.active {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 35%, transparent);
}
.doc-status-presets .report-preset-s {
  color: var(--success);
  font-weight: 600;
}
.report-filters {
  align-items: flex-end;
  flex-wrap: nowrap;
  gap: 10px 12px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.report-filters > div { min-width: 140px; flex: 0 0 auto; }
.report-filters > button { flex: 0 0 auto; }
.filter-card .table-filters { align-items: flex-end; padding-bottom: 2px; }
.report-filters .report-filter-party {
  min-width: 280px;
  flex: 1 1 320px;
  max-width: 420px;
}
.report-filters .report-filter-party .select2-container {
  width: 100% !important;
}
.report-filters .report-filter-party .select2-container--default .select2-selection--single {
  min-height: 34px;
}
.report-presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.report-preset {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.report-preset:hover { border-color: var(--primary); }
.report-preset.active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.report-preset-n { font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.report-preset-l { font-size: 13px; font-weight: 600; }
.report-preset-s { font-size: 11px; color: var(--text-muted); }
.audit-json {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 12px;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.audit-diff { font-size: 13px; }
.audit-diff dt { color: var(--text-muted); font-weight: 600; margin-top: 8px; }
.audit-diff dd { margin: 0; }
.ctx-field .form-select {
  border-radius: 8px;
  background: var(--surface-2);
}
.topbar .btn-icon:focus-visible,
.user-chip:focus-visible,
.form-select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}
.empty-state i { opacity: .7; }
.brand-asset-card { padding: 16px; }
.brand-asset-preview {
  min-height: 120px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background-color: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
  gap: 6px;
}
/* When a logo is shown, use real UI surfaces (not a checkerboard) so transparent PNGs read correctly. */
.brand-asset-preview:has(.brand-asset-img:not(.d-none)) {
  border-style: solid;
  background-color: var(--surface);
}
.brand-asset-preview[data-preview-kind="main"]:has(.brand-asset-img:not(.d-none)) {
  background-color: var(--sidebar-background);
}
.brand-asset-preview[data-preview-kind="icon"]:has(.brand-asset-img:not(.d-none)),
.brand-asset-preview[data-preview-kind="favicon"]:has(.brand-asset-img:not(.d-none)) {
  background-color: var(--bg);
}
.brand-asset-preview[data-preview-kind="invoice"]:has(.brand-asset-img:not(.d-none)) {
  background-color: color-mix(in srgb, var(--surface) 88%, #fff);
}
[data-theme="dark"] .brand-asset-preview[data-preview-kind="invoice"]:has(.brand-asset-img:not(.d-none)) {
  background-color: var(--surface);
}
.brand-asset-preview[data-preview-kind="main"] { min-height: 100px; }
.brand-asset-preview[data-preview-kind="icon"] { min-height: 168px; }
.brand-asset-preview[data-preview-kind="favicon"] { min-height: 100px; }
.brand-asset-preview[data-preview-kind="invoice"] { min-height: 120px; }
.brand-asset-img { object-fit: contain; display: block; max-width: 100%; }
.brand-asset-img--main { max-height: 72px; max-width: 100%; width: auto; }
.brand-asset-img--icon { width: 128px; height: 128px; max-width: 128px; max-height: 128px; }
.brand-asset-img--favicon { width: 48px; height: 48px; max-width: 48px; max-height: 48px; }
.brand-asset-img--invoice { max-height: 96px; max-width: 100%; width: auto; }
.brand-asset-hint {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.25;
  max-width: 100%;
}
.brand-asset-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
}
.brand-asset-empty i { font-size: 28px; opacity: .6; }
.brand-profile-logo-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  min-width: 120px;
  min-height: 88px;
}
.brand-profile-logo-wrap--doc {
  background: color-mix(in srgb, var(--surface) 88%, #fff);
}
[data-theme="dark"] .brand-profile-logo-wrap--doc {
  background: var(--surface-2);
}
.brand-profile-card .brand-logo,
.brand-profile-card .brand-doc-logo {
  max-height: 88px;
  max-width: 168px;
  object-fit: contain;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.brand-doc-placeholder {
  width: 120px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
}
.brand-doc-placeholder i { font-size: 22px; }
.brand-doc-placeholder:hover { color: var(--primary); border-color: var(--primary); }

.priv-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.priv-toolbar-user { flex: 1 1 280px; min-width: 220px; }
.priv-toolbar .btn { height: 38px; }
.priv-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.priv-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
}
.priv-chip.active, .priv-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}
.priv-boards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.priv-board {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.priv-board-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.priv-board-toggles { display: flex; gap: 6px; }
.priv-all, .priv-group-all {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 0 4px;
  cursor: pointer;
}
.priv-all:hover, .priv-group-all:hover { color: var(--primary); }
.priv-crud, .priv-extra, .priv-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.priv-extra, .priv-cards { margin-top: 10px; }
.priv-cards-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin: 12px 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.priv-board-wide {
  grid-column: 1 / -1;
}
@media (min-width: 1100px) {
  .priv-board-wide:not(:has(.priv-tab-group)) {
    grid-column: span 2;
  }
}
.priv-tabs { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.priv-tab-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
}
.priv-tab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-left: auto;
}
.priv-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin: 0;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--surface-2) 80%, var(--surface));
  user-select: none;
}
.priv-check:hover {
  border-color: var(--border);
  background: var(--surface-2);
}
.priv-check:has(input:checked) {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  background: var(--primary-soft);
  font-weight: 500;
}
.priv-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
}
.chart-box {
  position: relative;
  height: 200px;
}
.chart-box-sm { height: 200px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.priv-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}
.priv-who { font-size: 14px; }

.priv-sticky-bar {
  position: sticky;
  top: 0;
  z-index: 1020;
  margin: -4px 0 14px;
  padding: 10px 0;
  background: color-mix(in srgb, var(--background) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.priv-sticky-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.priv-sticky-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 200px;
  font-size: 14px;
}
.priv-sticky-meta > i {
  font-size: 1.25rem;
  color: var(--primary);
  flex-shrink: 0;
}
.priv-sticky-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}
.priv-unsaved {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--warning) 18%, var(--surface));
  color: var(--warning);
  border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border));
}
.priv-board {
  transition: border-color .15s ease, box-shadow .15s ease;
}
.priv-board:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}
.priv-board-head i {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 1rem;
}
.priv-tab-group .priv-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: 8px;
}
@media (max-width: 768px) {
  .priv-sticky-actions { width: 100%; margin-left: 0; }
  .priv-sticky-actions .btn { flex: 1 1 auto; }
  .priv-boards { grid-template-columns: 1fr; }
}

.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 14%, var(--surface)) 0%, var(--surface) 58%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.dash-kicker {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 4px;
}
.dash-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.dash-chip.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}
.dash-work {
  color: var(--text);
  transition: transform .15s ease, border-color .15s ease;
}
.dash-work:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}
.dash-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.dash-action:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 12%, transparent);
}
.dash-action-icon { font-size: 1.35rem; line-height: 1; margin-bottom: 4px; }
.dash-action-title { font-weight: 600; font-size: 0.95rem; }
.dash-action-hint { font-size: 12px; color: var(--text-muted); }
.catalog-selectable { cursor: pointer; }
tr.catalog-row-selected > td {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface)) !important;
}
.catalog-head-toolbar .btn { white-space: nowrap; }
.catalog-img-col { width: 52px; padding-top: 6px !important; padding-bottom: 6px !important; }
.catalog-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
  background: var(--surface);
}
.catalog-status-stack .status-badge { font-size: 11px; padding: 2px 6px; white-space: nowrap; }
.catalog-thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.1rem;
  background: color-mix(in srgb, var(--border) 40%, var(--surface));
}
.catalog-thumb--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.15rem;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
}
.dash-kpis .stat-card { padding: 10px 12px; }
.dash-kpis .stat-card .value { font-size: 1.05rem; margin-top: 2px; }
.dash-kpis .stat-card .label { font-size: 11px; }
.dash-kpis .stat-card-link { min-width: 0; }
.dash-kpis .stat-card .value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.stat-card-link:hover .stat-card { border-color: var(--primary); }
.dash-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.dash-panel-head h6 { font-size: 13px; font-weight: 700; }
.dash-table {
  font-size: 13px;
  --bs-table-bg: var(--surface);
  --bs-table-color: var(--text);
  --bs-table-striped-bg: var(--surface-2);
  --bs-table-hover-bg: var(--surface-2);
  background: var(--surface);
}
.dash-table thead th {
  font-size: 11px;
  padding: 6px 8px;
  background: var(--surface-2) !important;
  color: var(--text-muted) !important;
  border-color: var(--border);
}
.dash-table tbody td {
  padding: 6px 8px;
  background: var(--surface) !important;
  color: var(--text);
  border-color: var(--border);
}
.dash-table tbody .text-muted { color: var(--text-muted) !important; }
.dash-table tbody tr:hover td { background: var(--surface-2) !important; }
.dash-table a.table-name-link,
.dash-table a.table-id-link {
  color: var(--primary);
}
.dash-panel .table-responsive { background: var(--surface); border-radius: 8px; }
.card-soft .table-responsive:not(.table-shell) {
  background: var(--surface);
  border-radius: 8px;
}
[data-theme="dark"] .table > :not(caption) > * > * {
  --bs-table-bg: var(--surface);
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
}
[data-theme="dark"] .table thead th {
  --bs-table-bg: var(--surface-2);
  background-color: var(--surface-2) !important;
  color: var(--text-muted) !important;
}
.dash-empty {
  padding: 18px 10px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.dash-empty i { display: block; font-size: 1.35rem; margin-bottom: 6px; opacity: .45; }
.view-panel { width: min(400px, 100vw) !important; }
.view-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.view-panel-head .avatar {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
  flex: 0 0 auto;
}
.view-panel .view-kv {
  grid-template-columns: 110px 1fr;
  gap: 6px 10px;
  font-size: 13px;
}
.view-modes {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.view-mode {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.view-mode + .view-mode { border-left: 1px solid var(--border); }
.view-mode.active {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
}
.view-mode:hover { color: var(--primary); }
.date-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.date-preset {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}
.date-preset.active, .date-preset:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}
.inv-hero, .prod-hero {
  margin-bottom: 12px;
}
.inv-grid, .prod-grid, .report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.inv-card, .prod-card, .report-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
  min-height: 118px;
}
.inv-card:hover, .prod-card:hover, .report-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}
.inv-card-meta, .prod-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.inv-card-meta strong, .prod-card-meta strong { color: var(--text); }
.report-card h6 { font-size: 13px; font-weight: 700; margin: 0 0 8px; }
.report-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  font-size: 12px;
}
.report-card-grid span { display: block; color: var(--text-muted); font-size: 10px; text-transform: uppercase; }
.report-print-bar { display: none; }
#page[data-view="cards"] .table-shell table.dataTable,
#page[data-view="cards"] .dt-mid { display: none; }
#page[data-view="table"] .inv-grid,
#page[data-view="table"] .prod-grid,
#page[data-view="table"] .report-cards,
#page[data-view="compact"] .inv-grid,
#page[data-view="compact"] .prod-grid,
#page[data-view="compact"] .report-cards { display: none; }
#page[data-view="compact"] .table { font-size: 12px; }
#page[data-view="compact"] .table td,
#page[data-view="compact"] .table th { padding: 5px 8px; }
#page[data-view="print"] .no-print,
#page[data-view="print"] .page-tabs-wrap,
#page[data-view="print"] .report-groups,
#page[data-view="print"] .report-nav,
#page[data-view="print"] .report-subbar,
#page[data-view="print"] .report-submenu,
#page[data-view="print"] .report-crumbs,
#page[data-view="print"] .filter-card,
#page[data-view="print"] .dt-bar,
#page[data-view="print"] .dt-foot,
#page[data-view="print"] .table-actions,
#page[data-view="print"] .view-modes { display: none !important; }
#page[data-view="print"] .report-print-bar { display: block; margin-bottom: 10px; }
#page[data-view="print"] .table-shell { box-shadow: none; border: 1px solid var(--border); }
.xfer-doc { display: grid; gap: 12px; }
.xfer-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.xfer-meta .label { font-size: 11px; color: var(--text-muted); }
.prod-profile { display: grid; grid-template-columns: 1.6fr .9fr; gap: 12px; }
.prod-kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; font-size: 13px; }
.prod-kv .k { color: var(--text-muted); }
@media (max-width: 900px) {
  .prod-profile { grid-template-columns: 1fr; }
  .view-mode span { display: none; }
}

.stat-card { position: relative; overflow: hidden; }
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--primary);
}
.stat-card.is-pos {
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--success) 28%, var(--border));
}
.stat-card.is-pos::before { background: var(--success); }
.stat-card.is-neg {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 28%, var(--border));
}
.stat-card.is-neg::before { background: var(--danger); }
.stat-card.stat-plain,
.stat-card.stat-plain.is-pos,
.stat-card.stat-plain.is-neg {
  background: var(--surface);
  border-color: var(--border);
}
.stat-card.stat-plain::before { background: var(--border); width: 2px; }
.stat-card.stat-plain .value { color: var(--text); font-weight: 600; }
.stat-card.stat-plain .label { color: var(--text-muted); }
.amt-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.4;
}
.amt-pill.amt-pos {
  background: color-mix(in srgb, var(--success) 16%, transparent);
  color: color-mix(in srgb, var(--success) 85%, #064e3b);
}
.amt-pill.amt-neg {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: color-mix(in srgb, var(--danger) 88%, #7f1d1d);
}
.amt-pill.amt-zero {
  background: color-mix(in srgb, var(--text-muted) 10%, transparent);
  color: var(--text-muted);
}
.money-flow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}
.money-flow-from { color: var(--text-muted); }
.money-flow-to { font-weight: 600; color: var(--text); }
.money-flow i { color: var(--primary); font-size: 12px; }
.report-flow-note {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
}
.daily-sec-head {
  background: color-mix(in srgb, var(--primary) 4%, var(--surface));
}
.daily-sec .dataTables_wrapper {
  padding: 0 12px 12px;
}
.daily-sec thead th {
  font-size: 12px;
  text-transform: capitalize;
  white-space: nowrap;
}
.report-daily-ranges .btn { min-width: 5.5rem; }
@media print {
  .daily-sec { break-inside: avoid; }
  .daily-sec .dataTables_filter,
  .daily-sec .dataTables_length,
  .daily-sec .dt-buttons { display: none !important; }
}
.stat-card .value .amt-pill { font-size: inherit; padding: 3px 10px; }
@media print {
  .amt-pill { background: transparent !important; padding: 0; }
  .stat-card.is-pos, .stat-card.is-neg { background: transparent !important; }
  .report-flow-note { display: none !important; }
}
.profile-devices-card {
  margin-top: 0.5rem;
}
.profile-devices-card--page-bottom {
  margin-top: 2.25rem;
  padding-top: 1.5rem !important;
}
.profile-device-card.is-current {
  box-shadow: 0 0 0 1px var(--bs-primary);
}
.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}
.profile-hero .user-avatar,
.profile-hero .user-avatar-fallback { width: 72px; height: 72px; font-size: 24px; }
.profile-photo {
  position: relative;
  display: inline-flex;
  cursor: pointer;
  margin: 0;
}
.profile-photo .user-avatar,
.profile-photo .user-avatar-fallback {
  object-fit: cover;
}
.profile-photo.is-uploading::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.35);
}
.profile-photo-edit {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 0 0 2px var(--surface);
}
.profile-audit { max-height: 420px; overflow: auto; }
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.profile-kv {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.profile-kv i { color: var(--primary); margin-top: 3px; }
.profile-kv span { display: block; color: var(--text-muted); font-size: 12px; }
.profile-kv strong { font-weight: 600; }
.prod-detail-hero {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.prod-detail-photo {
  width: 96px;
  height: 96px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.prod-detail-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.prod-detail-photo.is-empty i {
  font-size: 2rem;
  color: var(--primary);
  opacity: .7;
}
.prod-detail-hero-text { min-width: 0; flex: 1; }
.prod-detail-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.prod-detail-dates strong { color: var(--text); font-weight: 600; }
.prod-detail-upload-preview {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.prod-detail-upload-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}
.prod-detail-upload-preview.is-empty { padding: 24px; }
.prod-detail-scroll { max-height: 360px; overflow: auto; }
.prod-detail-scroll-sm { max-height: 240px; overflow: auto; }
.prod-detail-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.prod-detail-list li:last-child { border-bottom: 0; }
@media (max-width: 767.98px) {
  .prod-detail-hero { flex-direction: column; align-items: stretch; }
  .prod-detail-photo { width: 100%; height: 160px; }
}
.table-name-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14.5px;
  letter-spacing: -.01em;
  color: var(--primary);
  text-decoration: none;
  line-height: 1.25;
}
.table-name-link i {
  font-size: 14px;
  opacity: .9;
  flex-shrink: 0;
}
.table-name-link:hover {
  color: color-mix(in srgb, var(--primary) 82%, var(--text));
  text-decoration: none;
}
.table-name-link:hover span { text-decoration: underline; }
.table-id-link {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: -.02em;
  color: var(--primary);
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: color .12s ease, border-color .12s ease;
}
.table-id-link:hover,
.table-id-link:focus {
  color: color-mix(in srgb, var(--primary) 78%, var(--text));
  border-bottom-color: color-mix(in srgb, var(--primary) 45%, transparent);
  text-decoration: none;
}
.table-id-link.is-static {
  color: var(--text);
  cursor: default;
  border-bottom: 0;
}
.table a[data-p],
.table a[data-j],
.table a[data-e],
.table a[data-x],
.je-sheet a[href^="#/"],
.dash-table a.table-id-link {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--primary);
  text-decoration: none;
}
.table a[data-p]:hover,
.table a[data-j]:hover,
.table a[data-e]:hover {
  color: color-mix(in srgb, var(--primary) 78%, var(--text));
  text-decoration: underline;
}
.table-name-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -.01em;
  color: var(--text);
  line-height: 1.25;
}
.med-empty { color: var(--text-muted); opacity: .55; }
.med-pill {
  display: inline-flex;
  align-items: center;
  padding: .2em .65em;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
}
.med-pill-form {
  background: color-mix(in srgb, var(--info, #0dcaf0) 12%, var(--surface));
  color: var(--info, #0aa2c0);
  border-color: color-mix(in srgb, var(--info, #0dcaf0) 22%, var(--border));
}
.med-batch {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table-code {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: -.02em;
  color: var(--primary);
}

.money-subnav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.money-subnav a {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.money-subnav a.active,
.money-subnav a:hover { color: var(--primary); border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.money-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.money-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.money-card:hover { border-color: var(--primary); }
.money-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.money-ico {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
}
.money-ico-cash {
  color: #0d9488;
  background: color-mix(in srgb, #0d9488 16%, var(--surface));
}
.money-ico-bank {
  color: #2563eb;
  background: color-mix(in srgb, #2563eb 14%, var(--surface));
}
.money-ico-mobile {
  color: #7c3aed;
  background: color-mix(in srgb, #7c3aed 14%, var(--surface));
}
.money-ico-wallet {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
}
.money-ico-card {
  color: #db2777;
  background: color-mix(in srgb, #db2777 12%, var(--surface));
}
.money-ico-other {
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text-muted) 12%, var(--surface));
}
.money-type-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
}
.money-type-cash {
  background: color-mix(in srgb, #0d9488 18%, var(--surface));
  color: #0f766e;
  border-color: color-mix(in srgb, #0d9488 28%, var(--border));
}
.money-type-bank {
  background: color-mix(in srgb, #2563eb 16%, var(--surface));
  color: #1d4ed8;
  border-color: color-mix(in srgb, #2563eb 26%, var(--border));
}
.money-type-mobile {
  background: color-mix(in srgb, #7c3aed 16%, var(--surface));
  color: #6d28d9;
  border-color: color-mix(in srgb, #7c3aed 26%, var(--border));
}
.money-type-wallet {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 26%, var(--border));
}
.money-type-card {
  background: color-mix(in srgb, #db2777 14%, var(--surface));
  color: #be185d;
  border-color: color-mix(in srgb, #db2777 24%, var(--border));
}
.money-type-other {
  background: var(--badge-neutral-bg);
  color: var(--badge-neutral-fg);
  border-color: var(--badge-neutral-bd);
}
.money-card-bal {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 10px;
}
.money-card-bal .amt-pill {
  font-size: 1.15rem;
  padding: 2px 10px;
}
.money-card-name { font-weight: 600; line-height: 1.25; }
.money-card-meta { color: var(--text-muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.money-card-gl { color: var(--text-muted); font-size: 11px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xfer-bal {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.xfer-bal strong { color: var(--text); font-variant-numeric: tabular-nums; }
.xfer-bal.is-bad, .xfer-preview.is-bad { color: #b42318; }
.xfer-preview {
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border, #e5e7eb));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
}
.xfer-stamp {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
#recBody {
  max-width: 100%;
  min-width: 0;
  overflow-x: visible;
}
#recBody > .row {
  max-width: 100%;
  min-width: 0;
  --bs-gutter-x: 0.75rem;
}
.rec-check-col {
  min-width: 0;
  max-width: 100%;
}
.rec-check-card {
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}
.rec-check-card > .d-flex {
  min-width: 0;
  max-width: 100%;
}
.rec-toggle {
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.rec-toggle:hover,
.rec-toggle:focus-visible {
  text-decoration: underline;
}
.rec-toggle-ico {
  transition: transform 0.15s ease;
  display: inline-block;
}
.rec-toggle[aria-expanded="true"] .rec-toggle-ico {
  transform: rotate(90deg);
}
.rec-collapse.collapsing,
.rec-collapse.show {
  overflow: visible;
  max-width: 100%;
}
.rec-table-fallback {
  overflow-x: auto;
}
.rec-docs {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
/* Reconciliation: one horizontal scroll strip (mobile + desktop) */
.rec-table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  contain: inline-size;
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
}
.rec-table-scroll::-webkit-scrollbar,
.rec-table-scroll .dt-scroll-body::-webkit-scrollbar,
.rec-table-scroll div.dt-scroll-body::-webkit-scrollbar {
  height: 10px;
}
.rec-table-scroll::-webkit-scrollbar-thumb,
.rec-table-scroll .dt-scroll-body::-webkit-scrollbar-thumb,
.rec-table-scroll div.dt-scroll-body::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 8px;
}
.rec-table-scroll div.dt-scroll,
.rec-table-scroll div.dt-scroll-body,
.rec-table-scroll .dt-scroll-body {
  max-width: 100% !important;
  overflow-x: auto !important;
}
.rec-table-scroll:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}
.rec-table-scroll .rec-table-shell.table-shell {
  overflow: visible;
  width: max-content;
  min-width: 100%;
  max-width: none;
  box-shadow: none;
}
.rec-table-scroll div.dt-container,
.rec-table-scroll .dataTables_wrapper {
  width: max-content;
  min-width: 100%;
  max-width: none;
}
.rec-table-scroll table.rec-dt,
.rec-table-scroll table.dataTable {
  width: max-content !important;
  min-width: 100%;
  margin: 0 !important;
}
.rec-table-shell {
  max-width: none;
}
.rec-table-shell .dt-bar,
.rec-table-shell .dt-foot {
  padding-left: 12px;
  padding-right: 12px;
}
.rec-table-shell table.dataTable thead th,
.rec-table-shell .dash-table thead th {
  white-space: nowrap;
  font-size: 11px;
  padding-left: 10px;
  padding-right: 10px;
}
.rec-table-shell table.dataTable tbody td {
  vertical-align: top;
  font-size: 12.5px;
  padding-left: 10px;
  padding-right: 10px;
}
.rec-table-shell td.num,
.rec-table-shell th.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rec-wallets-col {
  min-width: 10rem;
  max-width: 18rem;
}
.rec-wallet-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rec-wallet-list li {
  line-height: 1.35;
}
.card-soft .rec-table-scroll .rec-table-shell.table-shell {
  border-color: var(--border);
}
.rec-check-card--warn {
  border-color: color-mix(in srgb, var(--danger, #dc3545) 22%, var(--border));
}
.rec-dt tbody tr {
  cursor: pointer;
}
.rec-dt tbody tr.rec-row-bad td {
  background: color-mix(in srgb, var(--danger, #dc3545) 6%, var(--surface)) !important;
}
.rec-trace-col {
  width: 52px;
  text-align: center;
  vertical-align: middle !important;
}
.rec-trace-btn {
  line-height: 1.2;
}
.rec-reason-col {
  min-width: 12rem;
  max-width: 22rem;
}
.rec-trace-actions .btn {
  text-align: left;
}
.view-panel .rec-trace-actions {
  border-color: var(--border) !important;
}
.rec-table-shell .dt-bar {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  padding-top: 8px;
  padding-bottom: 8px;
}
.xfer-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.xfer-swap-wrap {
  display: flex;
  align-items: center;
  padding-top: 1.85rem;
}
.xfer-swap-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-color: var(--input-border);
  background: var(--surface-2);
  color: var(--text);
}
.xfer-swap-btn:hover,
.xfer-swap-btn:focus-visible {
  background: var(--input-background);
  border-color: var(--primary);
  color: var(--primary);
}
.is-xfer-modal .xfer-modal .form-control,
.is-xfer-modal .xfer-modal .form-select {
  background-color: var(--input-background);
  color: var(--text);
  border-color: var(--input-border);
}
.is-xfer-modal .xfer-modal .select2-container--default .select2-selection--single {
  min-height: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--input-background);
  border-color: var(--input-border);
}
.is-xfer-modal .xfer-modal .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 36px;
  color: var(--text);
}
.is-xfer-modal .xfer-modal .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 36px;
  right: 8px;
}
.is-xfer-modal .xfer-modal .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-top-color: var(--text-muted);
}
.is-xfer-modal .modal-footer .btn-primary {
  min-width: 8.5rem;
  font-weight: 600;
}
@media (max-width: 575.98px) {
  .xfer-pair {
    grid-template-columns: 1fr;
    grid-template-areas: "from" "swap" "to";
  }
  .xfer-from { grid-area: from; }
  .xfer-swap-wrap {
    grid-area: swap;
    justify-content: center;
    padding-top: 0;
    margin: -2px 0;
  }
  .xfer-to { grid-area: to; }
}
.erp-a4-view {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: #525659;
  display: flex;
  flex-direction: column;
}
.erp-a4-bar { display: none !important; }
.erp-a4-float {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 2110;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(30, 41, 59, .92);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.erp-a4-float kbd {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  margin-left: 4px;
}
.erp-a4-frame {
  flex: 1 1 auto;
  width: min(210mm, calc(100% - 24px));
  margin: 12px auto;
  background: #fff;
  border: 0;
  box-shadow: 0 4px 24px rgba(0,0,0,.35);
}
body.erp-a4-open { overflow: hidden; }
@media print {
  .erp-a4-float, .erp-a4-bar { display: none !important; }
}

.je-sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.je-sheet-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px 18px;
  flex: 1;
  min-width: 220px;
}
.je-sheet-meta span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.je-sheet-meta strong { font-weight: 600; }
.je-lines tfoot th {
  border-top: 2px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.je-lines td, .je-lines th { font-variant-numeric: tabular-nums; }
.pay-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.35;
}
.pay-hint.in {
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 22%, var(--border));
}
.pay-hint.out {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 22%, var(--border));
}
.pay-alloc {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}
.pay-alloc .table { margin: 0; font-variant-numeric: tabular-nums; }
.pay-receipt {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: -4px;
}
.pay-receipt-top {
  padding: 4px 4px 12px;
  border-bottom: 1px dashed var(--border);
}
.pay-receipt-body {
  padding: 12px 4px;
}
.pay-inv-list {
  max-height: min(42vh, 360px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.pay-inv-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(96px, 120px);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.pay-inv-row:last-child { border-bottom: 0; }
.pay-inv-row.is-on {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}
.pay-inv-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  cursor: pointer;
  min-width: 0;
}
.pay-inv-check input { margin-top: 4px; flex-shrink: 0; }
.pay-inv-check span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pay-inv-check strong { font-size: 13px; }
.pay-inv-check small { color: var(--text-muted); font-size: 11px; line-height: 1.3; }
.pay-inv-due {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.pay-inv-due span { display: block; font-size: 11px; color: var(--text-muted); }
.pay-inv-due strong { font-size: 13px; }
.pay-inv-amt .form-label { font-size: 11px; color: var(--text-muted); }
.pay-inv-amt input { font-variant-numeric: tabular-nums; font-weight: 600; }
.pay-receipt-foot {
  padding: 12px 4px 0;
  border-top: 1px dashed var(--border);
}
.pay-receipt-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
}
.pay-receipt-total span { font-size: 13px; color: var(--text-muted); }
.pay-receipt-total strong {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 575.98px) {
  .pay-inv-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "check check"
      "due amt";
  }
  .pay-inv-check { grid-area: check; }
  .pay-inv-due { grid-area: due; text-align: left; }
  .pay-inv-amt { grid-area: amt; }
}
.quote-foot-with-meta {
  grid-template-columns: minmax(0, 1fr) auto;
}
.quote-foot-with-meta .quote-foot-meta {
  grid-column: 1;
  min-width: 0;
}
.quote-foot-with-meta .quote-totals {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
}
.quote-foot-with-pay {
  grid-template-columns: minmax(0, 1fr) auto;
}
.quote-foot-with-pay .quote-pay-wrap {
  grid-column: 1 / -1;
}
.quote-foot-with-pay .quote-foot-meta {
  grid-column: 1;
  grid-row: 2;
}
.quote-foot-with-pay .quote-totals {
  grid-column: 2;
  grid-row: 2;
}
.inv-pay-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
}
.inv-pay-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.15rem;
}
.inv-pay-hint {
  flex: 1 1 140px;
}
[data-theme="dark"] .inv-pay-block {
  background: color-mix(in srgb, var(--surface-2) 88%, var(--background));
}
.inv-pay-block .form-select:not(:disabled) {
  background-color: var(--input-background);
}
.inv-pay-block .form-control[readonly] {
  background-color: var(--surface-2);
  color: var(--text-muted);
}
.inv-pay-block .form-check-label {
  cursor: pointer;
}
.inv-pay-check {
  padding-bottom: 0.15rem;
}
.inv-pay-row .form-label {
  color: var(--text-muted);
}
.money-stmt-shell tbody tr:not(.statement-opening):not(.statement-close) {
  cursor: pointer;
}
.money-stmt-shell tbody tr:not(.statement-opening):not(.statement-close):hover {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}
.filter-card-summary .stat-card .value {
  font-size: 1.15rem;
  font-weight: 600;
}

/* Money accounts — KPI text & icons (card tint backgrounds unchanged) */
.money-page .money-summary.report-summary .stat-card .value {
  color: inherit;
}
.money-page .money-summary.report-summary .stat-card .value .amt-pill {
  font-size: inherit;
  font-weight: inherit;
  padding: 2px 8px;
}
.money-page .money-summary .stat-card.stat-plain .value {
  color: inherit;
}
.money-page .money-stat-opening .stat-card-icon {
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text-muted) 12%, var(--surface));
}
.money-page .money-stat-out .stat-card-icon {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
}
.money-page .money-stat-in .stat-card-icon {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, var(--surface));
}
.money-page .money-stat-close .stat-card-icon {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
}
.money-page .money-stat-total .stat-card-icon {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, var(--surface));
}
.money-page .money-stat-mobile .stat-card-icon {
  color: #7c3aed;
  background: color-mix(in srgb, #7c3aed 14%, var(--surface));
}
.money-page .money-stat-cash .stat-card-icon {
  color: #0d9488;
  background: color-mix(in srgb, #0d9488 14%, var(--surface));
}
.money-page .money-stat-bank .stat-card-icon {
  color: #2563eb;
  background: color-mix(in srgb, #2563eb 14%, var(--surface));
}
.money-page .money-summary .stat-card.is-neg .stat-card-icon {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
}
.money-page .money-summary .stat-card.is-pos .stat-card-icon {
  color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, var(--surface));
}
.money-page #moneyTable .status-badge.status-active {
  background: var(--badge-success-bg);
  color: var(--badge-success-fg);
  border-color: var(--badge-success-bd);
}
.money-page #moneyTable .status-badge.status-inactive {
  background: var(--badge-neutral-bg);
  color: var(--badge-neutral-fg);
  border-color: var(--badge-neutral-bd);
}
.money-page .money-card-meta .bi {
  color: color-mix(in srgb, var(--primary) 70%, var(--text-muted));
}
.money-in-preview {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  padding: 18px 20px;
}
.money-in-preview.money-in-empty {
  background: var(--surface);
}
.money-in-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.money-in-total {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.money-in-count {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
}
.money-in-party {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 10px;
  overflow: hidden;
}
.money-in-party-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.money-in-item {
  display: grid;
  grid-template-columns: 110px 120px 1fr auto;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  font-size: 13px;
  color: inherit;
}
.money-in-item:first-of-type { border-top: 0; }
.money-in-item:hover {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}
.stmt-click { cursor: pointer; }
.stmt-click:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }

/* Canonical statement (Statement Engine): wallet, cash, bank, mobile, GL, customer, supplier */
.statement-shell {
  max-height: 70vh;
  overflow: auto;
}
.statement-shell .statement-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.statement-table tbody tr.statement-opening td {
  background: var(--surface-2) !important;
  font-weight: 600;
}
.statement-table tfoot td {
  background: var(--surface-2) !important;
  font-weight: 600;
}
.statement-table tfoot tr.statement-close td {
  font-weight: 700;
  border-top: 2px solid var(--primary);
}
.statement-table td,
.statement-table th {
  vertical-align: top;
}
@media (max-width: 768px) {
  .money-in-item {
    grid-template-columns: 1fr auto;
  }
  .money-in-item span:nth-child(1),
  .money-in-item span:nth-child(2) { grid-column: 1; }
}

/* ============================================================
   Realtime live sync: status pill, stale-data banner, POS flags
   ============================================================ */
.rt-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
}
.rt-pill .rt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.rt-pill.rt-success {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 35%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
}
.rt-pill.rt-info {
  color: var(--info);
  border-color: color-mix(in srgb, var(--info) 35%, var(--border));
  background: color-mix(in srgb, var(--info) 10%, var(--surface));
}
.rt-pill.rt-warning {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
}
.rt-pill.rt-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}
.rt-pill.rt-muted { color: var(--text-muted); }
.rt-pill.rt-success .rt-dot { animation: rtPulse 2.2s ease-in-out infinite; }
@keyframes rtPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.8); }
}
@media (max-width: 767px) {
  .rt-pill { padding: 4px 8px; }
  .rt-pill .rt-label { display: none; }
}
.rt-stale {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--info) 35%, var(--border));
  background: color-mix(in srgb, var(--info) 8%, var(--surface));
  color: var(--text);
  font-size: 13px;
}
.rt-stale .rt-stale-text { flex: 1 1 auto; }
.pos-line-warn {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--warning);
}
.pos-line-short { border-left: 3px solid var(--warning); }

@media print {
  .sidebar, .topbar, .page-head-actions, .page-tabs-wrap, .page-tabs, .page-pills,
  .table-toolbar, .dt-bar, .dt-buttons, .no-print, .erp-alerts, .btn, .table-actions, .rt-stale {
    display: none !important;
  }
  .main { margin-left: 0 !important; }
  .page { padding: 0; }
  .table-shell { box-shadow: none; border: 0; }
}


/* PWA install — compact top alert, auto-hides */
.erp-pwa-banner {
  position: fixed;
  left: 50%;
  top: max(10px, env(safe-area-inset-top));
  z-index: 20080;
  width: min(440px, calc(100vw - 24px));
  transform: translateX(-50%) translateY(-110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s ease, opacity 0.28s ease;
}
.erp-pwa-banner.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.erp-pwa-banner.is-leaving {
  transform: translateX(-50%) translateY(-110%);
  opacity: 0;
}
.erp-pwa-banner-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px 10px;
  padding: 8px 10px 8px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.erp-pwa-icon { font-size: 1.15rem; color: var(--primary); flex-shrink: 0; }
.erp-pwa-text {
  flex: 1 1 120px;
  font-size: 12px;
  line-height: 1.3;
  min-width: 0;
}
.erp-pwa-text strong { font-size: 12px; font-weight: 650; }
.erp-pwa-sub {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 1px;
}
.erp-pwa-actions {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  align-items: center;
}
.erp-pwa-close {
  padding: 0 6px !important;
  min-width: 28px;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted) !important;
  text-decoration: none !important;
}
body.has-pwa-banner .main {
  padding-bottom: inherit;
}
@media (display-mode: standalone) {
  .topbar {
    padding-top: max(8px, env(safe-area-inset-top));
  }
  .main {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Import + small screens */
@media (max-width: 768px) {
  .import-steps {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    margin-right: -4px;
  }
  .import-step-line { min-width: 8px; flex: 0 0 8px; }
  .import-step span:not(.import-step-n) { white-space: nowrap; }
  .import-types { grid-template-columns: 1fr; }
  .import-panel .table-shell {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .import-panel .table { min-width: 640px; }
  .import-panel .btn { width: 100%; margin-left: 0 !important; margin-top: 8px; }
  .import-panel .btn:first-of-type { margin-top: 12px; }
  #page .page-head {
    flex-wrap: wrap;
    gap: 8px;
  }
  #page .page-head-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .card-soft.p-4 { padding: 1rem !important; }
}
/* Users — availability pills */
.users-table-shell .presence-col { min-width: 10.5rem; }
.presence-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.presence-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid transparent;
  line-height: 1.2;
}
.presence-pill.is-online {
  background: color-mix(in srgb, var(--success) 20%, var(--surface));
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--success) 12%, transparent);
}
.presence-pill.is-offline {
  background: color-mix(in srgb, var(--secondary) 18%, var(--surface));
  color: var(--secondary);
  border-color: color-mix(in srgb, var(--secondary) 30%, transparent);
}
.presence-when {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}

@media (max-width: 992px) {
  #page {
    max-width: 100%;
    overflow-x: hidden;
  }
  .table-shell {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .dt-container .dt-layout-row {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* —— Employees —— */
.modal-dialog.erp-modal-emp {
  max-width: 540px;
}
.emp-modal-content {
  border: 1px solid var(--border);
  box-shadow: 0 20px 48px rgba(15, 23, 42, .12);
}
.emp-form-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.emp-form-hint {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--primary) 18%, var(--border));
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
}
.emp-form-photo-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.emp-photo-wrap .user-avatar,
.emp-photo-wrap .user-avatar-fallback {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  font-size: 22px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
  border: 2px solid var(--surface);
}
.emp-avatar-sm.user-avatar,
.emp-avatar-sm.user-avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 13px;
}
.emp-avatar-lg.user-avatar,
.emp-avatar-lg.user-avatar-fallback {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  font-size: 22px;
}
.erp-modal.emp-modal-content .emp-form-fields .form-control,
.erp-modal .emp-form-fields .form-control,
.erp-modal .emp-form-fields .form-select {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 85%, var(--text-muted));
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.erp-modal .emp-form-fields .form-control:focus,
.erp-modal .emp-form-fields .form-select:focus {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}
.emp-table-shell .emp-photo-col {
  width: 52px;
  padding-right: 0;
}
.emp-name-cell .emp-name-link {
  color: var(--text);
  text-decoration: none;
}
.emp-name-cell .emp-name-link:hover {
  color: var(--primary);
  text-decoration: underline;
}
.emp-view-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.emp-view-name {
  font-size: 1.25rem;
  font-weight: 700;
}
.emp-view-meta {
  font-size: 13px;
  color: var(--text-muted);
}
.emp-field {
  padding: 0.65rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  height: 100%;
}
.emp-field .label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.emp-field .value {
  font-weight: 600;
  word-break: break-word;
}

