/* ==========================================================================
   GoGetCab design system
   Palette taken from the logo: amber #F7A81B, charcoal #17161A, white.
   Mobile first — every layout starts at 360px and grows from there.
   Amber is a FILL colour only. Amber text on white is ~2:1 contrast and
   fails WCAG, so labels and body copy always use charcoal or --muted.
   ========================================================================== */

/* ==========================================================================
   Inter, variable, Latin subset, OFL. The file was already in public/fonts/ and
   referenced by nothing; this is the single change that most alters how the app reads.

   U+20B9 in the subset is load-bearing: it is the rupee sign, it appears in every
   price, balance and budget in the product, and if it falls outside the range the
   browser silently swaps in a fallback face for that one glyph — so every ₹ renders
   in a different typeface from the digits beside it.
   ========================================================================== */
@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F,
                 U+20B9, U+2212, U+2215;
}

:root {
  /* brand */
  --amber: #f7a81b;
  --amber-600: #e0940c;
  --amber-700: #b5720a;
  --amber-soft: #fff3dc;
  --amber-ring: rgba(247, 168, 27, .3);

  /* charcoal app shell */
  --ink: #17161a;
  --ink-2: #221f26;
  --ink-3: #2e2a33;
  --ink-line: rgba(255, 255, 255, .1);
  --on-ink: #f6f4f1;
  --on-ink-muted: #a9a4b0;

  /* light content surfaces */
  --bg: #f2ece4;                /* L* 93.7 — canvas is the floor */
  --surface: #ffffff;
  --surface-2: #f9f6f1;         /* L* 97.0 — inset, cut into a card */
  --border: #e3dcd1;            /* decorative hairline, never carries state */
  --border-strong: #cfc6b8;     /* alias kept for existing decorative uses */
  --border-input: #857f74;      /* 3.97:1 on white, 3.44:1 on canvas — WCAG 1.4.11 */
  --text: #1b1a1f;
  --muted: #63606a;             /* 5.24:1 on canvas */

  /* status */
  --new: #8a5605;               /* 5.51:1 on --new-soft, was 3.50 */
  --new-soft: #fff1d6;
  --contacted: #37479c;
  --contacted-soft: #eaecfa;
  --converted: #0f7a4d;
  --converted-soft: #e3f6ee;
  --closed: #5a5761;            /* 6.00:1 on --closed-soft, was 4.50 */
  --closed-soft: #efece8;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --wa: #25d366;
  --wa-dark: #1eb255;

  /* shape */
  --r-xs: 8px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --tap: 44px;

  /* Kept as aliases of the ladder above. Deleting them is what would make this
     phase unrevertible, since they are used throughout the file. */
  --shadow-1: var(--e-1);
  --shadow-2: var(--e-2);
  --shadow-3: var(--e-4);

  --topbar-h: 56px;
  --tabbar-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  /* type ------------------------------------------------------------------ */
  --font-sans: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --fs-2xs: .75rem;    /* 12 — badges, micro-labels */
  --fs-xs: .8125rem;   /* 13 — hints, captions, meta */
  --fs-sm: .875rem;    /* 14 — secondary body */
  --fs-base: 1rem;     /* 16 — body */
  --fs-md: 1.0625rem;  /* 17 — card primary line */
  --fs-lg: 1.25rem;    /* 20 — section titles */
  --fs-xl: 1.5rem;     /* 24 — h1 */
  --fs-2xl: 2rem;      /* 32 — secondary figures */
  --fs-3xl: 2.5rem;    /* 40 — hero figure */

  /* Display figures only. A hero number needs its own box with no leading above it. */
  --lh-none: 1;
  --lh-tight: 1.15;
  --lh-snug: 1.35;
  --lh-base: 1.55;

  --fw-body: 400;
  --fw-medium: 500;
  --fw-semi: 600;
  --fw-bold: 700;
  --fw-display: 800;

  --track-display: -.03em;
  --track-tight: -.02em;
  --track-normal: 0;
  --track-caps: .06em;

  /* Stops a balance or count changing width between polls. */
  --num-tabular: tabular-nums;

  /* spacing, 4px base ----------------------------------------------------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;

  /* elevation — one role per level ---------------------------------------- */
  --e-0: none;
  --e-1: 0 1px 2px rgba(23, 22, 26, .05);
  --e-2: 0 1px 2px rgba(23, 22, 26, .05), 0 4px 12px rgba(23, 22, 26, .06);
  --e-3: 0 2px 6px rgba(23, 22, 26, .06), 0 12px 28px rgba(23, 22, 26, .10);
  --e-4: 0 18px 44px rgba(23, 22, 26, .20);

  /* status rail ----------------------------------------------------------- */
  /*
   * The 4px inset edge that states an offer's freshness. Widened from 3px because at 3px
   * on a 2x phone screen it reads as a rendering artifact rather than a deliberate mark.
   *
   * These colours are decorative under WCAG and do not need 3:1: the rail never carries
   * the state on its own. Every card that has a rail also states the same fact in the
   * meta-strip age text and in the badge. That is what makes a 1.99:1 amber rail
   * acceptable where a 1.99:1 amber *label* would not be.
   */
  --rail: 4px;
  /* Narrower rail for list rows, where 4px would crowd a 16px gutter. */
  --rail-sm: 3px;
  --rail-hot: #e5484d;

  /* motion ---------------------------------------------------------------- */
  --dur-1: 120ms;
  --dur-2: 180ms;
  --dur-3: 260ms;
  --ease-out: cubic-bezier(.2, .8, .28, 1);
  --ease-in-out: cubic-bezier(.4, 0, .2, 1);

  /* focus — two-tone so it survives both palettes ------------------------- */
  --focus-ring: var(--ink);
  --focus-ring-dark: var(--amber);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
p { margin: 0; }
a { color: var(--text); text-decoration: none; }
a.underline { text-decoration: underline; text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--amber-600);
  outline-offset: 2px;
  border-radius: 4px;
}

