/* TC Agent portal — orange/amber theme, light + dark, mobile-first with a real
   desktop layout. No external assets: system fonts, inline SVG icons, and the
   charts are hand-drawn SVG. That is deliberate — the portal must make zero
   third-party requests, so a CDN chart library is not an option. Structure
   mirrors scripts/ts/staff/web/app.css so the two panels feel like one product. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
  --nav-h: 62px;
  --top-h: 58px;
  --gap: 12px;
}
@media (min-width: 720px)  { :root { --gap: 14px; } }
@media (min-width: 1024px) { :root { --gap: 18px; } }

/* ── light (default): warm paper ── */
:root, :root[data-theme="light"] {
  --bg: #fbf7f3;
  --bg-grad: radial-gradient(1100px 560px at 88% -12%, rgba(233,112,36,.10), transparent 60%),
             radial-gradient(820px 460px at -10% 110%, rgba(247,147,30,.07), transparent 55%);
  --surface: #ffffff;
  --elevated: #fffaf6;
  --text: #241a12;
  --muted: #8a7869;
  --primary: #e97024;
  --primary-strong: #d5641c;
  --primary-soft: rgba(233,112,36,.12);
  --on-primary: #ffffff;
  --gold: #b8860b;
  --ok: #15803d; --ok-soft: rgba(21,128,61,.12);
  --danger: #dc2626; --danger-soft: rgba(220,38,38,.10);
  --warn: #b45309; --warn-soft: rgba(180,83,9,.12);
  --border: rgba(36,26,18,.10);
  --input-bg: #ffffff;
  --shadow: 0 6px 22px rgba(90,50,20,.10);
  --slate: #64748b;
  /* Categorical series for charts. Ordered by distance from each other, not by
     hue family, so neighbouring slices never blur together. */
  --c1: #e97024; --c2: #4f46e5; --c3: #ca8a04; --c4: #64748b;
  --c5: #0ea5e9; --c6: #16a34a; --c7: #a855f7; --c8: #94a3b8;
}
:root[data-theme="dark"] {
  --bg: #16110d;
  --bg-grad: radial-gradient(1100px 560px at 88% -12%, rgba(233,112,36,.16), transparent 60%),
             radial-gradient(820px 460px at -10% 110%, rgba(247,147,30,.08), transparent 55%);
  --surface: #211913;
  --elevated: #2b201899;
  --text: #f6ece3;
  --muted: #b09a88;
  --primary: #f7931e;
  --primary-strong: #ffa943;
  --primary-soft: rgba(247,147,30,.16);
  --on-primary: #1a1209;
  --gold: #e0b341;
  --ok: #4ade80; --ok-soft: rgba(74,222,128,.14);
  --danger: #f87171; --danger-soft: rgba(248,113,113,.14);
  --warn: #fbbf24; --warn-soft: rgba(251,191,36,.14);
  --border: rgba(247,147,30,.16);
  --input-bg: #1a130e;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --slate: #94a3b8;
  --c1: #fb923c; --c2: #818cf8; --c3: #e0b341; --c4: #94a3b8;
  --c5: #38bdf8; --c6: #4ade80; --c7: #c084fc; --c8: #cbd5e1;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: var(--font); background: var(--bg); background-image: var(--bg-grad);
  background-attachment: fixed; color: var(--text); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.hide { display: none !important; }
/* The `hidden` attribute is only a `display:none` in the UA sheet, so ANY
   component rule setting display beats it — .ch-empty and .ch-thread are both
   flex containers and both rendered at once until this landed. */
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ═══ Login ═══ */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 26px 22px; width: 100%; max-width: 390px; box-shadow: var(--shadow);
}
.login-logo { display: flex; justify-content: center; margin-bottom: 6px; }
.login-logo img { height: 34px; width: auto; }
.login-sub { color: var(--muted); font-size: 12.5px; text-align: center; margin-bottom: 18px; }

/* ═══ App shell ═══ */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
/* The brand asset is a white/outline mark made for a dark background, so on the
   light theme it disappears. Rather than ship a second file, it sits on a dark
   branded plate — which also gives it the same presence in both themes. */
