/* TabMap — phone-first, friendly and big.

   Colours come from the logo (a white map pin with an orange receipt): orange is the brand,
   red/green are reserved for "owes" / "paid" so money status never looks like a button.

   Spacing and type are tokens (--font, --lh, --pad-y, ...) so they can change with the language:
   Arabic letters are taller and connected, so the [dir="rtl"] block near the end gives Arabic
   its own font stack, line-height and padding. The same block mirrors the fixed map overlays
   with plain left/right (no inset-inline-*), so old worker phones keep working. */

:root {
  /* Brand — the orange of the logo. Keep in sync with BRAND_COLOR in lib/ui.php + manifest.php. */
  --brand: #e8782a;
  --brand-dark: #c95f1b;
  --brand-soft: #fdeee2;
  --brand-grad: linear-gradient(135deg, #f5a239 0%, #e8832b 55%, #da651d 100%);
  --brand-shadow: rgba(218, 101, 29, .32);

  /* Money status colours: never the brand colour. */
  --danger: #c62828;
  --danger-soft: #fdecea;
  --ok: #1d8a5f;
  --ok-soft: #e3f4ea;
  --blue: #2a5bd7;              /* payments */
  --blue-soft: #e8eeff;

  /* Warm neutrals to sit next to the orange. */
  --ink: #26201a;
  --muted: #7a6f64;
  --bg: #f6f2ec;
  --card: #ffffff;
  --line: #eadfd3;
  --line-strong: #dccbbb;

  --nav-h: 64px;
  /* Top bar height. On an iPhone added to the Home Screen the page runs under the clock/battery
     strip, so the bar is padded by that strip (env(safe-area-inset-top), 0 elsewhere) and everything
     laid out from --top-h moves down with it. Grows when notice bars are shown (set by lib/ui.php). */
  --top-h: calc(54px + env(safe-area-inset-top, 0px));
  --radius: 18px;
  --radius-sm: 12px;

  /* Language-aware type + spacing (Arabic overrides these in the [dir="rtl"] block). */
  --font: 17px;
  --font-small: 14.5px;
  --lh: 1.35;
  --h1: 24px;
  --h2: 18.5px;
  --pad-y: 14px;                /* inputs */
  --btn-y: 16px;                /* buttons */
  --chip-y: 10px;               /* chips, legend, tags */
  --row-y: 16px;                /* list rows, menu rows */
  --nav-font: 12.5px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: var(--font);
  line-height: var(--lh);
  -webkit-text-size-adjust: 100%;
}

/* ---------- top bar ---------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--brand);
  background-image: var(--brand-grad);
  color: #fff;
  z-index: 1100;
  box-shadow: 0 2px 8px rgba(120, 60, 10, .28);
}
.topbar-main {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}
/* Notice bars under the title: viewing another business / subscription note / read-only. */
.topbar-bar {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  background: rgba(0, 0, 0, .22);
}
.topbar-bar a { color: #fff; font-weight: 800; text-decoration: underline; }
.topbar-bar.bar-sub { background: #5a3a12; }
.topbar-bar.bar-blocked { background: var(--danger); }
.topbar-bar.bar-debt { background: #8e1414; }
.topbar .brand {
  font-weight: 800;
  font-size: 18px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0;
}
.topbar .logo { flex: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }
.topbar-link {
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  padding: 8px 10px;
  border-radius: 8px;
  background: none;
  border: 0;
  box-shadow: none;
  font-family: inherit;
  cursor: pointer;
}
.topbar-link.back { font-size: 24px; padding: 2px 10px; line-height: 1; }
.topbar-link:active { background: rgba(255,255,255,.18); }

/* ---------- bottom navigation ---------- */

.bottomnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 1500;
  box-shadow: 0 -1px 6px rgba(60, 40, 20, .06);
}
.bottomnav a, .bottomnav button {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: none;
  box-shadow: none;
  font-family: inherit;
  font-size: var(--nav-font);
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}
.bottomnav .nav-ico { font-size: 24px; line-height: 1; }
.bottomnav .active { color: var(--brand-dark); }
.bottomnav .active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 34px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--brand);
}
.bottomnav a:active, .bottomnav button:active { background: var(--brand-soft); }

.more-sheet {
  position: fixed;
  right: 8px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px);
  z-index: 1600;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 8px 28px rgba(60, 30, 10, .22);
  padding: 8px;
  min-width: 250px;
}
.more-sheet a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: var(--row-y) 14px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  border-radius: 10px;
}
.more-sheet a:active { background: var(--brand-soft); }
.more-sheet .nav-ico { font-size: 22px; }
.menu-note { max-width: 270px; padding: 6px 14px 10px; margin: 0; }

