/* ==================================================================
   Atease® Client Portal — design system
   Mobile-first, installable PWA. Light + dark themes.
   Brand: navy #1a1a2e · Atease red #e24b4a
   ================================================================== */

:root {
  --navy:    #1a1a2e;
  --navy-2:  #24243e;
  --red:     #e24b4a;
  --red-2:   #c0392b;
  /* Dark surfaces keep the near-black base but gain blue depth via a gradient,
     so the UI reads as blue-and-white rather than black-and-white. */
  --navy-grad:     linear-gradient(160deg, #1a1a2e 0%, #1e2444 55%, #273069 100%);
  --navy-grad-bar: linear-gradient(90deg, #1a1a2e 0%, #23295a 100%);

  --bg:      #f4f5f8;
  --surface: #ffffff;
  --surface-2:#fbfbfd;
  --ink:     #1a1a24;
  --muted:   #6b7280;
  --faint:   #9aa1ad;
  --line:    #e8eaef;
  --line-2:  #f1f2f6;

  --good:    #1f9d57;
  --good-bg: #e7f6ee;
  --warn:    #c98a12;
  --warn-bg: #fbf1dc;
  --bad:     #d8352f;
  --bad-bg:  #fbe9e8;
  --info:    #2c5fb3;
  --info-bg: #e9f0fb;

  --radius:  16px;
  --radius-s:11px;
  --shadow:  0 1px 2px rgba(20,20,30,.05), 0 10px 30px -14px rgba(20,20,30,.18);
  --shadow-lg:0 20px 48px -20px rgba(20,20,30,.4);

  --nav-w:   248px;
  --bar-h:   58px;
  --tab-h:   62px;

  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* The portal is a single, light branded theme. Declaring the colour scheme
     keeps native controls light and stops browsers auto-darkening the page even
     when the client's device is set to dark mode. */
  color-scheme: light;
}

/* Auto dark-mode intentionally disabled — the portal stays light for every
   client regardless of their device setting. (The [data-theme="dark"] palette
   below is retained for a possible future in-app toggle, but nothing enables it.) */
:root[data-theme="light"] {
  --bg:#f4f5f8; --surface:#fff; --surface-2:#fbfbfd; --ink:#1a1a24; --muted:#6b7280;
  --faint:#9aa1ad; --line:#e8eaef; --line-2:#f1f2f6;
  --good-bg:#e7f6ee; --warn-bg:#fbf1dc; --bad-bg:#fbe9e8; --info-bg:#e9f0fb;
  --shadow:0 1px 2px rgba(20,20,30,.05), 0 10px 30px -14px rgba(20,20,30,.18);
}
:root[data-theme="dark"] {
  --bg:#0f0f17; --surface:#1a1a26; --surface-2:#20202e; --ink:#eceef3; --muted:#9aa1ad;
  --faint:#6b7280; --line:#2a2a3a; --line-2:#23232f;
  --good-bg:#12301f; --warn-bg:#33280f; --bad-bg:#331716; --info-bg:#12233f;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 12px 32px -14px rgba(0,0,0,.7);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
svg { display: block; }

/* ==================================================================
   AUTH SCREENS (login / forgot / reset)  — centered card
   ================================================================== */
.auth-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: #0f0f1a;
}
.auth-body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(226,75,74,.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(26,26,46,.6) 0%, transparent 60%);
}
.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 420px;
  background: rgba(255,255,255,.98); border-radius: 20px; overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.card-accent { height: 4px; background: linear-gradient(90deg, var(--red), var(--red-2)); }
.card-body   { padding: 2.5rem 2.25rem 2rem; }
.logo-wrap {
  text-align: center; background: var(--navy);
  margin: -2.5rem -2.25rem 1.75rem; padding: 1.75rem 2.25rem;
}
.logo-wrap img { max-height: 52px; width: auto; }
.logo-fallback { font-size: 26px; font-weight: 700; color: #fff; letter-spacing: -.5px; }
.logo-fallback sup { color: var(--red); font-size: 13px; }
.card-title    { font-size: 19px; font-weight: 600; color: var(--navy); margin-bottom: .25rem; }
.card-subtitle { font-size: 13px; color: #9ca3af; margin-bottom: 1.5rem; }
.card-footer {
  text-align: center; padding: 1rem 2.25rem 1.5rem; border-top: 1px solid #f3f4f6;
  font-size: 11.5px; color: #b0b7c3;
}
.card-foot-link { text-align: center; margin-top: 1.5rem; font-size: 12.5px; color: #6b7280; }
.card-foot-link a { color: var(--red-2); font-weight: 600; }
.card-foot-link a:hover { text-decoration: underline; }

/* Fields (shared by auth + app forms) */
.field { margin-bottom: 1.1rem; }
.field label {
  display: block; font-size: 12px; font-weight: 600; color: var(--ink);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px;
}
.auth-body .field label { color: #374151; }
.input-wrap { position: relative; }
.input-wrap > svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: #9ca3af; pointer-events: none;
}
.field input {
  width: 100%; height: 46px; padding: 0 14px 0 40px; font-size: 14px; font-family: inherit;
  border: 1.5px solid #e5e7eb; border-radius: 10px; background: #f9fafb; color: #111; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus { border-color: var(--navy); background: #fff; box-shadow: 0 0 0 4px rgba(26,26,46,.07); }
.field input::placeholder { color: #c4c9d4; }
.pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: #9ca3af; padding: 6px; line-height: 0;
}
.field .input-wrap input[type="password"], .field .input-wrap input[type="text"] { padding-right: 42px; }
.row-between { display: flex; align-items: center; justify-content: space-between; margin: -.3rem 0 1.25rem; }
.link { font-size: 12.5px; color: var(--red-2); font-weight: 500; }
.link:hover { text-decoration: underline; }

.btn {
  width: 100%; height: 48px; margin-top: .25rem; background: var(--navy); color: #fff;
  border: none; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer;
  letter-spacing: .02em; transition: background .15s, transform .1s;
}
.btn:hover  { background: var(--navy-2); }
.btn:active { transform: scale(.98); }
.btn.btn-ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }

/* Alerts (shared) */
.alert { font-size: 13px; line-height: 1.45; padding: 11px 14px; border-radius: 10px; margin-bottom: 1.25rem; }
.alert-error   { background: var(--bad-bg);  color: var(--bad);  }
.alert-success { background: var(--good-bg); color: var(--good); }
.alert-info    { background: var(--info-bg); color: var(--info); }

/* ==================================================================
   APP SHELL (logged-in pages)
   ================================================================== */
.app { min-height: 100vh; overflow-x: hidden; }   /* no page-wide horizontal scroll (keeps the fixed tab bar in place) */

/* Top bar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h); z-index: 40;
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: var(--navy-grad-bar); color: #fff;
}
.topbar__menu, .topbar__icon {
  background: none; border: none; color: #fff; cursor: pointer;
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
}
.topbar__menu:hover, .topbar__icon:hover { background: rgba(255,255,255,.1); }
.topbar__brand { display: flex; align-items: flex-start; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
/* Drawn ®, matching the sign-in page. The red glyph was an unreadable speck on
   the navy bar; a light tint at this size reads cleanly. */
.brand-reg--bar {
  width: 10px; height: 10px; flex: none;
  margin-left: 3px; margin-top: 1px;
  color: rgba(255,255,255,.75);
  overflow: visible;
}
.topbar__spacer { flex: 1; }

/* Page identity in the bar (back + title + tag), so the page below does not
   spend a whole row on a heading. Opt-in: pages pass a back href to app_head. */
.topbar__back {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 10px; color: #fff;
}
.topbar__back:hover { background: rgba(255,255,255,.1); }
.topbar__back svg { width: 20px; height: 20px; }
.topbar__sep { width: 1px; height: 20px; background: rgba(255,255,255,.22); flex: none; }
.topbar__title {
  min-width: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__tag {
  flex: none; font-size: 12px; font-weight: 700; color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.14); border-radius: 100px; padding: 4px 11px; white-space: nowrap;
}
/* Export buttons in the bar. Coloured to the conventions people already know
   — Acrobat red, Excel green — so they read as exports at a glance instead of
   disappearing into the navy as outlined buttons did. */
.topbar__acts { display: flex; align-items: center; gap: 7px; flex: none; }
.topbar__btn {
  height: 32px; padding: 0 11px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  border: none; color: #fff; font: inherit; font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  transition: filter .15s, opacity .15s;
}
.topbar__btn svg { width: 15px; height: 15px; }
.topbar__btn:hover:not(:disabled) { filter: brightness(1.12); }
.topbar__btn--pdf { background: #c0392b; }
.topbar__btn--xls { background: #1d7145; }
/* On a phone the bar is tight — the colour and icon still carry the meaning. */
@media (max-width: 560px) {
  .topbar__btn-t { display: none; }
  .topbar__btn { padding: 0 9px; }
}
/* On phones the bar is tight: the page title wins, the wordmark steps aside. */
@media (max-width: 899px) {
  .topbar--page .topbar__brand, .topbar--page .topbar__sep { display: none; }
  .topbar--page .topbar__client { display: none; }
}
/* Client name lives here on phones/tablets; on desktop the sidebar shows it. */
.topbar__client {
  min-width: 0; font-size: 13px; font-weight: 600; color: rgba(255,255,255,.85);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__icon { position: relative; }
.badge-dot {
  position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--red); color: #fff; border-radius: 100px; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--navy);
}

/* Sidebar — fully coloured (theme surface), with light nav text. */
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; width: var(--nav-w); z-index: 60;
  background: var(--navy-grad); color: #fff; border-right: none;
  transform: translateX(-100%); transition: transform .22s ease;
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }
.sidebar__head {
  padding: 18px 18px 16px; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 10px;
}
.sidebar__head .avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--red); display: grid; place-items: center; font-weight: 700; }
.sidebar__head .who { font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.sidebar__head .sub { font-size: 11.5px; color: rgba(255,255,255,.62); }
.nav { padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.nav__label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.42); padding: 12px 12px 6px; font-weight: 700; }
.nav__item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px;
  color: rgba(255,255,255,.82); font-size: 14px; font-weight: 500;
}
.nav__item svg { width: 19px; height: 19px; color: rgba(255,255,255,.55); flex: none; }
.nav__item:hover { background: rgba(255,255,255,.09); color: #fff; }
.nav__item:hover svg { color: rgba(255,255,255,.85); }
.nav__item.active { background: rgba(255,255,255,.15); color: #fff; }
.nav__item.active svg { color: var(--red); }
.nav__item .count { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 100px; }

/* Reports — a flyout panel (one arrow on Reports; the reports live in a floating
   card grouped by Mobile App / Accounts / Masters, so there is no arrow clutter). */
.nav__fly-btn { width: 100%; text-align: left; background: none; border: none; font: inherit; cursor: pointer; }
.nav__fly-btn span { flex: 1; min-width: 0; }
.nav__fly-btn.is-on { background: rgba(255,255,255,.09); color: #fff; }
.nav__caret { margin-left: auto; opacity: .5; flex: none; transition: transform .18s ease; }
.nav__fly-btn.is-on .nav__caret { transform: translateX(2px); opacity: .9; }

.nav__fly-panel { position: fixed; z-index: 400; width: 250px; max-height: 76vh; overflow-y: auto;
  background: var(--navy-2); border: 1px solid rgba(255,255,255,.14); border-radius: 14px;
  box-shadow: 0 22px 54px rgba(0,0,0,.55); padding: 8px; display: none; }
.nav__fly-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,.42); font-weight: 700; padding: 11px 10px 4px; }
.nav__fly-title:first-child { padding-top: 4px; }
.nav__flylink { display: block; padding: 9px 11px; border-radius: 9px; color: rgba(255,255,255,.82);
  font-size: 13.5px; font-weight: 500; text-decoration: none; }
.nav__flylink:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav__flylink.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }

/* Flyout — level 1: the three groups */
.fly-group { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none;
  border: none; cursor: pointer; padding: 10px 11px; border-radius: 9px; color: rgba(255,255,255,.85);
  font: inherit; font-size: 13.5px; font-weight: 600; }
.fly-group:hover { background: rgba(255,255,255,.1); color: #fff; }
.fly-group > svg:first-child { color: rgba(255,255,255,.6); flex: none; }
.fly-group .nav__caret { margin-left: 0; opacity: .45; }
.fly-group__t { flex: 1; min-width: 0; }
.fly-group__n { font-size: 11px; font-weight: 700; color: rgba(255,255,255,.5);
  background: rgba(255,255,255,.08); padding: 1px 8px; border-radius: 100px; }
/* Flyout — level 2: header row (back arrow + group name), returns to the group list */
.fly-back { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none;
  border: none; border-bottom: 1px solid rgba(255,255,255,.1); cursor: pointer; margin-bottom: 4px;
  padding: 6px 10px 10px; color: #fff; font: inherit; font-size: 14px; font-weight: 700; }
.fly-back svg { opacity: .6; flex: none; }
.fly-back:hover svg { opacity: 1; }
.fly-view[hidden] { display: none; }

.overlay {
  position: fixed; inset: 0; background: rgba(10,10,18,.5); z-index: 50;
  opacity: 0; visibility: hidden; transition: opacity .2s;
}
.overlay.show { opacity: 1; visibility: visible; }

/* Content */
.content {
  padding: calc(var(--bar-h) + 16px) 16px calc(var(--tab-h) + 20px);
  max-width: 1080px; margin: 0 auto;
}
.content-inner { width: 100%; }
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.page-head p  { font-size: 13px; color: var(--muted); margin-top: 2px; }
/* Standfirst for pages whose heading now lives in the top bar. */
.page-sub { font-size: 13px; color: var(--muted); margin: 0 2px 12px; }

/* Bottom tab bar (mobile) */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--tab-h); z-index: 40;
  background: var(--surface); border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 10.5px; color: var(--muted); font-weight: 500;
}
.tabbar a svg { width: 21px; height: 21px; }
.tabbar a.active { color: var(--red); }

/* Cards */
.card2 {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.acc-cols > .card2 { margin-bottom: 0; }   /* grid gap handles spacing inside */
.card2__head { padding: 16px 18px 0; display: flex; align-items: center; justify-content: space-between; }
.card2__head h2 { font-size: 15px; font-weight: 700; }
.card2__body { padding: 16px 18px; }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 15px 15px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi__icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 10px; }
.kpi__icon svg { width: 18px; height: 18px; }
.kpi__val { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi__label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.i-red   { background: var(--bad-bg);  color: var(--bad);  }
.i-green { background: var(--good-bg); color: var(--good); }
.i-blue  { background: var(--info-bg); color: var(--info); }
.i-amber { background: var(--warn-bg); color: var(--warn); }

/* Chart (hand-drawn SVG) */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--red); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .lbl { fill: var(--muted); font-size: 10px; }
.chart .val { fill: var(--ink); font-size: 9.5px; font-weight: 600; }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 100px; }
.pill--ok   { background: var(--good-bg); color: var(--good); }
.pill--warn { background: var(--warn-bg); color: var(--warn); }
.pill--bad  { background: var(--bad-bg);  color: var(--bad);  }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; background: var(--surface); }
table.data th, table.data td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.data th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; z-index: 3; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:active { background: var(--line-2); }

