/* The page is RTL only, but every rule is a logical property so nothing here assumes it. */

@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/vazirmatn-33.0.3.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --brand: #dc1b3e;
  --brand-strong: #b5112f;
  --brand-soft: #fdebef;
  /* brand red as text: a shade darker than the fill, so small text keeps its contrast */
  --brand-text: #c8102e;
  --on-brand: #ffffff;
  --bg: #f4f4f6;
  --surface: #ffffff;
  --surface-2: #f1f1f4;
  --text: #1d1d23;
  --muted: #6a6a75;
  --line: #e3e3e9;
  --ok: #157347;
  --ok-soft: #e2f4ea;
  --warn: #8f5300;
  --warn-soft: #fff2d9;
  --bad: #be1630;
  --bad-soft: #fdebef;
  --info: #1f4fc4;
  --info-soft: #e6edff;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(20 20 30 / 0.05), 0 4px 14px rgb(20 20 30 / 0.06);
  /* visitors' ways on the map, in this order (blue for one visitor alone). No green: orders are
     green. No red: beside orange and yellow it does not read apart. The order passes the dataviz
     validator on neighbours, wrapping round, in both themes */
  --route-1: #2a78d6;
  --route-2: #eb6834;
  --route-3: #4a3aa7;
  --route-4: #eda100;
  --route-5: #e87ba4;
  color-scheme: light;
}

/* theme.js sets data-theme before the first frame: the person's own choice from the header
   button, or their phone's setting until they make one */
:root[data-theme="dark"] {
  --brand: #dc1b3e;
  --brand-strong: #f0365a;
  --brand-soft: #3b1620;
  --brand-text: #ff6b86;
  --bg: #111115;
  --surface: #1b1b21;
  --surface-2: #25252d;
  --text: #ececf1;
  --muted: #a3a3b0;
  --line: #30303a;
  --ok: #57c993;
  --ok-soft: #12291f;
  --warn: #f2b955;
  --warn-soft: #2d2311;
  --bad: #ff7187;
  --bad-soft: #3b1620;
  --info: #93b2ff;
  --info-soft: #182239;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  --route-1: #3987e5;
  --route-2: #d95926;
  --route-3: #9085e9;
  --route-4: #c98500;
  --route-5: #d55181;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  line-height: 1.4;
}

.icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.muted {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- buttons and fields ---------------------------------------------------------- */

.btn {
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: background-color 0.15s, transform 0.1s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

.btn.primary:hover:not(:disabled) {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand-text);
}

.btn.danger {
  color: var(--bad);
}

.btn.small {
  min-height: 38px;
  border-radius: 11px;
  padding: 0 12px;
  font-size: 13.5px;
}

.btn.block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 13.5px;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  font-size: 16px; /* below 16px iOS zooms the page on focus */
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
}

.field textarea {
  resize: vertical;
  min-height: 76px;
}

.form-error {
  color: var(--bad);
  font-size: 13.5px;
  margin: 0;
}

.form-error:empty {
  display: none;
}

.hint {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
}

.hint:empty {
  display: none;
}

/* ---- sign in --------------------------------------------------------------------- */

.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgb(220 27 62 / 0.16), transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 22px;
  padding: 28px 20px 22px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.login-card h1 {
  margin: 0;
  font-size: 21px;
  text-align: center;
}

.login-card > .muted {
  margin: -6px 0 4px;
  text-align: center;
  font-size: 13.5px;
}

.login-card .hint {
  text-align: center;
}

.brand-mark {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: var(--brand);
  color: var(--on-brand);
  display: grid;
  place-items: center;
  margin-inline: auto;
  box-shadow: 0 8px 20px rgb(220 27 62 / 0.35);
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  margin: 0;
  background: var(--on-brand);
  color: #dc1b3e;
  box-shadow: none;
}

/* with three header buttons, a phone has too little room left for the name and the stock
   time; the mark is the one thing in the header nobody needs */
@media (max-width: 400px) {
  .brand-mark.small {
    display: none;
  }
}

/* ---- header ---------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-row {
  background: var(--brand);
  color: var(--on-brand);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
}

.topbar-who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.who-text {
  min-width: 0;
}

.who-text strong {
  display: block;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync {
  display: block;
  font-size: 12px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border: 0;
  background: rgb(255 255 255 / 0.16);
  color: inherit;
  display: grid;
  place-items: center;
}

.icon-btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.icon-btn.busy .icon {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(-360deg);
  }
}

.toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px 8px;
  display: grid;
  /* the column is the page's width, never its content's: else many groups widen it, and the
     whole page with it, instead of scrolling inside .chips (INC-0015) */
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.toolbar-row {
  display: flex;
  gap: 8px;
  max-width: 928px;
  width: 100%;
  margin-inline: auto;
}