/* ---------- language switcher (🌐 EN ▾ → English / العربية / Español / Русский) ----------
   A <details>: the summary is the button, the form inside is the drop-down list. In the top bar
   the button is white on orange; on the public pages (login, sign-up) it is a small grey pill in
   the corner of the card. */

.lang-switch { position: relative; flex: none; }
.lang-switch summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .04em;
  color: #fff;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary::after { content: "▾"; font-size: 12px; opacity: .85; }
.lang-switch .lang-globe { font-size: 18px; line-height: 1; }
.lang-switch summary:active, .lang-switch[open] summary { background: rgba(255, 255, 255, .18); }
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1700;
  min-width: 190px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(60, 30, 10, .22);
}
.lang-menu button[type="submit"] {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 12px 40px 12px 14px;
  font-size: 17px;
  font-weight: 700;
  text-align: left;
  background: none;
  color: var(--ink);
  border: 0;
  border-radius: 10px;
  box-shadow: none;
  position: relative;
}
.lang-menu button[type="submit"]:active { background: var(--brand-soft); }
.lang-menu button.active { color: var(--brand-dark); }
.lang-menu button.active::after {
  content: "✓";
  position: absolute;
  right: 14px;
  font-weight: 900;
}
/* On the public pages: a grey pill in the top corner of the card. */
.center-page .card { position: relative; }
.center-page .lang-switch { position: absolute; top: 10px; right: 10px; }
.center-page .lang-switch summary {
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--line-strong);
  padding: 5px 9px;
}
.center-page .lang-switch summary:active, .center-page .lang-switch[open] summary { background: var(--brand-soft); }

/* ---------- map screen ---------- */

#map {
  position: fixed;
  top: var(--top-h);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  left: 0; right: 0;
}

.fab {
  position: fixed;
  right: 14px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px);
  z-index: 1100;
  border: 0;
  border-radius: 32px;
  padding: var(--btn-y) 24px;
  background: var(--brand);
  background-image: var(--brand-grad);
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  font-family: inherit;
  box-shadow: 0 6px 16px var(--brand-shadow);
  cursor: pointer;
}
.fab:active { background-image: none; background: var(--brand-dark); }

.fab-mini {
  position: fixed;
  right: 14px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 92px);
  z-index: 1100;
  width: 54px; height: 54px;
  border: 0;
  border-radius: 27px;
  background: var(--card);
  font-size: 26px;
  line-height: 1;
  box-shadow: 0 3px 10px rgba(0,0,0,.25);
  cursor: pointer;
}

/* Top-left stack: filter chips + colour legend. Lives at the top so the bottom
   corners stay free for the zoom control and the round buttons. */
.map-top {
  position: fixed;
  top: calc(var(--top-h) + 8px); left: 10px;
  max-width: calc(100% - 20px);
  z-index: 1090;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;           /* only the pills catch taps, the map gets the rest */
}
.map-top > * { pointer-events: auto; }

.chipbar {
  display: flex;
  gap: 8px;
}
.chip {
  border: 0;
  border-radius: 18px;
  padding: var(--chip-y) 16px;
  background: var(--card);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  box-shadow: 0 1px 4px rgba(0,0,0,.22);
  cursor: pointer;
}
.chip.active { background: var(--brand); color: #fff; }

.legend {
  background: var(--card);
  border-radius: 18px;
  padding: calc(var(--chip-y) - 2px) 14px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,.22);
}

/* colored map pins */
.pin { background: none; border: 0; }
.pin svg { display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }

.banner {
  position: fixed;
  top: calc(var(--top-h) + 8px); left: 10px; right: 10px;
  z-index: 1100;
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(60, 30, 10, .2);
  font-size: 16px;
}
.banner span { flex: 1 1 100%; font-weight: 700; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: 82%;
  overflow-y: auto;
  z-index: 1600;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0,0,0,.25);
}
.sheet h2 { margin: 0 0 12px; font-size: 21px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 96px);
  transform: translateX(-50%);
  z-index: 1700;
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 22px;
  font-size: 16px;
  max-width: 90%;
  text-align: center;
}