/* Freeze the first two columns (Salesman, Mobile) during horizontal scroll. */
table.data.freeze2 th:nth-child(1), table.data.freeze2 td:nth-child(1) { position: sticky; left: 0; width: 150px; min-width: 150px; max-width: 150px; }
table.data.freeze2 th:nth-child(2), table.data.freeze2 td:nth-child(2) { position: sticky; left: 150px; width: 120px; min-width: 120px; max-width: 120px; }
table.data.freeze2 td:nth-child(1), table.data.freeze2 td:nth-child(2) { z-index: 2; background: var(--surface); overflow: hidden; text-overflow: ellipsis; }
table.data.freeze2 th:nth-child(1), table.data.freeze2 th:nth-child(2) { z-index: 4; }   /* header corners above everything */
table.data.freeze2 th:nth-child(2), table.data.freeze2 td:nth-child(2) { box-shadow: 3px 0 5px -3px rgba(0,0,0,.18); }   /* freeze-edge shadow */

/* Toolbar (search + export) */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 180px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search input {
  width: 100%; height: 44px; padding: 0 14px 0 38px; border: 1.5px solid var(--line);
  border-radius: 11px; background: var(--surface); color: var(--ink); font-size: 14px; font-family: inherit; outline: none;
}
.search input:focus { border-color: var(--navy); }

/* ── Dashboard: team map (last known position per salesman) ──────────── */
/* Reuses .map-split / .map-card / .timeline from the route map. */
#teamMap {
  height: 380px; width: 100%;
  z-index: 0;                    /* keep Leaflet's panes under the top bar */
}
@media (max-width: 640px) { #teamMap { height: 300px; } }

/* Clickable name list beside the map. */
.tm-item { cursor: pointer; }
.tm-badge { background: var(--red); color: #fff; font-size: 10.5px; letter-spacing: .02em; }

/* Initial-badge pin, so five salesmen are told apart at a glance. */
.tm-pin { background: none; border: none; }
.tm-pin__dot {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--red); color: #fff;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  border: 2.5px solid #fff; box-shadow: 0 3px 10px -2px rgba(0,0,0,.5);
}
.tm-pop { font-size: 12.5px; line-height: 1.5; }
.tm-pop strong { font-size: 13.5px; }
.tm-pop__t { color: var(--muted); }
.tm-pop__a { color: var(--muted); margin-bottom: 4px; }

/* ── Accounts: ledger picker + reports combo (top of page) ───────────── */
.acc-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.acc-tool { flex: 1 1 280px; min-width: 0; }

/* Badge + search as ONE control: the badge names what the box searches, which
   a placeholder alone was not saying. */
.ledger-box {
  display: flex; align-items: stretch; overflow: hidden;
  border: 1.5px solid var(--line); border-radius: 11px; background: var(--surface);
}
.ledger-box:focus-within { border-color: var(--navy); }
.lbl-badge {
  flex: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 0 14px; background: var(--navy-grad-bar); color: #fff;
  font-size: 12.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}
.lbl-badge svg { width: 14px; height: 14px; opacity: .9; }
.ledger-box .search { flex: 1; min-width: 0; }
.ledger-box .search input {
  height: 44px; border: none; border-radius: 0; background: transparent;
}
.ledger-box .search input:focus { border: none; }

/* Solid combo — a control you press, not a field you fill. Built from a button
   + list rather than a <select>, whose list the browser draws itself and will
   not theme. */
.rep-pick { position: relative; flex: 0 0 auto; }
.rep-combo {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; height: 48px; padding: 0 14px 0 18px; cursor: pointer;
  border: none; border-radius: 11px;
  background: var(--navy-grad-bar); color: #fff;
  font-family: inherit; font-size: 13.5px; font-weight: 700; letter-spacing: .02em;
  transition: filter .15s;
}
.rep-combo > span { display: inline-flex; align-items: center; gap: 8px; }
.rep-combo svg { width: 15px; height: 15px; }
.rep-combo .rep-caret { width: 13px; height: 13px; opacity: .85; transition: transform .18s; }
.rep-combo.is-open .rep-caret { transform: rotate(180deg); }
.rep-combo:hover { filter: brightness(1.14); }

.rep-drop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30;
  min-width: 100%; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-s); box-shadow: var(--shadow-lg); padding: 5px;
}
.rep-drop li a {
  display: block; padding: 10px 14px; border-radius: 8px;
  color: var(--ink); font-size: 13.5px; font-weight: 600;
}
.rep-drop li a:hover { background: var(--info-bg); color: var(--navy); }

/* Phones: the badge cost ~110px of ~360px, and with the magnifier and mic the
   typing area was down to a third. The placeholder already says "Search party
   ledger", so the badge is redundant here — drop it and take the width back.
   Both controls go full width; vertical space is the cheap one on a phone. */
@media (max-width: 560px) {
  .acc-tools { gap: 10px; }
  .acc-tool, .rep-pick { flex: 1 1 100%; width: 100%; }
  .lbl-badge { display: none; }
  .rep-drop { left: 0; right: 0; }
}