.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }
.strong { font-weight: 700; }
.center { text-align: center; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.tight { gap: 6px; }
.col { display: grid; gap: 10px; }
.spacer { flex: 1; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--surface); color: var(--text); padding: 10px 14px;
  border-radius: var(--r-sm); box-shadow: var(--shadow-2);
}
.skip-link:focus { top: calc(8px + var(--safe-t)); }

/* ---------------------------------------------------------------- app shell */

.topbar {
  background: var(--ink);
  color: var(--on-ink);
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: var(--safe-t);
  box-shadow: 0 1px 0 var(--ink-line);
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  min-height: var(--topbar-h);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; }
.brand-mark {
  width: 32px; height: 32px; flex: none;
  color: #fff; /* the G inherits this */
}
.brand-mark svg { display: block; width: 100%; height: 100%; }
.wordmark {
  font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.03em; white-space: nowrap;
}
.wordmark em { color: var(--amber); font-style: normal; }
.brand-sub {
  display: block; font-size: var(--fs-2xs); font-weight: 500; letter-spacing: .01em;
  color: var(--on-ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 42vw;
}
.tagline {
  font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted);
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 14px calc(28px + var(--safe-b));
}
.page.narrow { max-width: 640px; }
.page-head { margin-bottom: 14px; }
.page-head h1 { margin-bottom: 2px; }

body.has-tabbar .page { padding-bottom: calc(var(--tabbar-h) + 24px + var(--safe-b)); }

/* ------------------------------------------------------------- bottom tabs */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--ink);
  border-top: 1px solid var(--ink-line);
  padding-bottom: var(--safe-b);
}
.tab {
  position: relative;
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: var(--tabbar-h);
  padding: 8px 4px;
  color: var(--on-ink-muted);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: .02em;
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"], .tab.is-active { color: var(--amber); }
.tab[aria-current="page"]::before, .tab.is-active::before {
  content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px;
  background: var(--amber); border-radius: 0 0 3px 3px;
}
.tab-badge {
  position: absolute; top: 6px; left: calc(50% + 8px);
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--amber); color: var(--ink);
  font-size: var(--fs-2xs); font-weight: 800; display: grid; place-items: center;
}

/* -------------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-1);
  padding: 16px;
}
.card + .card, .card + .section-head, .section-head + .card { margin-top: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2, .card-head h3 { min-width: 0; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; }

/* ------------------------------------------------------------- admin tabs */

/*
 * The control room was one continuous scroll of eight cards — platform switches, database
 * snapshots, lead sources, held duplicates, distribution, partners — with nothing marking
 * where one concern ended and the next began. Everything was equally present, which is the
 * same as nothing being prominent, and an operator looking for one partner scrolled past two
 * settings forms and three tables to reach them.
 *
 * Tabs rather than an accordion or a sidebar. Three groups is too few for a sidebar to earn
 * its width on a phone, and an accordion would leave the operator managing eight independent
 * open/closed states instead of picking one of three.
 *
 * The stats strip deliberately stays OUTSIDE the tabs. It is the one thing wanted regardless
 * of what the operator came to do, so it is pinned above the switch rather than becoming a
 * fourth tab nobody would visit.
 */
.adm-tabs {
  display: flex;
  gap: var(--s-1);
  margin: var(--s-5) 0 var(--s-4);
  border-bottom: 1px solid var(--border);
  /*
   * Scrolls rather than wraps. Three labels cannot overflow a desktop, but at 320px they can
   * — and a bar that wraps to two rows moves the panel underneath it every time the active
   * tab changes width, which reads as the page jumping.
   */
  overflow-x: auto;
  scrollbar-width: none;
}

.adm-tabs::-webkit-scrollbar { display: none; }

.adm-tab {
  flex: 0 0 auto;
  min-height: var(--tap);
  padding: 0 var(--s-4);
  background: none;
  border: 0;
  /* Transparent, not absent: the selected tab swaps the colour in, so nothing reflows. */
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.adm-tab:hover { color: var(--ink); }

/*
 * Selected state is carried by aria-selected rather than a class, so the accessible state and
 * the painted state cannot disagree — there is only one attribute to set, and a screen reader
 * and a sighted operator read the same thing.
 */
.adm-tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--amber-600);
}

/*
 * A count beside two of the labels, because "Partners" and "Enquiries" are worth more when
 * they say how much is behind them — and because it means the numbers an operator checks most
 * are legible without opening either tab.
 */
.adm-tab-count {
  margin-left: var(--s-2);
  font-size: var(--fs-2xs);
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: var(--num-tabular);
}

.adm-panel { display: block; }

.hero {
  background: linear-gradient(160deg, var(--ink) 0%, #2b2531 100%);
  color: var(--on-ink);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--e-3);
}
.hero .muted { color: var(--on-ink-muted); }
.hero-value { font-size: var(--fs-3xl); font-weight: var(--fw-display); letter-spacing: var(--track-display); line-height: var(--lh-none); }
.hero-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.hero-chip {
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
}
.hero-chip b { color: var(--amber); }

.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
/*
 * For counts that aren't a multiple of two or four — the admin's five tiles.
 *
 * That count was accurate, then briefly wasn't: the row grew to twelve and this comment was
 * left behind. It is back to five, and the auto-fit track is why no breakpoint had to change
 * either time: at a 138px floor the row fits five across on a desktop, three on a tablet and
 * two on a phone without being told to.
 */
.stats.auto { grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow-1);
}
.stat-label {
  font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 700;
}
.stat-value { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.03em; margin-top: 2px; }

/* --------------------------------------------------------------------- form */

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-weight: 600; font-size: var(--fs-sm); margin-bottom: 6px; }
.hint { color: var(--muted); font-size: var(--fs-xs); margin-top: 6px; }