.popup-open {
  display: inline-block;
  margin-top: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--brand-dark);
}
.popup-debt { color: var(--danger); font-weight: 700; margin-top: 4px; }
.popup-ok { color: var(--ok); font-weight: 700; margin-top: 4px; }
.popup-due { color: var(--muted); font-weight: 600; font-size: 14px; margin-top: 2px; }
.popup-late { color: #8e1414; font-weight: 800; font-size: 14px; margin-top: 2px; }

/* ---------- forms ---------- */

label {
  display: block;
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
}
input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: var(--pad-y) 14px;
  font-size: var(--font);
  font-family: inherit;
  line-height: var(--lh);
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
}
input::placeholder, textarea::placeholder { color: #a99e93; }
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(232, 120, 42, .28);
  border-color: var(--brand);
}

button, .button-link {
  display: inline-block;
  border: 0;
  border-radius: 14px;
  padding: var(--btn-y) 22px;
  background: var(--brand);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  line-height: var(--lh);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 3px 10px var(--brand-shadow);
}
button:active, .button-link:active { background: var(--brand-dark); box-shadow: none; }
button.ghost, .button-link.ghosty {
  background: var(--card);
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
  box-shadow: none;
}
button.ghost:active, .button-link.ghosty:active { background: var(--brand-soft); }
form button[type="submit"] { width: 100%; }
.row { display: flex; gap: 10px; }
.row > .grow { min-width: 0; }            /* lets date pickers and selects shrink on narrow phones */
input[type="date"] { min-width: 0; }
.row button { flex: 1; width: auto; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
button.small, input.small { padding: 10px 12px; font-size: 15px; }

/* ---------- regular pages ---------- */

.page .content {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--top-h) + 14px) 12px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
}
.content.wide { max-width: 760px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(60, 40, 20, .06);
}
.card h1 { margin: 0 0 10px; font-size: var(--h1); line-height: 1.25; }
.card h2 { margin: 0 0 14px; font-size: var(--h2); line-height: 1.25; }
@media (min-width: 600px) {
  .page .content { padding-left: 16px; padding-right: 16px; }
  .card { padding: 22px 20px; }
}

.center-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 16px;
  background: radial-gradient(circle at 50% -20%, #fbdcc0 0, var(--bg) 60%);
}
.center-page .card { width: 100%; max-width: 400px; padding: 24px 20px; }
.logo-big { text-align: center; margin: 4px 0 10px; line-height: 0; }
.logo-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 24px;
  background: var(--brand);
  background-image: var(--brand-grad);
  box-shadow: 0 8px 20px var(--brand-shadow);
}
.brand-title { text-align: center; margin: 0 0 4px; font-size: 26px; letter-spacing: 0; }
.tagline { text-align: center; color: var(--muted); margin: 0 0 18px; font-size: 15px; }
.login-links { text-align: center; margin: 16px 0 0; font-size: 15px; font-weight: 700; }
.login-links a { color: var(--brand-dark); }

/* Public welcome page */
.hero { width: 100%; max-width: 440px; }
.hero .card { padding: 24px 20px; }
.hero ul { padding-left: 22px; margin: 12px 0 18px; font-size: 16.5px; }
.hero li { margin: 8px 0; }
.hero .price { font-size: 20px; font-weight: 800; color: var(--brand-dark); margin: 0 0 14px; text-align: center; }
.hero .row { margin-top: 6px; }
.hero .row .button-link { padding-left: 12px; padding-right: 12px; font-size: 17px; white-space: nowrap; }

/* First-steps card on the map (new business) */
.start-card {
  position: fixed;
  left: 10px; right: 10px;
  top: calc(var(--top-h) + 58px);
  margin: 0 auto;
  max-width: 380px;
  z-index: 1095;
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 6px 22px rgba(60, 30, 10, .25);
}
.start-card h2 { margin: 0 0 8px; font-size: 18px; }
.start-card ol { margin: 0 0 12px; padding-left: 24px; font-size: 16px; }
.start-card li { margin: 6px 0; }
.start-card li.done { color: var(--ok); text-decoration: line-through; }
.start-card li.done a { color: var(--ok); }
.start-card a { color: var(--brand-dark); font-weight: 700; }
.start-card button { width: auto; }