.party-pick { position: relative; }
.party-drop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  max-height: min(52vh, 380px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-s); box-shadow: var(--shadow-lg);
  padding: 5px;
}
.party-drop li a {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 9px 11px; border-radius: 8px; color: var(--ink);
}
.party-drop li a:hover { background: var(--info-bg); }
.party-pick .party-none {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
  box-shadow: var(--shadow-lg); padding: 14px; margin: 0;
  font-size: 13px; color: var(--muted);
}

/* ── Voice (mic / speak). Rendered by voice.js only where supported ──── */
.mic {
  flex: none; display: grid; place-items: center; cursor: pointer;
  padding: 0; border: none; background: none; color: var(--faint);
  transition: color .15s, background .15s;
}
.mic svg { width: 18px; height: 18px; }
.mic:hover { color: var(--navy); }
.mic.is-live { color: var(--red); animation: micPulse 1s ease-in-out infinite; }
@keyframes micPulse { 50% { opacity: .3; } }

/* Inside a search box. `.search svg` positions the magnifier absolutely, so
   the mic's own icon must opt out of that or it lands on top of it. */
.search .mic {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 8px;
}
.search .mic svg {
  position: static; transform: none; left: auto; top: auto;
  width: 18px; height: 18px; color: inherit;
}
.search.has-mic input { padding-right: 42px; }

/* Beside the date navigator */
.mic--cal {
  width: 40px; height: 40px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--muted);
}
.mic--cal:hover { background: var(--line-2); }

/* Read-this-out, in the ledger card head */
.mic--say { width: 34px; height: 34px; border-radius: 9px; margin-left: 10px; color: var(--muted); }
.mic--say:hover { background: var(--line-2); }
.btn-sm {
  height: 44px; padding: 0 16px; border-radius: 11px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-sm:hover { background: var(--line-2); }
.btn-sm.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-sm svg { width: 16px; height: 16px; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--faint); }

.muted { color: var(--muted); }
.section-gap { height: 16px; }

/* Reports grid (hub) */
.rgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.rtile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.rtile:active { transform: scale(.98); }
.rtile__icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--navy); color: #fff; }
.rtile__icon svg { width: 20px; height: 20px; }
.rtile h3 { font-size: 14px; font-weight: 600; }
.rtile span { font-size: 12px; color: var(--muted); }

/* Notifications */
.note-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.note-item:last-child { border-bottom: none; }
.note-item .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); margin-top: 6px; flex: none; }
.note-item.read .dot { background: var(--line); }
.note-item h4 { font-size: 14px; font-weight: 600; }
.note-item p  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.note-item time { font-size: 11px; color: var(--faint); }