input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 13px;
  font: inherit;
  font-size: 16px; /* keeps iOS from zooming on focus */
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%236d6a74' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--amber-600);
  box-shadow: 0 0 0 3px var(--amber-ring);
}
input::placeholder, textarea::placeholder { color: #a5a1aa; }
textarea { min-height: 84px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.error { color: var(--danger); font-size: var(--fs-xs); margin-top: 5px; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: #e07b74;
  background: #fffafa;
}

/* chip radios (trip type, vehicle) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input {
  position: absolute; inset: 0; opacity: 0; margin: 0; min-height: 0; cursor: pointer;
}
.chip span {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 14px;
  /*
   * --border-input, not --border-strong. A chip is an interactive control, so WCAG 1.4.11
   * wants its boundary at 3:1 against the surface behind it; --border-strong is a
   * decorative hairline at 1.6:1 and is most of why these amount chips look unfinished.
   */
  border: 1px solid var(--border-input); border-radius: var(--r-pill);
  background: var(--surface); font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--text);
  transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), color var(--dur-2) var(--ease-out);
}
.chip input:checked + span {
  background: var(--amber); border-color: var(--amber); color: var(--ink);
}
.chip input:focus-visible + span { outline: 2px solid var(--amber-600); outline-offset: 2px; }

/* document picker (verification step 1) — two up on a phone, four across on desktop */
.doc-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.doc-opt { position: relative; }
.doc-opt input {
  position: absolute; inset: 0; opacity: 0; margin: 0; min-height: 0; cursor: pointer;
}
.doc-opt span {
  display: flex; flex-direction: column; gap: 2px; height: 100%;
  min-height: 62px; padding: 10px 12px;
  /* Interactive control: 3:1 against the surface, not a decorative hairline. */
  border: 1px solid var(--border-input); border-radius: var(--r-sm);
  background: var(--surface);
  transition: background var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out);
}
.doc-opt span b { font-size: var(--fs-sm); font-weight: 700; color: var(--text); }
.doc-opt span em { font-style: normal; font-size: var(--fs-2xs); line-height: 1.3; color: var(--muted); }
.doc-opt input:checked + span {
  border-color: var(--amber); background: var(--amber-ring); box-shadow: inset 0 0 0 1px var(--amber);
}
.doc-opt input:checked + span em { color: var(--text); }
.doc-opt input:focus-visible + span { outline: 2px solid var(--amber-600); outline-offset: 2px; }

/*
 * document review (admin) — one block per uploaded file.
 *
 * An inset rather than a card: these sit inside the review panel's card, so they take
 * --surface-2 to stay one step down the ladder from it.
 */
.doc-review {
  display: grid; gap: 2px;
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface-2);
}
.doc-review + .doc-review { margin-top: var(--s-3); }
/*
 * Capped in both directions. A licence photo off a modern phone is several thousand
 * pixels wide, and an uncapped one would push the decision buttons off the screen —
 * which is the opposite of what this panel is for.
 */
.doc-shot {
  display: block; max-width: 100%; max-height: 420px; height: auto;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
}

/* the two ways to supply a document */
.fetch-box {
  position: relative; padding: 14px;
  /*
   * --border-input rather than --border. Each of these boxes is a whole route the partner
   * chooses between, and at 1.6:1 the two options blurred into the page — which is most of
   * why the verification step looked like a prototype.
   */
  border: 1px solid var(--border-input); border-radius: var(--r-sm); background: var(--surface-2);
}
.fetch-box.recommended { border-color: var(--amber); background: var(--surface); }
.fetch-tag {
  position: absolute; top: -9px; right: 12px;
  padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--amber); color: var(--ink);
  font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
}
.or-split { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.or-split::before, .or-split::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.or-split span {
  font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}

/* one upload row, for the chosen document only */
.up-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.up-row .up-state { font-size: var(--fs-xs); color: var(--muted); min-width: 0; flex: 1; }
.up-row .up-state.ok { color: var(--converted); font-weight: 600; }
.up-row .up-state.bad { color: var(--danger); }

/* switch */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input {
  position: absolute; opacity: 0; width: 0; height: 0; min-height: 0; padding: 0; margin: 0; border: 0;
}
.switch-track {
  width: 48px; height: 28px; flex: none; border-radius: var(--r-pill);
  /*
   * The off state needs a visible boundary of its own. A bare --border-strong fill at
   * 1.6:1 against the card left the switch reading as absent rather than as off.
   */
  background: var(--surface-2); border: 1px solid var(--border-input);
  position: relative; transition: background var(--dur-2) var(--ease-out);
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .18s;
}
.switch input:checked + .switch-track { background: var(--amber); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--amber-600); outline-offset: 2px; }

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 11px 18px;
  font: inherit; font-weight: 700; line-height: 1.2; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--amber); color: var(--ink);
  transition: background .15s, transform .04s, box-shadow .15s, border-color .15s;
  text-align: center;
}
.btn:hover { background: var(--amber-600); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }

.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--muted); }

.btn.dark { background: var(--ink); color: var(--on-ink); }
.btn.dark:hover { background: var(--ink-3); }

.btn.on-dark {
  background: rgba(255, 255, 255, .08); color: var(--on-ink); border-color: var(--ink-line);
}
.btn.on-dark:hover { background: rgba(255, 255, 255, .16); }

.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: #f3c9c5; }
.btn.danger:hover { background: #fbdcd9; }

.btn.sm { min-height: 38px; padding: 8px 14px; font-size: var(--fs-sm); }
.btn.wa { background: var(--wa); color: #06331a; font-size: var(--fs-base); min-height: 52px; }
.btn.wa:hover { background: var(--wa-dark); }
.btn.link {
  background: none; border: none; color: var(--muted); min-height: 36px;
  padding: 6px 4px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px;
}
.btn.link:hover { background: none; color: var(--text); }

.icon-btn {
  position: relative;
  width: var(--tap); height: var(--tap); flex: none;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .08); color: var(--on-ink);
  border: 1px solid var(--ink-line); border-radius: var(--r-sm);
  cursor: pointer; font: inherit;
}
.icon-btn:hover { background: rgba(255, 255, 255, .16); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.light {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
}
.icon-btn.light:hover { background: var(--surface-2); }
.bell-dot {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--amber); color: var(--ink);
  font-size: var(--fs-2xs); font-weight: 800; display: grid; place-items: center;
}

/* ------------------------------------------------------------------- badges */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: var(--r-pill);
  font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap;
}
.badge.NEW, .badge.ASSIGNED { background: var(--new-soft); color: var(--new); }
.badge.CONTACTED { background: var(--contacted-soft); color: var(--contacted); }
.badge.CONVERTED { background: var(--converted-soft); color: var(--converted); }
.badge.CLOSED { background: var(--closed-soft); color: var(--closed); }
.badge.solid { background: var(--amber); color: var(--ink); }
.badge.dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

