:root {
  --sidebar-w:   260px;
  --sidebar-bg:  #1A1D21;
  --sidebar-hover: rgba(255,255,255,.08);
  --sidebar-active: rgba(255,255,255,.12);

  --ink:         #1F1E1B;
  --ink-soft:    #2A2926;
  --cream:       #F7F7F5;
  --warm-gray:   #B1ADA1;
  --amber:       #D4A843;
  --amber-dark:  #B8912E;
  --amber-soft:  #FDF6E3;
  --anker-blue:  #00A2E1;
  --bg:          var(--cream);
  --card:        #ffffff;
  --text:        var(--ink);
  --muted:       #6B6862;
  --border:      #E5E2DA;
  --ok:          #15803D;
  --ok-bg:       #E8F3EC;
  --warn:        #B45309;
  --warn-bg:     #FFF6E6;
  --error:       #B91C1C;
  --error-bg:    #FEE2E2;
  --shadow-sm:   0 1px 2px rgba(31,30,27,.04);
  --shadow-md:   0 4px 14px rgba(31,30,27,.07);
  --shadow-lg:   0 12px 40px rgba(31,30,27,.12);
  --radius:      10px;
  --radius-sm:   6px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: absolute; top: -100px; inset-inline-start: 12px;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px;
  text-decoration: none; font-weight: 600; font-size: 14px; z-index: 1000;
}
.skip-link:focus { top: 12px; }

html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.55;
  min-height: 100vh; display: flex;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════ */

.sidebar {
  position: fixed; top: 0; inset-inline-start: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--sidebar-bg); color: #fff;
  display: flex; flex-direction: column; z-index: 100;
  overflow-y: auto; overflow-x: hidden;
  transition: transform .25s ease;
}

.sidebar-header {
  padding: 20px 20px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-logo { height: 32px; width: auto; }
.brand-text { color: #fff; font-size: 18px; font-weight: 700; white-space: nowrap; }
.brand-text em { font-style: normal; font-weight: 400; opacity: .7; }

/* BU Toggle in sidebar */
.bu-toggle {
  display: flex; gap: 2px;
  background: rgba(255,255,255,.06); border-radius: var(--radius-sm);
  padding: 3px; margin: 12px 16px;
}
.bu-toggle button {
  flex: 1; background: transparent; color: rgba(255,255,255,.55); border: none;
  padding: 6px 8px; border-radius: 4px; cursor: pointer;
  font-size: 12px; font-weight: 600; transition: all .15s; white-space: nowrap;
}
.bu-toggle button.active { background: var(--amber); color: #fff; }
.bu-toggle button:hover:not(.active) { color: #fff; background: rgba(255,255,255,.08); }

/* Sidebar nav */
.sidebar-nav {
  flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px;
}
.sidebar-nav .nav-section {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,.35); padding: 16px 8px 6px; user-select: none;
}
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.7); text-decoration: none;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; transition: all .12s;
  min-height: 40px;
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .6; }
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a:hover svg { opacity: .9; }
.sidebar-nav a.active { background: var(--sidebar-active); color: #fff; }
.sidebar-nav a.active svg { opacity: 1; color: var(--amber); }
.sidebar-nav a .badge {
  margin-inline-start: auto; background: var(--amber); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08);
}
.user-info {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px; border-radius: var(--radius-sm); cursor: default;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--amber); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.user-meta { overflow: hidden; }
.user-meta .name { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta .role { color: rgba(255,255,255,.45); font-size: 11px; }
.sidebar-footer .footer-actions {
  display: flex; gap: 4px; margin-top: 8px;
}
.sidebar-footer .footer-btn {
  flex: 1; background: rgba(255,255,255,.06); color: rgba(255,255,255,.6);
  border: none; padding: 7px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 11px; font-weight: 500; transition: all .12s;
}
.sidebar-footer .footer-btn:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ═══════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════════ */

.main-content {
  margin-inline-start: var(--sidebar-w);
  flex: 1; min-height: 100vh;
  padding: 28px 32px;
  max-width: calc(100vw - var(--sidebar-w));
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE HEADER
   ═══════════════════════════════════════════════════════════════════════ */

.mobile-header {
  /* `fixed` (not `sticky`) so the hamburger stays reachable regardless
     of scroll quirks on iOS Safari, where sticky inside an
     overflow-x:hidden body intermittently reverts to relative. */
  display: none; position: fixed; top: 0; inset-inline-start: 0; inset-inline-end: 0; z-index: 90;
  background: var(--sidebar-bg); color: #fff;
  padding: 10px 16px; align-items: center; gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.mobile-brand {
  font-size: 16px; font-weight: 700; flex: 1; min-width: 0;
  /* One line, always. Wrapped, it made the fixed header taller than the
     room the page leaves under it, and the page title slid beneath it —
     in Arabic at every phone width, where الطاقة الشمسية makes the
     business toggle wider, and in English on the narrowest phones. */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 370px) { .mobile-brand-more { display: none; } }
@media (max-width: 410px) {
  html[lang="ar"] .mobile-brand-more { display: none; }
  html[lang="ar"] .bu-toggle-mobile button { padding-inline: 6px; }
}
.hamburger {
  background: none; border: none; color: #fff;
  cursor: pointer; padding: 8px; min-height: 44px; min-width: 44px;
}
.hamburger svg { width: 24px; height: 24px; }

.bu-toggle-mobile { margin: 0; background: rgba(255,255,255,.1); }

/* Mobile menu overlay */
.menu-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; }
.menu-backdrop.open { display: block; }
.mobile-menu {
  display: none; position: fixed; top: 0; inset-inline-start: 0; bottom: 0; width: min(80vw, 300px);
  background: var(--sidebar-bg); z-index: 201; overflow-y: auto; overflow-x: hidden;
  transform: translateX(-100%); transition: transform .25s ease;
}
html[dir="rtl"] .mobile-menu { transform: translateX(100%); }
.mobile-menu.open { display: block; transform: translateX(0); }
/* RTL needs its own open rule — html[dir="rtl"] .mobile-menu outranks
   .mobile-menu.open, so without this the panel stays translated off-screen. */
html[dir="rtl"] .mobile-menu.open { transform: translateX(0); }
.mobile-menu-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.mobile-menu-header .brand-logo { height: 28px; width: auto; }
.close-menu { background: none; border: none; color: rgba(255,255,255,.6); cursor: pointer; padding: 8px; }
.close-menu svg { width: 20px; height: 20px; }
.mobile-menu nav { padding: 12px; }
.mobile-menu nav a {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.7); text-decoration: none;
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; margin-bottom: 2px;
}
/* Constrain inline nav icons (SVGs carry only a viewBox, so without an
   explicit size they balloon to the browser default ~300px). */
.mobile-menu nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.mobile-menu nav a:hover, .mobile-menu nav a.active { background: rgba(255,255,255,.1); color: #fff; }

@media (max-width: 900px) {
  /* Body is flex-row on desktop (sidebar + content). On mobile the sidebar
     is removed, so switch to normal block flow. */
  body { display: block; }
  .sidebar { display: none !important; }
  .mobile-header { display: flex !important; }
  /* The hidden attribute must still win (e.g. on the login screen) */
  .mobile-header[hidden], .sidebar[hidden] { display: none !important; }
  .main-content {
    margin-inline-start: 0 !important; margin-inline-end: 0 !important;
    max-width: 100vw; padding: 16px;
  }
  /* Reserve room for the fixed mobile-header (padding 10 + 44px hamburger
     + padding 10 = 64px) plus the device safe-area inset above it. */
  .mobile-header:not([hidden]) ~ .main-content {
    padding-top: calc(64px + env(safe-area-inset-top));
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   CARDS & CONTAINERS
   ═══════════════════════════════════════════════════════════════════════ */

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border);
  padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.card h3 { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--muted); }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-header h1 { font-size: 24px; font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════ */

.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--amber); color: #fff; border: none;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .12s; text-decoration: none;
}
.btn-primary:hover { background: var(--amber-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .12s; text-decoration: none;
}
.btn-secondary:hover { background: var(--cream); border-color: var(--warm-gray); }

.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--error); color: #fff; border: none;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-danger:hover { opacity: .9; }

.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 12px; font-weight: 500; transition: all .12s;
}
.btn-ghost:hover { background: var(--cream); color: var(--text); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.icon-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: all .12s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--cream); color: var(--text); border-color: var(--warm-gray); }

/* ═══════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════ */

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .03em;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  background: var(--card); color: var(--text); transition: border-color .12s;
}
input[type="checkbox"], input[type="radio"] {
  width: 18px; height: 18px; flex-shrink: 0; cursor: pointer;
  accent-color: var(--amber);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus, select:focus, textarea:focus {
  outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px rgba(212,168,67,.15);
}
textarea { resize: vertical; min-height: 80px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 140px; }

/* Filters bar */
.filters {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-end;
}
.filters input, .filters select { width: auto; min-width: 150px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border); padding: 6px 14px;
  border-radius: 20px; font-size: 12px; font-weight: 500; cursor: pointer;
  transition: all .12s;
}
.filter-chip:hover { border-color: var(--amber); }
.filter-chip.active { background: var(--amber-soft); border-color: var(--amber); color: var(--amber-dark); }

/* ═══════════════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════════════ */

table {
  width: 100%; border-collapse: collapse;
  background: var(--card); border-radius: var(--radius);
  overflow: hidden;
}
th, td {
  padding: 10px 14px; text-align: start; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--cream); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  position: sticky; top: 0;
}
tbody tr { transition: background .08s; }
tbody tr:hover { background: rgba(212,168,67,.04); }
tbody tr:last-child td { border-bottom: none; }
.right { text-align: end !important; }
.center { text-align: center !important; }
/* A date, a document number or an amount on one line: a narrow column
   broke "2026-09-05" after "2026-09-" and "26-114502" after "26-". */
.nowrap { white-space: nowrap; }

@media (max-width: 700px) {
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tr { margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }
  td { padding: 6px 8px; display: flex; justify-content: space-between; align-items: center; }
  td::before { content: attr(data-label); font-weight: 600; font-size: 12px; color: var(--muted); }
  td.right { text-align: end; }
  /* A statement stays a table, scrolling sideways in its own box: seven
     columns of figures read across, not as a card per row. */
  table.keep-table { display: table; }
  table.keep-table thead { display: table-header-group; }
  table.keep-table tbody { display: table-row-group; }
  table.keep-table tr { display: table-row; margin: 0; border: none; border-radius: 0; padding: 0; }
  table.keep-table th, table.keep-table td { display: table-cell; padding: 4px 6px; }
  table.keep-table td::before { content: none; }
}

/* ═══════════════════════════════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════════════════════════════ */

.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}

/* Dashboard: the tracked-open-PO cards take a full-width row of their own —
   one card per business unit, each laying its PO and LC ledgers side by side
   when the card is wide enough. Class-pair specificity so the .kpi-grid
   breakpoint overrides further down don't re-narrow this row. */
.kpi-grid.po-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.po-ledgers {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 24px; margin-top: 12px;
}
@media (max-width: 900px) {
  .kpi-grid.po-grid { grid-template-columns: 1fr; }
}
.kpi-card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ''; position: absolute; top: 0; inset-inline-start: 0; inset-inline-end: 0; height: 3px;
  background: var(--border);
}
.kpi-card.ok::before { background: var(--ok); }
.kpi-card.warn::before { background: var(--warn); }
.kpi-card.accent::before { background: var(--amber); }
.kpi-card.blue::before { background: var(--anker-blue); }
.kpi-card.error::before { background: var(--error); }
.kpi-label { font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--ink); }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════════════
   PILLS & BADGES
   ═══════════════════════════════════════════════════════════════════════ */