.muted { color: var(--muted); font-size: var(--font-small); }
.error {
  color: var(--danger);
  font-weight: 700;
  background: var(--danger-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.success {
  color: var(--ok);
  font-weight: 700;
  background: var(--ok-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.notice {
  background: #f1ebe4;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
}

/* ---------- money / history ---------- */

.balance-card {
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 600;
}
.balance-card strong { font-size: 26px; }
.balance-card.owes { background: var(--danger-soft); color: var(--danger); }
.balance-card.clear { background: var(--ok-soft); color: var(--ok); }
/* Deadline line under the balance: "due by …" (quiet) or "past the deadline" (loud). */
.due-line { color: var(--muted); font-size: 15px; font-weight: 600; margin: -4px 0 12px; }
.due-line.late { color: #8e1414; background: #fbe3e3; border-radius: var(--radius-sm); padding: 10px 12px; font-weight: 700; margin-top: -2px; }

.subform { margin-top: 14px; border-top: 1.5px solid var(--line); padding-top: 14px; }

.hist {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.hist summary {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  list-style: none;
}
.hist summary::-webkit-details-marker { display: none; }
.hist.payment { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.hist-kind {
  font-size: 13.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-dark);
}
.hist.payment .hist-kind { background: var(--blue-soft); color: var(--blue); }
.hist-amt { font-weight: 700; font-size: 17px; }
.hist-meta { color: var(--muted); font-size: 14px; flex: 1 1 100%; }
.hist-items { margin: 10px 0 0; padding-left: 22px; font-size: 15px; }
.hist-open-hint { color: var(--muted); font-size: 13px; margin-left: auto; }

/* ---------- sale screen ---------- */

.prod-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.prod-row:first-of-type { border-top: 0; }
.prod-info { flex: 1; }
.prod-name { font-weight: 700; font-size: 16.5px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper input {
  width: 66px;
  text-align: center;
  margin-top: 0;
  padding: 12px 4px;
  font-weight: 700;
}
.step {
  width: 52px; height: 52px;
  border-radius: 26px;
  padding: 0;
  font-size: 26px;
  line-height: 1;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 0;
  box-shadow: none;
}
.step:active { background: var(--brand); color: #fff; }
.total-row {
  font-size: 22px;
  text-align: end;
  margin: 12px 0 4px;
}

/* "Did they pay now?" */
.owed-lines { margin-bottom: 14px; font-size: 16px; }
.owed-lines > div { display: flex; justify-content: space-between; padding: 6px 0; color: var(--muted); }
.owed-lines .owed-total { border-top: 1.5px solid var(--line); color: var(--ink); font-weight: 700; font-size: 18px; }
.pay-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pay-choice:last-child:nth-child(odd) { grid-column: 1 / -1; }
.pay-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 14px;
  text-align: start;
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--line-strong);
  font-size: 16.5px;
  line-height: 1.25;
  box-shadow: none;
}
.pay-choice small { font-size: 14px; font-weight: 600; color: var(--muted); }
.pay-choice:active { background: var(--brand-soft); }
.pay-choice.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pay-choice.active small { color: rgba(255,255,255,.85); }
#someBox { margin-top: 12px; }
.outcome {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 17px;
}
.outcome.owes { background: var(--danger-soft); color: var(--danger); }
.outcome.clear { background: var(--ok-soft); color: var(--ok); }
.fill-all { width: 100%; margin-bottom: 4px; }

/* ---------- dashboard ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.stat { margin-bottom: 0; padding: 14px 16px; }
.stat-label { color: var(--muted); font-size: 14px; font-weight: 700; }
.stat-val { font-size: 26px; font-weight: 800; margin-top: 4px; color: var(--brand-dark); }
.stat.warn .stat-val { color: var(--danger); }
.due-cell { font-size: 14px; }
.late-cell { color: #8e1414; font-weight: 700; }
#teamMap { height: 300px; border-radius: var(--radius-sm); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: start; padding: 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 700; font-size: 13.5px; }
tr.inactive td { opacity: .5; }

/* ---------- lists / workers / products ---------- */

.place-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: var(--row-y) 4px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 17px;
}
.place-row::after { content: "\203A"; color: var(--line-strong); font-size: 26px; line-height: 1; }
.place-row:active { background: var(--brand-soft); }
.owes-tag, .clear-tag {
  font-weight: 700;
  white-space: nowrap;
  border-radius: 12px;
  padding: calc(var(--chip-y) - 4px) 12px;
  font-size: 15px;
}
.owes-tag { color: var(--danger); background: var(--danger-soft); }
.owes-tag.late { color: #8e1414; box-shadow: inset 0 0 0 1.5px #8e1414; }
.clear-tag { color: var(--ok); background: var(--ok-soft); }
.worker-row { border-top: 1px solid var(--line); padding: 14px 0; }
.worker-row.inactive { opacity: .6; }
.worker-row .row { margin-top: 10px; }
.tag.off {
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 700;
}
.prod-edit { border-top: 1px solid var(--line); padding: 14px 0; }
.prod-edit.inactive { opacity: .6; }
.check {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  color: var(--ink);
  padding: 6px 0;
}
.check input { width: 26px; height: 26px; margin: 0; accent-color: var(--brand); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- platform owner: all businesses ---------- */

.biz-row {
  display: block;
  padding: var(--row-y) 4px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.biz-row:active { background: var(--brand-soft); }
.biz-head { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.biz-head strong { flex: 1; }
.biz-meta { color: var(--muted); font-size: var(--font-small); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pill {
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
  background: #f1ebe4;
  color: var(--muted);
}
.pill.trial { background: var(--blue-soft); color: var(--blue); }
.pill.active { background: var(--ok-soft); color: var(--ok); }
.pill.paused, .pill.cancelled { background: var(--danger-soft); color: var(--danger); }
.pill.late { background: #fff3d6; color: #8a5a00; }
.stat-grid.compact .stat-val { font-size: 22px; }
.biz-actions { display: flex; flex-direction: column; gap: 10px; }
.field-note { margin: -8px 0 14px; }
.viewing-note { margin: 0 0 14px; }

/* ---------- Arabic (right-to-left) ---------- */

/* Arabic letters are taller and joined, so the language gets its own type and spacing tokens:
   a touch bigger, more line-height, and a little more vertical padding everywhere. */
[dir="rtl"] {
  --font: 17.5px;
  --font-small: 15px;
  --lh: 1.6;
  --h1: 25px;
  --h2: 19.5px;
  --pad-y: 15px;
  --btn-y: 17px;
  --chip-y: 11px;
  --row-y: 17px;
  --nav-font: 13.5px;
}
[dir="rtl"] body {
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", "Noto Naskh Arabic", Tahoma, Roboto, sans-serif;
  letter-spacing: 0;
}
[dir="rtl"] .bottomnav a, [dir="rtl"] .bottomnav button { gap: 2px; }
[dir="rtl"] .fab { padding-top: calc(var(--btn-y) - 2px); padding-bottom: calc(var(--btn-y) - 2px); }
/* Usernames, passwords, phone numbers and amounts are always typed left-to-right. */
[dir="rtl"] input[type="number"],
[dir="rtl"] input[type="password"],
[dir="rtl"] input[inputmode="tel"],
[dir="rtl"] input[name="username"] { direction: ltr; }
[dir="rtl"] .leaflet-popup-content { direction: rtl; text-align: right; }
/* Mirror the fixed map overlays and the More menu. */
[dir="rtl"] .map-top { left: auto; right: 10px; }
[dir="rtl"] .fab, [dir="rtl"] .fab-mini { right: auto; left: 14px; }
[dir="rtl"] .more-sheet { right: auto; left: 8px; }
[dir="rtl"] .lang-menu { right: auto; left: 0; }
[dir="rtl"] .center-page .lang-switch { right: auto; left: 10px; }
[dir="rtl"] .lang-menu button[type="submit"] { padding: 12px 14px 12px 40px; text-align: right; }
[dir="rtl"] .lang-menu button.active::after { right: auto; left: 14px; }
[dir="rtl"] .hist-items { padding-left: 0; padding-right: 22px; }
[dir="rtl"] .start-card ol, [dir="rtl"] .hero ul { padding-left: 0; padding-right: 24px; }
[dir="rtl"] .hist-open-hint { margin-left: 0; margin-right: auto; }
[dir="rtl"] .place-row::after { content: "\2039"; }
/* Signed amounts (+332.00 / −300.00) keep the sign on the left, as a number should. */
[dir="rtl"] .hist-amt, [dir="rtl"] .num { direction: ltr; unicode-bidi: isolate; }