/* segmented filter (tablist) */
.segmented {
  display: flex; gap: 6px; overflow-x: auto; padding: 3px;
  /*
   * The track sits on the canvas, and --surface-2 is only 3.7 L* away from it, so on a
   * dim phone screen outdoors the control loses its edge entirely. --surface plus a
   * --border-input outline is the same treatment the search field gets, and for the same
   * reason: this is an interactive control, so WCAG 1.4.11 wants 3:1 against what is
   * behind it, not a decorative hairline.
   */
  background: var(--surface); border: 1px solid var(--border-input);
  border-radius: var(--r-pill); scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  flex: 1 0 auto; min-height: 38px; padding: 8px 16px;
  background: none; border: none; border-radius: var(--r-pill);
  font: inherit; font-size: var(--fs-sm); font-weight: 700; color: var(--muted);
  cursor: pointer; white-space: nowrap;
}
.segmented button[aria-selected="true"] {
  background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-1);
}

/* --------------------------------------------------------------- lead cards */

.lead-list { display: grid; gap: 10px; }

.lead-card {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  box-shadow: var(--e-1);
  color: inherit;
  transition: box-shadow var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
.lead-card:active { transform: scale(.995); }
.lead-card:hover { border-color: var(--border-strong); box-shadow: var(--e-2); }
/*
 * An enquiry somebody else bought. Still listed, never filtered out, and now marked harder
 * than the 62% wash that was the whole treatment.
 *
 * The wash was the problem, not the fix: at .62 the badge faded with everything else, so the
 * one element stating the fact in words was the hardest thing on the card to read. Three
 * marks replace it, only one of which is colour — a --closed rail, the same inset-shadow
 * device --is-new and --is-hot use; a --closed-soft fill, within half an L* of the canvas, so
 * the card recedes into the page rather than reading as a live surface; and the line-through
 * kept from before, which is the cue that survives greyscale and a phone in direct sun.
 * --border-strong keeps the edge defined, since a card with no outline reads as a fault.
 * The :hover rule above is equal specificity and earlier, so the rail holds on hover.
 */
.lead-card.is-soldout {
  background: var(--closed-soft);
  border-color: var(--border-strong);
  box-shadow: var(--e-1), inset var(--rail) 0 0 var(--closed);
}
.lead-card.is-soldout .lead-primary { text-decoration: line-through; }
/*
 * The badge states the fact in words, so it gets heavier where the card gets quieter.
 * Inverted rather than retinted: --closed on --surface is 7.07:1 against 6.00:1 for the
 * --closed-soft pill, which is now the same fill as the card behind it and so has no edge.
 * Scoped to the card on purpose — .badge.CLOSED also marks Paused, Snoozed, Invite expired
 * and KYC rejected in admin, where a solid fill would shout over informational rows.
 */
.lead-card.is-soldout .badge.CLOSED {
  background: var(--closed);
  color: var(--surface);
}

/*
 * The 4px rail states freshness. It is a decorative low-contrast amber and that is
 * acceptable under WCAG only because the same fact is always stated in the meta strip
 * text and in the badge — the colour never carries the state on its own.
 */
.lead-card.is-new {
  border-color: #f2d9a5;
  box-shadow: var(--e-1), inset var(--rail) 0 0 var(--amber);
}
.lead-card.is-hot { box-shadow: var(--e-1), inset var(--rail) 0 0 var(--rail-hot); }

.lead-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.age { font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .02em; color: var(--muted); }
.age.hot { color: #c22b2f; }
.lead-name { font-size: var(--fs-md); font-weight: 700; letter-spacing: -.02em; }

/* pickup -> drop route line */
.route { display: grid; gap: 4px; margin: 10px 0; }
.route-line { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); min-width: 0; }
.route-line b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pip { width: 9px; height: 9px; border-radius: 50%; flex: none; border: 2px solid var(--muted); }
.pip.to { border-color: var(--amber-600); background: var(--amber); }

.facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.fact {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-xs); padding: 5px 9px;
  font-size: var(--fs-xs); color: var(--text);
}
.fact b { font-weight: 700; }
.fact.money b { font-variant-numeric: tabular-nums; }