.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.pill-pending   { background: var(--warn-bg); color: var(--warn); }
.pill-deposited { background: #E0F2FE; color: #0369A1; }
.pill-cleared   { background: var(--ok-bg); color: var(--ok); }
.pill-bounced   { background: var(--error-bg); color: var(--error); }
.pill-replaced  { background: #F3E8FF; color: #7C3AED; }
.pill-cancelled { background: #F3F3F0; color: #888; }
.pill-active    { background: var(--ok-bg); color: var(--ok); }
.pill-rejected  { background: var(--error-bg); color: var(--error); }

/* Stock Balance — weeks-to-sell-out cover bands. Hot is red for urgency
   (it's about to run out), stale grey because the stock is just sitting. */
.pill-hot       { background: var(--error-bg); color: var(--error); }
.pill-healthy   { background: var(--ok-bg); color: var(--ok); }
.pill-slow      { background: var(--warn-bg); color: var(--warn); }
.pill-stale     { background: #EDEAE3; color: #57534E; }
.pill-new       { background: #E0F2FE; color: #0369A1; }
.pill-out       { background: #F3F3F0; color: #888; }
.pill-admin     { background: var(--amber-soft); color: var(--amber-dark); }
.pill-user      { background: #E0F2FE; color: #0369A1; }
.pill-due       { background: var(--error-bg); color: var(--error); }
.pill-incoming  { background: var(--ok-bg); color: var(--ok); }
.pill-outgoing  { background: #E0F2FE; color: #0369A1; }

/* ═══════════════════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════════════════ */

.tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 16px;
}
.tabs button, .tabs > a {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 10px 18px; font-size: 13px; font-weight: 500;
  color: var(--muted); cursor: pointer; margin-bottom: -2px; transition: all .12s;
  text-decoration: none; white-space: nowrap;
}
.tabs button:hover, .tabs > a:hover { color: var(--text); }
.tabs button.active, .tabs > a.active { color: var(--amber-dark); border-bottom-color: var(--amber); font-weight: 600; }

/* Period selector */
.period-selector {
  display: flex; gap: 4px; margin-bottom: 20px;
}
.period-selector button {
  background: var(--card); border: 1px solid var(--border); color: var(--muted);
  padding: 6px 16px; border-radius: 20px; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .12s;
}
.period-selector button:hover { border-color: var(--amber); color: var(--text); }
.period-selector button.active { background: var(--amber); border-color: var(--amber); color: #fff; }

/* ═══════════════════════════════════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════════════════════════════════ */

.chart-wrap { position: relative; height: 260px; }

/* ═══════════════════════════════════════════════════════════════════════
   CALENDAR
   ═══════════════════════════════════════════════════════════════════════ */

.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px;
  background: var(--border); border-radius: var(--radius); overflow: hidden;
}
.calendar-header {
  background: var(--cream); padding: 8px; text-align: center;
  font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase;
}
.calendar-day {
  background: var(--card); min-height: 90px; padding: 6px;
}
.calendar-day.other-month { background: var(--cream); }
.day-num { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.cheque-dot {
  display: block; font-size: 10px; padding: 2px 6px;
  border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cheque-dot.pending   { background: var(--warn-bg); color: var(--warn); }
.cheque-dot.deposited { background: #E0F2FE; color: #0369A1; }
.cheque-dot.cleared   { background: var(--ok-bg); color: var(--ok); }
.cheque-dot.bounced   { background: var(--error-bg); color: var(--error); }
.cheque-dot.incoming  { background: var(--ok-bg); color: var(--ok); }
.cheque-dot.outgoing  { background: var(--error-bg); color: var(--error); }

/* ═══════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════ */

#toast {
  position: fixed; bottom: 24px; inset-inline-end: 24px;
  background: var(--ink); color: #fff; padding: 12px 22px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); z-index: 9999; max-width: 400px;
  animation: slideUp .25s ease;
  /* Nobody taps a toast, and on a phone it lands squarely on top of
     whatever is at the bottom of the screen — the camera overlay's
     Close button among them. A status message must never be the reason
     a button stops responding. */
  pointer-events: none;
}
#toast.ok { background: var(--ok); }
#toast.error { background: var(--error); }
#toast.warning { background: var(--amber-dark); color: #fff; }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ═══════════════════════════════════════════════════════════════════════
   LOADING BAR
   ═══════════════════════════════════════════════════════════════════════ */

.loading-bar {
  position: fixed; top: 0; inset-inline-start: 0; inset-inline-end: 0; height: 3px;
  background: linear-gradient(90deg, var(--amber) 30%, var(--amber-dark) 50%, var(--amber) 70%);
  background-size: 200% 100%; animation: shimmer 1.5s linear infinite; z-index: 9999;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ═══════════════════════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════════════════════ */

.login-wrap {
  max-width: 400px; margin: 80px auto; padding: 40px;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.login-wrap .logo { text-align: center; margin-bottom: 20px; }
.login-wrap .logo img { height: 40px; }
.login-wrap h1 { text-align: center; font-size: 22px; margin-bottom: 24px; }

/* ═══════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════ */

.empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .4; }
.empty p { font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════════════
   FLEX / GRID UTILITIES
   ═══════════════════════════════════════════════════════════════════════ */

.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-gap { display: flex; gap: 8px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; }
.gap-lg { gap: 16px; }
.mt-0 { margin-top: 0; } .mt-sm { margin-top: 8px; } .mt-md { margin-top: 16px; } .mt-lg { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-sm { margin-bottom: 8px; } .mb-md { margin-bottom: 16px; } .mb-lg { margin-bottom: 24px; }

/* ═══════════════════════════════════════════════════════════════════════
   CHAT MODULE
   ═══════════════════════════════════════════════════════════════════════ */

.chat-layout { display: flex; height: calc(100vh - 80px); gap: 0; }

.chat-sidebar {
  width: 260px; border-inline-end: 1px solid var(--border); background: var(--card);
  display: flex; flex-direction: column; border-radius: var(--radius) 0 0 var(--radius);
  overflow: hidden;
}
.chat-sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }
.chat-list { flex: 1; overflow-y: auto; padding: 8px; }
.chat-item {
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
  margin-bottom: 2px; transition: background .1s;
}
.chat-item:hover { background: var(--cream); }
.chat-item.active { background: var(--amber-soft); }
.chat-item .chat-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .chat-date { font-size: 11px; color: var(--muted); }

.chat-main {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.chat-msg {
  max-width: 80%; padding: 12px 16px; border-radius: var(--radius);
  font-size: 14px; line-height: 1.6;
}
.chat-msg.user {
  align-self: flex-end; background: var(--amber); color: #fff;
  border-end-end-radius: 4px;
}
.chat-msg.assistant {
  align-self: flex-start; background: var(--card);
  border: 1px solid var(--border); border-end-start-radius: 4px;
}
.chat-msg.assistant pre {
  background: var(--cream); padding: 8px 12px; border-radius: var(--radius-sm);
  overflow-x: auto; font-size: 12px; margin: 8px 0;
}
.chat-msg.assistant code { font-size: 12px; background: var(--cream); padding: 2px 5px; border-radius: 3px; }
/* Action-outcome receipts the suite inserts after the agent fires an
   action — distinct from regular chat so the user notices the side
   effect actually happened. */
.chat-msg.system {
  align-self: stretch; max-width: 100%;
  background: var(--amber-soft); border: 1px solid var(--amber);
  color: var(--ink); font-size: 13px;
  border-radius: var(--radius); padding: 10px 14px;
}

.chat-input-area {
  padding: 16px 24px; border-top: 1px solid var(--border); background: var(--card);
}
.chat-input-wrap {
  display: flex; gap: 8px; align-items: flex-end;
}
.chat-input-wrap textarea {
  flex: 1; resize: none; min-height: 42px; max-height: 160px;
  padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  font-size: 14px; line-height: 1.5;
}
.chat-send-btn {
  background: var(--amber); color: #fff; border: none;
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .12s; flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--amber-dark); }
.chat-send-btn:disabled { opacity: .4; cursor: not-allowed; }
.chat-send-btn svg { width: 18px; height: 18px; }
/* The paper plane flies the way the words run: in Arabic, to the left. */
html[dir="rtl"] .chat-send-btn svg { transform: scaleX(-1); }

.chat-file-btn {
  background: none; border: 1px solid var(--border); color: var(--warm-gray);
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .12s; flex-shrink: 0;
}
.chat-file-btn:hover { border-color: var(--amber); color: var(--amber); }
.chat-file-btn svg { width: 18px; height: 18px; }

.chat-file-label {
  font-size: 12px; color: var(--warm-gray); padding: 4px 8px;
  background: var(--bg-2, #f5f4f0); border-radius: 4px; margin-bottom: 4px;
}

.typing-indicator { display: flex; gap: 4px; padding: 12px 16px; }
.typing-indicator span {
  width: 8px; height: 8px; background: var(--warm-gray); border-radius: 50%;
  animation: bounce .6s ease infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: .1s; }
.typing-indicator span:nth-child(3) { animation-delay: .2s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-6px); } }

@media (max-width: 700px) {
  .chat-sidebar { display: none; }
  .chat-layout { height: calc(100vh - 60px); }
}

/* ═══════════════════════════════════════════════════════════════════════
   STOCK BALANCE
   ═══════════════════════════════════════════════════════════════════════ */

.warehouse-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.warehouse-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--card); font-size: 12px; font-weight: 500; cursor: pointer;
  transition: all .12s; user-select: none;
}
.warehouse-chip:hover { border-color: var(--amber); }
.warehouse-chip.selected { background: var(--amber); color: #fff; border-color: var(--amber); }
.warehouse-chip .chip-x { font-size: 14px; opacity: .6; margin-inline-start: 2px; }

/* ═══════════════════════════════════════════════════════════════════════
   MULTISELECT DROPDOWN
   ═══════════════════════════════════════════════════════════════════════ */

.multiselect-wrap { position: relative; }
.multiselect-trigger {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  min-height: 40px; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--card); cursor: pointer;
}
.multiselect-trigger:focus-within { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(212,168,67,.15); }
.multiselect-dropdown {
  position: absolute; top: 100%; inset-inline-start: 0; inset-inline-end: 0; z-index: 50;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); max-height: 260px; overflow-y: auto; margin-top: 4px;
}
.multiselect-dropdown label {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  font-size: 13px; cursor: pointer; transition: background .08s;
  text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text);
  margin-bottom: 0;
}
.multiselect-dropdown label:hover { background: var(--cream); }

/* ═══════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════ */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 300; display: flex; align-items: center; justify-content: center;
  animation: fadeIn .15s ease;
}
.modal {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 24px;
  max-width: 560px; width: 90%; max-height: 85vh; overflow-y: auto;
  animation: scaleIn .2s ease;
}
.modal h2 { font-size: 18px; margin-bottom: 16px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

/* ═══════════════════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════════════════ */

@media print {
  .sidebar, .mobile-header, .menu-backdrop, .mobile-menu, #toast, .loading-bar { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; max-width: 100% !important; }
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE-FIRST POLISH  (≈90% of usage is mobile)
   ═══════════════════════════════════════════════════════════════════════ */

/* Respect device safe areas (notches / home indicator) */
.sidebar, .mobile-menu { padding-bottom: env(safe-area-inset-bottom); }
.mobile-header { padding-top: calc(10px + env(safe-area-inset-top)); }

/* ── Touch targets ──────────────────────────────────────────────────
   These used to fire below 700px only, which meant a tablet — 820px and
   no mouse — got 26px buttons.

   Two triggers, because neither alone is enough:
     - `pointer: coarse` is the real test (true on phones and tablets,
       false on a laptop with a touchscreen) and it is the only thing
       that catches a 1366px iPad Pro in landscape.
     - the width bound catches every tablet-sized screen even where the
       pointer media feature is unreliable, which it still is in some
       embedded and emulated browsers.
   A mouse user at 1000px gets slightly roomier buttons. That is not a
   cost worth optimising away. */
@media (pointer: coarse), (max-width: 1024px) {
  /* Prevent iOS auto-zoom on focus: inputs must be ≥16px */
  input, select, textarea { font-size: 16px; }

  .icon-btn { width: 44px; height: 44px; }
  .btn-primary, .btn-secondary, .btn-danger, .btn-ghost { min-height: 44px; padding: 11px 16px; }
  .btn-sm { min-height: 40px; padding: 9px 14px; }
  .tabs { overflow-x: auto; }
  .tabs button, .tabs > a { min-height: 44px; padding: 11px 16px; }
  .bu-toggle button { min-height: 38px; }
  .filter-chip, .warehouse-chip { min-height: 38px; }
  .period-selector button { min-height: 40px; }
  /* A link styled as a button is still a target. */
  a.btn-primary, a.btn-secondary, a.btn-ghost, a.btn-sm {
    display: inline-flex; align-items: center; justify-content: center;
  }
  /* Two controls side by side need room between them, or a thumb hits
     the wrong one. */
  .page-header, .toolbar-row, .filters { gap: 10px; }
}

@media (max-width: 700px) {
  /* Headings & spacing scale down a touch */
  .page-header h1, h1 { font-size: 20px; }
  .main-content { padding: 14px; }
  .card { padding: 16px; }

  /* Filters & forms stack full-width */
  .filters { gap: 10px; }
  .filters input, .filters select { width: 100%; min-width: 0; flex: 1 1 100%; }
  .form-row > * { min-width: 0; flex: 1 1 100%; }
  /* Default min of 300px overflows narrow phones — collapse to one column. */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }

  /* KPI tiles one per row for readability */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 18px; }

  /* Tables already render as cards (<700px) — tighten spacing */
  tr { padding: 10px; }
  td { padding: 8px 4px; min-height: 40px; }

  /* Charts must never cause horizontal scroll */
  .chart-wrap { height: 240px !important; }
  canvas { max-width: 100% !important; }

  /* Avoid accidental pull-to-refresh / horizontal scroll.
     overflow-x belongs ONLY on body — putting it on <html> too on iOS
     Safari breaks position:sticky on .mobile-header so the user can't
     scroll the hamburger back into view. */
  html { overscroll-behavior-y: contain; }
  body { overscroll-behavior-y: contain; overflow-x: hidden; }
  /* Honour the home-indicator inset so the bottom of every page is reachable. */
  .main-content { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: 1fr; }
}
/* The chairman's tiles in the report preview: two to a row even on a
   phone, so the sections read as a page rather than a long column. */
@media (max-width: 420px) {
  .kpi-grid.chair-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-grid.chair-grid .kpi-value { font-size: 16px; }
}

/* ── Chat: full-height, keyboard-safe, big tap targets on mobile ── */
@media (max-width: 700px) {
  .chat-layout { height: calc(100dvh - 60px); }
  .chat-sidebar { display: none; }
  .chat-main { width: 100%; }
  .chat-messages { padding: 14px; }
  .chat-msg { max-width: 90%; font-size: 15px; }
  .chat-input-area { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); position: sticky; bottom: 0; }
  .chat-input-wrap textarea { font-size: 16px; min-height: 46px; }
  .chat-send-btn, .chat-file-btn { width: 46px; height: 46px; flex-shrink: 0; }
}

/* ── Chat: agent-generated file download cards ── */
.chat-files { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; align-self: flex-start; max-width: 90%; }
.chat-file-card {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; color: var(--text); transition: all .12s; min-height: 48px;
  font: inherit; cursor: pointer; text-align: start; width: auto;
}
.chat-file-card:hover { border-color: var(--amber); background: var(--amber-soft); }
.chat-file-ic { color: var(--amber-dark); display: flex; }
.chat-file-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.chat-file-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.chat-file-size { font-size: 11px; color: var(--muted); }
.chat-file-dl { margin-inline-start: auto; font-size: 18px; color: var(--amber-dark); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════
   SOLAR QUOTE WIZARD
   ═══════════════════════════════════════════════════════════════════════ */

.step-bar {
  display: flex; gap: 0; margin: 0 0 16px; padding: 0;
  border-radius: var(--radius); background: var(--card); overflow: hidden;
  border: 1px solid var(--border);
}
.step-bar .step {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-inline-end: 1px solid var(--border);
  font-size: 13px; color: var(--muted); min-width: 0;
}
.step-bar .step:last-child { border-inline-end: none; }
.step-bar .step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--cream); color: var(--muted);
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.step-bar .step-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-bar .step-active { color: var(--fg); background: rgba(212,168,67,.08); }
.step-bar .step-active .step-num { background: var(--amber); color: #fff; }
.step-bar .step-done { color: var(--fg); }
.step-bar .step-done .step-num { background: var(--ok, #6ea96e); color: #fff; }

.wizard-nav {
  display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px;
}
.wizard-nav .btn-secondary, .wizard-nav .btn-ghost { margin-inline-end: auto; }

.customer-results { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.match-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; text-align: start;
}
.match-card:hover { background: var(--cream); border-color: var(--warm-gray); }
.match-card.match-strong { border-inline-start: 3px solid var(--ok, #6ea96e); }
.match-card.match-likely { border-inline-start: 3px solid var(--amber); }
.match-card.match-weak   { border-inline-start: 3px solid var(--warm-gray); }
.match-main { flex: 1; min-width: 0; }
.match-name { font-weight: 600; }
.match-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.match-badge {
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: var(--cream); color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; flex-shrink: 0;
}
.match-badge-strong { background: rgba(110,169,110,.15); color: #3f7a3f; }
.match-badge-likely { background: rgba(212,168,67,.18); color: var(--amber-dark); }

.selected-customer {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  background: var(--cream); border-radius: var(--radius-sm); margin-top: 10px;
}
.selected-customer > div { flex: 1; }

.create-customer { margin-top: 12px; }
.create-form { display: flex; flex-direction: column; gap: 8px; padding: 12px;
  background: var(--cream); border-radius: var(--radius-sm); margin-top: 8px;
}

.mode-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px; margin-top: 12px;
}
.mode-card {
  text-align: start; padding: 14px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--card); cursor: pointer;
}
.mode-card:hover { border-color: var(--warm-gray); }
.mode-card.active { border-color: var(--amber); background: rgba(212,168,67,.06); }
.mode-title { font-weight: 700; margin-bottom: 4px; }
.mode-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }

.pill-group { margin-bottom: 14px; }
.pill-label { font-size: 12px; color: var(--muted); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
}
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-btn {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); cursor: pointer; font-size: 13px; color: var(--fg);
}
.pill-btn:hover { background: var(--cream); }
.pill-btn.active { background: var(--amber); border-color: var(--amber); color: #fff; }

.component-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.component-row {
  display: grid; grid-template-columns: 130px 1fr auto; align-items: center;
  gap: 12px; padding: 12px; background: var(--cream); border-radius: var(--radius-sm);
}
.component-label { font-weight: 600; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
}
.component-right { font-weight: 600; }
.wizard-notes { margin-top: 12px; padding: 10px 12px; background: rgba(212,168,67,.08);
  border-inline-start: 3px solid var(--amber); border-radius: var(--radius-sm); font-size: 13px;
}

@media (max-width: 700px) {
  .step-bar .step { padding: 8px 6px; font-size: 11px; }
  .step-bar .step-label { display: none; }
  .step-bar .step-active .step-label { display: inline; }
  .component-row { grid-template-columns: 1fr; gap: 2px; padding: 10px; }
  .component-right { text-align: end; }
}

/* ═══════════════════════════════════════════════════════════════════════
   CUSTOMER SANKEY MODAL
   ═══════════════════════════════════════════════════════════════════════ */

.link-cell {
  background: none; border: none; padding: 0; margin: 0;
  font: inherit; color: var(--amber-dark); cursor: pointer;
  text-align: start; font-weight: 600;
}
.link-cell:hover { text-decoration: underline; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 800; backdrop-filter: blur(2px);
}
.modal {
  /* Physical on purpose: this centres with a transform, and a transform
     does not flip. inset-inline-start would put it off-centre in Arabic. */
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 801; background: var(--card); border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0,0,0,.25); display: flex; flex-direction: column;
  width: min(960px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
}
.modal-wide { width: calc(100vw - 24px); max-width: none; }
.modal-header {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header > div:first-child { flex: 1; min-width: 0; }
/* A heading first does the same: it takes the room, and the × goes to the
   far corner rather than sitting just after the title — and it carries
   no margin of its own here, so the two line up. */
.modal-header > h2:first-child { flex: 1; min-width: 0; margin: 0; }
.modal-title { font-weight: 700; font-size: 16px; }
.modal-body { padding: 14px; overflow: auto; }

.modal-kpis { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.modal-kpi {
  background: var(--cream); border-radius: var(--radius-sm); padding: 10px 14px;
  flex: 1; min-width: 140px;
}
.modal-kpi .kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.modal-kpi .kpi-value { font-size: 18px; font-weight: 700; margin-top: 2px; }

.sankey-chart { width: 100%; height: calc(100vh - 220px); min-height: 520px; }

@media (max-width: 700px) {
  .modal { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; transform: none; top: 0; inset-inline-start: 0; }
  .sankey-chart { height: 60vh; }
}

/* ═══════════════════════════════════════════════════════════════════════
   VAT CENTER
   ═══════════════════════════════════════════════════════════════════════ */
.vat-tabs { display: flex; gap: 4px; margin: 6px 0 14px; border-bottom: 1px solid var(--border); }
.vat-tab {
  padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 600;
  font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.vat-tab:hover { color: var(--fg); }
.vat-tab.active { color: var(--amber-dark); border-bottom-color: var(--amber); }
/* On a phone the five tabs are wider than the screen: they scroll within
   their own bar rather than the whole page scrolling sideways. */
@media (max-width: 700px) {
  .vat-tabs { overflow-x: auto; scrollbar-width: none; }
  .vat-tab { flex-shrink: 0; white-space: nowrap; margin-bottom: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════
   ANKER DISTRIBUTION (field sales)
   ───────────────────────────────────────────────────────────────────────
   Designed phone-first and then allowed to widen, rather than a desktop
   layout squeezed down. A rep uses this standing in someone else's shop:
   one column, thumb-sized targets, and a running total that never
   scrolls away.
   ═══════════════════════════════════════════════════════════════════════ */

.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 22px; font-weight: 700; }

/* A row of controls that wraps instead of overflowing. A <select> or a
   button cannot shrink below its content, so anything next to a flex:1
   input pushes the page sideways unless the row is allowed to wrap. */
.toolbar-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar-row > * { min-width: 0; }

.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end; align-items: center;
  padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.link-btn { background: none; border: none; padding: 0; cursor: pointer; font: inherit; color: var(--amber-dark); }

.dist-list { display: flex; flex-direction: column; gap: 10px; }
.dist-card {
  display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px;
}
a.dist-card-link { text-decoration: none; color: inherit; }
a.dist-card-link:hover { border-color: var(--amber); }
.dist-card-main { flex: 1 1 200px; min-width: 0; }
.dist-card-title { font-weight: 700; font-size: 15px; }
.dist-card-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex: 0 0 auto; }

.dist-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dist-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dist-field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.dist-field input, .dist-field select, .dist-field textarea { width: 100%; min-width: 0; }
.dist-field small { font-size: 11.5px; line-height: 1.35; }

.dist-grid { display: flex; flex-direction: column; gap: 8px; padding-bottom: 92px; }
/* Name on its own line, then rate and stepper in a row beneath it.
   Side by side is what a desktop wants; on a phone it crushes the
   product name into a one-word-per-line column while the quantity box
   takes half the width. */
.dist-item {
  display: flex; flex-direction: column; gap: 8px; align-items: stretch;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.dist-item.on { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(212,168,67,.18); }
.dist-item-main { flex: 1 1 auto; min-width: 0; }
.dist-item-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.dist-item-side {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-top: 8px;
}
.dist-rate { font-weight: 700; font-size: 15px; flex: 1 1 auto; min-width: 0; }
.dist-linetot {
  font-size: 12.5px; color: var(--ok, #15803D); font-weight: 700;
  flex: 0 0 auto; text-align: end; min-width: 72px;
}
.dist-stepper { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.dist-stepper button {
  /* flex:none, or the row squeezes a 38px button down to whatever is
     left over — which on a 390px screen is not a thumb target. */
  flex: none; width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); font-size: 20px; font-weight: 700; cursor: pointer; color: var(--fg);
  line-height: 1; padding: 0;
}
/* The shared rule for text inputs is
   `input:not([type=checkbox]):not([type=radio]):not([type=file])`, which
   is three attribute selectors' worth of specificity and sets
   width:100%. A single class loses that fight, and the quantity box ends
   up owning the whole row — so this is deliberately chained past it. */
.dist-item .dist-item-side .dist-stepper .dist-qty {
  flex: none; width: 58px; text-align: center; padding: 8px 4px;
}
.dist-promo {
  margin-top: 5px; font-size: 11.5px; font-weight: 700; display: inline-block;
  padding: 3px 8px; border-radius: 7px; background: #F1F0EC; color: #6B6862;
}
.dist-promo.got { background: #14171A; color: #5EEAD4; }

/* The product's photo beside its name. Contained, not cropped: these are
   cut-outs on white, and a cropped charger is a picture of a cable. */
.dist-item-top { display: flex; gap: 12px; align-items: flex-start; flex: 1 1 auto; min-width: 0; }
.dist-thumb {
  width: 56px; height: 56px; border-radius: 8px; object-fit: contain; flex: none;
  background: #FAFAF8; border: 1px solid var(--border);
}
.dist-thumb.small { width: 48px; height: 48px; }
.dist-thumb.big { width: 92px; height: 92px; border-radius: 10px; }
.dist-thumb.ph { display: flex; align-items: center; justify-content: center; font-size: 22px; color: #C7C0AA; }
.dist-thumb.big.ph { font-size: 32px; }

/* ── A scan's question, and the cart ───────────────────────────────────
   A sheet from the bottom on a phone, a card in the middle on a wider
   screen. The question sits above the camera (900), which stays open
   behind it for the next box, and above the cart. */
.dist-sheet-bg {
  position: fixed; inset: 0; z-index: 940; background: rgba(20,20,18,.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.dist-sheet-bg.dist-qty-bg { z-index: 950; }
.dist-sheet {
  background: var(--card); width: 100%; max-width: 460px; border-radius: 16px 16px 0 0;
  padding: 18px 16px; padding-bottom: max(16px, env(safe-area-inset-bottom));
  box-shadow: 0 -10px 34px rgba(0,0,0,.22); max-height: 92vh; overflow-y: auto;
}
.dist-sheet.dist-cart { max-width: 560px; display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 620px) {
  .dist-sheet-bg { align-items: center; padding: 20px; }
  .dist-sheet { border-radius: 16px; }
}
.dist-sheet-head { display: flex; align-items: center; gap: 10px; }
.dist-sheet-head h2 { flex: 1; font-size: 18px; margin: 0; }
.dist-sheet-acts { display: flex; gap: 8px; margin-top: 14px; }
.dist-sheet-acts > :last-child { flex: 1; min-height: 46px; }
.dist-qty-head { display: flex; gap: 14px; align-items: flex-start; }
.dist-qty-name { font-weight: 700; font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.dist-qty-price { font-weight: 800; font-size: 18px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.dist-qty-have {
  display: inline-block; margin-top: 6px; padding: 2px 9px; border-radius: 9px;
  background: #FFF4DB; color: #8A5A00; font-size: 12px; font-weight: 700;
}
.dist-qty-q { margin-top: 16px; text-align: center; font-weight: 700; font-size: 13px; color: var(--muted); }
.dist-qty-step { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 8px 0 4px; }
.dist-qty-step button {
  flex: none; width: 54px; height: 54px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--card); font-size: 26px; font-weight: 700; color: var(--text); cursor: pointer; padding: 0;
}
.dist-sheet.dist-qtywin .dist-qty-step input.dist-qty-in {
  flex: none; width: 104px; height: 54px; text-align: center; font-size: 26px; font-weight: 800;
  border: 2px solid var(--text); border-radius: 14px; font-variant-numeric: tabular-nums; padding: 0;
}
.dist-qty-total { text-align: center; color: var(--ok, #15803D); font-weight: 700; font-size: 13.5px; min-height: 20px; }
.dist-cart-list { overflow-y: auto; flex: 1 1 auto; min-height: 60px; margin: 6px -16px 0; padding: 0 16px; }
.dist-cline {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 3px 12px; align-items: center;
  grid-template-areas: "img name amt" "img meta qty"; padding: 10px 0; border-bottom: 1px solid var(--border);
}
.dist-cline .dist-thumb { grid-area: img; align-self: start; }
.dist-cline-name { grid-area: name; font-weight: 600; font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; }
.dist-cline-meta { grid-area: meta; font-size: 11.5px; min-width: 0; }
.dist-cline-amt { grid-area: amt; font-weight: 700; text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dist-cline-qty { grid-area: qty; display: flex; align-items: center; gap: 6px; justify-self: end; }
.dist-cline .dist-stepper button { width: 32px; height: 32px; font-size: 18px; }
/* On a narrow phone the quantity gets a row of its own. */
@media (max-width: 420px) {
  .dist-cline { grid-template-areas: "img name amt" "img meta meta" "img qty qty"; }
}
.dist-cart-earned { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 8px; }
/* What the sale earns: a line of its own in the cart, at nothing. */
.dist-cline.free { background: var(--ok-bg); }
.dist-cline.free .dist-cline-amt { color: var(--ok); }
.dist-freeq { font-weight: 700; font-variant-numeric: tabular-nums; }
.dist-freetag { background: var(--ok); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 11.5px; font-weight: 800; }
.dist-sheet .dist-cline .dist-stepper .dist-qty { flex: none; width: 48px; text-align: center; padding: 6px 2px; }
.dist-rm {
  width: 30px; height: 30px; border: none; background: none; color: var(--error, #B91C1C);
  font-size: 19px; line-height: 1; cursor: pointer; padding: 0;
}
.dist-cart-tot {
  display: flex; justify-content: space-between; align-items: baseline; font-size: 15px;
  margin-top: 8px; padding-top: 9px; border-top: 1.5px solid var(--text);
}
/* The bar's cart: what is on the sale, one tap away. */
.dist-cartbtn {
  position: relative; flex: none; width: 48px; height: 46px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.dist-cartbtn svg { width: 24px; height: 24px; }
.dist-cartbtn:disabled { opacity: .45; cursor: default; }
.dist-badge {
  position: absolute; top: -6px; inset-inline-end: -6px; min-width: 20px; height: 20px; border-radius: 10px;
  background: var(--amber); color: #1F1E1B; font-size: 11.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

/* .pill title-cases its content, which suits a one-word status and
   mangles a sentence into "Signed — With Fulfilment". */
.dist-status { text-transform: none; white-space: nowrap; }

/* The running total. Fixed so it is reachable with a thumb no matter how
   long the catalog is, and inset for the home indicator. */
.dist-bar {
  position: fixed; inset-inline-start: 0; inset-inline-end: 0; bottom: 0; z-index: 30;
  display: flex; gap: 12px; align-items: center;
  background: var(--card); border-top: 1px solid var(--border);
  padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0,0,0,.06);
}
.dist-bar-tot { flex: 1; min-width: 0; }
.dist-bar-tot b { font-size: 18px; display: block; }
.dist-bar-tot small { color: var(--muted); font-size: 12px; }
.dist-bar .btn-primary { flex: none; min-height: 46px; }

.dist-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dist-table th {
  text-align: start; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 0 6px 6px; font-weight: 700;
}
.dist-table td { padding: 9px 6px; border-top: 1px solid var(--border); }

/* A shop's account: the statement's figures, its entries, its orders. */
.dist-sect { font-size: 15px; margin: 18px 0 8px; }
.dist-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.dist-fig { background: var(--cream); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.dist-fig span { display: block; font-size: 11.5px; color: var(--muted); }
.dist-fig b { font-size: 16px; font-variant-numeric: tabular-nums; }
.dist-fig.credit b { color: var(--ok); }
.dist-fig.due { border-color: #FDB329; background: #FFF8E7; }
.dist-fig.due b { color: var(--error); }
.dist-ledger { margin-top: 10px; }
.dist-ledger summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--amber-dark, #92400E); }
.dist-ledger .dist-table { margin-top: 6px; font-size: 12.5px; }
.dist-ledger tr.dist-credit td { background: #F0FAF0; }
.dist-amend { padding: 8px 0; border-top: 1px solid var(--border); }
.dist-amend:first-of-type { border-top: 0; }
.dist-amend-list { margin: 4px 0; padding-inline-start: 18px; font-size: 13px; }
.dist-was { font-size: 11.5px; color: var(--amber-dark, #92400E); margin-top: 2px; }
/* The reps' Lark messages: who, at which address, what the test met. */
.dist-replark { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 0; border-top: 1px solid var(--line, #E5E5E5); font-size: 13.5px; }
.dist-replark-head { margin: 14px 0 2px; font-size: 13.5px; }
.dist-replark-head + p + .dist-replark { border-top: 0; }
.dist-replark-res { font-size: 12.5px; text-align: end; max-width: 55%; overflow-wrap: anywhere; }
.dist-replark-res.ok { color: var(--ok, #2E7D32); }
.dist-replark-res.bad { color: var(--error, #C62828); }
/* What a product is, in a line under its name. */
.dist-item-desc { font-size: 12px; color: var(--muted); line-height: 1.35; margin: 1px 0 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dist-amended { background: #FFF7ED; color: #9A3412; }
.dist-ledger td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.dist-ledger .dist-ref { font-size: 11px; font-family: monospace; overflow-wrap: anywhere; }
/* A quantity that cannot go higher: on its way, or off the list. */
.dist-stepper button:disabled { opacity: .35; cursor: not-allowed; }

/* Above 900px the sidebar is on screen (see the layout breakpoint), so
   the cart starts where the content does rather than under the nav. */
@media (min-width: 901px) {
  .dist-bar { inset-inline-start: var(--sidebar-w); }
}
/* Wide enough for the name and the controls to share a line. */
@media (min-width: 560px) {
  .dist-item { flex-direction: row; align-items: center; gap: 14px; }
  .dist-item-side { border-top: none; padding-top: 0; flex: 0 0 auto; justify-content: flex-end; }
  .dist-rate { flex: 0 0 auto; text-align: end; }
}
@media (max-width: 700px) {
  .dist-form { grid-template-columns: 1fr; }
  .dist-card-acts { width: 100%; }
  .dist-card-acts > * { flex: 1 1 auto; text-align: center; }
  .dist-bar { inset-inline-start: 0; }
  /* .dist-table is a real table even on a phone — four short numeric
     columns read better as a grid than as four stacked rows. */
  .dist-table, .dist-table thead, .dist-table tbody, .dist-table tr, .dist-table th, .dist-table td { display: revert; }
  .dist-table thead { display: table-header-group; }
  .dist-table tr { margin: 0; border: none; padding: 0; }
  .dist-table td { display: table-cell; padding: 8px 4px; }
  .dist-table td::before { content: none; }
  .dist-item { padding: 10px; }
  .dist-item-name { font-size: 14.5px; }
  .dist-promo { display: block; }
}

/* ── Promotion editor ────────────────────────────────────────────────
   Both sides of a promotion are lists, so the form is rows rather than a
   fixed grid. The common case is still one line each side: it opens with
   one row, and the remove button only appears once there is more than
   one to remove. */
.promo-side { margin-top: 12px; }
.promo-side h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; margin-bottom: 6px;
}
.promo-rows { display: flex; flex-direction: column; gap: 8px; }
.promo-row { display: flex; gap: 8px; align-items: flex-start; }
.promo-row > :first-child { flex: 1 1 auto; min-width: 0; }
.promo-row .icon-btn { margin-top: 18px; }
.promo-row-fields {
  display: grid; gap: 8px;
  grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 90px) minmax(0, 110px);
}
/* The buy side has two fields, not four. */
.promo-row-fields:has(> :nth-child(2):last-child) {
  grid-template-columns: minmax(0, 1fr) minmax(0, 110px);
}
.promo-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.promo-f > span { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.promo-f input, .promo-f select { width: 100%; min-width: 0; }

@media (max-width: 860px) {
  /* Four columns of inputs cannot survive a phone; each line becomes its
     own little stack with a rule under it so the rows stay countable. */
  .promo-row-fields,
  .promo-row-fields:has(> :nth-child(2):last-child) { grid-template-columns: 1fr; }
  .promo-row {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 10px; align-items: flex-start;
  }
  .promo-row .icon-btn { margin-top: 0; }
}

/* A tier a bigger order has already overtaken: still shown, because the
   ladder only makes sense whole, but plainly no longer the one that pays. */
.dist-promo.past { opacity: .5; text-decoration: line-through; }
.dist-promo-foot { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

/* ── Maps ────────────────────────────────────────────────────────────
   Leaflet's own stylesheet arrives with the library; these are the bits
   that belong to us — the container, our pin, and what a map says when
   there is nothing to draw or nothing to draw it with. */
.ngp-map {
  height: 340px; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--cream);
}
.ngp-map-empty, .ngp-map-loading {
  height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; text-align: center; padding: 16px;
}
.ngp-pin span {
  display: block; width: 18px; height: 18px; border-radius: 50%;
  background: var(--amber); border: 2.5px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.45);
}
/* A shop that is pinned but not yet sellable — no contact, no WhatsApp. */
.ngp-pin.muted span { background: var(--muted); }
.ngp-pop-sub { color: #6B6862; font-size: 12px; }
.leaflet-container { font: inherit; }

@media (max-width: 700px) {
  .ngp-map { height: 260px; }
}

/* ── The warehouse board (SO Delivery) ───────────────────────────────
   The cards a shift starts from: what goes out today and what should
   already have gone, then what is coming up and what has no date yet.
   Deliberately louder than the queue under them — they are the answer,
   the queue is the reference. */
.board-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.board-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); border-top: 3px solid var(--border); overflow: hidden;
}
.board-card.today { border-top-color: var(--amber); }
.board-card.late  { border-top-color: var(--error); }
.board-card.upcoming    { border-top-color: var(--anker-blue); }
.board-card.unscheduled { border-top-color: var(--warm-gray); }
/* With the courier: out of the warehouse's hands, so across the foot of
   the board rather than beside what is still to send. */
.board-card.courier { border-top-color: #EA580C; grid-column: 1 / -1; }
.board-card.courier .board-count { color: #9A3412; }
.board-card.courier .board-row-side { flex: 0 1 auto; max-width: 60%; }
.board-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px 10px; border-bottom: 1px solid var(--border);
}
.board-head h2 { font-size: 14px; font-weight: 700; margin: 0; flex: 1; min-width: 0; }
.board-count {
  font-size: 20px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
}
.board-card.today .board-count { color: var(--amber-dark); }
.board-card.late  .board-count { color: var(--error); }
/* A long list must not push the page down past the queue it sits above. */
.board-body { max-height: 320px; overflow-y: auto; }
.board-empty { padding: 18px 14px; color: var(--muted); font-size: 12.5px; }

a.board-row {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
a.board-row:last-child { border-bottom: none; }
a.board-row:hover { background: var(--cream); }
.board-row-main { min-width: 0; }
.board-so { font-weight: 700; font-size: 13px; overflow-wrap: anywhere; }
.board-cust { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.board-row-side {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none;
}
.board-late { font-size: 11px; font-weight: 800; color: var(--error); white-space: nowrap; }
.board-when { font-size: 11px; color: var(--muted); white-space: nowrap; }
.board-courier { font-size: 11px; font-weight: 600; color: #9A3412; text-align: end; overflow-wrap: anywhere; }

@media (max-width: 700px) {
  /* Stacked, and shorter: on a phone the board should not be the whole
     first screen with the queue nowhere in sight. */
  .board-grid { grid-template-columns: 1fr; }
  .board-body { max-height: 260px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   DASHBOARD — indicator strip, revenue chart, indicator detail
   ───────────────────────────────────────────────────────────────────────
   Hierarchy comes from weight and ground, not from a different accent
   colour per card. Amber stays scarce: it marks the one tile that wants
   attention and nothing else.
   ═══════════════════════════════════════════════════════════════════════ */

.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.dash-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.dash-title h1 { margin: 0; }

.dash-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }

.dash-tile {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 14px 11px; display: flex; flex-direction: column; gap: 9px;
  text-align: start; font: inherit; color: inherit; cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.dash-tile:hover { border-color: var(--warm-gray); box-shadow: var(--shadow-sm); }
.dash-tile:focus-visible { outline: 2px solid var(--amber-dark); outline-offset: 2px; }
/* The one tile that wants looking at — amber earns its impact from scarcity. */
.dash-tile.flagged { background: var(--amber-soft); border-color: #F0DFB6; }
.dash-tile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.dash-tile-label { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); line-height: 1.3; }
.dash-tile-go { color: var(--warm-gray); flex: none; display: flex; margin-top: 1px; }
.dash-tile-figs { display: flex; flex-direction: column; gap: 6px; }

/* The figure is never truncated. It used to take an ellipsis when the
   tile ran out of room, which in English hid the last digits and in
   Arabic — where the ellipsis sits on the left — hid the first ones:
   "…,204,800" for a million and more. Now the change figure beside it
   gives way and drops to the next line instead. */
.dash-fig { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.dash-fig-v {
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
  white-space: nowrap; flex: none;
  direction: ltr; unicode-bidi: isolate;
}
.dash-fig-d, .dash-delta {
  margin-inline-start: auto; font-size: 10.5px; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.dash-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }

.dash-tile-spark { min-height: 0; }
.dash-spark { width: 100%; height: 30px; display: block; }
/* In Arabic the months run right to left, as the bars below do, so the
   lines are drawn that way too. */
html[dir="rtl"] .dash-spark,
html[dir="rtl"] .kpi-trend-chart svg { transform: scaleX(-1); }
.dash-spark-cap { display: block; font-size: 9.5px; color: var(--muted); margin-top: 2px; }

/* ── Chart + rail ──────────────────────────────────────────────────── */
.dash-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.dash-chart { display: flex; flex-direction: column; gap: 14px; }
.dash-chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dash-legend { display: flex; gap: 14px; flex: none; }
.dash-legend > span { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-soft); }
.dash-swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; display: inline-block; }

.dash-panels { display: flex; flex-direction: column; gap: 18px; }
.dash-panel { display: flex; flex-direction: column; gap: 6px; }
.dash-panel-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; row-gap: 2px; }
.dash-panel-name { font-size: 12px; font-weight: 700; white-space: nowrap; }
.dash-panel-unit { font-size: 10.5px; color: var(--muted); }
.dash-panel-empty { font-size: 11.5px; color: var(--muted); padding: 16px 0; }

.dash-bars {
  display: flex; align-items: flex-end; gap: 5px; height: 132px;
  padding-bottom: 1px; border-bottom: 1px solid var(--border);
}
.dash-bar-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; gap: 4px; }
.dash-bar-top { font-size: 9.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* 4px rounded top, anchored to the baseline. */
.dash-bar { width: 100%; border-radius: 4px 4px 0 0; min-height: 2px; }
.dash-bar-labels { display: flex; gap: 5px; }
.dash-bar-labels > span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 9.5px; color: var(--muted); }

/* ── Revenue by month, interactive ─────────────────────────────────── */
.dash-chart-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dash-rev-view .pill-btn { padding: 3px 11px; font-size: 11px; }
.dash-rev { position: relative; }
.dash-rev [hidden] { display: none !important; }
.dash-panel-vs { font-size: 10px; color: var(--muted); white-space: nowrap; }
/* The whole column is the target, not only the painted bar. */
.dash-bar-col { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; border-radius: 6px 6px 0 0; }
.dash-bar-col:hover, .dash-bar-col.on:focus-visible { background: var(--cream); }
.dash-bar-col:focus-visible { outline: 2px solid var(--amber-dark); outline-offset: 1px; }
.dash-bar { transition: background-color .12s; }
/* The month still running: hatched over its colour. */
.dash-bar.running { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.55) 0 3px, transparent 3px 6px); }
.dash-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 170px; max-width: 240px;
  background: var(--card); color: var(--ink); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-sm); padding: 8px 10px; font-size: 11.5px;
}
.dash-tip-title { font-weight: 700; margin-bottom: 5px; }
.dash-tip-row { display: grid; grid-template-columns: 12px auto 1fr; column-gap: 6px; align-items: baseline; margin-bottom: 4px; }
.dash-tip-key { width: 12px; height: 2px; border-radius: 1px; align-self: center; }
.dash-tip-v { font-weight: 700; font-variant-numeric: tabular-nums; }
.dash-tip-name { color: var(--muted); font-size: 10.5px; }
.dash-tip-d { grid-column: 2 / -1; color: var(--muted); font-size: 10.5px; }
.dash-tip-hint { color: var(--muted); font-size: 10px; border-top: 1px solid var(--border); padding-top: 4px; margin-top: 2px; }
.dash-rev-note { font-size: 10.5px; margin: 10px 0 0; }
.dash-rev-table { width: 100%; font-size: 12px; }
.dash-rev-table th[scope="row"] {
  font-weight: 600; text-align: start; white-space: nowrap; text-transform: none; letter-spacing: normal;
  font-size: 12px; color: var(--ink);
}
.dash-rev-table td { font-variant-numeric: tabular-nums; }
.linklike {
  background: none; border: 0; padding: 0; font: inherit; color: inherit; font-weight: 600; cursor: pointer;
  text-decoration: underline dotted; text-underline-offset: 3px;
}
.linklike:hover { color: var(--amber-dark); }

/* One month's revenue */
.rev-nav { display: flex; align-items: center; gap: 8px; }
.rev-nav .pill-btn { padding: 5px 12px; }
.rev-nav .pill-btn:disabled { opacity: .4; cursor: default; }
.rev-month { font-size: 13px; font-weight: 700; min-width: 128px; text-align: center; }
.rev-content { display: flex; flex-direction: column; gap: 16px; transition: opacity .12s; }
.kpi-figs.rev-figs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rev-vs-v { font-size: 18px; }
.kpi-row-name.rev-name { flex-direction: column; align-items: flex-start; gap: 1px; }
.rev-who { font-weight: 600; overflow-wrap: anywhere; }
.rev-sub { font-size: 10.5px; }

.dash-rail { display: flex; flex-direction: column; gap: 14px; }
.dash-weeks { margin-top: 10px; }
.dash-weeks-top { display: flex; align-items: baseline; gap: 7px; }
.dash-weeks-name { font-size: 11.5px; color: var(--ink-soft); }
.dash-weeks-v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dash-weeks-track {
  position: relative; height: 9px; background: var(--cream);
  border-radius: 5px; overflow: hidden; margin-top: 4px;
}
.dash-weeks-fill { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; border-radius: 5px; }
/* The 19- and 22-week marks, drawn over the fill rather than cut out of it. */
.dash-weeks-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(31,30,27,.28); }

.dash-vat {
  display: flex; flex-direction: column; gap: 3px; text-align: start;
  font: inherit; color: inherit; cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.dash-vat:hover { border-color: var(--warm-gray); box-shadow: var(--shadow-sm); }
.dash-vat:focus-visible { outline: 2px solid var(--amber-dark); outline-offset: 2px; }
.dash-vat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dash-vat-v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }

.dash-receipts-head {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin-bottom: 8px;
}
.dash-receipts-sep { height: 1px; background: var(--border); margin: 12px 0; }
.dash-receipt-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 5px; }
.dash-receipt-name { font-size: 11.5px; color: var(--ink-soft); }
.dash-receipt-v { margin-inline-start: auto; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dash-method { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.dash-method-name { font-size: 10.5px; color: var(--muted); width: 52px; flex: none; }
.dash-method-track { flex: 1; height: 7px; background: var(--cream); border-radius: 4px; overflow: hidden; }
.dash-method-fill { display: block; height: 100%; background: var(--amber); border-radius: 4px; }
.dash-method-pct { font-size: 10px; color: var(--muted); width: 30px; text-align: end; font-variant-numeric: tabular-nums; }
.dash-receipt-bu {
  display: block; width: 100%; text-align: start; font: inherit; color: inherit; background: none;
  border: 1px solid transparent; border-radius: 8px; padding: 6px 7px; margin: 0 -7px 4px; box-sizing: content-box;
  cursor: pointer; transition: border-color .12s, background .12s;
}
.dash-receipt-bu:hover { border-color: var(--border); background: var(--cream); }
.dash-receipt-bu:focus-visible { outline: 2px solid var(--amber-dark); outline-offset: 1px; }

/* ── The receipts behind the card ──────────────────────────────────── */
.rcpt-controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.rcpt-seg { flex-wrap: wrap; }
.kpi-figs.rcpt-figs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rcpt-method { text-align: start; font: inherit; color: inherit; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.rcpt-method:hover:not(:disabled) { border-color: var(--warm-gray); }
.rcpt-method.active { border-color: var(--amber-dark); box-shadow: inset 0 0 0 1px var(--amber-dark); background: var(--amber-soft); }
.rcpt-method:disabled { cursor: default; opacity: .6; }
.rcpt-method .kpi-fig-v { font-size: 18px; }
.rcpt-warn { background: var(--amber-soft); color: var(--amber-dark); border-radius: 8px; padding: 8px 11px; font-size: 12px; }
.rcpt-tools { display: flex; gap: 8px; }
.rcpt-tools input { flex: 1; min-width: 0; width: auto; }
.rcpt-tools select { flex: none; width: auto; }
.rcpt-list { display: flex; flex-direction: column; }
.rcpt-shown { font-size: 11.5px; color: var(--muted); padding: 0 0 6px; }
.rcpt-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); }
.rcpt-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.rcpt-who { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.rcpt-sub { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.rcpt-part { white-space: nowrap; }
.rcpt-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Indicator detail ──────────────────────────────────────────────── */
/* The base .modal still carries a 560px cap and 24px of padding from the
   older dialog style; this panel draws its own header and footer edge to
   edge, so both have to be undone rather than worked around. */
.kpi-modal {
  width: min(780px, calc(100vw - 24px)); max-width: none;
  padding: 0; overflow: hidden;
}
.kpi-head {
  background: var(--ink); color: #fff; padding: 16px 20px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
}
.kpi-eyebrow { font-size: 9.5px; font-weight: 700; letter-spacing: .14em; color: var(--amber); }
.kpi-title { font-size: 21px; font-weight: 700; line-height: 1.15; margin-top: 3px; }
.kpi-close {
  width: 32px; height: 32px; border-radius: 8px; border: none; flex: none;
  background: rgba(255,255,255,.14); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.kpi-close:hover { background: rgba(255,255,255,.24); }
.kpi-body { padding: 18px 20px 20px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }

.kpi-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.kpi-fig { background: var(--cream); border: 1px solid var(--border); border-radius: 10px; padding: 13px 15px; }
.kpi-fig-label {
  display: flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 700;
  letter-spacing: .08em; color: var(--muted);
}
.kpi-fig-v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }

.kpi-def { display: flex; gap: 10px; background: var(--amber-soft); border-radius: 10px; padding: 12px 14px; }
.kpi-def-icon { color: var(--amber-dark); flex: none; display: flex; margin-top: 1px; }
.kpi-def-title { font-size: 11.5px; font-weight: 700; }
.kpi-def-text { font-size: 11.5px; line-height: 1.55; color: var(--ink-soft); margin-top: 2px; }

.kpi-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kpi-sec-title { font-size: 10px; font-weight: 700; letter-spacing: .09em; color: var(--muted); }

.kpi-trends { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.kpi-trend { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.kpi-trend-head { display: flex; align-items: baseline; gap: 7px; }
.kpi-trend-name { font-size: 11.5px; font-weight: 700; }
.kpi-trend-unit { font-size: 10.5px; color: var(--muted); }
.kpi-trend-last { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-trend-chart svg { width: 100%; height: 86px; display: block; overflow: visible; }
.kpi-trend-labels { display: flex; }
.kpi-trend-labels > span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 9.5px; color: var(--muted); }

.kpi-rows { display: flex; flex-direction: column; }
.kpi-row {
  display: grid; grid-template-columns: minmax(0, 1.7fr) auto 96px; gap: 14px;
  align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.kpi-row:last-child { border-bottom: none; }
.kpi-row-name { display: flex; align-items: center; gap: 8px; font-size: 12px; min-width: 0; }
.kpi-row-v { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
.kpi-row-bar { height: 6px; background: var(--cream); border-radius: 3px; overflow: hidden; }
.kpi-row-fill { display: block; height: 100%; border-radius: 3px; }

.kpi-foot {
  border-top: 1px solid var(--border); background: var(--cream);
  padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.kpi-asof { font-size: 10.5px; color: var(--muted); }
.kpi-link { font-size: 12.5px; font-weight: 700; color: var(--amber-dark); text-decoration: none; }
.kpi-link:hover { text-decoration: underline; }

@media (max-width: 1100px) {
  .dash-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-body { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .dash-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dash-fig-v { font-size: 14px; }
  .dash-bars { height: 104px; }
  /* Twelve month labels will not fit — show every other one. */
  .dash-bar-labels > span:nth-child(even) { visibility: hidden; }
  .kpi-row { grid-template-columns: minmax(0, 1fr) auto; }
  .kpi-row-bar { display: none; }
  .kpi-figs { grid-template-columns: 1fr; }
  /* Full screen on a phone, as every pop-up is: kept a little narrower,
     it sat against one side. */
  .kpi-modal { width: 100vw; }
  /* The total across; the three methods two by two beneath it. */
  .kpi-figs.rcpt-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .rcpt-figs > .kpi-fig:first-child { grid-column: 1 / -1; }
  .rcpt-figs .kpi-fig { padding: 10px 12px; }
  .rcpt-method .kpi-fig-v { font-size: 16px; }
  .kpi-figs.rev-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .rev-figs .kpi-fig { padding: 10px 12px; }
  .rev-figs .kpi-fig-v { font-size: 17px; }
  .dash-tip { display: none !important; }
}
/* Two columns hold down to about 340px; below that the figures start to
   wrap mid-number, which is worse than scrolling. */
@media (max-width: 340px) {
  .dash-strip { grid-template-columns: 1fr; }
}

/* ── Year to date, leading the page ──────────────────────────────────
   The one figure the business is run against, so it gets the dark ground
   and the largest type on the screen; everything below is context. */
.dash-ytd-band { margin-bottom: 14px; }
.dash-ytd {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px;
  width: 100%; background: var(--ink); border: none; border-radius: 12px;
  padding: 18px 24px; text-align: start; font: inherit; color: #fff; cursor: pointer;
}
.dash-ytd:hover { background: var(--ink-soft); }
.dash-ytd:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.dash-ytd-half { min-width: 0; }
.dash-ytd-half + .dash-ytd-half { border-inline-start: 1px solid rgba(255,255,255,.14); padding-inline-start: 26px; }
.dash-ytd-eyebrow { font-size: 10px; font-weight: 700; letter-spacing: .14em; color: var(--amber); }
.dash-ytd-v {
  font-size: 34px; font-weight: 700; line-height: 1.1; margin: 3px 0 2px;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.dash-ytd-sub { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: #BFBDB6; }
.dash-ytd-delta { font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 700px) {
  .dash-ytd { grid-template-columns: 1fr; gap: 14px; padding: 16px 18px; }
  .dash-ytd-half + .dash-ytd-half {
    border-inline-start: none; padding-inline-start: 0;
    border-top: 1px solid rgba(255,255,255,.14); padding-top: 14px;
  }
  .dash-ytd-v { font-size: 27px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   BANK COMMITMENTS
   ───────────────────────────────────────────────────────────────────────
   Money going out. Charcoal carries the lenders, amber marks what is
   coming up, red only what is already past its date.
   ═══════════════════════════════════════════════════════════════════════ */

.cmt-card { display: flex; flex-direction: column; gap: 12px; }
.cmt-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cmt-open { font-size: 12px; font-weight: 700; color: var(--amber-dark); text-decoration: none; white-space: nowrap; }
.cmt-open:hover { text-decoration: underline; }

.cmt-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.cmt-cell {
  background: var(--cream); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px;
  text-align: start; font: inherit; color: inherit; cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.cmt-cell:hover { border-color: var(--warm-gray); box-shadow: var(--shadow-sm); }
.cmt-cell:focus-visible { outline: 2px solid var(--amber-dark); outline-offset: 2px; }
.cmt-cell.soon { background: var(--amber-soft); border-color: #F0DFB6; }
.cmt-cell.late { background: var(--error-bg); border-color: #F3C9C9; }
.cmt-cell.cmt-loans { background: var(--ink); border-color: var(--ink); color: #fff; }
.cmt-cell.cmt-loans .cmt-cell-label { color: var(--amber); }
.cmt-cell.cmt-loans .cmt-cell-note { color: #BFBDB6; }
.cmt-cell-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cmt-cell-v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cmt-cell.late .cmt-cell-v { color: var(--error); }
.cmt-cell-note { font-size: 10.5px; color: var(--muted); line-height: 1.4; }

.cmt-track { display: block; height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; }
.cmt-cell.cmt-loans .cmt-track { background: rgba(255,255,255,.18); }
.cmt-track-fill { display: block; height: 100%; background: var(--ok); border-radius: 4px; }

.cmt-cheques {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-top: 10px; font-size: 11.5px;
}
.cmt-chq-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cmt-chq-line { display: inline-flex; align-items: baseline; gap: 7px; }
.cmt-chq-line b { font-weight: 600; color: var(--muted); }

/* ── The schedule screen ───────────────────────────────────────────── */
.cmt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.cmt-kpi {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 13px 15px; display: flex; flex-direction: column; gap: 3px;
}
.cmt-kpi.hot { background: var(--amber-soft); border-color: #F0DFB6; }
.cmt-kpi.late { background: var(--error-bg); border-color: #F3C9C9; }
.cmt-kpi-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.cmt-kpi-v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmt-kpi.late .cmt-kpi-v { color: var(--error); }
.cmt-kpi-sub { font-size: 10.5px; color: var(--muted); }

.cmt-bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; margin-top: 12px; }
.cmt-bar-col {
  flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; gap: 3px; cursor: pointer; border-radius: 4px;
}
.cmt-bar-col:hover { background: var(--cream); }
.cmt-bar-col.on { background: var(--amber-soft); }
.cmt-bar-col:focus-visible { outline: 2px solid var(--amber-dark); outline-offset: 1px; }
.cmt-bar-top { font-size: 9px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Stacked by lender, with a hairline of ground between segments. */
.cmt-bar { width: 100%; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 2px; }
.cmt-seg { display: block; width: 100%; box-shadow: 0 -2px 0 var(--card); }
.cmt-seg:first-child { box-shadow: none; }
.cmt-bar-labels { display: flex; gap: 4px; margin-top: 4px; }
.cmt-bar-labels > span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 9px; color: var(--muted); }

.cmt-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin: 12px 0; }
.cmt-filters label { display: grid; gap: 4px; }
.cmt-flabel { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

.cmt-chip {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .05em;
  color: #fff; padding: 2px 7px; border-radius: 3px; white-space: nowrap;
}
.cmt-days { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.cmt-days.near { color: var(--amber-dark); }
.cmt-days.past { color: var(--error); }
/* An Arabic note runs longer than its column would allow it one word per line. */
html[dir="rtl"] .cmt-note { min-width: 150px; }
.cmt-row { cursor: pointer; }
.cmt-row:hover td { background: var(--amber-soft); }
.cmt-row.on td { background: var(--amber-soft); }
/* A settled instalment is still shown, but it has stopped being a claim
   on the future, so it stops competing for attention. */
.cmt-paid td { opacity: .55; }
/* Due loans: past their date and not settled in full. */
.cmt-due { border-top: 3px solid var(--error); }
.cmt-due-total { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmt-due-total.late { color: var(--error); }
/* An instalment settled in part: what was paid, and what is left. */
.cmt-left { font-size: 10.5px; font-weight: 600; color: var(--amber-dark); white-space: nowrap; margin-top: 2px; }
.pill-part { background: var(--amber-soft); color: var(--amber-dark); }
.cmt-settle-line {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; font-variant-numeric: tabular-nums;
}
.cmt-settle-line.paid { color: var(--ok); font-size: 12.5px; }
.cmt-settle-line.strong { font-weight: 700; border-bottom: none; font-size: 14px; }
.cmt-settle-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.cmt-settle-says { font-size: 12.5px; font-weight: 600; color: var(--amber-dark); margin: 6px 0 4px; }
@media (max-width: 520px) { .cmt-settle-form { grid-template-columns: 1fr; } }
.cmt-sort { cursor: pointer; user-select: none; }
.cmt-sort:hover { color: var(--amber-dark); }

.table-wrap { overflow-x: auto; }

@media (max-width: 700px) {
  .cmt-band { grid-template-columns: 1fr; }
  .cmt-bars { height: 110px; }
  .cmt-bar-labels > span:nth-child(even) { visibility: hidden; }
  .cmt-filters label { flex: 1 1 140px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   TASKS
   A task card is built around its action: the tick on the left, what it
   is in the middle, and the one button that does the job on the right.
   ═══════════════════════════════════════════════════════════════════════ */

.task-card {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); margin-bottom: 8px;
}
.task-card.done { opacity: .55; }
.task-card.done .task-title { text-decoration: line-through; }
.task-title { font-size: 13.5px; font-weight: 600; line-height: 1.35; }

/* Big enough to hit with a thumb, and obviously the thing you press
   when the job is finished. */
.task-tick {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--border); background: transparent; cursor: pointer;
  font-size: 14px; line-height: 1; color: transparent; margin-top: 1px;
}
.task-tick:hover { border-color: var(--ok); color: var(--border); }
.task-tick.on { background: var(--ok); border-color: var(--ok); color: #fff; }

.task-due { font-size: 11.5px; color: var(--muted); }
.task-due.late { color: var(--error); font-weight: 700; }

.task-ref {
  display: inline-flex; align-items: center; font-size: 11.5px;
  background: var(--cream); color: var(--body); border-radius: 999px;
  padding: 2px 9px; white-space: nowrap; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis;
}
a.task-ref:hover { background: var(--amber-soft); }

.task-group {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); margin: 14px 0 6px;
}

.nav-badge {
  display: inline-block; margin-inline-start: 7px; min-width: 18px;
  padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,.16); color: #fff; text-align: center;
}
.nav-badge.late { background: var(--error); color: #fff; }

@media (max-width: 640px) {
  .task-card { flex-wrap: wrap; }
  .task-card > div:last-child { width: 100%; justify-content: flex-end; }
}

/* Somebody's own words, in whichever language they wrote them: laid out
   by their own first letter, so an English note's full stop stays at its
   end inside an Arabic page — and an Arabic one's inside an English page —
   while the line keeps to the same edge as everything around it. */
.user-text { unicode-bidi: plaintext; text-align: left; }
html[dir="rtl"] .user-text { text-align: right; }

/* A withdrawn task is over, but it is not an achievement. */
.task-tick.off {
  border-color: var(--border);
  background: var(--cream);
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════════════
   ARABIC
   Everything here applies only when the suite is in Arabic.
   ═══════════════════════════════════════════════════════════════════════ */

/* Noto Sans Arabic for Arabic, as the brand has it. Inter comes first so
   that every Latin letter and every digit is still set in Inter — the
   figures look the same in both languages, and Arabic falls through to
   the face that has it. Arabic needs room between lines that English does
   not: its marks collide below about 1.6. */
html[lang="ar"] body {
  font-family: 'Inter', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  line-height: 1.7;
}
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 { line-height: 1.45; }
html[lang="ar"] input, html[lang="ar"] textarea,
html[lang="ar"] select, html[lang="ar"] button { font-family: inherit; }
/* A code column set in monospace inline still carries Arabic words beside
   the codes — «الرقم التسلسلي», «باركود». Without a face that has them they
   fell through to whatever the system had; the codes keep the monospace. */
html[lang="ar"] [style*="monospace"] {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace, 'Noto Sans Arabic', sans-serif !important;
}

/* Tracking pulls Arabic's joined letters apart, so it goes — including
   the inline styles that set it. Capitals mean nothing to Arabic, and
   what stays in Latin inside an Arabic screen is a name or a code, which
   should read exactly as it is written: Anker, not ANKER. */
html[lang="ar"] * { letter-spacing: 0 !important; text-transform: none !important; }

/* The small letter-spaced labels read as a style in English. At 9.5–10px
   Arabic is simply too small to read, so they come up to a size that is. */
html[lang="ar"] .sidebar-nav .nav-section,
html[lang="ar"] #mobileNav .nav-section,
html[lang="ar"] .kpi-eyebrow, html[lang="ar"] .kpi-fig-label,
html[lang="ar"] .kpi-sec-title, html[lang="ar"] .dash-ytd-eyebrow,
html[lang="ar"] .dash-receipts-head,
html[lang="ar"] .cmt-cell-label, html[lang="ar"] .cmt-chq-title,
html[lang="ar"] .cmt-kpi-label, html[lang="ar"] .cmt-flabel, html[lang="ar"] .cmt-chip,
html[lang="ar"] .match-badge, html[lang="ar"] .calendar-header,
html[lang="ar"] .modal-kpi .kpi-label { font-size: 12px !important; }
html[lang="ar"] th, html[lang="ar"] .dist-table th,
html[lang="ar"] .task-group, html[lang="ar"] .promo-side h3 { font-size: 12.5px; }

/* Numbers, codes, phones and addresses typed into a field are written
   left to right. The box sits in an Arabic form, so the text hugs the
   side the form starts from. */
html[lang="ar"] input[type="tel"], html[lang="ar"] input[type="email"],
html[lang="ar"] input[type="number"], html[lang="ar"] input[type="url"],
html[lang="ar"] input[inputmode="tel"], html[lang="ar"] input[inputmode="decimal"],
html[lang="ar"] .mono, html[lang="ar"] code {
  direction: ltr; unicode-bidi: isolate; text-align: right;
}

/* ═══════════════════════════════════════════════════════════════════════
   STOCK BALANCE ON A PHONE — a card per item
   What it is, how much there is, what it is worth and how long it lasts,
   then only the warehouses that hold it. The table's cells stacked one
   under another cut the code and name short and listed every warehouse,
   zeros and all.
   ═══════════════════════════════════════════════════════════════════════ */
.stock-cards { display: grid; gap: 10px; }
.stock-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 12px;
}
.stock-card-head { display: flex; gap: 10px; align-items: flex-start; }
.stock-card-pic img {
  display: block; width: 48px; height: 48px; object-fit: contain;
  border-radius: var(--radius-sm); background: #F5F4F0;
}
.stock-card-id { flex: 1; min-width: 0; }
.stock-card-code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px; color: var(--muted); overflow-wrap: anywhere;
}
.stock-card-name { font-weight: 600; font-size: 14.5px; line-height: 1.35; margin-top: 1px; overflow-wrap: anywhere; }
.stock-card-head .pill { flex: none; margin-top: 1px; }
.stock-card-figs {
  /* On hand is a short number; the value, with its currency, the longest. */
  display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.35fr) minmax(0, 1fr); gap: 10px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}
.stock-fig { min-width: 0; }
.stock-fig-label { font-size: 11px; font-weight: 600; color: var(--muted); line-height: 1.3; }
.stock-fig-value { font-size: 16px; font-weight: 700; margin-top: 2px; line-height: 1.25; overflow-wrap: anywhere; }
.stock-fig-value.neg { color: var(--error); }
.stock-fig-sub { font-size: 11px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.stock-card-whs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.stock-wh {
  display: inline-flex; gap: 6px; align-items: baseline; max-width: 100%;
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
  background: var(--bg); font-size: 12.5px;
}
.stock-wh-name { overflow-wrap: anywhere; }
.stock-wh.neg { border-color: #FCA5A5; background: var(--error-bg); color: var(--error); }
.stock-wh-none { font-size: 12px; color: var(--muted); }

/* ═══════════════════════════════════════════════════════════════════════
   REP COMMISSION — the month against its target, and what it earned
   ═══════════════════════════════════════════════════════════════════════ */
.cm-monthnav { display: flex; align-items: center; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.cm-monthnav b { min-width: 9em; text-align: center; }
.cm-sync { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 12px; }
.cm-month { display: grid; gap: 12px; }
.cm-month .card, .cm-person { min-width: 0; }
.cm-hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.cm-big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.cm-bar { height: 10px; background: var(--cream); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-top: 10px; }
.cm-bar span { display: block; height: 100%; background: var(--amber); border-radius: 6px; }
.cm-bar span.met { background: var(--ok); }
.kpi-card .cm-bar { margin-top: 8px; }
.cm-worth { margin-top: 12px; background: var(--amber-soft); border: 1px solid #F1DFA9; border-inline-start: 4px solid var(--amber);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; display: grid; gap: 4px; }
.cm-shop { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.cm-shop:first-of-type { border-top: none; }
.cm-shop-main { min-width: 0; }
.cm-shop-name { font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.cm-chart { display: flex; gap: 6px; align-items: flex-end; height: 140px; padding: 6px 0 0; overflow-x: auto; }
.cm-col { flex: 1 0 28px; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%;
  background: none; border: none; cursor: pointer; padding: 0; color: var(--muted); font: inherit; }
.cm-col-plot { position: relative; flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.cm-col-plot span { display: block; width: 70%; max-width: 30px; border-radius: 4px 4px 0 0; background: var(--amber); }
.cm-col-plot span.met { background: var(--ok); }
.cm-col-plot span.missed { background: #E8B4B4; }
.cm-col-plot .cm-target { position: absolute; inset-inline: 8%; height: 0; border-top: 2px dashed var(--ink); }
.cm-col small { font-size: 10.5px; }
.cm-col.on small { color: var(--text); font-weight: 700; }
.cm-row-on td { background: var(--amber-soft); }
.cm-alerts { list-style: none; display: grid; gap: 6px; font-size: 13px; }
.cm-alerts li { padding: 6px 0; border-top: 1px solid var(--border); }
.cm-alerts li:first-child { border-top: none; }
.cm-team-table td, .cm-team-table th { white-space: nowrap; }
.cm-team-cards { display: none; gap: 10px; }
.cm-rep-card { display: grid; gap: 4px; text-decoration: none; color: var(--text); }
.cm-rep-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.cm-rep-figs b { display: block; color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.cm-person { padding: 12px 0; border-top: 1px solid var(--border); }
.cm-person:first-of-type { border-top: none; }
.cm-person-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.cm-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.cm-check input { width: 18px; height: 18px; accent-color: var(--amber); }
.cm-pay { margin-top: 8px; font-size: 13px; }
.cm-pay summary { cursor: pointer; color: var(--amber-dark); font-weight: 600; }
.cm-pay-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 8px; align-items: end; }
.cm-pay-list { list-style: none; margin-top: 8px; font-size: 12.5px; display: grid; gap: 2px; }
.cm-targets input { width: 92px; min-width: 92px; padding: 6px; font-size: 12.5px; }
.cm-month .dist-fig small, .cm-month .dist-fig .muted { display: block; font-size: 11px; margin-top: 2px; }
.cm-others { margin-top: 10px; }
.cm-others summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 6px 0; }
.cm-targets input:disabled { background: var(--cream); color: var(--muted); }
@media (max-width: 760px) {
  .cm-team-wide { display: none; }
  .cm-team-cards { display: grid; }
  .cm-big { font-size: 22px; }
  .cm-shop { flex-wrap: wrap; }
}
/* A figure in a pill reads as written: "75% of target", not "75% Of Target". */
.cm-hero .pill, .cm-rep-card .pill, .cm-person .pill { text-transform: none; }

/* ── Cash flow planning ─────────────────────────────────────────────── */
.cf-warn { color: var(--amber-dark); background: var(--amber-soft); font-size: 12.5px; }
.cf-wrap { max-height: 70vh; }
.cf-table { font-size: 12px; font-variant-numeric: tabular-nums; border-collapse: separate; border-spacing: 0; }
.cf-table th, .cf-table td { white-space: nowrap; padding: 6px 8px; }
.cf-table thead th { position: sticky; top: 0; background: var(--card); z-index: 2; font-size: 10.5px; }
/* The row's name stays in view while the weeks scroll past. */
.cf-table .cf-label { position: sticky; inset-inline-start: 0; background: var(--card); z-index: 1;
  min-width: 190px; max-width: 260px; white-space: normal; font-weight: 600; }
.cf-table thead .cf-label { z-index: 3; font-size: 12px; }
.cf-table th.cf-month { background: var(--cream); }
.cf-table th.cf-over, .cf-table td[data-col="overdue"] { background: var(--error-bg); }
.cf-cell.has { cursor: pointer; }
.cf-cell.has:hover { background: var(--amber-soft); }
.cf-cell.on { background: var(--amber-soft); outline: 2px solid var(--amber); outline-offset: -2px; }
.cf-section td { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  background: var(--cream) !important; padding-top: 10px; }
.cf-section td:first-child { position: sticky; inset-inline-start: 0; }
.cf-subtotal td { font-weight: 700; border-top: 1px solid var(--border); }
.cf-net td { font-weight: 700; border-top: 2px solid var(--ink); }
.cf-balance td { font-weight: 800; background: var(--amber-soft); }
.cf-balance td.cf-label, .cf-net td.cf-label, .cf-subtotal td.cf-label { background: inherit; }
.cf-balance td.cf-label { background: var(--amber-soft); }
.cf-table td.neg { color: var(--error); }
.cf-undated-line, .cf-charge {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  font-size: 12.5px; padding: 5px 0; border-bottom: 1px solid var(--border);
}
.cf-charge.done { opacity: .55; }
.cf-ship { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.cf-ship-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 4px; }
.cf-ship-note { font-size: 11.5px; color: var(--amber-dark); background: var(--amber-soft); border-radius: 6px; padding: 5px 8px; margin: 4px 0; }
.cf-charge-add { margin-top: 6px; }
.cf-charge-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.cf-charge-form .form-group { margin: 0; }
.cf-found { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; max-height: 220px; overflow-y: auto; }
.cf-found-row { display: flex; flex-direction: column; align-items: flex-start; text-align: start; gap: 1px;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); cursor: pointer; }
.cf-found-row:hover { background: var(--amber-soft); }
.cf-chosen { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 700px) {
  /* The plan is a grid of weeks even on a phone: it scrolls sideways
     inside its card, the row names held at the edge. */
  .cf-table, .cf-table thead, .cf-table tbody, .cf-table tr, .cf-table th, .cf-table td { display: revert; }
  .cf-table thead { display: table-header-group; }
  .cf-table tr { margin: 0; border: none; padding: 0; }
  .cf-table td, .cf-table th { display: table-cell; padding: 6px 8px; }
  .cf-table td::before { content: none; }
  .cf-table .cf-label { min-width: 140px; }
  .cf-charge-form { flex-direction: column; align-items: stretch; }
}

/* ── How an order goes out ──────────────────────────────────────────── */
.dm-chip { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
  background: #E0F2FE; color: #075985; white-space: nowrap; }
.dm-chip[data-method="courier"] { background: #FFEDD5; color: #9A3412; }
.dm-chip[data-method="company_van"] { background: #DBEAFE; color: #1E3A8A; }
.dm-chip[data-method="rep"], .dm-chip[data-method="rep_home"] { background: #DCFCE7; color: #166534; }
.dm-chip[data-method="customer_pickup"] { background: #EDE9FE; color: #5B21B6; }
.dm-chip.none { background: var(--amber-soft); color: var(--amber-dark); white-space: normal; }
.dm-chip.big { font-size: 14px; padding: 4px 12px; }
.dm-card { border-inline-start: 4px solid var(--amber); }
.dm-now { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dm-wait { font-size: 13px; font-weight: 600; color: var(--amber-dark); margin: 0; }
.dist-method { padding: 10px 12px; background: var(--cream); border-radius: 8px; }
.dist-sale-method { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 4px; font-size: 12.5px; font-weight: 600; }

/* ── The container or B/L a shipment is followed by ───────────────── */
.track-ref { font-family: monospace; font-size: 12px; letter-spacing: .02em; }
.track-ref-input { max-width: 170px; padding: 4px 6px !important; font-family: monospace; font-size: 12px !important; text-transform: uppercase; }
.track-ref-input::placeholder { text-transform: none; font-family: inherit; }
.track-ref-hint { font-size: 10px; color: var(--muted); margin-top: 2px; }
.track-ref-hint.warn { color: var(--amber-dark); font-weight: 600; }

/* ── The kind of store ─────────────────────────────────────────────── */
.store-type-chip { font-size: 11.5px; margin-top: 3px; color: var(--ink-soft); }
.store-type-chip.unset { color: var(--amber-dark); font-weight: 600; }

/* ── Items hidden from the ordering links ─────────────────────────── */
.ex-untyped { font-size: 12px; color: var(--amber-dark); background: var(--amber-soft); border-radius: 8px; padding: 7px 10px; margin: 0 0 10px; }
.ex-list { max-height: 560px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.ex-row { display: flex; gap: 9px; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.ex-row:last-child { border-bottom: none; }
.ex-row.off .ex-name { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--border); }
.ex-name { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.ex-lock { color: var(--amber-dark); font-size: 11px; }
.ex-foot { display: flex; gap: 10px; align-items: center; margin-top: 12px; position: sticky; bottom: 0; background: var(--card); padding: 8px 0; }

/* ── Finding a store's link; switching one off ─────────────────────── */
.links-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.links-filters input[type="search"] { flex: 1 1 220px; width: auto; min-width: 0; }
.links-filters select { width: auto; flex: 0 1 auto; max-width: 220px; }
.links-waiting { display: flex; gap: 6px; align-items: center; font-size: 12.5px; white-space: nowrap; }
.links-count { font-size: 12px; margin-inline-start: auto; }
.link-store { font-size: 11.5px; margin-top: 2px; }
tr.link-off td { opacity: .6; }
tr.link-off td:last-child { opacity: 1; }
.link-off-pill { margin-top: 4px; font-size: 11px; font-weight: 700; color: var(--amber-dark); white-space: nowrap; }
.link-off-btn { color: var(--amber-dark); }
.link-off-banner { margin-top: 6px; padding: 7px 10px; background: var(--amber-soft); color: var(--amber-dark); border-radius: 6px; font-size: 12.5px; font-weight: 600; }

/* ── Every shop: filters, and what each was invoiced and owes ─────── */
.dist-filters { flex-wrap: wrap; gap: 8px; }
.dist-filters select { width: auto; flex: 1 1 150px; min-width: 0; max-width: 240px; }
.dist-totals { font-size: 12px; margin: 2px 0 8px; }
.dist-figs { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.dist-figs .owes { font-weight: 700; }
.dist-figs .late { color: var(--error); font-weight: 600; }

/* Cheque forwarding (renderChequeForward). */
.chf-search { flex: 1; min-width: 200px; }
.chf-table tr.chf-chosen td { background: var(--amber-soft); }
.chf-bar { position: sticky; bottom: 8px; margin-top: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.08); }
/* From the reps: a row of what a rep hands over, and how. */
.cf-rep-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.chf-results { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.chf-results li.ok { color: var(--ok); }
.chf-results li.error { color: var(--error); }
.pill.chf-done { background: var(--ok-bg); color: var(--ok); }
.pill.chf-working { background: var(--warn-bg); color: var(--warn); }
.pill.chf-attention { background: var(--error-bg); color: var(--error); }

/* Quick Stock Entry: items found by a few words of their name or code. */
.se-suggest { margin-top: 6px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
  max-height: 300px; overflow-y: auto; box-shadow: var(--shadow-md); }
.se-suggest[hidden] { display: none; }
.se-suggest-note { padding: 8px 10px; font-size: 12.5px; font-weight: 600; color: var(--warn); background: var(--warn-bg); }
.se-suggest-row { display: grid; grid-template-columns: minmax(90px, auto) 1fr auto; gap: 2px 10px; align-items: baseline;
  width: 100%; text-align: start; padding: 8px 10px; border: 0; border-top: 1px solid var(--border); background: none;
  cursor: pointer; font: inherit; color: inherit; }
.se-suggest-row:first-child, .se-suggest-note + .se-suggest-row { border-top: 0; }
.se-suggest-row:hover, .se-suggest-row.picked { background: var(--amber-soft); }
.se-suggest-code { font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.se-suggest-name { font-size: 13px; min-width: 0; }
.se-suggest-stock { font-size: 11.5px; white-space: nowrap; }
@media (max-width: 640px) {
  .se-suggest-row { grid-template-columns: 1fr; }
  .se-suggest-stock { white-space: normal; }
}

/* Item exclusions: ticked, and still hidden somewhere else. */
.ex-still { font-size: 11.5px; color: var(--warn); margin-top: 2px; }
/* Item exclusions: left out by the stock visibility rules, whatever the tick. */
.ex-ruled { font-size: 11.5px; color: var(--error); margin-top: 2px; }
.ex-row.ruled .ex-name { color: var(--muted); }

/* Distribution settings: each rep's collection accounts. */
.rep-acct-list { display: flex; flex-direction: column; gap: 10px; }
.rep-acct-row { display: grid; grid-template-columns: 140px 1fr 1fr 1fr auto; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); align-items: start; }
.rep-acct-row:first-child { border-top: none; }
@media (max-width: 720px) { .rep-acct-row { grid-template-columns: 1fr; } }


/* ── Stock count (#/stock-count-detail) ─────────────────────────────
   As the Anker Store Count page laid it out: where you count, a search
   and filters at the top; the lines grouped, a column per spot; the scan
   bar fixed at the thumb; the quantity window over everything, the
   camera too. */
body.sc-docked .main-content { padding-bottom: 110px; }
.sc-scrim[hidden], .sc-toast[hidden], .sc-sync[hidden], .sc-banner[hidden], .sc-dock[hidden] { display: none !important; }
.sc-top { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.sc-title { margin: 4px 0 2px; font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }
.sc-sync { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.sc-sync.ok { color: var(--ok); border-color: #BBE3C6; background: var(--ok-bg); }
.sc-sync.wait { color: var(--warn); border-color: #FCD34D; background: var(--warn-bg); }
.sc-sync.bad { color: var(--error); border-color: #FCA5A5; background: var(--error-bg); }
.sc-banner { border: 1px solid #FCD34D; background: var(--warn-bg); color: var(--ink); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin: 6px 0 10px; }
.sc-prog { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; margin: 6px 0 10px; }
.sc-big { font-size: 26px; font-weight: 800; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.sc-big small { font-size: 15px; color: var(--muted); font-weight: 600; }
.sc-lbl { font-size: 12px; color: var(--muted); }
.sc-bar { flex-basis: 100%; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.sc-bar span { display: block; height: 100%; background: var(--ink); transition: width .3s; }
.sc-deck { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0; border-bottom: 1px solid var(--border); }
.sc-lab { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; font-weight: 700; }
.sc-seg { display: grid; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.sc-seg button { border: 0; background: transparent; border-radius: 7px; padding: 9px 4px; font-weight: 600; font-size: 13px; color: var(--muted); line-height: 1.15; cursor: pointer; min-width: 0; overflow-wrap: anywhere; }
.sc-seg button small { display: block; font-weight: 400; font-size: 10.5px; opacity: .8; }
.sc-seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.sc-deck input[type="search"] { width: 100%; font-size: 15px; }
.sc-chips { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.sc-chips::-webkit-scrollbar { display: none; }
.sc-chip { border: 1px solid var(--border); background: var(--card); border-radius: 999px; padding: 6px 11px; font-size: 12.5px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.sc-chip b { margin-inline-start: 5px; color: var(--muted); font-weight: 700; }
.sc-chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: #fff; }
.sc-chip[aria-pressed="true"] b { color: var(--amber); }
.sc-thead, .sc-row { display: grid; grid-template-columns: var(--sc-cols); gap: 8px; align-items: center; }
.sc-thead span { font-size: 10px; }
.sc-thead { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 12px 6px; font-weight: 700; }
.sc-thead span { text-align: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-thead span:first-child { text-align: start; }
.sc-thead span.on { color: var(--ink); }
.sc-grp { font-weight: 800; font-size: 14px; letter-spacing: .02em; text-transform: uppercase; color: var(--ink); padding: 14px 2px 6px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sc-grp small { font-size: 11px; font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; }
.sc-list { background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.sc-row { padding: 10px 12px; border-top: 1px solid var(--border); cursor: pointer; }
.sc-row:first-child { border-top: 0; }
.sc-item { min-width: 0; }
.sc-nm { color: var(--ink); font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.sc-cd { font-size: 11.5px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.sc-tag { font-size: 10px; letter-spacing: .04em; text-transform: uppercase; background: var(--amber-soft); color: var(--ink); border: 1px solid var(--amber); border-radius: 4px; padding: 1px 5px; margin-inline-start: 6px; white-space: nowrap; font-weight: 700; }
.sc-link { border: 0; background: none; color: var(--anker-blue); text-decoration: underline; padding: 0; margin-inline-start: 8px; font-size: 12px; cursor: pointer; }
.sc-q { width: 100%; min-width: 0; text-align: center; border: 1px solid var(--border); background: var(--bg); border-radius: 8px; padding: 9px 2px; font-size: 16px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; cursor: pointer; }
.sc-q.on { border-color: var(--ink); }
.sc-ind { font-size: 12.5px; font-weight: 800; text-align: center; border-radius: 6px; padding: 6px 4px; line-height: 1.1; color: var(--muted); border: 1px dashed var(--border); min-width: 0; }
.sc-ind small { display: block; font-weight: 400; font-size: 10px; margin-top: 2px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-ind.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid transparent; }
.sc-ind.w { background: var(--warn-bg); color: var(--warn); border: 1px solid transparent; }
.sc-ind.b { background: var(--error-bg); color: var(--error); border: 1px solid transparent; }
.sc-adds { margin-top: 6px; }
.sc-adds .sc-grp { color: var(--amber-dark); }
.sc-hit-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border); }
.sc-hit-row:first-child { border-top: 0; }
.sc-hit-row .sc-item { flex: 1; }
.sc-adds[hidden], .sc-list[hidden] { display: none !important; }
.sc-foot { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sc-dock { position: fixed; inset-inline: 0; bottom: 0; z-index: 40; background: var(--card); border-top: 1px solid var(--border); box-shadow: 0 -6px 24px rgba(31,30,27,.10); padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 901px) { .sc-dock { inset-inline-start: var(--sidebar-w); } }
.sc-dock-in { max-width: 980px; margin: 0 auto; display: flex; gap: 10px; }
.sc-arm { flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0,1fr); column-gap: 12px; align-items: center; text-align: start; border: 0; border-radius: 12px; background: var(--ink); color: #fff; padding: 9px 16px; cursor: pointer; }
.sc-arm i { grid-row: 1 / 3; width: 14px; height: 14px; border-radius: 50%; background: #4CC35A; animation: sc-pulse 1.8s infinite; }
.sc-a1 { font-weight: 800; font-size: 17px; letter-spacing: .02em; text-transform: uppercase; line-height: 1.1; }
.sc-a2 { font-size: 12.5px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-arm.off { background: var(--amber); color: var(--ink); }
.sc-arm.off i { background: var(--ink); animation: none; }
.sc-arm.hit { animation: sc-hit .35s; }
.sc-dock.off .sc-arm { background: var(--border); color: var(--muted); }
.sc-cam, .sc-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--ink); font-weight: 700; font-size: 12px; padding: 6px 14px; cursor: pointer; }
.sc-cam { font-size: 20px; }
.sc-cam span { font-size: 11.5px; }
.sc-cam:disabled, .sc-add:disabled { opacity: .45; cursor: default; }
@keyframes sc-pulse { 0% { box-shadow: 0 0 0 0 rgba(76,195,90,.55); } 70% { box-shadow: 0 0 0 9px rgba(76,195,90,0); } 100% { box-shadow: 0 0 0 0 rgba(76,195,90,0); } }
@keyframes sc-hit { 0% { transform: scale(1); } 40% { transform: scale(1.025); } 100% { transform: scale(1); } }
/* Over the camera's own screen (z-index 900): the count is asked for
   without putting the camera away. */
.sc-scrim { position: fixed; inset: 0; background: rgba(20,20,20,.5); z-index: 950; display: flex; align-items: flex-end; justify-content: center; }
.sc-sheet { background: var(--card); width: 100%; max-width: 560px; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); max-height: 94vh; overflow-y: auto; }
@media (min-width: 640px) { .sc-scrim { align-items: center; } .sc-sheet { border-radius: 16px; } }
@media (min-width: 900px) { .sc-sheet { max-width: 660px; } .sc-qtywrap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; } }
.sc-sh-hd { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.sc-sh-nm { font-weight: 800; font-size: 20px; line-height: 1.15; color: var(--ink); overflow-wrap: anywhere; }
.sc-close { border: 0; background: var(--bg); border-radius: 50%; width: 34px; height: 34px; font-size: 18px; color: var(--muted); flex: none; cursor: pointer; }
.sc-sec { margin-top: 14px; }
.sc-sec h3 { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 0 6px; }
.sc-note { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.sc-note.warn { color: var(--warn); }
.sc-sofar { display: flex; justify-content: space-between; align-items: baseline; background: var(--bg); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.sc-sofar b { font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.sc-hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; padding: 8px 10px; border-inline-start: 3px solid var(--amber); background: var(--bg); border-radius: 0 6px 6px 0; }
.sc-qtyd { display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 800; color: var(--ink); border: 2px solid var(--ink); border-radius: 12px; padding: 4px 0; font-variant-numeric: tabular-nums; transition: background .2s; direction: ltr; }
.sc-qtyd.bump { background: var(--amber-soft); }
.sc-qtyd.take { border-color: var(--error); color: var(--error); }
.sc-mode button.take[aria-pressed="true"] { background: var(--error); color: #fff; }
.sc-take-btn { background: var(--error) !important; border-color: var(--error) !important; color: #fff !important; }
.sc-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; direction: ltr; }
.sc-pad button { border: 1px solid var(--border); background: var(--bg); border-radius: 10px; padding: 11px 0; font-size: 22px; font-weight: 700; color: var(--ink); cursor: pointer; }
.sc-pad button.fn { font-size: 14px; color: var(--muted); }
.sc-quick { display: flex; gap: 6px; margin-top: 8px; direction: ltr; }
.sc-quick button { flex: 1; border: 1px solid var(--border); background: var(--card); border-radius: 8px; padding: 8px 0; font-weight: 700; font-size: 13px; color: var(--ink); cursor: pointer; }
.sc-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.sc-acts .full { grid-column: 1 / -1; }
.sc-big-btn { padding: 14px 10px; font-size: 15px; }
.sc-big-btn:disabled { opacity: .45; }
.sc-picks { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: 8px; max-height: 42vh; overflow-y: auto; }
.sc-picks:empty { display: none; }
.sc-hit { display: block; width: 100%; text-align: start; padding: 10px 12px; border: 0; border-top: 1px solid var(--border); background: var(--card); cursor: pointer; }
.sc-hit:first-child { border-top: 0; }
.sc-hit .sc-nm, .sc-hit .sc-cd { display: block; }
.sc-copyarea { width: 100%; height: 150px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11px; border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin-top: 8px; }
.sc-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom, 0px)); z-index: 960; background: var(--ink); color: #fff; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; max-width: calc(100% - 32px); display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.sc-toast button { border: 0; background: var(--amber); color: var(--ink); border-radius: 7px; padding: 6px 10px; font-weight: 700; font-size: 12.5px; white-space: nowrap; cursor: pointer; }
@media (max-width: 640px) {
  .sc-thead, .sc-row { grid-template-columns: repeat(var(--sc-ncols), minmax(0,1fr)) 84px; gap: 6px; }
  .sc-thead span:first-child { display: none; }
  .sc-row .sc-item { grid-column: 1 / -1; margin-bottom: 2px; }
  .sc-thead { padding: 10px 12px 4px; font-size: 9.5px; }
  .sc-title { font-size: 21px; }
  .sc-a1 { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .sc-arm i, .sc-arm.hit { animation: none; } }

/* ═══════════════════════════════════════════════════════════════════════
   ACCOUNTS RECEIVABLE — the new view
   ═══════════════════════════════════════════════════════════════════════
   What is owed and how it is held; how old it is; when the cheques fall
   due; where it sits; who owes it. Colour does two jobs only: the open
   balance is one hue, darker as the debt gets older, and cheques in hand
   are blue. Figures and names stay in ink. */
.arx-head-acts { align-items: center; }
.arx-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.arx-switch button {
  border: 0; background: none; padding: 6px 12px; border-radius: 6px; cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.arx-switch button.on { background: var(--ink); color: #fff; }
.arx-switch button:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }

.arx { --arx-ink: #1F1E1B; --arx-ink2: #52514E; --arx-axis: #C3C2B7; --arx-cheque: #2A78D6; position: relative; }
.arx-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px 20px; min-width: 0;
}
.arx-card h2 { font-size: 15px; font-weight: 700; margin: 0 0 2px; }
.arx-hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.arx-empty { font-size: 12.5px; color: var(--muted); padding: 8px 0; }
.arx-top { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 1180px) { .arx-top { grid-template-columns: 1fr 1fr; } .arx-top .arx-hero { grid-column: 1 / -1; } }
@media (max-width: 720px) { .arx-top { grid-template-columns: 1fr; } }

/* The one figure the page leads with. */
.arx-hero { border-top: 3px solid var(--amber); }
.arx-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.arx-hero-num { font-size: clamp(34px, 4.2vw, 52px); font-weight: 700; line-height: 1.1; letter-spacing: -.02em; margin: 4px 0 2px; overflow-wrap: anywhere; }
[dir="rtl"] .arx-eyebrow, [dir="rtl"] .arx-hero-num { letter-spacing: 0; }
.arx-note { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

/* A whole split into parts: each part its own block, a gap between them. */
.arx-seg { display: flex; gap: 2px; width: 100%; }
.arx-seg .arx-blk { min-width: 3px; border: 0; padding: 0; font: inherit; }
.arx-seg.tall { height: 28px; margin: 14px 0 10px; }
.arx-seg.tall .arx-blk { border-radius: 4px; display: flex; align-items: center; padding: 0 8px; font-size: 12px; font-weight: 700; text-align: start; }
.arx-seg.tall .arx-blk > span { display: block; width: 100%; min-width: 0; white-space: nowrap; overflow: hidden; }
.arx-seg.tall button.arx-blk { cursor: pointer; }
.arx-seg.tall .arx-blk:hover, .arx-seg.tall .arx-blk:focus-visible { filter: brightness(1.1); }
.arx-seg.tall .arx-blk:focus-visible, .arx-seg.tall .arx-blk.on { outline: 2px solid var(--arx-ink); outline-offset: 2px; }
.arx.picking-band [data-role="arx-age-bar"] .arx-blk:not(.on) { opacity: .35; }
.arx-seg.thin { height: 10px; }
.arx-seg.thin .arx-blk { min-width: 2px; }
.arx-seg.thin .arx-blk:first-child { border-start-start-radius: 5px; border-end-start-radius: 5px; }
.arx-seg.thin .arx-blk:last-child { border-start-end-radius: 5px; border-end-end-radius: 5px; }
.arx-blk.who { background: #2C2C2C; color: #fff; }
.arx-seg.tall .arx-blk.who > .arx-num { display: none; }
.arx-seg.tall .arx-blk.who.numbered { padding: 0; justify-content: center; }
.arx-seg.tall .arx-blk.who.numbered > span[data-fit] { display: none; }
.arx-seg.tall .arx-blk.who.numbered > .arx-num { display: block; width: auto; }
.arx-names { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.arx-names button {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 0; border-radius: 6px; background: none;
  font: inherit; font-size: 12px; color: var(--arx-ink2); cursor: pointer; text-align: start;
}
.arx-names button:hover { background: var(--cream); }
.arx-names button:focus-visible { outline: 2px solid var(--arx-ink); outline-offset: -2px; }
.arx-names em { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; border-radius: 4px; background: #2C2C2C; color: #fff; font-style: normal; font-size: 10.5px; font-weight: 700; }
.arx-names b { color: var(--arx-ink); font-variant-numeric: tabular-nums; }
.arx-blk.rest { background: #C9C6BD; color: #0B0B0B; }

/* The names of the parts, and their figures. */
.arx-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.arx-legend li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.arx-legend i, .arx-keys i, .arx-mini i { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.arx-legend span { flex: 1; min-width: 0; color: var(--arx-ink2); }
.arx-legend b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.arx-legend.rows { gap: 1px; }
.arx-legend-row {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 6px; border: 0; border-radius: 6px;
  background: none; font: inherit; font-size: 13px; color: inherit; text-align: start; cursor: pointer;
}
.arx-legend-row:hover:not(:disabled) { background: var(--cream); }
.arx-legend-row:focus-visible { outline: 2px solid var(--arx-ink); outline-offset: -2px; }
.arx-legend-row.on { background: var(--amber-soft); box-shadow: inset 0 0 0 1px var(--amber); }
.arx-legend-row:disabled { cursor: default; opacity: .55; }
.arx-legend-row em { font-style: normal; width: 38px; text-align: end; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Cheques by the month they fall due: thin columns on one baseline. */
.arx-cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; margin-top: 14px; }
.arx-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.arx-col:disabled { cursor: default; }
.arx-col-track { width: 100%; height: 132px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-bottom: 1px solid var(--arx-axis); }
.arx-col-bar { display: block; flex: none; width: min(24px, 70%); background: var(--arx-cheque); border-radius: 4px 4px 0 0; }
.arx-col-val { font-size: 11.5px; font-weight: 700; margin-bottom: 4px; white-space: nowrap; }
.arx-col-label { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.arx-col:hover:not(:disabled) .arx-col-bar, .arx-col:focus-visible .arx-col-bar { filter: brightness(1.15); }
.arx-col:focus-visible { outline: 2px solid var(--arx-ink); outline-offset: 2px; border-radius: 4px; }
.arx-col.on .arx-col-label { color: var(--arx-ink); font-weight: 700; }
.arx.picking-month .arx-col:not(.on) .arx-col-bar { opacity: .35; }
.arx-foot { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.arx-foot span { display: flex; flex-direction: column; }
.arx-foot b { font-size: 14px; color: var(--arx-ink); }

/* The few figures that say how collecting is going. */
.arx-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1180px) { .arx-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .arx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.arx-stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.arx-stat-label { font-size: 12px; color: var(--muted); }
.arx-stat-value { font-size: 20px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.arx-stat-sub { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.arx-where { margin-bottom: 16px; }

/* Who owes it: what is asked for, in one row above the list it scopes. */
.arx-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0 10px; }
.arx .arx-search { flex: 1 1 200px; max-width: 260px; }
.arx-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 0 1 auto; }
.arx-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); font: inherit; font-size: 12.5px; font-weight: 600; color: var(--arx-ink2); cursor: pointer; white-space: nowrap;
}
.arx-chip em { font-style: normal; font-weight: 500; font-size: 11.5px; color: var(--muted); }
.arx-chip:hover:not(:disabled) { border-color: var(--arx-ink2); }
.arx-chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.arx-chip.on em { color: rgba(255,255,255,.75); }
.arx-chip:disabled { opacity: .45; cursor: default; }
.arx-chip:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.arx .arx-sort { width: auto; flex: none; margin-inline-start: auto; padding-block: 8px; font-size: 13px; }
.arx-picked:empty { display: none; }
.arx-pick {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px; padding-block: 5px; padding-inline: 10px 6px;
  background: var(--amber-soft); border: 1px solid var(--amber); border-radius: 8px; font-size: 12.5px; font-weight: 600;
}
.arx-pick button { border: 0; background: none; padding: 0 4px; font-size: 16px; line-height: 1; color: var(--arx-ink2); cursor: pointer; }
.arx-keys { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; font-size: 11.5px; color: var(--muted); }
.arx-keys span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.arx-count { margin-bottom: 6px; font-size: 12px; color: var(--muted); }

.arx-list { border-top: 1px solid var(--border); }
.arx-row { border-bottom: 1px solid var(--border); }
.arx-row-head {
  /* Every row the same tracks, so the bars share one baseline and one scale. */
  display: grid; grid-template-columns: 26px minmax(0, 1.1fr) minmax(0, 1.5fr) minmax(0, .9fr); gap: 12px; align-items: center;
  width: 100%; padding: 10px 6px; border: 0; background: none; font: inherit; color: inherit; text-align: start; cursor: pointer;
}
.arx-row-head:hover { background: var(--cream); }
.arx-row-head:focus-visible { outline: 2px solid var(--arx-ink); outline-offset: -2px; }
.arx-row.open > .arx-row-head { background: var(--amber-soft); }
.arx-rank { font-size: 12px; color: var(--muted); text-align: end; font-variant-numeric: tabular-nums; }
.arx-name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.arx-name b { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.arx-name small { font-size: 11.5px; color: var(--muted); }
.arx-flag { align-self: flex-start; margin-top: 3px; padding: 1px 8px; border-radius: 10px; background: var(--error-bg); color: var(--error); font-size: 11px; font-weight: 700; }
.arx-bar-cell { display: flex; align-items: center; min-width: 0; }
.arx-figs { display: flex; flex-direction: column; min-width: 0; text-align: end; }
.arx-figs b { font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.arx-figs b.credit { font-weight: 600; color: var(--muted); }
.arx-figs small { font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .arx-row-head { grid-template-columns: 22px minmax(0, 1.25fr) minmax(0, 1fr); grid-template-areas: "rank name figs" "bar bar bar"; gap: 8px 10px; }
  .arx-rank { grid-area: rank; align-self: start; padding-top: 2px; }
  .arx-name { grid-area: name; }
  .arx-figs { grid-area: figs; }
  .arx-bar-cell { grid-area: bar; }
}

/* What opens under a customer. */
.arx-detail { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding: 14px 16px 18px; background: #FCFBF8; border-top: 1px solid var(--border); }
@media (max-width: 760px) { .arx-detail { grid-template-columns: 1fr; gap: 14px; } }
.arx-detail h3 { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.arx-actions { grid-column: 1 / -1; padding-top: 14px; border-top: 1px solid var(--border); }
.arx-actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.arx table.arx-mini { width: 100%; border-collapse: collapse; background: none; box-shadow: none; border-radius: 0; font-size: 13px; }
.arx table.arx-mini th, .arx table.arx-mini td {
  padding: 3px 0; border: 0; background: none; font-size: 13px; font-weight: 500; color: var(--arx-ink2);
  text-transform: none; letter-spacing: 0; text-align: start; position: static;
}
.arx table.arx-mini td { text-align: end; white-space: nowrap; color: var(--arx-ink); font-variant-numeric: tabular-nums; }
.arx table.arx-mini td.plain { font-variant-numeric: normal; }
.arx table.arx-mini tr:hover { background: none; }
.arx table.arx-mini i { margin-inline-end: 7px; }
.arx table.arx-mini tfoot th, .arx table.arx-mini tfoot td { padding-top: 5px; border-top: 1px solid var(--border); font-weight: 700; color: var(--arx-ink); }
.arx-meter { height: 8px; margin: 10px 0 4px; border-radius: 4px; background: #CDE2FB; overflow: hidden; }
.arx-meter span { display: block; height: 100%; border-radius: 4px; background: var(--arx-cheque); }

/* One tooltip for every mark: the figure first, then what it is. */
.arx-tip {
  position: fixed; left: 0; top: 0; z-index: 400; display: flex; flex-direction: column; max-width: 260px; padding: 7px 10px;
  border-radius: 8px; background: #1F1E1B; color: #fff; font-size: 12px; line-height: 1.35; box-shadow: var(--shadow-md);
  pointer-events: none; opacity: 0; transition: opacity .1s;
}
.arx-tip.on { opacity: 1; }
.arx-tip b { font-size: 13.5px; }
.arx-tip span { color: rgba(255,255,255,.8); }
/* The same figures as a table, for a reader who is not looking at the chart. */
.arx-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Cartons scanned at fulfilment ───────────────────────────────────── */
.cs-card { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cs-card h2 { margin-bottom: 4px; }
.cs-card-text { flex: 1 1 260px; min-width: 0; }
.cs-card-side { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cs-card-side b { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.cs-card-side b.full { color: var(--ok); }
.cs { max-width: 860px; }
.cs-top { position: sticky; top: 8px; z-index: 5; border-top: 3px solid var(--amber); }
.cs-top.complete { border-top-color: var(--ok); }
.cs-count { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cs-count > span { font-size: 13px; color: var(--muted); }
.cs-big { font-variant-numeric: tabular-nums; line-height: 1; direction: ltr; unicode-bidi: isolate; }
.cs-big b { font-size: 46px; font-weight: 700; letter-spacing: -.02em; }
.cs-big span { font-size: 22px; font-weight: 600; color: var(--muted); }
.cs-meter { height: 10px; border-radius: 999px; background: #EEEBE4; overflow: hidden; margin: 10px 0 6px; }
.cs-meter i { display: block; height: 100%; background: var(--amber); border-radius: 999px; transition: width .2s ease; }
.cs-top.complete .cs-meter i, .cs-line.full .cs-meter i { background: var(--ok); }
.cs-meter.thin { height: 5px; margin: 6px 0 0; }
.cs-left { font-size: 13px; color: var(--muted); }
.cs-top.complete .cs-left { color: var(--ok); font-weight: 600; }
.cs-said { display: none; margin-top: 10px; padding: 11px 13px; border-radius: 10px; font-size: 15px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.cs-said.on { display: block; }
.cs-said.ok { background: var(--ok-bg); color: var(--ok); }
.cs-said.bad { background: var(--error-bg); color: var(--error); }
.cs-said.info { background: var(--amber-soft); color: #6B4E00; }
.cs-entry { display: flex; gap: 8px; margin-top: 12px; }
.cs-input { flex: 1; min-width: 0; font-size: 16px; padding: 11px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-family: ui-monospace, 'SF Mono', Consolas, monospace; direction: ltr; }
.cs-input:focus { border-color: var(--ink); outline: none; }
.cs-lines { display: flex; flex-direction: column; gap: 8px; }
.cs-line { border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
.cs-line.current { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(212,168,67,.35); }
.cs-line.full { background: #FAFCFA; }
.cs-line-head { all: unset; box-sizing: border-box; display: flex; width: 100%; gap: 12px; align-items: center; justify-content: space-between; cursor: pointer; min-height: 44px; }
.cs-line-head:focus-visible { outline: 2px solid var(--amber-dark); outline-offset: 3px; border-radius: 6px; }
.cs-line-name { min-width: 0; display: flex; flex-direction: column; }
.cs-line-name b { font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.cs-line-name small, .cs-line-count small { font-size: 12px; color: var(--muted); }
.cs-line-count { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.cs-line-count b { font-size: 18px; font-weight: 700; }
.cs-line.full .cs-line-count small { color: var(--ok); font-weight: 600; }
.cs-line.current .cs-line-count small { color: var(--ink); font-weight: 600; }
.cs-opt { display: flex; gap: 7px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 8px; cursor: pointer; }
.cs-opt input { width: 16px; height: 16px; flex: none; }
.cs-stray { margin-top: 10px; font-size: 12.5px; color: var(--warn); }
.cs-scan { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) minmax(0, 1.2fr) auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.cs-scan:last-child { border-bottom: 0; }
.cs-scan-code { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-weight: 600; overflow-wrap: anywhere; }
.cs-scan-code em { font-style: normal; font-family: inherit; font-size: 11px; font-weight: 500; color: var(--muted); margin-inline-start: 6px; }
.cs-scan-by { font-size: 12px; }
@media (max-width: 640px) {
  .cs-top { top: 60px; }
  .cs-big b { font-size: 38px; }
  .cs-scan { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
  .cs-scan-item, .cs-scan-by { grid-column: 1; }
  .cs-scan [data-role="cs-undo"] { grid-column: 2; grid-row: 1 / span 3; }
}

/* ── Warranty registrations (the office) ─────────────────────────────── */
.wr-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.wr-side .card { margin-bottom: 0; }
.wr-qr { display: flex; gap: 16px; align-items: flex-start; }
.wr-qr img { flex: none; width: 132px; height: 132px; border: 1px solid var(--border); border-radius: 8px; background: #fff; image-rendering: pixelated; }
.wr-code { font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-weight: 600; overflow-wrap: anywhere; }
.wr-sub { font-size: 12px; }
.wr-table th { white-space: nowrap; }
.wr-table td.wr-nw { white-space: nowrap; }
.wr-tag { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.wr-tag.ok { background: var(--ok-bg); color: var(--ok); }
.wr-tag.warn { background: var(--warn-bg); color: var(--warn); }
.wr-expired { color: var(--muted); text-decoration: line-through; }
.wr-found h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 4px; }
.wr-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 3px 0; }
.wr-kv span { color: var(--muted); flex: none; }
.wr-kv b { font-weight: 600; text-align: end; overflow-wrap: anywhere; }
.wr-months { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.wr-months label { font-size: 13px; font-weight: 600; }
@media (max-width: 560px) { .wr-qr { flex-direction: column; } }