.search {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search .icon {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  translate: 0 -50%;
  color: var(--muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding-inline: 40px 12px;
  font-size: 16px;
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.level-select {
  flex: none;
  height: 44px;
  max-width: 46%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding-inline: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand-text);
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-inline: -16px;
  padding-inline: 16px;
  padding-bottom: 2px;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip small {
  color: var(--muted);
  font-size: 12px;
}

.chip[aria-pressed="true"],
.chip[aria-checked="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
}

.chip[aria-pressed="true"] small,
.chip[aria-checked="true"] small {
  color: inherit;
  opacity: 0.85;
}

/* ---- banners, views -------------------------------------------------------------- */

.banners {
  display: grid;
  gap: 8px;
  max-width: 960px;
  margin-inline: auto;
  padding-inline: 16px;
}

.banners:not(:empty) {
  padding-top: 12px;
}

.banner {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13.5px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.banner .icon {
  margin-top: 2px;
}

.banner.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

/* the visitor's morning follow-ups: a link to their tab */
a.banner.follow-up {
  text-decoration: none;
  font-weight: 700;
  align-items: center;
}

a.banner.follow-up span {
  flex: 1;
}

.banner.info {
  background: var(--info-soft);
  color: var(--info);
}

.banner.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.view {
  max-width: 960px;
  margin-inline: auto;
  padding: 12px 16px calc(150px + env(safe-area-inset-bottom));
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  display: grid;
  gap: 12px;
  justify-items: center;
}

.empty .icon {
  color: var(--line);
}

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

/* ---- products -------------------------------------------------------------------- */

.group-title {
  font-size: 15px;
  margin: 18px 0 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.group-title:first-child {
  margin-top: 4px;
}

.group-title small {
  color: var(--muted);
  font-weight: 400;
  font-size: 12.5px;
}

.grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 10px 12px;
  border: 1.5px solid transparent;
}

.card.in-cart {
  border-color: var(--brand);
}

.card.out .thumb,
.card.out .card-body {
  opacity: 0.5;
}

.thumb {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 0;
  padding: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

button.thumb {
  cursor: zoom-in;
}

.card-body {
  min-width: 0;
  display: grid;
  gap: 3px;
  align-content: start;
}

.card-name {
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0;
}

.price {
  font-size: 16.5px;
  font-weight: 800;
}

.price small {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

.price.none {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.meta {
  font-size: 12.5px;
  color: var(--muted);
}

.card-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
}

.stock {
  font-size: 12.5px;
  color: var(--muted);
}

.stock.low {
  color: var(--warn);
  font-weight: 700;
}

.card-sum {
  display: grid;
  line-height: 1.5;
}

.card-sum strong {
  font-size: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
}

.add-btn {
  min-height: 42px;
  border-radius: 12px;
  border: 0;
  background: var(--brand);
  color: var(--on-brand);
  padding: 0 16px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-weight: 700;
  margin-inline-start: auto;
}

.add-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  margin-inline-start: auto;
}

.stepper button {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--brand-text);
  display: grid;
  place-items: center;
  border-radius: 11px;
}

.stepper button:disabled {
  color: var(--muted);
  opacity: 0.5;
  cursor: not-allowed;
}

.stepper input {
  width: 54px;
  height: 42px;
  border: 0;
  background: transparent;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  padding: 0;
}

.stepper .unit {
  font-size: 12.5px;
  color: var(--muted);
  padding-inline-end: 10px;
}

/* ---- cart bar and tabs ----------------------------------------------------------- */

.cartbar {
  position: fixed;
  inset-inline: 12px;
  bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 15;
  max-width: 936px;
  margin-inline: auto;
  background: var(--brand);
  color: var(--on-brand);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
  box-shadow: 0 8px 24px rgb(220 27 62 / 0.35);
  font-weight: 700;
}

.cartbar span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cartbar small {
  font-weight: 400;
  opacity: 0.9;
}

.tabs {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 20;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabs a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0 7px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
}

.tabs a[aria-current="page"] {
  color: var(--brand-text);
  font-weight: 700;
}

.tab-icon {
  display: grid;
}

.tab-badge {
  position: absolute;
  top: 3px;
  inset-inline-start: calc(50% + 6px);
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  padding: 0 5px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* ---- cart ------------------------------------------------------------------------ */

.section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
  display: grid;
  gap: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-head h2 {
  font-size: 15.5px;
  margin: 0;
  flex: 1;
}

.step {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-text);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  flex: none;
}

.step.done {
  background: var(--ok-soft);
  color: var(--ok);
}

/* no scroll box of its own: a list scrolling inside a scrolling page traps the thumb */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.pick {
  width: 100%;
  text-align: start;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 1px;
}

.pick:hover {
  border-color: var(--line);
}

.pick small {
  color: var(--muted);
  font-size: 12.5px;
}

.pick .mine {
  color: var(--ok);
  font-weight: 700;
}

.chosen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ok-soft);
  border-radius: 12px;
  padding: 10px 12px;
}

.chosen > div {
  min-width: 0;
  display: grid;
}

.chosen small {
  color: var(--muted);
  font-size: 12.5px;
}

.new-customer {
  display: grid;
  gap: 10px;
}

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

.row-actions .btn {
  flex: 1;
}

.levels {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

@media (min-width: 520px) {
  .levels {
    grid-template-columns: repeat(4, 1fr);
  }
}

.levels .chip {
  justify-content: center;
  min-height: 44px;
  border-radius: 12px;
}

.line {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 4px 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.line:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.line:first-child {
  padding-top: 0;
}

.line .thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  grid-row: span 2;
}

.line-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.line-name {
  font-weight: 700;
  font-size: 14px;
}

.line-total {
  font-weight: 800;
  white-space: nowrap;
}

.line-calc {
  font-size: 12.5px;
  color: var(--muted);
}

.line-problem {
  font-size: 12.5px;
  color: var(--bad);
  font-weight: 700;
}

.line.problem {
  background: var(--bad-soft);
  margin-inline: -14px;
  padding-inline: 14px;
}

.line-controls {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 6px;
}

.line-controls .stepper {
  margin-inline-start: 0;
}

.summary {
  display: grid;
  gap: 12px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.total-row strong {
  font-size: 22px;
}

.total-row small {
  color: var(--muted);
}

/* ---- orders ---------------------------------------------------------------------- */

.page-title {
  font-size: 17px;
  margin: 4px 0 12px;
}

.order {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}

.order summary {
  list-style: none;
  padding: 12px 14px;
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.order summary::-webkit-details-marker {
  display: none;
}

.order-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  /* a long name (a new customer's, as the books will file them) is cut, not pushed out of the card */
  min-width: 0;
}

.order-top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-sub {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.order-sub .chev {
  transition: rotate 0.2s;
}

.order[open] .order-sub .chev {
  rotate: -90deg;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex: none;
}

.badge.pending {
  background: var(--info-soft);
  color: var(--info);
}

.badge.processing,
.badge.held {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.issued {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.refused,
.badge.failed {
  background: var(--bad-soft);
  color: var(--bad);
}

.order-body {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  font-size: 13.5px;
}

.order-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.order-line span:last-child {
  white-space: nowrap;
  font-weight: 700;
}

.order-note {
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
}

.order-note.issued {
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 700;
}

.order-note.refused,
.order-note.failed {
  background: var(--bad-soft);
  color: var(--bad);
}

.order-note.held {
  background: var(--warn-soft);
  color: var(--warn);
}

.order-note.pending,
.order-note.processing {
  background: var(--surface-2);
  color: var(--muted);
}

/* ---- dialogs and toast ----------------------------------------------------------- */

dialog {
  color: var(--text);
}

dialog::backdrop {
  background: rgb(10 10 15 / 0.5);
}

.sheet {
  border: 0;
  padding: 0;
  width: 100%;
  max-width: 520px;
  max-height: 92dvh;
  margin: auto auto 0;
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  overflow-y: auto;
}

@media (min-width: 640px) {
  .sheet {
    margin: auto;
    border-radius: 22px;
  }
}

.sheet-body {
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
}

.sheet-body h2 {
  margin: 0;
  font-size: 18px;
}

.facts {
  margin: 0;
  display: grid;
  gap: 8px;
}

.facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-weight: 700;
  text-align: end;
}

.facts .grand dd {
  font-size: 19px;
  color: var(--brand-text);
}

.sheet-actions {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
}

.viewer {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100dvh;
  overflow: visible;
}

/* the caption is white: the page behind must go nearly black, not merely dim */
.viewer::backdrop {
  background: rgb(0 0 0 / 0.88);
}

.viewer figure {
  margin: 0;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.viewer img {
  display: block;
  max-width: min(92vw, 800px);
  max-height: 78dvh;
  border-radius: 16px;
  background: #ffffff;
}

.viewer figcaption {
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  padding-inline: 16px;
}

.viewer .icon-btn {
  background: rgb(255 255 255 / 0.2);
  color: #ffffff;
}

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: calc(136px + env(safe-area-inset-bottom));
  z-index: 40;
  max-width: 440px;
  margin-inline: auto;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: center;
  font-size: 14px;
  background: #24242b;
  color: #ffffff;
  border: 1px solid rgb(255 255 255 / 0.1);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
}

.toast[data-kind="ok"] {
  background: #157347;
}

.toast[data-kind="bad"] {
  background: #be1630;
}

/* ---- admin ----------------------------------------------------------------------- */

.admin-count {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
}

/* the visitors page: when Orash's list was read, how many have an account, and what follows Orash */
.visitor-intro {
  margin-bottom: 10px;
}

.visitor-intro .admin-count {
  margin: 0 0 2px;
}

/* «کاربران»: the staff, then Orash's visitors, each under a heading of its own */
.users-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 18px 0 8px;
}

.users-heading:first-child {
  margin-top: 0;
}

.users-heading h2 {
  font-size: 16px;
  margin: 0;
}

.staff-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.role-badge {
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12px;
  font-weight: 700;
  background: var(--info-soft);
  color: var(--info);
}

.role-badge.role-admin {
  background: var(--ok-soft);
  color: var(--ok);
}

/* a role to give, with what its page holds */
.role-choice {
  display: grid;
  gap: 8px;
}

.role-option {
  display: grid;
  gap: 2px;
  text-align: start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.role-option small {
  color: var(--muted);
  font-size: 12.5px;
}

.role-option[aria-checked="true"] {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

/* the collectors' cases: one card a customer */
.case-toolbar {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.case-list {
  display: grid;
  gap: 8px;
}

.case-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  display: grid;
  gap: 4px;
  border-inline-start: 4px solid transparent;
}

.case-card.due {
  border-inline-start-color: var(--warn);
}

.case-card.closed {
  opacity: 0.8;
}

.case-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.case-head small,
.case-facts,
.case-last {
  color: var(--muted);
  font-size: 12.5px;
}

.case-figures {
  font-weight: 700;
  font-size: 14px;
}

.reason {
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--warn-soft);
  color: var(--warn);
}

.reason.reason-debt_over_90,
.reason.reason-bounced_and_owing {
  background: var(--bad-soft);
  color: var(--bad);
}

.case-wanted {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 13px;
}

/* a case's name opens the whole of its debt */
.case-name {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--brand-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* the messenger's sheet (messenger.js) */
.messenger-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.variable-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
}

.messenger-text {
  margin: 4px 0;
  font-size: 13.5px;
  white-space: pre-wrap;
}

.tone-ok {
  color: var(--ok);
}

.tone-bad {
  color: var(--bad);
}

.debt-section {
  font-size: 15px;
  margin: 14px 0 6px;
}

.debt-list {
  display: grid;
  gap: 8px;
}

.debt-item {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}

.debt-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.debt-head small {
  color: var(--muted);
}

.debt-figures {
  font-weight: 700;
}

.debt-goods {
  margin: 4px 0 0;
  padding-inline-start: 18px;
  display: grid;
  gap: 2px;
  font-size: 13px;
}

.debt-goods.bad {
  color: var(--bad);
}

.case-history {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 10px;
}

.case-history li {
  display: grid;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.case-history small {
  color: var(--muted);
  font-size: 12.5px;
}

.case-history p {
  margin: 2px 0 0;
}

/* the staff's own page */
.work-intro h2 {
  font-size: 17px;
  margin: 0 0 4px;
}

.work-intro p {
  color: var(--muted);
  margin: 0 0 14px;
}

.admin-row {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.admin-row .thumb {
  width: 76px;
  height: 76px;
}

.admin-info {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.admin-info small {
  color: var(--muted);
  font-size: 12.5px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.file-btn {
  position: relative;
}

.file-btn:focus-within {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.row-status {
  font-size: 12.5px;
}

.row-status.ok {
  color: var(--ok);
}

.row-status.bad {
  color: var(--bad);
}

.row-status.busy {
  color: var(--muted);
}

.row-status.warn {
  color: var(--warn);
}

/* ---- the managers' map: Leaflet draws it; these only dress it ---------------------- */

.map {
  height: min(60vh, 560px);
  min-height: 300px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  /* Leaflet's panes stack up to 1000: kept inside the map, under the header, tabs and sheets */
  isolation: isolate;
}

.map.leaflet-container {
  font: inherit;
  font-size: 13px;
  background: var(--surface-2);
}

/* the tiles are drawn for daylight; at night they are turned, not swapped */
[data-theme="dark"] .map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9);
}

.map path.dot-now,
.map path.dot-old,
.map path.dot-stop,
.map path.dot-order {
  stroke: var(--surface);
  fill-opacity: 1;
}

.map path.dot-now {
  fill: var(--ok);
}

.map path.dot-old {
  fill: var(--muted);
}

.map path.dot-stop {
  fill: var(--warn);
}

.map path.dot-order {
  fill: var(--ok);
}

/* a way: a ring of the surface under the colour, so it stands off the tiles and off another way */
.map path.route-casing {
  stroke: var(--surface);
  stroke-opacity: 0.9;
  fill: none;
}

.map path.route {
  stroke-opacity: 0.95;
  fill: none;
}

/* point to point: where no street was found for the points */
.map path.route.off-road {
  stroke-dasharray: 6 8;
}

/* along the streets across minutes the tracker was not heard: the likeliest way, not one seen */
.map path.route.guessed {
  stroke-opacity: 0.4;
}

.map path.route-solo,
.map path.route-c1 {
  stroke: var(--route-1);
}

.map path.route-c2 {
  stroke: var(--route-2);
}

.map path.route-c3 {
  stroke: var(--route-3);
}

.map path.route-c4 {
  stroke: var(--route-4);
}

.map path.route-c5 {
  stroke: var(--route-5);
}

.map path.route-end {
  stroke: var(--route-1);
  fill: var(--surface);
  fill-opacity: 1;
}

.map path.stop-c1,
.map path.stop-c2,
.map path.stop-c3,
.map path.stop-c4,
.map path.stop-c5 {
  stroke: var(--surface);
  fill-opacity: 1;
}

.map path.stop-c1 {
  fill: var(--route-1);
}

.map path.stop-c2 {
  fill: var(--route-2);
}

.map path.stop-c3 {
  fill: var(--route-3);
}

.map path.stop-c4 {
  fill: var(--route-4);
}

.map path.stop-c5 {
  fill: var(--route-5);
}

/* every visitor at once: one tapped stands out, the others step back */
.map path.faded {
  opacity: 0.15;
}

.map .leaflet-tooltip.faded {
  opacity: 0.35;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.legend-row .map-item {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.legend-row .map-item[aria-pressed="true"] {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex: none;
  background: var(--route-1);
}

.swatch.c2 {
  background: var(--route-2);
}

.swatch.c3 {
  background: var(--route-3);
}

.swatch.c4 {
  background: var(--route-4);
}

.swatch.c5 {
  background: var(--route-5);
}

.swatch.none {
  background: var(--line);
}

.map .leaflet-tooltip,
.map .leaflet-popup-content-wrapper,
.map .leaflet-popup-tip,
.map .leaflet-bar a {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.map .leaflet-control-attribution {
  background: var(--surface);
  color: var(--muted);
}

.map .leaflet-control-attribution a {
  color: var(--info);
}

.map .leaflet-tooltip-top::before {
  border-top-color: var(--surface);
}

.map .leaflet-tooltip-bottom::before {
  border-bottom-color: var(--surface);
}

.map .map-label {
  font-weight: 700;
}

.map .leaflet-popup-content {
  margin: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
}

.map-pop {
  display: grid;
  gap: 2px;
}

.map-pop small {
  color: var(--muted);
}

.map-row {
  grid-template-columns: 12px 1fr;
}

.map-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  align-self: start;
  margin-top: 8px;
}

.map-dot.ok {
  background: var(--ok);
}

.map-dot.warn {
  background: var(--warn);
}

.map-note.bad {
  color: var(--bad);
  font-size: 13px;
  margin: 0 0 10px;
}

.map-summary {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: grid;
  gap: 10px;
}

.map-summary h2 {
  margin: 0;
  font-size: 16px;
}

.map-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: start;
  background: var(--surface);
  border: 0;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  margin-bottom: 6px;
}

.map-item span {
  display: grid;
  min-width: 0;
}

.map-item small {
  color: var(--muted);
  font-size: 12.5px;
}

.map-item:disabled {
  cursor: default;
  opacity: 0.75;
}

.qr-box {
  display: grid;
  place-items: center;
}

.qr-box canvas {
  width: min(280px, 100%);
  height: auto;
  image-rendering: pixelated;
  border-radius: 8px;
}

.steps {
  margin: 0;
  list-style-type: persian;
  padding-inline-start: 20px;
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.setup-facts dd {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  font-weight: 400;
  word-break: break-all;
}

.sheet-actions.single {
  grid-template-columns: 1fr;
}

.sheet-actions.three {
  grid-template-columns: 1fr 1fr;
}

.sheet-actions.three > :first-child {
  grid-column: span 2;
}

@media (min-width: 520px) {
  .sheet-actions.three {
    grid-template-columns: 2fr 1.3fr 1fr;
  }

  .sheet-actions.three > :first-child {
    grid-column: auto;
  }
}

/* ---- visitors' accounts ------------------------------------------------------------ */

.sheet-form {
  display: grid;
  gap: 12px;
}

.sheet-form > .btn.small {
  justify-self: start;
}

/* a new password, shown once to be passed on: large, and easy to read aloud */
.password-shown {
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-2);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 24px;
  letter-spacing: 2px;
  text-align: center;
  user-select: all;
  word-break: break-all;
}

/* ---- vans on the map, beside visitors ------------------------------------------------- */

.panel-title {
  font-size: 15px;
  margin: 14px 0 8px;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.empty.small {
  padding: 12px;
}

.map-dot.van {
  border-radius: 3px;
}

.retired {
  margin-top: 10px;
  font-size: 13.5px;
}

.retired summary {
  cursor: pointer;
  color: var(--muted);
  margin-bottom: 6px;
}

.retired-name {
  flex: 1;
  min-width: 0;
}

.retired-name small {
  color: var(--muted);
}

/* a van's mark is square where a visitor's is round */
.live-icon {
  background: transparent;
  border: 0;
}

.now-van {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--ok);
  border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.35);
}

.now-van.old {
  background: var(--muted);
}

.live-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.35);
  background: var(--route-1);
}

.live-mark.van {
  border-radius: 5px;
}

.live-mark.c2 { background: var(--route-2); }
.live-mark.c3 { background: var(--route-3); }
.live-mark.c4 { background: var(--route-4); }
.live-mark.c5 { background: var(--route-5); }
.live-mark.stale { background: var(--muted); }

.swatch.van {
  border-radius: 2px;
}

.swatch.c1 { background: var(--route-1); }

/* a stop is a ring in its way's colour */
.map path.ring-c1,
.map path.ring-c2,
.map path.ring-c3,
.map path.ring-c4,
.map path.ring-c5 {
  fill: var(--surface);
  fill-opacity: 1;
}

.map path.ring-c1 { stroke: var(--route-1); }
.map path.ring-c2 { stroke: var(--route-2); }
.map path.ring-c3 { stroke: var(--route-3); }
.map path.ring-c4 { stroke: var(--route-4); }
.map path.ring-c5 { stroke: var(--route-5); }

.map .map-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.map .map-name .swatch {
  width: 10px;
  height: 10px;
}

/* ---- the manager's dashboard -------------------------------------------------------- */

:root {
  /* the dataviz palette's validated steps: money in and out, two series, and an ordinal ramp for age */
  --ch-in: #2a78d6;
  --ch-out: #e34948;
  --ch-s1: #2a78d6;
  --ch-s2: #eb6834;
  --ch-grid: #ececf0;
  --ch-axis: #c3c2b7;
  --age-1: #86b6ef;
  --age-2: #5598e7;
  --age-3: #2a78d6;
  --age-4: #1c5cab;
  --age-5: #104281;
}

:root[data-theme="dark"] {
  --ch-in: #3987e5;
  --ch-out: #e66767;
  --ch-s1: #3987e5;
  --ch-s2: #d95926;
  --ch-grid: #2a2a33;
  --ch-axis: #474752;
  /* older debt brighter on the dark surface */
  --age-1: #184f95;
  --age-2: #256abf;
  --age-3: #3987e5;
  --age-4: #6da7ec;
  --age-5: #9ec5f4;
}

.tabs.four {
  grid-template-columns: repeat(4, 1fr);
}

.tabs.five {
  grid-template-columns: repeat(5, 1fr);
}

.tabs.six {
  grid-template-columns: repeat(6, 1fr);
}

.tabs.six a {
  font-size: 11px;
}

.view.wide {
  max-width: 1400px;
}

.dash {
  display: grid;
  gap: 14px;
}

.dash-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-size: 13px;
  color: var(--muted);
}

.dash-status .grow {
  flex: 1;
}

.dash-fresh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dash-fresh.bad {
  color: var(--bad);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  background: var(--muted);
}

.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}

.dot.bad {
  background: var(--bad);
}

.kpis {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  .kpis .hero {
    grid-column: span 2;
  }
}

@media (min-width: 1100px) {
  .kpis {
    grid-template-columns: repeat(4, 1fr);
  }
}

.tile {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.tile .label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.tile .value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
}

.tile .value small {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  margin-inline-start: 5px;
}

.tile .sub {
  font-size: 12.5px;
  color: var(--muted);
}

.tile .sub.warn {
  color: var(--warn);
}

.tile.hero {
  flex-direction: row;
  justify-content: space-between;
  gap: 16px;
}

.tile.hero .value {
  font-size: 42px;
  line-height: 1.1;
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.spark {
  flex: 1;
  max-width: 340px;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
}

.spark-box {
  height: 84px;
}

.spark-cap {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
}

@media (max-width: 520px) {
  .tile.hero {
    flex-direction: column;
  }

  .spark {
    max-width: none;
  }
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 8px;
  width: fit-content;
  color: var(--muted);
  background: var(--surface-2);
}

.delta.good {
  color: var(--ok);
  background: var(--ok-soft);
}

.delta.bad {
  color: var(--bad);
  background: var(--bad-soft);
}

.delta.warn {
  color: var(--warn);
  background: var(--warn-soft);
}

.meter {
  height: 8px;
  border-radius: 99px;
  background: var(--info-soft);
  overflow: hidden;
  margin-top: 4px;
}

/* the share past 60 days, in steps of 5%: a width from a class, since the page allows no inline style */
.meter .fill {
  display: block;
  height: 100%;
  background: #ec835a;
  border-radius: 99px;
  width: 0;
}

.meter .fill.w5 { width: 5%; }
.meter .fill.w10 { width: 10%; }
.meter .fill.w15 { width: 15%; }
.meter .fill.w20 { width: 20%; }
.meter .fill.w25 { width: 25%; }
.meter .fill.w30 { width: 30%; }
.meter .fill.w35 { width: 35%; }
.meter .fill.w40 { width: 40%; }
.meter .fill.w45 { width: 45%; }
.meter .fill.w50 { width: 50%; }
.meter .fill.w55 { width: 55%; }
.meter .fill.w60 { width: 60%; }
.meter .fill.w65 { width: 65%; }
.meter .fill.w70 { width: 70%; }
.meter .fill.w75 { width: 75%; }
.meter .fill.w80 { width: 80%; }
.meter .fill.w85 { width: 85%; }
.meter .fill.w90 { width: 90%; }
.meter .fill.w95 { width: 95%; }
.meter .fill.w100 { width: 100%; }

.split,
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.split span,
.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  flex: none;
}

.sw.in,
.sw.s1 { background: var(--ch-s1); }
.sw.out { background: var(--ch-out); }
.sw.s2 { background: var(--ch-s2); }
.sw.age-1 { background: var(--age-1); }
.sw.age-2 { background: var(--age-2); }
.sw.age-3 { background: var(--age-3); }
.sw.age-4 { background: var(--age-4); }
.sw.age-5 { background: var(--age-5); }

.dash-row {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

@media (min-width: 960px) {
  .dash-row.two {
    grid-template-columns: 1.15fr 1fr;
  }

  .dash-row.goods {
    grid-template-columns: 2.1fr 1fr;
  }
}

@media (min-width: 1100px) {
  .dash-row.three {
    grid-template-columns: 1fr 1fr 1.15fr;
  }
}

.dash-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  min-width: 0;
}

.dash-card .card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.dash-card h2 {
  margin: 0;
  font-size: 16px;
}

.dash-card .card-head p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.dash-card .more {
  color: var(--brand-text);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.dash-card .hint {
  margin: 10px 0 0;
}

.chart-box {
  min-height: 260px;
}

.chart {
  display: block;
  font-family: inherit;
}

.chart text {
  font-family: "Vazirmatn", Tahoma, sans-serif;
}

.ch-grid {
  stroke: var(--ch-grid);
  stroke-width: 1;
}

.ch-axis {
  stroke: var(--ch-axis);
  stroke-width: 1;
}

.ch-tick,
.ch-label {
  fill: var(--muted);
  font-size: 11.5px;
}

.ch-value,
.ch-net {
  fill: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.ch-net.worst {
  fill: var(--bad);
}

.ch-bar,
.ch-in,
.ch-s1 {
  fill: var(--ch-s1);
}

.ch-bar.partial {
  fill: var(--age-1);
}

.ch-out {
  fill: var(--ch-out);
}

.ch-s2 {
  fill: var(--ch-s2);
}

.ch-spark-area {
  fill: var(--ch-s1);
  fill-opacity: 0.1;
}

.ch-spark-line {
  fill: none;
  stroke: var(--ch-s1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.ch-spark-dot {
  fill: var(--ch-s1);
  stroke: var(--surface);
  stroke-width: 2;
}

.stack-box {
  height: 26px;
}

.age-1 { fill: var(--age-1); }
.age-2 { fill: var(--age-2); }
.age-3 { fill: var(--age-3); }
.age-4 { fill: var(--age-4); }
.age-5 { fill: var(--age-5); }

.age-legend {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.age-legend div {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: var(--muted);
  min-width: 0;
}

.age-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.age-legend b {
  color: var(--text);
  font-size: 13.5px;
}

.subhead {
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.debtors {
  list-style: none;
  margin: 0;
  padding: 0;
}

.debtors li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.debtors .who {
  flex: 1;
  min-width: 0;
}

.debtors .who small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}

.debtors .amt {
  font-weight: 700;
  white-space: nowrap;
}

.chip.bad,
.chip.warn,
.chip.ok,
.chip.mute {
  min-height: 0;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 7px;
  padding: 1px 7px;
  border: 0;
  white-space: nowrap;
}

.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.mute { background: var(--surface-2); color: var(--muted); }

.pairs {
  display: grid;
  gap: 8px;
}

.pair-row {
  display: grid;
  grid-template-columns: 84px 1fr 44px;
  align-items: center;
  gap: 8px;
}

.pair-row .nm {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pair-bars {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.pair-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1;
}

.pair-line .cellbar {
  width: 70%;
  min-width: 60px;
}

.ratio {
  font-size: 12.5px;
  font-weight: 700;
  text-align: end;
}

.ratio.low {
  color: var(--bad);
}

.tasks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tasks li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.tasks li:first-child {
  border-top: 0;
  padding-top: 0;
}

.sev {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  height: fit-content;
}

.sev.high { color: var(--bad); }
.sev.medium { color: var(--warn); }
.sev.low { color: var(--muted); }

.task-text {
  font-size: 13.5px;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.owner {
  background: var(--info-soft);
  color: var(--info);
  border-radius: 7px;
  padding: 0 7px;
  font-weight: 700;
  font-size: 11.5px;
}

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

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.dash-table th {
  text-align: start;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.dash-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.dash-table tr:last-child td {
  border-bottom: 0;
}

.gname {
  font-weight: 700;
}

.dash-table .gname small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 11.5px;
}

.cellbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.num {
  text-align: end;
  white-space: nowrap;
}

.pct-bad {
  color: var(--bad);
  font-weight: 700;
}

.watch-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.watch-row small {
  color: var(--muted);
}

.dash-stack {
  display: grid;
  gap: 12px;
  align-content: start;
}

.tile.placeholder {
  background: transparent;
  box-shadow: none;
  border: 1.5px dashed var(--line);
}

.tag {
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 6px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* today's ways: the map, and beside it each visitor and van */
.fleet-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

@media (min-width: 960px) {
  .fleet-grid {
    grid-template-columns: 1fr 340px;
  }
}

.fleet-map-wrap {
  position: relative;
  /* the legend's z-index stays inside, under the sticky header */
  isolation: isolate;
}

.dash-map {
  height: 460px;
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .dash-map {
    height: 340px;
    min-height: 0;
  }
}

.map-legend {
  position: absolute;
  bottom: 10px;
  inset-inline-start: 10px;
  z-index: 500;
  background: var(--surface);
  border-radius: 10px;
  padding: 5px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  box-shadow: var(--shadow);
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.lg {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.lg.order { background: var(--ok); }
.lg.stop { background: var(--surface); border: 2.5px solid var(--muted); }
.lg.person { background: var(--route-1); }
.lg.van { background: var(--route-4); border-radius: 3px; }

.fleet-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.fleet-list h3 {
  margin: 4px 0 0;
  font-size: 13.5px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.fleet-list h3 span {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

.fleet-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  display: grid;
  gap: 5px;
}

.fleet-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fleet-top .when {
  margin-inline-start: auto;
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.facts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.facts-row span {
  background: var(--surface-2);
  border-radius: 7px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--muted);
}

/* the TV's code, shown once and big: read off a phone, typed in with a remote */
.pair-code {
  display: flex;
  justify-content: center;
  gap: 0.45em;
  padding: 14px 10px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 44px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  user-select: all;
}

.steps .address {
  font-weight: 700;
}

.theme-choice {
  margin-inline: 0;
  padding-inline: 0;
}

.display-list {
  display: grid;
  gap: 8px;
}

.display-row {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}

.display-info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}

.display-info small {
  color: var(--muted);
  font-size: 12.5px;
}

.display-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---- what lies behind a part of the dashboard: held under the pointer, or a click away ---- */
.has-detail {
  cursor: pointer;
}

.tile.has-detail:hover,
.tile.has-detail:focus-visible {
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}

.has-detail:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.pair-row.has-detail,
.age-legend .has-detail {
  border-radius: 8px;
  padding: 2px 4px;
}

.pair-row.has-detail:hover,
.age-legend .has-detail:hover {
  background: var(--surface-2);
}

.chart .ch-hit {
  fill: transparent;
}

.chart .ch-hit:hover {
  fill: var(--ch-grid);
  fill-opacity: 0.45;
}

.detail-host {
  position: relative;
}

.detail-host.detail-open {
  z-index: 40;
}

.detail-pop {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-start: 0;
  z-index: 40;
  width: min(420px, calc(100vw - 32px));
  max-height: min(60vh, 520px);
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 30px rgb(20 20 30 / 0.2);
  font-size: 13px;
  font-weight: 400;
  text-align: start;
  cursor: pointer;
}

.detail-pop.above {
  top: auto;
  bottom: calc(100% + 6px);
}

.detail-pop.to-end {
  inset-inline-start: auto;
  inset-inline-end: 0;
}

.detail-head {
  display: grid;
  gap: 2px;
  margin-bottom: 8px;
}

.detail-head h2 {
  margin: 0;
}

.detail-head small {
  color: var(--muted);
  font-size: 12px;
}

.detail-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.detail-rows > li {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.detail-rows > li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-weight: 700;
}

.detail-line .amt {
  white-space: nowrap;
}

.detail-rows small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.detail-goods {
  margin: 4px 0 0;
  padding-inline-start: 18px;
  font-size: 12px;
}

.detail-rows .tone-in .amt {
  color: var(--ok);
}

.detail-rows .tone-out .amt,
.detail-rows .tone-bad .amt {
  color: var(--bad);
}

.detail-rows .tone-warn .amt {
  color: var(--warn);
}

.detail-rows > li.detail-section {
  padding: 6px 0 2px;
  border-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-more {
  margin: 8px 0 0;
  color: var(--brand-text);
  font-size: 12px;
}

.detail-sheet .detail-rows {
  max-height: 65vh;
  overflow-y: auto;
}

/* the sheet's search, order and storage, where the list has them (owner, 1405/07/28) */
.detail-tools {
  display: grid;
  gap: 8px;
  margin-bottom: 6px;
}

.detail-tools .chips {
  flex-wrap: wrap;
  overflow-x: visible;
  margin-inline: 0;
  padding-inline: 0;
  gap: 6px;
  align-items: center;
}

.detail-search input {
  height: 40px;
}

.chips-label {
  color: var(--muted);
  font-size: 12px;
}

.detail-count {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.detail-head .detail-total {
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}

/* the debt in one sentence: read as text, whatever the row's tone */
.detail-rows .detail-debt {
  margin: 3px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  font-weight: 400;
}

/* a customer's name leads to their page: the text's colour, underlined in the brand's */
.detail-line a.who {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--brand);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 5px;
}

.detail-line a.who:hover,
.detail-line a.who:focus-visible {
  color: var(--brand-text);
}

.detail-rows.loading-soft {
  opacity: 0.5;
}

.detail-sheet .detail-tools ~ .detail-rows {
  max-height: 55vh;
}

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

/* a customer's own statement, from the link in a message to them (statement.js) */
.statement {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  display: grid;
  gap: 12px;
}

.statement-head {
  display: grid;
  gap: 4px;
}

.statement-head h1 {
  margin: 0;
  font-size: 20px;
}

.statement-facts {
  padding: 14px;
  border-radius: 14px;
  background: var(--surface);
}

.statement-lines li {
  padding: 3px 0;
}

/* the catalog, from the link in a message to a customer (catalog.js, owner 1405/08/04): no price */
.catalog {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  display: grid;
  gap: 18px;
}

.catalog-head {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.catalog-head h1 {
  margin: 0;
  font-size: 20px;
}

.catalog-head p {
  margin: 0;
  color: var(--muted);
}

.catalog-group h2 {
  margin: 0 0 10px;
  font-size: 16px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.catalog-item {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  min-width: 0;
}

.catalog-item img,
.catalog-noimage {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  object-fit: cover;
  background: var(--surface-2);
}

.catalog-noimage {
  display: grid;
  place-items: center;
  font-size: 34px;
  color: var(--muted);
}

.catalog-item strong {
  font-size: 13.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.catalog-item small {
  color: var(--muted);
}

/* ---- a customer's own page (customer.js, owner 1405/07/28) ---------------------------------- */

.cust {
  display: grid;
  gap: 14px;
}

.cust-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
}

.cust-who {
  min-width: 0;
  flex: 1 1 220px;
}

/* their picture, beside their name (owner, 1405/08/04) */
.cust-photo-box {
  display: grid;
  justify-items: center;
  gap: 6px;
  flex: none;
}

/* on a phone, the picture beside its buttons above the name, which keeps the whole width */
@media (max-width: 560px) {
  .cust-photo-box {
    grid-template-columns: auto 1fr;
    align-items: center;
    justify-items: start;
    gap: 12px;
    flex-basis: 100%;
  }

  .cust-photo {
    width: 64px;
    height: 64px;
    font-size: 26px;
  }
}

.cust-photo {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 32px;
  font-weight: 800;
}

.cust-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cust-photo-acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.cust-who h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cust-who p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.cust-who small {
  color: var(--muted);
  font-size: 12px;
}

.cust-phones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cust-top {
  display: grid;
  gap: 14px;
}

@media (min-width: 1000px) {
  .cust-top {
    grid-template-columns: minmax(340px, 1fr) 1.6fr;
    align-items: start;
  }
}

.score-main {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.score-main h2 {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.score-main p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.score-ring {
  flex: none;
}

.ring-track,
.ring-value {
  fill: none;
  stroke-width: 12;
}

.ring-track {
  stroke: var(--surface-2);
}

.ring-value {
  stroke-linecap: round;
}

.ring-total {
  font-size: 34px;
  font-weight: 800;
  fill: var(--text);
}

.ring-of {
  font-size: 12px;
  fill: var(--muted);
}

.grade-good .ring-value { stroke: var(--ok); }
.grade-fair .ring-value { stroke: var(--brand); }
.grade-watch .ring-value { stroke: var(--warn); }
.grade-risk .ring-value { stroke: var(--bad); }

.score-grade {
  display: block;
  font-size: 20px;
  font-weight: 800;
}

.score-grade.grade-good { color: var(--ok); }
.score-grade.grade-fair { color: var(--brand-text); }
.score-grade.grade-watch { color: var(--warn); }
.score-grade.grade-risk { color: var(--bad); }

.score-parts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.score-parts li {
  display: grid;
  gap: 4px;
}

.part-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}

.part-points.tone-ok { color: var(--ok); }
.part-points.tone-warn { color: var(--warn); }
.part-points.tone-bad { color: var(--bad); }

.ch-bar.part-ok { fill: var(--ok); }
.ch-bar.part-warn { fill: var(--warn); }
.ch-bar.part-bad { fill: var(--bad); }

.score-parts small {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.cust-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 640px) {
  .cust-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.cust-kpis .tile .value {
  font-size: 21px;
}

.tile.mark-bad .value {
  color: var(--bad);
}

.tile.mark-warn .value {
  color: var(--warn);
}

.cust-case.due {
  border-inline-start: 4px solid var(--warn);
}

.cust-notes {
  margin: 8px 0 0;
  padding-inline-start: 20px;
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.cust-jump {
  flex-wrap: wrap;
  overflow-x: visible;
  margin-inline: 0;
  padding-inline: 0;
  gap: 6px;
}

.cust-row {
  display: grid;
  gap: 14px;
}

@media (min-width: 1000px) {
  .cust-row {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.cust-card {
  scroll-margin-top: 80px;
}

.cust-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.cust-list > li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px;
}

.cust-list > li:first-child {
  padding-top: 0;
}

.cust-list > li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.cust-list.compact > li {
  padding: 7px 0;
}

.cust-list.invoices {
  max-height: 70vh;
  overflow-y: auto;
}

.debt-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.debt-line .amt {
  font-weight: 700;
  white-space: nowrap;
}

.amt.minus {
  color: var(--bad);
}

.amt.plus {
  color: var(--ok);
}

.debt-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  color: var(--muted);
  font-size: 12.5px;
}

/* a mark on the reading side (inline-start), as an inset shadow would not be in RTL */
.cust-debt.late-bad,
.cust-debt.late-warn {
  border-inline-start: 3px solid var(--bad);
  padding-inline-start: 10px;
}

.cust-debt.late-warn {
  border-inline-start-color: var(--warn);
}

/* on a wide screen, two rows side by side: the title and the amount are not a screen apart */
@media (min-width: 1000px) {
  .cust-list.wide {
    grid-template-columns: 1fr 1fr;
    column-gap: 32px;
  }

  .cust-list.wide > li:nth-child(2) {
    padding-top: 0;
  }
}

.cust-goods summary {
  cursor: pointer;
  color: var(--brand-text);
  font-size: 12.5px;
  font-weight: 600;
  width: fit-content;
}

.cust-goods ul {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.cust-goods li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 10px;
  font-size: 13px;
}

.cust-goods li small {
  color: var(--muted);
}

.cust-list small {
  color: var(--muted);
  font-size: 12px;
}

.chart-box.small {
  min-height: 220px;
}

/* ---- the collections unit's own page: figures and tasks (tasks.js, owner 1405/07/28) -------- */

.desk {
  margin-bottom: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 900px) {
  .desk {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.desk .tile .value {
  font-size: 21px;
}

@media (max-width: 640px) {
  .desk {
    gap: 8px;
  }

  .desk .tile {
    padding: 10px 12px;
    gap: 2px;
  }

  .desk .tile .value {
    font-size: 18px;
  }
}

.desk-switch {
  flex-wrap: wrap;
  overflow-x: visible;
  margin: 0 0 12px;
  padding: 0;
}

.desk-switch .chip {
  min-height: 40px;
  font-size: 14.5px;
}

.task-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.task-bar p {
  margin: 0;
  flex: 1 1 260px;
}

.task-group {
  margin-top: 14px;
}

.task-group h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  margin: 0 0 6px;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
}

.task.late {
  border-inline-start: 3px solid var(--bad);
}

.task-check {
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: transparent;
  display: grid;
  place-items: center;
  padding: 0;
}

.task-check[aria-checked="true"] {
  background: var(--ok);
  border-color: var(--ok);
  color: #fff;
}

.task-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 4px;
}

.task-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.task.done .task-title {
  text-decoration: line-through;
  color: var(--muted);
  font-weight: 600;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.task-customer {
  color: var(--brand-text);
  font-weight: 600;
}

.task-remove {
  flex: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}

.task-remove:hover,
.task-remove:focus-visible {
  color: var(--bad);
  background: var(--bad-soft);
}

/* ---- the collections' board (board.js, owner 1405/07/28: «شبیه trello») ------------------- */

.board-wrap {
  display: grid;
  gap: 12px;
}

.board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
}

.board-title h2 {
  margin: 0;
  font-size: 18px;
}

.board-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 760px;
}

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

.board-tools {
  display: grid;
  gap: 8px;
}

.board-tools .chips,
.board-tabs {
  flex-wrap: wrap;
  overflow-x: visible;
  margin-inline: 0;
  padding-inline: 0;
  gap: 6px;
}

.board-columns {
  display: grid;
  gap: 12px;
  align-items: start;
}

.board-column {
  display: none;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 10px;
  min-width: 0;
  transition: background-color 0.15s;
}

.board-column.current {
  display: block;
}

.board-column.drop-here {
  background: color-mix(in srgb, var(--surface-2) 70%, var(--brand) 12%);
  outline: 2px dashed var(--brand);
  outline-offset: -2px;
}

.board-column > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 10px;
}

.board-column > header h3 {
  margin: 0;
  font-size: 15px;
}

.board-column > header .count {
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.board-cards {
  display: grid;
  gap: 8px;
}

.board-empty {
  margin: 4px;
  color: var(--muted);
  font-size: 13px;
}

@media (min-width: 900px) {
  .board-tabs {
    display: none;
  }

  .board-columns {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .board-column {
    display: block;
  }

  .board-cards {
    max-height: calc(100vh - 230px);
    overflow-y: auto;
    padding-inline-end: 2px;
  }
}

.board-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  display: grid;
  gap: 5px;
  cursor: pointer;
  text-align: start;
}

.board-card:hover,
.board-card:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
  outline-offset: 0;
}

.board-card.watch {
  opacity: 0.72;
  box-shadow: none;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
}

.board-card.dragging {
  opacity: 0.4;
}

.board-card[draggable="true"] {
  cursor: grab;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.board-card .kind,
.card-sheet-head .kind {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.board-card .kind-cheque,
.card-sheet-head .kind-cheque {
  color: var(--brand-text);
}

.board-card .kind-order,
.card-sheet-head .kind-order {
  color: var(--warn);
}

.prio {
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  padding: 1px 7px;
  background: var(--surface-2);
  color: var(--muted);
}

.prio.prio-high {
  background: var(--bad-soft);
  color: var(--bad);
}

.prio.prio-medium {
  background: var(--warn-soft);
  color: var(--warn);
}

.card-title {
  font-size: 14.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.card-line {
  font-size: 13px;
  font-weight: 600;
}

.card-visitor {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.card-visitor .icon {
  color: var(--muted);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-size: 12px;
  color: var(--muted);
}

.card-meta .holder {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-meta .holder.level-visitor {
  color: var(--warn);
  font-weight: 600;
}

.card-meta .when.late {
  color: var(--bad);
  font-weight: 700;
}

.card-badge {
  justify-self: start;
}

.card-last {
  color: var(--muted);
  font-size: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-sheet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}

.card-sheet-head h2 {
  margin: 0;
  flex: 1 1 200px;
}

.card-actions {
  margin: 10px 0 4px;
}

.card-note {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.card-note .btn {
  justify-self: start;
}

.card-debt {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
}

.card-debt summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--brand-text);
}

.card-debt-body {
  margin-top: 8px;
}

.unit-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.unit-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.unit-list li small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.chips.wrap {
  flex-wrap: wrap;
  overflow-x: visible;
}

/* ---- the customers (customers.js, owner 1405/07/29) ------------------------------------- */

.customers {
  display: grid;
  gap: 12px;
}

.work-tabs {
  flex-wrap: wrap;
  overflow-x: visible;
  margin: 0 0 12px;
  padding: 0;
}

.work-tabs .chip[aria-selected="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
}

.customers-sort {
  flex-wrap: wrap;
  overflow-x: visible;
  margin-inline: 0;
  padding-inline: 0;
  gap: 6px;
  align-items: center;
}

.customer-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .customer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1000px) {
  .customer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1300px) {
  .customer-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.customer-box {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  cursor: pointer;
  align-content: start;
}

.customer-box:hover,
.customer-box:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent);
  outline-offset: 0;
}

.customer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}

.customer-who {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.customer-who strong {
  font-size: 14.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.customer-who small {
  color: var(--muted);
  font-size: 12px;
}

.customer-score {
  flex: none;
  display: grid;
  justify-items: center;
  min-width: 64px;
  padding: 4px 8px;
  border-radius: 12px;
  background: var(--surface-2);
}

.customer-score .score-number {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.customer-score small {
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.customer-score.grade-good { background: var(--ok-soft); color: var(--ok); }
.customer-score.grade-fair { background: var(--surface-2); color: var(--text); }
.customer-score.grade-watch { background: var(--warn-soft); color: var(--warn); }
.customer-score.grade-risk { background: var(--bad-soft); color: var(--bad); }

.customer-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 13px;
}

.customer-row span {
  color: var(--muted);
}

.customer-row strong {
  font-weight: 700;
  text-align: end;
}

.customer-row.owes strong {
  color: var(--bad);
}

.customer-phones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.customer-address {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.customer-address .icon {
  flex: none;
  margin-top: 4px;
}

.customers-more {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

/* ---- the prospects (prospects.js, prospects-admin.js; owner 1405/08/03) ------------------- */

.prospect-box {
  cursor: default;
  gap: 8px;
}

.prospect-box:hover {
  outline: none;
}

.prospect-rating {
  flex: none;
  display: grid;
  justify-items: center;
  padding: 4px 8px;
  border-radius: 12px;
  background: var(--warn-soft);
  color: var(--warn);
}

.prospect-rating small {
  font-size: 10.5px;
}

.prospect-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.prospect-images img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface-2);
}

.prospect-customer {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ok);
  text-decoration: none;
}

.prospect-muted {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.prospect-last {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.prospect-last small {
  color: var(--muted);
  font-size: 12px;
}

.prospect-last p,
.prospect-history p {
  flex-basis: 100%;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.prospect-history {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0 18px 0 0;
  font-size: 12.5px;
}

.prospect-history small {
  color: var(--muted);
  margin-inline-start: 6px;
}

.prospect-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.prospect-form {
  display: grid;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.prospect-form textarea {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}

.prospect-outcomes,
.prospect-kinds,
.prospect-results {
  flex-wrap: wrap;
  overflow-x: visible;
  margin-inline: 0;
  padding-inline: 0;
  gap: 6px;
}

.prospect-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: grid;
  gap: 16px;
}

.prospect-section {
  display: grid;
  gap: 8px;
}

.prospect-section + .prospect-section {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.prospect-section h3 {
  margin: 0;
  font-size: 15px;
}

.prospect-areas {
  display: grid;
  gap: 6px;
}

.prospect-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--surface-2);
}

.prospect-area strong {
  flex: 1 1 auto;
}

.prospect-radius {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.prospect-radius input {
  width: 72px;
  font: inherit;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.prospect-person {
  display: grid;
  gap: 6px;
  padding: 8px 0;
}

.prospect-person + .prospect-person {
  border-top: 1px dashed var(--line);
}

.prospect-person-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.prospect-person-head small {
  color: var(--muted);
  flex: 1 1 auto;
}

/* a person's photo in «کاربران» (owner, 1405/08/03: the manager puts it) */
.staff-photo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 700;
  font-size: 20px;
}

.staff-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.staff-title .map-dot {
  display: inline-block;
  margin-inline-end: 6px;
}

/* a row with a photo: the photo's column, not the dot's */
.map-row:has(> .staff-photo) {
  grid-template-columns: 52px 1fr;
}

/* each person's goals for a month, on «کاربران» (owner, 1405/08/03) */
.goals-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.goals-head h2 {
  margin-inline-end: auto;
}

.goals-next .icon {
  transform: scaleX(-1);
}

.goals-scroll {
  overflow-x: auto;
  max-width: 100%;
  margin-block-end: 24px;
}

.goals-table {
  border-collapse: collapse;
  min-width: 720px;
  font-size: 13px;
}

.goals-table th,
.goals-table td {
  padding: 6px;
  border-block-end: 1px solid var(--line);
  text-align: start;
  vertical-align: middle;
}

.goals-table thead th {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.goals-table tbody th small {
  display: block;
  color: var(--muted);
  font-weight: 400;
}

.goal-cell {
  display: grid;
  gap: 2px;
  width: 100%;
  min-width: 96px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  background: var(--surface);
  text-align: start;
}

.goal-cell small {
  color: var(--muted);
  font-size: 11px;
}

.goal-cell.set {
  border-style: solid;
  border-color: var(--brand);
}