.lead-actions { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* ------------------------------------------------------------ detail layout */

.detail-list { display: grid; }
.detail-row {
  display: grid; grid-template-columns: 1fr; gap: 2px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.detail-row:first-child { padding-top: 0; }
.detail-row:last-child { border-bottom: none; padding-bottom: 0; }
.detail-row dt { color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.detail-row dd { margin: 0; font-weight: 600; }

.preview {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 12px 14px;
  font-size: var(--fs-sm); color: #3a3740; white-space: pre-wrap; word-break: break-word;
}

.sticky-cta {
  position: sticky; bottom: 0; z-index: 20;
  padding: 12px 0 calc(12px + var(--safe-b));
  background: linear-gradient(180deg, rgba(250, 248, 245, 0) 0%, var(--bg) 40%);
}

/* ------------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th, td { padding: 10px 12px; text-align: left; white-space: nowrap; }
th {
  font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); border-bottom: 1px solid var(--border); font-weight: 700;
}
tbody tr { border-bottom: 1px solid var(--surface-2); }
tbody tr:last-child { border-bottom: none; }
td.mono { font-variant-numeric: tabular-nums; color: var(--muted); }

/* Card list that replaces a table on small screens (built by JS). */
.row-cards { display: grid; gap: 10px; }
.row-card {
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px; background: var(--surface);
}
.row-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.row-card dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; }
.row-card dt { color: var(--muted); font-size: var(--fs-xs); }
.row-card dd { margin: 0; font-size: var(--fs-sm); font-weight: 600; }

/* ------------------------------------------------------- connection banner */

.conn-banner {
  position: fixed;
  left: 0; right: 0;
  top: calc(var(--safe-t) + var(--topbar-h));
  z-index: 25;
  padding: 9px 14px;
  background: #3a2f14;
  color: #ffe6b0;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-1);
}

/* ------------------------------------------------------------ setup wizard */

.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.step-pip {
  flex: 1; height: 5px; border-radius: var(--r-pill); background: var(--border);
  /*
   * The current step's pip grows rather than only changing colour, so progress is legible
   * as shape and not by hue alone. Transitioning flex-grow keeps the three pips filling the
   * row exactly — animating width instead would leave a gap mid-transition.
   */
  transition: flex-grow var(--dur-1) var(--ease-out), background var(--dur-1) var(--ease-out);
}
.step-pip.done { background: var(--amber); }
.step-pip.now { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-ring); flex-grow: 1.8; }
.step-count {
  font-size: var(--fs-2xs); font-weight: var(--fw-display); letter-spacing: var(--track-caps);
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}

.wizard-actions {
  display: grid; grid-template-columns: 1fr; gap: 8px;
  margin-top: 18px;
}

/* ----------------------------------------------------- copyable invite link */

.copy-row { display: flex; gap: 8px; align-items: stretch; }
.copy-row input {
  font-size: var(--fs-sm); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-2);
}

/* ------------------------------------------------------------- danger zone */

.danger-zone {
  margin-top: var(--s-6); padding: 14px;
  border: 1px solid #f3c9c5; border-radius: var(--r); background: #fffafa;
  /*
   * Keeps the red framing but sits at the lowest elevation. Account deletion is the least
   * likely thing a partner came here to do, and at --e-2 it was competing for attention
   * with the cards above it.
   */
  box-shadow: var(--e-1);
}
.danger-zone h3 { color: var(--danger); }

/* -------------------------------------------------------- notices & empties */

.notice {
  border-radius: var(--r-sm); padding: 12px 14px; font-size: var(--fs-sm);
  border: 1px solid transparent;
}
.notice.info { background: var(--amber-soft); color: #6b4a05; border-color: #f4e0b8; }
.notice.bad { background: var(--danger-soft); color: var(--danger); border-color: #f3c9c5; }
.notice.ok { background: var(--converted-soft); color: var(--converted); border-color: #c2e8d6; }

.empty {
  display: grid; gap: 8px; justify-items: center;
  padding: 34px 18px; text-align: center; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--r);
}
.empty-mark {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--amber-soft); color: var(--amber-700);
}
.empty-mark svg { width: 24px; height: 24px; }

/* ---------------------------------------------------------------- skeletons */

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, #eee9e2 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--r-xs);
}
.sk-line { height: 12px; margin-bottom: 8px; }
.sk-line.w-40 { width: 40%; }
.sk-line.w-60 { width: 60%; }
.sk-line.w-80 { width: 80%; }
.sk-btn { height: 38px; width: 120px; border-radius: var(--r-sm); margin-top: 12px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ------------------------------------------------------- sheets and toasts */

.scrim {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(23, 22, 26, .5);
  animation: fade .16s ease-out;
}
.sheet {
  position: fixed; z-index: 46;
  left: 0; right: 0; bottom: 0;
  max-height: 78vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-3);
  padding-bottom: var(--safe-b);
  animation: rise .2s ease-out;
}
.sheet-grab {
  width: 40px; height: 4px; border-radius: var(--r-pill);
  background: var(--border-strong); margin: 10px auto 2px;
}
.sheet-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.sheet-body { overflow-y: auto; overscroll-behavior: contain; }

.notif-item {
  display: block; padding: 13px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; color: inherit;
  /* Read rows sit on the card surface; unread lifts to the amber wash below. */
  background: var(--surface);
  /*
   * The rail is declared transparent here so an unread row only changes its colour, not its
   * box. Setting the border on .unread alone would shift every unread row 3px to the right
   * and make the list jitter as alerts are read.
   */
  border-left: var(--rail-sm) solid transparent;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }

/*
 * Unread is stated twice on purpose: the wash and the rail. The wash alone is a ~1.05:1
 * difference against the card — invisible on a dim phone screen outdoors, which is exactly
 * where a partner reads these.
 */
.notif-item.unread { background: var(--amber-soft); border-left-color: var(--amber); }

.notif-item .t { font-weight: var(--fw-bold); font-size: var(--fs-sm); }
.notif-item .b { color: var(--muted); font-size: var(--fs-sm); }
.notif-item .notif-when { color: var(--muted); font-size: var(--fs-xs); }