/* Install banner */
.install-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab-h) + 12px); z-index: 45;
  background: var(--navy); color: #fff; border-radius: 14px; padding: 12px 14px;
  display: none; align-items: center; gap: 12px; box-shadow: var(--shadow-lg);
}
.install-banner.show { display: flex; }
.install-banner p { font-size: 13px; flex: 1; }
.install-banner button { border: none; border-radius: 9px; padding: 8px 14px; font-weight: 600; font-size: 13px; cursor: pointer; }
.install-banner .ib-yes { background: var(--red); color: #fff; }
.install-banner .ib-no  { background: transparent; color: #b9bccb; }

/* Offline banner */
.offline-bar {
  position: fixed; top: var(--bar-h); left: 0; right: 0; z-index: 39;
  background: var(--warn); color: #1a1200; text-align: center; font-size: 12.5px; font-weight: 600;
  padding: 6px; display: none;
}
.offline-bar.show { display: block; }

/* ==================================================================
   Desktop
   ================================================================== */
@media (min-width: 900px) {
  .topbar__menu   { display: none; }
  .topbar__client { display: none; }
  .sidebar { transform: translateX(0); box-shadow: none; }
  .overlay { display: none; }
  .tabbar  { display: none; }
  .content { margin-left: var(--nav-w); max-width: none; padding-bottom: 32px; padding-left: 28px; padding-right: 28px; }
  /* Cap the readable width and centre it in the space beside the sidebar, so the
     cards/grids don't over-stretch on wide / ultra-wide monitors. */
  .content-inner { max-width: 1600px; margin-inline: auto; }
  .topbar  { left: var(--nav-w); }
  /* auto-fit: packs as many cards per row as the width allows (5–6 on a
     laptop) instead of forcing exactly 4 and wrapping the 5th. */
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .rgrid   { grid-template-columns: repeat(3, 1fr); }
  .install-banner { left: auto; right: 24px; bottom: 24px; max-width: 380px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ==================================================================
   Date bar, filters, summary/detail toggle, pagination, totals
   ================================================================== */
.date-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.date-bar label { font-size: 13px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.date-bar label svg { width: 15px; height: 15px; }
.date-bar input[type="date"], .date-bar .dp-input {
  height: 44px; border: 1.5px solid var(--line); border-radius: 11px;
  background: var(--surface); color: var(--ink); padding: 0 12px; font-size: 14px; font-family: inherit;
}
.date-bar input[type="date"]:focus, .date-bar .dp-input:focus { border-color: var(--navy); outline: none; }

/* dd/MM/yyyy date control (native picker underneath, styled display on top) */
.datepick {
  position: relative; display: inline-flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 12px; min-width: 156px;
  border: 1.5px solid var(--line); border-radius: 11px; background: var(--surface); cursor: pointer;
}
.datepick:focus-within { border-color: var(--navy); }
.datepick__text { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 500; }
.datepick > svg { width: 16px; height: 16px; color: var(--muted); margin-left: auto; }
.datepick__native {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; border: 0; margin: 0; padding: 0; cursor: pointer;
}
/* Hide the native calendar glyph (we render our own) */
.datepick__native::-webkit-calendar-picker-indicator { opacity: 0; cursor: pointer; }

/* Back button on report pages */
.page-head.with-back { display: flex; align-items: center; gap: 12px; }
.page-head.with-back h1 { margin: 0; }
.back-btn {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
}
.back-btn svg { width: 20px; height: 20px; }
.back-btn:hover { background: var(--line-2); }

/* Clickable KPI cards */
a.kpi { cursor: pointer; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
a.kpi:active { transform: translateY(0); }

/* Date chooser — a plain <select>, so the dd/MM/yyyy format is ours and
   nothing depends on the browser locale. Compact on mobile. */
.date-bar { gap: 8px; margin-bottom: 12px; }
.date-select, .ctl-form select {
  height: 40px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--ink); padding: 0 32px 0 12px; font-size: 14px; font-family: inherit; cursor: pointer;
  font-variant-numeric: tabular-nums;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa1ad' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.date-select:focus, .ctl-form select:focus { border-color: var(--navy); outline: none; }

/* Export buttons moved into the top bar (see .topbar__acts). The old in-page
   .icon-btn / .exp-btns rules are gone: nothing referenced them any more, and
   the #exportPdf id rule out-specified the bar styling. The scripts disable
   these while generating, so keep a disabled state. */
/* The export scripts disable these while generating — keep the feedback. */
.topbar__btn:disabled { opacity: .5; cursor: default; }
.icon-btn svg { width: 18px; height: 18px; }

/* Group row inside the device table (Sales Order Apps / Van Sales Apps).
   Colour-matched to the KPI cards: blue = sales orders, amber = van sales.
   !important because the nth-child zebra striping is more specific. */
table.data tbody tr.grp-row td {
  position: relative;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 9px 10px 8px 20px; white-space: nowrap;
  border-top: 1px solid var(--line);
}
/* Short accent bar, inset from the left/top/bottom (not a full-height edge) */
table.data tbody tr.grp-row td::before {
  content: '';
  position: absolute;
  left: 8px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 2px;
  background: currentColor;
}
table.data tbody tr.grp-row:first-child td { border-top: none; }

table.data tbody tr.grp-row--so td {
  background: var(--info-bg) !important;
  color: var(--info);
}
table.data tbody tr.grp-row--van td {
  background: var(--warn-bg) !important;
  color: var(--warn);
}

/* Dark table header — matches the Tabulator report grids */
table.data thead th {
  background: var(--navy-grad-bar);
  color: rgba(255,255,255,.88);
  text-align: center;
  border-bottom: none;
  border-right: none;
  border-left: 1px solid #fff;   /* white separator, left edge — never trails at the end */
}
table.data thead th:first-child { border-left: none; }

/* Outer grid frame — subtle line, corners clip the dark header */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  overflow: auto;              /* scroll BOTH axes so the sticky header engages */
  max-height: 72vh;            /* becomes a scroll region; short tables don't scroll */
}
table.data thead th:first-child { border-top-left-radius: 7px; }
table.data thead th:last-child  { border-top-right-radius: 7px; }
table.data tbody tr:last-child td { border-bottom: none; }

/* Slim scrollbar. --line was invisible on the dark cards, so the thumb uses
   --faint (brightening to --muted on hover); width added for the vertical bar
   in tall scroll regions like the invoice-items pop-up. */
.table-wrap::-webkit-scrollbar { width: 9px; height: 9px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb {
  background: var(--faint); border-radius: 5px;
  border: 2px solid transparent; background-clip: content-box;
}
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }
.table-wrap { scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }

/* ==================================================================
   Device states: expiring / reset / inactive / expired
   ================================================================== */
.pill--info  { background: var(--info-bg); color: var(--info); }
.pill--muted { background: var(--line-2);  color: var(--faint); }

table.data tbody tr.row-expiring td { background: var(--warn-bg) !important; }
table.data tbody tr.row-reset    td { background: var(--info-bg) !important; }
table.data tbody tr.row-inactive td { background: var(--bad-bg)  !important; }
table.data tbody tr.row-expired  td {
  background: var(--line-2) !important;
  color: var(--faint);
  text-decoration-color: var(--faint);
}
/* Dashboard shows expired apps in red (Devices page greys them instead) */
table.data tbody tr.row-expired-red td { background: var(--bad-bg) !important; color: var(--bad); }
.tag-exp {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 5px;
  background: var(--bad); color: #fff; font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; vertical-align: middle;
}
table.data tbody tr.row-expired td .btn-sm { opacity: .6; }

/* Salesman name -> drill-down */
.sm-link { color: var(--info); font-weight: 600; }
.sm-link:hover { text-decoration: underline; }

/* Salesman day summary strip */
.daystrip {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
@media (min-width: 700px) { .daystrip { grid-template-columns: repeat(5, 1fr); } }
.daystrip > div { display: flex; flex-direction: column; gap: 3px; }
.daystrip span {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--faint);
}
.daystrip strong { font-size: 17px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.daystrip strong.is-bad { color: var(--bad); }
.daystrip__now {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2);
  font-size: 12.5px; color: var(--muted);
}
.daystrip__now svg { flex: none; width: 14px; height: 14px; color: var(--info); }

/* ==================================================================
   Route map + visit timeline
   ================================================================== */
.map-split { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1000px) {
  .map-split { grid-template-columns: 1fr 330px; align-items: start; }
}

.map-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
#routeMap {
  width: 100%;
  height: calc(100vh - 350px);
  min-height: 380px;
  background: var(--line-2);
}

/* Expand button — sits above Leaflet's own controls (they use z-index 1000) */
.map-full {
  position: absolute; top: 10px; right: 10px; z-index: 1001;
  width: 34px; height: 34px; display: grid; place-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  color: #1a1a24; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.map-full:hover { background: #f1f2f6; }
.map-full svg { width: 17px; height: 17px; }
.map-full .ico-shrink { display: none; }
.map-card.is-full .map-full .ico-expand { display: none; }
.map-card.is-full .map-full .ico-shrink { display: block; }

/* Full screen. Two mechanisms, one look:
   1. Fullscreen API — also hides the browser tabs/address bar (biggest view).
   2. Fixed overlay — the fallback for iOS Safari, which won't grant the
      Fullscreen API to ordinary elements. */
.map-card.is-full {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column;
  border: 0; border-radius: 0; box-shadow: none;
  background: var(--surface);
}
.map-card.is-full #routeMap,
.map-card.is-full #teamMap { flex: 1; height: auto; min-height: 0; }
body.map-locked { overflow: hidden; }

/* When the Fullscreen API grants it, the element IS the screen */
.map-card:fullscreen,
.map-card:-webkit-full-screen {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  background: var(--surface);
}
.map-card:fullscreen #routeMap,
.map-card:-webkit-full-screen #routeMap { flex: 1; height: auto; min-height: 0; }
.leaflet-container { font-family: var(--font); }
.leaflet-popup-content { font-size: 12.5px; line-height: 1.5; margin: 10px 12px; }
.leaflet-popup-content strong { color: #1a1a24; }
.leaflet-popup-content em { color: var(--muted); font-style: normal; font-size: 11.5px; }
.leaflet-control-attribution { font-size: 10px; }

/* Numbered stop pin */
.stop-pin { background: none; border: none; }
.stop-pin__num {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  color: #fff; font-size: 12px; font-weight: 700; font-family: var(--font);
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}

.map-legend {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  padding: 11px 14px; border-top: 1px solid var(--line);
  background: var(--surface-2); font-size: 11.5px; color: var(--muted);
}
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend .dot {
  width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.dot-ok    { background: #1f9d57; }
.dot-warn  { background: #c98a12; }
.dot-far   { background: #d8352f; }
.dot-nogeo { background: #9aa1ad; }

/* Visit timeline */
.timeline {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.timeline__head { padding: 13px 15px; border-bottom: 1px solid var(--line); }
.timeline__head h2 { font-size: 14px; font-weight: 700; }
.timeline__head span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.timeline__list {
  list-style: none; margin: 0; padding: 6px;
  max-height: calc(100vh - 430px); min-height: 200px; overflow-y: auto;
}
.tl {
  display: flex; gap: 11px; padding: 9px 9px; border-radius: 10px;
  cursor: pointer; outline: none;
}
.tl:hover, .tl:focus-visible { background: var(--line-2); }
.tl.active { background: var(--info-bg); }
.tl__num {
  flex: none; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  color: #fff; font-size: 11.5px; font-weight: 700;
}
.tl__num.v-ok    { background: #1f9d57; }
.tl__num.v-warn  { background: #c98a12; }
.tl__num.v-far   { background: #d8352f; }
.tl__num.v-nogeo { background: #9aa1ad; }
.tl__body { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.tl__body strong {
  font-size: 13px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl__meta { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl__flag {
  display: inline-block; width: fit-content; margin-top: 2px;
  padding: 1px 7px; border-radius: 5px;
  font-size: 10.5px; font-weight: 700;
}
.tl__flag.bad   { background: var(--bad-bg);  color: var(--bad); }
.tl__flag.warn  { background: var(--warn-bg); color: var(--warn); }
.tl__flag.muted { background: var(--line-2);  color: var(--faint); }

/* In-cell setting dropdown (Auto Upload / Location on the Devices page) */
.cell-select {
  height: 32px; padding: 0 26px 0 9px; font-size: 12.5px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%239aa1ad' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.cell-select:focus { border-color: var(--navy); outline: none; }

/* Legend under the device table */
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; padding: 0 2px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend .sw { width: 12px; height: 12px; border-radius: 4px; border: 1px solid var(--line); }
.sw-expiring { background: var(--warn-bg); }
.sw-reset    { background: var(--info-bg); }
.sw-inactive { background: var(--bad-bg);  }
.sw-expired  { background: var(--line-2);  }

/* Expiry banner (devices page) */
.exp-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--warn-bg); color: var(--warn);
  border-radius: var(--radius-s); padding: 12px 14px; margin-bottom: 14px;
  font-size: 13px; line-height: 1.45;
}
.exp-banner svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.exp-banner strong { font-weight: 700; }
.exp-bad { display: inline-block; margin-left: 8px; color: var(--bad); font-weight: 600; }

/* ==================================================================
   Modal (app-expiry notice at sign-in)
   ================================================================== */
.modal-backdrop {
  /* Above Leaflet. Its map panes sit at 400 and its zoom controls at 1000,
     so anything below that gets painted over by the route map. */
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(12,12,22,.58);
  display: grid; place-items: center; padding: 20px;
}
/* display:grid above out-specifies the [hidden] UA rule, so toggled
   backdrops (e.g. the invoice-items pop-up) must be hidden explicitly. */
.modal-backdrop[hidden] { display: none; }
.modal {
  width: 100%; max-width: 420px;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: modalIn .22s cubic-bezier(.2,.75,.2,1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.modal__head h2 { display: flex; align-items: center; gap: 8px; font-size: 15.5px; font-weight: 700; }
.modal__head svg { width: 18px; height: 18px; color: var(--warn); }
.modal__x {
  margin-left: auto; background: none; border: none; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--faint); padding: 0 4px;
}
.modal__x:hover { color: var(--ink); }
.modal__body { padding: 16px 18px; }
.modal__foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 18px 16px; border-top: 1px solid var(--line-2);
}

/* Confirm dialog */
.modal--sm { max-width: 380px; }
.modal--sm .modal__head h2 { font-size: 15px; }
.confirm__msg { font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.btn-sm.danger {
  background: var(--bad); color: #fff; border-color: var(--bad);
}
.btn-sm.danger:hover { filter: brightness(1.08); background: var(--bad); }

.exp-list { list-style: none; display: grid; gap: 8px; margin-bottom: 14px; }
.exp-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--warn-bg); color: var(--warn);
  border-radius: 9px; padding: 9px 12px; font-size: 13px; font-weight: 600;
}
.exp-detail { display: grid; gap: 6px; }
.exp-detail div {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 12.5px; color: var(--muted);
  padding: 5px 2px; border-bottom: 1px dashed var(--line-2);
}
.exp-detail em { font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.exp-expired {
  margin-top: 12px; padding: 9px 12px; border-radius: 9px;
  background: var(--bad-bg); color: var(--bad); font-size: 13px; font-weight: 600;
}

/* One control row: date · filters · summary/details · search
   Margins kept tight — every px here is a px of grid. */
.ctl-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.page-head.with-back { margin-bottom: 12px; }
.ctl-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; }
.ctl-row .search { flex: 1 1 200px; min-width: 170px; }
.ctl-row .search input { height: 40px; border-radius: 10px; }
.ctl-row .seg { height: 40px; border-radius: 10px; }
.ctl-row .seg a { height: 100%; padding: 0 14px; font-size: 13px; }

/* Compact 2-row KPI card: [icon + label] then a centred value */
.kpi { padding: 12px 12px 13px; }
.kpi__top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.kpi__icon { width: 26px; height: 26px; border-radius: 8px; margin-bottom: 0; flex: none; }
.kpi__icon svg { width: 15px; height: 15px; }
.kpi__label { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 0; line-height: 1.2; }
.kpi__val { font-size: 24px; text-align: center; margin-top: 2px; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-bar select {
  height: 44px; border: 1.5px solid var(--line); border-radius: 11px; background: var(--surface);
  color: var(--ink); padding: 0 34px 0 12px; font-size: 13.5px; font-family: inherit; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa1ad' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.filter-bar select:focus { border-color: var(--navy); outline: none; }

.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 11px; overflow: hidden; }
.seg a { padding: 0 16px; height: 44px; display: flex; align-items: center; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.seg a.on { background: var(--navy); color: #fff; }

/* Alternate row colour.
   Plain tables stripe with :nth-child. Grouped and paginated tables set an
   explicit .alt class instead, because group headers / hidden rows would
   otherwise break the odd-even parity. */
table.data:not(.paginate):not(.grouped) tbody tr:nth-child(even) td { background: var(--line-2); }
table.data tbody tr.alt td { background: var(--line-2); }

/* Totals row */
table.data tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: var(--surface-2); white-space: nowrap; }
table.data tfoot td.tfoot-label { color: var(--muted); }
table.data tfoot td.tfoot-val { color: var(--ink); }

/* Location cell wraps */
table.data td.loc { white-space: normal; max-width: 240px; min-width: 160px; font-size: 12px; color: var(--muted); word-break: break-word; line-height: 1.4; }
table.data td.loc .loc-text { display: block; }
.maplink {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 4px;
  font-size: 11.5px; font-weight: 600; color: var(--info); white-space: nowrap;
}
.maplink svg { width: 13px; height: 13px; }
.maplink:hover { text-decoration: underline; }

/* Pager */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px 10px 4px; flex-wrap: wrap; }
.pager:empty { display: none; }   /* single page -> no empty padded strip */
.pager__btn {
  height: 38px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.pager__btn:hover:not(:disabled) { background: var(--line-2); }
.pager__btn:disabled { opacity: .45; cursor: default; }
.pager__info { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ==================================================================
   Login polish
   ================================================================== */
/* Login — same navy as the app shell (top bar / sidebar), red accent. */
.auth-body {
  display: block;                /* split layout handles its own centring */
  padding: 0;
  background:
    radial-gradient(1000px 560px at 20% -10%, #24243e 0%, rgba(26,26,46,0) 62%),
    radial-gradient(900px 620px at 90% 110%, #273069 0%, rgba(26,26,46,0) 60%),
    var(--navy);
}
.auth-body::before {
  display: block;
  background: radial-gradient(ellipse 70% 55% at 12% 18%, rgba(226,75,74,.13) 0%, transparent 62%);
}

/* ---------- split: brand panel | sign-in ---------- */
.auth-split { position: relative; z-index: 1; min-height: 100vh; }

/* Brand mark: the Atease web icon + the ATEASE(R) wordmark.
   NOTE: these sit on the DARK panel, so the text must be light — the earlier
   dark values (meant for the white card) made it invisible. */
.brand-mark { display: inline-flex; align-items: center; gap: 15px; }
.brand-mark__icon {
  width: 58px; height: 58px; border-radius: 15px; display: block;
  box-shadow: 0 14px 30px -12px rgba(0,0,0,.55);
}
.auth-body .brand-title {
  font-size: 31px; font-weight: 700; color: #fff;
  letter-spacing: .01em; line-height: 1;
}
/* The ® font glyph renders as a sub-pixel smudge at this size no matter the
   colour or size, so it's drawn as an SVG instead: a real circle + a real "R",
   which stay crisp at any scale. */
.auth-body .brand-title {
  display: inline-flex;
  align-items: flex-start;
}
.brand-reg {
  width: 17px; height: 17px;
  flex: none;
  margin-left: 5px; margin-top: 1px;
  color: #fff;
  overflow: visible;
}
.auth-body .brand-tagline {
  font-size: 13.5px; color: rgba(255,255,255,.62); margin-top: 6px; letter-spacing: .01em;
}

.auth-lede {
  font-size: 27px; font-weight: 700; color: #fff;
  letter-spacing: -.02em; line-height: 1.3; max-width: 20ch;
}
.auth-feats { list-style: none; display: grid; gap: 11px; margin-top: 22px; }
.auth-feats li {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,.8); font-size: 14px;
}
.auth-feats svg { flex: none; width: 17px; height: 17px; color: var(--red); }

.auth-contacts { margin-top: 30px; }   /* was crowding the feature list */
.auth-contacts__label {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em;
  color: rgba(255,255,255,.5); margin-bottom: 10px;
}
.auth-trust {
  margin-top: 24px; font-size: 12px; color: rgba(255,255,255,.38); letter-spacing: .01em;
}
.auth-contacts__row { display: flex; flex-wrap: wrap; gap: 9px; }
.auth-contact {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 9px 13px; border-radius: 11px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  color: #fff; font-size: 13px; transition: background .15s, border-color .15s;
}
.auth-contact:hover { background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.24); }
.auth-contact svg { flex: none; }
.auth-contact span { display: flex; flex-direction: column; line-height: 1.25; }
.auth-contact em {
  font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: rgba(255,255,255,.45);
}
.auth-contact.wa {
  background: rgba(37,211,102,.13); border-color: rgba(37,211,102,.32); color: #4ee08a;
}
.auth-contact.wa:hover { background: rgba(37,211,102,.2); border-color: rgba(37,211,102,.5); }
.auth-contact.wa em { color: rgba(78,224,138,.6); }

/* ---------- right column ---------- */
.announce {
  width: 100%; max-width: 420px;
  display: flex; align-items: flex-start; gap: 9px;
  padding: 10px 13px; border-radius: 12px;
  background: rgba(226,75,74,.12); border: 1px solid rgba(226,75,74,.3);
  color: #f7d5d4; font-size: 12.5px; line-height: 1.45;
}
.announce svg { flex: none; margin-top: 1px; color: var(--red); }

.install-cta {
  display: none; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 11px; cursor: pointer; font-family: inherit;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.15);
  color: #fff; font-size: 13.5px; font-weight: 600;
}
.install-cta.show { display: inline-flex; }
.install-cta:hover { background: rgba(255,255,255,.14); }

/* Install toast — slides up when the browser offers installation */
.toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 95;
  transform: translate(-50%, 160%); opacity: 0;
  display: flex; align-items: center; gap: 11px;
  width: calc(100% - 32px); max-width: 430px;
  padding: 11px 11px 11px 13px; border-radius: 14px;
  background: #fff; box-shadow: 0 22px 50px -18px rgba(0,0,0,.6);
  transition: transform .34s cubic-bezier(.2,.75,.2,1), opacity .3s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast__icon img { display: block; width: 38px; height: 38px; border-radius: 9px; }
.toast__body { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.toast__body strong { font-size: 13.5px; font-weight: 700; color: #1e1e2e; }
.toast__body span { font-size: 12px; color: #6b7280; }
.toast__btn {
  margin-left: auto; flex: none; padding: 9px 15px; border-radius: 9px; border: none;
  background: var(--navy); color: #fff; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.toast__btn:hover { background: var(--navy-2); }
.toast__x {
  flex: none; background: none; border: none; cursor: pointer;
  color: #b0b7c3; font-size: 20px; line-height: 1; padding: 0 2px;
}
.toast__x:hover { color: #1e1e2e; }

.auth-links { font-size: 12px; color: rgba(255,255,255,.4); text-align: center; }
.auth-links a { color: rgba(255,255,255,.68); }
.auth-links a:hover { color: #fff; text-decoration: underline; }
.auth-links span { margin: 0 6px; }

/* ---------- desktop: two columns ---------- */
@media (min-width: 960px) {
  .auth-split { display: grid; grid-template-columns: 1.05fr .95fr; }
  .auth-brand {
    display: flex; flex-direction: column; justify-content: center; gap: 34px;
    padding: 56px 24px 56px 6vw;
  }
  .auth-main {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; padding: 48px 6vw 48px 24px;
  }
}

/* ---------- mobile: brand on top, contacts below the card ---------- */
@media (max-width: 959px) {
  .auth-split {
    display: flex; flex-direction: column; align-items: center;
    gap: 14px; padding: 26px 18px 36px;
  }
  .auth-brand { display: contents; }            /* lets us reorder its children */
  .auth-brand__head { order: 1; text-align: center; }
  .auth-main {
    order: 2; width: 100%;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
  }
  .auth-brand__body { order: 3; width: 100%; max-width: 420px; }

  /* The pitch is for first-timers on a big screen — on a phone the form wins. */
  .auth-lede, .auth-feats { display: none; }
  .auth-contacts { margin-top: 4px; }
  .auth-contacts__label { text-align: center; }
  .auth-contacts__row { justify-content: center; }
  .auth-trust { text-align: center; margin-top: 16px; }
  .brand-mark { gap: 12px; }
  .brand-mark__icon { width: 48px; height: 48px; border-radius: 13px; }
  .auth-body .brand-title { font-size: 26px; }
  .brand-reg { width: 15px; height: 15px; margin-left: 4px; }
  .auth-body .brand-tagline { font-size: 12.5px; margin-top: 4px; }
}

.login-card {
  background: #fff;
  border: 1px solid #ecedf4;
  border-radius: 22px;
  box-shadow: 0 26px 64px -26px rgba(45,38,95,.38), 0 2px 6px rgba(20,20,40,.05);
  animation: cardIn .5s cubic-bezier(.2,.75,.2,1) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }

.auth-body .card-body { padding: 30px 28px 22px; text-align: center; }

.brand-title { font-size: 25px; font-weight: 700; letter-spacing: -.01em; color: #1e1e2e; line-height: 1.1; }
.brand-title sup { color: #e24b4a; font-size: .5em; top: -.85em; margin-left: 2px; }
.brand-tagline { font-size: 13px; color: #8b90a0; margin-top: 5px; }

.auth-heading { font-size: 16px; font-weight: 600; color: #1e1e2e; margin-top: 16px; }
.auth-sub { font-size: 12.5px; color: #9298a8; margin-top: 3px; }

/* Form (left-aligned inside the centred card) */
.login-card form { text-align: left; margin-top: 18px; }
.auth-body .alert { margin-top: 14px; margin-bottom: 0; padding: 9px 12px; font-size: 12.5px; }
.auth-body .field { margin-bottom: .8rem; }
.auth-body .field label { color: #4b5563; text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; margin-bottom: 5px; }
.auth-body .field input {
  height: 46px;
  /* Declared explicitly (not inherited from .field input) so the text and the
     caret always start after the leading icon, never on the border. */
  padding: 0 14px 0 42px;
  text-indent: 0;
  caret-color: #1a1a2e;
  border: 1.5px solid #e6e8ef; border-radius: 12px; background: #f7f8fb;
  font-size: 14px; color: #1e1e2e; transition: border-color .15s, box-shadow .15s, background .15s;
}
/* Password field: keep room on the right for the show/hide eye */
.auth-body .field .input-wrap input[type="password"],
.auth-body .field .input-wrap input[type="text"] { padding-right: 42px; }
.auth-body .field input:focus { border-color: #1a1a2e; background: #fff; box-shadow: 0 0 0 4px rgba(26,26,46,.10); }
.auth-body .input-wrap > svg { color: #a3a8b8; }
.auth-body .pw-toggle { color: #a3a8b8; }
.auth-body .row-between { margin: -.1rem 0 .85rem; }

/* Remember me */
.remember {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500; color: #4b5563; cursor: pointer; user-select: none;
}
.remember input {
  width: 15px; height: 15px; margin: 0; cursor: pointer;
  accent-color: #1a1a2e;
}

/* Caps Lock warning */
.caps-warn {
  display: none; align-items: center; gap: 5px;
  margin-top: 6px; font-size: 11.5px; font-weight: 600; color: #b9791c;
}
.caps-warn.show { display: flex; }
.caps-warn::before { content: '\26A0'; font-size: 12px; }   /* ⚠ */

.auth-body .btn {
  height: 48px; border-radius: 12px; font-size: 14.5px; letter-spacing: .01em; margin-top: 0;
  background: linear-gradient(135deg, #2a2a4c 0%, #1a1a2e 100%);
  box-shadow: 0 12px 26px -10px rgba(20,20,46,.55);
}
.auth-body .btn:hover { background: linear-gradient(135deg, #34345c 0%, #22223c 100%); }

.auth-body .link, .auth-body .card-foot-link a { color: #c0392b; }
.auth-body .card-footer {
  border-top: 1px solid #f0f1f6; color: #aeb3c2;
  padding: 12px 28px 14px; font-size: 11px;
}
.auth-body .card-foot-link { margin-top: 16px; font-size: 12px; }

/* ── Dashboard: date navigator ─────────────────────────────────────────── */
.date-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
/* Vertical day stepper: half the width of a normal button, split into an
   up (previous day) and down (next day) half — saves the second side button. */
.date-stepper {
  flex: none; display: flex; flex-direction: column;
  width: 30px; height: 40px; overflow: hidden;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface);
}
.date-step {
  flex: 1; display: grid; place-items: center;
  background: var(--surface); color: var(--ink);
}
.date-step svg { width: 14px; height: 14px; }
.date-step--up { border-bottom: 1px solid var(--line); }
.date-step:hover { background: var(--line-2); }
.date-step.is-off { opacity: .3; pointer-events: none; }
.date-nav__full {
  font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px;
}
.chip-today {
  margin-left: auto; flex: none; height: 40px; padding: 0 14px;
  display: inline-flex; align-items: center;
  border-radius: 10px; background: var(--navy); color: #fff;
  font-size: 13px; font-weight: 600;
}
.chip-today:hover { opacity: .9; }

/* ── Dashboard: what-needs-attention strip ─────────────────────────────── */
.alert-strip {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-bottom: 14px; padding: 10px 13px;
  border: 1px solid var(--line); border-left: 3px solid var(--warn);
  border-radius: var(--radius-s); background: var(--surface);
  font-size: 13px; line-height: 1.45; box-shadow: var(--shadow);
}
.alert-strip__item.is-warn { color: var(--ink); font-weight: 600; }
.alert-strip__item.is-bad  { color: var(--bad); font-weight: 600; }
.alert-strip__dot  { color: var(--muted); }
.alert-strip__more {
  margin-left: auto; font-size: 12px; font-weight: 600; color: var(--navy);
  text-decoration: underline; text-underline-offset: 2px;
}

/* ── Dashboard: KPI comparison line ────────────────────────────────────── */
.kpi__delta {
  display: block; margin-top: 5px; text-align: center;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.kpi__delta em  { font-style: normal; font-weight: 500; color: var(--muted); }
.kpi__delta.up   { color: var(--good); }
.kpi__delta.down { color: var(--bad); }
.kpi__delta.flat { color: var(--muted); font-weight: 500; }
/* Sales-return sub-line — light grey, sits under the value. */
.kpi__rtn { display: block; margin-top: 3px; text-align: center;
  font-size: 11px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
/* Day collection line — money in, so a green tint. */
.kpi__coll { display: block; margin-top: 4px; text-align: center;
  font-size: 12px; font-weight: 700; color: var(--good, #1f9d57); font-variant-numeric: tabular-nums; }
/* ── Accounts dashboard ───────────────────────────────────────────────── */
/* Header on one line with the FY / data-as-of meta. */
.acc-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.acc-head h1 { margin: 0; }
.acc-meta { font-size: 13px; color: var(--muted); font-weight: 600; }
/* Equal spacing between the stacked blocks. */
.date-nav { margin-bottom: 16px; }
/* …but inside a report/map control row it sits inline with the other
   controls, so drop the margin that would push it out of alignment. */
.ctl-row .date-nav { margin-bottom: 0; }

.mbars { display: flex; align-items: flex-end; gap: 10px; }
.mbar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; }
.mbar:hover .mbar__lbl { color: var(--navy); }
.mbar__g { font-size: 10px; font-weight: 700; }
.mbar__g.up   { color: var(--good); }
.mbar__g.down { color: var(--bad); }
.mbar__g.mut  { color: var(--faint); }
.mbar__pair { display: flex; align-items: flex-end; gap: 3px; height: 130px; }
.mbar__track { width: 13px; height: 100%; display: flex; align-items: flex-end;
  background: var(--line-2); border-radius: 5px 5px 0 0; overflow: hidden; }
.mbar__fill { width: 100%; border-radius: 5px 5px 0 0; min-height: 2px; }
.mbar__fill--cur  { background: linear-gradient(180deg, var(--navy), #33335a); }
.mbar__fill--prev { background: #c7ccda; }
.mbar__fill--coll { background: linear-gradient(180deg, #1f9d57, #2bb56a); }
/* Current month: striped = projected, solid bottom = actual so far. */
.mbar__fill--proj { display: flex; align-items: flex-end;
  background: repeating-linear-gradient(45deg, #b9bfd4 0 5px, #cfd4e2 5px 10px); }
.mbar__actual { width: 100%; background: linear-gradient(180deg, var(--navy), #33335a); border-radius: 0 0 5px 5px; }
.mbar__lbl { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.mbar__g sup { font-size: 8px; }
.mbar__note { margin-top: 12px; font-size: 11.5px; color: var(--muted); text-align: center; }
.mbar__note-k { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle;
  background: repeating-linear-gradient(45deg, #b9bfd4 0 3px, #cfd4e2 3px 6px); }
.lg-key { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: middle; }
.lg-key--cur  { background: var(--navy); }
.lg-key--prev { background: #c7ccda; }
.lg-key--coll { background: #1f9d57; }

/* Week-wise drill-down pop-up: this year vs last year, a few centred bars. */
.modal--days { max-width: 560px; }
.modal--days .modal__head h2 span { font-size: 14px; font-weight: 700; }
.mbars--wk { justify-content: center; align-items: flex-end; gap: 18px; padding-top: 12px; }
.mbars--wk .mbar { flex: 0 1 84px; cursor: default; }
.mbars--wk .mbar__pair { height: 170px; gap: 5px; }
.mbars--wk .mbar__track { width: 22px; background: transparent; }   /* no faint "remaining" column */
.mbars--wk .mbar__lbl { font-size: 12px; }
.wk-amt { font-size: 12.5px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 1px; }

.acc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
@media (max-width: 640px) { .acc-cols { grid-template-columns: 1fr; } }
/* Let each card shrink to its track (nowrap tables otherwise blow the grid
   past the viewport and push the right card off-screen). */
.acc-cols > * { min-width: 0; }
.acc-cols > .card2 { overflow: hidden; }   /* clip striped rows to rounded corners */
.card2__body.pad0 { padding: 0; }
.os-tbl .cum { color: var(--muted); }

/* Ranked party list — flex, so it never overflows and stacks on mobile. */
.prank { list-style: none; margin: 0; padding: 0; }
.prank__row { display: flex; align-items: center; gap: 10px; padding: 11px 16px; color: inherit; }
.prank li:nth-child(even) .prank__row { background: var(--line-2); }
.prank li:active .prank__row { background: var(--line); }
.prank__name { flex: 1 1 auto; min-width: 0; font-weight: 600; color: var(--info);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prank__place { color: var(--faint); font-weight: 500; font-size: .85em; }
.prank__place::before { content: '· '; }
.prank__meta { flex: none; display: flex; align-items: center; gap: 10px; }
.prank__amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.agebadge { padding: 1px 7px; border-radius: 100px; font-size: 10.5px; font-weight: 700;
  background: var(--line-2); color: var(--muted); white-space: nowrap; }
.agebadge.warn { background: var(--warn-bg); color: var(--warn); }
.agebadge.bad  { background: var(--bad-bg);  color: var(--bad); }

@media (max-width: 620px) {
  /* Two rows: full name on top (wraps, never scrolls), figures beneath. */
  .prank__row { flex-direction: column; align-items: stretch; gap: 4px; }
  .prank__name { white-space: normal; }
  .prank__meta { justify-content: flex-end; }

  /* Smaller KPI cards so four fit without the page needing to scroll. */
  .kpi-grid { gap: 10px; }
  .kpi { padding: 10px 11px 11px; }
  .kpi__val { font-size: 20px; }
  .kpi__delta { font-size: 10px; line-height: 1.35; }
  .kpi__delta em { color: var(--faint); }
}

/* Month-wise sales table */
.mw-tbl th.num, .mw-tbl td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mw-tbl td:first-child, .mw-tbl th:first-child { padding-left: 16px; }
.mw-tbl td.num:last-child, .mw-tbl th.num:last-child { padding-right: 16px; }
.mw-so { font-size: 10px; font-weight: 700; color: var(--faint); }
.gbadge sup { font-size: 8px; }

/* Subscription gate (Accounts locked) */
.gate { max-width: 560px; margin: 8px auto; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 30px 24px 26px; }
.gate__lock { width: 56px; height: 56px; margin: 0 auto 14px; display: grid; place-items: center;
  border-radius: 16px; background: var(--warn-bg); color: var(--warn); }
.gate h2 { font-size: 20px; margin-bottom: 8px; }
.gate__msg { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: 22px; }
.gate__grid { display: grid; gap: 10px; text-align: left; margin-bottom: 24px; }
.gate__feat { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; }
.gate__ic { flex: none; width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 9px; background: var(--info-bg); color: var(--info); }
.gate__feat strong { display: block; font-size: 14px; }
.gate__feat span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.gate__cta { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.gate__btn { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px;
  border-radius: 12px; background: #25d366; color: #fff; font-size: 14.5px; font-weight: 600; }
.gate__btn--ghost { background: var(--surface); border: 1.5px solid var(--line); color: var(--ink); }

/* Full-screen portal block (everything lapsed past grace) */
.block-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(120% 120% at 80% 0%, #2c2c54, #1a1a2e 60%); }
.block-card { width: 100%; max-width: 460px; background: #fff; border-radius: 18px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); padding: 32px 28px; text-align: center; }
.block-card h1 { font-size: 22px; margin-bottom: 10px; }
.block-card > p { font-size: 14px; color: #5c6473; line-height: 1.6; margin-bottom: 20px; }
.block-list { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 8px; text-align: left; }
.block-list li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: #5c6473;
  padding: 10px 12px; background: #f6f7fb; border-radius: 10px; }
.block-list li svg { color: #c0392b; flex: none; }
.block-cta { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.block-out { display: inline-block; font-size: 13px; color: #8b93a3; }
.block-out:hover { color: #1c1e26; }

/* Growth badge */
.gbadge { display: inline-block; padding: 1px 6px; border-radius: 100px; font-size: 10.5px; font-weight: 700; }
.gbadge.up   { background: var(--good-bg); color: var(--good); }
.gbadge.down { background: var(--bad-bg);  color: var(--bad); }
.gbadge.new  { background: var(--info-bg); color: var(--info); }

/* Non-performing + outstanding tables */
.np-tbl th, .np-tbl td, .os-tbl th, .os-tbl td { white-space: nowrap; }
.np-tbl td:first-child, .os-tbl td:first-child { white-space: normal; }
.np-days { font-size: 11px; color: var(--faint); font-weight: 700; }
.age-warn { color: var(--warn); font-weight: 700; }
.age-bad  { color: var(--bad);  font-weight: 700; }

/* Ledger vs outstanding mismatch notice */
/* Toast: confirms the outstanding message was copied for pasting into WhatsApp. */
.wa-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 12px);
  z-index: 3000; max-width: min(90vw, 420px);
  background: #1a1a2e; color: #fff; padding: 12px 16px; border-radius: 12px;
  font-size: 13px; line-height: 1.45; box-shadow: 0 12px 30px -8px rgba(0,0,0,.5);
  opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none;
}
.wa-toast.show { opacity: 1; transform: translate(-50%, 0); }

.os-diff { margin: 0 16px 12px; padding: 9px 12px; border-radius: 10px;
  background: var(--warn-bg); border: 1px solid var(--warn);
  font-size: 12.5px; font-weight: 600; color: var(--warn); }
.os-diff strong { color: var(--warn); }
.os-diff span { font-weight: 500; color: var(--muted); }
.os-diff--solo { margin: 12px 0; }
.os-diff--info { background: var(--info-bg); border-color: var(--info); color: var(--info); }
.os-diff--info strong { color: var(--info); }

.acc-cta { margin-bottom: 8px; }
.acc-cta--2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .acc-cta--2 { grid-template-columns: 1fr; } }

/* Routewise sales pivot: many month columns → horizontal scroll, with the
   party column frozen on the left so you never lose the row label. */
.rp-tbl { min-width: 640px; }
.rp-tbl th.num, .rp-tbl td.num { white-space: nowrap; }
.rp-tbl th.rp-party, .rp-tbl td.rp-party {
  position: sticky; left: 0; z-index: 1; text-align: left; white-space: normal;
  min-width: 150px; max-width: 220px; background: var(--surface);
}
.rp-tbl thead th.rp-party { background: var(--navy); z-index: 4; }   /* sticky top AND left */
.rp-tbl .rp-tot  { font-weight: 700; }
.rp-zero { color: var(--faint); }
.rp-cnt  { color: var(--faint); font-weight: 500; }
.rp-tbl td.num { vertical-align: top; }
/* Group rows force white-space:nowrap on every cell — but a long hyphenated route
   name in the sticky party column then rides over the Op. Bal column. Let that one
   cell wrap so the name stays inside its width. */
.rp-tbl tbody tr.grp-row td.rp-party { white-space: normal; overflow-wrap: anywhere; }

/* On a phone the fixed party column crowds the figures and clips long names.
   Release the LEFT sticking so the whole row — party name included — scrolls
   together and the full name is readable; the header row still sticks to the
   top. (Routewise, Outstanding and Party-balances all share .rp-tbl.) */
@media (max-width: 720px) {
  .rp-tbl th.rp-party, .rp-tbl td.rp-party { left: auto; max-width: none; white-space: nowrap; }
  .rp-tbl tbody td.rp-party { position: static; }
  /* On mobile the whole row scrolls, so keep the route name on one line too. */
  .rp-tbl tbody tr.grp-row td.rp-party { white-space: nowrap; }
}

/* Collapsible route bands: caret + pointer, parties hidden until expanded. */
.rp-route { cursor: pointer; }
.rp-caret { display: inline-block; margin-right: 6px; font-size: 9px; color: var(--info);
  transition: transform .15s ease; }
.rp-route.open .rp-caret { transform: rotate(90deg); }

/* Outstanding page: party rows open a bills pop-up. */
.os-party { cursor: pointer; }
.os-party:hover td { background: var(--info-bg); }
.os-caret { display: inline-block; margin-right: 6px; font-size: 9px; color: var(--info); }

/* Party-balances (movement) report: filter bar + wide grid. */
.mv-filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.mv-f { display: flex; flex-direction: column; gap: 4px; }
.mv-f label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.mv-f input[type="date"], .mv-f .dp-input, .mv-f select {
  height: 40px; padding: 0 10px; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px;
}
.mv-f input[type="date"]:focus, .mv-f .dp-input:focus, .mv-f select:focus { outline: none; border-color: var(--navy); }
.mv-f--search { flex: 1 1 200px; min-width: 180px; }
.mv-f--search .search { flex: 1; }
.mv-f--chk { justify-content: flex-end; }
.mv-chk { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; white-space: nowrap; }
.mv-chk input { width: 16px; height: 16px; accent-color: var(--navy); cursor: pointer; }
.mv-tbl td, .mv-tbl th { white-space: nowrap; }

/* Routewise pager — routes per page, so the grid never grows long enough to
   lose your place when you come back from a party ledger. */
.rp-pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 2px 0; }
.rp-pager:empty { display: none; }
.rp-pg {
  min-width: 34px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.rp-pg:hover:not(:disabled) { border-color: var(--faint); }
.rp-pg.is-on { background: var(--navy-grad-bar); color: #fff; border-color: transparent; }
.rp-pg:disabled { opacity: .45; cursor: default; }
.rp-pg-info { margin-left: auto; font-size: 12px; color: var(--muted); }
@media (max-width: 560px) { .rp-pg-info { margin-left: 0; width: 100%; } }
.rp-tbl thead th .rp-asof { display: block; font-size: 9px; font-weight: 500;
  color: rgba(255,255,255,.65); text-transform: none; letter-spacing: 0; margin-top: 1px; }

/* Stacked cell: this year on top, last year beneath (muted). */
.rp-cur { display: block; }
.rp-pv  { display: block; font-size: 10.5px; font-weight: 500; color: var(--faint); margin-top: 1px; }

/* Route summary band: accent bar on the first cell only; keep the group
   colour on every cell so the whole row reads as one band (like the
   salesman header on the Sales Order Report). */
.rp-tbl .grp-row td::before { display: none; }
.rp-tbl .grp-row td { background: var(--info-bg) !important; }
.rp-tbl .grp-row td.rp-party::before { display: block; }
.rp-tbl .grp-row td.num { text-transform: none; letter-spacing: 0; font-size: 12.5px;
  color: var(--info); padding-left: 8px; padding-right: 8px; }
.rp-tbl .grp-row .rp-cur { font-weight: 700; }
.rp-tbl .grp-row .rp-pv  { color: #5b7cba; font-weight: 600; }

.rp-tbl tfoot .tot-row td.rp-party { background: var(--line-2); }

/* Legend under the report */
.rp-note { margin-top: 10px; font-size: 12px; color: var(--muted); }
/* Counter-sales note — its own line, a touch stronger than the legend. */
.rp-counter { font-size: 12.5px; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; }
.rp-counter .up { color: var(--ok, #1f9d57); font-weight: 700; }
.rp-counter .down { color: var(--red); font-weight: 700; }
.rp-counter .rp-cnote { color: var(--muted); font-weight: 400; }
.rp-cur-key, .rp-pv-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
.rp-cur-key { background: var(--navy); }
.rp-pv-key  { background: var(--faint); }
.btn-wide { display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-size: 14px; font-weight: 600; color: var(--ink); }
.btn-wide:hover { background: var(--line-2); }
.btn-wide svg { width: 16px; height: 16px; }

.fy-tag { margin-left: auto; align-self: center; font-size: 12.5px; font-weight: 700; color: var(--muted);
  background: var(--line-2); border-radius: 100px; padding: 5px 12px; }
.upd { font-size: 12px; color: var(--faint); font-weight: 600; }
/* Compact "Change party" button that sits inline with the date picker. */
.chip-change { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 600; }
.chip-change:hover { background: var(--line-2); }
.chip-change svg { width: 15px; height: 15px; color: var(--muted); }

/* Graph chip — own accent so it stands apart from Change party. */
.chip-graph { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px;
  border: 1.5px solid #6c4bd6; border-radius: 10px; background: #efeaff; color: #4a30ad;
  font-size: 13px; font-weight: 600; cursor: pointer; }
.chip-graph:hover { background: #e4dcff; }
.chip-graph svg { width: 15px; height: 15px; color: #6c4bd6; }

/* Ledger from-date picker */
.from-pick { display: inline-flex; align-items: center; gap: 7px; margin: 0; height: 40px;
  padding: 0 6px 0 12px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); }
.from-pick label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.from-pick input[type="date"], .from-pick .dp-input { height: 30px; border: none; background: transparent; color: var(--ink);
  font: inherit; font-size: 13px; width: auto; min-width: 150px; cursor: pointer; }
.from-pick input[type="date"]:focus, .from-pick .dp-input:focus { outline: none; }

/* ---- Custom date picker (transforms every native <input type=date>) ---- */
.dp-input { cursor: pointer; }
.dp-pop { position: absolute; z-index: 9000; width: 280px; padding: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dp-title { font-size: 14px; font-weight: 700; cursor: pointer; border-radius: 6px; padding: 2px 8px; color: var(--ink); }
.dp-title:hover { background: var(--line-2); }
.dp-nav { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink);
  font-size: 18px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dp-nav:hover { background: var(--line-2); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-dow { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--faint); padding: 4px 0; }
.dp-day { position: relative; display: grid; place-items: center; height: 34px; border-radius: 8px; border: none; background: none;
  cursor: pointer; font-size: 13px; color: var(--ink); font-family: inherit; }
.dp-day:hover:not([disabled]) { background: var(--line-2); }
.dp-day[disabled] { opacity: .3; cursor: default; }
.dp-day.sel { background: var(--navy); color: #fff; font-weight: 700; }
.dp-day.today::after { content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--good); }
.dp-day.sel.today::after { background: #fff; }
.dp-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px 2px; }
.dp-mon { padding: 11px 0; border: none; background: none; border-radius: 8px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink); }
.dp-mon:hover { background: var(--line-2); }
.dp-mon.sel { background: var(--navy); color: #fff; }
.dp-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; border-top: 1px solid var(--line-2); padding-top: 8px; }
.dp-today, .dp-clear { border: 1.5px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 10px;
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--ink); }
.dp-today:hover, .dp-clear:hover { background: var(--line-2); }
.from-clear { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px;
  color: var(--muted); font-size: 17px; line-height: 1; }
.from-clear:hover { background: var(--line-2); color: var(--ink); }

/* Ledger opening-balance row */
.ledger-tbl tr.lg-open td { background: var(--surface-2); font-weight: 600; color: var(--muted); }

/* Party ledger table */
.ledger-tbl th, .ledger-tbl td { white-space: nowrap; }
.ledger-tbl td:nth-child(2) { white-space: normal; min-width: 160px; }
.drcr { font-size: 10px; color: var(--faint); font-weight: 700; }
.lt { display: inline-block; padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 700;
  background: var(--line-2); color: var(--muted); }
.lt--sales        { background: var(--info-bg); color: var(--info); }
.lt--cashreceipt  { background: var(--good-bg); color: var(--good); }
.lt--cheque       { background: var(--good-bg); color: var(--good); }
.lt--salesreturn  { background: var(--warn-bg); color: var(--warn); }
.lt--creditnote   { background: var(--warn-bg); color: var(--warn); }

/* Sale row → tap to open its invoice items in a pop-up. */
.ledger-tbl tr.lg-sale { cursor: pointer; }
.ledger-tbl tr.lg-sale:hover td { background: var(--info-bg); }
.lg-caret { display: inline-block; margin-right: 6px; font-size: 9px; color: var(--info); }

/* Invoice-items pop-up */
/* Ledger Graph pop-up: Sales-vs-Collection bars / balance line. */
.modal--graph { max-width: min(860px, 94vw); }
/* Columns share the modal width equally, so a few months spread across the
   whole width instead of bunching left; when there are many they shrink to a
   floor and scroll from the left so none clip. */
.mbars--flow { justify-content: flex-start; overflow-x: auto; gap: 12px; }
.mbars--flow .mbar { flex: 1 1 0; min-width: 56px; }
.modal--graph .modal__head h2 span { font-size: 13.5px; font-weight: 700; }
.modal--graph .modal__head svg { color: var(--info); }
.modal--graph #graphArea { min-height: 220px; padding-top: 6px; }
.g-seg { display: inline-flex; margin: 0 auto 14px; border: 1px solid var(--line); border-radius: 9px;
  overflow: hidden; background: var(--line-2); }
.g-seg__b { border: 0; background: transparent; padding: 7px 16px; font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--muted); cursor: pointer; }
.g-seg__b.on { background: var(--navy); color: #fff; }
.modal--graph .modal__body { text-align: center; }
.g-amt { font-size: 11.5px; font-weight: 700; line-height: 1.35; font-variant-numeric: tabular-nums; }
.g-amt--cur  { color: var(--navy); }
.g-amt--coll { color: #1f9d57; }
.g-bal { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
.g-bal strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.modal--items { max-width: 760px; }
.modal--items .modal__head h2 span { font-size: 13.5px; font-weight: 700; }
.modal--items .modal__head svg { color: var(--info); }
.lg-item-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.lg-item-tbl th, .lg-item-tbl td { padding: 8px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.lg-item-tbl th.num, .lg-item-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.lg-item-tbl td.lg-sl, .lg-item-tbl th.lg-sl { width: 1%; text-align: right; white-space: nowrap;
  color: var(--faint); font-variant-numeric: tabular-nums; }
.lg-item-tbl td:nth-child(2) { white-space: normal; color: var(--ink); }
.lg-item-tbl tbody tr:last-child td { border-bottom: none; }

/* ── Accounts: date field + custom calendar ───────────────────────────── */
.date-nav { position: relative; }
.date-field {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.date-field:hover { border-color: var(--navy); }
.date-field svg { width: 15px; height: 15px; color: var(--muted); }

.cal-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 70;
  width: 280px; padding: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
}
.cal-pop[hidden] { display: none; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-head span { font-size: 14px; font-weight: 700; }
.cal-nav {
  width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-size: 18px; line-height: 1; cursor: pointer;
}
.cal-nav:hover:not(:disabled) { background: var(--line-2); }
.cal-nav:disabled { opacity: .35; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--faint); padding: 4px 0; }
.cal-day {
  position: relative; display: grid; place-items: center; height: 34px; border-radius: 8px;
  font-size: 13px; color: var(--ink); text-decoration: none;
}
.cal-day:hover { background: var(--line-2); }
.cal-day.off { opacity: .3; pointer-events: none; }
.cal-day.has::after {
  content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--good);
}
.cal-day.sel { background: var(--navy); color: #fff; font-weight: 700; }
.cal-day.sel.has::after { background: #fff; }

/* Party place label */
.pl-place { color: var(--faint); font-weight: 500; font-size: .85em; }
.pl-place::before { content: '· '; }

/* Party search list */
.party-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.party-list li a {
  display: flex; flex-direction: column; gap: 1px; padding: 11px 12px; border-radius: 9px;
  color: var(--ink); text-decoration: none;
}
.party-list li a:hover { background: var(--line-2); }
.party-list__name { font-size: 14px; font-weight: 600; }
.party-list__place { font-size: 12px; color: var(--muted); }
.party-none { padding: 18px 12px; color: var(--muted); font-size: 14px; }

/* ── Per-page help sheet ───────────────────────────────────────────────── */
.help-back[hidden] { display: none; }
.help { max-width: 560px; }
.help .modal__body { max-height: min(66vh, 560px); overflow-y: auto; }
.help__intro {
  margin-bottom: 16px; padding: 11px 13px;
  background: var(--info-bg); border-radius: 10px;
  font-size: 13.5px; line-height: 1.6; color: var(--ink);
}
.help__list { margin: 0; }
.help__list dt {
  margin-top: 14px; font-size: 13.5px; font-weight: 700; color: var(--ink);
}
.help__list dt:first-child { margin-top: 0; }
.help__list dd {
  margin: 3px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted);
}
.help__list dd b { color: var(--ink); font-weight: 600; }
.help .modal__foot { justify-content: space-between; }

/* Salesman chip: "5/7" in the card's top-right, opposite the coloured icon.
   Amber the moment someone is missing — that is the whole point of the ratio. */
/* Centre, not flex-start: the label's line box is shorter than both the icon
   and the chip, so top-aligning the three leaves the text riding high. */
.kpi__top { align-items: center; }
.kpi__label { flex: 1; min-width: 0; }
.kpi__chip {
  flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 3px;
  height: 20px; padding: 0 7px; border-radius: 100px;
  background: var(--line-2); color: var(--muted);
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.kpi__chip svg { width: 12px; height: 12px; }
.kpi__chip.is-short { background: var(--warn-bg); color: var(--warn); }

/* ── Dashboard: activity grid ──────────────────────────────────────────── */
.card2__sub { font-size: 12px; font-weight: 600; color: var(--muted); }
.card2__headr { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.card2__more { font-size: 12.5px; font-weight: 700; color: var(--red); white-space: nowrap; }
.card2__more:hover { text-decoration: underline; }

/* Reports hub — group submenu (Mobile App / Accounts / Masters) */
.rmenu { display: flex; flex-direction: column; gap: 10px; max-width: 560px; }
.rmenu__item { display: flex; align-items: center; gap: 14px; padding: 15px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.rmenu__item:hover { border-color: var(--navy); }
.rmenu__icon { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); display: grid;
  place-items: center; color: var(--navy); flex-shrink: 0; }
.rmenu__txt { flex: 1; min-width: 0; }
.rmenu__txt h3 { font-size: 15px; font-weight: 700; }
.rmenu__txt p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rmenu__chev { color: var(--faint); flex-shrink: 0; }

/* Non-performing customers — full report page */
.np-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.np-bar__note { font-size: 12.5px; color: var(--muted); }
.np-tbl tfoot .np-total td { border-top: 2px solid var(--line); background: var(--surface-2); font-size: 13.5px; padding-top: 10px; padding-bottom: 10px; }
.data .tot-row td {
  font-weight: 700; background: var(--line-2);
  border-top: 1.5px solid var(--line); border-bottom: none;
}

/* ── Reports hub: two-line tile (icon over name), nothing else ─────────── */
.rgrid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.rtile { padding: 14px; gap: 9px; border-radius: var(--radius-s); }
.rtile__icon { width: 34px; height: 34px; border-radius: 9px; }
.rtile__icon svg { width: 18px; height: 18px; }
.rtile h3 { font-size: 13.5px; font-weight: 600; line-height: 1.3; }

@media (min-width: 900px) {
  /* auto-fill, so the tiles stay tile-sized instead of stretching into
     three big empty boxes across a laptop screen. */
  .rgrid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

