/* ============================================================
   style.css — SLS Matchbox QMS Design System
   Mobile-first, dark factory theme, safety-yellow accents
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg-base: #252c3a;
  --bg-surface: #30394a;
  --bg-elevated: #3b465a;
  --bg-card: #354052;
  --border: #58667c;
  --border-light: #6a7890;

  --accent: #f5c518;
  --accent-dim: #c9a214;
  --accent-glow: rgba(245, 197, 24, 0.18);

  --text-primary: #f5f7fb;
  --text-secondary: #d0d8e4;
  --text-muted: #abb7c8;

  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.12);
  --purple: #a855f7;
  --purple-bg: rgba(168, 85, 247, 0.12);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow: 0 10px 34px rgba(8, 13, 24, 0.24);
  --shadow-card: 0 4px 16px rgba(8, 13, 24, 0.18);

  --nav-height: 64px;
  --bottom-nav-height: 0px;
  --sidebar-width: 226px;

  /* ── Motion tokens (Emil Kowalski / web-animation-design skill) ── */
  /* Easing — ease-out for enter/exit, ease-in-out for on-screen movement, ease for hover */
  --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out-cubic: cubic-bezier(0.215, 0.61, 0.355, 1);
  --ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
  --ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-in-out-quart: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-in-out-expo: cubic-bezier(1, 0, 0, 1);

  /* Durations — keep UI under 300ms */
  --dur-instant: 80ms;
  --dur-micro: 120ms;   /* button press, color swap */
  --dur-std: 200ms;     /* dropdowns, tooltips, tabs */
  --dur-modal: 240ms;   /* modals, drawers */
  --dur-slow: 320ms;    /* page-level transitions */

  /* Back-compat alias — existing inline styles keep working */
  --transition: var(--dur-std) var(--ease-out-quart);
}

/* Next ERP shared design system. Keep this generic so migrated modules can reuse it. */
.erp-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.erp-page-heading {
  min-width: 0;
}
.erp-page-meta {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.06);
  color: #2563eb;
  padding: 0 9px;
  font-size: 0.68rem;
  font-weight: 850;
  margin-bottom: 8px;
}
.erp-page-heading h1 {
  margin: 0;
  color: #0f172a;
  font-size: clamp(1.55rem, 1.3vw + 1.1rem, 2.1rem);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: 0;
}
.erp-page-heading p {
  margin: 9px 0 0;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.45;
}
.erp-page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.erp-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.05);
}
.erp-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.erp-section-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 1.05rem;
  font-weight: 900;
}
.erp-section-header p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
}
.erp-action-btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  padding: 0 14px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.erp-action-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.erp-action-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.erp-action-primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18);
}
.erp-action-secondary {
  background: #f8fafc;
  color: #334155;
}
.erp-action-danger {
  border-color: rgba(239, 68, 68, 0.28);
  background: #fff1f2;
  color: #dc2626;
}
.erp-kpi-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 108px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  padding: 16px 16px;
  box-shadow: 0 14px 42px rgba(15, 23, 42, 0.045);
}
.erp-kpi-icon {
  width: 42px;
  height: 42px;
  display: grid !important;
  place-items: center;
  border-radius: 16px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
}
.erp-svg-icon {
  display: block;
  flex: 0 0 auto;
}
.erp-kpi-icon .erp-svg-icon {
  width: 19px;
  height: 19px;
}
.erp-kpi-card > div > span {
  display: block;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.2;
}
.erp-kpi-card strong {
  display: block;
  margin-top: 7px;
  color: #0f172a;
  font-size: 1.22rem;
  line-height: 1.05;
  font-weight: 950;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.erp-kpi-card small {
  display: block;
  margin-top: 7px;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.erp-kpi-success .erp-kpi-icon,
.erp-kpi-success strong { color: #16a34a; }
.erp-kpi-success .erp-kpi-icon { background: rgba(22, 163, 74, 0.1); border-color: rgba(22, 163, 74, 0.14); }
.erp-kpi-warning .erp-kpi-icon,
.erp-kpi-warning strong { color: #d97706; }
.erp-kpi-warning .erp-kpi-icon { background: rgba(245, 158, 11, 0.11); border-color: rgba(245, 158, 11, 0.18); }
.erp-kpi-danger .erp-kpi-icon,
.erp-kpi-danger strong { color: #ef4444; }
.erp-kpi-danger .erp-kpi-icon { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.16); }
.erp-kpi-accent .erp-kpi-icon,
.erp-kpi-accent strong { color: #2563eb; }
.erp-module-tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  padding: 0 18px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.04);
}
.erp-module-tabs button {
  min-height: 56px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #64748b;
  padding: 0 1px;
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
}
.erp-module-tabs button.active {
  background: transparent;
  color: #2563eb;
  border-bottom-color: #2563eb;
  box-shadow: none;
}
.erp-tab-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}
.erp-tab-icon .erp-svg-icon {
  width: 16px;
  height: 16px;
}
.erp-module-tabs b {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 0.64rem;
  font-weight: 900;
}
.erp-filter-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(4, minmax(150px, 0.8fr)) auto;
  gap: 12px;
  align-items: center;
}
.erp-search-input {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 12px;
  background: #ffffff;
  padding: 0 12px;
  color: #94a3b8;
}
.erp-search-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
}
.erp-search-icon .erp-svg-icon {
  width: 15px;
  height: 15px;
}
.erp-search-input input {
  width: 100%;
  min-width: 0;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  color: #0f172a !important;
  font-size: 0.82rem;
  font-weight: 750;
}
.erp-filter-toolbar select,
.erp-filter-toolbar input:not(.erp-search-input input) {
  min-height: 44px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 12px;
  background: #ffffff;
  color: #0f172a;
  padding: 0 13px;
  font-size: 0.8rem;
  font-weight: 800;
  outline: 0;
}
.erp-data-table-wrap {
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  background: #ffffff;
}
.erp-data-table {
  width: 100%;
  min-width: 940px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.78rem;
}
.erp-data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 13px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  background: #f8fafc;
  color: #64748b;
  font-size: 0.62rem;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.erp-data-table td {
  padding: 11px 13px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  color: #0f172a;
  font-weight: 780;
  vertical-align: middle;
}
.erp-data-table tr:last-child td {
  border-bottom: 0;
}
.erp-data-table tbody tr:hover {
  background: #f8fbff;
}
.erp-data-table td strong {
  display: block;
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.erp-data-table td small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 0.64rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.erp-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(100, 116, 139, 0.18);
  background: #f8fafc;
  color: #475569;
  padding: 0 9px;
  font-size: 0.66rem;
  font-weight: 900;
  white-space: nowrap;
}
.erp-status-success { border-color: rgba(22, 163, 74, 0.22); background: #ecfdf3; color: #16a34a; }
.erp-status-warning { border-color: rgba(245, 158, 11, 0.26); background: #fffbeb; color: #d97706; }
.erp-status-danger { border-color: rgba(239, 68, 68, 0.24); background: #fff1f2; color: #dc2626; }
.erp-status-muted { border-color: rgba(148, 163, 184, 0.24); background: #f1f5f9; color: #64748b; }
.erp-empty-state {
  min-height: 190px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed rgba(148, 163, 184, 0.36);
  border-radius: 16px;
  background: #f8fafc;
  padding: 28px;
  color: #64748b;
}
.erp-empty-state strong {
  display: block;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 900;
}
.erp-empty-state span {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}
@media (max-width: 1100px) {
  .erp-filter-toolbar {
    grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(150px, 1fr));
  }
}
@media (max-width: 720px) {
  .erp-page-header {
    flex-direction: column;
  }
  .erp-page-actions,
  .erp-page-actions .erp-action-btn {
    width: 100%;
  }
  .erp-filter-toolbar {
    grid-template-columns: 1fr;
  }
}

/* Modern app shell reference. HR uses this first; other modules can move here one by one. */
.modern-erp-shell {
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  background: #f4f7fb;
  color: #0f172a;
  overflow: hidden;
}
.modern-sidebar {
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.96);
  padding: 18px 16px;
  overflow: hidden;
}
.modern-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  margin-bottom: 24px;
  color: inherit;
  text-decoration: none;
}
.modern-brand > div {
  min-width: 0;
}
.modern-brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eef4ff;
  color: #2563eb;
  font-weight: 950;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.14);
}
.modern-brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex: 0 0 auto;
}
.modern-brand strong {
  display: block;
  color: #0f172a;
  font-size: 0.9rem;
  font-weight: 900;
}
.modern-brand small {
  display: block;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 750;
}
.modern-sidebar-user {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: #f8fafc;
  color: #0f172a;
  padding: 10px 11px;
  margin: -10px 0 16px;
}
.modern-sidebar-user > span {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef4ff;
  color: #2563eb;
  font-size: 0.78rem;
  font-weight: 950;
}
.modern-sidebar-user > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.modern-sidebar-user strong,
.modern-sidebar-user small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modern-sidebar-user strong {
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 950;
}
.modern-sidebar-user small {
  color: #64748b;
  font-size: 0.66rem;
  font-weight: 800;
}
.modern-message-shortcut {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 12px;
  background: #f8fbff;
  color: #334155;
  text-decoration: none;
  padding: 0 10px;
  margin: -12px 0 14px;
  font-size: 0.8rem;
  font-weight: 900;
  position: relative;
}
.modern-message-shortcut > span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eef4ff;
  color: #2563eb;
  flex: 0 0 auto;
}
.modern-message-shortcut b {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: inherit;
}
.modern-message-shortcut strong {
  min-width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  padding: 0 5px;
  font-size: 0.56rem;
  line-height: 1;
  font-weight: 950;
}
.modern-message-shortcut.active {
  border-color: rgba(37, 99, 235, 0.28);
  background: #eef4ff;
  color: #2563eb;
}
.modern-nav-list,
.modern-module-list {
  display: grid;
  gap: 4px;
}
.modern-nav-list a,
.modern-module-list a {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 10px;
  color: #475569;
  text-decoration: none;
  padding: 0 12px;
  font-size: 0.83rem;
  font-weight: 800;
  position: relative;
}
.modern-nav-list a span,
.modern-module-list a span {
  width: 22px;
  display: grid;
  place-items: center;
  color: #64748b;
  font-size: 0.9rem;
}
.modern-nav-list a b,
.modern-module-list a b {
  font-weight: inherit;
}
.modern-nav-list a.active,
.modern-module-list a.active {
  background: #eef4ff;
  color: #2563eb;
}
.modern-nav-list a.active::before {
  content: "";
  position: absolute;
  left: -16px;
  width: 3px;
  height: 26px;
  border-radius: 999px;
  background: #2563eb;
}
.modern-nav-list a.active span,
.modern-module-list a.active span {
  color: #2563eb;
}
.modern-sidebar-divider {
  height: 1px;
  background: rgba(148, 163, 184, 0.2);
  margin: 22px 0 18px;
}
.modern-sidebar-label {
  margin: 0 8px 10px;
  color: #94a3b8;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.modern-module-list {
  overflow: auto;
  padding-right: 2px;
}
.modern-module-list a {
  min-height: 38px;
}
.modern-module-list a span {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 0.64rem;
  font-weight: 950;
}
.modern-collapse-button {
  margin-top: auto;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: #64748b;
  text-align: left;
  padding: 0 8px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}
.modern-main {
  height: 100vh;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modern-topbar {
  flex: 0 0 auto;
  z-index: 20;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  padding: 0 28px;
}
.modern-topbar #top-menubar {
  position: relative !important;
  top: auto !important;
  flex: 1 1 auto;
  min-width: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}
.modern-global-search {
  width: min(360px, 42vw);
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
  background: #ffffff;
  padding: 0 12px;
  color: #64748b;
}
.global-search {
  position: relative;
  z-index: 80;
}
.global-search.open .modern-global-search {
  width: min(460px, 46vw);
  border-color: rgba(37, 99, 235, 0.52);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), 0 12px 28px rgba(15, 23, 42, 0.08);
}
.modern-global-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #0f172a;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 700;
}
.modern-global-search > button {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  cursor: pointer;
}
.modern-global-search kbd {
  min-width: 42px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.66rem;
  font-weight: 900;
}
.global-search-panel {
  position: absolute;
  top: calc(100% + 14px);
  right: -64px;
  width: min(980px, calc(100vw - 330px));
  max-height: min(78vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}
.global-search-panel::before {
  content: "";
  position: absolute;
  top: -8px;
  right: 340px;
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
  border-left: 1px solid rgba(148, 163, 184, 0.24);
  border-top: 1px solid rgba(148, 163, 184, 0.24);
  background: #fff;
}
.global-search-tabs {
  flex: 0 0 auto;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.global-search-tabs button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  padding: 0 12px;
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
}
.global-search-tabs button span {
  color: #64748b;
  font-size: 0.68rem;
}
.global-search-tabs button.active {
  background: #eef4ff;
  border-color: rgba(37, 99, 235, 0.34);
  color: #2563eb;
}
.global-search-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  flex: 1 1 auto;
}
.global-search-left {
  border-right: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, #fff, #f8fafc);
  padding: 14px 14px 16px;
  overflow: auto;
}
.global-search-side-title {
  margin: 0 4px 8px;
  color: #0f172a;
  font-size: 0.76rem;
  font-weight: 950;
}
.global-search-side-title.actions {
  margin-top: 22px;
}
.global-search-left button {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #0f172a;
  padding: 6px 8px;
  text-align: left;
  font-size: 0.73rem;
  font-weight: 800;
  cursor: pointer;
}
.global-search-left button:hover {
  background: #eef4ff;
}
.global-search-left button.action {
  min-height: 48px;
}
.global-search-left button.action strong,
.global-search-left button.action small {
  display: block;
}
.global-search-left button.action small {
  margin-top: 2px;
  color: #64748b;
  font-size: 0.66rem;
}
.global-search-results {
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 18px;
}
.global-search-group {
  margin-bottom: 14px;
}
.global-search-group.top .global-search-result {
  min-height: 76px;
  border-color: rgba(37, 99, 235, 0.18);
}
.global-search-group-head {
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #0f172a;
  font-size: 0.76rem;
  font-weight: 950;
}
.global-search-group-head span {
  color: #64748b;
  font-size: 0.68rem;
}
.global-search-result {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(110px, auto) 86px;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-bottom-width: 0;
  background: #fff;
  color: #0f172a;
  padding: 9px 12px;
  text-align: left;
  cursor: pointer;
}
.global-search-result:first-of-type {
  border-radius: 12px 12px 0 0;
}
.global-search-result:last-child {
  border-bottom-width: 1px;
  border-radius: 0 0 12px 12px;
}
.global-search-result:only-child {
  border-radius: 12px;
}
.global-search-result:hover,
.global-search-result.selected {
  background: #f8fbff;
  border-color: rgba(37, 99, 235, 0.26);
  box-shadow: inset 3px 0 0 #2563eb;
}
.global-search-result-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eef4ff;
  color: #2563eb;
}
.global-search-result-main {
  min-width: 0;
}
.global-search-result-main strong,
.global-search-result-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.global-search-result-main strong {
  font-size: 0.82rem;
  font-weight: 950;
}
.global-search-result-main small {
  margin-top: 3px;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 800;
}
.global-search-result-side {
  text-align: right;
  white-space: nowrap;
}
.global-search-result-side b,
.global-search-result-side em {
  display: block;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 950;
}
.global-search-result-side em {
  margin-top: 3px;
  color: #16a34a;
  font-size: 0.66rem;
}
.global-search-result-side em.due {
  color: #ef4444;
}
.global-search-result-date {
  color: #64748b;
  text-align: right;
  font-size: 0.68rem;
  font-weight: 850;
  white-space: nowrap;
}
.global-search-empty {
  border: 1px dashed rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 20px;
  color: #64748b;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 850;
}
.global-search-footer {
  flex: 0 0 auto;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: #f8fafc;
  padding: 0 14px;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 850;
}
.global-search-footer b {
  min-width: 24px;
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #eef4ff;
  color: #2563eb;
}
.global-search-footer em {
  margin-left: auto;
  font-style: normal;
}
.modern-top-actions {
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.modern-top-actions > button {
  width: 36px;
  height: 36px;
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  cursor: pointer;
  font-weight: 900;
}
.modern-top-actions > button b {
  position: absolute;
  top: 4px;
  right: 3px;
  min-width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.55rem;
}
.modern-credit-pill {
  width: auto !important;
  min-width: 74px;
  height: 40px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  border-radius: 12px !important;
  background: #fff !important;
  padding: 0 12px !important;
  color: #334155 !important;
  font-size: 0.76rem;
  font-weight: 900;
}
.modern-credit-pill svg {
  width: 16px;
  height: 16px;
}
.modern-credit-pill:hover {
  border-color: rgba(37, 99, 235, 0.28) !important;
  background: #eef4ff !important;
  color: #2563eb !important;
}
.modern-user-menu {
  position: relative;
  flex: 0 0 auto;
}
.modern-user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 118px;
  min-height: 44px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  padding: 0 10px 0 8px;
  cursor: pointer;
  font: inherit;
}
.modern-user-profile.open {
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.modern-user-profile > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  color: #0f172a;
  font-size: 0.75rem;
  font-weight: 950;
}
.modern-user-profile > div {
  min-width: 0;
}
.modern-user-profile strong {
  display: block;
  color: #0f172a;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}
.modern-user-profile small {
  display: block;
  color: #64748b;
  font-size: 0.66rem;
  font-weight: 750;
}
.modern-user-profile em {
  color: #64748b;
  font-style: normal;
  font-weight: 900;
}
.modern-user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 10060;
  width: 260px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  background: #fff;
  color: #0f172a;
  padding: 10px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}
.modern-user-dropdown::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 22px;
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
  border-left: 1px solid rgba(148, 163, 184, 0.24);
  border-top: 1px solid rgba(148, 163, 184, 0.24);
  background: #fff;
}
.modern-user-dropdown-head {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  padding: 8px 8px 10px;
  margin-bottom: 8px;
}
.modern-user-dropdown-head > span {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef4ff;
  color: #2563eb;
  font-size: 0.84rem;
  font-weight: 950;
}
.modern-user-dropdown-head > div {
  min-width: 0;
}
.modern-user-dropdown-head strong,
.modern-user-dropdown-head small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modern-user-dropdown-head strong {
  color: #0f172a;
  font-size: 0.84rem;
  font-weight: 950;
}
.modern-user-dropdown-head small {
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 800;
}
.modern-user-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.modern-user-facts div {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  background: #f8fafc;
  padding: 8px;
}
.modern-user-facts span,
.modern-user-facts strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modern-user-facts span {
  color: #94a3b8;
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}
.modern-user-facts strong {
  color: #0f172a;
  font-size: 0.74rem;
  font-weight: 900;
}
.modern-user-dropdown button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  padding: 0 10px;
  text-align: left;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
}
.modern-user-dropdown button:hover {
  background: #eef4ff;
  color: #2563eb;
}
.modern-user-dropdown button.danger {
  color: #dc2626;
}
.modern-user-dropdown button.danger:hover {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}
.modern-user-dropdown button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
.modern-content {
  display: block !important;
  position: static !important;
  inset: auto !important;
  min-width: 0;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  width: 100% !important;
  flex: 1 1 auto;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  background: transparent !important;
  touch-action: auto !important;
  -webkit-overflow-scrolling: touch;
}
.modern-page {
  display: block !important;
  min-height: 100%;
  height: auto !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  animation: none !important;
}
.modern-page-content {
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 32px 28px 40px;
  box-sizing: border-box;
}
.modern-page-content-flush {
  max-width: none;
  margin: 0;
  padding: 0;
}
.modern-erp-shell .hr-native {
  max-width: 1540px;
  padding: 56px 38px 44px;
}
@media (max-width: 1080px) {
  .modern-erp-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }
  .modern-brand div,
  .modern-sidebar-user > div,
  .modern-message-shortcut b,
  .modern-nav-list a b,
  .modern-module-list,
  .modern-sidebar-divider,
  .modern-sidebar-label,
  .modern-collapse-button {
    display: none;
  }
  .modern-sidebar {
    padding: 16px 12px;
  }
  .modern-brand {
    justify-content: center;
  }
  .modern-sidebar-user {
    width: 46px;
    min-height: 46px;
    justify-content: center;
    padding: 0;
    margin: -10px auto 14px;
  }
  .modern-message-shortcut {
    width: 46px;
    min-height: 46px;
    justify-content: center;
    padding: 0;
    margin: -10px auto 14px;
  }
  .modern-message-shortcut strong {
    position: absolute;
    top: 3px;
    right: 1px;
  }
  .modern-nav-list a {
    justify-content: center;
    padding: 0;
  }
  .modern-nav-list a.active::before {
    left: -12px;
  }
}
@media (max-width: 760px) {
  .modern-erp-shell {
    grid-template-columns: 1fr;
  }
  .modern-sidebar {
    display: none;
  }
  .modern-topbar {
    padding: 0 14px;
  }
  .modern-global-search {
    width: 100%;
  }
  .modern-page-content {
    padding: 18px 10px 28px;
  }
  .modern-page-content-flush {
    padding: 0;
  }
  .modern-user-profile div,
  .modern-user-profile em {
    display: none;
  }
  .modern-user-dropdown {
    width: min(260px, calc(100vw - 28px));
  }
  .modern-erp-shell .hr-native {
    padding: 24px 12px 28px;
  }
}

/* Batch invoice simple mode: keep paper-entry fast and uncluttered. */
#sales-order-modal[data-batch-entry="1"] .modal {
  width: min(1180px, calc(100vw - 32px)) !important;
  max-width: 1180px !important;
}
#sales-order-modal[data-batch-entry="1"] .modal-body {
  padding: 14px !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 320px !important;
  gap: 14px !important;
  align-items: start !important;
  max-width: 100% !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode > :not(#so-customer-side-panel) {
  grid-column: auto !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode > #so-customer-side-panel {
  display: flex !important;
  grid-column: 2 !important;
  grid-row: 1 / span 20 !important;
}
.so-batch-context-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
  padding: 9px 10px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.06);
}
.so-batch-context-strip div {
  min-width: 0;
}
.so-batch-context-strip span,
.so-batch-context-strip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.so-batch-context-strip span {
  color: #2563eb;
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.so-batch-context-strip strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
  margin-top: 2px;
}
#sales-order-form.so-batch-simple-mode .so-sync-status {
  display: flex !important;
  margin-bottom: 8px !important;
  border-color: rgba(245, 158, 11, 0.28) !important;
  background: rgba(245, 158, 11, 0.08) !important;
}
#sales-order-form.so-batch-simple-mode .so-sync-status small {
  display: block !important;
}
#sales-order-form.so-batch-simple-mode .so-date-lock-note {
  display: block !important;
  text-align: left !important;
  color: #b45309 !important;
}
#sales-order-form.so-batch-simple-mode .so-sync-status strong {
  font-size: 0.76rem !important;
}
#sales-order-form.so-batch-simple-mode .so-sync-date-field {
  flex-basis: 148px !important;
  min-width: 140px !important;
}
#sales-order-form.so-batch-simple-mode .so-sync-date-field .so-doc-input {
  height: 34px !important;
  min-height: 34px !important;
  font-size: 0.7rem !important;
  border-radius: 9px !important;
}
#sales-order-form.so-batch-simple-mode .so-invoice-head,
#sales-order-form.so-batch-simple-mode #so-payment-section {
  padding: 10px !important;
  margin-bottom: 10px !important;
  border-radius: 12px !important;
}
#sales-order-form.so-batch-simple-mode #so-recent-products,
#sales-order-form.so-batch-simple-mode .so-payment-advanced-btn {
  display: none !important;
}
#sales-order-form.so-batch-simple-mode .so-collection-source-card {
  padding: 8px 9px !important;
  margin-bottom: 10px !important;
}
#sales-order-form.so-batch-simple-mode .so-collection-source-grid {
  grid-template-columns: minmax(0, 1fr) minmax(160px, 210px) !important;
  gap: 8px !important;
}
#sales-order-form.so-batch-simple-mode #so-collection-source-note {
  font-size: 0.66rem !important;
  line-height: 1.25 !important;
}
#sales-order-form.so-batch-simple-mode .so-sticky-summary {
  margin: 6px 0 8px !important;
  padding: 8px 10px !important;
}
#sales-order-form.so-batch-simple-mode .so-invoice-actions {
  margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px) !important;
}
@media (max-width: 680px) {
  #sales-order-modal[data-batch-entry="1"] .modal {
    width: 100% !important;
    max-width: 100% !important;
  }
  .so-batch-context-strip {
    grid-template-columns: 1fr 1fr;
  }
  .so-batch-context-strip div:last-of-type {
    grid-column: 1 / -1;
  }
  #sales-order-form.so-batch-simple-mode .so-collection-source-grid {
    grid-template-columns: 1fr !important;
  }
  body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode {
    grid-template-columns: 1fr !important;
  }
body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode > #so-customer-side-panel {
    grid-column: 1 !important;
    grid-row: auto !important;
    position: static !important;
    max-height: none !important;
  }
}

/* Keep horizontal scrollbars visible anywhere a wide table or tab row can scroll. */
:where(
  .page,
  .table-wrapper,
  .tabs,
  .tab-bar-scroll,
  .erp-workspace-tabs,
  #top-menubar,
  #global-quick-actions,
  .setup-tabs,
  .setup-category-controls,
  .sales-workspace-tabs,
  .stg-tabs,
  .srp-controls-bar,
  .srp-rep-actions,
  .fl-tabs,
  .rpt-choice-grid,
  .rpt-category-list,
  .rpt-report-chip-row,
	  #suphub-tabbar,
	  [style*="overflow:auto"],
	  [style*="overflow: auto"],
	  [style*="overflow-x:auto"],
	  [style*="overflow-x: auto"]
	) {
  scrollbar-width: auto !important;
  -ms-overflow-style: auto !important;
}
:where(
  .page,
  .table-wrapper,
  .tabs,
  .tab-bar-scroll,
  .erp-workspace-tabs,
  #top-menubar,
  #global-quick-actions,
  .setup-tabs,
  .setup-category-controls,
  .sales-workspace-tabs,
  .stg-tabs,
  .srp-controls-bar,
  .srp-rep-actions,
  .fl-tabs,
  .rpt-choice-grid,
  .rpt-category-list,
  .rpt-report-chip-row,
	  #suphub-tabbar,
	  [style*="overflow:auto"],
	  [style*="overflow: auto"],
	  [style*="overflow-x:auto"],
	  [style*="overflow-x: auto"]
	)::-webkit-scrollbar {
  display: block !important;
  height: 13px !important;
}

/* Banks page */
.banks-shell {
  padding: 12px 18px;
  max-width: 1280px;
  margin: 0 auto;
}
.banks-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  margin-bottom: 10px;
}
.banks-kicker {
  display: block;
  color: var(--accent);
  text-transform: uppercase;
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .04em;
  margin-bottom: 2px;
}
.banks-hero h1 {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 950;
  color: var(--text-primary);
}
.banks-hero p {
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: .76rem;
  font-weight: 750;
}
.banks-actions,
.banks-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.banks-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.banks-kpi {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.banks-kpi > span {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.banks-kpi b,
.banks-kpi em,
.banks-kpi small {
  display: block;
}
.banks-kpi b {
  font-size: .92rem;
  color: var(--text-primary);
  font-weight: 950;
}
.banks-kpi em {
  font-style: normal;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: .58rem;
  font-weight: 900;
}
.banks-kpi small {
  color: var(--text-secondary);
  font-size: .64rem;
  font-weight: 750;
  margin-top: 2px;
}
.banks-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 260px 220px;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  margin-bottom: 10px;
}
.banks-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.banks-toolbar span {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: .62rem;
  font-weight: 900;
}
.banks-toolbar input,
.banks-toolbar select {
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  min-height: 36px;
  padding: 7px 10px;
  font-weight: 800;
}
.banks-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
  margin-bottom: 10px;
}
.banks-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.banks-panel-head-compact {
  padding: 8px 10px;
}
.banks-panel-head h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: .9rem;
  font-weight: 950;
}
.banks-panel-head p {
  margin: 1px 0 0;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 750;
}
.banks-panel-head > span {
  color: var(--accent);
  font-weight: 950;
  font-size: 1rem;
}
.banks-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.banks-panel-actions > span {
  color: var(--accent);
  font-weight: 950;
  font-size: .86rem;
}
.banks-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
}
.banks-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  padding: 10px;
}
.banks-card.cash-account {
  border-color: rgba(34,197,94,.34);
  background: rgba(34,197,94,.045);
}
.banks-card.cash-account .banks-bank-icon {
  background: rgba(34,197,94,.12);
  color: #16a34a;
}
.banks-card-top {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.banks-bank-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(37,99,235,.1);
  color: #2563eb;
  flex-shrink: 0;
}
.banks-card h3 {
  margin: 0;
  font-size: .82rem;
  color: var(--text-primary);
  font-weight: 950;
}
.banks-card p,
.banks-last {
  color: var(--text-muted);
  font-size: .65rem;
  font-weight: 750;
}
.banks-card p {
  margin: 3px 0 0;
}
.banks-factor-badge {
  margin-left: auto;
  align-self: flex-start;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(14,165,233,.1);
  color: #0284c7;
  font-size: .56rem;
  font-weight: 950;
  white-space: nowrap;
}
.banks-account-no {
  margin: 8px 0;
  padding: 6px 8px;
  background: var(--bg-elevated);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: .66rem;
  font-weight: 850;
}
.banks-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.banks-card-metrics div {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  min-width: 0;
}
.banks-card-metrics span,
.banks-card-metrics b {
  display: block;
}
.banks-card-metrics span {
  color: var(--text-muted);
  font-size: .52rem;
  text-transform: uppercase;
  font-weight: 900;
}
.banks-card-metrics b {
  color: var(--text-primary);
  font-size: .68rem;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
}
.banks-book {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: .65rem;
  font-weight: 850;
}
.banks-book.ready {
  color: #16a34a;
  background: rgba(22,163,74,.1);
}
.banks-book.missing {
  color: #ef4444;
  background: rgba(239,68,68,.09);
}
.banks-last {
  margin-top: 7px;
}
.banks-card-actions {
  margin-top: 8px;
}
.banks-card-actions button {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: .64rem;
  font-weight: 900;
  cursor: pointer;
}
.banks-activity {
  padding: 0;
}
.banks-activity-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.banks-activity-row:last-child {
  border-bottom: 0;
}
.banks-activity-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
}
.banks-activity-main div {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.banks-activity-main b {
  color: var(--text-primary);
  font-size: .74rem;
  font-weight: 950;
}
.banks-activity-main span {
  color: var(--accent);
  font-size: .66rem;
  font-weight: 900;
}
.banks-activity-main p,
.banks-activity-main small {
  display: block;
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: .64rem;
  font-weight: 750;
}
.banks-activity-row > strong {
  color: var(--text-primary);
  font-weight: 950;
  white-space: nowrap;
}
.banks-empty {
  grid-column: 1 / -1;
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-weight: 800;
}
.banks-modal {
  max-width: 560px;
}
.banks-money-in-modal {
  max-width: 720px;
}
.banks-modal-sub {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: .78rem;
  font-weight: 750;
}
.banks-modal-note {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: .78rem;
  font-weight: 850;
  margin-bottom: 12px;
}
.banks-form-error {
  border: 1px solid rgba(239, 68, 68, .22);
  background: rgba(239, 68, 68, .08);
  color: #dc2626;
  border-radius: 10px;
  padding: 9px 11px;
  margin-bottom: 10px;
  font-size: .76rem;
  font-weight: 900;
}
.banks-factor-defaults {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}
.banks-factor-defaults summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--text-primary);
  font-size: .78rem;
  font-weight: 950;
  cursor: pointer;
  list-style: none;
}
.banks-factor-defaults summary span {
  min-width: 0;
}
.banks-factor-defaults summary em {
  margin-left: auto;
  color: var(--text-muted);
  font-size: .62rem;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}
.banks-factor-defaults summary::-webkit-details-marker {
  display: none;
}
.banks-factor-defaults summary::after {
  content: "+";
  margin-left: 0;
  color: var(--text-muted);
  font-size: 1rem;
}
.banks-factor-defaults[open] summary {
  border-bottom: 1px solid var(--border);
}
.banks-factor-defaults[open] summary::after {
  content: "-";
}
.banks-factor-defaults-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}
.banks-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: .76rem;
  font-weight: 850;
}
.banks-check-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}
.chq-factor-more {
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}
.chq-factor-more summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--text-secondary);
  font-size: .76rem;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}
.chq-factor-more summary::-webkit-details-marker {
  display: none;
}
.chq-factor-more summary::after {
  content: "+";
  margin-left: auto;
  color: var(--text-muted);
  font-size: 1rem;
}
.chq-factor-more[open] summary {
  border-bottom: 1px solid var(--border);
}
.chq-factor-more[open] summary::after {
  content: "-";
}
.chq-factor-more-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}
@media (max-width: 1040px) {
  .banks-kpis,
  .banks-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .banks-toolbar {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 720px) {
  .banks-shell {
    padding: 12px;
  }
  .banks-hero,
  .banks-panel-head {
    align-items: stretch;
    flex-direction: column;
  }
  .banks-panel-actions {
    justify-content: space-between;
  }
  .banks-actions,
  .banks-actions .btn,
  .banks-toolbar,
  .banks-kpis,
  .banks-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }
  .banks-activity-row {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .banks-activity-row > strong {
    grid-column: 2;
  }
}

.batch-page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 4px 0 18px;
  color: var(--text-primary);
}
.batch-page button,
.batch-page input,
.batch-page select {
  font-family: inherit;
}
.batch-picker {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}
.batch-standalone-shell,
.batch-standalone-shell .batch-page,
.batch-standalone-shell .batch-picker,
.batch-standalone-shell .batch-picker-hero {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}
.batch-picker-hero,
.batch-topbar,
.batch-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: none;
}
.batch-picker-hero {
  overflow: hidden;
}
.batch-picker-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 18px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(59, 130, 246, 0.08));
  border-bottom: 1px solid var(--border);
}
.batch-picker-head > div {
  min-width: 0;
}
.batch-kicker {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.batch-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.28rem;
  font-weight: 950;
  line-height: 1.1;
}
.batch-sub {
  margin: 7px 0 0;
  max-width: 680px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 760;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.batch-step-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 18px 0;
}
.batch-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}
.batch-step b {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
  color: #1a1a00;
  font-size: 0.68rem;
  font-weight: 950;
}
.batch-step span {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 850;
  line-height: 1.2;
}
.batch-rep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  padding: 14px 18px 18px;
}
.batch-rep-card {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.batch-rep-card:hover {
  transform: translateY(-1px);
  border-color: rgba(245, 197, 24, 0.45);
  background: var(--bg-card);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}
.batch-rep-avatar,
.batch-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 13px;
  background: var(--accent);
  color: #1a1a00;
  font-weight: 950;
}
.batch-rep-avatar {
  width: 38px;
  height: 38px;
  font-size: 1rem;
}
.batch-rep-card strong,
.batch-rep-card span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-rep-card strong {
  font-size: 0.86rem;
  font-weight: 950;
}
.batch-rep-card span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 800;
}
.batch-topbar {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--bg-card);
}
.batch-top-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.batch-back-btn {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
}
.batch-back-btn:hover,
.batch-exit-btn:hover,
.batch-day-actions button:hover,
.batch-day-details-btn:hover {
  border-color: rgba(212,168,0,.38);
  background: var(--bg-card);
  color: var(--text-primary);
}
.batch-avatar {
  width: 44px;
  height: 44px;
  font-size: 1.05rem;
}
.batch-avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 0.82rem;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.10);
}
.batch-top-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.batch-compact-title {
  font-size: 0.88rem;
  line-height: 1.05;
}
.batch-compact-sub {
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 850;
}
.batch-top-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}
.batch-date-group,
.batch-create-group,
.batch-control-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.batch-date-group,
.batch-create-group {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  flex-wrap: nowrap;
}
.batch-create-group {
  overflow: visible;
}
.batch-control-group {
  padding-left: 2px;
  flex-wrap: nowrap;
}
.batch-date-field {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.batch-date-field span {
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.batch-date-field input {
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 900;
}
.batch-action-primary,
.batch-action-soft {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border-radius: 9px;
  font-size: 0.66rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.batch-action-primary {
  border: 0;
  background: var(--accent);
  color: #1a1a00;
  box-shadow: 0 8px 18px rgba(212,168,0,.17);
}
.batch-action-soft {
  border: 1px solid rgba(34, 197, 94, 0.34);
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}
.batch-action-collection,
.batch-action-expense,
.batch-action-report,
.batch-action-audit {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid rgba(34, 197, 94, 0.34);
  border-radius: 9px;
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
  font-size: 0.66rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.batch-action-expense {
  border-color: rgba(239, 68, 68, 0.34);
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.batch-action-report {
  border-color: rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}
.batch-action-audit {
  border-color: var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}
.batch-action-more,
.batch-invoice-more,
.batch-row-menu {
  position: relative;
  flex: 0 0 auto;
}
.batch-action-more > summary,
.batch-invoice-more > summary,
.batch-row-menu > summary {
  list-style: none;
}
.batch-action-more > summary::-webkit-details-marker,
.batch-invoice-more > summary::-webkit-details-marker,
.batch-row-menu > summary::-webkit-details-marker {
  display: none;
}
.batch-action-more > summary {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.66rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.batch-action-more > summary span {
  display: inline-block;
}
.batch-action-more-count {
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(212, 168, 0, 0.16);
  color: #9a6b00;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 950;
  line-height: 1;
}
.batch-action-more[open] > summary {
  border-color: rgba(212,168,0,.38);
  color: var(--text-primary);
  background: var(--bg-card);
}
.batch-action-more-body {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 70;
  width: 218px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-card);
  box-shadow: 0 16px 34px rgba(15,23,42,.12);
}
.batch-action-more-head {
  padding: 7px 9px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.batch-action-more-head strong,
.batch-action-more-head span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-action-more-head strong {
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 950;
}
.batch-action-more-head span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 850;
}
.batch-action-more-body button {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  padding: 0 9px;
  font-size: 0.68rem;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}
.batch-action-more-body button:hover {
  background: var(--bg-elevated);
}
.batch-exit-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
}
.batch-entry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 12px;
  align-items: start;
}
.batch-entry-layout-simple {
  grid-template-columns: minmax(0, 1fr);
}
.batch-main-column {
  min-width: 0;
}
.batch-workflow {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--bg-card);
  box-shadow: none;
  overflow: hidden;
}
.batch-workflow-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
}
.batch-workflow-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.batch-workflow-label {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-bottom: 0;
  border-radius: 999px;
  padding: 3px 8px;
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.batch-workflow-warning .batch-workflow-label,
.batch-workflow-due .batch-workflow-label {
  background: rgba(245, 158, 11, 0.1);
  color: #9a6700;
}
.batch-workflow-done .batch-workflow-label {
  background: rgba(34, 197, 94, 0.09);
  color: #16a34a;
}
.batch-workflow-main strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
  line-height: 1.2;
}
.batch-workflow-meta {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-workflow-action {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(154, 103, 0, 0.26);
  border-radius: 11px;
  background: rgba(245, 158, 11, 0.1);
  color: #7c5800;
  font-size: 0.7rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.batch-day-snapshot {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 7px;
}
.batch-day-snapshot-card {
  min-width: 0;
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-start;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 4px 7px;
  text-align: left;
  cursor: pointer;
}
.batch-day-snapshot-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15,23,42,.06);
}
.batch-day-snapshot-card.ok,
.batch-day-snapshot-card.collection-ok {
  border-color: rgba(34, 197, 94, 0.24);
  background: rgba(34, 197, 94, 0.055);
}
.batch-day-snapshot-card.expense-ok {
  border-color: rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.055);
}
.batch-day-snapshot-card.attention,
.batch-day-snapshot-card.due {
  border-color: rgba(239, 68, 68, 0.24);
  background: rgba(239, 68, 68, 0.055);
}
.batch-day-snapshot-icon {
  width: 21px;
  height: 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 7px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}
.batch-day-snapshot-card.ok .batch-day-snapshot-icon,
.batch-day-snapshot-card.collection-ok .batch-day-snapshot-icon {
  color: #16a34a;
}
.batch-day-snapshot-card.expense-ok .batch-day-snapshot-icon {
  color: #2563eb;
}
.batch-day-snapshot-card.attention .batch-day-snapshot-icon,
.batch-day-snapshot-card.due .batch-day-snapshot-icon {
  color: #ef4444;
}
.batch-day-snapshot-copy {
  min-width: 0;
  flex: 1 1 auto;
}
.batch-day-snapshot-copy small,
.batch-day-snapshot-copy strong,
.batch-day-snapshot-copy em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-day-snapshot-copy small {
  color: var(--text-muted);
  font-size: 0.5rem;
  font-weight: 950;
  text-transform: none;
}
.batch-day-snapshot-copy strong {
  color: var(--text-primary);
  font-size: 0.68rem;
  font-weight: 950;
}
.batch-day-snapshot-copy em {
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 0.6rem;
  font-style: normal;
  font-weight: 820;
}
.batch-day-snapshot-add {
  width: 24px;
  min-height: 24px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.62rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.batch-day-snapshot-add span {
  display: none;
}
.batch-day-snapshot-add:hover {
  color: var(--accent, #facc15);
  border-color: color-mix(in srgb, var(--accent, #facc15) 42%, var(--border));
  background: color-mix(in srgb, var(--accent, #facc15) 12%, var(--bg-elevated));
}
.batch-source-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: -1px 0 8px;
  color: var(--text-muted);
  font-size: 0.61rem;
  font-weight: 850;
}
.batch-source-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.batch-source-legend i {
  width: 8px;
  height: 8px;
  display: inline-block;
  border-radius: 999px;
}
.batch-source-legend i.rep {
  background: #2563eb;
}
.batch-source-legend i.office {
  background: #b45309;
}
.batch-source-legend em {
  color: var(--text-muted);
  font-style: normal;
  opacity: 0.86;
}
.batch-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 110px;
  vertical-align: middle;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.56rem;
  font-weight: 950;
  line-height: 1.15;
  white-space: nowrap;
}
.batch-source-pill.rep {
  border: 1px solid rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}
.batch-source-pill.office {
  border: 1px solid rgba(180, 83, 9, 0.25);
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
}
.batch-source-row {
  position: relative;
  overflow: hidden;
}
.batch-source-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
}
.batch-source-row.rep::before {
  background: #2563eb;
}
.batch-source-row.office::before {
  background: #d97706;
}
.batch-flow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 7px;
}
.batch-flow-step {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.batch-flow-step:hover {
  transform: none;
  box-shadow: none;
  border-color: rgba(100, 116, 139, 0.32);
}
.batch-flow-step.complete {
  border-color: rgba(34, 197, 94, 0.18);
  background: rgba(34, 197, 94, 0.045);
}
.batch-flow-step.attention,
.batch-flow-step.due {
  border-color: rgba(245, 158, 11, 0.2);
  background: rgba(245, 158, 11, 0.045);
}
.batch-flow-step.waiting {
  opacity: 0.78;
}
.batch-flow-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-muted);
}
.batch-flow-step.complete .batch-flow-icon {
  color: #16a34a;
}
.batch-flow-step.attention .batch-flow-icon,
.batch-flow-step.due .batch-flow-icon {
  color: #b45309;
}
.batch-flow-copy {
  min-width: 0;
}
.batch-flow-copy strong,
.batch-flow-copy em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-flow-copy strong {
  color: var(--text-muted);
  font-size: 0.52rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.batch-flow-copy em {
  margin-top: 2px;
  color: var(--text-primary);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 950;
}
.batch-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}
.batch-metric {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid color-mix(in srgb, var(--metric-color, #64748b) 26%, var(--border));
  border-radius: 13px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--metric-color, #64748b) 9%, var(--bg-card)), var(--bg-card));
}
.batch-metric span,
.batch-metric strong,
.batch-metric small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-metric span {
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.batch-metric strong {
  margin-top: 4px;
  color: var(--metric-color, var(--text-primary));
  font-size: 1rem;
  font-weight: 950;
}
.batch-metric small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 780;
}
.batch-utility-row {
  display: grid;
  grid-template-columns: 150px minmax(220px, 1fr);
  gap: 7px;
  align-items: start;
  margin-bottom: 7px;
}
.batch-tools {
  margin-bottom: 8px;
  overflow: hidden;
}
.batch-tools summary {
  min-height: 32px;
  list-style: none;
  cursor: pointer;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-elevated);
}
.batch-tools summary::-webkit-details-marker {
  display: none;
}
.batch-tools-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 950;
}
.batch-tools summary > span:last-child {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 820;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-tools-body {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 7px 9px;
  border-top: 1px solid var(--border);
}
.batch-tools-compact {
  margin-bottom: 0;
  border-radius: 10px;
}
.batch-tools-inline {
  flex: 0 1 330px;
  min-width: 230px;
}
.batch-tools-note {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 780;
}
.batch-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 0.64rem;
  font-weight: 900;
  cursor: pointer;
}
.batch-tool-btn.export {
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}
.batch-tool-btn.import {
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}
.batch-tool-btn.template {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
}
.batch-simple-details {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  overflow: hidden;
}
.batch-simple-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-elevated);
}
.batch-simple-details > summary::-webkit-details-marker {
  display: none;
}
.batch-simple-details > summary span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 950;
}
.batch-simple-details > summary small {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 850;
}
.batch-simple-details-body {
  padding: 8px;
  border-top: 1px solid var(--border);
}
.batch-simple-details-body > .batch-panel:last-child,
.batch-simple-details-body > .batch-reminder-side:last-child {
  margin-bottom: 0;
}
.batch-day-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.batch-day-actions button,
.batch-day-details-btn {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 0 9px;
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.batch-day-details-btn {
  margin: 0;
  min-width: 132px;
}
.batch-invoice-toolbar {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 7px 9px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.batch-invoice-toolbar-clean {
  position: relative;
  overflow: visible;
}
.batch-invoice-search {
  position: relative;
  flex: 1 1 380px;
  min-width: 240px;
}
.batch-status-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.batch-invoice-summary {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  padding: 0 10px;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 900;
  white-space: nowrap;
}
.batch-invoice-summary strong {
  color: var(--accent);
  font-size: 0.72rem;
}
.batch-invoice-summary em {
  color: #ef4444;
  font-style: normal;
}
.batch-source-counts {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.batch-source-counts span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.64rem;
  font-weight: 950;
  white-space: nowrap;
}
.batch-source-counts .rep {
  border: 1px solid rgba(37, 99, 235, 0.24);
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
}
.batch-source-counts .office {
  border: 1px solid rgba(180, 83, 9, 0.23);
  background: rgba(245, 158, 11, 0.08);
  color: #b45309;
}
.batch-source-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 12px;
  padding: 11px 12px;
  border: 1px solid rgba(239, 68, 68, 0.26);
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.055);
}
.batch-source-alert-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.batch-source-alert-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.batch-source-alert-copy strong {
  color: #b91c1c;
  font-size: 0.82rem;
  font-weight: 950;
}
.batch-source-alert-copy span {
  color: #991b1b;
  font-size: 0.69rem;
  font-weight: 820;
}
.batch-source-alert-list {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.batch-source-alert-list button,
.batch-source-alert-list span {
  border: 1px solid rgba(239, 68, 68, 0.26);
  border-radius: 999px;
  background: var(--bg-card);
  color: #b91c1c;
  padding: 4px 8px;
  font-size: 0.64rem;
  font-weight: 950;
}
.batch-source-alert-list button {
  cursor: pointer;
}
.batch-source-alert-list em {
  margin-left: 3px;
  color: #ef4444;
  font-style: normal;
}
.batch-invoice-more > summary {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 0 10px;
  font-size: 0.68rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.batch-invoice-more[open] > summary {
  border-color: rgba(212,168,0,.38);
  background: var(--bg-card);
  color: var(--text-primary);
}
.batch-invoice-more-body {
  position: absolute;
  right: 0;
  top: calc(100% + 7px);
  z-index: 65;
  width: min(680px, calc(100vw - 48px));
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: 0 18px 38px rgba(15,23,42,.13);
}
.batch-more-section + .batch-more-section {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
}
.batch-more-title {
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 950;
  text-transform: uppercase;
}
.batch-more-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.batch-date-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--accent);
  background: rgba(245,158,11,.12);
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.68rem;
  font-weight: 950;
  white-space: nowrap;
}
.batch-more-note {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 820;
}
.batch-row-menu > summary {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
}
.batch-row-menu[open] > summary {
  border-color: rgba(212,168,0,.38);
  color: var(--text-primary);
}
.batch-row-menu-body {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 55;
  min-width: 138px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  box-shadow: 0 14px 28px rgba(15,23,42,.12);
}
.batch-row-menu-body button {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 0 8px;
  font-size: 0.68rem;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}
.batch-row-menu-body button.warning {
  color: #d97706;
}
.batch-row-menu-body button.danger {
  color: #ef4444;
}
.batch-row-menu-body button:hover {
  background: var(--bg-elevated);
}
.batch-invoice-date-head {
  min-width: 0;
}
.batch-invoice-date-total {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-reminder-side {
  gap: 9px !important;
  position: sticky !important;
  top: 10px;
  max-height: none;
  overflow: visible;
}
.batch-reminder-side > div,
.batch-reminder-side > details {
  border-radius: 13px !important;
  box-shadow: 0 10px 24px rgba(15,23,42,.04) !important;
}
.batch-reminder-side > div > div:first-child,
.batch-reminder-side > details > summary {
  padding: 10px 12px !important;
}
.batch-reminder-side > div > div:nth-child(2),
.batch-reminder-side > details > div {
  padding: 9px !important;
  gap: 6px !important;
}
.batch-reminder-side strong {
  font-size: 0.76rem !important;
  line-height: 1.2;
}
.batch-reminder-side span,
.batch-reminder-side small,
.batch-reminder-side em,
.batch-reminder-side div {
  font-size: 0.66rem !important;
  line-height: 1.28;
}
.batch-reminder-side button {
  font-size: 0.66rem !important;
  border-radius: 8px !important;
}
.batch-reminder-side button[style*="padding"] {
  padding: 5px 7px !important;
}
@media (max-width: 1100px) {
  .batch-topbar,
  .batch-picker-head {
    grid-template-columns: 1fr;
  }
  .batch-workflow-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .batch-workflow-main {
    align-items: flex-start;
    flex-direction: column;
  }
  .batch-workflow-action {
    width: fit-content;
  }
  .batch-top-actions {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .batch-date-group,
  .batch-create-group,
  .batch-control-group {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .batch-flow-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .batch-day-snapshot {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .batch-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .batch-utility-row {
    grid-template-columns: 1fr;
  }
  .batch-invoice-toolbar {
    align-items: stretch;
  }
  .batch-day-details-btn {
    width: fit-content;
  }
  .batch-tools-inline {
    flex-basis: 100%;
    min-width: 0;
  }
}
@media (max-width: 680px) {
  .batch-step-list,
  .batch-flow-grid,
  .batch-day-snapshot,
  .batch-metrics,
  .batch-rep-grid {
    grid-template-columns: 1fr;
  }
  .batch-picker-head,
  .batch-rep-grid,
  .batch-step-list {
    padding-left: 12px;
    padding-right: 12px;
  }
  .batch-title,
  .batch-sub {
    max-width: 100%;
  }
  .batch-topbar {
    padding: 12px;
  }
  .batch-top-actions,
	  .batch-date-field,
	  .batch-action-primary,
	  .batch-action-collection,
	  .batch-action-expense,
	  .batch-action-report,
	  .batch-action-audit,
	  .batch-action-soft,
	  .batch-action-more > summary,
	  .batch-invoice-more > summary,
	  .batch-day-actions button,
	  .batch-day-details-btn {
    width: 100%;
  }
  .batch-create-group {
    display: grid;
    grid-template-columns: 1fr;
  }
  .batch-date-group {
    display: grid;
    grid-template-columns: 1fr;
  }
  .batch-control-group {
    justify-content: space-between;
  }
  .batch-date-field {
    justify-content: space-between;
  }
  .batch-action-more,
  .batch-invoice-more {
    width: 100%;
  }
  .batch-action-more-body,
  .batch-invoice-more-body {
    position: static;
    width: 100%;
    margin-top: 6px;
    box-shadow: none;
  }
  .batch-invoice-search,
  .batch-status-chips,
  .batch-invoice-summary {
    width: 100%;
  }
  .batch-invoice-summary {
    justify-content: space-between;
    white-space: normal;
    flex-wrap: wrap;
  }
  .batch-date-field input {
    width: 100%;
    text-align: right;
  }
  .batch-status-chips > button {
    flex: 1 1 auto;
  }
  .batch-invoice-date-head {
    flex-wrap: wrap;
  }
  .batch-invoice-date-total {
    width: 100%;
    margin-left: 0 !important;
  }
  .batch-workflow-action {
    width: 100%;
  }
}

.ll-load-modal {
  background: var(--bg-surface);
  border-radius: 18px;
  width: min(1320px, calc(100vw - 32px));
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
}
.ll-load-setup-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.45fr) minmax(220px, 0.75fr) minmax(240px, 0.9fr);
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
}
.ll-load-setup-grid.no-date {
  grid-template-columns: minmax(360px, 1.3fr) minmax(260px, 0.9fr);
}
.ll-load-setup-grid.no-store {
  grid-template-columns: minmax(360px, 1.25fr) minmax(220px, 0.75fr);
}
.ll-load-setup-grid.no-date.no-store {
  grid-template-columns: 1fr;
}
.ll-setup-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  padding: 10px 11px;
}
.ll-setup-card.date {
  border-color: rgba(34,197,94,.24);
  background: rgba(34,197,94,.08);
}
.ll-setup-label {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
  line-height: 1;
}
.ll-setup-card.date .ll-setup-label,
.ll-setup-card.date .ll-setup-help strong {
  color: #16a34a;
}
.ll-setup-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.ll-setup-card select,
.ll-setup-card input {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 850;
}
.ll-save-ref-btn {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 0 13px;
  font-size: 0.76rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.ll-lock-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  padding: 0 11px;
  font-size: 0.68rem;
  font-weight: 950;
}
.ll-setup-help {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ll-issue-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 14px;
  align-items: start;
}
.ll-issue-main {
  min-width: 0;
}
.ll-load-entry-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  padding: 14px;
  box-shadow: 0 10px 28px rgba(15,23,42,0.06);
}
.ll-load-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.ll-load-entry-title {
  font-size: 0.82rem;
  font-weight: 950;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.ll-load-entry-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 750;
  margin-top: 3px;
  line-height: 1.35;
}
.ll-load-entry-head > span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(99,102,241,0.09);
  border: 1px solid rgba(99,102,241,0.18);
  color: #6366f1;
  font-size: 0.68rem;
  font-weight: 900;
  padding: 5px 9px;
}
.ll-items-list {
  display: grid;
  gap: 9px;
}
.ll-recent-issues {
  position: sticky;
  top: 76px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  padding: 12px;
  box-shadow: 0 10px 28px rgba(15,23,42,0.06);
}
.ll-recent-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.ll-recent-title {
  font-size: 0.78rem;
  font-weight: 950;
  color: var(--text-primary);
  text-transform: uppercase;
}
.ll-recent-sub {
  margin-top: 2px;
  font-size: 0.66rem;
  font-weight: 750;
  color: var(--text-muted);
}
.ll-recent-head > span {
  border-radius: 999px;
  background: rgba(245,158,11,0.13);
  border: 1px solid rgba(245,158,11,0.25);
  color: #b77900;
  font-size: 0.68rem;
  font-weight: 950;
  padding: 4px 9px;
}
.ll-recent-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
  padding-right: 2px;
}
.ll-recent-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  padding: 9px 10px;
}
.ll-recent-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.ll-recent-card-top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 950;
}
.ll-recent-card-top span {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 850;
}
.ll-recent-items {
  display: grid;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.3;
}
.ll-recent-items span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.ll-recent-items strong {
  flex: 0 0 auto;
  color: #16a34a;
  font-weight: 950;
}
.ll-recent-items em {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 850;
}
.ll-recent-note {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ll-recent-empty {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 18px 12px;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 850;
}
.ll-item-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 138px 120px 34px;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  padding: 11px;
}
.ll-item-row label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.62rem;
  font-weight: 900;
  color: var(--text-muted);
  text-transform: uppercase;
}
.ll-item-row input,
.ll-item-row select {
  min-height: 40px;
  font-size: 0.82rem;
  font-weight: 850;
}
.ll-item-product {
  min-width: 0;
  position: relative;
}
.ll-product-suggestions {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 5px);
  z-index: 12;
  max-height: 238px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-surface);
  box-shadow: 0 16px 34px rgba(15,23,42,0.18);
  padding: 5px;
}
.ll-product-suggestion {
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-primary);
  text-align: left;
  padding: 9px 10px;
  cursor: pointer;
}
.ll-product-suggestion:hover,
.ll-product-suggestion:focus {
  background: var(--bg-elevated);
  outline: none;
}
.ll-product-suggestion strong {
  display: block;
  font-size: 0.8rem;
  font-weight: 950;
}
.ll-product-suggestion span,
.ll-product-suggestion-empty {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1.3;
}
.ll-product-suggestion-empty {
  padding: 12px 10px;
  text-align: center;
}
.ll-remove-item {
  width: 34px;
  height: 40px;
  border: 1px solid rgba(239,68,68,0.22);
  border-radius: 10px;
  background: rgba(239,68,68,0.08);
  color: #ef4444;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ll-stock-hint {
  grid-column: 1 / -1;
  display: block;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.35;
}
.ll-stock-hint.is-warning {
  color: #ef4444;
}
.ll-stock-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}
.ll-stock-detail-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-surface);
  padding: 9px 10px;
  min-width: 0;
}
.ll-stock-detail-card.rep {
  background: rgba(34,197,94,0.08);
  border-color: rgba(34,197,94,0.24);
}
.ll-stock-detail-card.all {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.24);
}
.ll-stock-detail-card.warehouse {
  background: rgba(59,130,246,0.08);
  border-color: rgba(59,130,246,0.24);
}
.ll-stock-detail-card.danger {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.26);
}
.ll-stock-detail-title {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0;
}
.ll-stock-detail-main {
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
}
.ll-stock-detail-card.rep .ll-stock-detail-main {
  color: #16a34a;
}
.ll-stock-detail-card.all .ll-stock-detail-main {
  color: #d97706;
}
.ll-stock-detail-card.warehouse .ll-stock-detail-main {
  color: #2563eb;
}
.ll-stock-detail-card.danger .ll-stock-detail-main {
  color: #ef4444;
}
.ll-stock-detail-units {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}
.ll-stock-detail-units span {
  border-radius: 999px;
  background: rgba(148,163,184,0.15);
  color: var(--text-secondary);
  padding: 3px 6px;
  font-size: 0.58rem;
  font-weight: 900;
  white-space: nowrap;
}
.ll-stock-warning {
  margin-top: 7px;
  color: #ef4444;
  font-weight: 950;
}
.ll-add-item-btn {
  margin-top: 10px;
  width: 100%;
  min-height: 42px;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 950;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.ll-load-tools {
  position: sticky;
  top: 61px;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  box-shadow: 0 10px 28px rgba(15,23,42,0.08);
}
.ll-load-search-wrap {
  position: relative;
}
.ll-load-search-wrap span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 900;
  pointer-events: none;
}
.ll-load-search-wrap input {
  padding-left: 34px !important;
  font-weight: 800;
}
.ll-filter-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ll-filter-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 8px 12px;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}
.ll-filter-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a00;
}
.ll-product-count {
  min-width: 72px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-align: right;
}
.ll-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.ll-product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.ll-product-card.has-entry {
  border-color: rgba(34,197,94,0.55);
  box-shadow: inset 4px 0 0 #22c55e;
}
.ll-unit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.ll-unit-box {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.ll-simple-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 12px;
  align-items: center;
}
.ll-load-actions {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding: 12px 0 0;
  background: linear-gradient(180deg, transparent, var(--bg-surface) 22%);
}

@media (max-width: 860px) {
  .ll-load-modal {
    width: min(760px, calc(100vw - 16px));
    max-height: calc(100vh - 16px);
    border-radius: 16px;
  }
  .ll-load-tools {
    top: 58px;
    grid-template-columns: 1fr;
  }
	  .ll-issue-layout {
	    grid-template-columns: 1fr;
	  }
  .ll-load-setup-grid,
  .ll-load-setup-grid.no-date,
  .ll-load-setup-grid.no-store,
  .ll-load-setup-grid.no-date.no-store {
    grid-template-columns: 1fr;
  }
  .ll-setup-control-row {
    grid-template-columns: 1fr;
  }
  .ll-save-ref-btn,
  .ll-lock-pill {
    width: 100%;
  }
  .ll-setup-help {
    white-space: normal;
  }
	  .ll-recent-issues {
	    position: static;
	  }
  .ll-recent-list {
    max-height: none;
  }
  .ll-product-count {
    text-align: left;
  }
  .ll-product-grid {
    grid-template-columns: 1fr;
  }
  .ll-load-entry-head {
    display: grid;
  }
  .ll-load-entry-head > span {
    width: max-content;
  }
  .ll-item-row {
    grid-template-columns: 1fr;
  }
  .ll-stock-detail-grid {
    grid-template-columns: 1fr;
  }
  .ll-remove-item {
    width: 100%;
  }
}

/* ── Sales Page Calm Light Theme ──────────────────────────────
   The Sales workspace is used for long monitoring sessions. In light mode,
   keep the page readable but reduce pure-white glare from nested panels. */
[data-theme="light"] #page-sales {
  --bg-base: #e8edf5;
  --bg-surface: #eef3f9;
  --bg-card: #f7f9fc;
  --bg-elevated: #e1e8f2;
  --border: #c4cedf;
  --border-light: #aebbd0;
  --shadow-card: 0 2px 10px rgba(15, 23, 42, 0.055);
  background:
    linear-gradient(180deg, #e8edf5 0%, #edf2f8 46%, #e6ecf5 100%);
  border-radius: 0;
}

[data-theme="light"] #page-sales .sales-workspace-tabs,
[data-theme="light"] #page-sales .sales-workspace-window,
[data-theme="light"] #page-sales .sales-start-row,
[data-theme="light"] #page-sales .srp-alert,
[data-theme="light"] #page-sales .srp-manual-card,
[data-theme="light"] #page-sales .srp-toolbar,
[data-theme="light"] #page-sales .srp-rep-card {
  background: #f7f9fc !important;
  border-color: #c4cedf !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.045) !important;
}

[data-theme="light"] #page-sales .sales-workspace-window-head {
  background: linear-gradient(180deg, #eef3f9, #e1e8f2) !important;
}

[data-theme="light"] #page-sales .sales-workspace-window-body {
  background: #f3f6fb;
}

[data-theme="light"] #page-sales .srp-kpi,
[data-theme="light"] #page-sales #sales-kpi-grid > div,
[data-theme="light"] #page-sales #sales-panel-reps-hub > div:first-child > div,
[data-theme="light"] #page-sales .srp-rep-stats > div {
  background: #e3eaf3 !important;
  border-color: #c6d1e2 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55) !important;
}

[data-theme="light"] #page-sales .srp-kpi-ic,
[data-theme="light"] #page-sales .sales-workspace-gear,
[data-theme="light"] #page-sales .sales-workspace-close,
[data-theme="light"] #page-sales .sales-start-btn,
[data-theme="light"] #page-sales .srp-date-input,
[data-theme="light"] #page-sales .srp-rep-select,
[data-theme="light"] #page-sales .srp-btn,
[data-theme="light"] #page-sales .srp-rep-action {
  background-color: #dde5f0 !important;
  border-color: #c1ccdd !important;
}

[data-theme="light"] #page-sales .srp-alert-danger {
  background: linear-gradient(135deg, rgba(239,68,68,0.075), rgba(245,158,11,0.04), #f7f9fc) !important;
}

.so-office-rep-card {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 340px);
  gap: 12px;
  align-items: center;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.so-office-rep-label {
  font-size: 0.68rem;
  font-weight: 900;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.so-office-rep-sub {
  margin-top: 3px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1.35;
}
.so-office-rep-select {
  min-height: 44px;
  font-weight: 850;
}
@media (max-width: 767px) {
  .so-office-rep-card {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.srp-visit-action,
.srp-visit-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.76rem;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.srp-visit-mini-btn {
  padding: 5px 9px;
  font-size: 0.68rem;
  border-radius: 8px;
  white-space: nowrap;
}
.srp-visit-action.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a00;
}
.srp-visit-action:hover,
.srp-visit-mini-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

/* Office invoice window: keep Sales Rep mobile unchanged, make desktop a working popup */
body:not([data-role="Sales Rep"]) #sales-order-modal.modal-overlay {
  background: rgba(15, 23, 42, 0.45);
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
}
body:not([data-role="Sales Rep"]) #sales-order-modal .modal {
  width: min(1120px, calc(100vw - 48px));
  max-width: 1120px;
  height: auto;
  min-height: 0;
  max-height: calc(100vh - 48px);
  border: 1px solid var(--border);
  border-radius: 18px;
  margin: auto;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  animation: modalIn var(--dur-modal) var(--ease-out-quart) !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal .modal-header {
  border-radius: 18px 18px 0 0;
}
body:not([data-role="Sales Rep"]) #sales-order-modal .modal-body {
  padding: 16px;
  padding-bottom: 16px;
  overflow-y: auto;
}
body:not([data-role="Sales Rep"]) #sales-order-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  gap: 12px;
  align-items: start;
}
body:not([data-role="Sales Rep"]) #sales-order-form > :not(#so-customer-side-panel) {
  grid-column: 1;
}
body:not([data-role="Sales Rep"]) #sales-order-form > #so-customer-side-panel {
  grid-column: 2;
  grid-row: 1 / span 20;
}
.so-customer-side-panel {
  position: sticky;
  top: 0;
  max-height: calc(100vh - 132px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
}
.so-customer-side-empty,
.so-side-empty-line {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.so-customer-side-empty strong {
  color: var(--text-primary);
  font-size: 0.9rem;
}
.so-side-icon,
.so-side-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-weight: 900;
}
.so-side-avatar {
  background: rgba(37, 99, 235, 0.10);
  color: #2563eb;
  flex-shrink: 0;
}
.so-side-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.so-side-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}
.so-side-kicker,
.so-side-section-title small,
.so-side-metric span {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.so-side-profile h4 {
  margin: 1px 0 2px;
  color: var(--text-primary);
  font-size: 0.88rem;
  line-height: 1.18;
}
.so-side-profile p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.25;
}
.so-side-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.so-side-metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 9px 10px;
}
.so-side-metric strong {
  display: block;
  margin-top: 3px;
  font-size: 0.95rem;
  color: var(--text-primary);
}
.so-side-metric .is-danger,
.so-side-tx .is-danger { color: #ef4444; }
.so-side-metric .is-ok,
.so-side-tx .is-ok { color: #22c55e; }
.so-side-metric .is-warn { color: #d6a500; }
.so-side-metric .is-info { color: #6366f1; }
.so-side-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 900;
}
.so-side-tx-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.so-side-tx {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}
.so-side-tx:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.so-side-tx div {
  min-width: 0;
}
.so-side-tx strong,
.so-side-tx span,
.so-side-tx em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.so-side-tx strong {
  font-size: 0.76rem;
  color: var(--text-primary);
}
.so-side-tx span,
.so-side-tx em {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-style: normal;
  margin-top: 1px;
}
.so-side-tx b {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--text-primary);
}
.so-side-actions {
  display: grid;
  gap: 8px;
}
.so-side-actions button {
  border: 1px solid rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.10);
  color: #16a34a;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.76rem;
  font-weight: 900;
  cursor: pointer;
}
.so-recent-invoice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.so-recent-invoice-item {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 10px;
  overflow: hidden;
}
.so-recent-invoice-main {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  padding: 8px 9px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}
.so-recent-invoice-main span,
.so-recent-invoice-main strong,
.so-recent-invoice-main em,
.so-recent-invoice-main small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.so-recent-invoice-main strong {
  font-size: 0.73rem;
  font-weight: 950;
  color: var(--text-primary);
}
.so-recent-invoice-main em,
.so-recent-invoice-main small {
  color: var(--text-muted);
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 800;
  margin-top: 2px;
}
.so-recent-invoice-main b {
  font-size: 0.68rem;
  font-weight: 950;
  white-space: nowrap;
  align-self: start;
}
.so-recent-invoice-main b.is-danger { color: #ef4444; }
.so-recent-invoice-main b.is-ok { color: #16a34a; }
.so-recent-invoice-actions {
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3,1fr);
}
.so-recent-invoice-actions button {
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.so-recent-invoice-actions button:last-child {
  border-right: 0;
}
.so-recent-invoice-actions button:hover,
.so-recent-invoice-main:hover {
  background: rgba(99,102,241,0.07);
}
.so-batch-toolbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 10px;
  padding: 8px;
}
.so-batch-toolbar button {
  min-height: 34px;
  border: 1px solid rgba(214, 165, 0, 0.35);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.so-batch-toolbar div {
  min-width: 0;
  text-align: center;
}
.so-batch-toolbar strong,
.so-batch-toolbar span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.so-batch-toolbar strong {
  color: var(--text-primary);
  font-size: 0.8rem;
}
.so-batch-toolbar span {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 800;
  margin-top: 2px;
}
.so-batch-toolbar-edit,
.so-batch-toolbar-new {
  grid-column: auto;
}
.so-batch-view-mode {
  position: relative;
}
.so-batch-view-mode::before {
  content: "View only";
  position: sticky;
  top: 0;
  z-index: 3;
  grid-column: 1;
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  margin-bottom: -2px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.26);
  color: #2563eb;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.so-batch-audit-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(59, 130, 246, 0.07);
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 10px;
  padding: 9px;
}
.so-batch-audit-card div {
  min-width: 0;
}
.so-batch-audit-card span,
.so-batch-audit-card strong,
.so-batch-audit-card em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.so-batch-audit-card span {
  color: #2563eb;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.so-batch-audit-card strong {
  color: var(--text-primary);
  font-size: 0.76rem;
  margin-top: 3px;
}
.so-batch-audit-card em {
  color: var(--text-muted);
  font-size: 0.65rem;
  font-style: normal;
  margin-top: 2px;
}
.so-batch-view-mode input:disabled,
.so-batch-view-mode select:disabled,
.so-batch-view-mode textarea:disabled {
  opacity: 1;
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
  background: var(--bg-elevated);
  cursor: default;
}
.so-batch-view-mode .so-batch-view-action:disabled {
  opacity: 0.5;
}
.so-batch-mini-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.so-batch-mini-metrics div {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 8px;
  padding: 7px 8px;
  min-width: 0;
}
.so-batch-mini-metrics span,
.so-batch-mini-metrics b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.so-batch-mini-metrics span {
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.so-batch-mini-metrics b {
  color: var(--text-primary);
  font-size: 0.78rem;
  margin-top: 2px;
}
.so-batch-mini-metrics .is-danger,
.so-batch-recent-item .is-danger {
  color: #ef4444;
}
.so-batch-recent-item .is-ok {
  color: #22c55e;
}
.so-batch-recent-list {
  display: grid;
  gap: 6px;
}
.so-batch-recent-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
}
.so-batch-recent-item.is-active {
  border-color: rgba(214, 165, 0, 0.65);
  background: rgba(245, 158, 11, 0.12);
}
.so-batch-recent-item:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}
.so-batch-recent-item span {
  min-width: 0;
}
.so-batch-recent-item strong,
.so-batch-recent-item em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.so-batch-recent-item strong {
  color: var(--text-primary);
  font-size: 0.74rem;
}
.so-batch-recent-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.so-batch-recent-title strong {
  min-width: 0;
}
.so-batch-manual-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(99, 102, 241, 0.42);
  background: rgba(99, 102, 241, 0.16);
  color: #4338ca;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.66rem;
  font-weight: 950;
  line-height: 1.1;
}
.so-batch-recent-item em {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-style: normal;
  margin-top: 1px;
}
.so-batch-recent-item b {
  flex-shrink: 0;
  font-size: 0.72rem;
}
@media (max-width: 980px) {
  body:not([data-role="Sales Rep"]) #sales-order-modal.modal-overlay {
    align-items: flex-start;
    padding: 10px;
  }
  body:not([data-role="Sales Rep"]) #sales-order-modal .modal {
    width: 100%;
    max-height: calc(100vh - 20px);
    border-radius: 14px;
  }
  body:not([data-role="Sales Rep"]) #sales-order-form {
    grid-template-columns: 1fr;
  }
  body:not([data-role="Sales Rep"]) #sales-order-form > #so-customer-side-panel {
    grid-column: 1;
    grid-row: auto;
    position: static;
    max-height: none;
  }
  .so-batch-toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .so-batch-toolbar div {
    grid-column: 1 / -1;
    grid-row: 1;
  }
  .so-batch-toolbar button {
    grid-row: auto;
  }
  .so-batch-toolbar-edit,
  .so-batch-toolbar-new {
    grid-column: span 1;
  }
  .so-batch-audit-card {
    grid-template-columns: 1fr;
  }
}


/* ── Light Theme ──────────────────────────────────────────── */
[data-theme="light"] {
  --bg-base: #f0f2f7;
  --bg-surface: #ffffff;
  --bg-elevated: #e8ecf4;
  --bg-card: #ffffff;
  --border: #d1d8e8;
  --border-light: #b8c2d8;

  --accent: #d4a800;
  --accent-dim: #b8920a;
  --accent-glow: rgba(212, 168, 0, 0.12);

  --text-primary: #1a2035;
  --text-secondary: #4a5568;
  --text-muted: #8a94a8;

  --shadow: 0 4px 24px rgba(0,0,0,0.10);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.07);
}
[data-theme="light"] body {
  background: var(--bg-base);
  color: var(--text-primary);
}
[data-theme="light"] select.form-control option {
  background: #fff;
  color: #1a2035;
}
[data-theme="light"] .modal { background: #fff; }
[data-theme="light"] .modal-header { background: #fff; }
[data-theme="light"] #sidebar { background: #fff; }
[data-theme="light"] #top-header { background: #fff; }
[data-theme="light"] #bottom-nav { background: #fff; }
[data-theme="light"] .toast { background: #fff; }

/* Theme toggle button */
#theme-toggle {
  background: none; border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: all 0.2s ease;
  flex-shrink: 0;
}
#theme-toggle:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--accent); }

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-overflow-scrolling: touch; }
html {
  font-size: 16px;
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; }

/* ── Scrollbar ──────────────────────────────────────────────── */
* {
  scrollbar-width: auto;
  scrollbar-color: rgba(148, 163, 184, 0.82) rgba(226, 232, 240, 0.72);
}
::-webkit-scrollbar { width: 13px; height: 13px; }
::-webkit-scrollbar-track {
  background: rgba(226, 232, 240, 0.72);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.82);
  border: 3px solid rgba(226, 232, 240, 0.72);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.9);
}
::-webkit-scrollbar-corner {
  background: rgba(226, 232, 240, 0.72);
}

/* ============================================================
   AUTH / LOGIN
   ============================================================ */
#auth-boot-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 50% 0%, rgba(245,197,24,0.07) 0%, var(--bg-base) 62%);
}
.auth-boot-card {
  width: min(320px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}
.auth-boot-card img {
  width: 74px;
  height: 74px;
  border-radius: 18px;
  object-fit: contain;
  box-shadow: var(--shadow-card);
}
.auth-boot-card strong {
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 950;
  color: var(--accent);
}
.auth-boot-card span {
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--text-muted);
}
#login-screen {
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(ellipse at 50% 0%, rgba(245,197,24,0.08) 0%, var(--bg-base) 60%);
}
#login-screen.auth-visible {
  display: flex;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; margin-bottom: 14px; }
.login-logo img { width: 96px; height: 96px; border-radius: 20px; object-fit: contain; }
.login-logo h1 { font-size: 1.4rem; font-weight: 700; color: var(--accent); margin-top: 12px; letter-spacing: 0.5px; }
.login-logo p { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }
.login-company-code-step {
  display: grid;
  gap: 9px;
  margin: 0 0 20px;
}
.login-company-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}
.login-company-code-row .btn {
  min-width: 104px;
  padding-inline: 14px;
}
.login-company-code-error {
  color: #ef4444;
  font-size: 0.73rem;
  font-weight: 800;
}
.login-company-context {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin: 0 0 20px;
  padding: 10px 12px;
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.06);
  text-align: center;
}
.login-company-kicker {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
#login-company-name {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 900;
}
.login-trial-status {
  margin-top: 5px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1.2;
}
.login-change-company {
  margin-top: 4px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
}
.login-credentials.login-locked {
  display: none;
}
.login-support-note {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
}
.login-support-note a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 900;
}
.login-mode-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  cursor: pointer;
  user-select: none;
}
.login-mode-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.login-mode-box {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.login-mode-title {
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 800;
}
.login-mode-sub {
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.35;
}
.login-hint { background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 20px; font-size: 0.75rem; color: var(--text-secondary); line-height: 1.6; }
.login-hint strong { color: var(--accent); }

/* ============================================================
   APP SHELL
   ============================================================ */
#app-shell { display: none; min-height: 100vh; }
#app-shell.visible { display: flex; }

/* ── Top Header ─────────────────────────────────────────────── */
#top-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px;
  z-index: 100;
  gap: 12px;
}
#menu-toggle { background: none; border: none; color: var(--text-primary); cursor: pointer; padding: 8px; border-radius: var(--radius-sm); display: flex; align-items: center; }
#menu-toggle svg { width: 22px; height: 22px; }
#header-logo { display: flex; align-items: center; gap: 10px; flex: 1; }
#header-logo img { width: 36px; height: 36px; border-radius: 8px; }
#header-logo span { font-size: 0.95rem; font-weight: 700; color: var(--accent); }
#header-logo small { display: block; font-size: 0.65rem; color: var(--text-secondary); font-weight: 400; }
.header-actions { display: flex; align-items: center; gap: 8px; position: relative; }
#header-version-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  border: 1px solid rgba(180,130,0,0.35);
  border-radius: 8px;
  background: rgba(180,130,0,0.13);
  color: var(--accent);
  padding: 4px 8px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
}
#header-version-badge:hover {
  border-color: rgba(180,130,0,0.55);
  background: rgba(180,130,0,0.2);
}
#header-version-badge .header-version-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148,163,184,0.14);
}
#header-version-badge[data-update-status="current"] .header-version-status-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.16); }
#header-version-badge[data-update-status="update"] .header-version-status-dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }
#header-version-badge[data-update-status="checking"] .header-version-status-dot { background: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.16); }
#header-version-badge[data-update-status="offline"] .header-version-status-dot,
#header-version-badge[data-update-status="error"] .header-version-status-dot { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.14); }
#header-version-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 48px;
  z-index: 2500;
  width: min(300px, calc(100vw - 24px));
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-surface);
  box-shadow: 0 18px 45px rgba(15,23,42,0.18);
  padding: 12px;
}
.erp-version-menu-top {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.erp-version-menu-top span,
.erp-version-server span {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}
.erp-version-menu-top strong {
  color: var(--text-primary);
  font-size: 1.6rem;
  font-weight: 950;
  letter-spacing: 0;
}
.erp-version-status {
  margin-top: 10px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 10px;
}
.erp-version-status b {
  display: block;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 950;
  margin-bottom: 3px;
}
.erp-version-status small {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.35;
}
.erp-version-status.is-current { background: rgba(34,197,94,0.09); border-color: rgba(34,197,94,0.28); }
.erp-version-status.is-update { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.35); }
.erp-version-status.is-offline,
.erp-version-status.is-error { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.25); }
.erp-version-status.is-current b { color: #16a34a; }
.erp-version-status.is-update b { color: #d97706; }
.erp-version-status.is-offline b,
.erp-version-status.is-error b { color: #dc2626; }
.erp-version-server {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 850;
}
.erp-version-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.erp-version-actions button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  padding: 7px 10px;
  cursor: pointer;
}
.erp-version-actions button.primary {
  border-color: rgba(34,197,94,0.45);
  background: #22c55e;
  color: #fff;
}
.erp-version-actions button:disabled {
  opacity: 0.6;
  cursor: wait;
}
#notif-btn { position: relative; background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 8px; border-radius: var(--radius-sm); }
#notif-btn svg { width: 22px; height: 22px; }
#notif-badge { position: absolute; top: 4px; right: 4px; background: var(--red); color: #fff; font-size: 0.6rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 3px; }
#user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent-glow); border: 2px solid var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; color: var(--accent); cursor: pointer; }

/* Mobile: slim icon-only header */
@media (max-width: 767px) {
  #top-header {
    height: 44px;
    padding: 0 10px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    justify-content: space-between;
  }
  #header-logo { display: none; }
  .header-actions { gap: 6px; min-width: 0; }
  .header-actions button[onclick="openUniversalSearch()"] {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    justify-content: center !important;
    flex: 0 0 32px;
  }
  .header-actions button[onclick="openUniversalSearch()"] span,
  .header-actions button[onclick="openUniversalSearch()"] kbd {
    display: none !important;
  }
  #main-content { margin-top: 44px; }
  #menu-toggle { padding: 6px; }
  #notif-btn { padding: 6px; }
  #user-avatar { width: 30px; height: 30px; font-size: 0.75rem; }
  #theme-toggle { width: 32px !important; height: 32px !important; font-size: 0.9rem !important; flex: 0 0 32px; display: flex !important; }
}

/* Sales Rep mobile scroll model: one native scroll area.
   This wins over the older body-scroll rules above and is intentionally last. */
@media (max-width: 767px) {
  html,
  body[data-role="Sales Rep"] {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
    touch-action: none !important;
  }
  body[data-role="Sales Rep"] #app-shell.visible {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
  }
  body[data-role="Sales Rep"] #main-content {
    display: block !important;
    position: fixed !important;
    top: 44px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 0 18px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: contain !important;
  }
  body[data-role="Sales Rep"] .page.active {
    display: block !important;
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
    padding-bottom: 18px !important;
  }
  body[data-role="Sales Rep"] #sales-order-modal,
  body[data-role="Sales Rep"] #sales-order-modal .modal,
  body[data-role="Sales Rep"] #sales-order-modal .modal-body {
    touch-action: pan-y !important;
  }
  body[data-role="Sales Rep"] #sales-order-modal .modal-body {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  body[data-role="Sales Rep"] #sales-chq-modal[data-mode="customer-return"] {
    align-items: flex-start !important;
    touch-action: pan-y !important;
  }
  body[data-role="Sales Rep"] #sales-chq-modal[data-mode="customer-return"] .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    touch-action: pan-y !important;
  }
  @supports (height: 100dvh) {
    body[data-role="Sales Rep"] #sales-chq-modal[data-mode="customer-return"] .modal {
      height: 100dvh !important;
      max-height: 100dvh !important;
    }
  }
  body[data-role="Sales Rep"] #sales-chq-modal[data-mode="customer-return"] .modal-header {
    flex-shrink: 0 !important;
    border-radius: 0 !important;
  }
  body[data-role="Sales Rep"] #sales-chq-modal[data-mode="customer-return"] .modal-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 28px) !important;
  }
}


/* ── Sidebar Overlay ─────────────────────────────────────────── */
#sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 199;
  display: none;
}
#sidebar-overlay.open { display: block; }

/* ── Sidebar ──────────────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform var(--dur-modal) var(--ease-out-quart);
  display: flex; flex-direction: column;
  overflow: hidden;
  will-change: transform;
}
#sidebar.open { transform: translateX(0); }
.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-header img { width: 44px; height: 44px; border-radius: 10px; }
.sidebar-header-text h2 { font-size: 0.95rem; font-weight: 700; color: var(--accent); }
.sidebar-header-text p { font-size: 0.7rem; color: var(--text-secondary); margin-top: 2px; }
.sidebar-user-info {
  padding: 12px 20px;
  background: var(--bg-elevated);
  margin: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
#sidebar-status-row {
  padding: 5px 8px !important;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
}
#sidebar-session-mode {
  min-height: 23px !important;
  padding: 3px 7px !important;
  font-size: 0.56rem !important;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
}
#cleanup-mode-toggle {
  min-height: 27px !important;
  padding: 4px 8px !important;
  border-radius: 999px !important;
  font-size: 0.64rem !important;
}
#sidebar-fs-actions {
  padding: 4px 8px !important;
}
.sidebar-user-info .user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.sidebar-user-info .user-role { font-size: 0.72rem; color: var(--accent); font-weight: 500; margin-top: 2px; }
#sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 10px; }
.nav-section-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); padding: 12px 12px 6px; }
.nav-section-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.nav-section-toggle:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.nav-section-toggle.open,
.nav-section-toggle.has-active {
  color: var(--text-primary);
}
.nav-section-toggle.has-active {
  background: rgba(245, 197, 24, 0.08);
  border-color: rgba(245, 197, 24, 0.20);
}
.nav-section-toggle span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav-section-toggle em {
  min-width: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}
.nav-section-toggle svg {
  width: 14px;
  height: 14px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-secondary);
  font-size: 0.875rem; font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); border: 1px solid rgba(245,197,24,0.2); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-recent-panel {
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.nav-favorites-panel {
  margin: 0 0 8px;
  padding: 6px;
  border-bottom: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-card));
  border: 1px solid rgba(245,197,24,0.20);
}
.nav-favorites-label {
  padding: 0 2px 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-primary);
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.04em;
}
.nav-favorites-label small {
  font-size: 0.58rem;
  color: var(--text-muted);
  font-weight: 950;
  letter-spacing: 0;
}
.nav-favorite-label-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.nav-favorites-label button {
  border: 1px solid rgba(59,130,246,0.34);
  background: rgba(59,130,246,0.12);
  color: #1d4ed8;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 0.63rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.nav-recent-label {
  padding-top: 6px;
}
.nav-favorite-item {
  width: 100%;
  min-height: 36px;
  padding: 0 6px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 18px 18px 18px;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
  text-align: left;
}
.nav-favorite-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 2px;
}
.nav-favorite-item:hover,
.nav-favorite-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: rgba(245,197,24,0.42);
}
.nav-favorite-item svg {
  color: var(--text-secondary);
  opacity: 0.9;
}
.nav-fav-order,
.nav-favorite-item i {
  width: 18px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border: 1px solid transparent;
  background: transparent;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, background .12s ease, color .12s ease;
}
.nav-favorite-item:hover .nav-fav-order,
.nav-favorite-item:hover i,
.nav-favorite-item:focus-within .nav-fav-order,
.nav-favorite-item:focus-within i,
.nav-favorite-item.active .nav-fav-order,
.nav-favorite-item.active i {
  opacity: 1;
  pointer-events: auto;
}
.nav-fav-order {
  font-style: normal;
  font-weight: 900;
}
.nav-fav-order:hover {
  background: rgba(59,130,246,0.10);
  color: #2563eb;
}
.nav-favorite-item i:hover {
  background: rgba(239,68,68,0.10);
  color: #ef4444;
}
.nav-favorite-spacer {
  min-height: 26px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto auto;
  align-items: center;
  gap: 5px;
  padding: 1px 5px;
  color: var(--text-muted);
}
.nav-favorite-spacer span {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}
.nav-favorite-spacer span::before,
.nav-favorite-spacer span::after {
  content: "";
  height: 1px;
  border-top: 1px dashed rgba(148,163,184,0.55);
  flex: 1;
}
.nav-favorite-spacer button {
  width: 20px;
  height: 20px;
  border: 1px solid rgba(148,163,184,0.25);
  border-radius: 999px;
  background: rgba(148,163,184,0.08);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, background .12s ease, color .12s ease;
}
.nav-favorite-spacer:hover button,
.nav-favorite-spacer:focus-within button {
  opacity: 1;
  pointer-events: auto;
}
.nav-favorite-spacer button:hover {
  color: #2563eb;
  background: rgba(59,130,246,0.10);
}
.nav-favorite-spacer button.danger:hover {
  color: #ef4444;
  background: rgba(239,68,68,0.10);
}
.nav-favorites-empty {
  padding: 8px 9px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.35;
  font-weight: 850;
  border: 1px dashed rgba(245,197,24,0.34);
  border-radius: 11px;
  background: var(--bg-card);
}
.nav-favorites-empty strong {
  color: var(--text-primary);
}
.nav-recent-item {
  width: 100%;
  min-height: 34px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}
.nav-recent-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.nav-recent-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.nav-action-button {
  width: 100%;
  min-height: 38px;
  margin: 4px 0 8px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(34,197,94,0.34);
  border-radius: var(--radius-sm);
  background: rgba(34,197,94,0.09);
  color: #16a34a;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 900;
  cursor: pointer;
  text-align: left;
}
.nav-action-button:hover { background: rgba(34,197,94,0.14); }
.nav-action-button svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-action-button.blue {
  border-color: rgba(59,130,246,0.32);
  background: rgba(59,130,246,0.08);
  color: #2563eb;
}
.nav-action-button.blue:hover { background: rgba(59,130,246,0.13); }
.nav-action-button.gold {
  border-color: rgba(214,169,0,0.34);
  background: rgba(214,169,0,0.09);
  color: #b88a00;
}
.nav-action-button.gold:hover { background: rgba(214,169,0,0.14); }

/* Sidebar polish: compact grouped drawers */
#sidebar {
  background: color-mix(in srgb, var(--bg-surface) 94%, var(--bg-elevated));
}
.sidebar-header {
  padding: 6px 8px !important;
  background: var(--bg-card);
  gap: 8px !important;
}
.sidebar-header img {
  width: 24px !important;
  height: 24px !important;
  border-radius: 7px !important;
  box-shadow: none;
}
.sidebar-header-text h2 { font-size: 0.72rem !important; }
.sidebar-header-text p { display: none !important; }
.sidebar-user-info {
  margin: 4px 7px !important;
  padding: 5px 7px !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  background: var(--bg-card) !important;
  box-shadow: none;
}
.sidebar-user-info #sidebar-user-avatar {
  width: 24px !important;
  height: 24px !important;
  font-size: 0.66rem !important;
}
.sidebar-user-info .user-name {
  font-size: 0.72rem !important;
}
.sidebar-user-info .user-role,
#sidebar-user-username {
  font-size: 0.56rem !important;
}
#sidebar-status-row {
  padding: 4px 7px !important;
}
#sidebar-nav {
  padding: 5px 7px 8px;
}
.sidebar-nav-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 6px;
  align-items: center;
  margin: 0 1px 5px;
}
.sidebar-nav-search {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}
.sidebar-nav-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 760;
}
.sidebar-nav-search input::placeholder {
  color: var(--text-muted);
}
.sidebar-compact-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sidebar-compact-toggle:hover,
.sidebar-nav-search:focus-within {
  border-color: rgba(245, 197, 24, 0.45);
  color: var(--accent);
}
.sidebar-view-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin: 0 2px 5px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}
.sidebar-view-switch button {
  min-height: 24px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.sidebar-view-switch button.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.06);
}
.sidebar-view-switch button.simple.active {
  color: #16a34a;
}
.sidebar-view-switch button:hover {
  color: var(--text-primary);
}
.nav-section {
  position: relative;
}
.sidebar-simple-panel {
  margin: 1px 2px 4px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 9px;
}
.nav-recent-panel {
  margin: 0 0 5px;
  padding: 0 0 5px;
}
.nav-favorites-panel {
  margin: 0 0 8px;
  padding: 7px;
}
.nav-section-label {
  padding: 4px 7px 2px;
  font-size: 0.58rem;
}
.nav-section-toggle {
  min-height: 34px;
  margin: 4px 0 2px;
  padding: 5px 7px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.06);
  border-color: rgba(148, 163, 184, 0.18);
  color: var(--text-primary);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.03);
}
.nav-section-toggle.open {
  background: var(--bg-card);
  border-color: rgba(148, 163, 184, 0.30);
}
.nav-section-toggle.open:not(.single) {
  margin-bottom: 0;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
}
.nav-section-toggle.has-active {
  background: linear-gradient(180deg, rgba(245, 197, 24, 0.16), rgba(245, 197, 24, 0.07));
  border-color: rgba(245, 197, 24, 0.42);
  box-shadow: inset 3px 0 0 var(--accent), 0 6px 18px rgba(214, 164, 0, 0.08);
}
.nav-section-toggle.single em {
  min-width: 0;
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  font-size: 0.58rem;
  text-transform: uppercase;
}
.nav-section-toggle.single.has-active em {
  color: var(--accent);
}
.nav-section-title {
  display: flex !important;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.nav-section-title > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}
.nav-section-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--text-muted) 10%, transparent);
  color: var(--text-secondary);
}
.nav-section-toggle.open .nav-section-icon {
  background: var(--bg-elevated);
}
.nav-section-toggle.has-active .nav-section-icon {
  background: rgba(245, 197, 24, 0.22);
  color: var(--accent);
}
.nav-section-toggle em {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: rgba(148, 163, 184, 0.30);
}
.nav-section-toggle.has-active em {
  color: var(--accent);
  border-color: rgba(245, 197, 24, 0.44);
  background: rgba(255,255,255,0.55);
}
.nav-section-body {
  display: grid;
  gap: 3px;
  margin: 3px 0 6px 8px;
  padding: 6px 6px 6px 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0 0 13px 13px;
  background: color-mix(in srgb, var(--bg-card) 74%, var(--bg-elevated));
  box-shadow: inset 2px 0 0 rgba(148, 163, 184, 0.22);
  animation: sidebarDrawerIn 160ms var(--ease-out-quart);
}
.nav-section-toggle.open.has-active + .nav-section-body {
  border-color: rgba(245, 197, 24, 0.30);
  background: linear-gradient(180deg, rgba(245, 197, 24, 0.08), color-mix(in srgb, var(--bg-card) 82%, var(--bg-elevated)));
  box-shadow: inset 3px 0 0 var(--accent), 0 8px 22px rgba(214, 164, 0, 0.07);
}
.nav-item,
.nav-recent-item,
.nav-action-button {
  border-radius: 10px;
}
.nav-item {
  min-height: 32px;
  margin-bottom: 0;
  padding: 0 7px;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 780;
  border: 1px solid transparent;
  color: var(--text-secondary);
  position: relative;
}
.nav-item::before {
  display: none;
}
.nav-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.76;
}
.nav-fav-toggle {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.72;
}
.nav-fav-toggle:hover,
.nav-fav-toggle.active {
  border-color: rgba(245,197,24,0.30);
  background: var(--accent-glow);
  color: var(--accent);
  opacity: 1;
}
.nav-fav-toggle svg {
  width: 13px;
  height: 13px;
}
.nav-item.active {
  background: color-mix(in srgb, var(--accent) 11%, var(--bg-card));
  color: var(--accent);
  border-color: rgba(245, 197, 24, 0.38);
  box-shadow: inset 3px 0 0 var(--accent), 0 5px 14px rgba(214, 164, 0, 0.10);
  font-weight: 950;
}
.nav-item.active::before {
  display: none;
}
.nav-item.active svg {
  opacity: 1;
}
.nav-recent-item {
  min-height: 27px;
  padding: 0 8px;
  font-size: 0.68rem;
}
.nav-action-button {
  min-height: 32px;
  margin: 2px 0;
  padding: 0 8px;
  gap: 8px;
  font-size: 0.7rem;
}
.nav-more-btn {
  min-height: 30px;
  border: 1px dashed rgba(148, 163, 184, 0.36);
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.66rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.nav-more-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.sidebar-list-view .nav-section-body {
  margin-left: 0;
  border-radius: 12px;
  box-shadow: none;
}
.sidebar-grouped-compact .nav-section {
  margin: 1px 0;
}
.sidebar-grouped-compact .nav-section-toggle {
  min-height: 34px;
  margin: 0;
  padding: 4px 7px;
  border-radius: 9px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.sidebar-grouped-compact .nav-section-toggle:hover,
.sidebar-grouped-compact .nav-section-toggle.has-active {
  background: var(--bg-elevated);
  border-color: var(--border);
  box-shadow: none;
}
.sidebar-grouped-compact .nav-section-toggle.has-active {
  color: var(--text-primary);
}
.sidebar-grouped-compact .nav-section-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}
.sidebar-grouped-compact .nav-section-title > span:last-child {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
}
.sidebar-grouped-compact .nav-section-toggle em {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
}
.sidebar-grouped-compact .nav-section-body,
.sidebar-grouped-compact .nav-more-btn,
.sidebar-grouped-compact .nav-action-button {
  display: none !important;
}
.sidebar-grouped-compact .nav-recent-panel {
  margin-bottom: 5px;
  padding-bottom: 5px;
}
.sidebar-grouped-compact .nav-favorites-panel {
  margin-bottom: 7px;
}
.sidebar-grouped-compact .nav-recent-item {
  min-height: 26px;
  padding: 0 7px;
  font-size: 0.67rem;
}
.sidebar-grouped-compact .nav-favorite-item {
  min-height: 33px;
  font-size: 0.73rem;
}
.sidebar-hover-flyout {
  position: fixed;
  z-index: 260;
  width: 260px;
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.18);
  animation: sidebarFlyoutIn 120ms var(--ease-out-quart);
}
.sidebar-flyout-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px 9px;
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sidebar-flyout-head em {
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-style: normal;
  text-align: center;
}
.sidebar-flyout-list {
  display: grid;
  gap: 4px;
}
.sidebar-flyout-item,
.sidebar-flyout-action {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 9px;
}
.sidebar-flyout-item:hover,
.sidebar-flyout-item.active {
  background: color-mix(in srgb, var(--accent) 11%, var(--bg-card));
  color: var(--accent);
  border-color: rgba(245, 197, 24, 0.30);
}
.sidebar-flyout-action {
  margin-top: 4px;
  border-color: rgba(34,197,94,0.28);
  background: rgba(34,197,94,0.09);
  color: #16a34a;
  font-weight: 950;
}
.sidebar-flyout-action.blue {
  border-color: rgba(59,130,246,0.30);
  background: rgba(59,130,246,0.09);
  color: #2563eb;
}
.sidebar-flyout-action.gold {
  border-color: rgba(214,169,0,0.34);
  background: rgba(214,169,0,0.10);
  color: #b88a00;
}
.sidebar-flyout-item svg,
.sidebar-flyout-action svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}
.sidebar-flyout-item span {
  min-width: 0;
  flex: 1;
}
.sidebar-flyout-fav {
  margin-left: auto;
  min-width: 54px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  flex: 0 0 auto;
  font-style: normal;
  font-size: 0.58rem;
  font-weight: 950;
}
.sidebar-flyout-fav:hover,
.sidebar-flyout-fav.active {
  background: var(--accent-glow);
  color: var(--accent);
}
.sidebar-flyout-fav svg {
  width: 13px;
  height: 13px;
}
.sidebar-flyout-fav small {
  font: inherit;
}
@keyframes sidebarFlyoutIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}
.sidebar-empty-state {
  min-height: 82px;
  margin: 10px 4px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 800;
}
@keyframes sidebarDrawerIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.sidebar-footer {
  padding: 5px 7px 6px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}
#sidebar-primary-action {
  width: 100%;
  min-height: 34px;
  margin-bottom: 5px;
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.10);
  color: #16a34a;
  font-size: 0.76rem;
  font-weight: 950;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}
#sidebar-primary-action:hover {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}
#logout-btn {
  width: 100%; padding: 7px; border-radius: var(--radius-sm);
  background: var(--red-bg); border: 1px solid rgba(239,68,68,0.2);
  color: var(--red); font-size: 0.78rem; font-weight: 800;
  cursor: pointer; transition: all var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
#fs-toggle-btn {
  width: 38px !important;
  min-height: 38px !important;
  padding: 6px !important;
  margin-bottom: 0 !important;
  border-radius: 9px !important;
  font-size: 0.72rem !important;
}
#fs-btn-label {
  display: none !important;
}
#logout-btn:hover { background: var(--red); color: #fff; }

/* Desktop icon-only sidebar */
@media (min-width: 768px) {
  body.sidebar-compact {
    --sidebar-width: 72px;
  }
  body.sidebar-compact #sidebar {
    width: var(--sidebar-width);
  }
  body.sidebar-compact .sidebar-header {
    justify-content: center;
    padding: 10px 8px !important;
  }
  body.sidebar-compact .sidebar-header-text,
  body.sidebar-compact .sidebar-user-info > div:not(#sidebar-user-avatar),
  body.sidebar-compact #sidebar-session-mode,
  body.sidebar-compact #cleanup-mode-toggle span:not(#cleanup-mode-dot),
  body.sidebar-compact .nav-section-title > span:last-child,
  body.sidebar-compact .nav-section-toggle em,
  body.sidebar-compact .nav-section-toggle > svg,
  body.sidebar-compact .nav-item span,
  body.sidebar-compact .nav-recent-panel,
  body.sidebar-compact .nav-favorites-panel,
  body.sidebar-compact .nav-action-button span,
  body.sidebar-compact .nav-more-btn,
  body.sidebar-compact .sidebar-view-switch span,
  body.sidebar-compact #fs-btn-label,
  body.sidebar-compact #logout-btn,
  body.sidebar-compact #sidebar-primary-action span:last-child,
  body.sidebar-compact .sidebar-nav-search input {
    display: none !important;
  }
  body.sidebar-compact .sidebar-user-info {
    justify-content: center;
    margin: 8px !important;
    padding: 8px !important;
  }
  body.sidebar-compact #sidebar-nav {
    padding: 8px 7px;
  }
  body.sidebar-compact .sidebar-nav-tools {
    grid-template-columns: 1fr;
    gap: 6px;
    margin: 0 0 8px;
  }
  body.sidebar-compact .sidebar-view-switch {
    grid-template-columns: 1fr;
    margin: 0 auto 8px;
    width: 42px;
    padding: 3px;
  }
  body.sidebar-compact .sidebar-view-switch button {
    min-height: 34px;
    padding: 0;
  }
  body.sidebar-compact .sidebar-nav-search,
  body.sidebar-compact .sidebar-compact-toggle {
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    justify-content: center;
    margin: 0 auto;
  }
  body.sidebar-compact .nav-section-toggle {
    width: 46px;
    height: 46px;
    min-height: 46px;
    grid-template-columns: 1fr;
    justify-items: center;
    margin: 6px auto;
    padding: 0;
  }
  body.sidebar-compact .nav-section-title {
    justify-content: center;
  }
  body.sidebar-compact .nav-section-icon {
    width: 32px;
    height: 32px;
  }
  body.sidebar-compact .nav-section-body {
    margin: 2px 0 8px;
    padding: 0;
    gap: 5px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  body.sidebar-compact .nav-item,
  body.sidebar-compact .nav-action-button {
    width: 46px;
    min-height: 44px;
    padding: 0;
    justify-content: center;
    margin: 0 auto;
  }
  body.sidebar-compact #sidebar-primary-action,
  body.sidebar-compact #fs-toggle-btn {
    width: 46px !important;
    min-height: 44px;
    padding: 0 !important;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ── Top Menu Bar (QuickBooks-style horizontal dropdowns) ────── */
#top-menubar {
  --top-menubar-height: 38px;
  position: sticky !important;
  top: 0 !important;
  z-index: 140;
  display: flex; align-items: stretch; flex-wrap: nowrap;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  padding: 0 10px;
  min-height: var(--top-menubar-height);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#top-menubar::-webkit-scrollbar {
  display: none;
}

body[data-role="Sales Rep"] #top-menubar,
body[data-role="Sales Rep"] #global-quick-bar {
  display: none !important;
}

/* ── Global Search + Quick Actions bar (App shell only) ─────── */
#global-quick-bar {
  position: static;
  background: rgba(248, 250, 252, 0.92);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  overflow: hidden;
}

#global-search-pill {
  flex-shrink: 0;
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  min-width: 136px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
#global-search-pill span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

#global-search-pill kbd {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 0.62rem;
  font-family: monospace;
  color: var(--text-muted);
}

#global-create-button,
#global-inbox-button,
#global-message-button,
#global-work-home,
#global-quiet-mode,
#global-approvals-button,
#global-credit-approval-button,
#global-user-sessions-button {
  flex: 0 0 auto;
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
#global-create-button {
  border-color: rgba(245, 197, 24, 0.38);
  background: rgba(245, 197, 24, 0.15);
  color: #8a6500;
  font-weight: 900;
}
#global-create-button:hover {
  filter: brightness(0.98);
}
#global-inbox-button,
#global-message-button {
  position: relative;
}
#global-inbox-button strong,
#global-message-button strong,
#global-approvals-button strong,
#global-credit-approval-button strong {
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  background: #ef4444;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 900;
  line-height: 1;
}
#global-inbox-button strong.hidden,
#global-message-button strong.hidden {
  display: none;
}
#global-message-button.urgent {
  border-color: rgba(59,130,246,0.38);
  background: rgba(59,130,246,0.09);
  color: #2563eb;
}
#global-approvals-button,
#global-credit-approval-button,
#global-user-sessions-button {
  position: relative;
  display: none;
}
#global-approvals-button.active,
#global-credit-approval-button.active,
#global-user-sessions-button.active {
  display: inline-flex;
}
#global-approvals-button.urgent,
#global-credit-approval-button.urgent {
  border-color: rgba(239,68,68,0.38);
  background: rgba(239,68,68,0.09);
  color: #dc2626;
  animation: urgentApprovalBlink 1.05s ease-in-out infinite;
}
#global-credit-approval-button.urgent {
  border-color: rgba(245,158,11,0.5);
  background: rgba(245,158,11,0.16);
  color: #9a6700;
}
#global-approvals-button strong.hidden,
#global-credit-approval-button strong.hidden {
  display: none;
}
@keyframes urgentApprovalBlink {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); transform: translateY(0); }
  50% { box-shadow: 0 0 0 4px rgba(239,68,68,0.12); transform: translateY(-1px); }
}
#global-work-home.hidden {
  display: none !important;
}
#global-work-home:hover,
#global-quiet-mode:hover,
#global-user-sessions-button:hover,
#global-user-sessions-button.active,
#global-quiet-mode.active {
  border-color: rgba(245,197,24,0.35);
  background: var(--accent-glow);
  color: var(--accent);
}
#global-quiet-mode.active {
  border-color: rgba(34,197,94,0.34);
  background: rgba(34,197,94,0.10);
  color: #16a34a;
}

#global-current-page {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 260px;
  height: 33px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
}
#global-current-page,
#global-quick-actions,
#global-work-home {
  display: none !important;
}
#global-current-page span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-center-grid {
  display: grid;
  gap: 12px;
}
.session-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.session-summary > div {
  min-width: 150px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
}
.session-summary strong {
  display: block;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-primary);
}
.session-summary span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 800;
}
.session-list {
  display: grid;
  gap: 8px;
}
.session-policy-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}
.session-policy-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 140px 140px auto;
  align-items: end;
  gap: 10px;
}
.session-policy-grid label {
  display: grid;
  gap: 5px;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 900;
  text-transform: uppercase;
}
.session-policy-toggle {
  align-self: center;
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--text-primary) !important;
  font-size: .78rem !important;
  text-transform: none !important;
}
.session-policy-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.session-policy-note {
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 750;
  line-height: 1.45;
}
.session-exception-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.session-exception-list {
  display: grid;
  gap: 6px;
}
.session-exception-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
}
.session-exception-row strong,
.session-exception-row span {
  display: block;
}
.session-exception-row span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 750;
}
.session-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}
.session-avatar {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-glow);
  border: 1px solid rgba(245,197,24,.35);
  color: var(--accent);
  font-weight: 950;
}
.session-avatar.blocked {
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.3);
  color: #ef4444;
}
.session-main {
  min-width: 0;
}
.session-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--text-primary);
}
.session-meta,
.session-times {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: .74rem;
  font-weight: 750;
}
.session-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.session-status {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .64rem;
  font-weight: 950;
}
.session-status.online {
  background: rgba(34,197,94,.12);
  color: #16a34a;
}
.session-status.current {
  background: rgba(59,130,246,.12);
  color: #2563eb;
}
.session-status.blocked {
  background: rgba(239,68,68,.12);
  color: #dc2626;
}
.session-section-title {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .04em;
}
@media (max-width: 760px) {
  .session-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .session-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .session-actions .btn {
    flex: 1 1 120px;
  }
  .session-policy-grid,
  .session-exception-tools {
    grid-template-columns: 1fr;
  }
}

.approval-center-shell {
  display: grid;
  gap: 14px;
}
.approval-center-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}
.approval-center-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: .7rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.approval-center-hero h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.45rem;
  font-weight: 950;
}
.approval-center-hero p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 750;
}
.approval-center-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}
.approval-center-kpi {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
}
.approval-center-kpi span {
  display: block;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 950;
  text-transform: uppercase;
}
.approval-center-kpi strong {
  display: block;
  margin-top: 5px;
  font-size: 1.35rem;
  line-height: 1;
}
.approval-center-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}
.approval-center-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.approval-center-tabs button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
  font: inherit;
  font-size: .76rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}
.approval-center-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #111827;
}
.approval-center-tabs span {
  margin-left: 5px;
  opacity: .72;
}
.approval-center-section {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
}
.approval-center-section-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.approval-center-section-head > div {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.approval-center-section-head h2 {
  flex: 1;
  margin: 0;
  color: var(--text-primary);
  font-size: .95rem;
  font-weight: 950;
}
.approval-center-section-head > span {
  min-width: 26px;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  text-align: center;
  font-size: .72rem;
  font-weight: 950;
  padding: 3px 8px;
}
.approval-center-list {
  display: grid;
}
.approval-center-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.approval-center-row:last-child {
  border-bottom: 0;
}
.approval-center-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 950;
}
.approval-center-main {
  min-width: 0;
}
.approval-center-title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.approval-center-title strong {
  color: var(--text-primary);
  font-size: .88rem;
}
.approval-center-title span {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: .62rem;
  font-weight: 950;
}
.approval-center-sub,
.approval-center-meta {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: .74rem;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.approval-center-meta {
  font-size: .68rem;
}
.approval-center-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}
.ac-inline-input {
  width: 120px;
  min-height: 34px;
  padding: 6px 9px;
}
@media (max-width: 860px) {
  .approval-center-kpis,
  .approval-center-toolbar {
    grid-template-columns: 1fr;
  }
  .approval-center-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .approval-center-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .approval-center-actions .btn,
  .approval-center-actions input {
    flex: 1 1 130px;
  }
}

.pdc-shell {
  display: grid;
  gap: 14px;
  padding: 16px;
}
.pdc-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
}
.pdc-kicker {
  color: var(--accent);
  font-size: .72rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.pdc-hero h1 {
  margin: 4px 0 4px;
  font-size: 1.45rem;
  color: var(--text-primary);
}
.pdc-hero p {
  margin: 0;
  color: var(--text-secondary);
  font-size: .86rem;
  font-weight: 750;
  line-height: 1.4;
}
.pdc-progress-card {
  min-width: 210px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
}
.pdc-progress-card strong {
  display: block;
  color: var(--text-primary);
  font-size: 1.7rem;
  line-height: 1;
}
.pdc-progress-card span {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 850;
}
.pdc-progress-bar {
  height: 7px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148,163,184,.24);
}
.pdc-progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.pdc-toolbar,
.pdc-add {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
}
.pdc-add {
  grid-template-columns: 210px minmax(240px, 1fr) 130px auto;
}
.pdc-segments {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
}
.pdc-segments button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: .75rem;
  font-weight: 900;
  padding: 7px 12px;
  cursor: pointer;
}
.pdc-segments button.active {
  background: var(--accent);
  color: #1f2937;
}
.pdc-sections {
  display: grid;
  gap: 12px;
}
.pdc-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-surface);
}
.pdc-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
}
.pdc-section-head h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: .98rem;
}
.pdc-section-head p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 750;
}
.pdc-section-head span {
  min-width: 54px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 950;
  font-size: .75rem;
}
.pdc-list {
  display: grid;
}
.pdc-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.pdc-item:last-child {
  border-bottom: 0;
}
.pdc-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.pdc-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: var(--bg-card);
}
.pdc-item.done .pdc-check {
  border-color: #22c55e;
  background: #22c55e;
  box-shadow: inset 0 0 0 4px var(--bg-card);
}
.pdc-item-main {
  min-width: 0;
}
.pdc-item-main strong {
  display: block;
  color: var(--text-primary);
  font-size: .84rem;
  line-height: 1.25;
}
.pdc-item-main small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 800;
}
.pdc-item.done .pdc-item-main strong {
  color: var(--text-muted);
  text-decoration: line-through;
}
.pdc-remove {
  border: 1px solid rgba(239,68,68,.28);
  border-radius: 999px;
  background: rgba(239,68,68,.08);
  color: #dc2626;
  font: inherit;
  font-size: .68rem;
  font-weight: 900;
  padding: 6px 10px;
  cursor: pointer;
}
.pdc-empty {
  padding: 14px;
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 800;
}
.sa-change-line {
  display: grid;
  grid-template-columns: minmax(120px, 170px) minmax(120px, 1fr) minmax(120px, 1fr);
  gap: 8px;
  align-items: center;
  margin: 2px 0;
}
.sa-change-line strong {
  color: var(--text-primary);
}
.sa-change-line span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.sa-change-line b {
  color: var(--text-muted);
  font-size: .65rem;
  font-weight: 950;
  text-transform: uppercase;
}
.sa-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15,23,42,.58);
}
.sa-modal {
  width: min(1120px, 96vw);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}
.sa-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.sa-modal-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 900;
}
.sa-modal-header h3 {
  margin: 7px 0 3px;
  color: var(--text-primary);
  font-size: 1.25rem;
}
.sa-modal-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 850;
}
.sa-modal-body {
  display: grid;
  gap: 14px;
  padding: 16px 20px 20px;
}
.sa-event-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}
.sa-detail-section {
  display: grid;
  gap: 10px;
}
.sa-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sa-section-title h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: .94rem;
}
.sa-section-title span {
  color: var(--text-muted);
  font-size: .72rem;
  font-weight: 850;
}
.sa-diff-grid {
  display: grid;
  gap: 8px;
}
.sa-diff-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
}
.sa-diff-field {
  display: flex;
  align-items: center;
  color: var(--text-primary);
  font-weight: 950;
}
.sa-diff-values {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}
.sa-before-box,
.sa-after-box {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.sa-before-box {
  background: rgba(239,68,68,.06);
  border-color: rgba(239,68,68,.18);
}
.sa-after-box {
  background: rgba(34,197,94,.07);
  border-color: rgba(34,197,94,.2);
}
.sa-before-box span,
.sa-after-box span {
  display: block;
  color: var(--text-muted);
  font-size: .66rem;
  font-weight: 950;
  text-transform: uppercase;
}
.sa-before-box strong,
.sa-after-box strong {
  display: block;
  margin-top: 3px;
  color: var(--text-primary);
  font-size: .88rem;
  overflow-wrap: anywhere;
}
.sa-arrow {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 950;
  font-size: 1.1rem;
}
.sa-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.sa-compare-panel,
.sa-items-panel,
.sa-note-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
  overflow: hidden;
}
.sa-compare-panel.before {
  border-color: rgba(239,68,68,.22);
}
.sa-compare-panel.after {
  border-color: rgba(34,197,94,.24);
}
.sa-compare-panel h4,
.sa-items-panel h4 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: .82rem;
  font-weight: 950;
}
.sa-compare-panel.empty p,
.sa-items-panel p,
.sa-note-box {
  padding: 12px;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 800;
}
.sa-compare-fields {
  display: grid;
}
.sa-compare-fields div,
.sa-item-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.sa-compare-fields div:last-child,
.sa-item-row:last-child {
  border-bottom: 0;
}
.sa-compare-fields span {
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 900;
  text-transform: uppercase;
}
.sa-compare-fields strong {
  color: var(--text-primary);
  font-size: .82rem;
  overflow-wrap: anywhere;
}
.sa-item-row {
  grid-template-columns: minmax(0, 1fr) 100px 110px 120px;
  align-items: center;
  font-size: .78rem;
}
.sa-item-row strong {
  color: var(--text-primary);
}
.sa-item-row span {
  color: var(--text-secondary);
}
.sa-item-row b {
  text-align: right;
  color: var(--text-primary);
}
@media (max-width: 820px) {
  .pdc-hero,
  .pdc-toolbar,
  .pdc-add {
    grid-template-columns: 1fr;
    display: grid;
  }
  .pdc-progress-card {
    min-width: 0;
  }
  .pdc-item {
    grid-template-columns: 28px minmax(0, 1fr);
  }
  .pdc-remove {
    grid-column: 1 / -1;
    justify-self: start;
  }
  .sa-change-line {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .sa-event-summary,
  .sa-compare-grid,
  .sa-diff-card,
  .sa-diff-values {
    grid-template-columns: 1fr;
  }
  .sa-arrow {
    min-height: 24px;
  }
  .sa-item-row {
    grid-template-columns: 1fr;
  }
  .sa-item-row b {
    text-align: left;
  }
}

#global-nav-context {
  position: static;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-surface) 92%, var(--accent-glow));
  color: var(--text-secondary);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}
#global-nav-context.hidden {
  display: none !important;
}
.nav-context-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  font-size: 0.74rem;
  font-weight: 850;
}
.nav-context-copy strong {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-context-source {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 0.66rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nav-context-arrow {
  color: var(--text-muted);
}
.nav-context-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}
.nav-context-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}
.nav-context-actions button {
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(245,197,24,0.38);
  background: var(--accent);
  color: #1a1a00;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 950;
  cursor: pointer;
}
.nav-context-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}
.nav-context-actions button.quiet {
  border-color: var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
}
body.simple-ui-on #global-nav-context {
  top: auto;
}

#global-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 1px;
}
#global-quick-actions::-webkit-scrollbar { display: none; }

#training-workspace-warning {
  position: sticky;
  top: 0;
  z-index: 87;
  background: #2563eb;
  color: #fff;
  border-bottom: 1px solid #1d4ed8;
  padding: 8px 12px;
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
}
#training-workspace-warning strong {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}
body.training-mode-session .page::after {
  content: "TRAINING";
  position: fixed;
  right: 14px;
  bottom: calc(var(--bottom-nav-height) + 14px);
  z-index: 60;
  pointer-events: none;
  background: rgba(37,99,235,0.12);
  border: 1px solid rgba(37,99,235,0.42);
  color: #60a5fa;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.global-quick-action {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 33px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.global-quick-action-icon { font-size: 0.92rem; }
.global-quick-action-icon svg {
  width: 15px;
  height: 15px;
  display: block;
}
.global-quick-action-pinned { color: var(--accent); font-size: 0.7rem; line-height: 1; margin-left: 1px; opacity: 0.95; }
.global-quick-more-button {
  border-style: dashed;
  color: var(--text-muted);
}
.global-quick-action-count {
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 900;
}
.global-quick-more-menu {
  position: fixed;
  z-index: 10000;
  width: 260px;
  max-width: calc(100vw - 20px);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
}
.global-create-menu {
  width: 286px;
}
.global-quick-more-title {
  padding: 6px 8px 8px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.global-quick-more-item {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.global-quick-more-item:hover { background: var(--bg-elevated); }
.global-quick-more-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  flex-shrink: 0;
}
.global-quick-more-item strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.15;
}
.global-quick-more-item small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1.2;
}

@media (hover: hover) and (pointer: fine) {
  #global-search-pill:hover,
  .global-quick-action:hover { color: var(--text-primary); border-color: rgba(245,197,24,0.35); background: var(--accent-glow); }
}

@media (max-width: 767px) {
  #global-quick-bar { padding: 8px 6px; gap: 6px; }
  #global-search-pill {
    min-width: 42px;
    padding: 0 9px;
    font-size: 0.67rem;
    gap: 5px;
    height: 31px;
  }
  #global-search-pill span:first-child { display: inline-flex; }
  #global-search-pill span:nth-child(2) { display: none; }
  #global-search-pill kbd { display: none; }
  #global-work-home { display: none; }
  #global-create-button {
    min-width: 42px;
    padding: 0 10px;
  }
  #global-create-button span:last-child { display: none; }
  #global-inbox-button {
    min-width: 42px;
    padding: 0 10px;
  }
  #global-inbox-button span:nth-child(2) { display: none; }
  #global-message-button {
    min-width: 42px;
    padding: 0 10px;
  }
  #global-message-button span:nth-child(2) { display: none; }
  #global-quiet-mode { min-width: 42px; padding: 0 10px; }
  #global-quiet-mode span:last-child { display: none; }
  #global-current-page { display: none; }
  #global-nav-context {
    top: 47px;
    padding: 7px 9px;
    gap: 8px;
  }
  .nav-context-copy {
    font-size: 0.68rem;
    gap: 6px;
  }
  .nav-context-source,
  .nav-context-label {
    display: none;
  }
  .nav-context-actions button {
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.66rem;
  }
  .global-quick-action {
    height: 31px;
    font-size: 0.66rem;
    padding: 0 10px;
  }
  .global-quick-action-icon { font-size: 0.84rem; }
}

.tmb-item {
  position: relative;
  display: flex; align-items: center; gap: 5px;
  padding: 7px 10px;
  font-size: 0.74rem; font-weight: 700;
  color: var(--text-secondary);
  background: transparent; border: none;
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tmb-item:hover,
.tmb-item.tmb-open,
.tmb-item.tmb-active,
.tmb-item.tmb-has-active { color: var(--accent); background: rgba(245, 197, 24, 0.08); border-bottom-color: var(--accent); }
.tmb-add-favorite {
  color: #2563eb;
  font-size: 0.7rem;
  font-weight: 800;
}
.tmb-add-favorite:hover {
  color: #1d4ed8;
  background: rgba(59,130,246,0.08);
  border-bottom-color: #3b82f6;
}
.tmb-item .tmb-caret {
  width: 10px; height: 10px; margin-left: 2px; opacity: 0.55;
  transition: transform 0.2s;
}
.tmb-item.tmb-open .tmb-caret { transform: rotate(180deg); opacity: 1; }
.tmb-dropdown {
  display: none; position: absolute; top: 100%; left: 0;
  min-width: 220px; max-height: 500px; overflow-y: auto;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  padding: 6px; z-index: 95;
}
.tmb-floating-dropdown {
  display: block;
  position: fixed;
  top: auto;
  left: auto;
  z-index: 10050;
  border-radius: 0 0 10px 10px;
}
.tmb-dropdown-finance {
  width: min(360px, calc(100vw - 16px));
}
.tmb-item.tmb-open .tmb-dropdown { display: block; }
.tmb-dropdown-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px; border-radius: 7px;
  font-size: 0.78rem; font-weight: 500;
  color: var(--text-primary); cursor: pointer; text-align: left;
  background: transparent; border: none; width: 100%;
  transition: background 0.12s;
}
.tmb-dropdown-item:hover { background: var(--accent-glow); color: var(--accent); }
.tmb-dropdown-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.75; }
.tmb-dropdown-item.active-page { background: var(--accent-glow); color: var(--accent); font-weight: 700; }
.tmb-dropdown-item.action {
  margin-bottom: 4px;
  border: 1px solid rgba(37,99,235,0.2);
  background: rgba(37,99,235,0.08);
  color: #2563eb;
}
.tmb-dropdown-item.action:hover {
  background: rgba(37,99,235,0.14);
  color: #1d4ed8;
}
.tmb-dropdown-item.guided {
  align-items: flex-start;
  min-height: 54px;
  padding: 10px 11px;
}
.tmb-dropdown-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.tmb-dropdown-copy > span {
  color: inherit;
  font-weight: 900;
  line-height: 1.15;
}
.tmb-dropdown-copy small {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 750;
  line-height: 1.25;
}
.tmb-dropdown-item.guided:hover .tmb-dropdown-copy small {
  color: color-mix(in srgb, var(--accent) 72%, var(--text-muted));
}
.tmb-dropdown-guide-title {
  padding: 5px 9px 8px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tmb-favorites-empty {
  padding: 10px;
  display: grid;
  gap: 7px;
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.35;
}
.tmb-favorites-empty strong {
  color: var(--text-primary);
  font-size: 0.78rem;
}
.tmb-favorites-empty button {
  border: 1px solid rgba(59,130,246,0.24);
  background: rgba(59,130,246,0.08);
  color: #2563eb;
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 0.7rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.shortcut-settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 10080;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15,23,42,0.58);
}
.shortcut-settings-card {
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-surface);
  box-shadow: 0 24px 80px rgba(15,23,42,0.32);
}
.shortcut-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.shortcut-settings-head h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 950;
}
.shortcut-settings-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 750;
}
.shortcut-settings-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.shortcut-settings-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.shortcut-settings-search {
  min-width: 180px;
  flex: 1;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-muted);
}
.shortcut-settings-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.78rem;
}
.shortcut-settings-select {
  gap: 7px;
}
.shortcut-settings-select > span {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 950;
  white-space: nowrap;
}
.shortcut-settings-select select {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 850;
}
.shortcut-settings-toolbar > button,
.shortcut-settings-foot button {
  min-height: 38px;
  border: 1px solid rgba(59,130,246,0.28);
  border-radius: 10px;
  background: rgba(59,130,246,0.08);
  color: #2563eb;
  font: inherit;
  font-size: 0.73rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
}
.shortcut-settings-body {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.1fr);
  gap: 14px;
  padding: 14px 18px;
}
.shortcut-settings-section-title {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 950;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
#shortcut-settings-selected,
#shortcut-settings-list {
  display: grid;
  gap: 7px;
}
.shortcut-selected-row,
.shortcut-page-row {
  min-width: 0;
  width: 100%;
  display: grid;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-primary);
}
.shortcut-selected-row {
  grid-template-columns: 20px minmax(0,1fr) auto 28px 28px 28px;
  min-height: 42px;
  padding: 0 7px 0 10px;
}
.shortcut-selected-row.keyboard {
  grid-template-columns: 20px minmax(0,1fr) auto 28px;
}
.shortcut-selected-row strong,
.shortcut-selected-row small,
.shortcut-page-row strong,
.shortcut-page-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shortcut-selected-row strong,
.shortcut-page-row strong {
  font-size: 0.78rem;
  font-weight: 900;
}
.shortcut-selected-row small,
.shortcut-page-row small {
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 750;
}
.shortcut-selected-row button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.shortcut-selected-row.spacer {
  grid-template-columns: minmax(0,1fr) 28px 28px 28px;
}
.shortcut-selected-row.spacer span {
  height: 1px;
  border-top: 1px dashed rgba(148,163,184,0.55);
}
.shortcut-page-row {
  grid-template-columns: 24px minmax(0,1fr) auto;
  min-height: 48px;
  padding: 8px 10px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.shortcut-page-row span {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.shortcut-page-row em {
  min-width: 52px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 950;
  text-align: center;
}
.shortcut-page-row:hover,
.shortcut-page-row.active {
  border-color: rgba(34,197,94,0.30);
  background: rgba(34,197,94,0.07);
}
.shortcut-page-row.active em {
  background: rgba(34,197,94,0.13);
  color: #16a34a;
}
.shortcut-settings-empty {
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  background: var(--bg-card);
  font-size: 0.75rem;
  font-weight: 800;
}
.keyboard-shortcut-builtins {
  display: grid;
  gap: 7px;
}
.keyboard-shortcut-builtins div {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(110px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 8px 10px;
}
.keyboard-shortcut-builtins kbd {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 4px 7px;
  font-size: 0.66rem;
  font-weight: 950;
  text-align: center;
}
.keyboard-shortcut-builtins span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 800;
}
.shortcut-settings-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
}
.shortcut-settings-foot button.primary {
  border-color: rgba(34,197,94,0.30);
  background: #16a34a;
  color: #fff;
}
.shortcut-settings-foot button.danger {
  margin-right: auto;
  border-color: rgba(239,68,68,0.25);
  background: rgba(239,68,68,0.08);
  color: #ef4444;
}

@media (max-width: 720px) {
  .shortcut-settings-overlay {
    align-items: flex-end;
    padding: 10px;
  }
  .shortcut-settings-card {
    max-height: calc(100vh - 20px);
    border-radius: 14px;
  }
  .shortcut-settings-toolbar {
    flex-wrap: wrap;
  }
  .shortcut-settings-search {
    flex-basis: 100%;
  }
  .shortcut-settings-body {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }
  .shortcut-selected-row {
    grid-template-columns: 20px minmax(0,1fr) 28px 28px 28px;
  }
  .shortcut-selected-row.keyboard {
    grid-template-columns: 20px minmax(0,1fr) 28px;
  }
  .shortcut-selected-row small {
    display: none;
  }
  .keyboard-shortcut-builtins div {
    grid-template-columns: 1fr;
  }
}
/* Mobile: collapse to icons only, keep scrolling */
@media (max-width: 767px) {
  #top-menubar { padding: 0 4px; }
  .tmb-item { padding: 7px 9px; font-size: 0.72rem; }
  .tmb-dropdown { min-width: 200px; }
  #global-home-back-btn {
    top: 6px;
    min-height: 40px;
    margin: 8px 12px 0;
    padding: 0 15px;
    font-size: 0.82rem;
  }
}
/* Print + hide */
@media print { #top-menubar { display: none !important; } }

/* ── Main Content ────────────────────────────────────────────── */
#main-content {
  flex: 1;
  margin-top: var(--nav-height);
  padding-bottom: 16px;
  min-height: calc(100vh - var(--nav-height));
  width: 100%;
  overflow-y: auto;
}
#global-home-back-btn {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  margin: 10px 16px 0;
  padding: 0 14px;
  border: 1px solid rgba(239,68,68,0.35);
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(239,68,68,0.18);
  cursor: pointer;
  touch-action: manipulation;
}
#global-home-back-btn.hidden,
body.modal-open #global-home-back-btn,
body.preview-mode #global-home-back-btn {
  display: none !important;
}
#global-home-back-btn:active {
  transform: scale(0.98);
}
@media (max-width: 767px) {
  body[data-role="Sales Rep"] #global-home-back-btn {
    display: none !important;
  }
}
.page { display: none; box-sizing: border-box; padding: 16px; max-width: 100%; overflow-x: auto; }
.page.active { display: block; animation: pageShow var(--dur-std) var(--ease-out-quart); }
@keyframes pageShow {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Keep normal work screens readable on large monitors.
   Wide operational pages get extra space, but actions should not drift too far from the content. */
@media (min-width: 1280px) {
  #main-content > .page.active {
    width: min(100%, 1280px);
    margin-left: auto;
    margin-right: auto;
  }
  #main-content > .page.active:is(
    #page-dashboard,
    #page-attendance-center,
    #page-bf-payroll,
    #page-loan-manager,
    #page-sales,
    #page-sales-team,
    #page-accounts-finance,
    #page-inventory,
    #page-purchasing,
    #page-manufacturing,
    #page-collections,
    #page-customer-management,
    #page-reports,
    #page-hr,
    #page-activitylog
  ) {
    width: min(100%, 1480px);
  }
  #page-reminders.page.active {
    width: min(100%, 1040px);
  }
}
@media (min-width: 1700px) {
  #main-content > .page.active {
    width: min(100%, 1340px);
  }
  #main-content > .page.active:is(
    #page-dashboard,
    #page-attendance-center,
    #page-bf-payroll,
    #page-loan-manager,
    #page-sales,
    #page-sales-team,
    #page-accounts-finance,
    #page-inventory,
    #page-purchasing,
    #page-manufacturing,
    #page-collections,
    #page-customer-management,
    #page-reports,
    #page-hr,
    #page-activitylog
  ) {
    width: min(100%, 1440px);
  }
}

/* Wide workspace mode: when users zoom the browser out, Chrome exposes more
   CSS pixels. Table-heavy ERP pages should use that extra room instead of
   staying centered with large empty side margins. */
@media (min-width: 1500px) {
  #main-content > .page.active:is(
    #page-attendance-center,
    #page-bf-payroll,
    #page-loan-manager,
    #page-inventory,
    #page-purchasing,
    #page-manufacturing,
    #page-accounts-finance,
    #page-sales,
    #page-collections,
    #page-customer-management,
    #page-distributors,
    #page-reports,
    #page-cheques,
    #page-banks
  ) {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: clamp(12px, 1vw, 20px);
    padding-right: clamp(12px, 1vw, 20px);
  }
  body[data-workspace-spacing="comfortable"] #main-content > .page.active:is(
    #page-attendance-center,
    #page-bf-payroll,
    #page-loan-manager,
    #page-inventory,
    #page-purchasing,
    #page-manufacturing,
    #page-accounts-finance,
    #page-sales,
    #page-collections,
    #page-customer-management,
    #page-distributors,
    #page-reports,
    #page-cheques,
    #page-banks
  ) {
    width: calc(100% - clamp(40px, 3.2vw, 92px));
    margin-left: clamp(24px, 2vw, 56px);
    margin-right: clamp(16px, 1.6vw, 36px);
    padding-left: clamp(12px, 1vw, 18px);
    padding-right: clamp(12px, 1vw, 18px);
  }
  body[data-workspace-spacing="focused"] #main-content > .page.active:is(
    #page-attendance-center,
    #page-bf-payroll,
    #page-loan-manager,
    #page-inventory,
    #page-purchasing,
    #page-manufacturing,
    #page-accounts-finance,
    #page-sales,
    #page-collections,
    #page-customer-management,
    #page-distributors,
    #page-reports,
    #page-cheques,
    #page-banks
  ) {
    width: min(100% - clamp(80px, 6vw, 180px), 1500px);
    margin-left: auto;
    margin-right: auto;
    padding-left: clamp(16px, 1.2vw, 24px);
    padding-right: clamp(16px, 1.2vw, 24px);
  }
}

@media (min-width: 1900px) {
  #main-content > .page.active:is(
    #page-attendance-center,
    #page-bf-payroll,
    #page-loan-manager,
    #page-inventory,
    #page-purchasing,
    #page-manufacturing,
    #page-accounts-finance,
    #page-sales,
    #page-collections,
    #page-customer-management,
    #page-distributors,
    #page-reports,
    #page-cheques,
    #page-banks
  ) {
    padding-left: 12px;
    padding-right: 12px;
  }
  body[data-workspace-spacing="comfortable"] #main-content > .page.active:is(
    #page-attendance-center,
    #page-bf-payroll,
    #page-loan-manager,
    #page-inventory,
    #page-purchasing,
    #page-manufacturing,
    #page-accounts-finance,
    #page-sales,
    #page-collections,
    #page-customer-management,
    #page-distributors,
    #page-reports,
    #page-cheques,
    #page-banks
  ) {
    padding-left: clamp(14px, 1vw, 22px);
    padding-right: clamp(14px, 1vw, 22px);
  }
}

/* ── Bottom Navigation (Mobile) ──────────────────────────────── */
/* Bottom nav removed — hidden permanently */
#bottom-nav { display: none !important; }
.bottom-nav-item { display: none !important; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* Page Header */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 1.3rem; font-weight: 800; color: var(--text-primary); }
.page-header p { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }
.page-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-header-row h1 { font-size: 1.2rem; font-weight: 800; color: var(--text-primary); }

/* Reminders */
.reminders-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.reminders-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 2px;
}
.reminders-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.reminders-title-block h1 {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-primary);
}
.reminders-title-block p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}
.reminders-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.reminder-count-pill {
  text-align: left;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform .14s var(--ease-out-quart), border-color .14s var(--ease-out-quart), box-shadow .14s var(--ease-out-quart);
}
.reminder-count-pill:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.reminder-count-pill strong {
  display: block;
  color: var(--text-primary);
  font-size: 1.3rem;
  line-height: 1;
}
.reminder-count-pill span {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.reminder-count-pill small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.25;
}
.reminder-count-pill.is-danger { border-color: rgba(239,68,68,0.28); background: linear-gradient(135deg, var(--bg-card), var(--red-bg)); }
.reminder-count-pill.is-warning { border-color: rgba(245,158,11,0.28); background: linear-gradient(135deg, var(--bg-card), var(--amber-bg)); }
.reminder-count-pill.is-info { border-color: rgba(59,130,246,0.24); background: linear-gradient(135deg, var(--bg-card), var(--blue-bg)); }
.reminder-count-pill.is-blue { border-color: rgba(59,130,246,0.24); background: linear-gradient(135deg, var(--bg-card), rgba(59,130,246,0.09)); }
.reminder-count-pill.is-audit { border-color: rgba(239,68,68,0.24); background: linear-gradient(135deg, var(--bg-card), rgba(245,158,11,0.09)); }
.reminder-control-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.reminder-search {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}
.reminder-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
}
.reminder-search input::placeholder {
  color: var(--text-muted);
}
.reminder-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: thin;
}
.reminder-tabs button {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 8px 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.reminder-tabs button svg {
  flex: 0 0 auto;
}
.reminder-tabs button.active {
  border-color: var(--accent);
  background: rgba(245,197,24,0.14);
  color: var(--text-primary);
}
.reminder-tabs button.tone-red.active {
  border-color: rgba(239,68,68,0.35);
  background: var(--red-bg);
}
.reminder-tabs button.tone-amber.active {
  border-color: rgba(245,158,11,0.35);
  background: var(--amber-bg);
}
.reminder-tabs button.tone-green.active {
  border-color: rgba(34,197,94,0.35);
  background: var(--green-bg);
}
.reminder-tabs button strong {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.66rem;
}
.reminder-tabs button.active strong {
  background: var(--accent);
  color: #191600;
}
.reminder-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.reminder-section-label span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.reminder-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.reminder-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.reminder-card.is-read {
  opacity: 0.74;
}
.reminder-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
}
.reminder-main {
  min-width: 0;
}
.reminder-title {
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.25;
}
.reminder-card:not(.is-read) .reminder-title {
  color: var(--accent);
}
.reminder-message {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.35;
}
.reminder-audit-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.reminder-audit-grid span {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 800;
}
.reminder-audit-grid b {
  color: var(--text-muted);
  font-weight: 950;
  text-transform: uppercase;
  margin-right: 4px;
}
.reminder-audit-reason {
  margin-top: 7px;
  border-left: 3px solid var(--amber);
  padding-left: 8px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.35;
}
.reminder-meta {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
}
.reminder-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.reminder-badge {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}
.reminder-badge.is-red { color: var(--red); background: var(--red-bg); }
.reminder-badge.is-amber { color: var(--amber); background: var(--amber-bg); }
.reminder-badge.is-blue { color: var(--blue); background: var(--blue-bg); }
.reminder-badge.is-green { color: var(--green); background: var(--green-bg); }

@media (max-width: 700px) {
  .reminders-toolbar,
  .reminder-card {
    align-items: stretch;
  }
  .reminders-toolbar {
    flex-direction: column;
  }
  .reminders-toolbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .reminders-toolbar .btn {
    width: 100%;
    justify-content: center;
  }
  .reminders-counts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .reminder-count-pill {
    min-height: 86px;
    padding: 11px;
  }
  .reminder-control-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .reminder-search {
    width: 100%;
  }
  .reminder-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }
  .reminder-audit-grid span {
    flex: 1 1 150px;
  }
  .reminder-icon {
    width: 42px;
    height: 42px;
  }
  .reminder-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

/* SLS 11:2023 Standard Pages */
.sls-std-shell {
  display: grid;
  gap: 14px;
}
.sls-std-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.sls-std-kicker {
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sls-std-head h1 {
  margin-top: 4px;
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text-primary);
}
.sls-std-head p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}
.sls-std-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.sls-std-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.sls-std-tools input {
  flex: 1;
  min-width: 260px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 800;
  outline: none;
}
.sls-std-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.sls-std-pills button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
}
.sls-std-pills button.active {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}
.sls-std-pills span {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.22);
}
.sls-std-search-meta {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 800;
}
.sls-std-search-meta b {
  color: var(--text-primary);
}
.sls-std-search-meta button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}
.sls-std-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.sls-std-summary div {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.sls-std-summary strong {
  display: block;
  color: var(--text-primary);
  font-size: 1.25rem;
  line-height: 1;
}
.sls-std-summary span {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}
.sls-std-list {
  display: grid;
  gap: 10px;
}
.sls-std-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.sls-std-card.readable {
  grid-template-columns: 82px minmax(0, 980px);
  justify-content: center;
  align-items: flex-start;
}
.sls-std-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 128px;
  border-radius: 10px;
  background: var(--blue-bg);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
}
.sls-std-page span {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
}
.sls-std-page strong {
  margin-top: 3px;
  font-size: 1.35rem;
  line-height: 1;
}
.sls-std-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.sls-std-clause {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}
.sls-std-card h3 {
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 0.96rem;
  font-weight: 900;
}
.sls-std-card-top > span {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
}
.sls-std-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.sls-std-card-actions span {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
}
.sls-std-card-actions button {
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
}
.sls-std-card p {
  margin-top: 7px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.4;
}
.sls-std-page-image {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
  cursor: zoom-in;
}
.sls-std-page-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  background: #fff;
}
.sls-std-fulltext {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.sls-std-fulltext mark {
  padding: 1px 3px;
  border-radius: 4px;
  background: rgba(245,197,24,0.32);
  color: var(--text-primary);
}
.sls-std-search-hit {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 174, 0, 0.32);
  border-radius: 10px;
  background: rgba(255, 248, 214, 0.78);
  color: var(--text-secondary);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.84rem;
  line-height: 1.5;
}
.sls-std-search-hit b {
  color: var(--text-primary);
  font-family: inherit;
}
.sls-std-search-hit mark {
  padding: 1px 3px;
  border-radius: 4px;
  background: rgba(245,197,24,0.42);
  color: var(--text-primary);
}
.sls-std-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.sls-std-checks span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 800;
}
.sls-std-erp {
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--green-bg);
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
}
.sls-std-empty {
  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-muted);
  text-align: center;
  font-weight: 800;
}
.sls-std-viewer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.82);
}
.sls-std-viewer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  color: var(--text-primary);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.24);
}
.sls-std-viewer-bar button {
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 900;
  cursor: pointer;
}
.sls-std-viewer img {
  display: block;
  max-width: min(980px, 100%);
  max-height: calc(100vh - 78px);
  margin: 0 auto;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.32);
}

@media (max-width: 700px) {
  .sls-std-head {
    flex-direction: column;
  }
  .sls-std-actions,
  .sls-std-actions .btn {
    width: 100%;
  }
  .sls-std-summary {
    grid-template-columns: 1fr;
  }
  .sls-std-card {
    grid-template-columns: 1fr;
  }
  .sls-std-page {
    min-height: 42px;
    justify-content: flex-start;
    align-items: flex-start;
    padding-left: 12px;
  }
  .sls-std-page strong {
    font-size: 1rem;
  }
  .sls-std-card-top,
  .sls-std-card-actions {
    align-items: flex-start;
    justify-content: flex-start;
  }
  .sls-std-card-top {
    flex-direction: column;
  }
  .sls-std-fulltext {
    font-size: 0.84rem;
    padding: 12px;
  }
  .sls-std-page-image {
    padding: 6px;
    border-radius: 10px;
  }
  .sls-std-viewer {
    padding: 8px;
  }
  .sls-std-viewer-bar {
    border-radius: 10px;
  }
}

/* Setup Center */
.setup-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 14px 18px 36px;
}
.setup-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.04);
}
.setup-kicker {
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 5px;
}
.setup-hero h1 {
  margin: 0;
  font-size: 1.55rem;
  color: var(--text-primary);
}
.setup-hero p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 700;
}
.setup-scope-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.setup-scope-pills span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.66rem;
  font-weight: 850;
}
.setup-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.setup-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.setup-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.setup-stat:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}
.setup-stat span,
.setup-row-main span,
.setup-row-main small {
  display: block;
  color: var(--text-muted);
}
.setup-stat span {
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}
.setup-stat b {
  display: block;
  margin-top: 5px;
  font-size: 1.35rem;
  color: #2563eb;
}
.setup-stat em {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
}
.setup-toolbar {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 360px);
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
}
.setup-health {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 16px;
  margin: 0 0 12px;
  background: var(--bg-card);
}
.setup-health.needs-work {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.06);
}
.setup-health.ok {
  border-color: rgba(34, 197, 94, 0.30);
  background: rgba(34, 197, 94, 0.06);
}
.setup-health b {
  display: block;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.setup-health span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
}
.setup-health-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}
.setup-health-actions button {
  border: 1px solid rgba(245, 158, 11, 0.38);
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--bg-card);
  color: #b77900;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}
.setup-health-actions em {
  color: var(--text-muted);
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 800;
}
.setup-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.setup-tabs button,
.setup-search,
.setup-panel,
.setup-row,
.setup-empty,
.setup-next-list div {
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.setup-tabs button {
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  color: var(--text-primary);
}
.setup-tabs button.active {
  border-color: var(--accent);
  background: rgba(245, 197, 24, 0.10);
  box-shadow: inset 3px 0 0 var(--accent);
}
.setup-tabs span {
  display: block;
  font-size: 0.86rem;
  font-weight: 900;
}
.setup-tabs small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
}
.setup-search {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 0 15px;
}
.setup-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.84rem;
}
.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 12px;
  align-items: start;
}
.setup-panel {
  border-radius: 14px;
  padding: 14px;
  overflow: hidden;
}
.setup-panel-wide {
  grid-row: span 2;
}
.setup-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.setup-panel-head h2 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
}
.setup-panel-head p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
}
.setup-panel-head > span,
.setup-panel-head button,
.setup-head-actions button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}
.setup-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.setup-compact-form,
.setup-stack-form {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 12px;
  gap: 8px;
}
.setup-compact-form {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.9fr 0.9fr 0.8fr auto;
}
.setup-stack-form {
  display: grid;
  grid-template-columns: 1fr;
}
.setup-company-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 8px;
  align-items: end;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 12px;
}
.setup-company-form label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}
.setup-compact-form input,
.setup-stack-form input,
.setup-stack-form select,
.setup-company-form input {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 10px;
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.78rem;
}
.setup-compact-form button,
.setup-stack-form button,
.setup-company-form button {
  border: 0;
  border-radius: 9px;
  padding: 9px 13px;
  background: var(--accent);
  color: #1a1a00;
  font-weight: 900;
  cursor: pointer;
}
.setup-list {
  display: grid;
  gap: 8px;
}
.setup-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-radius: 12px;
  padding: 11px;
}
.setup-row.muted {
  opacity: 0.62;
}
.setup-row-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(59, 130, 246, 0.10);
  font-size: 1.15rem;
}
.setup-code-icon {
  font-weight: 900;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #2563eb;
}
.setup-row-main {
  min-width: 0;
}
.setup-row-main b {
  display: block;
  color: var(--text-primary);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setup-row-main span {
  font-size: 0.74rem;
  font-weight: 700;
  margin-top: 2px;
}
.setup-row-main small {
  font-size: 0.68rem;
  font-weight: 800;
  margin-top: 4px;
  color: #2563eb;
}
.setup-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.setup-row-actions button {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 900;
  cursor: pointer;
}
.setup-inline-select {
  max-width: 220px;
  min-width: 170px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 9px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 800;
}
.setup-cat-editor {
  max-width: 520px;
}
.setup-cat-editor .modal-body {
  padding: 18px 22px;
}
.setup-edit-note {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.45;
}
.setup-row-actions button.danger {
  border-color: rgba(239, 68, 68, 0.30);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
}
.setup-empty {
  border-radius: 12px;
  padding: 18px;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.8rem;
  font-weight: 800;
}
.setup-next-list {
  display: grid;
  gap: 8px;
}
.setup-next-list div {
  border-radius: 12px;
  padding: 12px;
}
.setup-next-list b {
  display: block;
  color: var(--text-primary);
  font-size: 0.84rem;
}
.setup-next-list span {
  display: block;
  color: var(--text-muted);
  font-size: 0.73rem;
  font-weight: 700;
  margin-top: 2px;
}
.setup-mini-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.setup-mini-alert.ok {
  border-color: rgba(34, 197, 94, 0.30);
  background: rgba(34, 197, 94, 0.06);
}
.setup-mini-alert.warn {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.07);
}
.setup-mini-alert b {
  color: var(--text-primary);
  font-size: 0.82rem;
}
.setup-mini-alert span {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
}
.setup-item-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.setup-item-row {
  grid-template-columns: 38px minmax(0, 1fr) auto;
}
@media (max-width: 980px) {
  .setup-stats,
  .setup-toolbar,
  .setup-grid,
  .setup-compact-form,
  .setup-company-form {
    grid-template-columns: 1fr;
  }
  .setup-tabs {
    grid-template-columns: 1fr;
  }
  .setup-item-list {
    grid-template-columns: 1fr;
  }
  .setup-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .setup-row-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }
  .setup-row-actions button {
    flex: 1;
  }
  .setup-inline-select {
    max-width: none;
    min-width: 0;
    width: 100%;
  }
  .setup-hero {
    align-items: flex-start;
    flex-direction: column;
  }
  .setup-health {
    align-items: flex-start;
    flex-direction: column;
  }
  .setup-health-actions {
    width: 100%;
    justify-content: stretch;
  }
  .setup-health-actions button {
    flex: 1;
  }
}

/* Setup Center minimal density pass */
.setup-shell {
  max-width: 1180px;
  padding: 10px 14px 28px;
}
.setup-hero {
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: none;
}
.setup-kicker {
  color: var(--text-muted);
  font-size: 0.64rem;
  letter-spacing: 0.07em;
  margin-bottom: 2px;
}
.setup-hero h1 {
  font-size: 1.25rem;
  line-height: 1.15;
}
.setup-hero p {
  margin-top: 3px;
  font-size: 0.76rem;
}
.setup-scope-pills {
  gap: 4px;
  margin-top: 7px;
}
.setup-scope-pills span {
  min-height: 20px;
  padding: 0 7px;
  font-size: 0.59rem;
}
.setup-hero-actions .btn {
  border-radius: 8px;
  min-height: 0;
  padding: 8px 12px;
  font-size: 0.74rem;
}
.setup-stats {
  gap: 8px;
  margin: 8px 0;
}
.setup-stat {
  border-radius: 9px;
  padding: 9px 11px;
  box-shadow: none;
}
.setup-stat:hover {
  transform: none;
  box-shadow: none;
}
.setup-stat span {
  font-size: 0.62rem;
}
.setup-stat b {
  margin-top: 2px;
  font-size: 1.05rem;
}
.setup-stat em {
  margin-top: 1px;
  font-size: 0.64rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setup-health {
  border-radius: 9px;
  padding: 9px 11px;
  margin-bottom: 8px;
}
.setup-health b {
  font-size: 0.82rem;
}
.setup-health span {
  font-size: 0.68rem;
}
.setup-health-actions button {
  padding: 5px 9px;
  font-size: 0.66rem;
}
.setup-toolbar {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 310px);
  gap: 8px;
  margin-bottom: 10px;
}
.setup-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.setup-tabs button {
  flex: 0 0 auto;
  min-width: 0;
  border-radius: 999px;
  padding: 8px 11px;
}
.setup-tabs button.active {
  box-shadow: none;
  background: var(--accent);
  color: #1a1a00;
}
.setup-tabs span {
  font-size: 0.74rem;
}
.setup-tabs small {
  display: none;
}
.setup-search {
  min-height: 38px;
  border-radius: 10px;
  padding: 0 12px;
}
.setup-search input {
  font-size: 0.76rem;
}
.setup-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 10px;
}
.setup-items-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 10px;
  align-items: start;
}
.setup-items-side {
  display: grid;
  gap: 10px;
}
.setup-panel {
  border-radius: 10px;
  padding: 12px;
  box-shadow: none;
}
.setup-panel-head {
  align-items: center;
  margin-bottom: 9px;
}
.setup-panel-head h2 {
  font-size: 0.92rem;
}
.setup-panel-head p {
  margin-top: 1px;
  font-size: 0.68rem;
}
.setup-panel-head > span,
.setup-panel-head button,
.setup-head-actions button {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.64rem;
}
.setup-compact-form,
.setup-stack-form,
.setup-company-form {
  border-radius: 9px;
  padding: 8px;
  gap: 6px;
  margin-bottom: 9px;
}
.setup-category-add {
  display: grid;
  grid-template-columns: 116px minmax(140px, 1fr) minmax(150px, 220px) 76px;
  gap: 6px;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-elevated);
}
.setup-compact-form input,
.setup-stack-form input,
.setup-stack-form select,
.setup-company-form input,
.setup-category-add input,
.setup-category-add select,
.setup-inline-select {
  border-radius: 7px;
  padding: 7px 8px;
  font-size: 0.72rem;
}
.setup-compact-form button,
.setup-stack-form button,
.setup-company-form button,
.setup-category-add button {
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 0.72rem;
}
.setup-category-add input,
.setup-category-add select {
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
}
.setup-category-add button {
  min-width: 76px;
  border: 0;
  background: var(--accent);
  color: #1a1a00;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}
.setup-category-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}
.setup-category-guide div {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  background: var(--bg-elevated);
}
.setup-category-guide b,
.setup-category-guide span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setup-category-guide b {
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1;
}
.setup-category-guide span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
}
.setup-category-guide .warn {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.08);
}
.setup-category-guide .ok {
  border-color: rgba(34, 197, 94, 0.30);
  background: rgba(34, 197, 94, 0.08);
}
.setup-category-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.setup-category-controls button,
.setup-category-controls select {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--bg-card);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 900;
}
.setup-category-controls button.active {
  border-color: var(--accent);
  background: rgba(245, 197, 24, 0.16);
}
.setup-category-controls b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--bg-elevated);
}
.setup-category-controls select {
  min-width: 180px;
}
.setup-category-table {
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  background: var(--bg-card);
}
.setup-category-head,
.setup-category-line {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) 90px minmax(160px, 1fr) 64px auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
}
.setup-category-head {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}
.setup-category-line {
  border-top: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 800;
}
.setup-category-line .muted {
  color: var(--text-muted);
}
.setup-category-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.setup-category-name > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.10);
}
.setup-category-name b,
.setup-category-name small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setup-category-name small {
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 0.62rem;
}
.setup-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-style: normal;
  font-size: 0.64rem;
  font-weight: 900;
}
.setup-category-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}
.setup-category-actions button {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.64rem;
  font-weight: 900;
  cursor: pointer;
}
.setup-category-actions button.danger {
  border-color: rgba(239, 68, 68, 0.30);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
}
.setup-list,
.setup-next-list {
  gap: 6px;
}
.setup-row {
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 8px;
  border-radius: 8px;
  padding: 8px;
}
.setup-row-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 0.95rem;
}
.setup-row-main b {
  font-size: 0.8rem;
}
.setup-row-main span {
  margin-top: 1px;
  font-size: 0.68rem;
}
.setup-row-main small {
  margin-top: 2px;
  font-size: 0.64rem;
}
.setup-row-actions {
  gap: 5px;
}
.setup-row-actions button {
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 0.64rem;
}
.setup-inline-select {
  min-width: 145px;
  max-width: 170px;
}
.setup-category-row {
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
}
.setup-category-row .setup-row-main {
  padding-top: 1px;
}
.setup-category-row .setup-row-main b,
.setup-category-row .setup-row-main span,
.setup-category-row .setup-row-main small {
  white-space: normal;
  overflow: visible;
}
.setup-category-row .setup-row-actions {
  grid-column: auto;
  display: flex;
  width: auto;
  justify-content: flex-end;
}
.setup-empty {
  border-radius: 8px;
  padding: 12px;
  font-size: 0.72rem;
}
.setup-next-list div {
  border-radius: 8px;
  padding: 9px;
}
.setup-next-list b {
  font-size: 0.76rem;
}
.setup-next-list span {
  font-size: 0.66rem;
}
.setup-mini-alert {
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.setup-mini-alert b {
  font-size: 0.76rem;
}
.setup-mini-alert span {
  font-size: 0.66rem;
}
.setup-check-list,
.setup-item-shortcuts {
  display: grid;
  gap: 7px;
}
.setup-check-row,
.setup-item-shortcuts button {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 10px;
  background: var(--bg-card);
}
.setup-check-row b,
.setup-check-row span,
.setup-item-shortcuts b,
.setup-item-shortcuts span,
.setup-item-shortcuts small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setup-check-row b {
  color: var(--text-primary);
  font-size: 0.76rem;
}
.setup-check-row span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 800;
}
.setup-check-row.warn {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.08);
}
.setup-check-row.ok {
  border-color: rgba(34, 197, 94, 0.26);
  background: rgba(34, 197, 94, 0.07);
}
.setup-item-shortcuts button {
  text-align: left;
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
}
.setup-item-shortcuts button:hover {
  border-color: rgba(59, 130, 246, 0.36);
  background: rgba(59, 130, 246, 0.06);
}
.setup-item-shortcuts button.warn {
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.08);
}
.setup-item-shortcuts b {
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
}
.setup-item-shortcuts span {
  margin-top: 3px;
  font-size: 0.76rem;
  font-weight: 900;
}
.setup-item-shortcuts small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 800;
}
.setup-item-list {
  gap: 6px;
}
.setup-item-row {
  grid-template-columns: 32px minmax(0, 1fr) auto;
}
.setup-finance-category-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 10px;
  align-items: start;
}
.setup-finance-category-layout > .setup-panel-wide:last-child {
  grid-column: 1 / -1;
}
.setup-finance-category-form {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px;
  background: var(--bg-elevated);
}
.setup-fin-type-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.setup-fin-type-strip button,
.setup-fin-actions button {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 7px 10px;
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}
.setup-fin-type-strip button.active {
  border-color: var(--accent);
  background: rgba(245, 197, 24, 0.17);
}
.setup-fin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.setup-fin-form-grid label {
  min-width: 0;
}
.setup-fin-form-grid label > span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.61rem;
  font-weight: 950;
  text-transform: uppercase;
}
.setup-fin-form-grid input,
.setup-fin-form-grid select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 8px 9px;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 850;
  box-sizing: border-box;
}
.setup-fin-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  padding: 7px 9px;
}
.setup-fin-check input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
}
.setup-fin-check span {
  margin: 0;
  text-transform: none;
  white-space: normal;
}
.setup-fin-form-grid .span-2,
.setup-fin-warning.span-2 {
  grid-column: 1 / -1;
}
.setup-fin-warning {
  border: 1px solid rgba(245, 158, 11, 0.30);
  border-radius: 9px;
  background: rgba(245, 158, 11, 0.08);
  color: #9a6700;
  padding: 8px 10px;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.35;
}
.setup-fin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}
.setup-fin-actions button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #1a1a00;
}
.setup-fin-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.setup-fin-preview-grid div {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-elevated);
  padding: 8px 9px;
}
.setup-fin-preview-grid span,
.setup-fin-preview-grid b {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.setup-fin-preview-grid span {
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 950;
  text-transform: uppercase;
}
.setup-fin-preview-grid b {
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 950;
}
.setup-fin-category-table .setup-category-head,
.setup-fin-category-table .setup-category-line {
  grid-template-columns: minmax(210px, 1.15fr) 120px minmax(180px, 0.85fr) minmax(150px, 0.75fr) auto;
}
.setup-fin-behavior-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.setup-fin-behavior-mini span {
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 2px 7px;
  color: var(--text-secondary);
  font-size: 0.58rem;
  font-weight: 950;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .setup-shell {
    padding: 8px 10px 22px;
  }
  .setup-hero,
  .setup-health {
    align-items: stretch;
  }
  .setup-toolbar,
  .setup-grid,
  .setup-items-layout,
  .setup-finance-category-layout {
    grid-template-columns: 1fr;
  }
  .setup-fin-form-grid,
  .setup-fin-preview-grid {
    grid-template-columns: 1fr;
  }
  .setup-finance-category-layout > .setup-panel-wide:last-child {
    grid-column: auto;
  }
  .setup-category-add {
    grid-template-columns: 1fr;
  }
  .setup-category-guide {
    grid-template-columns: 1fr;
  }
  .setup-category-head {
    display: none;
  }
  .setup-category-line {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px;
  }
  .setup-category-actions {
    justify-content: stretch;
  }
  .setup-category-actions button {
    flex: 1;
  }
  .setup-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .setup-tabs {
    padding-bottom: 2px;
  }
  .setup-row {
    grid-template-columns: 32px minmax(0, 1fr);
  }
  .setup-row-actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }
  .setup-row-actions button,
  .setup-row-actions select {
    flex: 1;
  }
  .setup-category-row .setup-row-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: stretch;
  }
}

/* Cheque Management */
.chq-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.chq-page-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 900;
}
.chq-page-head h2 svg {
  color: var(--accent);
}
.chq-page-head div div {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
}
.chq-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.chq-summary-main {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}
.chq-summary-main strong {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 900;
}
.chq-summary-main span:not(:last-child)::after {
  content: "·";
  margin-left: 5px;
  color: var(--text-muted);
}
.chq-summary-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}
.chq-priority-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}
.chq-priority-chip b {
  color: var(--text-primary);
}
.chq-priority-chip em,
.chq-priority-chip small {
  font-style: normal;
}
.chq-priority-chip small {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 800;
}
.chq-priority-chip.green { border-color: rgba(34,197,94,0.26); background: rgba(34,197,94,0.06); color: #16a34a; }
.chq-priority-chip.amber { border-color: rgba(245,158,11,0.28); background: rgba(245,158,11,0.06); color: #b45309; }
.chq-priority-chip.red { border-color: rgba(239,68,68,0.24); background: rgba(239,68,68,0.05); color: #ef4444; }
.chq-priority-chip.violet { border-color: rgba(139,92,246,0.24); background: rgba(139,92,246,0.05); color: #7c3aed; }
.chq-all-clear {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 900;
}
.chq-add-bank-modal {
  max-width: 440px;
}
.chq-add-bank-modal .form-actions {
  padding: 12px 16px 16px;
}
.chq-add-bank-note {
  margin-top: 2px;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(59,130,246,0.08);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4;
}
.chq-form-note {
  margin-top: 7px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(59,130,246,0.07);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
}
.chq-command {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--bg-card), color-mix(in srgb, var(--accent) 5%, var(--bg-card)));
  box-shadow: var(--shadow-card);
}
.chq-command-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.chq-command-title {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 900;
}
.chq-command-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}
.chq-lite-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
}
.chq-lite-btn.primary {
  border-color: rgba(245, 197, 24, 0.55);
  background: var(--accent);
  color: #161616;
}
.chq-priority-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.chq-priority {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  text-align: left;
  cursor: pointer;
}
.chq-priority span,
.chq-priority b,
.chq-priority em,
.chq-priority small {
  display: block;
}
.chq-priority span {
  font-size: 1rem;
}
.chq-priority b {
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 1.05rem;
  line-height: 1;
}
.chq-priority em {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chq-priority small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 800;
}
.chq-priority.green { border-color: rgba(34,197,94,0.28); background: rgba(34,197,94,0.07); }
.chq-priority.amber { border-color: rgba(245,158,11,0.30); background: rgba(245,158,11,0.07); }
.chq-priority.red { border-color: rgba(239,68,68,0.26); background: rgba(239,68,68,0.06); }
.chq-priority.blue { border-color: rgba(59,130,246,0.26); background: rgba(59,130,246,0.06); }
.chq-priority.violet { border-color: rgba(139,92,246,0.26); background: rgba(139,92,246,0.06); }
.chq-search-wrap {
  margin-bottom: 10px;
}
.chq-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}
.chq-search-box svg {
  color: var(--text-muted);
  flex: 0 0 auto;
}
.chq-search-box.active {
  border-color: var(--accent);
}
.chq-search-clear {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
}
.chq-search-note {
  margin-top: 5px;
  padding-left: 6px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
}
.chq-global-search-panel {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 12px;
  background: color-mix(in srgb, #3b82f6 5%, var(--bg-card));
}
.chq-global-search-head,
.chq-global-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chq-global-search-head {
  justify-content: space-between;
  margin-bottom: 8px;
}
.chq-global-search-head strong,
.chq-global-search-head span {
  display: block;
}
.chq-global-search-head strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
}
.chq-global-search-head span,
.chq-global-search-more,
.chq-global-search-empty {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.chq-global-search-head button,
.chq-global-search-row button {
  min-height: 32px;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 9px;
  background: rgba(37, 99, 235, 0.08);
  color: #2563eb;
  padding: 0 11px;
  font-size: 0.68rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.chq-global-search-list {
  display: grid;
  gap: 6px;
}
.chq-global-search-row {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}
.chq-global-search-row.archive {
  border-color: rgba(100, 116, 139, 0.28);
  background: color-mix(in srgb, #64748b 7%, var(--bg-elevated));
}
.chq-global-search-main {
  min-width: 0;
  flex: 1;
}
.chq-global-search-main b,
.chq-global-search-main span,
.chq-global-search-main small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chq-global-search-main b {
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 950;
}
.chq-global-search-main span {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 850;
}
.chq-global-search-main small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 800;
}
.chq-global-search-money {
  min-width: 104px;
  text-align: right;
}
.chq-global-search-money strong,
.chq-global-search-money span {
  display: block;
}
.chq-global-search-money strong {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 950;
}
.chq-global-search-money span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 850;
}
.chq-global-search-more,
.chq-global-search-empty {
  padding: 9px 2px 2px;
  text-align: center;
}
.chq-archive-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(100, 116, 139, 0.24);
  border-radius: 12px;
  background: color-mix(in srgb, #64748b 7%, var(--bg-card));
}
.chq-archive-hero strong,
.chq-archive-hero span {
  display: block;
}
.chq-archive-hero strong {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.chq-archive-hero span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.chq-archive-hero button,
.chq-archive-meta button,
.chq-old-modal-foot button {
  min-height: 34px;
  border: 1px solid rgba(100, 116, 139, 0.28);
  border-radius: 9px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 12px;
  font-size: 0.68rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.chq-archive-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.chq-archive-kpis div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.chq-archive-kpis span,
.chq-archive-tools span,
.chq-archive-meta span,
.chq-old-detail-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}
.chq-archive-kpis b {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.chq-archive-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.chq-archive-tools select {
  min-height: 38px;
  min-width: 180px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 12px;
  font-size: 0.74rem;
  font-weight: 900;
}
.chq-archive-tools span {
  text-transform: none;
  letter-spacing: 0;
}
.chq-archive-list {
  display: grid;
  gap: 8px;
}
.chq-archive-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-left: 4px solid #64748b;
  border-radius: 12px;
  background: var(--bg-card);
}
.chq-archive-main {
  min-width: 0;
}
.chq-archive-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.chq-archive-title b {
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.chq-archive-title span {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 950;
}
.chq-archive-main strong,
.chq-archive-main small,
.chq-archive-main em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chq-archive-main strong {
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 900;
}
.chq-archive-main small,
.chq-archive-main em {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
}
.chq-archive-meta {
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: 118px;
}
.chq-archive-meta span {
  text-transform: none;
  letter-spacing: 0;
}
.chq-recon-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 13px 14px;
  border: 1px solid rgba(20, 184, 166, 0.26);
  border-left: 4px solid #14b8a6;
  border-radius: 12px;
  background: color-mix(in srgb, #14b8a6 7%, var(--bg-card));
}
.chq-recon-hero strong,
.chq-recon-hero span {
  display: block;
}
.chq-recon-hero strong {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 950;
}
.chq-recon-hero span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
}
.chq-recon-type,
.chq-recon-filters {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.chq-recon-type button,
.chq-recon-filters button {
  min-height: 34px;
  border: 1px solid rgba(100, 116, 139, 0.28);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 0 12px;
  font-size: 0.68rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.chq-recon-type button.active,
.chq-recon-filters button.active {
  border-color: #0f172a;
  background: #0f172a;
  color: #fff;
}
.chq-recon-filters {
  margin-bottom: 10px;
}
.chq-return-status-tabs {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin: 2px 0 12px;
}
.chq-return-status-tabs button {
  min-height: 34px;
  border: 1px solid rgba(100, 116, 139, 0.28);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 0 12px;
  font-size: 0.68rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.chq-return-status-tabs button.active {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.chq-return-status-tabs button.return-partial.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.13);
  color: #b45309;
}
.chq-return-status-tabs button.return-fullrecovered.active {
  border-color: #16a34a;
  background: rgba(34, 197, 94, 0.13);
  color: #16a34a;
}
.chq-return-status-tabs button.return-writtenoff.active,
.chq-return-status-tabs button.return-all.active {
  border-color: #64748b;
  background: rgba(100, 116, 139, 0.13);
  color: #64748b;
}
.chq-return-status-tabs span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: inherit;
  font-size: 0.64rem;
}
.chq-recon-filters span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: inherit;
  font-size: 0.64rem;
}
.chq-recon-kpis {
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
}
.chq-recon-list {
  display: grid;
  gap: 9px;
}
.chq-recon-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid #f59e0b;
  border-radius: 12px;
  background: var(--bg-card);
}
.chq-recon-row.green { border-left-color: #16a34a; }
.chq-recon-row.teal { border-left-color: #14b8a6; }
.chq-recon-row.red { border-left-color: #ef4444; }
.chq-recon-row.blue { border-left-color: #2563eb; }
.chq-recon-row.muted { border-left-color: #64748b; }
.chq-recon-main {
  min-width: 0;
}
.chq-recon-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.chq-recon-title b {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 950;
}
.chq-recon-title span {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 950;
}
.chq-recon-title em {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 950;
}
.chq-recon-title em.green,
.chq-recon-chips .ok {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}
.chq-recon-title em.teal {
  background: rgba(20, 184, 166, 0.13);
  color: #0f766e;
}
.chq-recon-title em.red,
.chq-recon-chips .danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.chq-recon-title em.blue {
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}
.chq-recon-title em.amber {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}
.chq-recon-title em.muted {
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
}
.chq-recon-main strong,
.chq-recon-main small,
.chq-recon-main p {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chq-recon-main strong {
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 950;
}
.chq-recon-main small,
.chq-recon-main p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.69rem;
  font-weight: 800;
}
.chq-recon-chips {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 7px;
}
.chq-recon-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-secondary);
  padding: 0 8px;
  font-size: 0.63rem;
  font-weight: 950;
}
.chq-recon-chips .type.old {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
}
.chq-recon-chips .type.return {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}
.chq-recon-chips .source {
  background: rgba(20, 184, 166, 0.12);
  color: #0f766e;
}
.chq-recon-live-match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  border: 1px solid rgba(20, 184, 166, 0.22);
  border-radius: 10px;
  background: rgba(20, 184, 166, 0.07);
  padding: 8px 10px;
}
.chq-recon-live-match.diff {
  border-color: rgba(245, 158, 11, 0.26);
  background: rgba(245, 158, 11, 0.07);
}
.chq-recon-live-match span,
.chq-recon-live-match b,
.chq-recon-live-match small {
  display: block;
  min-width: 0;
}
.chq-recon-live-match span {
  color: #0f766e;
  font-size: 0.59rem;
  font-weight: 950;
  text-transform: uppercase;
}
.chq-recon-live-match.diff span {
  color: #b45309;
}
.chq-recon-live-match b {
  margin-top: 2px;
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 950;
}
.chq-recon-live-match small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 800;
}
.chq-recon-live-match em {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.14);
  color: #0f766e;
  padding: 0 9px;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 950;
  white-space: nowrap;
}
.chq-recon-live-match.diff em {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}
.chq-recon-trace {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-top: 2px;
}
.chq-recon-trace section {
  min-width: 0;
  border: 1px solid rgba(100, 116, 139, 0.18);
  border-radius: 9px;
  background: color-mix(in srgb, #64748b 6%, var(--bg-card));
  padding: 8px 9px;
}
.chq-recon-trace section.ok {
  border-color: rgba(34, 197, 94, 0.22);
  background: rgba(34, 197, 94, 0.07);
}
.chq-recon-trace section.warn {
  border-color: rgba(245, 158, 11, 0.24);
  background: rgba(245, 158, 11, 0.08);
}
.chq-recon-trace section.danger {
  border-color: rgba(239, 68, 68, 0.23);
  background: rgba(239, 68, 68, 0.07);
}
.chq-recon-trace section.bank {
  border-color: rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.07);
}
.chq-recon-trace label,
.chq-recon-trace strong,
.chq-recon-trace span,
.chq-recon-trace small {
  display: block;
  min-width: 0;
}
.chq-recon-trace label {
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 950;
  text-transform: uppercase;
}
.chq-recon-trace strong {
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.68rem;
  font-weight: 950;
}
.chq-recon-trace span,
.chq-recon-trace small {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: none;
  white-space: normal;
}
.chq-recon-trace small {
  color: var(--text-muted);
}
.chq-recon-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 6px;
  width: min(680px, 100%);
  margin-left: auto;
}
.chq-recon-quick-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid rgba(100, 116, 139, 0.28);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 12px;
  font-size: 0.7rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.chq-recon-quick-actions .clarify {
  border-color: #0f172a;
  background: #fff;
  color: #0f172a;
}
.chq-recon-quick-actions .timeline {
  border-color: rgba(99, 102, 241, 0.28);
  background: rgba(99, 102, 241, 0.09);
  color: #6366f1;
}
.chq-recon-quick-actions .factor {
  border-color: rgba(14, 165, 233, 0.28);
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
}
.chq-recon-quick-actions .deposit {
  border-color: rgba(59, 130, 246, 0.28);
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}
.chq-recon-quick-actions .bounce {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.chq-recon-quick-actions .supplier {
  border-color: rgba(168, 85, 247, 0.28);
  background: rgba(168, 85, 247, 0.1);
  color: #a855f7;
}
.chq-recon-related {
  width: 100%;
  margin-top: 8px;
  border: 1px solid rgba(100, 116, 139, 0.18);
  border-radius: 10px;
  background: color-mix(in srgb, #64748b 5%, var(--bg-card));
  padding: 8px;
}
.chq-recon-related-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}
.chq-recon-related-head b {
  color: var(--text-primary);
  font-size: 0.68rem;
  font-weight: 950;
}
.chq-recon-related-head span {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 850;
}
.chq-recon-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 7px;
}
.chq-recon-related section {
  min-width: 0;
  border: 1px solid rgba(100, 116, 139, 0.18);
  border-left: 3px solid #64748b;
  border-radius: 9px;
  background: var(--bg-elevated);
  padding: 8px 9px;
}
.chq-recon-related section.old { border-left-color: #64748b; }
.chq-recon-related section.return,
.chq-recon-related section.bounced {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.045);
}
.chq-recon-related section.live {
  border-left-color: #14b8a6;
  background: rgba(20, 184, 166, 0.045);
}
.chq-recon-related label,
.chq-recon-related strong,
.chq-recon-related span,
.chq-recon-related small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chq-recon-related label {
  color: var(--text-muted);
  font-size: 0.56rem;
  font-weight: 950;
  text-transform: uppercase;
}
.chq-recon-related strong {
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.68rem;
  font-weight: 950;
}
.chq-recon-related span,
.chq-recon-related small {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 0.61rem;
  font-weight: 800;
}
.chq-recon-related small {
  color: var(--text-muted);
}
.chq-recon-related button {
  width: 100%;
  min-height: 28px;
  margin-top: 7px;
  border: 1px solid rgba(100, 116, 139, 0.22);
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-card));
  color: var(--text-primary);
  font-size: 0.62rem;
  font-weight: 950;
  cursor: pointer;
}
.chq-recon-actions {
  display: grid;
  gap: 5px;
  min-width: 124px;
}
.chq-recon-actions button,
.chq-recon-modal-foot button {
  min-height: 34px;
  border: 1px solid rgba(100, 116, 139, 0.28);
  border-radius: 9px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 12px;
  font-size: 0.68rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.chq-recon-actions button.primary,
.chq-recon-modal-foot button.primary {
  border-color: #0f172a;
  background: #0f172a;
  color: #fff;
}
.chq-recon-modal {
  width: min(820px, calc(100vw - 28px));
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
}
.chq-recon-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
}
.chq-recon-modal-head span,
.chq-recon-modal-head p {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 850;
}
.chq-recon-modal-head h3 {
  margin: 4px 0 2px;
  color: var(--text-primary);
  font-size: 1.08rem;
  font-weight: 950;
}
.chq-recon-modal-head button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
}
.chq-recon-modal-body {
  overflow-y: auto;
  padding: 14px 16px;
}
.chq-recon-summary,
.chq-recon-suggest-grid,
.chq-recon-form {
  display: grid;
  gap: 8px;
}
.chq-recon-summary {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  margin-bottom: 10px;
}
.chq-recon-summary div,
.chq-recon-suggest-grid div {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  padding: 10px;
}
.chq-recon-summary span,
.chq-recon-suggest-grid span,
.chq-recon-form span {
  display: block;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}
.chq-recon-summary b {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 950;
}
.chq-recon-warning {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.08);
  color: #b45309;
  padding: 9px 11px;
  font-size: 0.72rem;
  font-weight: 900;
}
.chq-recon-suggest-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
}
.chq-recon-suggest-grid b,
.chq-recon-suggest-grid em {
  display: block;
  margin-top: 6px;
  color: var(--text-primary);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 900;
}
.chq-recon-suggest-grid small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 800;
}
.chq-recon-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.chq-recon-form label {
  display: grid;
  gap: 5px;
}
.chq-recon-form label.wide {
  grid-column: 1 / -1;
}
.chq-recon-form input,
.chq-recon-form select,
.chq-recon-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 9px 10px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
}
.chq-recon-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.chq-old-modal {
  width: min(760px, calc(100vw - 28px));
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
}
.chq-old-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.chq-old-modal-head span,
.chq-old-modal-head p {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 850;
}
.chq-old-modal-head h3 {
  margin: 3px 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 950;
}
.chq-old-modal-head button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}
.chq-old-modal-body {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding: 14px 16px;
}
.chq-old-story {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.chq-old-story div {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(34, 197, 94, 0.22);
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.07);
}
.chq-old-story span,
.chq-old-story small {
  display: block;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 850;
}
.chq-old-story b {
  display: block;
  margin: 4px 0 2px;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.chq-old-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.chq-old-detail-grid div {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-elevated);
}
.chq-old-detail-grid b {
  display: block;
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}
.chq-old-timeline {
  display: grid;
  gap: 8px;
}
.chq-old-timeline > div {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}
.chq-old-timeline > div > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
}
.chq-old-timeline b,
.chq-old-timeline small,
.chq-old-timeline p {
  display: block;
}
.chq-old-timeline b {
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
}
.chq-old-timeline small,
.chq-old-timeline p {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.chq-old-modal-foot {
  display: flex;
  justify-content: flex-end;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}
.chq-return-recovery-modal {
  width: min(560px, calc(100vw - 28px));
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
}
.chq-return-recovery-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
}
.chq-return-recovery-head h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 950;
}
.chq-return-recovery-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 850;
}
.chq-return-recovery-head button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
}
.chq-return-recovery-body {
  display: grid;
  gap: 12px;
  overflow: auto;
  padding: 10px 18px 14px;
}
.chq-return-recovery-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.chq-return-recovery-cards div {
  min-width: 0;
  padding: 13px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
}
.chq-return-recovery-cards .ok {
  border-color: rgba(34,197,94,0.24);
  background: rgba(34,197,94,0.07);
}
.chq-return-recovery-cards .danger {
  border-color: rgba(239,68,68,0.24);
  background: rgba(239,68,68,0.07);
}
.chq-return-recovery-cards span,
.chq-return-recovery-cards b {
  display: block;
}
.chq-return-recovery-cards span {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}
.chq-return-recovery-cards b {
  margin-top: 5px;
  font-size: 1.08rem;
  font-weight: 950;
}
.chq-return-recovery-cards .ok b {
  color: #16a34a;
}
.chq-return-recovery-cards .danger b {
  color: #ef4444;
}
.chq-return-recovery-progress {
  display: grid;
  gap: 6px;
}
.chq-return-recovery-progress div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 900;
}
.chq-return-recovery-progress em {
  color: #ef4444;
  font-style: normal;
}
.chq-return-recovery-progress i {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(239,68,68,0.14);
}
.chq-return-recovery-progress i b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #22c55e;
}
.chq-return-recovery-log {
  padding: 12px;
  border: 1px solid rgba(245,158,11,0.22);
  border-radius: 10px;
  background: rgba(245,158,11,0.05);
}
.chq-return-recovery-log h4 {
  margin: 0 0 8px;
  color: #92400e;
  font-size: 0.8rem;
  font-weight: 950;
}
.chq-return-recovery-log div {
  padding-top: 7px;
  border-top: 1px solid rgba(245,158,11,0.16);
}
.chq-return-recovery-log b,
.chq-return-recovery-log p {
  display: block;
  margin: 0;
}
.chq-return-recovery-log b {
  color: #16a34a;
  font-size: 0.75rem;
  font-weight: 950;
}
.chq-return-recovery-log p {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.chq-return-recovery-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.chq-return-recovery-actions button,
.chq-return-recovery-form button,
.chq-return-recovery-foot button {
  min-height: 38px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
  cursor: pointer;
}
.chq-return-recovery-actions .wide {
  grid-column: 1 / -1;
}
.chq-return-recovery-actions .amber { border-color: #f59e0b; background: rgba(245,158,11,0.07); color: #b45309; }
.chq-return-recovery-actions .green { border-color: #22c55e; background: rgba(34,197,94,0.07); color: #15803d; }
.chq-return-recovery-actions .blue { border-color: #2563eb; background: rgba(37,99,235,0.07); color: #2563eb; }
.chq-return-recovery-actions .red { border-color: #ef4444; background: rgba(239,68,68,0.07); color: #ef4444; }
.chq-return-recovery-actions .violet { border-color: #6366f1; background: rgba(99,102,241,0.07); color: #4f46e5; }
.chq-return-recovery-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}
.chq-return-recovery-form h4,
.chq-return-recovery-form .wide {
  grid-column: 1 / -1;
}
.chq-return-recovery-form h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.chq-return-recovery-form label span {
  display: block;
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}
.chq-return-recovery-form .wide:last-child {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.chq-return-recovery-form .wide:last-child button:last-child {
  border-color: #eab308;
  background: #eab308;
  color: #111827;
}
.chq-return-recovery-foot {
  padding: 10px 18px 16px;
}
.chq-return-recovery-foot button {
  width: 100%;
}
.chq-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chq-archive-pagebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 850;
}
.chq-archive-pagebar > span {
  min-width: 0;
}
.chq-archive-pagebar > div {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}
.chq-archive-pagebar button,
.chq-archive-next-actions button,
.chq-archive-row-side button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
}
.chq-archive-pagebar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.chq-archive-pagebar em {
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
}
.chq-archive-next {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.chq-archive-next.old {
  border-left: 3px solid #64748b;
}
.chq-archive-next.return {
  border-left: 3px solid #ef4444;
}
.chq-archive-next-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.chq-archive-next-head strong,
.chq-archive-next-head span {
  display: block;
}
.chq-archive-next-head strong {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 950;
}
.chq-archive-next-head span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.chq-archive-next-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chq-archive-next-actions button:first-child {
  border-color: rgba(59,130,246,0.34);
  background: rgba(59,130,246,0.09);
  color: #2563eb;
}
.chq-archive-next-actions button:nth-child(3) {
  border-color: rgba(245,158,11,0.34);
  background: rgba(245,158,11,0.08);
  color: #b45309;
}
.chq-archive-next-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-card) 78%, var(--bg-elevated));
}
.chq-archive-next-kpis div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-card);
}
.chq-archive-next-kpis span,
.chq-archive-next-kpis b {
  display: block;
}
.chq-archive-next-kpis span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.56rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.chq-archive-next-kpis b {
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
  line-height: 1.1;
}
.chq-archive-next-kpis b.ok {
  color: #16a34a;
}
.chq-archive-next-kpis b.danger {
  color: #ef4444;
}
.chq-archive-next-list {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
}
.chq-archive-next-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 146px;
  gap: 12px;
  align-items: start;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid #64748b;
  border-radius: 10px;
  background: var(--bg-card);
}
.chq-archive-next-row.return {
  border-left-color: #ef4444;
}
.chq-archive-next-row.return.partial {
  border-left-color: #f59e0b;
}
.chq-archive-next-row.return.recovered {
  border-left-color: #22c55e;
}
.chq-archive-row-main {
  min-width: 0;
}
.chq-archive-row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}
.chq-archive-row-title b {
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.chq-archive-row-title strong {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 950;
}
.chq-archive-row-title em {
  padding: 2px 7px;
  border: 1px solid rgba(245,158,11,0.28);
  border-radius: 999px;
  background: rgba(245,158,11,0.08);
  color: #b45309;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 950;
}
.chq-archive-row-main h4 {
  margin: 6px 0 0;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 950;
}
.chq-archive-row-main p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.35;
}
.chq-archive-row-extra {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.chq-archive-row-extra span,
.chq-archive-row-side span {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 950;
  white-space: nowrap;
}
.chq-archive-row-side {
  display: grid;
  gap: 6px;
  justify-items: stretch;
}
.chq-archive-row-side span {
  justify-content: center;
}
.chq-archive-row-side button.danger {
  border-color: rgba(239,68,68,0.36);
  background: rgba(239,68,68,0.08);
  color: #ef4444;
}
.chq-archive-progress {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}
.chq-archive-progress div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-weight: 900;
}
.chq-archive-progress div span:last-child {
  color: #ef4444;
}
.chq-archive-progress i {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(239,68,68,0.12);
}
.chq-archive-progress b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #22c55e;
}
.chq-archive-progress small {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 800;
}
.chq-recon-next {
  margin-bottom: 14px;
}
.chq-recon-next-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid #14b8a6;
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.chq-recon-next-hero strong,
.chq-recon-next-hero span {
  display: block;
}
.chq-recon-next-hero strong {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 950;
}
.chq-recon-next-hero span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
}
.chq-recon-type-tabs {
  display: inline-flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  flex: 0 0 auto;
}
.chq-recon-type-tabs button,
.chq-recon-filter-row button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.chq-recon-type-tabs button {
  min-height: 28px;
  padding: 0 10px;
}
.chq-recon-type-tabs button.active {
  background: rgba(20,184,166,0.13);
  color: #0f766e;
}
.chq-recon-next-kpis {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.chq-recon-next-kpis div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.chq-recon-next-kpis span,
.chq-recon-next-kpis b {
  display: block;
}
.chq-recon-next-kpis span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.55rem;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.chq-recon-next-kpis b {
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.chq-recon-next-kpis b.ok {
  color: #16a34a;
}
.chq-recon-next-kpis b.warn {
  color: #d97706;
}
.chq-recon-next-kpis b.danger {
  color: #ef4444;
}
.chq-recon-filter-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 3px;
  overflow-x: auto;
}
.chq-recon-filter-row button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.chq-recon-filter-row button.active {
  border-color: rgba(20,184,166,0.38);
  background: rgba(20,184,166,0.1);
  color: #0f766e;
}
.chq-recon-filter-row span {
  margin-left: 5px;
  color: inherit;
  opacity: 0.72;
}
.chq-recon-next-list {
  display: grid;
  gap: 8px;
}
.chq-recon-next-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid #94a3b8;
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.chq-recon-next-row.ok {
  border-left-color: #22c55e;
}
.chq-recon-next-row.warn {
  border-left-color: #f59e0b;
}
.chq-recon-next-row.danger,
.chq-recon-next-row.return.danger {
  border-left-color: #ef4444;
}
.chq-recon-row-main {
  min-width: 0;
}
.chq-recon-row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}
.chq-recon-row-title b {
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 950;
}
.chq-recon-row-title strong {
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 950;
}
.chq-recon-row-title em {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 950;
}
.chq-recon-row-title em.ok {
  background: rgba(34,197,94,0.1);
  color: #16a34a;
}
.chq-recon-row-title em.warn {
  background: rgba(245,158,11,0.1);
  color: #b45309;
}
.chq-recon-row-title em.danger {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
}
.chq-recon-row-title em.muted {
  background: var(--bg-elevated);
  color: var(--text-muted);
}
.chq-recon-row-main h4 {
  margin: 6px 0 0;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.chq-recon-row-main p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.35;
}
.chq-recon-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.chq-recon-chip-row span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.56rem;
  font-weight: 950;
}
.chq-recon-chip-row span.old {
  border-color: rgba(100,116,139,0.3);
  background: rgba(100,116,139,0.08);
  color: #64748b;
}
.chq-recon-chip-row span.return,
.chq-recon-chip-row span.danger {
  border-color: rgba(239,68,68,0.28);
  background: rgba(239,68,68,0.08);
  color: #ef4444;
}
.chq-recon-chip-row span.ok {
  border-color: rgba(34,197,94,0.28);
  background: rgba(34,197,94,0.08);
  color: #16a34a;
}
.chq-recon-linked {
  color: var(--text-secondary) !important;
}
.chq-recon-live-match {
  margin-top: 9px;
  padding: 8px 10px;
  border: 1px solid rgba(20,184,166,0.25);
  border-radius: 10px;
  background: rgba(20,184,166,0.07);
}
.chq-recon-live-match span,
.chq-recon-live-match b,
.chq-recon-live-match small {
  display: block;
}
.chq-recon-live-match span {
  color: #0f766e;
  font-size: 0.56rem;
  font-weight: 950;
  text-transform: uppercase;
}
.chq-recon-live-match b {
  margin-top: 2px;
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 950;
}
.chq-recon-live-match small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 800;
}
.chq-recon-row-actions {
  display: grid;
  gap: 6px;
  align-content: start;
}
.chq-recon-row-actions button {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
}
.chq-recon-row-actions button.primary {
  border-color: rgba(20,184,166,0.35);
  background: rgba(20,184,166,0.11);
  color: #0f766e;
}
.chq-recon-detail-modal {
  width: min(760px, calc(100vw - 28px));
  max-height: min(86vh, 760px);
  overflow: auto;
}
.chq-recon-detail-body {
  display: grid;
  gap: 12px;
}
.chq-recon-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.chq-recon-detail-grid div,
.chq-recon-detail-section {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}
.chq-recon-detail-grid span,
.chq-recon-detail-grid b {
  display: block;
}
.chq-recon-detail-grid span {
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 950;
  text-transform: uppercase;
}
.chq-recon-detail-grid b {
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 950;
}
.chq-recon-detail-section h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 950;
}
.chq-recon-detail-section p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.create-invoice-page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 10px 18px 28px;
}
.create-invoice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}
.create-invoice-head span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #2563eb;
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
}
.create-invoice-head h2 {
  margin: 2px 0 1px;
  color: var(--text-primary);
  font-size: 1.18rem;
  font-weight: 950;
  letter-spacing: 0;
}
.create-invoice-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 800;
}
.create-invoice-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.create-invoice-actions button,
.create-invoice-closed button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 13px;
  font-size: 0.76rem;
  font-weight: 900;
  cursor: pointer;
}
.create-invoice-actions button:last-child,
.create-invoice-closed button {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}
.create-invoice-form-host {
  min-height: 0;
}
.so-standalone-invoice-shell {
  position: static;
  display: block;
  background: transparent;
  z-index: auto;
}
.so-standalone-invoice-card {
  width: 100%;
  max-width: none;
  max-height: none;
  padding-bottom: 0;
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: none;
}
.so-standalone-invoice-card .modal-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-card);
  min-height: 52px;
  padding: 12px 16px;
}
.so-standalone-invoice-card .modal-body {
  max-height: none;
  overflow: visible;
  padding: 14px 16px 18px;
}
.create-invoice-closed {
  min-height: 340px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--text-muted);
  text-align: center;
  padding: 28px;
}
.create-invoice-closed strong {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 950;
}
.create-invoice-closed span {
  font-size: 0.78rem;
  font-weight: 800;
}
.chq-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}
.chq-tabs button svg {
  flex: 0 0 auto;
}
.chq-tabs button.active {
  border-color: color-mix(in srgb, var(--chq-tab) 35%, transparent);
  background: color-mix(in srgb, var(--chq-tab) 12%, var(--bg-card));
  color: var(--chq-tab);
}
.chq-tabs span {
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--chq-tab);
  color: #fff;
  font-size: 0.64rem;
  text-align: center;
}
.chq-mini-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.chq-mini-kpis div {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.chq-mini-kpis span,
.chq-mini-kpis b,
.chq-mini-kpis em {
  display: block;
}
.chq-mini-kpis span {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}
.chq-mini-kpis b {
  margin-top: 4px;
  color: var(--accent);
  font-size: 1.05rem;
  line-height: 1;
}
.chq-rep-filter {
  margin-bottom: 12px;
}
.chq-rep-filter select {
  min-height: 34px;
  min-width: 150px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 800;
}
.chq-mini-kpis em {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
}
.chq-bank-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.chq-bank-rep > div {
  margin: 0 !important;
}
.chq-bank-toolbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}
.chq-bank-action {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
}
.chq-bank-action.muted {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
}
.chq-bank-action.green {
  border: 1px solid rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.09);
  color: #16a34a;
}
.chq-bank-action.blue {
  border: 1px solid rgba(59,130,246,0.35);
  background: rgba(59,130,246,0.09);
  color: #2563eb;
}
.chq-bank-stale {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(245,158,11,0.35);
  border-radius: 10px;
  background: rgba(245,158,11,0.08);
  cursor: pointer;
}
.chq-bank-stale span {
  font-size: 1rem;
}
.chq-bank-stale b {
  flex: 1;
  color: #b45309;
  font-size: 0.78rem;
}
.chq-bank-stale em {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
}
.chq-bank-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}
.chq-bank-kpis div {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 8px;
  row-gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-card);
}
.chq-bank-kpis span,
.chq-bank-kpis b,
.chq-bank-kpis em {
  display: block;
}
.chq-bank-kpis span {
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}
.chq-bank-kpis b {
  color: #2563eb;
  font-size: 0.98rem;
  line-height: 1;
}
.chq-bank-kpis em {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 900;
}
.chq-bank-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
}
.chq-bank-filter-title {
  color: #2563eb;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.chq-bank-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.chq-bank-filter-pills button {
  min-height: 27px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.71rem;
  font-weight: 900;
  cursor: pointer;
}
.chq-bank-filter-pills button.active {
  border-color: #3b82f6;
  background: rgba(59,130,246,0.12);
  color: #2563eb;
}
.chq-bank-custom-dates {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.chq-bank-custom-dates label {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
}
.chq-bank-custom-dates input {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.74rem;
}
.chq-bank-grid {
  display: grid;
  gap: 8px;
}
.chq-bank-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.chq-bank-card.is-empty {
  background: var(--bg-card);
}
.chq-bank-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
}
.chq-bank-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.chq-bank-title span {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(59,130,246,0.12);
}
.chq-bank-title h4 {
  margin: 0;
  color: #2563eb;
  font-size: 0.84rem;
  font-weight: 900;
}
.chq-bank-title p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 700;
}
.chq-bank-totals {
  text-align: right;
  white-space: nowrap;
}
.chq-bank-totals strong {
  display: block;
  color: #2563eb;
  font-size: 0.88rem;
  font-weight: 900;
}
.chq-bank-totals span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 800;
}
.chq-bank-warning {
  margin: 9px 12px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(245,158,11,0.09);
  color: #b45309;
  font-size: 0.72rem;
  font-weight: 900;
}
.chq-bank-list {
  padding: 9px 10px 2px;
}
.chq-bank-empty {
  padding: 8px 12px 10px 51px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
}
.chq-row {
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--chq-color);
  border-radius: 10px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.chq-row.overdue {
  background: linear-gradient(90deg, rgba(239,68,68,0.07), var(--bg-card) 38%);
}
.chq-row-inner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
}
.chq-row-check {
  display: flex;
  align-items: center;
  padding-top: 8px;
}
.chq-row-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.chq-row-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--chq-color) 12%, var(--bg-elevated));
  color: var(--chq-color);
}
.chq-row-icon svg {
  width: 16px;
  height: 16px;
}
.chq-row-main {
  min-width: 0;
  flex: 1;
}
.chq-row-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}
.chq-no {
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 900;
}
.chq-risk {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(239,68,68,0.12);
  color: #ef4444;
  font-size: 0.63rem;
  font-weight: 900;
}
.chq-amount {
  margin-top: 3px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 900;
}
.chq-amount.given {
  color: #8b5cf6;
}
.chq-amount span {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}
.chq-party,
.chq-meta,
.chq-bank-line,
.chq-bounce-line {
  margin-top: 2px;
  font-size: 0.7rem;
}
.chq-party {
  color: var(--text-secondary);
}
.chq-party strong {
  color: var(--text-primary);
}
.chq-calendar-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(124,58,237,0.22);
  border-radius: 12px;
  background: rgba(124,58,237,0.06);
}
.chq-calendar-intro.green {
  border-color: rgba(22,163,74,0.24);
  background: rgba(22,163,74,0.06);
}
.chq-calendar-intro strong {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.chq-calendar-intro span {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
}
.chq-calendar-intro button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}
.chq-calendar-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(124,58,237,0.18);
  border-radius: 12px;
  background: rgba(124,58,237,0.045);
}
.chq-calendar-toolbar.green {
  border-color: rgba(22,163,74,0.2);
  background: rgba(22,163,74,0.045);
}
.chq-calendar-toolbar strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.chq-calendar-toolbar span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
}
.chq-calendar-toolbar > button {
  min-height: 31px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
}
.chq-calendar-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.chq-calendar-toolbar-filters button {
  min-height: 29px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 900;
  cursor: pointer;
}
.chq-calendar-toolbar-filters button.active {
  border-color: rgba(22,163,74,0.36);
  background: rgba(22,163,74,0.1);
  color: #16a34a;
}
.chq-cal-shell {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.chq-cal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
}
.chq-cal-head h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text-primary);
  font-size: 0.96rem;
  font-weight: 950;
}
.chq-cal-head p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
}
.chq-cal-nav {
  display: flex;
  align-items: center;
  gap: 5px;
}
.chq-cal-nav button {
  min-width: 34px;
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}
.chq-cal-month-picker {
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}
.chq-cal-month-picker input {
  width: 132px;
  min-height: 25px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.72rem;
  text-transform: none;
  outline: 0;
}
.chq-assign-modal {
  max-width: 860px;
}
.chq-assign-wrap {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  padding: 16px;
}
.chq-assign-cheque,
.chq-assign-form {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  padding: 14px;
}
.chq-assign-label {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}
.chq-assign-cheque-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--text-primary);
}
.chq-assign-cheque-main strong {
  font-size: 1rem;
  font-weight: 950;
}
.chq-assign-cheque-main b {
  color: #d5aa20;
  font-size: 1.05rem;
  font-weight: 950;
}
.chq-assign-cheque-meta {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 800;
}
.chq-assign-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.chq-assign-summary div {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 10px;
}
.chq-assign-summary span {
  display: block;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}
.chq-assign-summary b {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 950;
}
.chq-assign-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 8px;
}
.chq-assign-title-row strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 950;
}
.chq-assign-title-row span,
.chq-assign-hint {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
}
.chq-assign-title-row button {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 6px 10px;
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
}
.chq-assign-bills {
  display: grid;
  gap: 7px;
  max-height: 220px;
  overflow: auto;
  padding-right: 2px;
}
.chq-assign-bill {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 9px;
  cursor: pointer;
}
.chq-assign-bill.active {
  border-color: rgba(34,197,94,0.45);
  background: rgba(34,197,94,0.08);
}
.chq-assign-bill b {
  display: block;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
}
.chq-assign-bill small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.chq-assign-bill strong {
  color: #ef4444;
  font-size: 0.78rem;
  font-weight: 950;
}
.chq-assign-empty,
.chq-assign-live {
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 10px;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 800;
}
.chq-assign-live {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.chq-assign-live b {
  color: #22c55e;
}
.chq-assign-live .warn {
  color: #f59e0b;
}
.chq-cal-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.chq-cal-kpis div {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-card);
}
.chq-cal-kpis span,
.chq-cal-kpis b,
.chq-cal-kpis em {
  display: block;
}
.chq-cal-kpis span {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}
.chq-cal-kpis b {
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.98rem;
  font-weight: 950;
}
.chq-cal-kpis em {
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 850;
}
.chq-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
}
.chq-cal-dow {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}
.chq-cal-cell {
  min-height: 118px;
  padding: 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.chq-cal-cell.muted {
  background: color-mix(in srgb, var(--bg-elevated) 70%, var(--bg-card));
}
.chq-cal-cell.today {
  box-shadow: inset 0 0 0 2px rgba(245,197,24,0.55);
}
.chq-cal-cell.past-due {
  background: linear-gradient(180deg, rgba(239,68,68,0.06), var(--bg-card));
}
.chq-cal-date {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 20px;
  margin-bottom: 6px;
}
.chq-cal-date span {
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 950;
}
.chq-cal-date b {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 900;
}
.chq-cal-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chq-cal-event {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1px 5px;
  width: 100%;
  padding: 5px 6px;
  border: 1px solid rgba(124,58,237,0.24);
  border-radius: 8px;
  background: rgba(124,58,237,0.08);
  color: #7c3aed;
  text-align: left;
  cursor: pointer;
}
.chq-cal-event.customer {
  border-color: rgba(22,163,74,0.24);
  background: rgba(22,163,74,0.08);
  color: #16a34a;
}
.chq-cal-event strong,
.chq-cal-event span,
.chq-cal-event em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.64rem;
  line-height: 1.25;
}
.chq-cal-event strong {
  font-weight: 950;
}
.chq-cal-event span {
  color: var(--text-secondary);
  font-weight: 800;
}
.chq-cal-event em {
  grid-column: 1 / -1;
  color: currentColor;
  font-style: normal;
  font-weight: 900;
}
.chq-cal-more {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
}
.chq-realize-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.chq-realize-panel {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.chq-realize-title {
  margin-bottom: 9px;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 950;
}
.chq-realize-stats {
  display: grid;
  gap: 7px;
}
.chq-realize-stats div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--bg-elevated);
}
.chq-realize-stats b {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 950;
}
.chq-realize-stats span {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 900;
}
.chq-realize-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.chq-realize-filters button {
  min-height: 30px;
  padding: 0 11px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.71rem;
  font-weight: 900;
  cursor: pointer;
}
.chq-realize-filters button.active {
  border-color: rgba(22,163,74,0.4);
  background: rgba(22,163,74,0.11);
  color: #16a34a;
}
.chq-realize-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 3px 10px;
  width: 100%;
  margin-bottom: 7px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  text-align: left;
  cursor: pointer;
}
.chq-realize-row.work {
  cursor: default;
}
.chq-realize-row strong,
.chq-realize-row em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chq-realize-row strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
}
.chq-realize-row em {
  grid-column: 2;
  color: var(--text-muted);
  font-size: 0.69rem;
  font-style: normal;
  font-weight: 800;
}
.chq-realize-row .state {
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: start;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(59,130,246,0.12);
  color: #2563eb;
  font-size: 0.62rem;
  font-weight: 950;
  white-space: nowrap;
}
.chq-realize-row .state.late {
  background: rgba(239,68,68,0.12);
  color: #ef4444;
}
.chq-realize-row .state.today {
  background: rgba(245,158,11,0.14);
  color: #b45309;
}
.chq-realize-row .state.bank {
  background: rgba(59,130,246,0.12);
  color: #2563eb;
}
.chq-realize-row .state.soon {
  background: rgba(22,163,74,0.12);
  color: #16a34a;
}
.chq-realize-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 5px;
}
.chq-realize-actions button {
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
}
.chq-realize-actions button.blue {
  border-color: rgba(59,130,246,0.36);
  background: rgba(59,130,246,0.1);
  color: #2563eb;
}
.chq-realize-actions button.green {
  border-color: rgba(22,163,74,0.36);
  background: rgba(22,163,74,0.1);
  color: #16a34a;
}
.chq-realize-actions button.red {
  border-color: rgba(239,68,68,0.32);
  background: rgba(239,68,68,0.09);
  color: #ef4444;
}
.chq-realize-empty {
  padding: 18px 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
}
.chq-simple-list {
  margin-top: 10px;
}
@media (max-width: 760px) {
  .chq-calendar-intro,
  .chq-cal-head {
    flex-direction: column;
    align-items: stretch;
  }
  .chq-calendar-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .chq-calendar-toolbar-filters {
    justify-content: flex-start;
  }
  .chq-calendar-toolbar > button {
    justify-content: center;
  }
  .chq-cal-nav {
    justify-content: space-between;
    flex-wrap: wrap;
  }
  .chq-cal-nav button {
    flex: 1 1 96px;
  }
  .chq-cal-month-picker {
    flex: 1 1 100%;
    justify-content: space-between;
  }
  .chq-cal-kpis,
  .chq-assign-wrap,
  .chq-assign-summary,
  .chq-realize-layout {
    grid-template-columns: 1fr;
  }
  .chq-cal-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
  .chq-cal-dow,
  .chq-cal-cell {
    min-width: 0;
    padding-left: 4px;
    padding-right: 4px;
  }
  .chq-cal-cell {
    min-height: 88px;
  }
  .chq-cal-date {
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
  }
  .chq-cal-date b,
  .chq-cal-event span,
  .chq-cal-event em {
    display: none;
  }
  .chq-cal-event {
    display: block;
    padding: 4px;
  }
  .chq-realize-row {
    grid-template-columns: 1fr;
  }
  .chq-realize-row .state,
  .chq-realize-row em {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 640px) {
  #page-cheques,
  #page-sales,
  #page-collections {
    max-width: 100%;
    overflow-x: hidden;
  }

  #page-cheques *,
  #page-sales *,
  #page-collections * {
    box-sizing: border-box;
  }

  #page-cheques :is(.chq-command, .chq-search-box, .chq-tabs, .chq-rep-filter, .chq-cal-shell, .chq-realize-panel),
  #page-sales :is(.sales-workspace-tabs-wrap, .sales-workspace-tabs, .sales-workspace-window, .sales-workspace-window-body),
  #page-collections :is(.erp-workspace-tabs, .erp-workspace-window, .erp-workspace-body) {
    min-width: 0;
    max-width: 100%;
  }

  #page-cheques :is(input, select, textarea, button),
  #page-sales :is(input, select, textarea, button),
  #page-collections :is(input, select, textarea, button) {
    max-width: 100%;
  }

  #page-cheques .chq-tabs,
  #page-sales .sales-workspace-tabs,
  #page-collections .erp-workspace-tabs {
    width: 100%;
    padding-bottom: 8px;
  }

  #page-cheques .chq-search-box input {
    min-width: 0;
  }
  #page-cheques .chq-global-search-head,
  #page-cheques .chq-global-search-row {
    align-items: stretch;
  }
  #page-cheques .chq-global-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  #page-cheques .chq-global-search-money {
    min-width: 0;
    text-align: left;
  }
  #page-cheques .chq-global-search-row button {
    grid-column: 1 / -1;
    width: 100%;
  }
  #page-cheques .chq-archive-hero,
  #page-cheques .chq-recon-hero,
  #page-cheques .chq-archive-tools {
    align-items: stretch;
    flex-direction: column;
  }
  #page-cheques .chq-archive-hero button,
  #page-cheques .chq-recon-type button,
  #page-cheques .chq-return-status-tabs button,
  #page-cheques .chq-archive-tools select {
    width: 100%;
  }
  #page-cheques .chq-archive-kpis,
  #page-cheques .chq-recon-kpis,
  #page-cheques .chq-recon-summary,
  #page-cheques .chq-recon-suggest-grid,
  #page-cheques .chq-recon-form,
  #page-cheques .chq-old-story,
  #page-cheques .chq-old-detail-grid {
    grid-template-columns: 1fr;
  }
  #page-cheques .chq-archive-row,
  #page-cheques .chq-recon-row {
    grid-template-columns: 1fr;
  }
  #page-cheques .chq-archive-meta,
  #page-cheques .chq-recon-actions {
    justify-items: stretch;
  }
  #page-cheques .chq-archive-meta button,
  #page-cheques .chq-recon-actions button,
  #page-cheques .chq-recon-modal-foot button {
    width: 100%;
  }
  #page-cheques .chq-recon-main strong,
  #page-cheques .chq-recon-main small,
  #page-cheques .chq-recon-main p {
    white-space: normal;
  }
  #page-cheques .chq-recon-modal-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .create-invoice-page {
    padding: 10px 10px 22px;
  }
  .create-invoice-head {
    align-items: stretch;
    flex-direction: column;
  }
  .create-invoice-actions,
  .create-invoice-actions button {
    width: 100%;
  }
  .so-standalone-invoice-card {
    border-radius: 12px;
  }

  #page-collections .erp-workspace-body div[style*="grid-template-columns:repeat(auto-fit,minmax(150px,1fr))"],
  #page-collections .erp-workspace-body div[style*="grid-template-columns:repeat(auto-fill,minmax(140px,1fr))"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Accounts Finance */
.af-page {
  padding: 10px 18px 72px;
}
.af-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(245, 197, 24, 0.08), transparent 42%),
    var(--bg-card);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}
.af-page-kicker {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.af-page-head h2 {
  margin: 2px 0 1px;
  color: var(--text-primary);
  font-size: 1.12rem;
  line-height: 1.15;
  font-weight: 950;
}
.af-page-head p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 780;
}
.af-page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.af-page-actions button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0 11px;
  font-size: 0.73rem;
  font-weight: 950;
  font-family: inherit;
  cursor: pointer;
}
.af-page-actions button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a00;
}
.af-page-actions span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  font-size: 0.62rem;
  font-weight: 950;
}

.af-page .erp-workspace-tabs {
  padding: 6px 8px;
  margin-bottom: 10px;
  border-radius: 12px;
}
.af-page .erp-workspace-tab {
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 0.72rem;
}
.af-page .erp-workspace-window {
  border-radius: 14px;
  margin-bottom: 12px;
}
.af-page .erp-workspace-head {
  padding: 9px 12px;
}
.af-page .erp-workspace-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}
.af-page .erp-workspace-title {
  gap: 8px;
}
.af-page .erp-workspace-title strong {
  font-size: 0.9rem;
}
.af-page .erp-workspace-title small {
  font-size: 0.68rem;
}
.af-page .erp-workspace-close {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.72rem;
}
.af-finance-overview {
  margin-bottom: 8px;
  display: grid;
  gap: 6px;
}
.af-finance-overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}
.af-finance-overview-head span {
  display: block;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.af-finance-overview-head strong {
  display: block;
  margin-top: 2px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 950;
}
.af-finance-overview-head button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #1a1a00;
  padding: 0 11px;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.af-finance-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.af-finance-card {
  min-width: 0;
  min-height: 112px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-primary);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}
.af-finance-card:hover {
  border-color: rgba(245,197,24,0.56);
  box-shadow: 0 8px 18px rgba(15,23,42,0.06);
}
.af-finance-card-icon {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--accent);
}
.af-finance-card-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.af-finance-card-copy em {
  color: var(--text-muted);
  font-size: 0.58rem;
  font-style: normal;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.af-finance-card-copy strong {
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1.18;
}
.af-finance-card-copy small {
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 760;
  line-height: 1.25;
}
.af-finance-card b {
  align-self: end;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
  overflow-wrap: anywhere;
}
.af-finance-card.danger {
  border-color: rgba(239,68,68,0.28);
  background: linear-gradient(135deg, rgba(239,68,68,0.08), var(--bg-card) 42%);
}
.af-finance-card.warning {
  border-color: rgba(245,158,11,0.3);
  background: linear-gradient(135deg, rgba(245,158,11,0.08), var(--bg-card) 42%);
}
.af-finance-card.ready {
  border-color: rgba(34,197,94,0.25);
  background: linear-gradient(135deg, rgba(34,197,94,0.07), var(--bg-card) 42%);
}
.af-finance-card.blue {
  border-color: rgba(37,99,235,0.22);
  background: linear-gradient(135deg, rgba(37,99,235,0.06), var(--bg-card) 42%);
}
.af-finance-card.danger .af-finance-card-icon,
.af-finance-card.danger b {
  color: #ef4444;
}
.af-finance-card.warning .af-finance-card-icon,
.af-finance-card.warning b {
  color: #d97706;
}
.af-finance-card.ready .af-finance-card-icon,
.af-finance-card.ready b {
  color: #16a34a;
}
.af-finance-card.blue .af-finance-card-icon,
.af-finance-card.blue b {
  color: #2563eb;
}
.af-finance-next {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--bg-card);
}
.af-finance-next.danger {
  border-left-color: #ef4444;
  background: linear-gradient(90deg, rgba(239,68,68,0.07), var(--bg-card) 42%);
}
.af-finance-next.warning {
  border-left-color: #f59e0b;
  background: linear-gradient(90deg, rgba(245,158,11,0.08), var(--bg-card) 42%);
}
.af-finance-next.ready {
  border-left-color: #16a34a;
  background: linear-gradient(90deg, rgba(34,197,94,0.07), var(--bg-card) 42%);
}
.af-finance-next-main {
  min-width: 0;
}
.af-finance-next span,
.af-finance-status span {
  display: block;
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}
.af-finance-next strong {
  display: block;
  margin-top: 1px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 950;
  line-height: 1.18;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-finance-next small {
  display: block;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-finance-next button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #1a1a00;
  padding: 0 16px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.af-finance-next button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.af-finance-mini-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.af-finance-mini-stats span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  padding: 0 9px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: none;
  white-space: nowrap;
}
.af-finance-mini-stats b {
  color: var(--text-primary);
  font-weight: 950;
}
.af-finance-mini-stats span.danger {
  border-color: rgba(239,68,68,0.24);
  background: rgba(239,68,68,0.06);
  color: #dc2626;
}
.af-finance-mini-stats span.danger b {
  color: #ef4444;
}
.af-finance-mini-stats span.warning {
  border-color: rgba(245,158,11,0.3);
  background: rgba(245,158,11,0.08);
  color: #b45309;
}
.af-finance-mini-stats span.warning b {
  color: #d97706;
}
.af-finance-mini-stats span.ready b {
  color: #16a34a;
}
.af-finance-status-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.af-finance-status {
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.af-finance-status b {
  display: block;
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-finance-status small {
  display: block;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 0.63rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-finance-status.danger {
  border-color: rgba(239,68,68,0.26);
  background: rgba(239,68,68,0.06);
}
.af-finance-status.danger b {
  color: #ef4444;
}
.af-finance-status.warning {
  border-color: rgba(245,158,11,0.3);
  background: rgba(245,158,11,0.07);
}
.af-finance-status.warning b {
  color: #d97706;
}
.af-finance-status.ready b {
  color: #16a34a;
}
.af-finance-shortcuts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.af-finance-shortcut {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 0 10px;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 950;
  cursor: pointer;
}
.af-finance-shortcut:hover {
  border-color: rgba(245,197,24,0.48);
  background: rgba(245,197,24,0.08);
}
.af-simple-workspace {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
}

/* Accounts Finance: Utility bills */
.af-util-next {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--bg-card);
}
.af-util-next.danger {
  border-left-color: #ef4444;
  background: linear-gradient(90deg, rgba(239,68,68,0.07), var(--bg-card) 42%);
}
.af-util-next.warning {
  border-left-color: #f59e0b;
  background: linear-gradient(90deg, rgba(245,158,11,0.08), var(--bg-card) 42%);
}
.af-util-next.attention {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, rgba(245,197,24,0.12), var(--bg-card) 42%);
}
.af-util-next.ready {
  border-left-color: #22c55e;
  background: linear-gradient(90deg, rgba(34,197,94,0.07), var(--bg-card) 42%);
}
.af-util-next-main {
  min-width: 0;
}
.af-util-next span,
.af-util-status span {
  display: block;
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}
.af-util-next strong {
  display: block;
  margin-top: 1px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 950;
  line-height: 1.18;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-util-next small {
  display: block;
  margin-top: 1px;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-util-next-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.af-util-next-stats span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  padding: 0 9px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: none;
  white-space: nowrap;
}
.af-util-next-stats b {
  color: var(--text-primary);
  font-weight: 950;
}
.af-util-next-stats span.danger {
  border-color: rgba(239,68,68,0.24);
  background: rgba(239,68,68,0.06);
  color: #dc2626;
}
.af-util-next-stats span.danger b {
  color: #ef4444;
}
.af-util-next-stats span.attention {
  border-color: rgba(245,197,24,0.34);
  background: rgba(245,197,24,0.1);
  color: #8a6400;
}
.af-util-next button,
.af-util-toolbar button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #1a1a00;
  padding: 0 14px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.af-util-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.af-util-status {
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.af-util-status b {
  display: block;
  margin-top: 2px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-util-status small {
  display: block;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 0.63rem;
  font-weight: 820;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-util-status.danger {
  border-color: rgba(239,68,68,0.28);
  background: rgba(239,68,68,0.06);
}
.af-util-status.danger b {
  color: #ef4444;
}
.af-util-status.attention {
  border-color: rgba(245,197,24,0.38);
  background: rgba(245,197,24,0.1);
}
.af-util-status.attention b {
  color: #b45309;
}
.af-util-status.ready b {
  color: #16a34a;
}
.af-util-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.af-util-toolbar input {
  min-height: 36px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 750;
}
.af-util-toolbar button {
  border-color: var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.af-util-building-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.af-util-building-chips button {
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 0 10px;
  font-size: 0.66rem;
  font-weight: 900;
  font-family: inherit;
  cursor: pointer;
}
.af-util-building-chips button.active {
  border-color: rgba(245,197,24,0.55);
  background: rgba(245,197,24,0.16);
  color: #8a6400;
}
.af-util-building-chips span {
  margin-left: 3px;
  opacity: 0.72;
}
.af-util-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 8px;
}
.af-util-list-head strong {
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.af-util-list-head span {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 900;
}
.af-util-list {
  display: grid;
  gap: 6px;
}
.af-util-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.af-util-row.danger {
  border-left-color: #ef4444;
  background: linear-gradient(90deg, rgba(239,68,68,0.06), var(--bg-card) 42%);
}
.af-util-row.warning {
  border-left-color: #f59e0b;
  background: linear-gradient(90deg, rgba(245,158,11,0.06), var(--bg-card) 42%);
}
.af-util-row.attention {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, rgba(245,197,24,0.1), var(--bg-card) 42%);
}
.af-util-row.ready {
  border-left-color: #22c55e;
}
.af-util-row-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--bg-elevated);
  font-size: 1rem;
}
.af-util-row-main {
  min-width: 0;
}
.af-util-row-title {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.af-util-row-title strong {
  min-width: 0;
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 950;
}
.af-util-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.62rem;
  font-weight: 950;
}
.af-util-chip.danger {
  background: rgba(239,68,68,0.1);
  color: #dc2626;
}
.af-util-chip.warning,
.af-util-chip.attention {
  background: rgba(245,158,11,0.12);
  color: #b45309;
}
.af-util-chip.ready {
  background: rgba(34,197,94,0.1);
  color: #16a34a;
}
.af-util-chip.muted {
  background: var(--bg-elevated);
  color: var(--text-muted);
}
.af-util-row-meta,
.af-util-row-note {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 800;
}
.af-util-row-note {
  color: var(--text-primary);
}
.af-util-row-note.muted {
  color: var(--text-muted);
  font-weight: 760;
}
.af-util-row-actions {
  min-width: 150px;
  display: grid;
  gap: 6px;
  justify-items: end;
}
.af-util-row-actions .primary {
  min-width: 108px;
  min-height: 34px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #1a1a00;
  padding: 0 12px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 950;
  cursor: pointer;
}
.af-util-row-actions .primary.danger {
  border-color: rgba(239,68,68,0.35);
  background: rgba(239,68,68,0.1);
  color: #dc2626;
}
.af-util-row-actions .primary.warning {
  border-color: rgba(245,158,11,0.36);
  background: rgba(245,158,11,0.12);
  color: #b45309;
}
.af-util-row-actions .primary.ready {
  border-color: rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.1);
  color: #16a34a;
}
.af-util-row-actions div {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.af-util-row-actions div button {
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 0 8px;
  font-family: inherit;
  font-size: 0.66rem;
  font-weight: 900;
  cursor: pointer;
}
.af-vehicle-toolbar-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.af-vehicle-toolbar-actions button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #1a1a00;
}

/* Accounts Finance: Add utility bill form */
#af-bill-modal .modal {
  max-width: 760px;
}
#af-bill-modal .modal-body {
  padding-bottom: 14px;
}
.af-bill-simple-form {
  display: grid;
  gap: 10px;
}
.af-bill-provider-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(14,165,233,0.22);
  border-radius: 12px;
  background: rgba(14,165,233,0.07);
}
.af-bill-provider-card span,
.af-bill-section-head span,
.af-bill-details summary small {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
}
.af-bill-provider-card span {
  display: block;
  text-transform: uppercase;
}
.af-bill-provider-card strong {
  display: block;
  margin-top: 2px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-bill-provider-card small {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 780;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-bill-section,
.af-bill-details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}
.af-bill-section {
  padding: 12px;
}
.af-bill-section.primary {
  border-color: rgba(245,197,24,0.36);
  background: linear-gradient(135deg, rgba(245,197,24,0.08), var(--bg-card) 36%);
}
.af-bill-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.af-bill-section-head strong {
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 950;
  white-space: nowrap;
}
.af-bill-section .form-row,
.af-bill-details .form-row {
  gap: 10px;
}
.af-bill-section .form-group,
.af-bill-details .form-group {
  margin-bottom: 0;
}
.af-bill-unpaid-note {
  align-self: end;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(59,130,246,0.18);
  border-radius: 10px;
  background: rgba(59,130,246,0.06);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 850;
  line-height: 1.3;
}
.af-bill-payment-options {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.af-bill-details {
  overflow: hidden;
}
.af-bill-details summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
  cursor: pointer;
  list-style: none;
}
.af-bill-details summary::-webkit-details-marker {
  display: none;
}
.af-bill-details summary::after {
  content: "+";
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 950;
}
.af-bill-details[open] summary {
  border-bottom: 1px solid var(--border);
}
.af-bill-details[open] summary::after {
  content: "-";
}
.af-bill-details-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}
.af-bill-upload {
  min-height: 86px;
  display: grid;
  place-items: center;
  align-content: center;
}
.af-bill-upload p {
  margin: 4px 0 0;
}
#af-bill-modal .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 2px;
  padding-top: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0), var(--bg-surface) 32%);
}

/* Accounts Finance: Rental building form */
#af-rental-modal .modal {
  max-width: 760px;
}
#af-rental-modal .modal-body {
  padding-bottom: 14px;
}
.af-rental-simple-form {
  display: grid;
  gap: 10px;
}
.af-rental-section,
.af-rental-details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}
.af-rental-section {
  padding: 12px;
}
.af-rental-section.primary {
  border-color: rgba(245,197,24,0.36);
  background: linear-gradient(135deg, rgba(245,197,24,0.08), var(--bg-card) 36%);
}
.af-rental-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.af-rental-section-head strong {
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 950;
  white-space: nowrap;
}
.af-rental-section-head span,
.af-rental-details summary small {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
}
.af-rental-section .form-row,
.af-rental-details .form-row {
  gap: 10px;
}
.af-rental-section .form-group,
.af-rental-details .form-group {
  margin-bottom: 0;
}
.af-rental-due-row {
  align-items: end;
}
.af-rental-due-hint {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(59,130,246,0.18);
  border-radius: 10px;
  background: rgba(59,130,246,0.06);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 850;
  line-height: 1.3;
}
.af-rental-details {
  overflow: hidden;
}
.af-rental-details summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
  cursor: pointer;
  list-style: none;
}
.af-rental-details summary::-webkit-details-marker {
  display: none;
}
.af-rental-details summary::after {
  content: "+";
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 950;
}
.af-rental-details[open] summary {
  border-bottom: 1px solid var(--border);
}
.af-rental-details[open] summary::after {
  content: "-";
}
.af-rental-details-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}
#af-rental-modal .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: 2px;
  padding-top: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0), var(--bg-surface) 32%);
}

/* Supplier Payment */
.af-pay-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}
.af-pay-main {
  min-width: 0;
}
.af-pay-section {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
}
.af-pay-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.af-pay-title {
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 900;
}
.af-pay-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}
.af-pay-mini-btn {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}
.af-pay-invoices {
  display: grid;
  gap: 7px;
}
.af-pay-invoice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  cursor: pointer;
}
.af-pay-invoice.active {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.07);
}
.af-pay-invoice input {
  width: 17px;
  height: 17px;
  accent-color: #22c55e;
}
.af-pay-invoice b,
.af-pay-invoice small,
.af-pay-invoice strong {
  display: block;
}
.af-pay-invoice b {
  color: var(--text-primary);
  font-size: 0.82rem;
}
.af-pay-invoice small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
}
.af-pay-invoice strong {
  color: #ef4444;
  font-size: 0.8rem;
  white-space: nowrap;
}
.af-pay-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.af-pay-inline-title {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.af-pay-inline-title span {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}
.af-pay-inline-title b {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 950;
  white-space: nowrap;
}
.af-pay-inline-title em {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}
.af-pay-inline-head button {
  min-height: 32px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
#af-pay-bills-modal .af-pay-compact-form > .calm-form-guide,
#af-suppay-modal .af-pay-compact-form > .calm-form-guide {
  display: none;
}
.af-pay-simple-form {
  display: grid;
  gap: 12px;
}
.af-pay-simple-form .form-row {
  gap: 12px;
}
.af-pay-simple-main {
  grid-template-columns: 1fr 1fr 1fr;
}
.af-pay-more {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}
.af-pay-more summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}
.af-pay-more summary::-webkit-details-marker {
  display: none;
}
.af-pay-more summary::after {
  content: "+";
  margin-left: auto;
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 900;
}
.af-pay-more[open] summary {
  border-bottom: 1px solid var(--border);
}
.af-pay-more[open] summary::after {
  content: "-";
}
.af-pay-more-body {
  padding: 12px;
}
.af-pay-compact .af-pay-section {
  margin-bottom: 8px;
  padding: 9px 10px;
  border-radius: 12px;
}
.af-pay-compact .af-pay-section:first-child {
  display: grid;
  grid-template-columns: auto minmax(260px, 1fr) auto 180px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}
.af-pay-compact .af-pay-section:first-child .form-label {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0;
}
.af-pay-compact .af-pay-section:first-child .form-control {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 0.82rem;
}
.af-pay-compact .af-pay-title-row {
  align-items: center;
  margin-bottom: 4px;
}
.af-pay-compact .af-pay-title {
  font-size: 0.8rem;
}
.af-pay-compact .af-pay-sub {
  font-size: 0.64rem;
}
.af-pay-compact .af-pay-section:nth-child(2) .af-pay-sub {
  display: none;
}
.af-pay-compact .af-pay-mini-btn {
  min-height: 28px;
  padding: 0 9px;
  font-size: 0.68rem;
}
.af-pay-compact .af-pay-invoices {
  gap: 5px;
}
.af-pay-compact .af-pay-invoice {
  padding: 6px 8px;
  border-radius: 9px;
}
.af-pay-compact .af-pay-invoice input {
  width: 16px;
  height: 16px;
}
.af-pay-compact .af-pay-invoice b {
  font-size: 0.78rem;
}
.af-pay-compact .af-pay-invoice small {
  margin-top: 0;
  font-size: 0.6rem;
}
.af-pay-compact .af-pay-invoice strong {
  font-size: 0.76rem;
}
.af-pay-compact .af-pay-date-row {
  max-width: 220px;
  margin-bottom: 8px;
}
.af-pay-compact .af-pay-date-label {
  white-space: nowrap;
}
.af-pay-compact .af-pay-date-input {
  max-width: 180px;
}
.af-pay-compact .af-pay-date-row .form-control {
  min-height: 38px;
  padding: 7px 10px;
  font-size: 0.82rem;
}
.af-pay-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.af-pay-split-ledger {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.af-pay-split-ledger div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(100, 116, 139, 0.06);
}
.af-pay-split-ledger span,
.af-pay-split-ledger b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-pay-split-ledger span {
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 950;
  text-transform: uppercase;
}
.af-pay-split-ledger b {
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
}
.af-pay-split-ledger div:nth-child(2) b,
.af-pay-split-ledger div:nth-child(3) b,
.af-pay-split-ledger div:nth-child(4) b {
  color: #16a34a;
}
.af-pay-split-ledger div.danger {
  border-color: rgba(239, 68, 68, 0.32);
  background: rgba(239, 68, 68, 0.07);
}
.af-pay-split-ledger div.danger b {
  color: #dc2626;
}
.af-pay-method-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.af-pay-supplier-simple {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
}
.af-pay-supplier-simple .af-pay-math {
  display: none;
}
.af-pay-supplier-simple .af-pay-summary {
  display: grid;
}
.af-pay-supplier-simple .af-pay-split-ledger {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 10px;
}
.af-pay-supplier-simple .af-pay-split-ledger div:nth-child(2),
.af-pay-supplier-simple .af-pay-split-ledger div:nth-child(3),
.af-pay-supplier-simple .af-pay-split-ledger div:nth-child(4) {
  display: none;
}
.af-pay-supplier-simple .af-pay-method-grid-simple,
.af-pay-supplier-simple .af-pay-method-grid-advanced {
  grid-template-columns: minmax(0, 1fr);
}
.af-pay-supplier-simple #afsp-cash-card {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(260px, 1fr);
  gap: 10px;
  align-items: start;
}
.af-pay-supplier-simple #afsp-cash-card .af-pay-method-head {
  grid-column: 1 / -1;
  margin-bottom: 0;
}
.af-pay-supplier-simple #afsp-cash-card > .form-control {
  min-height: 48px;
}
.af-pay-supplier-simple #afsp-cash-card .af-pay-source {
  margin-top: 0;
}
.af-pay-advanced-options {
  margin: 2px 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  overflow: hidden;
}
.af-pay-advanced-options summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
  cursor: pointer;
  list-style: none;
}
.af-pay-advanced-options summary::-webkit-details-marker {
  display: none;
}
.af-pay-advanced-options summary::after {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1;
}
.af-pay-advanced-options[open] summary {
  border-bottom: 1px solid var(--border);
}
.af-pay-advanced-options[open] summary::after {
  content: "-";
}
.af-pay-advanced-options summary small {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 850;
}
.af-pay-advanced-options > .af-pay-method-grid,
.af-pay-advanced-options > .af-pay-inhand {
  margin: 10px;
}
.af-pay-method-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
}
.af-pay-method-card.active {
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.07);
}
.af-pay-method-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.af-pay-method-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
}
.af-pay-method-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 800;
}
.af-pay-method-head span {
  align-self: flex-start;
  padding: 3px 8px;
  border: 1px solid rgba(34, 197, 94, 0.24);
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.08);
  color: #16a34a;
  font-size: 0.64rem;
  font-weight: 950;
  white-space: nowrap;
}
.af-pay-source {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.055);
}
.af-pay-source .form-label {
  margin-bottom: 4px;
}
.af-pay-extra-source-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.af-pay-extra-source-card {
  display: grid;
  grid-template-columns: minmax(180px, 0.82fr) minmax(220px, 1fr);
  gap: 10px 12px;
  align-items: end;
  padding: 10px;
}
.af-pay-extra-source-card .af-pay-method-head {
  grid-column: 1 / -1;
  margin-bottom: 0;
}
.af-pay-extra-source-card > .form-control,
.af-pay-extra-source-card > .af-pay-source {
  min-width: 0;
}
.af-pay-extra-source-card > .af-pay-source {
  margin-top: 0;
}
.af-pay-source-remove {
  min-height: 30px;
  border: 1px solid rgba(239, 68, 68, 0.24);
  border-radius: 9px;
  background: rgba(239, 68, 68, 0.07);
  color: #dc2626;
  padding: 0 10px;
  font-size: 0.66rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.af-pay-add-source-btn {
  width: 100%;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 9px;
  border: 1px dashed rgba(37, 99, 235, 0.34);
  border-radius: 11px;
  background: rgba(59, 130, 246, 0.055);
  color: #2563eb;
  font-size: 0.74rem;
  font-weight: 950;
  cursor: pointer;
}
.af-pay-add-source-btn:hover {
  border-style: solid;
  background: rgba(59, 130, 246, 0.09);
}
.af-pay-compact-cheque-picker {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(14, 165, 233, 0.24);
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.06);
}
.af-pay-compact-cheque-picker .form-control {
  min-height: 40px;
}
.af-pay-compact-cheque-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
}
.af-pay-compact-cheque-search-row button,
.af-pay-compact-cheque-selected button {
  min-height: 40px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.08);
  color: #0284c7;
  padding: 0 12px;
  font-size: 0.7rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.af-pay-compact-cheque-summary {
  min-height: 32px;
  padding: 8px 9px;
  border: 1px dashed rgba(14, 165, 233, 0.28);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.35);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1.35;
}
.af-pay-compact-cheque-summary.success {
  border-style: solid;
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.08);
  color: #15803d;
}
.af-pay-compact-cheque-summary.warning {
  border-style: solid;
  border-color: rgba(245, 158, 11, 0.32);
  background: rgba(245, 158, 11, 0.08);
  color: #92400e;
}
.af-pay-compact-cheque-list {
  display: grid;
  gap: 6px;
}
.af-pay-compact-cheque-selected {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid rgba(34, 197, 94, 0.26);
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.07);
}
.af-pay-compact-cheque-selected b,
.af-pay-compact-cheque-selected small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-pay-compact-cheque-selected b {
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 950;
}
.af-pay-compact-cheque-selected small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 850;
}
.af-pay-compact-cheque-selected button {
  min-height: 30px;
  border-color: rgba(239, 68, 68, 0.26);
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}
.af-pay-supplier-simple #afsp-cash-card.cheque-source {
  grid-template-columns: minmax(0, 1fr);
  border-color: rgba(14, 165, 233, 0.36);
  background: rgba(14, 165, 233, 0.055);
}
.af-pay-supplier-simple #afsp-cash-card.cheque-source > .form-control {
  display: none;
}
.af-pay-supplier-simple #afsp-cash-card.cheque-source .af-pay-source {
  grid-column: 1 / -1;
}
.af-pay-supplier-simple .af-pay-inhand-hidden-source {
  display: none;
}
.af-pay-supplier-side {
  gap: 10px;
}
.af-pay-supplier-side-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
}
.af-pay-supplier-side-card.empty {
  border-style: dashed;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-align: center;
}
.af-pay-supplier-side-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.af-pay-supplier-side-head span,
.af-pay-supplier-side-metrics span,
.af-pay-supplier-side-info span {
  display: block;
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 950;
  text-transform: uppercase;
}
.af-pay-supplier-side-head strong {
  display: block;
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 950;
  line-height: 1.2;
}
.af-pay-supplier-side-head small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.3;
}
.af-pay-supplier-side-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 10px;
}
.af-pay-supplier-side-metrics div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}
.af-pay-supplier-side-metrics b {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-pay-supplier-side-metrics b.danger {
  color: #ef4444;
}
.af-pay-supplier-side-metrics b.ok {
  color: #16a34a;
}
.af-pay-supplier-side-info {
  display: grid;
  gap: 7px;
}
.af-pay-supplier-side-info div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}
.af-pay-supplier-side-info b {
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-pay-supplier-side-title {
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
}
.af-pay-supplier-side-list {
  display: grid;
  gap: 7px;
}
.af-pay-supplier-side-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}
.af-pay-supplier-side-row b,
.af-pay-supplier-side-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-pay-supplier-side-row b {
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 950;
}
.af-pay-supplier-side-row small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 800;
}
.af-pay-supplier-side-row > strong {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 950;
  white-space: nowrap;
}
.af-pay-supplier-side-row.danger > strong {
  color: #ef4444;
}
.af-pay-supplier-side-row.ok > strong {
  color: #16a34a;
}
.af-pay-supplier-side-row.info > strong {
  color: #2563eb;
}
.af-pay-supplier-side-empty {
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 850;
  text-align: center;
}
.af-pay-auto-btn {
  width: 100%;
  min-height: 32px;
  margin-top: 7px;
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 9px;
  background: rgba(59, 130, 246, 0.08);
  color: #2563eb;
  font-size: 0.68rem;
  font-weight: 950;
  cursor: pointer;
}
.af-pay-date-row {
  max-width: 260px;
  margin-bottom: 10px;
}
.af-pay-math {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
}
.af-pay-math-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
}
.af-pay-math-card span,
.af-pay-math-card b,
.af-pay-math-card small {
  display: block;
}
.af-pay-math-card span {
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 950;
  text-transform: uppercase;
}
.af-pay-math-card b {
  margin-top: 5px;
  color: var(--text-primary);
  font-size: 1.18rem;
  font-weight: 950;
}
.af-pay-math-card small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1.25;
}
.af-pay-math-card.bill b {
  color: #ef4444;
}
.af-pay-math-card.applied b {
  color: #16a34a;
}
.af-pay-math-card.result.warning {
  border-color: rgba(245, 158, 11, 0.34);
  background: rgba(245, 158, 11, 0.08);
}
.af-pay-math-card.result.warning b {
  color: #b45309;
}
.af-pay-math-card.result.success {
  border-color: rgba(34, 197, 94, 0.34);
  background: rgba(34, 197, 94, 0.08);
}
.af-pay-math-card.result.success b {
  color: #16a34a;
}
.af-pay-math-card.result.danger {
  border-color: rgba(239, 68, 68, 0.36);
  background: rgba(239, 68, 68, 0.08);
}
.af-pay-math-card.result.danger b {
  color: #dc2626;
}
.af-pay-math-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.2rem;
  font-weight: 950;
}
.af-pay-flow-warning {
  margin: -2px 0 10px;
  padding: 9px 10px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.08);
  color: #92400e;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.35;
}
.af-pay-flow-warning b {
  color: #b45309;
}
.af-pay-flow-warning.danger {
  border-color: rgba(239, 68, 68, 0.34);
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
}
.af-pay-flow-warning.danger b {
  color: #dc2626;
}
.af-pay-inhand {
  margin: 2px 0 10px;
  padding: 10px;
  border: 1px solid rgba(14, 165, 233, 0.26);
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.055);
}
.af-pay-inhand-count {
  align-self: flex-start;
  padding: 4px 8px;
  border: 1px solid rgba(14, 165, 233, 0.24);
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.09);
  color: #0284c7;
  font-size: 0.64rem;
  font-weight: 950;
  white-space: nowrap;
}
.af-pay-inhand-list {
  display: grid;
  gap: 7px;
}
.af-pay-inhand-selected-note {
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px solid rgba(34, 197, 94, 0.26);
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.08);
  color: #22c55e;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.35;
}
.af-pay-inhand-selected-note b {
  color: #86efac;
  font-weight: 950;
}
.af-pay-inhand-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}
.af-pay-inhand-search input {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 8px 10px;
  font-size: 0.76rem;
  font-weight: 850;
}
.af-pay-inhand-search span {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
}
.af-pay-inhand-extend {
  min-height: 36px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  border-radius: 10px;
  background: rgba(14, 165, 233, 0.08);
  color: #0284c7;
  padding: 7px 11px;
  font-size: 0.72rem;
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
}
.af-pay-inhand-cheque {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  cursor: pointer;
}
.af-pay-inhand-cheque.active {
  border-color: rgba(34, 197, 94, 0.52);
  background: rgba(34, 197, 94, 0.09);
  box-shadow: inset 3px 0 0 #22c55e;
}
.af-pay-inhand-cheque.partial {
  border-color: rgba(245, 158, 11, 0.48);
  background: rgba(245, 158, 11, 0.08);
  box-shadow: inset 3px 0 0 #f59e0b;
}
.af-pay-inhand-cheque.no-apply {
  border-color: rgba(239, 68, 68, 0.36);
  background: rgba(239, 68, 68, 0.06);
  box-shadow: inset 3px 0 0 #ef4444;
}
.af-pay-inhand-cheque input {
  width: 17px;
  height: 17px;
  accent-color: #0284c7;
}
.af-pay-inhand-cheque b,
.af-pay-inhand-cheque small,
.af-pay-inhand-cheque strong {
  display: block;
}
.af-pay-inhand-cheque b {
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 900;
}
.af-pay-inhand-cheque small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 750;
}
.af-pay-inhand-cheque strong {
  color: #0284c7;
  font-size: 0.8rem;
  font-weight: 950;
  white-space: nowrap;
}
.af-pay-inhand-apply {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 950;
}
.af-pay-inhand-cheque.active .af-pay-inhand-apply {
  background: rgba(34, 197, 94, 0.14);
  color: #15803d;
}
.af-pay-inhand-cheque.partial .af-pay-inhand-apply {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}
.af-pay-inhand-cheque.no-apply .af-pay-inhand-apply {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}
.af-pay-inhand-money {
  display: grid;
  gap: 3px;
  justify-items: end;
  text-align: right;
}
.af-pay-inhand-money small {
  color: #b45309;
  font-size: 0.62rem;
  font-weight: 900;
  white-space: nowrap;
}
.af-pay-inhand-empty {
  padding: 10px 11px;
  border: 1px dashed rgba(14, 165, 233, 0.28);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
}
.af-pay-apply-plan {
  margin: 8px 0;
  padding: 9px 10px;
  border: 1px solid rgba(34, 197, 94, 0.24);
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.07);
}
.af-pay-apply-plan.no-apply {
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.08);
}
.af-pay-apply-plan-head,
.af-pay-apply-plan-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.af-pay-apply-plan-head {
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 950;
  text-transform: uppercase;
}
.af-pay-apply-plan-head b {
  color: #22c55e;
}
.af-pay-apply-plan.no-apply .af-pay-apply-plan-head b {
  color: #b45309;
}
.af-pay-apply-plan-note {
  margin: 0 0 7px;
  padding: 7px 8px;
  border: 1px solid rgba(245, 158, 11, 0.22);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.45);
  color: #92400e;
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1.35;
}
.af-pay-apply-plan-note.is-warning {
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.08);
  color: #92400e;
}
.af-pay-apply-plan-row {
  padding-top: 6px;
  border-top: 1px solid rgba(34, 197, 94, 0.18);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 850;
}
.af-pay-apply-plan-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.af-pay-apply-plan-row b {
  color: var(--text-primary);
  font-weight: 950;
  white-space: nowrap;
}
.af-pay-cheque {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid rgba(139, 92, 246, 0.26);
  border-radius: 10px;
  background: rgba(139, 92, 246, 0.06);
}
.af-pay-cheque-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.af-pay-cheque-title {
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 950;
}
.af-pay-cheque-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.af-pay-cheque-badge {
  align-self: flex-start;
  padding: 4px 8px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.08);
  color: #8b5cf6;
  font-size: 0.64rem;
  font-weight: 950;
}
.af-pay-cheque-empty,
.af-pay-cheque-status,
.af-pay-cheque-preview {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 800;
}
.af-pay-cheque-empty,
.af-pay-cheque-status {
  min-height: 42px;
  padding: 11px 12px;
}
.af-pay-cheque-preview {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 9px 10px;
  line-height: 1.35;
}
.af-pay-cheque-preview strong {
  color: #22c55e;
}
.af-pay-cheque-preview span {
  color: var(--text-muted);
}
.af-pay-cheque .form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.af-pay-cheque .form-row .form-group:last-child {
  grid-column: 1 / -1;
}
.af-pay-summary {
  align-self: start;
  position: sticky;
  top: 12px;
  display: grid;
  gap: 10px;
}
.af-pay-side-summary {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
}
.af-pay-side-title {
  padding: 2px 2px 4px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
}
.af-pay-summary-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
}
.af-pay-summary-card span,
.af-pay-summary-card b {
  display: block;
}
.af-pay-summary-card span {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}
.af-pay-summary-card b {
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 1.04rem;
  font-weight: 900;
}
.af-pay-summary-card.result {
  border-color: rgba(34, 197, 94, 0.26);
  background: rgba(34, 197, 94, 0.07);
}
.af-pay-summary-card.result b {
  color: #16a34a;
}
.af-pay-summary-card.danger {
  border-color: rgba(239, 68, 68, 0.32);
  background: rgba(239, 68, 68, 0.07);
}
.af-pay-summary-card.danger b {
  color: #dc2626;
}
[data-theme="light"] .af-pay-inhand-selected-note {
  color: #15803d;
}
[data-theme="light"] .af-pay-inhand-selected-note b {
  color: #166534;
}
[data-theme="light"] .af-pay-apply-plan-head b,
[data-theme="light"] .af-pay-cheque-preview strong {
  color: #15803d;
}
.af-pay-summary-card small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 850;
  line-height: 1.25;
}
.af-pay-summary-note {
  padding: 11px 12px;
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.07);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.4;
}
@media (max-width: 1040px) {
  .af-pay-shell {
    grid-template-columns: 1fr;
  }
  .af-pay-summary {
    position: static;
  }
  .af-pay-compact .af-pay-section:first-child {
    grid-template-columns: auto minmax(0, 1fr) auto minmax(150px, 180px);
  }
}
@media (max-width: 760px) {
  .af-pay-shell,
  .af-pay-split,
  .af-pay-math,
  .af-pay-split-ledger,
  .af-pay-method-grid,
  .af-pay-inhand-search {
    grid-template-columns: 1fr;
  }
  .af-pay-math-arrow {
    min-height: 10px;
  }
  .af-pay-inhand-cheque {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .af-pay-inhand-money {
    grid-column: 2;
    justify-items: start;
    text-align: left;
  }
  .af-pay-compact .af-pay-section:first-child {
    grid-template-columns: 1fr;
  }
  .af-pay-compact .af-pay-date-input {
    max-width: none;
  }
  .af-pay-supplier-simple #afsp-cash-card {
    grid-template-columns: 1fr;
  }
  .af-pay-extra-source-card {
    grid-template-columns: 1fr;
  }
  .af-pay-compact-cheque-search-row,
  .af-pay-compact-cheque-selected {
    grid-template-columns: 1fr;
  }
  .af-pay-simple-main {
    grid-template-columns: 1fr;
  }
}

/* Accounts Pay Center */
.af-paycenter-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 250px);
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(245, 197, 24, 0.1), transparent 44%),
    var(--bg-card);
}
.af-paycenter-hero.calm {
  background:
    linear-gradient(135deg, rgba(34, 197, 94, 0.09), transparent 44%),
    var(--bg-card);
}
.af-paycenter-kicker {
  color: var(--accent);
  font-size: 0.62rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.af-paycenter-hero h3 {
  margin: 3px 0 2px;
  color: var(--text-primary);
  font-size: 0.96rem;
  font-weight: 950;
}
.af-paycenter-hero p {
  margin: 0;
  max-width: 640px;
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.3;
}
.af-paycenter-total {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-elevated);
}
.af-paycenter-total span,
.af-paycenter-total em {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}
.af-paycenter-total b {
  margin: 3px 0;
  color: #ef4444;
  font-size: 1rem;
  font-weight: 950;
}
.af-paycenter-total button {
  min-height: 30px;
  margin-top: 4px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #1a1a00;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 950;
  cursor: pointer;
}
.af-paycenter-total button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.af-paycenter-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
.af-paycenter-stats div {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.af-paycenter-stats div.danger {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.06);
}
.af-paycenter-stats div.warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.06);
}
.af-paycenter-stats div.ready {
  border-color: rgba(14, 165, 233, 0.26);
  background: rgba(14, 165, 233, 0.06);
}
.af-paycenter-stats span,
.af-paycenter-stats b,
.af-paycenter-stats em {
  display: block;
}
.af-paycenter-stats span {
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 950;
  text-transform: uppercase;
}
.af-paycenter-stats b {
  margin-top: 2px;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.af-paycenter-stats em {
  margin-top: 1px;
  color: var(--text-secondary);
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 800;
}
.af-paycenter-plain-summary {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: -2px 0 10px;
}
.af-paycenter-plain-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.66rem;
  font-weight: 900;
}
.af-paycenter-plain-summary span.danger {
  border-color: rgba(239,68,68,0.28);
  background: rgba(239,68,68,0.08);
  color: #dc2626;
}
.af-paycenter-plain-summary span.warning {
  border-color: rgba(245,158,11,0.32);
  background: rgba(245,158,11,0.08);
  color: #b45309;
}
.af-paycenter-tools {
  display: grid;
  grid-template-columns: minmax(230px, 360px) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.af-paycenter-tools input {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.76rem;
}
.af-paycenter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.af-paycenter-chips button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
}
.af-paycenter-chips button.active {
  border-color: rgba(245, 197, 24, 0.55);
  background: rgba(245, 197, 24, 0.14);
  color: #b45309;
}
.af-paycenter-chips span {
  margin-left: 3px;
  color: inherit;
}
.af-paycenter-quickbar {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.af-paycenter-quickbar button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.af-paycenter-quickbar button:first-child {
  border-color: rgba(245,197,24,0.52);
  background: rgba(245,197,24,0.14);
  color: #8a6400;
}
.af-paycenter-quickbar span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(245,197,24,0.2);
}
.af-paycenter-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 8px;
  color: var(--text-primary);
}
.af-paycenter-list-head strong {
  font-size: 0.86rem;
  font-weight: 950;
}
.af-paycenter-list-head span {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 900;
}
.af-paycenter-list {
  display: grid;
  gap: 8px;
}
.af-paycenter-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 135px 126px 82px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}
.af-paycenter-row.danger {
  border-left-color: #ef4444;
  background: linear-gradient(90deg, rgba(239,68,68,0.07), var(--bg-card) 42%);
}
.af-paycenter-row.warning {
  border-left-color: #f59e0b;
  background: linear-gradient(90deg, rgba(245,158,11,0.07), var(--bg-card) 42%);
}
.af-paycenter-row.supplier .af-paycenter-icon { color: #6366f1; }
.af-paycenter-row.utility .af-paycenter-icon { color: #f59e0b; }
.af-paycenter-row.rental .af-paycenter-icon { color: #2563eb; }
.af-paycenter-row.vehicle .af-paycenter-icon { color: #06b6d4; }
.af-paycenter-row.petty .af-paycenter-icon { color: #22c55e; }
.af-paycenter-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--accent);
}
.af-paycenter-title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.af-paycenter-title span {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}
.af-paycenter-title strong {
  min-width: 0;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 950;
}
.af-paycenter-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 750;
}
.af-paycenter-amount {
  color: #ef4444;
  font-size: 0.84rem;
  font-weight: 950;
  text-align: right;
}
.af-paycenter-due {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: right;
}
.af-paycenter-due.danger {
  color: #ef4444;
}
.af-paycenter-due.warning {
  color: #d97706;
}
.af-paycenter-row button {
  min-height: 34px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  font-size: 0.74rem;
  font-weight: 950;
  cursor: pointer;
}
.af-paycenter-row button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.af-paycenter-empty {
  min-height: 190px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  color: var(--text-muted);
  text-align: center;
}
.af-paycenter-empty strong {
  color: var(--text-primary);
  font-size: 0.9rem;
}
.af-paycenter-empty span {
  font-size: 0.74rem;
  font-weight: 800;
}
@media (max-width: 860px) {
  .af-page {
    padding: 12px 12px 78px;
  }
  .af-page-head {
    align-items: stretch;
    flex-direction: column;
  }
  .af-page-actions {
    justify-content: stretch;
  }
  .af-page-actions button {
    flex: 1 1 140px;
  }
  .af-finance-status-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .af-finance-next {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .af-finance-mini-stats,
  .af-util-next-stats {
    justify-content: flex-start;
  }
  .af-finance-next button {
    justify-content: center;
  }
  .af-paycenter-hero,
  .af-paycenter-tools {
    grid-template-columns: 1fr;
  }
  .af-paycenter-quickbar {
    justify-content: flex-start;
  }
  .af-paycenter-stats,
  .af-paycenter-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .af-paycenter-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }
  .af-paycenter-amount,
  .af-paycenter-due,
  .af-paycenter-row button {
    grid-column: 2;
    text-align: left;
  }
  .af-util-next,
  .af-util-toolbar {
    grid-template-columns: 1fr;
  }
  .af-util-next button,
  .af-util-toolbar button {
    justify-content: center;
  }
  .af-util-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .af-util-row {
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: flex-start;
  }
  .af-util-row-actions {
    grid-column: 2;
    justify-items: stretch;
    min-width: 0;
  }
  .af-util-row-actions .primary {
    width: 100%;
  }
  .af-util-row-actions div {
    justify-content: flex-start;
  }
}
@media (max-width: 560px) {
  .af-finance-status-row {
    grid-template-columns: 1fr;
  }
  .af-paycenter-stats,
  .af-paycenter-actions {
    grid-template-columns: 1fr;
  }
  .af-util-status-grid {
    grid-template-columns: 1fr;
  }
  .af-util-row-title strong {
    width: 100%;
  }
}
.chq-meta {
  color: var(--text-muted);
}
.chq-meta strong {
  color: var(--accent);
}
.chq-bank-line {
  color: #2563eb;
  font-weight: 800;
}
.chq-bounce-line {
  color: #ef4444;
  font-weight: 800;
}
.chq-row-actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(76px, 1fr));
  gap: 4px;
  width: min(340px, 36vw);
  align-content: start;
  justify-items: stretch;
}
.chq-row-actions button {
  min-height: 28px;
  padding: 3px 7px !important;
  border-radius: 7px !important;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .chq-summary {
    align-items: flex-start;
    flex-direction: column;
  }
  .chq-summary-actions {
    justify-content: flex-start;
  }
  .chq-priority-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .chq-bank-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .chq-bank-toolbar-actions {
    justify-content: flex-start;
  }
  .chq-bank-kpis {
    grid-template-columns: 1fr;
  }
  .chq-archive-next-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .chq-archive-next-actions {
    justify-content: flex-start;
  }
  .chq-archive-next-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chq-archive-next-row {
    grid-template-columns: 1fr;
  }
  .chq-archive-row-side {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .chq-recon-next-hero {
    align-items: stretch;
    flex-direction: column;
  }
  .chq-recon-type-tabs {
    align-self: flex-start;
  }
  .chq-recon-next-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chq-recon-next-row {
    grid-template-columns: 1fr;
  }
  .chq-recon-row-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .chq-mini-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chq-row-inner {
    flex-wrap: wrap;
  }
  .chq-row-actions {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-left: 42px;
  }
}
@media (max-width: 560px) {
  .chq-page-head {
    align-items: stretch;
    flex-direction: column;
  }
  .chq-page-head .btn {
    width: 100%;
  }
  .chq-command-top {
    align-items: stretch;
    flex-direction: column;
  }
  .chq-bank-action {
    width: 100%;
  }
  .chq-bank-toolbar-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .chq-bank-card-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .chq-bank-totals {
    text-align: left;
  }
  .chq-priority-grid,
  .chq-mini-kpis {
    grid-template-columns: 1fr;
  }
  .chq-summary-main {
    flex-wrap: wrap;
    white-space: normal;
  }
  .chq-priority-chip {
    width: 100%;
    justify-content: flex-start;
  }
  .chq-bank-filter {
    border-radius: 12px;
  }
  .chq-archive-pagebar {
    align-items: stretch;
    flex-direction: column;
  }
  .chq-archive-pagebar > div {
    justify-content: space-between;
  }
  .chq-archive-next-kpis {
    grid-template-columns: 1fr;
  }
  .chq-archive-row-side {
    grid-template-columns: 1fr;
  }
  .chq-recon-next-kpis,
  .chq-recon-detail-grid {
    grid-template-columns: 1fr;
  }
  .chq-recon-row-actions {
    grid-template-columns: 1fr;
  }
  .chq-row-actions {
    grid-template-columns: 1fr;
    padding-left: 0;
  }
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-header h3 { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 16px; }

/* KPI Cards */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer; position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--kpi-color, var(--accent));
}
@media (hover: hover) and (pointer: fine) {
  .kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
}
.kpi-card:active { transform: scale(0.99); transition-duration: var(--dur-instant); }
.kpi-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--kpi-bg, var(--accent-glow)); }
.kpi-icon svg { width: 15px; height: 15px; color: var(--kpi-color, var(--accent)); }
.kpi-value { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); line-height: 1; }
.kpi-label { font-size: 0.68rem; color: var(--text-secondary); font-weight: 500; line-height: 1.3; }

/* Alert Banner */
.alert-banner {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 0.82rem;
  animation: fadeInScale var(--dur-std) var(--ease-out-quart);
}
/* Only critical alerts pulse — everyday banners stay calm */
.alert-banner.urgent { animation: pulse-border 2s ease-in-out infinite; }
.alert-danger { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.24); color: #dc2626; }
.alert-warning { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.24); color: #b45309; }
.alert-info { background: var(--blue-bg); border: 1px solid rgba(59,130,246,0.3); color: var(--blue); }
.alert-success { background: var(--green-bg); border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
@keyframes pulse-border { 0%,100% { opacity: 1; } 50% { opacity: 0.8; } }
@keyframes gps-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.7); } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  border: none; white-space: nowrap;
  transition: background-color var(--dur-micro) ease,
              color var(--dur-micro) ease,
              border-color var(--dur-micro) ease,
              transform var(--dur-micro) var(--ease-out-quart),
              box-shadow var(--dur-micro) ease;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
/* Press feedback — skill's #1 practical tip */
.btn:active { transform: scale(0.97); transition-duration: var(--dur-instant); }
.btn-primary { background: var(--accent); color: #1a1a00; }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border); }
.btn-danger { background: var(--red-bg); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-success { background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
/* Hover only on devices with real hover — avoids tap-flicker on mobile */
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--accent-dim); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245,197,24,0.25); }
  .btn-secondary:hover { background: var(--border); }
  .btn-danger:hover { background: var(--red); color: #fff; }
  .btn-success:hover { background: var(--green); color: #fff; }
}
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-lg { padding: 14px 24px; font-size: 0.95rem; border-radius: var(--radius); }
.btn-full { width: 100%; }
.btn svg { width: 16px; height: 16px; }

/* Compact payroll detail modal actions */
.bf-pay-detail-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  padding: 10px 14px;
}
.bf-pay-detail-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.bf-pay-detail-actions.right {
  justify-content: flex-end;
  margin-left: auto;
}
.bf-pay-detail-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: none !important;
}
.bf-pay-detail-btn.soft {
  background: rgba(99,102,241,0.07);
  border-color: rgba(99,102,241,0.26);
  color: #4f46e5;
}
.bf-pay-detail-btn.primary {
  min-width: 82px;
}
.bf-pay-detail-link {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(99,102,241,0.22);
  border-radius: 10px;
  background: rgba(99,102,241,0.06);
  color: #4f46e5;
  display: inline-flex;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .bf-pay-detail-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .bf-pay-detail-actions,
  .bf-pay-detail-actions.right {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-left: 0;
  }
  .bf-pay-detail-btn,
  .bf-pay-detail-link {
    width: 100%;
  }
}

/* Quick Action Buttons */
.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.quick-action-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: all var(--transition); text-align: center;
}
@media (hover: hover) and (pointer: fine) {
  .quick-action-btn:hover { background: var(--accent-glow); border-color: rgba(245,197,24,0.3); transform: translateY(-2px); }
}
.quick-action-btn:active { transform: scale(0.97); transition-duration: var(--dur-instant); }
.quick-action-btn svg { width: 28px; height: 28px; color: var(--accent); }
.quick-action-btn span { font-size: 0.75rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-control {
  width: 100%; padding: 12px 14px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--dur-micro) ease,
              box-shadow var(--dur-std) var(--ease-out-quart);
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg-elevated); color: var(--text-primary); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.form-actions .btn { flex: 1; }

/* Result Selector */
.result-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.result-option { display: none; }
.result-label {
  padding: 10px 8px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); text-align: center;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition); color: var(--text-secondary);
}
.result-option:checked + .result-label.approved { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.result-option:checked + .result-label.rejected { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.result-option:checked + .result-label.hold { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }
.result-label:hover { border-color: var(--border-light); color: var(--text-primary); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 600; white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-grey { background: var(--bg-elevated); color: var(--text-secondary); }

/* Tables */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
thead { background: var(--bg-elevated); }
th { padding: 10px 12px; text-align: left; font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
td { padding: 12px; border-top: 1px solid var(--border); color: var(--text-primary); vertical-align: middle; }
tr:hover td { background: var(--bg-elevated); }

/* List Items */
.list-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 10px; transition: all var(--transition); cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .list-item:hover { border-color: var(--border-light); transform: translateY(-1px); box-shadow: var(--shadow-card); }
}
.list-item:active { transform: scale(0.995); transition-duration: var(--dur-instant); }
.list-item-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.list-item-body { flex: 1; min-width: 0; }
.list-item-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item-sub { font-size: 0.75rem; color: var(--text-secondary); margin-top: 3px; }
.list-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }

/* Modals — overlay + modal are paired elements (same duration + easing) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 1200; display: none; align-items: flex-end; justify-content: center;
  /* backdrop-filter only on capable hardware — omit on mobile for GPU budget */
}
@supports (backdrop-filter: blur(4px)) {
  @media (min-width: 768px) {
    .modal-overlay { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
  }
}
.modal-overlay.open { display: flex; animation: overlayFade var(--dur-modal) var(--ease-out-quart); }
.modal {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 600px;
  max-height: 92vh; overflow-y: auto;
  animation: modalIn var(--dur-modal) var(--ease-out-quart);
  padding-bottom: calc(env(safe-area-inset-bottom) + 16px);
  will-change: transform;
  transform-origin: bottom center;
}
.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  animation: modalIn var(--dur-modal) var(--ease-out-quart);
}
/* Enter from a subtle lift + 98% scale — no "appearing from nowhere" */
@keyframes modalIn {
  from { transform: translateY(20px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes overlayFade { from { opacity: 0; } to { opacity: 1; } }
/* Legacy name kept so inline code that references it still works */
@keyframes slideUp {
  from { transform: translateY(20px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-header {
  position: sticky; top: 0;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  padding: 16px 20px; display: flex; align-items: center;
  justify-content: space-between; z-index: 1;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.modal-close { background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 6px; border-radius: var(--radius-sm); }
.modal-close:hover { background: var(--bg-elevated); color: var(--text-primary); }
/* Extra bottom padding so last buttons are always above device chrome & reachable */
.modal-body { padding: 20px; padding-bottom: calc(env(safe-area-inset-bottom) + 60px); overflow-x: hidden; }

/* Batch Opening Balance modal */
#cm-batch-ob-modal {
  padding: 16px;
}
#cm-batch-ob-modal .cm-batch-ob-dialog {
  width: min(96vw, 720px);
  max-height: min(90vh, 760px);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 18px;
}
.cm-batch-ob-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.cm-batch-ob-title {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 900;
}
.cm-batch-ob-subtitle {
  color: var(--text-muted);
  font-size: 0.7rem;
  margin-top: 2px;
}
.cm-batch-ob-close {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}
.cm-batch-ob-close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.cm-batch-ob-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-width: 0;
  margin-bottom: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.cm-batch-ob-search {
  flex: 1 1 280px;
  min-width: 200px;
  height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
}
.cm-batch-ob-date-field {
  display: flex;
  flex: 0 0 150px;
  flex-direction: column;
  gap: 3px;
}
.cm-batch-ob-date-field span {
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 800;
}
.cm-batch-ob-date-field input {
  height: 42px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
}
.cm-batch-ob-search:focus,
.cm-batch-ob-date-field input:focus,
.cm-batch-ob-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.cm-batch-ob-table-wrap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 200px;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.cm-batch-ob-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--bg-card);
}
.cm-batch-ob-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.cm-batch-ob-table th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: left;
}
.cm-batch-ob-table th:nth-child(2),
.cm-batch-ob-table th:nth-child(3) {
  text-align: right;
}
.cm-batch-ob-row {
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.cm-batch-ob-row:nth-child(even) {
  background: color-mix(in srgb, var(--bg-elevated) 32%, var(--bg-card));
}
.cm-batch-ob-row:last-child {
  border-bottom: 0;
}
.cm-batch-ob-empty {
  padding: 30px 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}
.cm-batch-ob-table td {
  padding: 9px 12px;
  vertical-align: middle;
}
.cm-batch-ob-customer-cell {
  min-width: 0;
}
.cm-batch-ob-name {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cm-batch-ob-place,
.cm-batch-ob-history {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cm-batch-ob-place {
  margin-top: 2px;
}
.cm-batch-ob-prev-cell,
.cm-batch-ob-input-cell {
  text-align: right;
}
.cm-batch-ob-prev {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
}
.cm-batch-ob-prev.has-balance {
  color: var(--text-primary);
}
.cm-batch-ob-history {
  margin-top: 2px;
}
.cm-batch-ob-input {
  width: 100%;
  max-width: 130px;
  height: 36px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.82rem;
  text-align: right;
  outline: none;
}
.cm-batch-ob-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  margin-top: 14px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.cm-batch-ob-summary {
  color: var(--text-muted);
  font-size: 0.7rem;
}
.cm-batch-ob-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 640px) {
  #cm-batch-ob-modal {
    padding: 8px;
  }
  #cm-batch-ob-modal .cm-batch-ob-dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: 92vh;
    padding: 12px;
    border-radius: 16px;
  }
  .cm-batch-ob-controls,
  .cm-batch-ob-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .cm-batch-ob-search,
  .cm-batch-ob-date-field,
  .cm-batch-ob-actions {
    width: 100%;
  }
  .cm-batch-ob-search,
  .cm-batch-ob-date-field {
    flex: 0 0 auto;
    min-width: 0;
  }
  .cm-batch-ob-date-field {
    flex-basis: auto;
  }
  .cm-batch-ob-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .cm-batch-ob-actions .btn {
    min-width: 0;
    width: auto;
  }
}

/* Full Page Create Invoice Modal for Performance */
#sales-order-modal.modal-overlay {
  background: var(--bg-surface);
  align-items: flex-start;
  z-index: 1100;
}
#sales-order-modal .modal {
  width: 100vw;
  max-width: 100vw;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
  border: none;
  margin: 0;
  animation: none !important;
  box-shadow: none;
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}
@supports (height: 100dvh) {
  #sales-order-modal .modal {
    height: 100dvh;
    max-height: 100dvh;
  }
}
#sales-order-modal .modal-header {
  border-radius: 0;
  flex-shrink: 0;
}
#sales-order-modal .modal-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y; /* Android: allow vertical scroll inside modal */
}
#sales-order-form .so-invoice-actions {
  position: static;
  z-index: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: none;
  margin: 10px 0 calc(env(safe-area-inset-bottom, 0px) + 18px);
}
.so-credit-gate {
  margin-top: 10px;
  border-radius: 12px;
  padding: 12px;
  border: 1.5px solid rgba(245,158,11,0.38);
  background: rgba(245,158,11,0.08);
  color: var(--text-primary);
}
.so-credit-gate-danger {
  border-color: rgba(239,68,68,0.42);
  background: rgba(239,68,68,0.08);
}
.so-credit-gate-pending {
  border-color: rgba(59,130,246,0.38);
  background: rgba(59,130,246,0.08);
}
.so-credit-gate-ok {
  border-color: rgba(34,197,94,0.38);
  background: rgba(34,197,94,0.08);
}
.so-credit-gate-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.so-credit-gate-copy strong {
  font-size: 0.86rem;
  font-weight: 950;
}
.so-credit-gate-copy span,
.so-credit-gate-copy em {
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--text-muted);
  font-style: normal;
}
.so-credit-gate-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.so-credit-gate-btn {
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}
.so-credit-gate-request {
  border: none;
  background: #f59e0b;
  color: #fff;
}
.so-credit-gate-pay {
  border: none;
  background: #22c55e;
  color: #fff;
}
.so-credit-gate-btn:disabled {
  cursor: not-allowed;
  opacity: 0.75;
}
.so-credit-disabled-section {
  opacity: 0.42;
  filter: grayscale(0.35);
  position: relative;
}
.so-credit-disabled-section::after {
  content: "Credit approval required";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: rgba(255,255,255,0.34);
  color: #b45309;
  font-weight: 950;
  font-size: 0.84rem;
  pointer-events: none;
}
[data-theme="dark"] .so-credit-disabled-section::after {
  background: rgba(15,23,42,0.38);
}
.so-sync-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.so-sync-copy {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}
.so-sync-status strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
}
.so-sync-status small {
  display: block;
  margin-top: 1px;
  color: var(--text-muted);
  font-size: 0.62rem;
  line-height: 1.35;
}
.so-sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  margin-top: 3px;
  background: #22c55e;
}
.so-sync-online .so-sync-dot { background: #22c55e; }
.so-sync-offline .so-sync-dot,
.so-sync-pending .so-sync-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245,158,11,0.14);
}
.so-sync-pending {
  border-color: rgba(245,158,11,0.38);
  background: rgba(245,158,11,0.08);
}
.so-sync-offline {
  border-color: rgba(239,68,68,0.32);
  background: rgba(239,68,68,0.07);
}
.so-sync-date-field {
  flex: 0 0 178px;
  min-width: 168px;
}
.so-sync-date-field .so-doc-input {
  min-height: 36px;
  height: 36px;
  padding-left: 12px;
  padding-right: 8px;
  border-radius: 10px;
  font-size: 0.74rem;
}
.so-date-lock-note {
  margin-top: 4px;
  color: #b45309;
  font-size: 0.58rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: right;
}
.so-sticky-summary {
  position: static;
  z-index: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 9px 10px;
  margin: 8px 0 10px;
  box-shadow: none;
}
.so-sticky-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1.1;
}
.so-sticky-total {
  color: var(--accent);
  font-size: 1rem;
  font-weight: 950;
  line-height: 1.2;
}
.so-paid-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 800;
}
.so-add-total-btn {
  min-height: 30px;
  border: 1px solid rgba(34,197,94,0.35);
  border-radius: 10px;
  background: rgba(34,197,94,0.1);
  color: #16a34a;
  padding: 0 11px;
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.so-paid-full-btn {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(34,197,94,0.35);
  background: rgba(34,197,94,0.12);
  color: #22c55e;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}
.so-quick-reorder-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(59,130,246,0.3);
  background: rgba(59,130,246,0.08);
}
.so-quick-reorder-card strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--text-primary);
}
.so-quick-reorder-card small {
  display: block;
  margin-top: 2px;
  font-size: 0.66rem;
  color: var(--text-muted);
}
.so-quick-reorder-card button,
.so-show-all-products {
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(59,130,246,0.35);
  background: rgba(59,130,246,0.12);
  color: #3b82f6;
  font-size: 0.74rem;
  font-weight: 900;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
}
.so-chip-title {
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.so-chip-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.so-chip-row button {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}
.so-qty-stepper {
  display: grid;
  grid-template-columns: 36px minmax(56px,1fr) 36px;
  gap: 5px;
  align-items: center;
}
.so-qty-stepper button {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1.05rem;
  font-weight: 950;
  cursor: pointer;
  touch-action: manipulation;
}
.sr-route-head,
.sr-sync-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-card);
  padding: 14px;
  margin-bottom: 12px;
}
.sr-route-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sr-route-head h2,
.sr-sync-card h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 950;
}
.sr-route-head p,
.sr-sync-card p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
}
.sr-route-head span {
  min-width: 34px;
  height: 34px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #1a1a00;
  font-weight: 950;
}
.sr-route-card {
  display: grid;
  grid-template-columns: minmax(0,1fr);
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  padding: 12px;
  margin-bottom: 8px;
}
.sr-route-main strong {
  display: block;
  font-size: 0.86rem;
  font-weight: 950;
  color: var(--text-primary);
}
.sr-route-main small {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
}
.sr-route-actions {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 7px;
}
.sr-route-actions button,
.sr-sync-card button,
.sr-sync-queue button {
  min-height: 42px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 900;
  cursor: pointer;
}
.sr-route-actions button:nth-child(2) {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a00;
}
.sr-route-actions button:nth-child(4) {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.25);
  color: #ef4444;
}
.sr-route-actions button.is-done {
  background: rgba(34,197,94,0.12);
  border-color: rgba(34,197,94,0.35);
  color: #22c55e;
}
@media (max-width: 390px) {
  .sr-route-actions {
    grid-template-columns: repeat(2,1fr);
  }
}
.sr-sync-card {
  text-align: center;
}
.sr-sync-big-dot {
  width: 18px;
  height: 18px;
  display: inline-block;
  border-radius: 50%;
  background: #22c55e;
  margin-bottom: 10px;
}
.sr-sync-pending .sr-sync-big-dot,
.sr-sync-offline .sr-sync-big-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 8px rgba(245,158,11,0.14);
}
.sr-sync-actions {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 8px;
  margin-top: 12px;
}
.sr-sync-card button {
  margin-top: 12px;
  padding: 0 16px;
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1a00;
}
.sr-sync-actions button {
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}
.sr-sync-actions button:nth-child(2) {
  background: rgba(59,130,246,0.08);
  border-color: rgba(59,130,246,0.28);
  color: #2563eb;
}
.sr-sync-lines {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.sr-sync-lines div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.sr-sync-lines div:last-child {
  border-bottom: 0;
}
.sr-sync-lines span {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
}
.sr-sync-lines strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
}
.sr-sync-health {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  overflow: hidden;
}
.sr-sync-health-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.sr-sync-health-head strong {
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.sr-sync-health-head button {
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(59,130,246,0.26);
  background: rgba(59,130,246,0.08);
  color: #2563eb;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 900;
  cursor: pointer;
}
.sr-sync-health-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
}
.sr-sync-health-grid div {
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.sr-sync-health-grid div:nth-child(2n) {
  border-right: 0;
}
.sr-sync-health-grid div:nth-last-child(-n+2) {
  border-bottom: 0;
}
.sr-sync-health-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 850;
  margin-bottom: 4px;
}
.sr-sync-health-grid strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.76rem;
  font-weight: 950;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.sr-sync-queue {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  overflow: hidden;
}
.sr-sync-queue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.sr-sync-queue-head strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 950;
}
.sr-sync-queue-head span,
.sr-sync-queue-main span,
.sr-sync-queue-empty span {
  display: block;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.35;
}
.sr-sync-queue-head > div:last-child {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}
.sr-sync-queue button {
  min-height: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.7rem;
}
.sr-sync-queue button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sr-sync-queue-head button:first-child {
  color: #2563eb;
  border-color: rgba(59,130,246,0.26);
  background: rgba(59,130,246,0.08);
}
.sr-sync-queue-head button:last-child,
.sr-sync-queue-actions button:last-child {
  color: #ef4444;
  border-color: rgba(239,68,68,0.25);
  background: rgba(239,68,68,0.08);
}
.sr-sync-queue-tools {
  display: grid;
  grid-template-columns: auto minmax(220px,1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.sr-sync-queue-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
}
.sr-sync-queue-tabs button {
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
}
.sr-sync-queue-tabs button.active {
  background: var(--accent);
  color: #111827;
  box-shadow: 0 1px 3px rgba(15,23,42,0.12);
}
.sr-sync-queue-tools input {
  min-height: 36px;
  font-size: 0.78rem;
}
.sr-sync-clear-problems {
  color: #ef4444;
  border-color: rgba(239,68,68,0.25);
  background: rgba(239,68,68,0.08);
}
.sr-sync-queue-list {
  display: grid;
  gap: 0;
}
.sr-sync-queue-item {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.sr-sync-queue-item.problem {
  background: rgba(239,68,68,0.04);
  border-left: 4px solid #ef4444;
}
.sr-sync-queue-item:last-child {
  border-bottom: 0;
}
.sr-sync-queue-main {
  min-width: 0;
}
.sr-sync-queue-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sr-sync-queue-main strong,
.sr-sync-queue-title strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sr-sync-queue-title b {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(239,68,68,0.12);
  color: #ef4444;
  font-size: 0.64rem;
  font-weight: 950;
}
.sr-sync-queue-main small {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.sr-sync-queue-main em {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 750;
}
.sr-sync-queue-main .sr-sync-queue-error {
  color: #ef4444;
}
.sr-sync-queue-main .sr-sync-queue-help {
  color: #b45309;
}
.sr-sync-queue-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}
.sr-sync-queue-chips i {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(59,130,246,0.18);
  background: rgba(59,130,246,0.08);
  color: #2563eb;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 950;
}
.sr-sync-queue-details {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(150px,1fr));
  gap: 2px 10px;
  margin-top: 7px;
}
.sr-sync-queue-actions {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
}
.sr-sync-queue-actions button:first-child:not(:last-child) {
  color: #2563eb;
  border-color: rgba(59,130,246,0.26);
  background: rgba(59,130,246,0.08);
}
.sr-sync-queue-empty {
  padding: 18px 12px;
  text-align: center;
}
.sr-sync-queue-empty strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 950;
  margin-bottom: 4px;
}
@media (max-width: 430px) {
  .sr-sync-actions {
    grid-template-columns: 1fr;
  }
  .sr-sync-queue-head {
    align-items: stretch;
    flex-direction: column;
  }
  .sr-sync-queue-head > div:last-child {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .sr-sync-queue-tools {
    grid-template-columns: 1fr;
  }
  .sr-sync-queue-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .sr-sync-queue-item {
    grid-template-columns: 1fr;
  }
  .sr-sync-queue-actions {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  .sr-sync-health-grid {
    grid-template-columns: 1fr;
  }
  .sr-sync-health-grid div {
    border-right: 0;
  }
  .sr-sync-health-grid div:nth-last-child(2) {
    border-bottom: 1px solid var(--border);
  }
}
.so-field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.so-invoice-head {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 10px 10px;
  margin-bottom: 10px;
}
.so-doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
  align-items: start;
}
.so-doc-field {
  min-width: 0;
}
.so-doc-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.so-doc-label span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}
.so-doc-input {
  min-height: 44px;
  height: 44px;
  font-size: 0.88rem;
  border-radius: 10px;
}
.so-doc-number-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: stretch;
}
.so-doc-next-btn {
  min-width: 58px;
  min-height: 44px;
  border: 1px solid rgba(214,170,0,0.42);
  border-radius: 10px;
  background: rgba(245,197,24,0.12);
  color: #9a6b00;
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
}
.so-doc-next-btn:hover {
  background: rgba(245,197,24,0.2);
  border-color: rgba(214,170,0,0.62);
}
.so-doc-readonly {
  background: var(--bg-card) !important;
  color: var(--text-muted) !important;
  font-weight: 800;
}
.so-doc-chip,
.so-manual-next-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 17px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
  flex-shrink: 0;
}
.so-doc-chip-blue {
  background: rgba(37,99,235,0.12);
  border-color: rgba(37,99,235,0.28);
  color: #2563eb;
}
.so-manual-next-chip {
  background: rgba(34,197,94,0.10);
  border-color: rgba(34,197,94,0.28);
  color: #16a34a;
}
#sales-order-form .so-doc-input[type="date"] {
  max-width: none !important;
  width: 100% !important;
}
@media (max-width: 680px) {
  .so-sync-status {
    gap: 7px;
    padding: 7px 8px;
  }
  .so-sync-date-field {
    flex-basis: 166px;
    min-width: 158px;
  }
  .so-sync-status small {
    font-size: 0.58rem;
  }
  .so-invoice-head {
    padding: 8px;
    margin-bottom: 8px;
  }
  .so-doc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .so-doc-label {
    min-height: 17px;
    font-size: 0.52rem;
    gap: 3px;
  }
  .so-doc-chip,
  .so-manual-next-chip {
    min-height: 16px;
    padding: 0 5px;
    font-size: 0.5rem;
  }
  .so-doc-input {
    min-height: 40px;
    height: 40px;
    padding: 7px 8px;
    font-size: 0.78rem !important;
    border-radius: 10px;
  }
  .so-doc-next-btn {
    min-width: 50px;
    min-height: 40px;
    padding: 0 8px;
    font-size: 0.68rem;
  }
}
@media (max-width: 420px) {
  .so-sync-copy {
    gap: 7px;
  }
  .so-sync-status strong {
    font-size: 0.78rem;
  }
  .so-sync-date-field {
    flex-basis: 158px;
    min-width: 150px;
  }
  .so-sync-date-field .so-doc-input {
    min-height: 34px;
    height: 34px;
    padding-left: 9px;
    padding-right: 6px;
    font-size: 0.66rem !important;
  }
  .so-doc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }
  .so-doc-chip:not(.so-doc-chip-blue),
  .so-manual-next-chip {
    display: none !important;
  }
  .so-doc-input {
    padding-left: 7px;
    padding-right: 7px;
  }
}
.so-locked-chip {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}
#so-date.so-date-locked,
#so-date:disabled {
  background: #fff !important;
  border-color: rgba(245, 158, 11, 0.42) !important;
  color: var(--text-primary) !important;
  opacity: 1;
  cursor: not-allowed;
  -webkit-text-fill-color: var(--text-primary);
}
.so-new-customer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #1a1a00;
  font-size: 0.68rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}
.so-new-customer-btn:active {
  transform: scale(0.98);
}
/* Ensure no form control overflows modal width */
.modal-body input,
.modal-body select,
.modal-body textarea { max-width: 100%; box-sizing: border-box; }

/* User permission editor */
#um-perm-modal {
  align-items: center;
  padding: 18px;
}
#um-perm-modal .um-perm-modal {
  width: min(1180px, calc(100vw - 36px));
  max-width: min(1180px, calc(100vw - 36px)) !important;
  max-height: min(88vh, 920px);
  border-radius: 20px;
  overflow: hidden;
  padding-bottom: 0;
}
#um-perm-modal .um-perm-header {
  padding: 18px 22px;
}
#um-perm-modal .um-perm-header h3 {
  font-size: 1.1rem;
  font-weight: 900;
}
#um-perm-body.um-perm-body {
  padding: 16px 18px 0;
  max-height: calc(min(88vh, 920px) - 68px);
  overflow-y: auto;
}
.um-perm-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
}
.um-perm-role {
  font-size: 0.86rem;
  color: var(--text-primary);
}
.um-perm-note {
  margin-top: 3px;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.um-perm-count {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}
.um-perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 12px;
  align-items: start;
}
.um-perm-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.um-perm-group-title {
  position: sticky;
  top: -16px;
  z-index: 1;
  padding: 10px 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.um-perm-items {
  display: grid;
  gap: 7px;
  padding: 10px;
}
.um-perm-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid transparent;
}
.um-perm-row.is-overridden {
  background: rgba(59,130,246,0.08);
  border-color: rgba(59,130,246,0.28);
}
.um-perm-row-main {
  min-width: 0;
}
.um-perm-row-title {
  color: var(--text-primary);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.25;
}
.um-perm-row.is-overridden .um-perm-row-title {
  color: #3b82f6;
}
.um-perm-row-sub {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.68rem;
}
.um-perm-row-sub .yes {
  color: #22c55e;
  font-weight: 900;
}
.um-perm-row-sub .no {
  color: #ef4444;
  font-weight: 900;
}
.um-perm-row-sub strong {
  color: #3b82f6;
}
.um-perm-select {
  width: 100%;
  min-height: 38px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
}
.um-perm-select.is-overridden {
  border-color: #3b82f6;
  color: #3b82f6;
}
.um-perm-actions {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(220px, 1fr);
  gap: 12px;
  margin: 14px -18px 0;
  padding: 14px 18px calc(env(safe-area-inset-bottom, 0px) + 14px);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -12px 28px rgba(15, 23, 42, 0.12);
}
.um-perm-actions .btn {
  min-height: 48px;
  font-size: 0.88rem;
  font-weight: 900;
}

@media (min-width: 1320px) {
  #um-perm-modal .um-perm-modal {
    width: min(1320px, calc(100vw - 52px));
    max-width: min(1320px, calc(100vw - 52px)) !important;
  }
  .um-perm-grid {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  }
}

@media (max-width: 767px) {
  #um-perm-modal {
    align-items: flex-start;
    padding: 0;
  }
  #um-perm-modal .um-perm-modal {
    width: 100vw;
    max-width: 100vw !important;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  #um-perm-body.um-perm-body {
    max-height: calc(100dvh - 64px);
    padding: 12px 12px 0;
  }
  .um-perm-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .um-perm-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .um-perm-row {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
  }
  .um-perm-select {
    min-height: 44px;
  }
  .um-perm-actions {
    grid-template-columns: 1fr;
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }
}


/* Workflow Stepper */
.workflow-stepper { display: flex; flex-direction: column; gap: 0; margin: 16px 0; }
.workflow-step { display: flex; gap: 12px; }
.step-connector { display: flex; flex-direction: column; align-items: center; }
.step-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; flex-shrink: 0;
  border: 2px solid var(--border);
  background: var(--bg-elevated); color: var(--text-muted);
}
.step-dot.active { background: var(--accent); color: #1a1a00; border-color: var(--accent); }
.step-dot.done { background: var(--green); color: #fff; border-color: var(--green); }
.step-line { width: 2px; flex: 1; min-height: 24px; background: var(--border); margin: 2px 0; }
.step-line.done { background: var(--green); }
.step-content { padding: 4px 0 20px; flex: 1; }
.step-label { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); line-height: 32px; }
.step-notes { font-size: 0.75rem; color: var(--text-secondary); margin-top: 4px; }

/* Accordion */
.accordion-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.accordion-header {
  padding: 14px 16px; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-card); transition: background var(--transition);
}
.accordion-header:hover { background: var(--bg-elevated); }
.accordion-header h4 { font-size: 0.88rem; font-weight: 600; color: var(--text-primary); }
.accordion-header .chevron { transition: transform var(--dur-std) var(--ease-out-quart); color: var(--text-muted); }
.accordion-header.open .chevron { transform: rotate(180deg); }
.accordion-body { display: none; padding: 16px; background: var(--bg-elevated); border-top: 1px solid var(--border); }
.accordion-body.open { display: block; }

/* Tabs */
.tabs { display: flex; gap: 4px; background: var(--bg-elevated); padding: 4px; border-radius: var(--radius-sm); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 8px 14px; border-radius: 6px; border: none; background: none;
  color: var(--text-secondary); font-size: 0.82rem; font-weight: 500;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: background-color var(--dur-micro) ease,
              color var(--dur-micro) ease,
              box-shadow var(--dur-std) var(--ease-out-quart);
  -webkit-tap-highlight-color: transparent;
}
.tab-btn:active { transform: scale(0.97); transition-duration: var(--dur-instant); }
.tab-btn.active { background: var(--bg-card); color: var(--accent); box-shadow: var(--shadow-card); }

/* All module-level tab bars — always single scrollable row, never wrap */
.tab-bar-scroll {
  display: flex; gap: 0;
  flex-wrap: nowrap; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 2px solid var(--border);
  margin-bottom: 14px;
}
.tab-bar-scroll::-webkit-scrollbar { display: none; }

/* Mobile responsive adjustments (< 768px) */
@media (max-width: 767px) {
  /* Compact page header */
  .module-title { font-size: 1.1rem !important; }
  .module-subtitle { font-size: 0.68rem !important; }

  /* Single-column forms on mobile */
  .form-row { grid-template-columns: 1fr !important; }
  .form-control { font-size: 0.85rem; padding: 10px 12px; }
  .form-label { font-size: 0.72rem; }
  /* Date inputs — don't stretch full width */
  input[type="date"].form-control { max-width: 160px; width: auto; }

  /* KPI cards — 2 columns */
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .kpi-value { font-size: 1.1rem; }

  /* Buttons */
  .btn { font-size: 0.8rem; padding: 9px 14px; }
  .btn-sm { font-size: 0.72rem; padding: 5px 9px; }

  /* Modals */
  .modal { max-height: 92vh; }
  .modal-body { padding: 14px; padding-bottom: calc(env(safe-area-inset-bottom) + 60px); }

  /* Tables */
  table { font-size: 0.74rem; }
  th, td { padding: 7px 9px; }

  /* Inline tab containers in module JS — force no-wrap scroll */
  div[style*="overflow-x:auto"] { flex-wrap: nowrap !important; }


  /* Disable expensive hover transforms on touch devices */
  .kpi-card:hover { transform: none; box-shadow: var(--shadow-card); }
  .list-item:hover { transform: none; }
  .quick-action-btn:hover { transform: none; }
  .btn-primary:hover { transform: none; }

  /* Disable transition on all cards (costly on mobile repaint) */
  .kpi-card, .list-item, .nav-item, .bottom-nav-item { transition: none; }

  /* Touch-friendly scrolling */
  #sidebar-nav, .modal-body, #main-content, .page {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y; /* Android: allow vertical scroll gesture */
  }

  /* Faster scroll on tables */
  .table-wrapper { -webkit-overflow-scrolling: touch; }

  /* Eliminate 300ms tap delay on all interactive elements */
  button, a, select, label, [onclick], .nav-item, .bottom-nav-item,
  .kpi-card, .list-item, .quick-action-btn, .tab-btn {
    touch-action: manipulation;
  }

  /* No transition on inputs — instant feedback */
  .form-control, input, select, textarea {
    transition: none !important;
  }

  /* Reduce paint cost: simpler focus ring */
  .form-control:focus, input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 2px var(--accent);
    outline: none;
  }

  /* ── Budget device GPU budget ─────────────────────────────── */

  /* Kill will-change on mobile — it reserves GPU memory per element */
  *, *::before, *::after { will-change: auto !important; }
  /* Re-enable only for active modals sliding in (single element at a time) */
  .modal.open, .modal-overlay.open { will-change: transform; }

  /* No box-shadow stacking — replace with single-layer border */
  .kpi-card  { box-shadow: none !important; border: 1px solid var(--border); }
  .list-item { box-shadow: none !important; }
  .card      { box-shadow: none !important; border: 1px solid var(--border); }

  /* Remove all decorative backdrop-filter blurs */
  * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  /* Keep modal overlay readable without blur */
  .modal-overlay { background: rgba(0,0,0,0.82) !important; }

  /* Kill staggered entry animations — saves 420ms of blocked compositing */
  #sales-kpi-grid > div    { animation: none !important; opacity: 1 !important; transform: none !important; }
  .sls-stock-chip          { animation: none !important; opacity: 1 !important; transform: none !important; }
  .fl-tab, .tab-btn        { animation: none !important; }

  /* Minimum 44px tap target for all tab/pill buttons */
  [role="tab"], .fl-tab, .tab-btn {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Sales module tab bar — bigger tap strip */
  #sales-tab-bar-desktop button {
    padding: 11px 13px;
    min-height: 44px;
  }

  /* Bottom nav: reduce transition cost */
  #sr-bottom-nav button { transition: color 0.08s linear; }

  /* Prevent text selection flicker on repeated taps */
  button, .nav-item, .list-item, .kpi-card,
  #sr-bottom-nav button { user-select: none; -webkit-user-select: none; }
}



/* Score Bar */
.score-bar { margin: 8px 0; }
.score-bar-label { display: flex; justify-content: space-between; font-size: 0.78rem; margin-bottom: 4px; }
.score-bar-track { height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.score-high { background: var(--green); }
.score-med { background: var(--amber); }
.score-low { background: var(--red); }

/* Stat Row */
.stat-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: none; }
.stat-label { font-size: 0.82rem; color: var(--text-secondary); }
.stat-value { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }

/* Photo Upload */
.photo-upload-zone {
  border: 2px dashed var(--border-light); border-radius: var(--radius);
  padding: 24px; text-align: center; cursor: pointer;
  transition: all var(--transition); background: var(--bg-elevated);
}
.photo-upload-zone:hover { border-color: var(--accent); background: var(--accent-glow); }
.photo-upload-zone svg { width: 32px; height: 32px; color: var(--text-muted); margin-bottom: 8px; }
.photo-upload-zone p { font-size: 0.82rem; color: var(--text-secondary); }
.photo-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.photo-thumb { width: 72px; height: 72px; border-radius: var(--radius-sm); object-fit: cover; border: 2px solid var(--border); }

/* Empty State */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 0.88rem; }

/* Search Bar */
.search-bar { position: relative; margin-bottom: 16px; }
.search-bar svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); }
.search-bar input { padding-left: 38px; }

/* Compliance Expiry Status */
.expiry-valid { color: var(--green); }
.expiry-soon { color: var(--amber); }
.expiry-expired { color: var(--red); }

/* Chart Container */
.chart-container { position: relative; height: 220px; margin: 12px 0; }

/* QR Code display */
.qr-display { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; }
.qr-display canvas, .qr-display img { border: 4px solid #fff; border-radius: 8px; }
.qr-label { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); text-align: center; }
.qr-sublabel { font-size: 0.72rem; color: var(--text-secondary); text-align: center; }

/* Section title */
.section-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin: 20px 0 10px; }

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { display: flex; gap: 8px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* ── Mobile Base (all screens) ──────────────────────── */
.page { padding: 12px; }

/* ── Tablet / Desktop (768px+) ──────────────────────── */
@media (min-width: 768px) {
  #app-shell.visible { gap: 0; }
  #top-header { display: none; }
  #sidebar { position: fixed; transform: translateX(0); }
  #sidebar.sidebar-desktop { transform: translateX(0); }
  #main-content {
    margin-left: var(--sidebar-width);
    margin-top: 0;
    height: 100vh;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }
  #sidebar-overlay { display: none !important; }
  #menu-toggle { display: none; }
  #bottom-nav { left: var(--sidebar-width); }
  .quick-actions { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .modal { border-radius: var(--radius-xl); margin: 20px; max-width: 560px; align-self: center; }
  .modal-overlay { align-items: center; }
  .page { padding: 20px; }
}
@media (min-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .quick-actions { grid-template-columns: repeat(5, 1fr); }
  #main-content { padding: 0 0 24px; }
  .page { padding: 28px; max-width: 100%; }
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  #top-header, #sidebar, #bottom-nav, #global-quick-bar, .no-print { display: none !important; }
  #training-workspace-warning { display: block !important; position: static !important; background: #2563eb !important; color: #fff !important; border: 2px solid #1d4ed8 !important; margin-bottom: 12px !important; }
  #main-content { margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .card { border: 1px solid #ccc !important; box-shadow: none !important; }
  body.training-mode-session::after {
    content: "TRAINING";
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(-28deg);
    font: 900 82px Arial, sans-serif;
    color: rgba(37,99,235,0.12);
    pointer-events: none;
    z-index: 999999;
  }
}

/* ── Loading Spinner ──────────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast Notification ───────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: calc(var(--bottom-nav-height) + 16px); left: 50%;
  transform: translateX(-50%); z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: 90%; max-width: 360px;
}
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  font-size: 0.85rem; font-weight: 500; color: var(--text-primary);
  box-shadow: var(--shadow); width: 100%;
  will-change: transform, opacity;
  animation: toastIn var(--dur-std) var(--ease-out-quart),
             toastOut 220ms var(--ease-out-quart) 2.5s forwards;
}
.toast.toast-success { border-color: var(--green); color: var(--green); background: var(--green-bg); }
.toast.toast-error { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.toast.toast-warning { border-color: rgba(245,158,11,0.35); color: #b45309; background: rgba(245,158,11,0.08); }
.toast.toast-info { border-color: rgba(59,130,246,0.28); color: var(--blue); background: var(--blue-bg); }
@keyframes toastIn  { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(-6px) scale(0.98); } }
@keyframes fadeInScale { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

.calm-save-panel {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-nav-height) + 22px);
  transform: translateX(-50%);
  z-index: 9998;
  width: min(720px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) auto 32px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(34,197,94,0.28);
  border-radius: 16px;
  background: var(--bg-surface);
  box-shadow: 0 18px 50px rgba(15,23,42,0.18);
}
.calm-save-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: rgba(34,197,94,0.12);
  color: #16a34a;
  font-size: 1.1rem;
  font-weight: 950;
}
.calm-save-copy { min-width: 0; }
.calm-save-copy strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 950;
}
.calm-save-copy span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calm-save-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}
.calm-save-actions button,
.calm-save-close {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}
.calm-save-actions button { padding: 0 11px; }
.calm-save-actions button:hover,
.calm-save-close:hover {
  border-color: rgba(34,197,94,0.34);
  background: rgba(34,197,94,0.09);
  color: #16a34a;
}
.calm-save-close {
  width: 32px;
  padding: 0;
  color: var(--text-muted);
  font-size: 1rem;
}

.empty-state,
.module-empty-state,
.list-empty-state {
  border: 1px dashed rgba(148,163,184,0.38);
  border-radius: 16px;
  background: linear-gradient(180deg,var(--bg-card),rgba(148,163,184,0.045));
  color: var(--text-muted);
}

.calm-form-guide {
  margin: 0 0 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(59,130,246,0.18);
  border-radius: 12px;
  background: rgba(59,130,246,0.055);
  color: var(--text-secondary);
}
.calm-form-guide strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
  white-space: nowrap;
}
.calm-form-guide span {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.3;
}
.calm-optional-field > label,
.calm-optional-field > .form-label {
  color: var(--text-muted);
}
.calm-optional-field > label::after,
.calm-optional-field > .form-label::after {
  content: " optional";
  margin-left: 6px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

body.quiet-mode-on #header-version-badge,
body.quiet-mode-on #erp-update-prompt,
body.quiet-mode-on #ai-assistant-launcher,
body.quiet-mode-on .ai-assistant-launcher,
body.quiet-mode-on #critical-alert-popup,
body.quiet-mode-on .calm-save-panel,
body.quiet-mode-on .global-quick-action-pinned,
body.quiet-mode-on .global-quick-action-count {
  display: none !important;
}
body.quiet-mode-on .alert-banner:not(.urgent) {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-muted);
}
body.quiet-mode-on .toast.toast-success,
body.quiet-mode-on .toast.toast-info {
  display: none !important;
}

@media (max-width: 640px) {
  .calm-save-panel {
    grid-template-columns: 38px minmax(0,1fr) 30px;
    gap: 10px;
  }
  .calm-save-actions {
    grid-column: 1 / -1;
    width: 100%;
    overflow-x: auto;
  }
  .calm-save-actions button {
    flex: 1 0 auto;
  }
}

.shortcut-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15,23,42,0.58);
}
.shortcut-help-card {
  width: min(440px, 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.shortcut-help-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.shortcut-help-head h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 900;
}
.shortcut-help-head p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}
.shortcut-help-head button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
}
.shortcut-help-list {
  padding: 8px;
}
.shortcut-help-row {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 10px;
  border-radius: 10px;
}
.shortcut-help-row:nth-child(odd) {
  background: var(--bg-elevated);
}
.shortcut-help-row kbd {
  min-width: 116px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}
.shortcut-help-row span {
  flex: 1;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 800;
}

/* ── NCR Kanban ──────────────────────────────────────────────── */
/* ── Invoice Item Row Grid (responsive) ──────────────────────── */
.so-item-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr 1fr;
  gap: 6px;
  align-items: end;
}
@media (max-width: 767px) {
  .so-item-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.ncr-status-bar {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px;
}
.ncr-status-chip {
  padding: 6px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
  white-space: nowrap; cursor: pointer; border: 1px solid var(--border);
  background: var(--bg-elevated); color: var(--text-secondary);
  transition: all var(--transition);
}
.ncr-status-chip.active { background: var(--accent-glow); border-color: rgba(245,197,24,0.3); color: var(--accent); }

/* ── Per-user Text Size ───────────────────────────────────────── */
:root, [data-text-size="normal"] { font-size: 15px; }
[data-text-size="small"]  { font-size: 13px; }
[data-text-size="large"]  { font-size: 17px; }
[data-text-size="xl"]     { font-size: 19px; }

/* ── Role specific overrides ─────────────────────────────────── */
body[data-role="Sales Rep"] #menu-toggle { display: none !important; }
body[data-role="Sales Rep"] #sidebar { display: none !important; }
body[data-role="Sales Rep"] #sidebar-overlay { display: none !important; }

/* Desktop Sales Rep */
body[data-role="Sales Rep"] #main-content {
  margin-left: 0 !important;
}

@media (min-width: 768px) {
  body[data-role="Sales Rep"] #top-header { display: flex !important; margin-bottom: 0 !important; }
  body[data-role="Sales Rep"] #main-content { margin-top: var(--nav-height) !important; }
}

/*
 * ── MOBILE Sales Rep: Natural Body Scroll ─────────────────────
 * Budget Android (Redmi 15C etc.) cannot handle overflow scroll
 * containers inside flex layouts. The ONLY reliable approach is:
 *   - Body scrolls naturally (no overflow:hidden)
 *   - Header is fixed at top
 *   - #main-content is a normal block with margin-top
 *   - .page is a normal block — no overflow constraints
 *   - Content just flows and body scroll handles everything
 */
@media (max-width: 767px) {
  body[data-role="Sales Rep"],
  body[data-role="Sales Rep"] #app-shell,
  body[data-role="Sales Rep"] #top-header,
  body[data-role="Sales Rep"] #main-content,
  body[data-role="Sales Rep"] .page {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  body[data-role="Sales Rep"] {
    /* Let body scroll naturally — DO NOT lock it */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    position: static !important;
    min-height: 100vh;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  /* Break out of flex layout — flex is the scroll killer on Android */
  body[data-role="Sales Rep"] #app-shell {
    display: block !important;
    min-height: 0 !important;
    width: 100% !important;
  }

  body[data-role="Sales Rep"] #top-header {
    position: fixed !important;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: 44px;
    padding: 0 8px !important;
    gap: 6px !important;
    contain: layout paint;
  }

  body[data-role="Sales Rep"] #header-logo {
    display: flex !important;
    flex: 1 1 auto;
    min-width: 0;
    gap: 7px;
    overflow: hidden;
  }
  body[data-role="Sales Rep"] #header-logo img {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    flex-shrink: 0;
  }
  body[data-role="Sales Rep"] #header-logo div {
    min-width: 0;
    overflow: hidden;
  }
  body[data-role="Sales Rep"] #header-logo span {
    display: block;
    max-width: 116px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    line-height: 1.05;
  }
  body[data-role="Sales Rep"] #header-logo small {
    display: none !important;
  }
  body[data-role="Sales Rep"] .header-actions {
    flex: 0 0 auto;
    min-width: 0;
    gap: 5px !important;
    overflow: hidden;
  }
  body[data-role="Sales Rep"] .header-actions button[onclick="openUniversalSearch()"] {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    justify-content: center !important;
    border-radius: 10px !important;
    flex: 0 0 32px;
  }
  body[data-role="Sales Rep"] .header-actions button[onclick="openUniversalSearch()"] span,
  body[data-role="Sales Rep"] .header-actions button[onclick="openUniversalSearch()"] kbd,
  body[data-role="Sales Rep"] .header-actions button[title^="Hard refresh"],
  body[data-role="Sales Rep"] .header-actions > div[style*="width:1px"] {
    display: none !important;
  }
  body[data-role="Sales Rep"] #theme-toggle {
    display: flex !important;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    flex: 0 0 32px !important;
    border-radius: 10px !important;
    font-size: 0.9rem !important;
  }
  body[data-role="Sales Rep"] .header-actions button[title="Sign out"] {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    flex: 0 0 32px;
    border-radius: 10px !important;
  }
  body[data-role="Sales Rep"] #network-dot {
    margin-right: 2px !important;
    flex: 0 0 9px;
  }
  body[data-role="Sales Rep"] #user-avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.72rem !important;
    flex: 0 0 28px;
  }
  body[data-role="Sales Rep"] input,
  body[data-role="Sales Rep"] select,
  body[data-role="Sales Rep"] textarea {
    font-size: 16px !important;
  }

  body[data-role="Sales Rep"] #main-content {
    /* NOT fixed, NOT flex child — just a normal block below the header */
    display: block !important;
    position: static !important;
    margin-top: 44px !important;
    margin-left: 0 !important;
    padding-bottom: 24px;
    width: 100% !important;
    /* Remove ALL scroll/overflow — body handles scrolling */
    overflow-y: visible !important;
    overflow-x: hidden !important;
    min-height: auto !important;
    height: auto !important;
    flex: none !important;
  }

  /* Pages: normal blocks, no scroll traps */
  body[data-role="Sales Rep"] .page {
    overflow-y: visible !important;
    overflow-x: hidden !important;
    min-height: 0 !important;
    height: auto !important;
    /* Disable page animation — causes render lag on budget Android */
    animation: none !important;
  }

  /* Modals still need their own scroll (they are fixed overlays) */
  body[data-role="Sales Rep"] .modal {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body[data-role="Sales Rep"] #sales-order-modal .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 136px) !important;
  }

  /* Hide desktop tab bar on mobile for Sales Rep */
  body[data-role="Sales Rep"] #sales-tab-bar-desktop {
    display: none !important;
  }

  /* Add bottom padding so content isn't hidden behind bottom nav */
  body[data-role="Sales Rep"] #main-content {
    padding-bottom: 64px !important;
  }
}

/* ── Mobile optimizations for all roles on small screens ─────── */
@media (max-width: 480px) {
  /* Larger touch targets on invoice form */
  .modal-body .form-control { font-size: 16px !important; min-height: 44px; }
  .modal-body select { min-height: 44px; }
  .modal-body .btn { min-height: 44px; font-size: 0.88rem; }
  #sales-order-form .so-invoice-actions {
    gap: 8px;
  }
  #sales-order-form .so-invoice-actions .btn {
    min-height: 52px;
    border-radius: 12px;
  }
  #sales-order-form .so-customer-label-row {
    align-items: center;
    margin-bottom: 4px;
  }
  #sales-order-form .so-new-customer-btn {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 0.74rem;
  }

  /* Invoice item rows: stack unit/qty/price on narrow screens */
  .so-item-row > div { flex-wrap: wrap; }

  /* Admin tab bar: larger tap targets */
  #sales-tab-bar-desktop button { min-height: 40px; padding: 8px 11px !important; }

  /* Tighter page header on small phones */
  .page-header-row { flex-wrap: wrap; gap: 8px; }
  .page-header-row h1 { font-size: 1rem; }

  /* Payment section in invoice: single column */
  #so-payment-row { flex-direction: column !important; }
}

@media (max-width: 767px) {
  html,
  body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: 100%;
    -webkit-overflow-scrolling: touch;
  }
  body.modal-open:not([data-role="Sales Rep"]) {
    overflow: hidden !important;
  }
  #app-shell.visible {
    min-height: 100vh;
  }
  #main-content {
    overflow-y: visible !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: calc(100vh - var(--nav-height));
  }
  .page {
    overflow-y: visible !important;
  }
  body[data-role="Sales Rep"] .sls-mobile-action-row {
    margin: 6px 0 12px !important;
  }
  body[data-role="Sales Rep"] .sls-inline-home-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid rgba(239,68,68,0.35);
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 950;
    cursor: pointer;
    white-space: nowrap;
    touch-action: manipulation;
    box-shadow: none;
  }
  body[data-role="Sales Rep"] .sls-inline-home-spacer {
    display: block;
    width: 1px;
    min-width: 1px;
  }
  body[data-role="Sales Rep"] .sls-mobile-action-right {
    flex: 1;
  }
  body[data-role="Sales Rep"] #sls-bt-printer-btn {
    min-height: 44px;
    padding: 0 11px !important;
    font-size: 0.76rem !important;
  }
  body[data-role="Sales Rep"] .sls-create-btn {
    min-height: 44px;
    padding: 0 13px !important;
    font-size: 0.78rem !important;
  }
}

@media (max-width: 390px) {
  body[data-role="Sales Rep"] .sls-mobile-action-row {
    gap: 6px !important;
  }
  body[data-role="Sales Rep"] .sls-inline-home-btn {
    padding: 0 11px;
    font-size: 0.74rem;
  }
  body[data-role="Sales Rep"] #sls-bt-printer-btn {
    max-width: 92px;
    overflow: hidden;
  }
  body[data-role="Sales Rep"] .sls-create-btn {
    padding: 0 10px !important;
  }
}

/* ── Sales Rep Bottom Navigation Bar ─────────────────────────── */
#sr-bottom-nav {
  display: none; /* hidden by default — shown only on mobile */
}

#sk-bottom-nav {
  display: none;
}
#dm-bottom-nav {
  display: none;
}
#am-bottom-nav {
  display: none;
}

/* ── Admin Mobile Control ─────────────────────────────────── */
.am-mobile-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
}
.am-hero {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: stretch;
  background:
    linear-gradient(135deg, rgba(99,102,241,.16), rgba(14,165,233,.10) 48%, rgba(34,197,94,.10)),
    var(--bg-card);
  border: 1px solid rgba(99,102,241,.24);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.07);
}
.am-kicker {
  color: #4f46e5;
  font-size: 0.7rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 4px;
}
.am-hero h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.7rem;
  line-height: 1.08;
  font-weight: 950;
}
.am-hero p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.35;
}
.am-status-pill {
  flex-shrink: 0;
  width: min(210px, 38%);
  min-height: 88px;
  border: 1px solid rgba(99,102,241,.25);
  background: rgba(99,102,241,.08);
  border-radius: 18px;
  padding: 12px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.am-status-pill span,
.am-stat span,
.am-big-action span,
.am-action-card span,
.am-row-icon {
  color: var(--am-color, #4f46e5);
  background: color-mix(in srgb, var(--am-color, #4f46e5) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.am-status-pill span {
  width: 34px;
  height: 34px;
  border-radius: 13px;
}
.am-status-pill strong {
  font-size: 0.9rem;
  font-weight: 950;
  line-height: 1.1;
}
.am-status-pill small {
  color: var(--text-muted);
  font-size: 0.67rem;
  font-weight: 850;
  line-height: 1.2;
}
.am-stat-grid,
.am-big-actions,
.am-action-grid {
  display: grid;
  gap: 10px;
}
.am-stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.am-big-actions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 12px;
}
.am-action-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.am-stat,
.am-panel,
.am-big-action,
.am-action-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.am-stat {
  min-width: 0;
  border-left: 3px solid var(--am-color);
  border-radius: 14px;
  padding: 12px;
}
.am-stat span {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  margin-bottom: 8px;
}
.am-stat strong {
  display: block;
  color: var(--text-primary);
  font-size: 1.08rem;
  font-weight: 950;
  line-height: 1;
}
.am-stat em,
.am-stat small {
  display: block;
  font-style: normal;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1.2;
  margin-top: 4px;
}
.am-panel {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}
.am-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 13px 13px 10px;
  border-bottom: 1px solid var(--border);
}
.am-panel-head h2 {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 950;
  color: var(--text-primary);
}
.am-panel-head p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.am-panel-head button {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}
.am-big-action,
.am-action-card {
  min-height: 106px;
  border-top: 4px solid var(--am-color);
  border-radius: 16px;
  padding: 13px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.am-big-action span,
.am-action-card span {
  width: 36px;
  height: 36px;
  border-radius: 13px;
}
.am-big-action b,
.am-action-card strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 950;
  line-height: 1.15;
}
.am-big-action small,
.am-action-card small {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.25;
}
.am-list {
  display: flex;
  flex-direction: column;
}
.am-row {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}
.am-row:last-child {
  border-bottom: 0;
}
.am-row-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
}
.am-row strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 950;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.am-row small {
  display: block;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 780;
  line-height: 1.25;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.am-row em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 950;
  color: #22c55e;
  white-space: nowrap;
}
.am-empty {
  padding: 18px 14px;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
}
.am-picker-help {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 10px;
}
.am-picker-list {
  display: grid;
  gap: 8px;
}
.am-picker-list button {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 13px;
  padding: 11px;
  color: var(--text-primary);
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}
.am-picker-list span {
  grid-row: 1 / span 2;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(99,102,241,.12);
  color: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 950;
}
.am-picker-list b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.am-picker-list small {
  color: var(--text-muted);
  font-weight: 780;
}

/* ── Director Mobile Monitor ───────────────────────────────── */
.dm-mobile-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
}
.dm-hero {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: stretch;
  background:
    linear-gradient(135deg, rgba(20,184,166,.18), rgba(34,197,94,.10) 46%, rgba(14,165,233,.10)),
    var(--bg-card);
  border: 1px solid rgba(20,184,166,.24);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.07);
}
.dm-kicker {
  color: #0f9f8f;
  font-size: 0.7rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 4px;
}
.dm-hero h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.7rem;
  line-height: 1.08;
  font-weight: 950;
}
.dm-hero p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.35;
}
.dm-status-pill {
  flex-shrink: 0;
  width: min(210px, 38%);
  min-height: 88px;
  border: 1px solid color-mix(in srgb, var(--dm-color) 26%, var(--border));
  background: color-mix(in srgb, var(--dm-color) 10%, var(--bg-card));
  border-radius: 18px;
  padding: 12px;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
.dm-status-pill span {
  width: 34px;
  height: 34px;
  border-radius: 13px;
  color: var(--dm-color);
  background: color-mix(in srgb, var(--dm-color) 13%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dm-status-pill strong {
  font-size: 0.9rem;
  font-weight: 950;
  line-height: 1.1;
}
.dm-status-pill small {
  color: var(--text-muted);
  font-size: 0.67rem;
  font-weight: 850;
  line-height: 1.2;
}
.dm-refresh-btn {
  flex-shrink: 0;
  min-height: 40px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 13px;
  padding: 0 12px;
  font-size: 0.76rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.dm-stat-grid,
.dm-action-grid,
.dm-two-grid,
.dm-today-grid,
.dm-watch-grid {
  display: grid;
  gap: 10px;
}
.dm-stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.dm-action-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.dm-two-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.dm-today-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
}
.dm-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.dm-section-title h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 950;
}
.dm-section-title p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 820;
}
.dm-today-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 12px;
}
.dm-today-metric {
  min-width: 0;
  min-height: 106px;
  border: 1px solid color-mix(in srgb, var(--dm-color) 18%, var(--border));
  background: color-mix(in srgb, var(--dm-color) 6%, var(--bg-card));
  border-radius: 16px;
  padding: 12px;
  color: var(--text-primary);
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
}
.dm-today-metric span {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  color: var(--dm-color);
  background: color-mix(in srgb, var(--dm-color) 14%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dm-today-metric strong {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 950;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.dm-today-metric em,
.dm-today-metric small {
  display: block;
  font-style: normal;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1.2;
}
.dm-stat,
.dm-action-card,
.dm-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.dm-stat {
  min-width: 0;
  border-left: 3px solid var(--dm-color);
  border-radius: 14px;
  padding: 12px;
}
.dm-stat span,
.dm-action-card span,
.dm-row-icon {
  border-radius: 13px;
  color: var(--dm-color);
  background: color-mix(in srgb, var(--dm-color) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dm-stat span {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
}
.dm-stat strong {
  display: block;
  color: var(--text-primary);
  font-size: 1.08rem;
  font-weight: 950;
  line-height: 1;
}
.dm-stat em,
.dm-stat small {
  display: block;
  font-style: normal;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1.2;
  margin-top: 4px;
}
.dm-action-card {
  position: relative;
  min-height: 106px;
  border-left: 0;
  border-top: 4px solid var(--dm-color);
  border-radius: 16px;
  padding: 13px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.dm-action-card > b {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 950;
}
.dm-action-card span {
  width: 36px;
  height: 36px;
}
.dm-action-card strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 950;
  line-height: 1.15;
}
.dm-action-card small {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.25;
}
.dm-panel {
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}
.dm-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 13px 13px 10px;
  border-bottom: 1px solid var(--border);
}
.dm-panel-head h2 {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 950;
  color: var(--text-primary);
}
.dm-panel-head p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.dm-panel-head button {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}
.dm-list,
.dm-metric-list {
  display: flex;
  flex-direction: column;
}
.dm-watch-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 10px;
}
.dm-row,
.dm-metric {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  padding: 10px 12px;
  display: grid;
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}
.dm-row {
  grid-template-columns: 36px minmax(0, 1fr) auto;
}
.dm-metric {
  grid-template-columns: minmax(0, 1fr) auto;
  border-left: 3px solid transparent;
}
.dm-watch-grid .dm-metric {
  min-height: 86px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-elevated);
}
.dm-row:last-child,
.dm-metric:last-child {
  border-bottom: 0;
}
.dm-row-icon {
  width: 36px;
  height: 36px;
}
.dm-row strong,
.dm-metric span {
  display: block;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 950;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dm-row small {
  display: block;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 780;
  line-height: 1.25;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dm-row em,
.dm-metric em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 950;
  white-space: nowrap;
  justify-self: end;
  color: var(--dm-color, var(--text-muted));
}
.dm-metric strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--dm-color);
  font-size: 0.84rem;
  font-weight: 950;
  white-space: nowrap;
}
.dm-watch-grid .dm-metric {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 5px;
}
.dm-watch-grid .dm-metric strong {
  white-space: normal;
  font-size: 0.82rem;
}
.dm-empty {
  padding: 18px 14px;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
}
.dm-report-panel {
  scroll-margin-top: 70px;
  overflow: hidden;
}
.dm-report-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 9px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.dm-report-tabs button {
  min-height: 52px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: 12px;
  font-weight: 950;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 1px 6px;
  padding: 7px 8px;
  text-align: left;
}
.dm-report-tabs button span {
  grid-row: 1 / span 2;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dm-report-tabs button strong,
.dm-report-tabs button small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dm-report-tabs button strong {
  color: var(--text-primary);
  font-size: 0.72rem;
}
.dm-report-tabs button small {
  color: var(--text-muted);
  font-size: 0.55rem;
  font-weight: 850;
}
.dm-report-tabs button.active {
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 76%, #000);
  color: #1a1a00;
}
.dm-report-tabs button.active strong,
.dm-report-tabs button.active small {
  color: #1a1a00;
}
.dm-report-body {
  padding: 9px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-elevated) 55%, transparent), transparent 90px);
}
.dm-report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 8px;
}
.dm-report-mini {
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--dm-color) 20%, var(--border));
  background: color-mix(in srgb, var(--dm-color) 7%, var(--bg-elevated));
  border-radius: 12px;
  padding: 9px;
}
.dm-report-mini small {
  display: block;
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 900;
  text-transform: uppercase;
}
.dm-report-mini strong {
  display: block;
  margin-top: 4px;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 950;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dm-aging-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}
.dm-aging-strip span {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 7px;
  background: var(--bg-elevated);
}
.dm-aging-strip b,
.dm-aging-strip small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dm-aging-strip b {
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 950;
}
.dm-aging-strip small {
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 800;
  margin-top: 2px;
}
.dm-report-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.dm-report-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
  padding: 2px 2px 0;
}
.dm-report-list-head span {
  text-transform: none;
  font-size: 0.6rem;
  font-weight: 850;
}
.dm-report-row {
  width: 100%;
  border: 1px solid var(--border);
  border-left: 4px solid var(--dm-color);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 9px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}
.dm-report-row span,
.dm-report-row strong,
.dm-report-row small {
  min-width: 0;
}
.dm-report-row strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dm-report-row small {
  display: block;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 800;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dm-report-row b {
  color: var(--dm-color);
  font-size: 0.76rem;
  font-weight: 950;
  white-space: nowrap;
}
.dm-report-row em {
  color: var(--dm-color);
  background: color-mix(in srgb, var(--dm-color) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--dm-color) 25%, transparent);
  border-radius: 999px;
  padding: 2px 7px;
  font-style: normal;
  font-size: 0.58rem;
  font-weight: 950;
  white-space: nowrap;
}
.dm-report-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

@media (max-width: 767px) {
  body[data-role="Sales Rep"] #sr-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 56px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: 500;
    justify-content: space-around;
    align-items: center;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    transform: translateY(0);
    transition: transform 180ms var(--ease-out-quart);
    will-change: transform;
  }

  body[data-role="Sales Rep"].modal-open #sr-bottom-nav {
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
    pointer-events: none;
  }
  body[data-role="Sales Rep"]:has(.modal-overlay.open) #sr-bottom-nav {
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
    pointer-events: none;
  }

  #sr-bottom-nav button {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    color: var(--text-muted);
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  #sr-bottom-nav button.sr-bnav-active {
    color: var(--accent);
  }

  .sr-bnav-icon {
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
  }
  .sr-bnav-icon svg {
    width: 20px;
    height: 20px;
  }

  .sr-bnav-label {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    white-space: nowrap;
  }

  /* Extra-small phones (< 360px) — keep labels from wrapping */
  @media (max-width: 359px) {
    .sr-bnav-label { font-size: 0.55rem; letter-spacing: 0; }
    .sr-bnav-icon { height: 20px; }
    .sr-bnav-icon svg { width: 18px; height: 18px; }
  }
}

/* Desktop: hide bottom nav, show tab bar */
@media (min-width: 768px) {
  #sr-bottom-nav { display: none !important; }
  #sk-bottom-nav { display: none !important; }
  #sr-more-overlay { display: none !important; }
  #sr-more-sheet { display: none !important; }
}

/* ============================================================
   REDUCED MOTION — kills all transitions/animations for users
   who set prefers-reduced-motion: reduce (OS-level accessibility).
   Skill requirement: every animated element must respect this.
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Kill infinite decorative animations entirely */
  .alert-banner.urgent,
  .spinner,
  .toast { animation: none !important; }
  /* Keep spinner visible as a static ring */
  .spinner { border-top-color: var(--accent); }
}

/* ═══════════════════════════════════════════════════════════════
   Responsive tables — "card flip" on small screens.

   Usage:  <table class="responsive-table"> …
   The auto-labeler in app.js stamps data-label="<column>" on every
   <td>, so no manual data-label attributes are needed.

   On screens ≤ 640px:
     - <thead> is hidden
     - each <tr> becomes a bordered card
     - each <td> stacks with its column label on the left (bold)
     - table container loses horizontal scroll
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .responsive-table,
  .responsive-table thead,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table th,
  .responsive-table td { display: block; width: 100%; box-sizing: border-box; }
  .responsive-table thead { display: none; }
  .responsive-table { border-collapse: separate; border-spacing: 0; }
  .responsive-table tr {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    padding: 8px 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  }
  .responsive-table tr + tr { margin-top: 0; }
  /* Hide truly empty cells so we don't show blank rows */
  .responsive-table td:empty,
  .responsive-table td[data-empty="true"] { display: none; }
  .responsive-table td {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0 !important;
    border: none !important;
    text-align: left !important;
    white-space: normal !important;
    min-height: 22px;
  }
  .responsive-table td + td {
    border-top: 1px dashed var(--border) !important;
    padding-top: 6px !important;
    margin-top: 2px;
  }
  .responsive-table td::before {
    content: attr(data-label);
    font-size: 0.62rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    flex-shrink: 0;
    margin-right: 6px;
    /* Only show the label when we've managed to derive one */
  }
  .responsive-table td:not([data-label])::before,
  .responsive-table td[data-label=""]::before { content: ""; margin-right: 0; }
  /* When a <td> contains a button as its only child, right-align it nicely */
  .responsive-table td > button:only-child,
  .responsive-table td > a:only-child { margin-left: auto; }
  /* Parent scrollers (overflow-x:auto) become natural blocks again */
  .responsive-table-wrap,
  .responsive-table-wrap > div[style*="overflow"] { overflow: visible !important; }
}
/* Desktop defaults — keep existing table behaviour intact */
@media (min-width: 641px) {
  .responsive-table thead { display: table-header-group; }
  .responsive-table tbody { display: table-row-group; }
  .responsive-table tr    { display: table-row; }
  .responsive-table td, .responsive-table th { display: table-cell; }
  .responsive-table td::before { content: none; }
}

/* ─── Preview mode (used by QM Document List "👁 Preview" iframe) ─────────
   When the app is loaded inside the preview modal iframe with ?preview=1,
   we hide the sidebar / bottom nav / FAB and reset main-content margins so
   the embedded module fills the modal cleanly. */
body.preview-mode #sidebar,
body.preview-mode #bottom-nav,
body.preview-mode #fab-nav,
body.preview-mode #header-version-badge,
body.preview-mode #ai-assistant-launcher,
body.preview-mode .ai-assistant-launcher {
  display: none !important;
}
body.preview-mode #main-content {
  margin-left: 0 !important;
  margin-top: 0 !important;
  padding: 14px !important;
  width: 100% !important;
  max-width: 100% !important;
}
body.preview-mode #app-shell.visible {
  display: block;
}

/* Route Map workbench */
.rm-workbench {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.rm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}
.rm-title-block {
  max-width: 620px;
}
.rm-title-block h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-primary);
}
.rm-title-block p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 650;
}
.rm-eyebrow {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rm-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 0 auto;
}
.rm-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  min-width: 118px;
}
.rm-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  -webkit-overflow-scrolling: touch;
}
.rm-filter-label {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}
.rm-chip {
  --rep: var(--accent);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--rep) 45%, var(--border));
  background: color-mix(in srgb, var(--rep) 9%, var(--bg-card));
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}
.rm-chip.active {
  background: color-mix(in srgb, var(--rep) 18%, var(--bg-card));
  color: var(--text-primary);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--rep) 45%, transparent);
}
.rm-chip strong {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  text-align: center;
}
.rm-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--rep);
}
.rm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: stretch;
}
.rm-map-card,
.rm-side {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.rm-map {
  height: min(62vh, 610px);
  min-height: 430px;
  width: 100%;
}
.rm-side {
  padding: 14px;
  overflow-y: auto;
  max-height: min(62vh, 610px);
}
.rm-side-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.rm-side-head strong {
  display: block;
  margin-top: 2px;
  font-size: 1rem;
}
.rm-live-pill {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(34,197,94,0.11);
  color: #16a34a;
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 850;
}
.rm-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.rm-stat {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg-elevated);
}
.rm-stat strong {
  display: block;
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
}
.rm-stat span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: uppercase;
}
.rm-stat.warn strong {
  color: #f59e0b;
}
.rm-section-title {
  margin: 14px 0 8px;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.rm-customer-list,
.rm-rep-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.rm-customer {
  width: 100%;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
}
.rm-customer:hover {
  border-color: var(--accent);
}
.rm-customer-pin {
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(15,23,42,0.22);
}
.rm-customer strong,
.rm-customer small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rm-customer strong {
  font-size: 0.76rem;
}
.rm-customer small,
.rm-more-note,
.rm-empty-note {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 650;
}
.rm-more-note {
  margin-top: 8px;
}
.rm-rep-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 800;
}
.rm-rep-row span {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.rm-rep-row i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
}
@media (max-width: 1100px) {
  .rm-layout {
    grid-template-columns: 1fr;
  }
  .rm-side {
    max-height: none;
  }
}
@media (max-width: 640px) {
  .rm-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .rm-actions {
    justify-content: stretch;
  }
  .rm-actions .btn {
    flex: 1 1 120px;
    justify-content: center;
  }
  .rm-map {
    min-height: 300px;
    height: 48vh;
  }
  .rm-stat-grid {
    grid-template-columns: 1fr;
  }
}

/* Sales GPS Activity review */
.am-workbench {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 0 16px;
}
.am-filterbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}
.am-filter-label,
.am-eyebrow {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.am-date-range {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 750;
}
.am-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid rgba(239,68,68,0.38);
  border-radius: 12px;
  background: rgba(239,68,68,0.075);
  cursor: pointer;
}
.am-alert:hover {
  border-color: rgba(239,68,68,0.62);
  background: rgba(239,68,68,0.105);
}
.am-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.am-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--kpi, var(--accent));
  border-radius: 12px;
  padding: 10px 12px;
}
.am-kpi span {
  display: block;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}
.am-kpi strong {
  display: block;
  margin-top: 4px;
  color: var(--kpi, var(--accent));
  font-size: 1.05rem;
  line-height: 1;
}
.am-kpi.good { --kpi:#22c55e; }
.am-kpi.info { --kpi:#3b82f6; }
.am-kpi.visit { --kpi:#a855f7; }
.am-kpi.warn { --kpi:#f59e0b; }
.am-kpi.danger { --kpi:#ef4444; }
.am-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: stretch;
}
.am-map-panel,
.am-review-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.am-map-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.am-map-head strong {
  display: block;
  margin-top: 2px;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.am-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.68rem;
  font-weight: 900;
}
.am-status.ok {
  background: rgba(34,197,94,0.11);
  color: #16a34a;
}
.am-status.danger {
  background: rgba(239,68,68,0.1);
  color: #ef4444;
}
.am-map {
  height: min(56vh, 560px);
  min-height: 390px;
  width: 100%;
}
.am-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 12px;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 700;
  border-top: 1px solid var(--border);
}
.am-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.am-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}
.am-legend .paid { background:#22c55e; }
.am-legend .partial { background:#f59e0b; }
.am-legend .unpaid { background:#ef4444; }
.am-legend .collection { background:#3b82f6; border-radius:3px; }
.am-legend .visit { background:#a855f7; }
.am-legend .unvisited { background:#cbd5e1; }
.am-legend .danger { color:#ef4444; font-weight:900; }
.am-review-panel {
  padding: 14px;
  overflow-y: auto;
  max-height: calc(min(56vh, 560px) + 72px);
}
.am-review-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-elevated);
}
.am-review-card.danger {
  border-color: rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.06);
}
.am-review-card.ok {
  border-color: rgba(34,197,94,0.3);
  background: rgba(34,197,94,0.06);
}
.am-review-card h3 {
  margin: 4px 0;
  color: var(--text-primary);
  font-size: 0.96rem;
}
.am-review-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.73rem;
  line-height: 1.35;
}
.am-side-title {
  margin: 14px 0 8px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.am-review-row,
.am-mini-event {
  width: 100%;
  display: block;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  padding: 9px 10px;
  cursor: pointer;
  color: var(--text-primary);
  margin-bottom: 7px;
}
.am-review-row:hover,
.am-mini-event:hover {
  border-color: var(--accent);
}
.am-review-row.danger {
  border-color: rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.055);
}
.am-review-row.warn {
  border-color: rgba(245,158,11,0.35);
  background: rgba(245,158,11,0.06);
}
.am-review-row strong,
.am-mini-event strong {
  display: block;
  font-size: 0.74rem;
}
.am-review-row span,
.am-mini-event small,
.am-empty-mini {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.67rem;
  font-weight: 650;
  line-height: 1.3;
}
.am-mini-event {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  column-gap: 8px;
}
.am-mini-event > span {
  grid-row: span 2;
}
.am-signal-modal {
  max-width: 760px;
  width: min(760px, calc(100vw - 28px));
  max-height: min(86vh, 760px);
  overflow: hidden;
}
.am-signal-modal .modal-header {
  align-items: flex-start;
}
.am-signal-modal h3 {
  margin: 3px 0 0;
  color: var(--text-primary);
  font-size: 1.05rem;
}
.am-signal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: calc(min(86vh, 760px) - 72px);
}
.am-signal-alert {
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid var(--signal-border);
  background: var(--signal-bg);
}
.am-signal-alert.danger {
  --signal-border: rgba(239,68,68,0.36);
  --signal-bg: rgba(239,68,68,0.07);
}
.am-signal-alert.warn {
  --signal-border: rgba(245,158,11,0.38);
  --signal-bg: rgba(245,158,11,0.08);
}
.am-signal-alert strong,
.am-signal-alert span {
  display: block;
}
.am-signal-alert strong {
  color: var(--text-primary);
  font-size: 0.88rem;
}
.am-signal-alert span {
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.42;
  margin-top: 4px;
}
.am-signal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.am-signal-grid > div {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
}
.am-signal-grid span,
.am-signal-row span {
  display: block;
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.am-signal-grid strong,
.am-signal-row strong {
  display: block;
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}
.am-signal-orders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.am-signal-order {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  overflow: hidden;
}
.am-signal-order-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.am-signal-order-head span {
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}
.am-signal-order-head strong {
  color: var(--accent);
  font-size: 0.78rem;
}
.am-signal-row {
  padding: 8px 12px;
  border-bottom: 1px dashed var(--border);
}
.am-signal-actions {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
}
.am-signal-actions .btn {
  flex: 1;
  justify-content: center;
}
.am-signal-checks {
  border: 1px solid rgba(59,130,246,0.22);
  border-radius: 12px;
  background: rgba(59,130,246,0.055);
  padding: 12px 14px;
}
.am-signal-checks strong,
.am-signal-checks span {
  display: block;
}
.am-signal-checks strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  margin-bottom: 6px;
}
.am-signal-checks span {
  color: var(--text-secondary);
  font-size: 0.72rem;
  line-height: 1.45;
}
.am-correction-box {
  border: 1px solid rgba(34,197,94,0.28);
  border-radius: 12px;
  background: rgba(34,197,94,0.055);
  padding: 12px 14px;
}
.am-correction-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.am-correction-head strong {
  display: block;
  margin-top: 3px;
  color: var(--text-primary);
  font-size: 0.86rem;
}
.am-correction-box select,
.am-correction-box textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 10px 11px;
  margin-bottom: 8px;
}
.am-correction-box textarea {
  resize: vertical;
  min-height: 74px;
}
.am-correction-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.am-correction-history > div {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg-card);
  padding: 8px 10px;
}
.am-correction-history strong,
.am-correction-history span {
  display: block;
}
.am-correction-history strong {
  color: var(--text-primary);
  font-size: 0.73rem;
}
.am-correction-history span {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.67rem;
  line-height: 1.35;
}
@media (max-width: 1100px) {
  .am-layout {
    grid-template-columns: 1fr;
  }
  .am-review-panel {
    max-height: none;
  }
  .am-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .am-signal-grid,
  .am-signal-orders {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .am-filterbar {
    align-items: stretch;
  }
  .am-date-range {
    margin-left: 0;
    width: 100%;
  }
  .am-map {
    min-height: 300px;
    height: 48vh;
  }
  .am-signal-actions {
    flex-direction: column;
  }
}

/* Shared workspace windows used by multi-tab modules */
.erp-workspace-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  margin: 0 0 14px;
}

.erp-workspace-tabs::-webkit-scrollbar {
  display: none;
}

.erp-workspace-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
}

.erp-workspace-tab.active {
  background: var(--accent);
  color: #1a1a00;
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(214, 169, 0, 0.18);
}

.erp-workspace-tab .count {
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-primary);
  font-size: 0.62rem;
  font-weight: 950;
}

.erp-workspace-window {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  margin-bottom: 16px;
}

.erp-workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(90deg, rgba(248,250,252,0.96), rgba(255,255,255,0.96));
  border-bottom: 1px solid var(--border);
}

.erp-workspace-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.erp-workspace-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex: 0 0 auto;
}

.erp-workspace-title strong {
  display: block;
  font-size: 0.98rem;
  line-height: 1.15;
  color: var(--text-primary);
}

.erp-workspace-title small {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.erp-workspace-close {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex: 0 0 auto;
}

.erp-workspace-body {
  padding: 14px;
}

@media (max-width: 640px) {
  .erp-workspace-tabs {
    border-radius: 12px;
    padding: 6px;
    margin-bottom: 10px;
  }
  .erp-workspace-tab {
    padding: 8px 10px;
    font-size: 0.72rem;
  }
  .erp-workspace-head {
    padding: 10px 12px;
  }
  .erp-workspace-icon {
    width: 32px;
    height: 32px;
  }
  .erp-workspace-body {
    padding: 10px;
  }
}

/* FINAL OFFICE OVERRIDE: desktop invoice opens as a popup with account context.
   Sales Rep mobile is excluded so the mobile salesrep flow stays unchanged. */
body:not([data-role="Sales Rep"]) #sales-order-modal.modal-overlay {
  background: rgba(15, 23, 42, 0.45) !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 24px !important;
  overflow: auto !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal.modal-overlay.modal-over-daily-report {
  z-index: 10050 !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal .modal {
  width: min(1120px, calc(100vw - 48px)) !important;
  max-width: 1120px !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(100vh - 48px) !important;
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
  margin: auto !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22) !important;
  animation: modalIn var(--dur-modal) var(--ease-out-quart) !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal .modal-header {
  border-radius: 18px 18px 0 0 !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal .modal-body {
  padding: 16px !important;
  padding-bottom: 16px !important;
  overflow-y: auto !important;
}
body:not([data-role="Sales Rep"]) #sales-order-form {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 318px !important;
  gap: 12px !important;
  align-items: start !important;
}
body:not([data-role="Sales Rep"]) #sales-order-form > :not(#so-customer-side-panel) {
  grid-column: 1 !important;
}
body:not([data-role="Sales Rep"]) #sales-order-form > #so-customer-side-panel {
  grid-column: 2 !important;
  grid-row: 1 / span 20 !important;
}
@media (max-width: 980px) {
  body:not([data-role="Sales Rep"]) #sales-order-modal.modal-overlay {
    align-items: flex-start !important;
    padding: 10px !important;
  }
  body:not([data-role="Sales Rep"]) #sales-order-modal .modal {
    width: 100% !important;
    max-height: calc(100vh - 20px) !important;
    border-radius: 14px !important;
  }
  body:not([data-role="Sales Rep"]) #sales-order-form {
    grid-template-columns: 1fr !important;
  }
body:not([data-role="Sales Rep"]) #sales-order-form > #so-customer-side-panel {
  grid-column: 1 !important;
  grid-row: auto !important;
  position: static !important;
  max-height: none !important;
  }
}

/* Inventory item list: compact, full-width, and easier to scan on large screens. */
#page-inventory .inv-page-head {
  margin-bottom: 12px;
}
.inv-command-center {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, auto);
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, #fffdf5 0%, #fff 48%, #eef4ff 100%);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.07);
}
.inv-command-copy {
  min-width: 0;
}
.inv-command-eyebrow {
  margin-bottom: 5px;
  color: #b38b00;
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.inv-command-copy h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--text-primary);
  font-size: 1.34rem;
  line-height: 1.08;
  font-weight: 950;
  letter-spacing: 0;
}
.inv-command-copy p {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.42;
  font-weight: 700;
}
.inv-command-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}
.inv-command-meta span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-muted);
  padding: 0 10px;
  font-size: 0.66rem;
  font-weight: 850;
}
.inv-command-meta strong {
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 950;
}
.inv-command-meta .danger strong {
  color: #ef4444;
}
.inv-command-meta .good strong {
  color: #16a34a;
}
.inv-command-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.inv-primary-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.inv-primary-actions .btn {
  white-space: nowrap;
}
.inv-issue-primary {
  border-color: rgba(37, 99, 235, 0.22) !important;
  background: rgba(37, 99, 235, 0.07) !important;
  color: #1d4ed8 !important;
}
#page-inventory .inv-page-actions .btn {
  min-height: 34px;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 0.74rem;
}
.inv-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, .42fr);
  gap: 10px;
  margin-bottom: 10px;
}
.inv-dashboard-main,
.inv-activity-card,
.inv-attention-strip {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.035);
}
.inv-dashboard-main {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
}
.inv-dashboard-title span,
.inv-activity-title {
  display: block;
  color: var(--text-muted);
  font-size: .64rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.inv-dashboard-title strong {
  display: block;
  margin-top: 5px;
  color: var(--text-primary);
  font-size: 1.12rem;
  line-height: 1.1;
  font-weight: 950;
}
.inv-dashboard-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}
.inv-dashboard-stats button {
  min-width: 0;
  min-height: 54px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: var(--bg-elevated);
  padding: 8px 9px;
  text-align: left;
  cursor: pointer;
}
.inv-dashboard-stats strong,
.inv-dashboard-stats span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-dashboard-stats strong {
  color: var(--text-primary);
  font-size: .92rem;
  font-weight: 950;
}
.inv-dashboard-stats span {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: .62rem;
  font-weight: 850;
}
.inv-activity-card {
  padding: 12px;
}
.inv-activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}
.inv-activity-grid span {
  min-height: 44px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 11px;
  background: var(--bg-elevated);
  padding: 7px 8px;
}
.inv-activity-grid b,
.inv-activity-grid small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-activity-grid b {
  color: var(--text-primary);
  font-size: .85rem;
  font-weight: 950;
}
.inv-activity-grid small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: .59rem;
  font-weight: 850;
}
.inv-attention-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  padding: 8px;
}
.inv-attention-strip button {
  min-width: 0;
  min-height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 11px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  cursor: pointer;
  font-size: .68rem;
  font-weight: 900;
}
.inv-attention-strip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.inv-attention-strip strong {
  color: var(--text-primary);
  font-size: .76rem;
  font-weight: 950;
}
.inv-filter-bar {
  grid-template-columns: minmax(360px, 1fr) minmax(150px, 190px) minmax(160px, 230px) minmax(140px, 180px);
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.035);
}
.inv-search-control,
.inv-filter-select,
.inv-stock-filter-group {
  min-height: 38px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 11px;
  background: rgba(248, 250, 252, 0.78);
}
.inv-search-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}
.inv-filter-select {
  min-width: 0;
  width: 100%;
  padding: 0 10px;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 800;
}
.inv-stock-filter-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  overflow-x: auto;
}
.inv-stock-filter-btn {
  min-width: max-content;
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  padding: 0 9px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 900;
}
.inv-search-assist {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -2px 0 10px;
  color: var(--text-muted);
  font-size: .66rem;
  font-weight: 800;
}
.inv-search-assist div {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.inv-search-assist button {
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  color: var(--text-secondary);
  padding: 4px 8px;
  font-size: .62rem;
  font-weight: 850;
  cursor: pointer;
}
.inv-stock-filter-btn.active {
  background: var(--accent);
  color: #1a1a00;
}
.inv-issue-center-banner {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 10px;
  padding: 10px 14px;
  border: 1px solid rgba(214, 173, 31, 0.32);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 11%, var(--bg-card));
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}
.inv-issue-banner-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.inv-issue-banner-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: #9a7600;
}
.inv-issue-banner-text,
.inv-issue-center-banner strong,
.inv-issue-banner-sub {
  display: block;
  min-width: 0;
}
.inv-issue-center-banner strong {
  color: var(--text-primary);
  font-size: 0.86rem;
  line-height: 1.2;
  font-weight: 950;
}
.inv-issue-banner-sub {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.inv-issue-banner-open {
  min-height: 30px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(214, 173, 31, 0.34);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-primary) !important;
  padding: 0 12px;
  font-size: 0.72rem !important;
  font-weight: 950 !important;
}
.inv-reorder-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-left: 3px solid #ef4444;
  border-radius: 12px;
  background: color-mix(in srgb, #ef4444 6%, var(--bg-card));
}
.inv-reorder-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  font-size: 1rem;
  flex: 0 0 auto;
}
.inv-reorder-copy {
  flex: 1 1 240px;
  min-width: 0;
}
.inv-reorder-title {
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 950;
}
.inv-reorder-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.inv-reorder-tag,
.inv-reorder-more {
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.64rem;
  font-weight: 800;
  max-width: 190px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-reorder-more {
  background: transparent;
  color: var(--text-muted);
}
.inv-reorder-button {
  border: 1px solid rgba(239, 68, 68, 0.24);
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  color: #ef4444;
  font-size: 0.7rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.inv-kpi-strip {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.inv-kpi-card {
  appearance: none;
  min-height: 36px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  padding: 5px 10px 5px 7px;
  display: inline-grid;
  grid-template-columns: 24px auto auto;
  align-items: center;
  gap: 6px;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}
button.inv-kpi-card {
  cursor: pointer;
}
button.inv-kpi-card:hover {
  border-color: color-mix(in srgb, var(--kpi-color, var(--accent)) 34%, var(--border));
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}
button.inv-kpi-card:active {
  transform: scale(0.99);
}
.inv-kpi-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--kpi-color, var(--accent)) 13%, transparent);
  color: var(--kpi-color, var(--accent));
}
.inv-kpi-blue { --kpi-color: #6366f1; color: #6366f1; }
.inv-kpi-red { --kpi-color: #ef4444; color: #ef4444; }
.inv-kpi-green { --kpi-color: #22c55e; color: #22c55e; }
.inv-kpi-number {
  font-size: 0.86rem;
  line-height: 1.1;
  font-weight: 950;
  color: currentColor;
  white-space: nowrap;
}
.inv-kpi-number.inv-money {
  font-size: 0.82rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-kpi-label {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: none;
  letter-spacing: 0;
  justify-self: end;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-real-list-head,
.inv-real-list-row {
  display: grid;
  grid-template-columns: minmax(270px, 1.35fr) 160px 94px 94px 94px minmax(130px, .8fr) 86px 134px;
  gap: 12px;
  align-items: center;
  min-width: 1180px;
  box-sizing: border-box;
}
.inv-real-list-head {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
  background: #e8edf5;
  color: var(--text-muted);
  font-size: 0.64rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 1;
}
.inv-real-list-head span {
  color: var(--text-muted);
  font-size: 0.56rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: none;
}
.inv-real-list-row-wrap {
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}
.inv-real-list-row {
  padding: 10px 14px;
  background: transparent;
  cursor: pointer;
}
.inv-real-list-row-wrap:hover {
  background: #fff;
}
.inv-real-list-row-wrap.is-expanded {
  background: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.inv-item-cell {
  min-width: 0;
}
.inv-item-name-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  font-size: .82rem;
  font-weight: 900;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.inv-item-subline {
  color: var(--text-muted);
  font-family: monospace;
  font-size: .66rem;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-table-qty {
  text-align: right;
  white-space: nowrap;
  min-width: 0;
}
.inv-table-qty strong,
.inv-table-qty span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-table-qty strong {
  color: var(--text-primary);
  font-size: .78rem;
  font-weight: 950;
}
.inv-table-qty span {
  color: var(--text-muted);
  font-size: .58rem;
  font-weight: 850;
}
.inv-row-expanded {
  min-width: 1180px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 0 14px 10px;
}
.inv-row-expanded div {
  border: 1px solid rgba(148, 163, 184, .18);
  border-radius: 10px;
  background: var(--bg-elevated);
  padding: 7px 9px;
}
.inv-row-expanded span,
.inv-row-expanded strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-row-expanded span {
  color: var(--text-muted);
  font-size: .58rem;
  font-weight: 900;
  text-transform: uppercase;
}
.inv-row-expanded strong {
  margin-top: 3px;
  color: var(--text-primary);
  font-size: .7rem;
  font-weight: 900;
}
.inv-list-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  white-space: nowrap;
}
.inv-row-action,
.inv-row-more-menu button {
  min-height: 30px;
  min-width: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 0 7px;
  font-size: 0.64rem;
  font-weight: 900;
  cursor: pointer;
}
.inv-row-action.receive {
  border-color: rgba(34, 197, 94, 0.26);
  background: rgba(34, 197, 94, 0.08);
  color: #16a34a;
}
.inv-row-action.issue {
  border-color: rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.06);
  color: #ef4444;
}
.inv-row-action svg {
  width: 14px;
  height: 14px;
}
.inv-row-more-wrap {
  position: relative;
  display: inline-flex;
}
.inv-list-actions .inv-row-menu-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 0.92rem;
}
.inv-row-more-menu {
  position: absolute;
  right: 0;
  top: 32px;
  z-index: 6;
  min-width: 118px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
}
.inv-row-more-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 5px;
  text-align: left;
}
.inv-row-more-menu button:last-child {
  margin-bottom: 0;
}
.inv-items-shell {
  display: grid;
  gap: 10px;
}
.inv-tool-group-title {
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 950;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.inv-tools-simple {
  display: grid;
  gap: 18px;
}
.inv-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.inv-tool-grid-primary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.inv-tool-card {
  min-height: 64px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--tool-color);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 10px 11px;
  text-align: left;
  cursor: pointer;
}
.inv-tool-card > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.inv-tool-card span {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--tool-color);
  background: color-mix(in srgb, var(--tool-color) 12%, transparent);
}
.inv-tool-card strong {
  color: var(--text-primary);
  font-size: .8rem;
  font-weight: 950;
}
.inv-tool-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.inv-tool-list {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  padding: 10px;
}
.inv-tool-list-title {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 950;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.inv-tool-list button {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  text-align: left;
  cursor: pointer;
}
.inv-tool-list button:hover {
  background: var(--bg-elevated);
}
.inv-tool-list button span {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--tool-color);
  background: color-mix(in srgb, var(--tool-color) 12%, transparent);
}
.inv-tool-list button strong {
  min-width: 0;
  color: var(--text-primary);
  font-size: .78rem;
  font-weight: 950;
}
.inv-floating-actions {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  display: grid;
  justify-items: end;
  gap: 8px;
}
.inv-floating-toggle {
  width: 48px;
  height: 48px;
  border: 1px solid rgba(214, 173, 31, .45);
  border-radius: 999px;
  background: var(--accent);
  color: #1f2937;
  display: grid;
  place-items: center;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
  cursor: pointer;
}
.inv-floating-menu {
  width: 190px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: 0 18px 44px rgba(15, 23, 42, .18);
  padding: 7px;
}
.inv-floating-menu button {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  font-size: .72rem;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}
.inv-floating-menu button:hover {
  background: var(--bg-elevated);
}
.inv-category-section {
  min-width: 0;
}
.inv-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 8px;
}
.inv-category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 950;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.inv-category-title > div {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.inv-category-mark {
  flex: 0 0 auto;
  width: 4px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
}
.inv-category-meta {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}
.inv-category-meta span {
  color: #ef4444;
}
.inv-items-grid {
  display: grid;
  align-items: start;
}
.inv-items-grid.list {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr));
  gap: 8px;
}
.inv-items-grid.cards {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 10px;
}
.inv-stock-row {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--border);
  border-left: 4px solid var(--stock-color);
  border-radius: 12px;
  background: var(--bg-card);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.inv-stock-row:hover {
  border-color: color-mix(in srgb, var(--stock-color) 38%, var(--border));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}
.inv-stock-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 36px;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
}
.inv-stock-copy {
  min-width: 0;
}
.inv-stock-name {
  color: var(--text-primary);
  font-size: 0.84rem;
  line-height: 1.15;
  font-weight: 950;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-stock-meta {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 760;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-stock-state {
  text-align: right;
  white-space: nowrap;
}
.inv-stock-qty {
  color: var(--stock-color);
  font-size: 0.88rem;
  line-height: 1.15;
  font-weight: 950;
}
.inv-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.58rem;
  font-weight: 850;
}
.inv-status-pill span {
  color: var(--stock-color);
}
.inv-row-menu-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1;
  font-weight: 950;
  cursor: pointer;
}
.inv-stock-actions {
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 6px;
  padding: 0 10px 10px;
}
.inv-mobile-only,
.inv-mobile-item-list {
  display: none;
}
@media (max-width: 720px) {
  #page-inventory {
    padding-bottom: 92px;
  }
  #page-inventory .inv-page-head {
    display: block;
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px !important;
  }
  #page-inventory .inv-command-center {
    padding: 14px;
    border-radius: 18px;
  }
  #page-inventory .inv-command-copy h1 {
    font-size: 1.16rem;
  }
  #page-inventory .inv-command-meta {
    display: none;
  }
  #page-inventory .inv-page-actions {
    display: none !important;
  }
  #page-inventory .inv-page-actions .btn {
    width: 100%;
    min-height: 42px;
    justify-content: center;
    padding: 9px 10px;
    font-size: 0.74rem;
  }
  #page-inventory .inv-filter-bar.is-open {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px !important;
  }
  #page-inventory .inv-filter-bar > div:first-child {
    grid-column: 1 / -1;
    min-height: 42px;
  }
  #page-inventory .inv-filter-bar select {
    min-width: 0;
    width: 100%;
    min-height: 42px;
  }
  #page-inventory .inv-filter-bar > div:last-child {
    grid-column: 1 / -1;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
  #page-inventory .erp-workspace-window {
    border-radius: 14px;
  }
  #page-inventory .erp-workspace-head {
    display: none;
  }
  #page-inventory .inv-tool-grid-primary,
  #page-inventory .inv-tool-summary-grid {
    grid-template-columns: 1fr;
  }
  #page-inventory .inv-tool-card {
    min-height: 58px;
  }
  #page-inventory .inv-issue-center-banner,
  #page-inventory .inv-mobile-role-panel,
  #page-inventory .inv-kpi-strip,
  #page-inventory .inv-reorder-banner {
    display: none !important;
  }
  .inv-mobile-role-panel {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-card);
    padding: 12px;
    margin: 0 0 12px;
    box-shadow: var(--shadow-sm);
  }
  .inv-mobile-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
  }
  .inv-mobile-panel-head span {
    display: block;
    color: var(--accent);
    font-size: 0.62rem;
    font-weight: 950;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .inv-mobile-panel-head h2 {
    margin: 2px 0 0;
    color: var(--text-primary);
    font-size: 1.02rem;
    line-height: 1.15;
    font-weight: 950;
  }
  .inv-mobile-panel-head p {
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.35;
    font-weight: 750;
  }
  .inv-mobile-panel-head button {
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 8px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 900;
    white-space: nowrap;
  }
  .inv-mobile-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }
  .inv-mobile-stats button {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-elevated);
    padding: 9px 8px;
    text-align: left;
    color: var(--text-primary);
    min-width: 0;
  }
  .inv-mobile-stats strong,
  .inv-mobile-stats span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .inv-mobile-stats strong {
    font-size: 0.98rem;
    line-height: 1.05;
    font-weight: 950;
  }
  .inv-mobile-stats span {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 0.58rem;
    font-weight: 900;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .inv-mobile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .inv-mobile-action {
    border: 1px solid var(--border);
    border-left: 4px solid var(--inv-mobile-color);
    border-radius: 13px;
    background: var(--bg-elevated);
    padding: 10px;
    text-align: left;
    min-width: 0;
    color: var(--text-primary);
  }
  .inv-mobile-action span {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    color: var(--inv-mobile-color);
    background: color-mix(in srgb, var(--inv-mobile-color) 13%, transparent);
    margin-bottom: 7px;
  }
  .inv-mobile-action strong,
  .inv-mobile-action small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .inv-mobile-action strong {
    font-size: 0.78rem;
    font-weight: 950;
    white-space: nowrap;
  }
  .inv-mobile-action small {
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 0.62rem;
    line-height: 1.25;
  }
  .inv-reorder-button {
    width: 100%;
  }
  .inv-category-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .inv-real-list-table {
    display: none !important;
  }
  .inv-mobile-item-list {
    display: grid;
    gap: 6px;
  }
  .inv-mobile-item-card {
    border: 1px solid var(--border);
    border-left: 3px solid var(--inv-stock-color);
    border-radius: 10px;
    background: var(--bg-card);
    overflow: hidden;
  }
  .inv-mobile-item-main {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    padding: 9px 9px;
    display: grid;
    grid-template-columns: 8px minmax(0, 1fr) 22px;
    gap: 6px;
    align-items: center;
    text-align: left;
  }
  .inv-mobile-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--inv-stock-color);
  }
  .inv-mobile-item-copy,
  .inv-mobile-item-stock {
    min-width: 0;
  }
  .inv-mobile-item-copy strong,
  .inv-mobile-item-stock strong {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .inv-mobile-item-copy strong {
    color: var(--text-primary);
    font-size: 0.8rem;
    line-height: 1.16;
    font-weight: 950;
    white-space: nowrap;
  }
  .inv-mobile-item-stock {
    grid-column: 2 / -1;
    text-align: left;
    max-width: none;
  }
  .inv-mobile-item-stock strong {
    color: var(--inv-stock-color);
    font-size: 0.78rem;
    line-height: 1.18;
    font-weight: 950;
    white-space: nowrap;
  }
  .inv-mobile-item-chevron {
    grid-column: 3;
    grid-row: 1;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    display: grid;
    place-items: center;
    font-size: 0.95rem;
    font-weight: 950;
  }
  .inv-mobile-item-detail {
    display: none;
    border-top: 1px solid var(--border);
    padding: 8px 9px 9px;
  }
  .inv-mobile-item-card.is-expanded .inv-mobile-item-detail {
    display: block;
  }
  .inv-mobile-item-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 0;
  }
  .inv-mobile-item-meta span {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-elevated);
    padding: 5px 6px;
    color: var(--text-muted);
    font-size: 0.58rem;
    font-weight: 850;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .inv-mobile-item-meta b {
    color: var(--text-primary);
  }
  .inv-mobile-item-sub {
    margin: 7px 0 0;
    color: var(--text-muted);
    font-size: 0.6rem;
    line-height: 1.25;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .inv-mobile-item-actions {
    padding: 8px 0 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .inv-mobile-item-actions button {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    min-height: 32px;
    padding: 5px 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.62rem;
    font-weight: 900;
    white-space: nowrap;
  }
  .inv-stock-row-main {
    grid-template-columns: minmax(0, 1fr) 36px;
  }
  .inv-stock-state {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: left;
  }
}

/* ── Store Keeper Mobile Workspace ─────────────────────────── */
.sk-mobile-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 1180px;
  margin: 0 auto;
}
.sk-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(214,173,31,.16), rgba(14,165,233,.08));
  border: 1px solid rgba(214,173,31,.28);
  border-radius: 18px;
  padding: 18px;
}
.sk-kicker {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 4px;
}
.sk-hero h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.7rem;
  line-height: 1.08;
  font-weight: 950;
}
.sk-hero p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.35;
}
.sk-scan-btn {
  flex-shrink: 0;
  min-height: 42px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 13px;
  padding: 0 12px;
  font-size: 0.76rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.sk-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.sk-stat {
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--sk-color);
  border-radius: 14px;
  padding: 12px;
}
.sk-stat span,
.sk-action-card span {
  border-radius: 13px;
  color: var(--sk-color);
  background: color-mix(in srgb, var(--sk-color) 12%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sk-stat span {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
}
.sk-stat strong {
  display: block;
  color: var(--text-primary);
  font-size: 1.08rem;
  font-weight: 950;
  line-height: 1;
}
.sk-stat em,
.sk-stat small {
  display: block;
  font-style: normal;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1.2;
  margin-top: 4px;
}
.sk-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.sk-action-card {
  min-height: 120px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--sk-color);
  background: var(--bg-card);
  border-radius: 16px;
  padding: 13px;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.sk-action-card span {
  width: 38px;
  height: 38px;
}
.sk-action-card strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 950;
  line-height: 1.15;
}
.sk-action-card small {
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.25;
}
.sk-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.sk-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 13px 13px 10px;
  border-bottom: 1px solid var(--border);
}
.sk-panel-head h2 {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 950;
  color: var(--text-primary);
}
.sk-panel-head p {
  margin: 3px 0 0;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.sk-panel-head button {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
}
.sk-list {
  display: flex;
  flex-direction: column;
}
.sk-row {
  width: 100%;
  min-height: 66px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}
.sk-row:last-child {
  border-bottom: 0;
}
.sk-row-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sk-row strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 950;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sk-row small {
  display: block;
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 780;
  line-height: 1.25;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sk-row em {
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 950;
  white-space: nowrap;
  justify-self: end;
}
.sk-row em.ok { color: #22c55e; }
.sk-row em.warn { color: #f59e0b; }
.sk-empty {
  padding: 18px 14px;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 767px) {
  body[data-role="Store Keeper"] {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
    touch-action: none !important;
  }
  body[data-role="Store Keeper"] #app-shell.visible {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
  }
  body[data-role="Store Keeper"] #sidebar,
  body[data-role="Store Keeper"] #sidebar-overlay,
  body[data-role="Store Keeper"] #top-menubar,
  body[data-role="Store Keeper"] #global-quick-bar,
  body[data-role="Store Keeper"] #bottom-nav {
    display: none !important;
  }
  body[data-role="Store Keeper"] #top-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    min-height: calc(52px + env(safe-area-inset-top, 0px)) !important;
    height: auto !important;
    padding: calc(env(safe-area-inset-top, 0px) + 6px) 10px 7px !important;
    align-items: center !important;
    gap: 7px !important;
  }
  body[data-role="Store Keeper"] #main-content {
    display: block !important;
    position: fixed !important;
    top: calc(52px + env(safe-area-inset-top, 0px)) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: contain !important;
    background: var(--bg-main);
  }
  body[data-role="Store Keeper"] .page.active {
    display: block !important;
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
    padding: 10px !important;
  }
  body[data-role="Store Keeper"] #header-logo {
    gap: 8px !important;
  }
  body[data-role="Store Keeper"] #header-logo img {
    width: 32px !important;
    height: 32px !important;
    border-radius: 9px !important;
  }
  body[data-role="Store Keeper"] #header-logo span {
    max-width: 142px !important;
    font-size: 0.96rem !important;
    line-height: 1.05 !important;
  }
  body[data-role="Store Keeper"] .header-actions {
    gap: 6px !important;
  }
  body[data-role="Store Keeper"] .header-actions button[onclick="openUniversalSearch()"],
  body[data-role="Store Keeper"] #theme-toggle,
  body[data-role="Store Keeper"] .header-actions button[title="Sign out"] {
    width: 38px !important;
    height: 38px !important;
    flex-basis: 38px !important;
    border-radius: 13px !important;
  }
  body[data-role="Store Keeper"] #user-avatar {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }
  body[data-role="Store Keeper"] #sk-bottom-nav {
    display: flex !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 58px;
    padding: 2px 4px env(safe-area-inset-bottom, 0px);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: 500;
    justify-content: space-around;
    align-items: center;
  }
  body[data-role="Store Keeper"].modal-open #sk-bottom-nav,
  body[data-role="Store Keeper"]:has(.modal-overlay.open) #sk-bottom-nav {
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
    pointer-events: none;
  }
  #sk-bottom-nav button {
    flex: 1;
    min-width: 0;
    height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 12px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  #sk-bottom-nav button.active {
    color: var(--accent);
    background: rgba(214, 173, 31, 0.12);
  }
  #sk-bottom-nav small {
    font-size: 0.58rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0;
    white-space: nowrap;
  }
  .sk-mobile-page {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 12px;
  }
  .sk-hero {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    background: linear-gradient(135deg, rgba(214,173,31,.16), rgba(14,165,233,.08));
    border: 1px solid rgba(214,173,31,.28);
    border-radius: 18px;
    padding: 15px;
  }
  .sk-kicker {
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 4px;
  }
  .sk-hero h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.28rem;
    line-height: 1.08;
    font-weight: 950;
  }
  .sk-hero p {
    margin: 5px 0 0;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 750;
    line-height: 1.35;
  }
  .sk-scan-btn {
    flex-shrink: 0;
    min-height: 42px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: 13px;
    padding: 0 12px;
    font-size: 0.76rem;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
  }
  .sk-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .sk-stat {
    min-width: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--sk-color);
    border-radius: 14px;
    padding: 10px 9px;
  }
  .sk-stat span {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sk-color);
    background: color-mix(in srgb, var(--sk-color) 12%, transparent);
    margin-bottom: 7px;
  }
  .sk-stat strong {
    display: block;
    color: var(--text-primary);
    font-size: 1.02rem;
    font-weight: 950;
    line-height: 1;
  }
  .sk-stat em,
  .sk-stat small {
    display: block;
    font-style: normal;
    color: var(--text-muted);
    font-size: 0.64rem;
    font-weight: 850;
    line-height: 1.2;
    margin-top: 4px;
  }
  .sk-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .sk-action-card {
    min-height: 116px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--sk-color);
    background: var(--bg-card);
    border-radius: 16px;
    padding: 13px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
  }
  .sk-action-card span {
    width: 38px;
    height: 38px;
    border-radius: 13px;
    color: var(--sk-color);
    background: color-mix(in srgb, var(--sk-color) 12%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .sk-action-card strong {
    display: block;
    font-size: 0.92rem;
    font-weight: 950;
    line-height: 1.15;
  }
  .sk-action-card small {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.25;
  }
  .sk-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
  }
  .sk-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 13px 13px 10px;
    border-bottom: 1px solid var(--border);
  }
  .sk-panel-head h2 {
    margin: 0;
    font-size: 0.94rem;
    font-weight: 950;
    color: var(--text-primary);
  }
  .sk-panel-head p {
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
  }
  .sk-panel-head button {
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 0.72rem;
    font-weight: 900;
    cursor: pointer;
  }
  .sk-list {
    display: flex;
    flex-direction: column;
  }
  .sk-row {
    width: 100%;
    min-height: 66px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    text-align: left;
    cursor: pointer;
  }
  .sk-row:last-child {
    border-bottom: 0;
  }
  .sk-row-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--bg-elevated);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .sk-row strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 950;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sk-row small {
    display: block;
    color: var(--text-muted);
    font-size: 0.66rem;
    font-weight: 780;
    line-height: 1.25;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sk-row em {
    font-style: normal;
    font-size: 0.68rem;
    font-weight: 950;
    white-space: nowrap;
    justify-self: end;
  }
  .sk-row em.ok { color: #22c55e; }
  .sk-row em.warn { color: #f59e0b; }
  .sk-empty {
    padding: 18px 14px;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-align: center;
  }
}

@media (max-width: 767px) {
  body[data-role="Admin"] {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
    touch-action: none !important;
  }
  body[data-role="Admin"] #app-shell.visible {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
  }
  body[data-role="Admin"] #sidebar,
  body[data-role="Admin"] #sidebar-overlay,
  body[data-role="Admin"] #top-menubar,
  body[data-role="Admin"] #global-quick-bar,
  body[data-role="Admin"] #bottom-nav {
    display: none !important;
  }
  body[data-role="Admin"] #top-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    min-height: calc(52px + env(safe-area-inset-top, 0px)) !important;
    height: auto !important;
    padding: calc(env(safe-area-inset-top, 0px) + 6px) 10px 7px !important;
    align-items: center !important;
    gap: 7px !important;
  }
  body[data-role="Admin"] #main-content {
    display: block !important;
    position: fixed !important;
    top: calc(52px + env(safe-area-inset-top, 0px)) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: contain !important;
    background: var(--bg-main);
  }
  body[data-role="Admin"] .page.active {
    display: block !important;
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
    padding: 10px !important;
  }
  body[data-role="Admin"] #header-logo {
    gap: 8px !important;
  }
  body[data-role="Admin"] #header-logo img {
    width: 32px !important;
    height: 32px !important;
    border-radius: 9px !important;
  }
  body[data-role="Admin"] #header-logo span {
    max-width: 142px !important;
    font-size: 0.96rem !important;
    line-height: 1.05 !important;
  }
  body[data-role="Admin"] .header-actions {
    gap: 6px !important;
  }
  body[data-role="Admin"] .header-actions button[onclick="openUniversalSearch()"],
  body[data-role="Admin"] #theme-toggle {
    display: none !important;
  }
  body[data-role="Admin"] .header-actions button[title^="Hard refresh"],
  body[data-role="Admin"] .header-actions button[title="Sign out"] {
    width: 38px !important;
    height: 38px !important;
    flex-basis: 38px !important;
    border-radius: 13px !important;
  }
  body[data-role="Admin"] #user-avatar {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }
  body[data-role="Admin"] #am-bottom-nav {
    display: flex !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 58px;
    padding: 2px 4px env(safe-area-inset-bottom, 0px);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: 500;
    justify-content: space-around;
    align-items: center;
  }
  body[data-role="Admin"].modal-open #am-bottom-nav,
  body[data-role="Admin"]:has(.modal-overlay.open) #am-bottom-nav {
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
    pointer-events: none;
  }
  #am-bottom-nav button {
    flex: 1;
    min-width: 0;
    height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 12px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  #am-bottom-nav button.active {
    color: #4f46e5;
    background: rgba(99,102,241,.12);
  }
  #am-bottom-nav small {
    font-size: 0.58rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0;
    white-space: nowrap;
  }
  .am-mobile-page {
    gap: 12px;
    padding-bottom: 12px;
  }
  .am-hero {
    border-radius: 22px;
    padding: 15px;
    align-items: stretch;
  }
  .am-hero h1 {
    font-size: 1.42rem;
  }
  .am-hero p {
    font-size: 0.78rem;
    max-width: 22rem;
  }
  .am-status-pill {
    width: 122px;
    min-height: 88px;
    padding: 11px;
  }
  .am-status-pill strong {
    font-size: 0.78rem;
  }
  .am-status-pill small {
    font-size: 0.6rem;
  }
  .am-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .am-stat {
    padding: 10px 9px;
  }
  .am-stat span {
    width: 28px;
    height: 28px;
    border-radius: 10px;
  }
  .am-stat strong {
    font-size: 1.02rem;
  }
  .am-stat em,
  .am-stat small {
    font-size: 0.64rem;
  }
  .am-big-actions,
  .am-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .am-big-actions {
    padding: 10px;
  }
  .am-big-action,
  .am-action-card {
    min-height: 94px;
    border-radius: 16px;
    padding: 12px;
  }
  .am-big-action span,
  .am-action-card span {
    width: 32px;
    height: 32px;
    border-radius: 12px;
  }
  .am-big-action b,
  .am-action-card strong {
    font-size: 0.86rem;
  }
  .am-big-action small,
  .am-action-card small {
    font-size: 0.64rem;
  }
  .am-panel {
    border-radius: 16px;
  }
  .am-row {
    min-height: 66px;
  }
  .am-picker-modal {
    width: min(94vw, 430px) !important;
  }

  body[data-role="Director"] {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
    touch-action: none !important;
  }
  body[data-role="Director"] #app-shell.visible {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
  }
  body[data-role="Director"] #sidebar,
  body[data-role="Director"] #sidebar-overlay,
  body[data-role="Director"] #top-menubar,
  body[data-role="Director"] #global-quick-bar,
  body[data-role="Director"] #bottom-nav {
    display: none !important;
  }
  body[data-role="Director"] #top-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    min-height: calc(52px + env(safe-area-inset-top, 0px)) !important;
    height: auto !important;
    padding: calc(env(safe-area-inset-top, 0px) + 6px) 10px 7px !important;
    align-items: center !important;
    gap: 7px !important;
  }
  body[data-role="Director"] #main-content {
    display: block !important;
    position: fixed !important;
    top: calc(52px + env(safe-area-inset-top, 0px)) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(58px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: contain !important;
    background: var(--bg-main);
  }
  body[data-role="Director"] .page.active {
    display: block !important;
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
    padding: 10px !important;
  }
  body[data-role="Director"] #header-logo {
    gap: 8px !important;
  }
  body[data-role="Director"] #header-logo img {
    width: 32px !important;
    height: 32px !important;
    border-radius: 9px !important;
  }
  body[data-role="Director"] #header-logo span {
    max-width: 142px !important;
    font-size: 0.96rem !important;
    line-height: 1.05 !important;
  }
  body[data-role="Director"] .header-actions {
    gap: 6px !important;
  }
  body[data-role="Director"] .header-actions button[onclick="openUniversalSearch()"],
  body[data-role="Director"] #theme-toggle {
    display: none !important;
  }
  body[data-role="Director"] .header-actions button[onclick="openUniversalSearch()"],
  body[data-role="Director"] #theme-toggle,
  body[data-role="Director"] .header-actions button[title="Sign out"] {
    width: 38px !important;
    height: 38px !important;
    flex-basis: 38px !important;
    border-radius: 13px !important;
  }
  body[data-role="Director"] #user-avatar {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }
  body[data-role="Director"] #dm-bottom-nav {
    display: flex !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 58px;
    padding: 2px 4px env(safe-area-inset-bottom, 0px);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: 500;
    justify-content: space-around;
    align-items: center;
  }
  body[data-role="Director"].modal-open #dm-bottom-nav,
  body[data-role="Director"]:has(.modal-overlay.open) #dm-bottom-nav {
    transform: translateY(calc(100% + env(safe-area-inset-bottom, 0px)));
    pointer-events: none;
  }
  #dm-bottom-nav button {
    flex: 1;
    min-width: 0;
    height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 12px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  #dm-bottom-nav button.active {
    color: #16a34a;
    background: rgba(34, 197, 94, 0.12);
  }
  #dm-bottom-nav small {
    font-size: 0.58rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0;
    white-space: nowrap;
  }
  .dm-mobile-page {
    gap: 12px;
    padding-bottom: 12px;
  }
  .dm-hero {
    border-radius: 22px;
    padding: 15px;
    align-items: stretch;
  }
  .dm-hero h1 {
    font-size: 1.42rem;
  }
  .dm-hero p {
    font-size: 0.78rem;
    max-width: 22rem;
  }
  .dm-status-pill {
    width: 122px;
    min-height: 88px;
    padding: 11px;
  }
  .dm-status-pill strong {
    font-size: 0.78rem;
  }
  .dm-status-pill small {
    font-size: 0.6rem;
  }
  .dm-refresh-btn {
    min-height: 38px;
    padding: 0 10px;
  }
  .dm-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .dm-stat {
    padding: 10px 9px;
  }
  .dm-stat span {
    width: 28px;
    height: 28px;
    border-radius: 10px;
  }
  .dm-stat strong {
    font-size: 1.02rem;
  }
  .dm-stat em,
  .dm-stat small {
    font-size: 0.64rem;
  }
  .dm-action-grid,
  .dm-two-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .dm-today-card,
  .dm-panel {
    border-radius: 18px;
  }
  .dm-section-title {
    padding: 12px;
  }
  .dm-today-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
  }
  .dm-today-metric {
    min-height: 94px;
    border-radius: 15px;
    padding: 10px 8px;
  }
  .dm-today-metric span {
    width: 29px;
    height: 29px;
    border-radius: 11px;
  }
  .dm-today-metric strong {
    font-size: 0.88rem;
  }
  .dm-today-metric em,
  .dm-today-metric small {
    font-size: 0.6rem;
  }
  .dm-action-card {
    min-height: 92px;
    border-radius: 16px;
    padding: 12px;
  }
  .dm-action-card span {
    width: 32px;
    height: 32px;
    border-radius: 12px;
  }
  .dm-action-card strong {
    font-size: 0.86rem;
  }
  .dm-action-card small {
    font-size: 0.64rem;
  }
  .dm-priority-panel,
  .dm-panel {
    border-radius: 16px;
  }
  .dm-watch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 9px;
  }
  .dm-watch-grid .dm-metric {
    min-height: 76px;
  }
  .dm-row,
  .dm-metric {
    min-height: 66px;
  }
  .dm-secondary-panels {
    grid-template-columns: 1fr;
  }
  .dm-report-summary,
  .dm-aging-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dm-report-body {
    padding: 8px;
  }
  .dm-report-mini {
    padding: 8px;
  }
  .dm-report-tabs {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 8px;
  }
  .dm-report-tabs button {
    min-height: 46px;
    border-radius: 11px;
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 0 5px;
    padding: 6px 7px;
  }
  .dm-report-tabs button span {
    width: 16px;
    height: 16px;
  }
  .dm-report-tabs button strong {
    font-size: 0.68rem;
  }
  .dm-report-tabs button small {
    font-size: 0.5rem;
  }
  .dm-report-row {
    border-radius: 12px;
    padding: 8px;
    grid-template-columns: minmax(0, 1fr) minmax(72px, auto);
  }
  .dm-report-row strong {
    font-size: 0.74rem;
  }
  .dm-report-row small {
    font-size: 0.59rem;
    max-width: 100%;
  }
  .dm-report-row b {
    font-size: 0.7rem;
  }
  .dm-report-row em {
    font-size: 0.52rem;
    padding: 2px 6px;
  }
}

/* FINAL OVERRIDE: Sales Rep mobile uses #main-content as the only scroll area.
   This must remain at the very end of the file. */
@media (max-width: 767px) {
  html,
  body[data-role="Sales Rep"] {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
    touch-action: none !important;
  }
  body[data-role="Sales Rep"] #app-shell.visible {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    overflow: hidden !important;
    position: fixed !important;
    inset: 0 !important;
  }
  body[data-role="Sales Rep"] #top-header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 44px !important;
  }
  body[data-role="Sales Rep"] #main-content {
    display: block !important;
    position: fixed !important;
    top: 44px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 0 18px !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: contain !important;
  }
  body[data-role="Sales Rep"] .page.active {
    display: block !important;
    min-height: auto !important;
    height: auto !important;
    overflow: visible !important;
    padding-bottom: 18px !important;
  }
  body[data-role="Sales Rep"] #sr-bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
  }

  /* iPhone Sales Rep home polish: respect the notch/status bar and use a
     denser phone layout instead of the squeezed tablet-style cards. */
  body[data-role="Sales Rep"] #top-header {
    min-height: calc(52px + env(safe-area-inset-top, 0px)) !important;
    height: auto !important;
    padding: calc(env(safe-area-inset-top, 0px) + 6px) 10px 7px !important;
    align-items: center !important;
    gap: 7px !important;
  }
  body[data-role="Sales Rep"] #header-logo {
    gap: 8px !important;
  }
  body[data-role="Sales Rep"] #header-logo img {
    width: 32px !important;
    height: 32px !important;
    border-radius: 9px !important;
  }
  body[data-role="Sales Rep"] #header-logo span {
    max-width: 132px !important;
    font-size: 0.96rem !important;
    line-height: 1.05 !important;
  }
  body[data-role="Sales Rep"] .header-actions {
    gap: 6px !important;
  }
  body[data-role="Sales Rep"] .header-actions button[onclick="openUniversalSearch()"],
  body[data-role="Sales Rep"] #theme-toggle,
  body[data-role="Sales Rep"] .header-actions button[title="Sign out"] {
    width: 38px !important;
    height: 38px !important;
    flex-basis: 38px !important;
    border-radius: 13px !important;
    font-size: 1rem !important;
  }
  body[data-role="Sales Rep"] #user-avatar {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
    font-size: 0.86rem !important;
  }
  body[data-role="Sales Rep"] #network-dot {
    width: 9px !important;
    height: 9px !important;
    flex-basis: 9px !important;
  }
  body[data-role="Sales Rep"] #main-content {
    top: calc(52px + env(safe-area-inset-top, 0px)) !important;
    padding: 0 0 14px !important;
  }
  body[data-role="Sales Rep"] .page.active {
    padding: 10px 10px 14px !important;
  }
  body[data-role="Sales Rep"] .sls-mobile-action-row {
    margin: 2px 0 10px !important;
    gap: 8px !important;
  }
  body[data-role="Sales Rep"] .sls-mobile-action-right {
    gap: 8px !important;
    width: 100%;
  }
  body[data-role="Sales Rep"] #sls-bt-printer-btn {
    min-height: 42px !important;
    max-width: 104px !important;
    padding: 0 10px !important;
    border-radius: 14px !important;
    font-size: 0.72rem !important;
    justify-content: center !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  body[data-role="Sales Rep"] .sls-create-btn {
    flex: 1 1 auto !important;
    min-height: 42px !important;
    padding: 0 12px !important;
    border-radius: 14px !important;
    font-size: 0.78rem !important;
    justify-content: center !important;
    white-space: nowrap !important;
  }
  body[data-role="Sales Rep"] .sr-home-page {
    padding-bottom: 10px !important;
  }
  body[data-role="Sales Rep"] .sr-home-hero,
  body[data-role="Sales Rep"] .sr-home-customer-card {
    border-radius: 14px !important;
    padding: 12px !important;
    margin-bottom: 10px !important;
  }
  body[data-role="Sales Rep"] .sr-home-hero h2 {
    font-size: 1rem !important;
    line-height: 1.15 !important;
  }
  body[data-role="Sales Rep"] .sr-home-hero p,
  body[data-role="Sales Rep"] .sr-home-customer-card p {
    font-size: 0.68rem !important;
    line-height: 1.28 !important;
  }
  body[data-role="Sales Rep"] .sr-home-actions {
    gap: 9px !important;
    margin-bottom: 10px !important;
  }
  body[data-role="Sales Rep"] .sr-home-action {
    min-height: 78px !important;
    padding: 10px !important;
    gap: 9px !important;
    border-radius: 14px !important;
  }
  body[data-role="Sales Rep"] .sr-home-action-ic {
    width: 36px !important;
    height: 36px !important;
    border-radius: 12px !important;
    font-size: 1.05rem !important;
  }
  body[data-role="Sales Rep"] .sr-home-action strong {
    font-size: 0.78rem !important;
    line-height: 1.12 !important;
  }
  body[data-role="Sales Rep"] .sr-home-action small {
    font-size: 0.58rem !important;
    line-height: 1.15 !important;
    margin-top: 2px !important;
  }
  body[data-role="Sales Rep"] .sr-home-customer-card h3 {
    font-size: 0.9rem !important;
  }
  body[data-role="Sales Rep"] .sr-home-customer-row {
    gap: 7px !important;
    margin-bottom: 9px !important;
  }
  body[data-role="Sales Rep"] .sr-home-customer-stat {
    padding: 8px 6px !important;
    border-radius: 10px !important;
  }
  body[data-role="Sales Rep"] .sr-home-customer-stat strong {
    font-size: 0.92rem !important;
  }
  body[data-role="Sales Rep"] .sr-home-customer-stat span {
    font-size: 0.55rem !important;
  }
  body[data-role="Sales Rep"] .sr-home-customer-actions button {
    min-height: 42px !important;
    border-radius: 12px !important;
    font-size: 0.72rem !important;
  }
  body[data-role="Sales Rep"] .sr-home-metrics {
    gap: 8px !important;
  }
  body[data-role="Sales Rep"] .sr-home-metric {
    min-height: 74px !important;
    padding: 9px !important;
    border-radius: 12px !important;
  }

  @media (max-width: 430px) {
    body[data-role="Sales Rep"] #top-header {
      gap: 6px !important;
      padding-left: 8px !important;
      padding-right: 8px !important;
    }
    body[data-role="Sales Rep"] #header-logo {
      gap: 7px !important;
    }
    body[data-role="Sales Rep"] #header-logo img {
      width: 30px !important;
      height: 30px !important;
    }
    body[data-role="Sales Rep"] #header-logo span {
      max-width: 82px !important;
      font-size: 0.86rem !important;
    }
    body[data-role="Sales Rep"] .header-actions {
      gap: 5px !important;
    }
    body[data-role="Sales Rep"] .header-actions button[title="Sign out"] {
      display: none !important;
    }
    body[data-role="Sales Rep"] .header-actions button[onclick="openUniversalSearch()"],
    body[data-role="Sales Rep"] #theme-toggle {
      width: 36px !important;
      height: 36px !important;
      flex-basis: 36px !important;
    }
    body[data-role="Sales Rep"] #header-mode-badge {
      padding: 4px 7px !important;
      font-size: 0.58rem !important;
      letter-spacing: 0.03em !important;
    }
    body[data-role="Sales Rep"] #user-avatar {
      width: 34px !important;
      height: 34px !important;
      flex-basis: 34px !important;
    }
  }
  body[data-role="Sales Rep"] #sales-order-modal,
  body[data-role="Sales Rep"] #sales-order-modal .modal,
  body[data-role="Sales Rep"] #sales-order-modal .modal-body {
    touch-action: pan-y !important;
  }
  body[data-role="Sales Rep"] #sales-order-modal .modal-body {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  body[data-role="Sales Rep"] #col-entry-modal {
    align-items: flex-start !important;
    justify-content: center !important;
    z-index: 10090 !important;
    overflow: hidden !important;
    touch-action: pan-y !important;
    padding: 8px !important;
  }
  body[data-role="Sales Rep"] #col-entry-modal .col-entry-modal-card {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: calc(100vh - 16px) !important;
    margin: 0 !important;
    display: block !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
  }
  @supports (height: 100dvh) {
    body[data-role="Sales Rep"] #col-entry-modal .col-entry-modal-card {
      max-height: calc(100dvh - 16px) !important;
    }
  }
  body[data-role="Sales Rep"] #col-entry-modal .col-entry-shell {
    display: block !important;
    min-height: auto !important;
    overflow: visible !important;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 112px) !important;
  }
  body[data-role="Sales Rep"] #col-entry-modal .col-entry-main,
  body[data-role="Sales Rep"] #col-entry-modal .col-entry-side {
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body[data-role="Sales Rep"] #sales-cust-modal {
    align-items: flex-start !important;
    justify-content: center !important;
    z-index: 1300 !important;
    overflow: hidden !important;
    touch-action: pan-y !important;
  }
  body[data-role="Sales Rep"] #sales-cust-modal .modal,
  body[data-role="Sales Rep"] #sales-cust-modal .modal-content {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    touch-action: pan-y !important;
  }
  @supports (height: 100dvh) {
    body[data-role="Sales Rep"] #sales-cust-modal .modal,
    body[data-role="Sales Rep"] #sales-cust-modal .modal-content {
      height: 100dvh !important;
      max-height: 100dvh !important;
    }
  }
  body[data-role="Sales Rep"] #sales-cust-modal .modal-header {
    flex: 0 0 auto !important;
    border-radius: 0 !important;
    z-index: 2 !important;
  }
  body[data-role="Sales Rep"] #sales-cust-modal .modal-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior-y: contain !important;
    touch-action: pan-y !important;
    padding: 14px 14px calc(env(safe-area-inset-bottom, 0px) + 34px) !important;
  }
  body[data-role="Sales Rep"] #sales-cust-modal #sc-form {
    padding-bottom: 22px !important;
  }
}

/* Final batch invoice overrides live after mobile role rules. */
body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] .modal {
  width: min(1180px, calc(100vw - 32px)) !important;
  max-width: 1180px !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 320px !important;
  gap: 14px !important;
  align-items: start !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode > #so-customer-side-panel {
  display: flex !important;
  grid-column: 2 !important;
  grid-row: 1 / span 20 !important;
}

@media (max-width: 980px) {
  .sls-approvals-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 980px) {
  body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode {
    grid-template-columns: 1fr !important;
  }
  body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode > #so-customer-side-panel {
    grid-column: 1 !important;
    grid-row: auto !important;
    position: static !important;
    max-height: none !important;
  }
}

/* Compact Batch Invoice modal: keep the paper-entry work area near the top. */
body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] .modal {
  width: min(1120px, calc(100vw - 32px)) !important;
  max-width: 1120px !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] .modal-body {
  padding: 10px 12px 12px !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode {
  grid-template-columns: minmax(0, 1fr) 270px !important;
  gap: 10px !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode > #so-customer-side-panel {
  grid-row: 1 / span 8 !important;
}
#sales-order-modal[data-batch-entry="1"] [id^="draft-banner-"] {
  min-height: 38px !important;
  margin-bottom: 10px !important;
  padding: 7px 10px !important;
  border-radius: 10px !important;
}
#sales-order-modal[data-batch-entry="1"] [id^="draft-banner-"] > div:first-child {
  font-size: 0.74rem !important;
  font-weight: 900 !important;
}
#sales-order-form.so-batch-simple-mode > .section-title:first-of-type {
  display: none !important;
}
#sales-order-form.so-batch-simple-mode .section-title,
#sales-order-form.so-batch-simple-mode .form-section-title,
#sales-order-form.so-batch-simple-mode .required-first,
#sales-order-form.so-batch-simple-mode .so-required-strip {
  min-height: 32px !important;
  margin-bottom: 8px !important;
  padding: 7px 10px !important;
  border-radius: 10px !important;
}
body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] .so-batch-side-panel {
  padding: 8px !important;
  gap: 8px !important;
  border-radius: 12px !important;
}
#sales-order-modal[data-batch-entry="1"] .so-batch-empty-customer {
  display: none !important;
}
#sales-order-form.so-batch-simple-mode .so-sync-status {
  min-height: 44px !important;
  margin-bottom: 8px !important;
  padding: 8px 9px !important;
  border-radius: 10px !important;
}
#sales-order-form.so-batch-simple-mode .so-sync-copy {
  align-items: center !important;
  gap: 8px !important;
}
#sales-order-form.so-batch-simple-mode .so-sync-status small {
  display: inline !important;
  margin-top: 0 !important;
  font-size: 0.66rem !important;
}
#sales-order-form.so-batch-simple-mode .so-date-lock-note {
  font-size: 0.64rem !important;
}
#sales-order-form.so-batch-simple-mode .so-sync-date-field {
  flex-basis: 140px !important;
  min-width: 136px !important;
}
#sales-order-form.so-batch-simple-mode .so-batch-context-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
  padding: 7px 9px;
  border-radius: 10px;
}
#sales-order-form.so-batch-simple-mode .so-batch-context-strip strong {
  font-size: 0.74rem;
}
#sales-order-form.so-batch-simple-mode .so-invoice-head {
  padding: 8px 9px 9px !important;
  margin-bottom: 8px !important;
  border-radius: 11px !important;
}
#sales-order-form.so-batch-simple-mode .so-doc-grid {
  gap: 7px !important;
  margin-bottom: 7px !important;
}
#sales-order-form.so-batch-simple-mode .so-doc-number-wrap {
  grid-template-columns: minmax(0, 1fr) auto auto !important;
}
#sales-order-form.so-batch-simple-mode .so-doc-input,
#sales-order-form.so-batch-simple-mode .so-doc-next-btn,
#sales-order-form.so-batch-simple-mode #so-customer-search {
  min-height: 38px !important;
  height: 38px !important;
  border-radius: 9px !important;
  font-size: 0.82rem !important;
}
#sales-order-form.so-batch-simple-mode .so-customer-label-row {
  margin-top: 9px !important;
  margin-bottom: 6px !important;
  padding: 7px 8px !important;
  border: 1px solid rgba(37,99,235,0.28);
  border-radius: 10px;
  background: rgba(37,99,235,0.08);
  color: #2563eb !important;
}
#sales-order-form.so-batch-simple-mode .so-customer-label-row span {
  color: #2563eb !important;
  font-size: 0.74rem !important;
  font-weight: 950 !important;
}
#sales-order-form.so-batch-simple-mode #so-customer-search {
  height: 50px !important;
  min-height: 50px !important;
  border: 2px solid rgba(37,99,235,0.62) !important;
  background: #fff !important;
  color: var(--text-primary) !important;
  font-size: 0.96rem !important;
  font-weight: 850 !important;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.10) !important;
}
#sales-order-form.so-batch-simple-mode #so-customer-search::placeholder {
  color: #64748b !important;
  opacity: 1;
  font-weight: 800;
}
.so-standalone-invoice-card #sales-order-form .so-customer-label-row {
  margin-top: 10px;
  margin-bottom: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(37,99,235,0.30);
  border-radius: 11px;
  background: rgba(37,99,235,0.08);
  color: #2563eb;
}
.so-standalone-invoice-card #sales-order-form .so-customer-label-row span {
  color: #2563eb;
  font-size: 0.76rem;
  font-weight: 950;
}
.so-standalone-invoice-card #sales-order-form #so-customer-search {
  min-height: 52px;
  height: 52px;
  border: 2px solid rgba(37,99,235,0.62);
  background: #fff;
  color: var(--text-primary);
  font-size: 0.98rem;
  font-weight: 850;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.10);
}
.so-standalone-invoice-card #sales-order-form #so-customer-search::placeholder {
  color: #64748b;
  opacity: 1;
  font-weight: 800;
}
#sales-order-form.so-batch-simple-mode .so-doc-next-btn {
  min-width: 58px !important;
  padding: 0 10px !important;
  white-space: nowrap !important;
}
#sales-order-form.so-batch-simple-mode .so-doc-label,
#sales-order-form.so-batch-simple-mode .so-field-label-row {
  min-height: 18px !important;
  margin-bottom: 3px !important;
  font-size: 0.6rem !important;
}
#sales-order-form.so-batch-simple-mode .so-new-customer-btn {
  min-height: 30px !important;
  padding: 0 10px !important;
  border-radius: 9px !important;
  font-size: 0.68rem !important;
}
#sales-order-modal[data-batch-entry="1"] .so-batch-recent-card {
  padding: 9px !important;
  border-radius: 11px !important;
}
#sales-order-modal[data-batch-entry="1"] .so-side-section-title {
  margin-bottom: 7px !important;
}
#sales-order-modal[data-batch-entry="1"] .so-batch-mini-metrics {
  gap: 5px !important;
  margin-bottom: 7px !important;
}
#sales-order-modal[data-batch-entry="1"] .so-batch-mini-metrics div {
  padding: 6px 7px !important;
}
#sales-order-modal[data-batch-entry="1"] .so-batch-recent-list {
  max-height: 154px;
  overflow-y: auto;
  gap: 5px;
}
#sales-order-modal[data-batch-entry="1"] .so-batch-recent-item {
  min-height: 42px;
  padding: 6px 7px !important;
  border-radius: 8px !important;
}
#sales-order-modal[data-batch-entry="1"] .so-batch-recent-item b {
  display: none;
}
#sales-order-modal[data-batch-entry="1"] .so-batch-manual-chip {
  max-width: 82px;
  padding: 2px 7px;
  font-size: 0.62rem;
}
#sales-order-modal .so-item-row .so-prod-menu {
  position: absolute;
  left: 12px;
  right: 42px;
  top: 74px;
  z-index: 60;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22);
  padding: 6px;
}
#sales-order-modal .so-prod-search:focus ~ .so-prod-menu,
#sales-order-modal .so-prod-menu:hover {
  display: block !important;
}
#sales-order-modal .so-prod-menu-option {
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}
#sales-order-modal .so-prod-menu-option:hover,
#sales-order-modal .so-prod-menu-option:focus {
  background: var(--bg-elevated);
}
#sales-order-modal .so-prod-menu-option strong {
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#sales-order-modal .so-prod-menu-option span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
  padding: 2px 7px;
  font-size: 0.6rem;
  font-weight: 900;
}
#sales-order-modal .so-prod-menu-empty {
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 850;
}
.batch-next-loading,
.batch-next-error {
  margin: 24px auto;
  width: min(1160px, calc(100% - 32px));
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.batch-next-loading {
  padding: 18px;
}
.batch-next-loading-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.batch-next-loading-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #1a1a00;
  font-weight: 950;
}
.batch-next-loading-head strong,
.batch-next-error h1 {
  display: block;
  color: var(--text-primary);
  font-weight: 950;
}
.batch-next-loading-head span,
.batch-next-error p,
.batch-next-error span {
  color: var(--text-muted);
  font-weight: 800;
}
.batch-next-loading-row,
.batch-next-loading-grid div {
  min-height: 46px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--bg-elevated), rgba(148, 163, 184, 0.16), var(--bg-elevated));
  background-size: 220% 100%;
  animation: batchNextPulse 1.4s ease-in-out infinite;
}
.batch-next-loading-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.batch-next-error {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.batch-next-error h1 {
  margin: 4px 0;
  font-size: 1.05rem;
}
.batch-next-error p {
  margin: 0;
  font-size: 0.78rem;
}
.batch-next-error button {
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 11px;
  background: var(--accent);
  color: #1a1a00;
  cursor: pointer;
  font-weight: 950;
  min-height: 40px;
  padding: 0 18px;
}
@keyframes batchNextPulse {
  0% { background-position: 0% 50%; }
  100% { background-position: 220% 50%; }
}
@media (max-width: 720px) {
  .batch-next-loading-grid {
    grid-template-columns: 1fr 1fr;
  }
  .batch-next-error {
    align-items: stretch;
    flex-direction: column;
  }
}
@media (max-width: 980px) {
  body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode {
    grid-template-columns: 1fr !important;
  }
  body:not([data-role="Sales Rep"]) #sales-order-modal[data-batch-entry="1"] #sales-order-form.so-batch-simple-mode > #so-customer-side-panel {
    grid-row: auto !important;
  }
  #sales-order-form.so-batch-simple-mode .so-doc-grid,
  #sales-order-form.so-batch-simple-mode .so-batch-context-strip {
    grid-template-columns: 1fr !important;
  }
}

/* Credit Approval: keep module-rendered controls styled even when inline
   module style tags are stripped by the Next/legacy hybrid shell. */
.cr-tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
  overflow-x: auto;
}
.cr-tab-btn {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  padding: 9px 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  transition: all .2s cubic-bezier(0.165,0.84,0.44,1);
}
.cr-tab-btn.active {
  background: var(--accent);
  color: #1a1a00;
}
.cr-tab-btn:not(.active) {
  background: transparent;
  color: var(--text-muted);
}
.cr-pending-list {
  display: grid;
  gap: 14px;
}
.cr-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 14px;
  transition: box-shadow .25s cubic-bezier(0.165,0.84,0.44,1), transform .25s cubic-bezier(0.165,0.84,0.44,1);
}
.cr-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.cr-progress {
  height: 6px;
  border-radius: 3px;
  background: rgba(0,0,0,0.07);
  overflow: hidden;
  flex: 1;
}
.cr-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .7s cubic-bezier(0.165,0.84,0.44,1);
}
.cr-btn {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .12s, opacity .15s, background .18s;
  touch-action: manipulation;
}
.cr-avatar {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 900;
  flex-shrink: 0;
}
.cr-urgent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}
.cr-history-row {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  overflow: hidden;
}
.cr-card-body {
  padding: 14px 16px;
  cursor: pointer;
}
.cr-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.cr-card-main {
  flex: 1;
  min-width: 0;
}
.cr-customer-line {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cr-customer-line div {
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.cr-request-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.cr-request-line > span:not(.cr-pill) {
  font-size: 0.62rem;
  color: var(--text-muted);
}
.cr-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.cr-amount div {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--accent);
}
.cr-amount span {
  font-size: 0.6rem;
  color: var(--text-muted);
}
.cr-dismiss {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
}
.cr-items {
  font-size: 0.67rem;
  color: var(--text-muted);
  margin-bottom: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cr-status-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cr-actions {
  display: flex;
  border-top: 1px solid var(--border);
}
.cr-no-access {
  padding: 8px 16px;
  font-size: 0.68rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
}
.cr-quick-approve,
.cr-quick-reject {
  flex: 1;
  padding: 12px;
  border: none;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s, color .15s;
  touch-action: manipulation;
}
.cr-quick-approve {
  background: rgba(34,197,94,0.07);
  color: #22c55e;
  border-right: 1px solid var(--border);
}
.cr-quick-reject {
  background: rgba(239,68,68,0.05);
  color: #ef4444;
}
.cr-btn:active,
.cr-card:active,
.cr-quick-approve:active,
.cr-quick-reject:active {
  transform: scale(0.98);
}
@media (hover:hover) and (pointer:fine) {
  .cr-card:hover {
    box-shadow: 0 10px 36px rgba(0,0,0,0.13);
    transform: translateY(-2px);
  }
  .cr-tab-btn:not(.active):hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
  }
  .cr-quick-approve:hover {
    background: #22c55e !important;
    color: #fff !important;
  }
  .cr-quick-reject:hover {
    background: #ef4444 !important;
    color: #fff !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cr-card,
  .cr-history-row {
    transition: none !important;
  }
}
@media (max-width: 640px) {
  .cr-card-top {
    align-items: flex-start;
  }
  .cr-amount {
    align-items: flex-start;
  }
  .cr-dismiss {
    display: none;
  }
  .cr-tab-btn {
    flex: 0 0 auto;
  }
  .cr-history-row {
    align-items: flex-start;
  }
  .cr-status-pills {
    gap: 5px;
  }
}