.toast-stack {
  position: fixed; z-index: 60;
  left: 12px; right: 12px;
  bottom: calc(12px + var(--safe-b));
  display: grid; gap: 8px;
}
body.has-tabbar .toast-stack { bottom: calc(var(--tabbar-h) + 12px + var(--safe-b)); }
.toast {
  background: var(--ink); color: var(--on-ink);
  border-left: 4px solid var(--amber);
  border-radius: var(--r-sm); padding: 12px 14px;
  box-shadow: var(--shadow-3); animation: rise .18s ease-out; cursor: pointer;
}
.toast .small, .toast .muted { color: var(--on-ink-muted); }
.toast.ok { border-left-color: var(--wa); }
.toast.bad { border-left-color: #e5484d; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* -------------------------------------------------------------- login page */

.auth-wrap {
  min-height: 100dvh;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  max-width: 440px; margin: 0 auto;
}
.auth-logo {
  display: grid; justify-items: center; gap: 10px; text-align: center;
  padding: 8px 0 4px;
}
.auth-logo img {
  width: 100%; max-width: 260px; height: auto; display: block;
  mix-blend-mode: multiply; /* the source JPEG has a white background */
}

/*
 * The demo credential list that used to sit under the sign-in card is gone
 * deliberately, not mislaid, and its four rules went with it. It printed real
 * username/password pairs into the markup of a public page, and a query parameter
 * un-hid them for any visitor whether or not the server flag was set. The selectors
 * are not named here on purpose: page-smoke.mjs greps login.html and this stylesheet
 * for those exact strings as a credential-disclosure guard, and a comment naming them
 * is the one thing that could make that guard argue with itself.
 */

/* --------------------------------------------------------------- free trial */

/*
 * The trial offer, on the sign-in card and on the wallet screen.
 *
 * Amber on amber-soft rather than the green of `.notice.ok`: an offer is not a
 * success message, and a partner arriving at a sign-in page has not done anything
 * to succeed at yet. It reads as the brand talking, which is what it is.
 *
 * Every one of these starts hidden in the markup and is un-hidden by script once
 * the numbers have actually arrived. A trial band that renders before its content
 * would flash an empty amber box on the first paint of the most important page we
 * have, and a band promising "0 free leads" is worse than no band at all.
 */
.trial-band {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--amber);
  border-radius: var(--r);
  background: var(--amber-soft);
}

/*
 * The figure, not a decorative icon. A partner skimming the page should be able to
 * take the offer from this alone, which is why it carries the number rather than
 * sitting next to one.
 */
.trial-band-badge {
  flex: none;
  display: grid;
  place-items: center;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 var(--s-2);
  border-radius: var(--r-sm);
  background: var(--amber);
  color: var(--ink);
  font-size: var(--fs-lg);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.trial-band-copy { display: grid; gap: 2px; }
.trial-band-title {
  margin: 0;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--amber-700);
}
/*
 * `--text`, not `--muted`. This line carries the terms of the offer — what runs out
 * and when — and the one sentence a partner most needs to be able to read is not the
 * one to set in the low-contrast colour.
 */
.trial-band-note {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--text);
}

/* ------------------------------------------------------------ profile page */

.profile-head {
  display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center;
}
.avatar {
  width: 58px; height: 58px; border-radius: var(--r); flex: none;
  display: grid; place-items: center;
  background: var(--amber); color: var(--ink);
  font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.02em;
}
.avatar.lg { width: 72px; height: 72px; font-size: var(--fs-2xl); }

.kv { display: grid; gap: 10px; }
.kv-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--border);
}
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--muted); font-size: var(--fs-sm); }
.kv-row .v { font-weight: 600; margin-left: auto; text-align: right; word-break: break-word; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 5px 11px; font-size: var(--fs-xs); font-weight: 600;
}

.meter { height: 8px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--amber); border-radius: inherit; }

.session-row {
  display: grid; gap: 2px; padding: 11px 0; border-bottom: 1px solid var(--border);
}
.session-row:last-child { border-bottom: none; }

/* -------------------------------------------------------------- responsive */

@media (min-width: 560px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .doc-picker { grid-template-columns: repeat(4, 1fr); }
  .metrics, .stats { grid-template-columns: repeat(4, 1fr); }
  .toast-stack { left: auto; right: 16px; width: min(360px, calc(100vw - 32px)); }
  .wizard-actions { grid-template-columns: auto auto; justify-content: space-between; }
}

@media (min-width: 760px) {
  body { font-size: var(--fs-base); }
  h1 { font-size: var(--fs-2xl); }
  .page { padding: 22px 20px calc(40px + var(--safe-b)); }
  .card { padding: 18px; }
  .detail-row { grid-template-columns: 170px 1fr; gap: 12px; align-items: baseline; }
  .brand-sub { max-width: none; }
  .row-cards { display: none; }          /* wide screens get the real table */
  .lead-actions { grid-template-columns: auto auto; justify-content: start; }
  .hero { padding: 22px; }
  .hero-value { font-size: var(--fs-3xl); }
  .auth-wrap { max-width: 460px; padding-top: 40px; }

  /* the tab bar is a phone pattern; on desktop the topbar links are enough */
  .tabbar { display: none; }
  body.has-tabbar .page { padding-bottom: calc(40px + var(--safe-b)); }
  body.has-tabbar .toast-stack { bottom: 16px; }
}

@media (max-width: 759px) {
  .table-wrap { display: none; }         /* phones get .row-cards instead */
  .desktop-only { display: none !important; }
}

@media (min-width: 760px) {
  .mobile-only { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  /*
   * Killing the shimmer without this leaves .skeleton as a static gradient slab,
   * which reads as a rendering bug rather than a deliberate placeholder.
   */
  .skeleton { background: var(--surface-2); animation: none; }

  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .topbar, .tabbar, .sticky-cta, .toast-stack { display: none !important; }
}

/* ------------------------------------------------------------ tabular figures */
/*
 * Structural rather than remembered: every number the app renders goes through
 * figure() and lands inside one of these. ₹1,000 and ₹950 differ by several pixels
 * per digit in proportional figures, which is what makes a polling balance twitch.
 */
.figure,
.mono,
.hero-value,
.stat-value,
.badge,
td.mono,
.fact.money b {
  font-variant-numeric: var(--num-tabular);
}

/* ------------------------------------------------------------ spacing helpers */
/*
 * Nine tokens and a dozen utilities, not a framework. These exist to retire the
 * inline style="margin-top:12px" attributes in the markup — the current values are
 * 6, 8, 10, 12, 14 and 18px, four of which are off any grid.
 */
.mt-1 { margin-top: var(--s-1); }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-6 { margin-bottom: var(--s-6); }
.m-0 { margin: 0; }

/*
 * Deliberately `d-block` and not `block`. `.btn.block` already means "full width" on this
 * codebase, and a bare `.block { display: block }` declared later in the file would win
 * the cascade against `.btn { display: inline-flex }` and flatten every full-width button
 * in the app.
 */
.d-block { display: block; }

/* Lets a flex/grid child ellipsis its text instead of forcing the row wider. */
.min-w-0 { min-width: 0; }

.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.stack { display: grid; gap: var(--s-3); }

/* ------------------------------------------------------------------ next step */
/*
 * One card, replacing five stacked .notice boxes.
 *
 * It reads as a card that out-ranks the enquiry cards below it rather than as another
 * tinted alert box, and that ranking is carried by elevation and type — --e-3 exists for
 * precisely this — instead of by adding more colour to the screen. A left rail states
 * severity: red for something stopping delivery, amber for something worth doing.
 */
.next-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--amber);
  border-radius: var(--r);
  padding: var(--s-4);
  box-shadow: var(--e-3);
}