.logo-plate { background: linear-gradient(135deg, #2b1a0e, #3d2413);
              border: 1px solid rgba(247,147,30,.35); border-radius: 9px;
              padding: 5px 10px; display: inline-flex; align-items: center; }
.topbar .logo-plate img { height: 22px; width: auto; display: block; }
/* The topbar mark doubles as the sidebar's collapse control. Below 1024px there
   is no sidebar — the phone uses the bottom bar — so it reverts to being purely
   the logo, and is inert rather than a button that toggles something invisible.
   Only ONE of the two children is ever shown, so the plate keeps its size. */
button.logo-plate.nav-toggle { border: 1px solid rgba(247,147,30,.35); cursor: default;
                               font-family: inherit; pointer-events: none; }
.nav-toggle .nav-caret { display: none; width: 20px; height: 20px; color: #f7931e;
                         transition: transform .18s ease; }
.sidebar .brand .logo-plate img { height: 26px; width: auto; display: block; }
.login-logo .logo-plate { padding: 9px 16px; }
.login-logo .logo-plate img { height: 30px; width: auto; display: block; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ── top-bar search ── */
.topsearch { position: relative; display: flex; align-items: center; gap: 6px;
  flex: 0 1 340px; min-width: 190px; max-width: 340px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px 8px; }
.topsearch .ts-ico { display: flex; opacity: .55; }
.topsearch .ts-ico svg { width: 16px; height: 16px; }
.topsearch input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  color: var(--text); font: inherit; font-size: 13px; padding: 3px 0; }
.topsearch input::placeholder { color: var(--muted); }
/* The whole pill shows ONE focus ring — the input itself must not add the global
   one on top (that read as a double outline). */
.topsearch input:focus { box-shadow: none; border-color: transparent; }
.topsearch:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.topsearch .ts-clear { border: 0; background: transparent; color: var(--muted); font-size: 18px;
  line-height: 1; cursor: pointer; padding: 0 2px; }
.topsearch-dd { position: absolute; top: calc(100% + 8px); left: 0; right: 0; min-width: 320px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,.22); z-index: 70; max-height: 62vh; overflow: auto; padding: 6px; }
.ts-note { padding: 12px; color: var(--muted); font-size: 13px; }
.ts-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 0; background: transparent; cursor: pointer; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.ts-row:hover { background: var(--primary-soft); }
.ts-row .ts-id { font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.ts-row .ts-main { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-row .ts-r { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.ts-row .ts-sub { font-size: 11px; color: var(--muted); white-space: nowrap; }
.ts-row .ts-bal { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .topsearch { flex: 1 1 auto; min-width: 120px; }
  .topsearch input::placeholder { color: transparent; }
  .topsearch-dd { left: -6px; right: -6px; }
}

/* ── member: a dedicated page (replaces the old drawer) ── */
.member-page { max-width: 980px; margin: 0 auto; }
.member-head { display: flex; align-items: center; gap: 12px; margin-bottom: var(--gap); }
.member-head .btn { flex: 0 0 auto; }
.member-title { margin: 0; font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.content { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto;
           padding: var(--gap) 14px calc(var(--nav-h) + 28px); }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: flex;
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  backdrop-filter: blur(10px); border-top: 1px solid var(--border);
}
.bottomnav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; background: none; border: 0; cursor: pointer;
  color: var(--muted); font-size: 11px; font-weight: 600; font-family: inherit;
}
.bottomnav button svg { width: 22px; height: 22px; }
.bottomnav button.active { color: var(--primary); }
.sidebar { display: none; }

@media (min-width: 1024px) {
  .shell { flex-direction: row; }
  .bottomnav { display: none; }
  /* `position:sticky` only has somewhere to stick if the element is SHORTER than
     the viewport. As a row-flex item the sidebar stretched to the container's
     full height — on a long page that is the whole document (1641px against a
     720px viewport), so sticky did nothing and the nav scrolled away with the
     table. Pin it to exactly one viewport, stop the stretch, and let a nav that
     ever outgrows the screen scroll inside itself rather than the page. */
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; width: 236px;
    height: 100dvh; align-self: flex-start; overflow-y: auto; flex: 0 0 auto;
    position: sticky; top: 0; padding: 18px 12px;
    background: color-mix(in srgb, var(--surface) 76%, transparent);
    border-right: 1px solid var(--border);
  }
  .sidebar .brand { display: flex; align-items: center; padding: 4px 10px 20px; }
  .sidebar .brand img { height: 30px; width: auto; }

  /* The collapse control lives on the TOPBAR mark, which only exists as a
     control at this width — there is no sidebar to collapse below it. */
  button.logo-plate.nav-toggle { pointer-events: auto; cursor: pointer; }
  /* `.topbar .logo-plate img` above sets display:block at the same specificity,
     so this has to match it and win on order — a bare `.nav-toggle img` loses. */
  .topbar .nav-toggle img { display: none; }
  .nav-toggle .nav-caret { display: block; }
  .nav-toggle:hover { border-color: rgba(247,147,30,.75); }
  .shell.nav-collapsed .nav-toggle .nav-caret { transform: rotate(180deg); }

  /* Collapsed: an icon rail. Labels go, every row centres. Only the width
     animates — the contents do not, so labels never smear across it. */
  .sidebar { transition: width .18s ease; }
  .shell.nav-collapsed .sidebar { width: 68px; padding-left: 10px; padding-right: 10px; }
  .shell.nav-collapsed .sidebar button { justify-content: center; padding-left: 0; padding-right: 0; }
  .shell.nav-collapsed .sidebar button > span:not(.logo-plate) { display: none; }
  .shell.nav-collapsed .sidebar .brand { padding-left: 0; padding-right: 0; justify-content: center; }
  .sidebar button {
    display: flex; align-items: center; gap: 11px; width: 100%;
    padding: 11px 12px; border-radius: var(--radius-sm); border: 0; background: none;
    color: var(--muted); font-weight: 600; font-size: 14px; font-family: inherit;
    cursor: pointer; text-align: left;
  }
  .sidebar button svg { width: 20px; height: 20px; flex: 0 0 auto; }
  .sidebar button:hover { background: var(--primary-soft); color: var(--text); }
  .sidebar button.active { background: var(--primary-soft); color: var(--primary-strong); }
  .sidebar .grow { flex: 1; }
  .main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .content { padding: var(--gap) var(--gap) 40px; }
}

/* ═══ Components ═══ */
.card { background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card, .stack > * + * { margin-top: var(--gap); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.card-h h3 { margin: 0; font-size: 14px; font-weight: 700; }
.card-h .spacer { flex: 1; }
/* Explanatory line beside a card title — what a figure counts, or why a list
   holds who it holds. Drops to its own row on narrow screens so the heading is
   never squeezed down to a few characters. */
.card-h { flex-wrap: wrap; }
.card-h .sub { flex: 1 1 100%; color: var(--muted); font-size: 12px; line-height: 1.45; }
@media (min-width: 720px) { .card-h .sub { flex: 1 1 auto; } }
.dim { color: var(--muted); }

/* A user id that opens the member drawer — a link, not a button that looks
   like a control the agent has to press. */
.lnk { border: 0; background: none; padding: 0; font: inherit; font-weight: 600;
       color: var(--primary-strong); cursor: pointer; }
.lnk:hover { text-decoration: underline; }

/* The signal legend: each kind of flag explained once, in the agent's words
   rather than the detector's. Printing it on every row said the same sentence
   nine times and drowned the numbers. */
.sig-legend { display: grid; gap: 12px; }
@media (min-width: 720px) { .sig-legend { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.sig-legend .li p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* Chips scroll sideways on a phone, where a wrapped row would eat the screen,
   but wrap on a desktop — a filter you cannot see is a filter nobody uses. */
@media (min-width: 720px) { .chips { flex-wrap: wrap; overflow-x: visible; } }

/* A card that is itself the warning — used when the agent's own record is open. */
.card-warn { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }

/* Tonight's queued salary. Tinted, because it is the one thing on the page that
   is about to happen rather than something that already did. */
.tonight { border-color: color-mix(in srgb, var(--gold) 42%, var(--border)); }
.tonight-b { display: flex; align-items: flex-end; gap: 26px; flex-wrap: wrap; }
.tonight-b > div { display: flex; flex-direction: column; gap: 1px; }
.tonight-b b { font-size: 21px; font-weight: 700; line-height: 1.15; }
.tonight-b .dim { font-size: 11.5px; }
.tn-k { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.tonight-b .btn svg { width: 14px; height: 14px; }

/* Coaching. Each point is one thing to do, with a coloured spine saying whether
   it is blocking the salary, growing it, or a caution. */
.coach { display: grid; gap: 10px; }
@media (min-width: 900px) { .coach { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.coach-i { border-left: 3px solid var(--border); padding: 2px 0 2px 11px; }
.coach-i.must { border-left-color: var(--danger); }
.coach-i.grow { border-left-color: var(--ok); }
.coach-i.warn { border-left-color: var(--warn); }
.coach-i b { display: block; font-size: 13px; }
.coach-i p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.card-b { padding: 14px 15px; }

.btn { font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
       border-radius: var(--radius-sm); border: 1px solid var(--border);
       background: var(--surface); color: var(--text); padding: 8px 13px;
       display: inline-flex; align-items: center; gap: 7px; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--elevated); }
.btn-primary { background: linear-gradient(135deg, var(--gold), var(--primary));
               color: #fff; border-color: transparent; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* KPI tiles — the headline row */
.kpis { display: grid; gap: var(--gap); grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (min-width: 620px)  { .kpis { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(6, minmax(0,1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
       padding: 13px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--primary); }
.kpi.ok::before { background: var(--ok); } .kpi.dn::before { background: var(--danger); }
.kpi.gold::before { background: var(--gold); } .kpi.slate::before { background: var(--slate); }
.kpi .kv { font-size: 19px; font-weight: 800; letter-spacing: -.2px; word-break: break-all; }
.kpi .kl { font-size: 11px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.kpi .kl svg { width: 13px; height: 13px; }
.kpi .ks { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* range chips + toolbar */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: var(--gap); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { white-space: nowrap; background: var(--surface); border: 1px solid var(--border);
        color: var(--muted); border-radius: 999px; padding: 7px 13px; font-weight: 600;
        font-size: 12.5px; cursor: pointer; font-family: inherit; }
.chip:hover { color: var(--text); }
/* A date field wearing the chip's shape, so "pick any day" sits in the same row
   as Today / Yesterday / Day before rather than in a control of its own. */
.chip-date { color: var(--text); font-size: 12px; padding: 6px 10px; min-width: 0; }

/* Filter bar: level chips on the left, the narrower controls on the right. On a
   phone the chips scroll and the controls wrap under them rather than squeezing
   into a row nobody can hit. */
.filterbar { gap: 10px; align-items: center; }
.filterbar .fld { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.filterbar .fld input, .filterbar .fld select {
  font-family: inherit; font-size: 12.5px; color: var(--text); background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 11px; min-width: 0;
}
.filterbar .fld input { width: 92px; }
@media (max-width: 719px) {
  .filterbar { align-items: stretch; }
  .filterbar .chips { flex: 1 1 100%; }
  .filterbar .spacer { display: none; }
  .filterbar .fld { flex: 1 1 auto; }
  .filterbar .fld input { width: 100%; }
}
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11.5px; color: var(--muted); font-weight: 600; }
input, select { font-family: inherit; font-size: 14px; padding: 9px 11px; color: var(--text);
                background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none;
          border: 0; padding: 6px; line-height: 0; color: var(--muted); border-radius: 8px; cursor: pointer; }
.pw-eye:hover { color: var(--primary); background: var(--primary-soft); }
.pw-eye svg { width: 19px; height: 19px; display: block; }

/* tables — real table on desktop, stacked rows on phones */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px;
               color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr.clickable { cursor: pointer; }
table.tbl tr.clickable:hover td { background: var(--primary-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
/* An inline SVG has no intrinsic size. In the desktop table it inherits a sane
   line-box, but once cells become flex stacks on phones it expands to fill the
   row — a chevron rendered 200px tall. Pin every in-cell icon. */
table.tbl td svg { width: 16px; height: 16px; flex: 0 0 auto; display: block; }
/* Cells default to nowrap, which is right for ids, amounts and dates. A prose
   cell has to opt out or it runs straight under the next column — the class was
   already on the markup, it just had no rule behind it. */
table.tbl td.wrap { white-space: normal; min-width: 20ch; }
.pos { color: var(--ok); font-weight: 700; } .neg { color: var(--danger); font-weight: 700; }
/* Badges default to NEUTRAL. A team level appears in every row of every table;
   in the brand orange those repeats were most of the colour on the page, and
   they carry no urgency at all. Orange is now something a badge opts into. */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
        background: color-mix(in srgb, var(--slate) 15%, transparent); color: var(--slate); }
.pill.slate { background: color-mix(in srgb, var(--slate) 16%, transparent); color: var(--slate); }
.pill.brand { background: var(--primary-soft); color: var(--primary-strong); }
.empty { text-align: center; color: var(--muted); padding: 34px 16px; font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px; }

@media (max-width: 719px) {
  table.tbl thead { display: none; }
  table.tbl, table.tbl tbody, table.tbl tr, table.tbl td { display: block; width: 100%; }
  table.tbl tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  table.tbl tr:last-child { border-bottom: 0; }
  table.tbl td { border: 0; padding: 2px 0; white-space: normal; display: flex;
                 justify-content: space-between; gap: 12px; align-items: baseline; }
  table.tbl td::before { content: attr(data-l); font-size: 11px; color: var(--muted); font-weight: 600; }
  table.tbl td.num { text-align: right; }
  table.tbl td[data-l=""]::before { content: none; }
}

/* charts */
.charts { display: grid; gap: var(--gap); grid-template-columns: minmax(0,1fr); }
@media (min-width: 900px) { .charts { grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); } }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.legend { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.legend .li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.legend .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .vl { font-variant-numeric: tabular-nums; font-weight: 700; }

/* drawer — member drill-down */
.drawer-lb { position: fixed; inset: 0; z-index: 60; background: rgba(20,10,4,.5); display: flex; }
.drawer { margin-left: auto; width: min(560px, 100%); background: var(--bg); background-image: var(--bg-grad);
          height: 100dvh; overflow-y: auto; box-shadow: -12px 0 40px rgba(0,0,0,.28);
          display: flex; flex-direction: column; }
.drawer-h { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px;
            padding: 14px 16px; border-bottom: 1px solid var(--border);
            background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); }
.drawer-h h3 { margin: 0; font-size: 15px; font-weight: 800; }
.drawer-b { padding: var(--gap) 16px 40px; }
@media (max-width: 719px) {
  .drawer { width: 100%; margin-left: 0; border-radius: 0; }
}

/* modal */
.modal-lb { position: fixed; inset: 0; z-index: 70; background: rgba(20,10,4,.5);
            display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); width: min(440px, 100%);
         padding: 20px 20px 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h4 { margin: 0 0 6px; font-size: 16px; }
.modal p { margin: 0 0 14px; font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
/* The line that goes on every irreversible thing, in both steps. */
.disclaimer { font-size: 12px; font-weight: 600; color: var(--warn);
              background: var(--warn-soft); border-radius: var(--radius-sm); padding: 9px 11px; }

/* Account controls: one row per switch, the consequence stated next to it so
   nobody has to guess what "Block P2P" does to the player. */
.ctrls { display: grid; gap: 12px; }
.ctrl { display: flex; align-items: center; gap: 14px; }
.ctrl > div { flex: 1; min-width: 0; }
.ctrl b { font-size: 13px; }
.ctrl p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ctrl .btn.on { border-color: var(--danger); color: var(--danger); }

/* toast */
#toast-root { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px); transform: translateX(-50%);
              z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (min-width: 1024px) { #toast-root { bottom: 22px; } }
.toast { background: var(--text); color: var(--bg); font-size: 12.5px; font-weight: 600;
         padding: 10px 15px; border-radius: 10px; box-shadow: var(--shadow); max-width: min(340px, 92vw); }
.toast.bad { background: var(--danger); color: #fff; }

/* Impersonation banner. Deliberately loud and un-dismissable: it is the only
   thing distinguishing an admin looking around from the agent working. */
.imp-banner { background: repeating-linear-gradient(135deg, var(--warn-soft), var(--warn-soft) 12px,
                transparent 12px, transparent 24px), var(--surface);
              border-bottom: 2px solid var(--warn); color: var(--warn);
              font-size: 12.5px; font-weight: 700; padding: 9px 16px; text-align: center; }

.err { color: var(--danger); font-size: 12.5px; min-height: 16px; margin: 6px 0; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.note { background: var(--primary-soft); border-left: 3px solid var(--primary); border-radius: 8px;
        padding: 9px 11px; font-size: 11.5px; color: var(--muted); line-height: 1.5; margin-top: 10px; }
.steps { counter-reset: st; margin: 10px 0 0; padding: 0; list-style: none; }
.steps li { counter-increment: st; position: relative; padding: 0 0 10px 26px; font-size: 12.5px; line-height: 1.5; }
.steps li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 18px; height: 18px;
        border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
        display: flex; align-items: center; justify-content: center; }
.secret-box { font-family: ui-monospace, monospace; letter-spacing: 2px; background: var(--elevated);
              border: 1px dashed var(--primary); border-radius: 10px; padding: 12px; text-align: center;
              font-size: 15px; word-break: break-all; }
.skel { background: linear-gradient(90deg, var(--elevated) 25%, var(--primary-soft) 37%, var(--elevated) 63%);
        background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 6px; height: 12px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ═══ More sheet (phone) ═══
   Everything in NAV, reachable from a phone — the bottom bar only has room for
   four destinations plus this. */
.sheet-lb { position: fixed; inset: 0; z-index: 65; background: rgba(20,10,4,.5); display: flex; align-items: flex-end; }
.sheet { width: 100%; background: var(--surface); border-radius: 18px 18px 0 0;
         padding: 6px 12px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(0,0,0,.3); }
.sheet-h { display: flex; align-items: center; gap: 10px; padding: 12px 6px; font-weight: 800; font-size: 14px; }
.sheet-b { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; padding-bottom: 8px; }
.sheet-b button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px;
                  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--elevated);
                  color: var(--muted); font-family: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.sheet-b button svg { width: 21px; height: 21px; }
.sheet-b button.active { color: var(--primary-strong); border-color: var(--primary); background: var(--primary-soft); }

/* ═══ Live Chat ═══
   Three panes on a desktop (rooms · thread · conflicts). On a phone the thread
   slides over the room list — `.show-thread` is the only difference, so the two
   layouts cannot drift apart. */
/* Chat is the one page that fills the viewport exactly rather than scrolling the
   document — the room list and the transcript each scroll on their own. Driven
   by a class on .shell rather than a height calc, so it costs nothing on other
   pages and adapts to the impersonation banner instead of guessing its height. */
/* `fill-mode` = this page owns the viewport and scrolls internally. Shared by
   Live Chat and Genealogy. `chat-mode` adds only what the conflicts rail needs,
   so the tree does not reserve a gutter for a rail it never renders. */
.shell.fill-mode { height: 100dvh; overflow: hidden; }
.shell.fill-mode .main-col { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.shell.fill-mode .content { flex: 1; min-height: 0; display: flex; overflow: hidden;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--gap)); }
@media (min-width: 1024px) { .shell.fill-mode .content { padding-bottom: var(--gap); } }
.chat-wrap { display: flex; gap: var(--gap); flex: 1; min-height: 0; }

.ch-rooms, .ch-main, .ch-cf { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.ch-rooms { width: 300px; flex: 0 0 auto; }
.ch-main { flex: 1; min-width: 0; }
.ch-rooms-h { padding: 12px 13px; border-bottom: 1px solid var(--border); }
.ch-rooms-t { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 14px; }
.ch-pill { background: var(--primary); color: var(--on-primary); border-radius: 999px;
           font-size: 10.5px; font-weight: 700; padding: 2px 8px; }
.ch-list { flex: 1; overflow-y: auto; }
.ch-room { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
           background: none; border: 0; border-bottom: 1px solid var(--border); padding: 11px 12px;
           font-family: inherit; color: var(--text); }
.ch-room:hover { background: var(--elevated); }
.ch-room.active { background: var(--primary-soft); }
.ch-av { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; display: flex; align-items: center;
         justify-content: center; font-size: 12px; font-weight: 800; color: var(--on-primary);
         background: linear-gradient(135deg, var(--gold), var(--primary)); }
.ch-room-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ch-room-t { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.ch-room-t b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-when { font-size: 10.5px; color: var(--muted); flex: 0 0 auto; }
.ch-room-p { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-you { color: var(--primary-strong); font-style: normal; font-weight: 700; }
.ch-room-m { font-size: 10.5px; color: var(--muted); opacity: .8; }
.ch-badge { flex: 0 0 auto; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
            background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 800;
            display: flex; align-items: center; justify-content: center; }
.ch-more { text-align: center; color: var(--muted); font-size: 12px; padding: 12px; }

.ch-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
            gap: 10px; color: var(--muted); font-size: 13px; }
.ch-empty svg { width: 40px; height: 40px; opacity: .45; }
.ch-thread { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ch-head { display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-bottom: 1px solid var(--border); }
.ch-head-id { min-width: 0; }
.ch-name { font-weight: 800; font-size: 14px; }
.ch-sub { font-size: 11px; color: var(--muted); }
.ch-back { display: none; background: none; border: 0; color: var(--text); padding: 4px; cursor: pointer; }
.ch-back svg { width: 22px; height: 22px; display: block; }

.ch-msgs { flex: 1; overflow-y: auto; padding: 14px 13px; display: flex; flex-direction: column; gap: 9px;
           background: var(--bg); }
/* Anchor the transcript to the bottom like every chat client. `margin-top:auto`
   on the first child rather than `justify-content:flex-end`, which clips the top
   of an overflowing column in Chrome. */
.ch-msgs > *:first-child { margin-top: auto; }
.ch-older { text-align: center; padding-bottom: 6px; }
.ch-row { display: flex; }
.ch-row.out { justify-content: flex-end; }
.ch-bub { max-width: min(78%, 460px); border-radius: 14px; padding: 8px 11px 6px;
          background: var(--surface); border: 1px solid var(--border); }
.ch-row.out .ch-bub { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 26%, transparent); }
.ch-text { font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.ch-muted { color: var(--muted); font-style: italic; }
.ch-meta { font-size: 10px; color: var(--muted); margin-top: 3px; }
.ch-img { max-width: 100%; max-height: 260px; border-radius: 10px; display: block; cursor: zoom-in; margin-bottom: 4px; }
.ch-file { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600;
           text-decoration: none; color: var(--primary-strong); padding: 6px 0; }
.ch-file svg { width: 17px; height: 17px; }
.ch-quote { border-left: 3px solid var(--primary); padding: 3px 0 3px 8px; margin-bottom: 5px;
            font-size: 11.5px; color: var(--muted); }
.ch-quote b { display: block; color: var(--primary-strong); font-size: 11px; }
.ch-rxs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.ch-rx { background: var(--elevated); border: 1px solid var(--border); border-radius: 999px;
         padding: 1px 7px; font-size: 11.5px; }
/* The composer's place, saying why there isn't one. A disabled input would read
   as broken; this reads as a rule. */
.ch-ro { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-top: 1px solid var(--border);
         font-size: 11.5px; color: var(--muted); background: var(--elevated); }
.ch-ro svg { width: 15px; height: 15px; flex: 0 0 auto; }

/* conflicts rail */
.ch-cf { width: 330px; flex: 0 0 auto; }
.ch-cf.collapsed { width: 44px; }
.ch-cf.collapsed .cf-inner { display: none; }
.ch-cf:not(.collapsed) .cf-rail { display: none; }
.cf-rail { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 0;
           background: none; border: 0; cursor: pointer; color: var(--muted); font-family: inherit; }
.cf-rail svg { width: 19px; height: 19px; }
.cf-rail-label { writing-mode: vertical-rl; font-size: 11.5px; font-weight: 700; letter-spacing: .4px; }
.cf-rail-badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: 10.5px;
                 font-weight: 800; padding: 1px 6px; }
.cf-inner { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.cf-head { display: flex; align-items: center; gap: 7px; padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.cf-count { font-size: 11px; color: var(--muted); }
.cf-filter { width: auto; padding: 4px 7px; font-size: 11.5px; }
.cf-collapse { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px; }
.cf-collapse svg { width: 17px; height: 17px; display: block; }
.cf-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.cf-card { border: 1px solid var(--border); border-left: 3px solid var(--slate); border-radius: var(--radius-sm);
           background: var(--elevated); padding: 10px 11px; }
.cf-card.pending { border-left-color: var(--warn); }
.cf-card.in_progress { border-left-color: var(--primary); }
.cf-card.hold { border-left-color: var(--slate); }
.cf-card.resolved { border-left-color: var(--ok); }
.cf-card.rejected { border-left-color: var(--danger); }
.cf-top { display: flex; align-items: center; gap: 8px; }
.cf-type { font-weight: 700; font-size: 12.5px; flex: 1; }
.cf-badge { border-radius: 999px; padding: 1px 8px; font-size: 10px; font-weight: 800; text-transform: capitalize;
            background: color-mix(in srgb, var(--slate) 18%, transparent); color: var(--slate); }
.cf-badge.pending { background: var(--warn-soft); color: var(--warn); }
.cf-badge.in_progress { background: var(--primary-soft); color: var(--primary-strong); }
.cf-badge.resolved { background: var(--ok-soft); color: var(--ok); }
.cf-badge.rejected { background: var(--danger-soft); color: var(--danger); }
.cf-meta { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.cf-wallet { font-family: ui-monospace, monospace; font-size: 10.5px; word-break: break-all;
             background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 7px; margin-top: 6px; }
.cf-msg { font-size: 12px; margin-top: 6px; background: var(--surface); border: 1px solid var(--border);
          border-radius: 6px; padding: 6px 8px; white-space: pre-wrap; word-break: break-word; }
.cf-files { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.cf-file { width: 52px; height: 52px; border-radius: 7px; overflow: hidden; border: 1px solid var(--border);
           cursor: zoom-in; background: var(--surface); }
.cf-file img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cf-file.pdf { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
               cursor: pointer; text-decoration: none; color: var(--muted); font-size: 9.5px; font-weight: 700; }
.cf-note { font-size: 11.5px; margin-top: 7px; border-left: 3px solid var(--primary);
           background: var(--primary-soft); border-radius: 6px; padding: 6px 8px; white-space: pre-wrap; }
.cf-note b { display: block; font-size: 10.5px; color: var(--primary-strong); margin-bottom: 2px; }
.cf-review { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

@media (max-width: 1023px) {
  /* Phone/tablet: one pane at a time. The conflicts panel floats over both. */
  .ch-rooms { width: 100%; }
  .ch-main { display: none; }
  .chat-wrap.show-thread .ch-rooms { display: none; }
  .chat-wrap.show-thread .ch-main { display: flex; }
  .ch-back { display: block; }
  .ch-cf { position: fixed; right: 0; top: var(--top-h); bottom: var(--nav-h); z-index: 40;
           width: min(340px, 92vw); border-radius: var(--radius) 0 0 var(--radius); }
  .ch-cf.collapsed { width: 38px; }
  /* The rail is FIXED, so it sits over whatever is beneath it. Reserve its width
     on the page rather than letting it clip message bubbles and the header's
     Deposits / Withdrawals buttons. Chat only — genealogy has no rail. */
  .shell.chat-mode .content { padding-right: 46px; }
  /* Those two buttons are icon-only here — their labels are the first thing to
     cost a phone the width that the transcript needs. */
  .ch-head .btn span { display: none; }
  .ch-head .btn { padding: 7px 9px; }
}

/* full-bleed image viewer for chat photos and conflict evidence */
.img-lb { position: fixed; inset: 0; z-index: 90; background: rgba(10,6,3,.92); display: flex;
          align-items: center; justify-content: center; padding: 18px; cursor: zoom-out; }
.img-lb img { max-width: 100%; max-height: 100%; border-radius: 10px; }
.img-x { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,.12); border: 0;
         color: #fff; border-radius: 50%; width: 38px; height: 38px; cursor: pointer;
         display: flex; align-items: center; justify-content: center; }
.img-x svg { width: 20px; height: 20px; }

/* ═══ Salary allocation ═══ */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 28px 1fr auto auto; gap: 9px; align-items: center; font-size: 12px; }
.bar-k { font-weight: 700; color: var(--muted); }
.bar-t { background: var(--elevated); border-radius: 999px; height: 9px; overflow: hidden; }
.bar-f { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--primary)); }
.bar-v { font-variant-numeric: tabular-nums; font-weight: 700; }
.bar-s { color: var(--muted); font-size: 11px; min-width: 54px; text-align: right; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 14px;
         padding-top: 12px; border-top: 1px solid var(--border); }
.split > div { display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.split-k { font-size: 11px; color: var(--muted); }

/* status pills shared by the salary ledger and the payment drawer */
.pill.paid, .pill.approved, .pill.sent { background: var(--ok-soft); color: var(--ok); }
.pill.held, .pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.rejected { background: var(--danger-soft); color: var(--danger); }
td.mono { font-family: ui-monospace, monospace; font-size: 11.5px; }
td.wrap { white-space: normal; max-width: 240px; }

/* ═══ Genealogy ═══
   The canvas fills the pane and everything floats over it. No theme of its own:
   the renderer reads the same custom properties as the rest of the portal, so
   light/dark here is the light/dark the agent already chose. */
.ge-wrap { display: flex; flex-direction: column; gap: var(--gap); flex: 1; min-height: 0; width: 100%; }
.ge-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* One row on desktop. `flex-wrap: wrap` makes the browser move an item to the
   next line rather than shrink it, so the chips only give way once wrapping is
   off — and then they scroll inside themselves, which is what .chips already
   does. The phone keeps wrap; there is no single row to be had at 412px. */
@media (min-width: 720px) { .ge-bar { flex-wrap: nowrap; } }
.ge-bar .chips { flex: 1 1 auto; min-width: 0; }
/* The bar now carries level chips, the layout picker, search and three buttons.
   Both flexible controls shrink so the whole set stays on ONE desktop row —
   wrapping cost the canvas 40px of height for no gain. */
.ge-search { flex: 0 1 150px; min-width: 108px; }
.ge-search input { padding: 7px 10px; font-size: 12.5px; }
.ge-stage { position: relative; flex: 1; min-height: 0; background: var(--surface);
            border: 1px solid var(--border); border-radius: var(--radius);
            box-shadow: var(--shadow); overflow: hidden; }
/* touch-action:none — the browser's own pan/zoom would otherwise swallow the
   pointer events the canvas needs to drive its own pan and pinch. */
.ge-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.ge-stage canvas:active { cursor: grabbing; }
.ge-zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.ge-zoom .btn { width: 34px; height: 34px; padding: 0; justify-content: center;
                background: var(--surface); box-shadow: var(--shadow); }
.ge-legend { position: absolute; left: 10px; top: 10px; display: flex; flex-direction: column; gap: 5px;
             background: color-mix(in srgb, var(--surface) 88%, transparent);
             border: 1px solid var(--border); border-radius: var(--radius-sm);
             padding: 8px 10px; font-size: 11px; color: var(--muted); pointer-events: none; }
.ge-legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ge-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--surface);
          border: 1.5px solid var(--border); flex: 0 0 auto; }
.ge-dot.root { background: var(--primary); border-color: var(--primary); }
.ge-dot.agent { background: var(--gold); border-color: var(--gold); }
.ge-dot.inactive { background: var(--muted); border-color: var(--muted); }
.ge-dot.banned { background: var(--danger); border-color: var(--danger); }
.ge-dash { width: 14px; border-top: 1.5px dashed var(--danger); flex: 0 0 auto; }
/* Selected-node chip: says who is selected and — for a parent, whose tap is
   spent folding the subtree — is the only way into their details. */
.ge-chip { position: absolute; left: 50%; transform: translateX(-50%); bottom: 34px;
           display: flex; align-items: center; gap: 9px; max-width: calc(100% - 24px);
           background: var(--surface); border: 1px solid var(--border);
           border-radius: 999px; padding: 6px 8px 6px 14px; box-shadow: var(--shadow); }
.ge-chip-id { font-weight: 800; font-size: 13px; white-space: nowrap; }
.ge-chip-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap;
               overflow: hidden; text-overflow: ellipsis; }
.ge-chip-x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 3px;
             line-height: 0; border-radius: 50%; flex: 0 0 auto; }
.ge-chip-x:hover { color: var(--danger); background: var(--danger-soft); }
.ge-chip-x svg { width: 15px; height: 15px; display: block; }
.ge-hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: 8px;
           font-size: 10.5px; color: var(--muted); pointer-events: none; white-space: nowrap;
           background: color-mix(in srgb, var(--surface) 80%, transparent);
           border-radius: 999px; padding: 3px 10px; }
@media (max-width: 719px) {
  /* On a phone the toolbar and the legend are competing with the tree for the
     only screen there is. Everything here buys canvas height back: one toolbar
     row instead of three, a legend that reads as a strip along the bottom
     instead of a panel over the tree, and no desktop mouse hint. */
  /* Two rows, not one: squeezing the level chips onto the button row collapsed
     them to nothing — and the level filter IS the control this page is for. */
  .ge-bar { gap: 6px; }
  .ge-bar .chips { flex: 1 0 100%; }
  .ge-search { flex: 1 1 70px; max-width: none; }
  .ge-search input { padding: 6px 8px; font-size: 12px; }
  .ge-bar .btn { padding: 6px 7px; font-size: 11px; white-space: nowrap; }
  .ge-bar .btn span { display: none; }
  .ge-legend { flex-direction: row; flex-wrap: wrap; gap: 4px 10px; font-size: 9.5px;
               padding: 5px 8px; left: 8px; right: 8px; top: auto; bottom: 8px; }
  /* The chip sits above the legend strip rather than over it. */
  .ge-chip { bottom: 56px; }
  .ge-hint { display: none; }
  .ge-zoom { right: 8px; top: 8px; }
}

/* Layout picker — a native select so the optgroups (Linear / Radial /
   Space-filling) come for free and the phone gets its own wheel picker. */
.ge-select { width: auto; flex: 0 1 170px; min-width: 112px; padding: 6px 8px; font-size: 12.5px;
             border-radius: var(--radius-sm); cursor: pointer; }
.ge-select optgroup, .ge-select option { background: var(--surface); color: var(--text); }
@media (max-width: 719px) { .ge-select { flex: 1 1 120px; min-width: 0; font-size: 12px; } }

/* ── Gift code conditions — one aligned line per rule, help text beneath it.
   The block takes the portal's own surface tokens, so it reads in both themes. */
.gc-cond { margin-top: 14px; padding: 12px; border-radius: 10px;
           background: var(--elevated); border: 1px solid var(--border); }
.gc-cond-h { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
             color: var(--muted); margin-bottom: 10px; }
.gc-cond-h span { text-transform: none; letter-spacing: 0; font-weight: 400; }
.gc-crit-row { display: grid; grid-template-columns: minmax(180px, 300px) 130px 150px 38px;
               gap: 10px; align-items: end; justify-content: start; margin-bottom: 10px; }
.gc-crit-row.ids { grid-template-columns: minmax(180px, 300px) minmax(180px, 280px) 38px; }
.gc-crit-row .c-help { grid-column: 1 / -1; font-size: 11px; color: var(--muted); }
.gc-crit-row .c-rm { height: 36px; }
@media (max-width: 640px) {
  .gc-crit-row, .gc-crit-row.ids { grid-template-columns: 1fr 38px; }
  .gc-crit-row .field:first-child { grid-column: 1 / -1; }
}