.next-step.is-stop { border-left-color: var(--danger); }
.next-step.is-improve { border-left-color: var(--amber); }

.next-step b { font-size: var(--fs-md); font-weight: var(--fw-bold); letter-spacing: var(--track-tight); }
.next-step .small { color: var(--muted); margin-top: var(--s-1); }
.next-step .btn { flex: none; }

/*
 * Paused is a state, not a task, so it is one always-visible line rather than a box that
 * competes for the card. That is what lets a slower problem take the card without the
 * partner ever losing sight of being paused.
 */
.step-strip {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--danger);
  margin-bottom: var(--s-2);
}

.step-strip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  flex: none;
}

.step-strip a { color: var(--danger); text-decoration: underline; }

/* Deprioritised items: quiet text links, no tint and no box, so they inform without nagging. */
.step-extra {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: var(--s-2);
}

.step-extra:empty { display: none; }
.step-extra a { color: var(--muted); text-decoration: underline; }
.step-extra a:hover { color: var(--text); }

/* --------------------------------------------------------- hero zero-data state */
/*
 * A partner with no history at all gets a sentence instead of a giant 0. The zero is not
 * hidden once there is any history — at that point it honestly means "nothing open right
 * now" rather than "this product is empty".
 */
.hero-value.is-waiting {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semi);
  letter-spacing: var(--track-normal);
  line-height: var(--lh-snug);
  color: var(--on-ink);
}

/* Matches the hero figure's box so the skeleton does not resize the header on load. */
.skeleton.sk-hero {
  display: inline-block;
  width: 3.2ch;
  height: 1em;
  border-radius: var(--r-xs);
  vertical-align: -.08em;
}

/* ----------------------------------------------------------- enquiry card body */
/*
 * Whichever element leads the card, in whichever mode. On an offer that is the route,
 * because the customer's name is not actionable until the lead is claimed; on a claimed
 * enquiry it is the customer, and the route demotes to context.
 */
.lead-primary {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  letter-spacing: var(--track-tight);
  line-height: var(--lh-snug);
  /* One line. A long route pushing the price button off screen is worse than an ellipsis. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-arrow { color: var(--amber-600); font-weight: var(--fw-bold); padding: 0 2px; }

.lead-sub {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text);
  margin-top: 2px;
}

.lead-route {
  margin-top: var(--s-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * The primary line and its sub-lines are one shrinkable block, so the age and the #id can
 * sit to the right of them in .lead-top. min-width: 0 is what lets .lead-primary's
 * ellipsis engage at all: a flex item defaults to min-width: auto and refuses to shrink
 * below its content, so a long route would push the age clean off the card instead.
 */
.lead-main { min-width: 0; }

/*
 * One row below the primary line, carrying exactly three things: state, date, action.
 * The passengers, vehicle and budget chips used to live here and none of them changed
 * whether a partner bought the enquiry — they only competed with the button that did.
 */
.lead-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

/* The travel date: the one remaining fact that decides whether an enquiry is worth buying. */
.lead-when { font-size: var(--fs-xs); color: var(--text); }

/*
 * Marked so "exactly one primary action per card" can be verified by counting rather than
 * by reading. There is deliberately no styling here — the class exists for the property
 * test and for anyone reasoning about the card's anatomy.
 */
.is-primary-action { /* no visual change; a hook for verification */ }

/* Freshness leads the meta strip, so it needs to read as status rather than as a footnote. */
.lead-top .age { font-size: var(--fs-xs); font-weight: var(--fw-semi); }

/* The overflow counter when a card carries more fact chips than fit one row. */
.fact.more { font-weight: var(--fw-semi); color: var(--muted); }

/* ---------------------------------------------------------------- wallet ledger */
/*
 * Amounts align on their decimal, which is the whole point of a ledger — a column you can
 * scan for the big number. Needs both tabular figures (from .figure) and right alignment.
 */
.num { text-align: right; }
th.num { text-align: right; }

.ledger-note { display: block; }

.ledger-amount { font-weight: var(--fw-semi); }

/*
 * Credits and debits are distinguished by their sign first and colour second. Around one
 * man in twelve cannot separate this green from this grey, so the + and − do the work and
 * the colour only reinforces it.
 */
.delta-up { color: var(--converted); }
.delta-down { color: var(--text); }

/* The ₹ mark in the wallet's empty state, in place of an icon we have no asset for. */
.empty-mark b { font-size: var(--fs-lg); font-weight: var(--fw-display); }

/* ------------------------------------------------------------------ profile */
/*
 * The avatar initials are the largest text on the screen after the business name, so they
 * carry display weight and tracking rather than inheriting body settings.
 */
.avatar { font-weight: var(--fw-display); letter-spacing: var(--track-tight); }
.avatar.lg { font-size: var(--fs-xl); }

/*
 * Header wordmark on the enquiry detail page, which reads "Enquiry #1042" rather than the
 * brand. A step down from the brand wordmark so it does not compete with it.
 */
.wordmark.sm { font-size: var(--fs-base); }

/* The caption that stops a row of honest zeros reading as a fault. */
.metrics-caption { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--s-2); }

/* ------------------------------------------------------- wizard sticky actions */
/*
 * Step 2 is the longest form in the app: five fields plus the vehicle chips. On a phone the
 * Continue button sat below the fold, so finishing setup meant scrolling back down to a
 * button you could no longer see. Sticking it to the bottom of the viewport puts it in
 * thumb reach for the whole scroll.
 *
 * Phones only. Above 760px the form fits and a floating bar would be noise.
 *
 * The negative margins bleed the bar to the card's edges (the card pads 16px on phones) and
 * the bottom corners are rounded to match, so it reads as part of the card rather than a
 * strip laid over it. There is no tab bar on this page, but --safe-b is still respected so
 * the bar clears the home indicator on a notched handset.
 */
@media (max-width: 759px) {
  .wizard-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin: var(--s-6) calc(-1 * var(--s-4)) calc(-1 * var(--s-4));
    padding: var(--s-3) var(--s-4) calc(var(--s-3) + var(--safe-b));
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--r) var(--r);
    box-shadow: var(--e-3);
  }
}


/* ------------------------------------------------------------- lead detail */
/*
 * The sticky CTA container is a gradient fade, so the elevation belongs on the button
 * inside it rather than on the container — a shadow cast by a transparent gradient reads
 * as a smudge. --e-3 is the same level the next-step card uses: it lifts above the cards
 * it scrolls over without becoming another tinted box.
 */
.sticky-cta .btn { box-shadow: var(--e-3); }

/* ------------------------------------------------------------------- admin */
/*
 * A flush card drops its own padding so a table can run edge to edge, which leaves any
 * child that is not a table sitting hard against the card border. These two put the inset
 * back on the only two children that need it. Written as descendant rules rather than as
 * .p-3 / .p-4 utilities because a bare .p-4 would outrank .empty's own 34px padding
 * everywhere it was ever used — the same cascade collision .d-block exists to avoid.
 */
.card.flush > .empty { padding: var(--s-4); }
.card.flush > .row-cards { padding: var(--s-3); }

/* --------------------------------------------------------------- filter row */
/*
 * From / to / received, above the enquiry list. Replaces the segmented tab strip, which was
 * a horizontal scroller of five one-word buttons whose selected state was the only thing
 * telling a partner what the list contained.
 *
 * Two columns on a phone with Received spanning both, three across from 560px. The two
 * cities pair naturally and are the ones typed together; Received is a single tap and reads
 * better full width than squeezed into a third of a 360px screen.
 */
.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--s-3);
  margin-bottom: var(--s-3);
}
.filter-row .field { margin-bottom: var(--s-3); }
.filter-row .field:last-child { grid-column: 1 / -1; margin-bottom: 0; }
/*
 * Micro-labels, the same treatment as the wizard's step counter. These sit above controls
 * whose placeholder reads "Any", so the label is what says which end of the trip it is —
 * it cannot be dropped in favour of the placeholder alone.
 */
.filter-row label {
  font-size: var(--fs-2xs);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s-1);
}
@media (min-width: 560px) {
  .filter-row { grid-template-columns: 1fr 1fr 1fr; }
  .filter-row .field:last-child { grid-column: auto; }
}

/* --------------------------------------------------------------- alerts gate */
/*
 * The first-run alerts gate on /dashboard. Blocking on purpose: an enquiry goes to several
 * partners at once and the first few to accept get it, so a partner who cannot be told one
 * arrived does not miss a notification, they miss the work.
 *
 * z-index sits above the toast stack at 60. A toast is the app talking; while this is up the
 * app has nothing else to say, and a notification sliding over a modal that cannot be
 * dismissed would look like a way out that isn't one.
 *
 * The dark surface is the same --ink / --on-ink pair the toast and the topbar use, so the
 * gate reads as the app rather than as a browser dialog. Both text pairs on it are already
 * asserted at 4.5:1 or better by tools/ui-check.mjs.
 */
.gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-5);
  /*
   * Opaque enough that the list behind it is not readable. A translucent scrim would leave
   * enquiries legible but untappable, which reads as a broken page rather than as a
   * deliberate stop.
   */
  background: rgba(23, 22, 26, .92);
  /* Stops a scroll gesture on the overlay chaining through to the page underneath. */
  overscroll-behavior: contain;
  animation: fade var(--dur-2) var(--ease-out);
}

/*
 * The page itself stops scrolling while the gate is up. Without this the list scrolls behind
 * the overlay on a phone, so the one thing the gate is meant to prevent — using the app
 * without alerts — is still half-possible.
 */
body.gate-open { overflow: hidden; }

.gate-card {
  width: 100%;
  max-width: 400px;
  padding: var(--s-6);
  text-align: center;
  background: var(--ink);
  color: var(--on-ink);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-lg);
  box-shadow: var(--e-4);
}

.gate-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--s-3);
  border-radius: var(--r-pill);
  background: var(--amber-soft);
  color: var(--ink);
}
.gate-mark svg { width: 24px; height: 24px; }

.gate-card h2 {
  margin: 0 0 var(--s-2);
  font-size: var(--fs-lg);
  font-weight: var(--fw-bold);
  letter-spacing: var(--track-tight);
  line-height: var(--lh-tight);
}

.gate-body {
  margin: 0 0 var(--s-5);
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  color: var(--on-ink-muted);
  text-align: left;
}

/*
 * The recovery steps shown after a browser-level refusal. A list rather than a sentence,
 * because it is a sequence a partner has to perform in another app's settings and prose is
 * the wrong shape for that.
 */
.gate-body ol { margin: var(--s-2) 0 0; padding-left: var(--s-5); }
.gate-body li { margin-bottom: var(--s-1); }

.gate-hint {
  margin: var(--s-3) 0 0;
  font-size: var(--fs-xs);
  color: var(--on-ink-muted);
}
