/* ===========================================================================
   TruckMe design code — Vendor Financial Management Portal
   Tokens first, then primitives, then components. Nothing here hardcodes a
   colour that is not a token: restyling the whole product means editing :root.
   =========================================================================== */

:root {
  /* brand -- the two colours on the invoice a customer receives:
     TRUCK.ME orange for anything to act on, navy for structure */
  --brand: #fc4100;
  --brand-hover: #d63700;
  --brand-soft: #fff1ea;
  --brand-ink: #a82d00;
  --navy: #003f79;
  --navy-soft: #eaf0f7;
  --navy-ink: #002c56;

  /* surfaces */
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef0f4;
  --border: #e7e9ee;
  --border-strong: #d6dae2;

  /* text */
  --text: #111827;
  --text-muted: #6b7280;
  --text-soft: #9aa1ad;
  --ink: #12131a;

  /* status */
  --blue: #2563eb;      --blue-soft: #e8efff;
  --green: #15803d;     --green-soft: #e7f6ec;
  --red: #dc2626;       --red-soft: #fdeaea;
  --amber: #b45309;     --amber-soft: #fdf3e3;
  --purple: #6d28d9;    --purple-soft: #f1ebfe;
  --cyan: #0e7490;      --cyan-soft: #e4f4f8;

  /* geometry */
  --r-lg: 16px;
  --r: 12px;
  --r-sm: 9px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);

  --sidebar-w: 248px;
  --font: "Inter", -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a.link { color: var(--brand); font-weight: 600; }
a.link:hover { color: var(--brand-hover); }
strong { font-weight: 650; }

/* --- shell --------------------------------------------------------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 0 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px 16px;
}
.sidebar .brand .mark {
  width: 38px; height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand) 0 52%, var(--navy) 52% 100%);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; letter-spacing: .02em;
}
.sidebar .brand .name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.sidebar .brand .sub { font-size: 11.5px; color: var(--text-soft); }

.sidebar nav { padding: 0 10px; flex: 1; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 2px;
  border-radius: var(--r-sm);
  color: #3f4551;
  font-size: 13.5px;
  font-weight: 500;
}
.sidebar nav a svg { width: 17px; height: 17px; flex: 0 0 17px; stroke: currentColor; }
.sidebar nav a:hover { background: var(--surface-2); }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.sidebar nav a .tail { margin-left: auto; }

.sidebar .nav-group {
  padding: 16px 12px 6px;
  font-size: 10.5px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-soft);
  font-weight: 650;
}

.sidebar .who {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px 0;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}
.sidebar .who .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.sidebar .who .n { font-size: 13px; font-weight: 600; }
.sidebar .who .r { font-size: 11.5px; color: var(--text-soft); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 58px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .user { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 12px; }
.sync-info { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 10px; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.sync-dot.off { background: var(--red); }

.content { padding: 14px 18px 24px; flex: 1; max-width: 1760px; width: 100%; }

/* --- type ---------------------------------------------------------------- */
.page-title {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -.02em;
  margin: 0 0 4px;
  /* the same navy the statement puts its own headings in */
  color: var(--navy-ink);
}
.page-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 4px; }
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
}
.section-title {
  font-size: 13px; font-weight: 700; color: var(--navy-ink);
  margin: 0 0 8px; letter-spacing: -.01em;
}
.section-title.kicker {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-soft); font-weight: 650;
}
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 14px; }
.right { text-align: right; }

/* --- surfaces ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

/* --- forms --------------------------------------------------------------- */
input[type=text], input[type=password], input[type=number], input[type=date],
input[type=file], select, textarea {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 8px 11px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input[type=file] { padding: 6px 9px; background: var(--surface-2); }
label.field {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-soft); font-weight: 650;
}
label.field > input, label.field > select, label.field > textarea {
  text-transform: none; letter-spacing: normal; font-weight: 400;
  color: var(--text); font-size: 13.5px;
}

/* --- buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--brand); color: #fff;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 9px 17px;
  font-size: 13.5px; font-weight: 600; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--brand-hover); }
.btn.ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--text-soft); }
.btn.soft { background: var(--surface-3); color: var(--text); }
.btn.soft:hover { background: var(--border); }
.btn.dark { background: var(--ink); }
.btn.dark:hover { background: #000; }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.amber { background: #d97706; }
.btn.sm { padding: 6px 12px; font-size: 12.5px; }

.toggle-group {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-3); border-radius: var(--r-pill);
}
.toggle-group a {
  padding: 6px 15px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); border-radius: var(--r-pill);
}
.toggle-group a:hover { color: var(--text); }
.toggle-group a.active { background: var(--ink); color: #fff; }

/* --- flashes ------------------------------------------------------------- */
.flash {
  padding: 11px 15px; border-radius: var(--r);
  margin-bottom: 12px; font-size: 13.5px; font-weight: 500;
}
.flash.success { background: var(--green-soft); color: var(--green); }
.flash.error { background: var(--red-soft); color: var(--red); }

/* --- tables -------------------------------------------------------------- */
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
  text-align: left;
  padding: 11px 12px;
  /* the statement puts its column headings in navy; a screen that produces
     that paper should not argue with it */
  color: var(--navy);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  border-bottom: 2px solid var(--navy-soft);
  white-space: nowrap;
  background: var(--surface);
}
table.grid td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover td { background: var(--surface-2); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border-radius: var(--r); }

/* --- badges -------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
  white-space: nowrap;
  background: var(--surface-3); color: var(--text-muted);
}
.badge.grey { background: var(--surface-3); color: #555c69; }
.badge.purple { background: var(--purple-soft); color: var(--purple); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

/* --- metric tiles -------------------------------------------------------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.tile .label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-soft); font-weight: 700;
  display: flex; align-items: center; gap: 7px;
}
.tile .label:before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-soft); flex: 0 0 7px;
}
.tile .value {
  font-size: 26px; font-weight: 780; letter-spacing: -.03em;
  margin-top: 6px; font-variant-numeric: tabular-nums;
}
.tile .sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.tile .sub b { color: var(--brand); font-weight: 650; }
.tile.alert .label:before { background: var(--red); }
.tile.alert .value { color: var(--red); }
.tile.good .label:before { background: var(--green); }
.tile.good .value { color: var(--green); }
.tile.info .label:before { background: var(--blue); }
.tile.brand .label:before { background: var(--brand); }

/* a row that does not count yet */
tr.dim td { opacity: .62; }

.mc-find { background: var(--surface-2); padding: 10px 12px; }
/* Matching is a run of the same three moves: press match, type, press Tie.
   They sit in one column on the right of the row, so the pointer travels a
   few pixels down twice instead of crossing the table each time. */
.mc-find .filters { justify-content: flex-end; row-gap: 6px; }
.mc-find .filters .field { flex: 0 1 300px; }
.mc-find .filters .field input[type=number] { max-width: 120px; }
.mc-find [data-case-note],
.mc-find .filters > .muted.small { flex: 1 1 100%; text-align: right; }
/* The cases offered for a code sit in columns, not in a sentence: twelve
   facts run together made every row a different length, and the eye had to
   read each one from the start to find the amount. Under a heading apiece
   the amounts stand under the amounts and the days under the days. */
.mc-find .table-wrap { margin-top: 2px; background: var(--surface); }
.mc-find .cases th, .mc-find .cases td { padding: 5px 9px; }
.mc-find .cases th { font-size: 10px; }
.mc-find .cases td { font-size: 12.5px; white-space: nowrap; }
/* the one column that may be longer than its share: a shop name wraps
   rather than pushing the figures off the right edge */
.mc-find .cases td.shop { white-space: normal; min-width: 150px; }
.mc-find .cases td.tie { text-align: right; }
.mc-find .cases td.tie form { display: inline; }

/* --- user management ----------------------------------------------------- */
table.grid.users td { padding-top: 10px; padding-bottom: 10px; }
.u-name { color: var(--brand); font-weight: 600; text-decoration: none; }
.u-name:hover { text-decoration: underline; }
.linkbtn {
  border: none; background: none; cursor: pointer; font: inherit; font-size: 12.5px;
  color: var(--brand); padding: 0 8px 0 0;
}
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--danger, #c0392b); font-weight: 600; }

/* --- linking a vendor to its Zoho shop ----------------------------------- */
.mg-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-top: 1px solid var(--border);
}
.mg-row:first-of-type { border-top: none; }
.mg-row .row { gap: 8px; align-items: center; }

/* --- the search box, first thing on the dashboard ------------------------ */
.searchbar {
  display: flex; align-items: center; gap: 10px; margin: 0 0 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 6px 12px; box-shadow: var(--shadow-sm);
}
.searchbar:focus-within { border-color: var(--brand); box-shadow: var(--shadow-md); }
.sb-icon { display: flex; color: var(--text-soft); }
.sb-input {
  flex: 1 1 auto; border: none; background: none; outline: none;
  font: inherit; font-size: 15px; color: var(--text); padding: 6px 0;
}
.sb-input::placeholder { color: var(--text-soft); }
.sb-input::-webkit-search-cancel-button { cursor: pointer; }
.sb-count { font-size: 12px; color: var(--text-soft); white-space: nowrap; }
.sb-count b { color: var(--text); font-variant-numeric: tabular-nums; }

/* --- filters ------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }

/* --- vendor cards (one card per vendor, accounts stacked inside) ---------- */
.vendor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.vendor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.vendor-card.attention { border-color: #f3c9b7; }
.vendor-card .vc-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.vendor-card .vc-name {
  font-size: 14px; font-weight: 700; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vendor-card .vc-name:hover { color: var(--brand); }
/* the tag on a card: green means somebody vouched for the balance, and an
   empty ring means nobody has -- the same shape either way, so the eye reads
   the colour and not the presence of a mark */
.dot-ok, .dot-off {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}
.dot-ok { background: #2f9e5e; box-shadow: 0 0 0 2px rgba(47,158,94,.18); }
.dot-off { background: transparent; border: 1.5px solid #c8cdd6; }
.vendor-card .vc-trust { margin: -2px 0 8px; }
/* the tag reads as a state and clicks as a switch */
.tagbtn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-3, #eef0f4); color: #5b6270;
  border: 1px solid transparent; border-radius: var(--r-pill, 999px);
  padding: 3px 10px; font-size: 11px; font-weight: 600; cursor: pointer;
}
button.tagbtn:hover { border-color: #c8cdd6; color: #2f3742; }
.tagbtn.on { background: rgba(47,158,94,.10); color: #22683f; }
button.tagbtn.on:hover { border-color: #9ed3b5; }
.oval {
  background: var(--surface-3); color: #4b5261;
  border-radius: var(--r-pill);
  padding: 2px 9px; font-size: 11px; font-weight: 600; white-space: nowrap;
  max-width: 45%; overflow: hidden; text-overflow: ellipsis;
}

/* one account = one compact block; the next one sits under the bar */
.acct { border-top: 1px solid var(--border); padding-top: 7px; margin-top: 7px; }
.acct.first { border-top: none; padding-top: 0; margin-top: 0; }
.acct-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.acct-name {
  font-weight: 700; letter-spacing: .06em; font-size: 10px;
  text-transform: uppercase; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%;
}
.acct-figs { font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-figs b { font-weight: 700; margin-left: 4px; }
.acct-figs b.warm { color: #b45309; }
.acct-figs b.hot { color: var(--red); }
.acct-meta {
  font-size: 11px; color: var(--text-soft); margin-top: 5px;
  display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
}
.acct-meta .badge { font-size: 10.5px; padding: 1px 7px; }

.bar { height: 5px; background: var(--surface-3); border-radius: var(--r-pill); overflow: hidden; margin-top: 5px; }
.bar > div { height: 100%; background: var(--blue); border-radius: var(--r-pill); transition: width .2s; }
.bar.warn > div { background: #f59e0b; }
.bar.crit > div { background: var(--red); }

/* account chips in the vendor library */
.acct-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-3); color: #444b59;
  border-radius: var(--r-pill); padding: 2px 10px;
  font-size: 11.5px; font-weight: 600; margin: 2px 4px 2px 0;
}
.acct-chip b { font-weight: 700; color: var(--text); }
.acct-chip:hover { background: var(--brand-soft); color: var(--brand); }
.acct-chip.warn { background: var(--amber-soft); color: var(--amber); }
.acct-chip.off b { color: var(--text-soft); font-weight: 600; }

/* --- profile ------------------------------------------------------------- */
.profile { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1250px) { .profile { grid-template-columns: 1fr; } }

.tabs {
  display: flex; gap: 3px; padding: 4px;
  background: var(--surface-3); border-radius: var(--r-pill);
  margin-bottom: 16px; flex-wrap: wrap; width: fit-content;
}
.tabs a {
  padding: 7px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); border-radius: var(--r-pill);
}
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* --- chat ---------------------------------------------------------------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 150px); position: sticky; top: 74px; }
.chat .chat-body { flex: 1; overflow-y: auto; padding: 2px; display: flex; flex-direction: column; gap: 10px; }
.msg { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; }
.msg.system { background: var(--brand-soft); border-color: #f7d9c9; }
.msg .meta { font-size: 11px; color: var(--text-soft); display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.msg .nick { color: var(--brand); font-weight: 700; }
.msg .quote { border-left: 2px solid var(--brand); padding-left: 8px; font-size: 11.5px; color: var(--text-muted); margin-bottom: 5px; }
.msg img.preview { max-width: 100%; border-radius: var(--r-sm); margin-top: 6px; cursor: zoom-in; }
.msg .body { white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.chat-form { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 9px; }
.chat-form textarea { resize: vertical; min-height: 56px; }

.lightbox {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .72);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 30px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: var(--r); }

/* --- modal --------------------------------------------------------------- */
.modal {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45);
  display: none; align-items: center; justify-content: center; z-index: 90; padding: 20px;
}
.modal.open { display: flex; }
.modal .box {
  background: var(--surface); border-radius: var(--r-lg); padding: 22px;
  width: min(580px, 96vw); max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal .box h3 { margin: 0 0 14px; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 150px; }

pre.message-box, textarea.message-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 15px;
  white-space: pre-wrap;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12.5px; line-height: 1.6;
  max-height: 360px; overflow-y: auto;
  color: var(--text);
}

/* --- timeline ------------------------------------------------------------ */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 2px solid var(--border); padding: 0 0 16px 16px; position: relative; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:before {
  content: ""; position: absolute; left: -5px; top: 5px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
}
.timeline .t-meta { font-size: 11.5px; color: var(--text-soft); }

/* --- pagination ---------------------------------------------------------- */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 14px; font-size: 13px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 6px 11px; border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-muted); background: var(--surface);
}
.pagination a:hover { border-color: var(--border-strong); color: var(--text); }
.pagination a.current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* --- login --------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card {
  width: 396px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 32px; box-shadow: var(--shadow);
}
.login-card .mark {
  width: 44px; height: 44px; border-radius: 13px; background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: 16px;
}
.login-card h1 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; }
.login-card p.sub { color: var(--text-muted); font-size: 12.5px; margin: 0 0 22px; }
.login-card .field { margin-bottom: 13px; }
.login-card input { width: 100%; }
.login-hint {
  margin-top: 18px; font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 14px;
}

/* --- TV ------------------------------------------------------------------ */
.tv-wrap { padding: 28px 36px; }
.tv-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 22px; }
.tv-head h1 { font-size: 30px; font-weight: 750; letter-spacing: -.02em; margin: 0; }
.tv-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-bottom: 22px; }
.tv-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; text-align: center; box-shadow: var(--shadow-sm);
}
.tv-tile .label {
  font-size: 12px; color: var(--text-soft); text-transform: uppercase;
  letter-spacing: .08em; font-weight: 700;
}
.tv-tile .value { font-size: 40px; font-weight: 800; margin-top: 8px; letter-spacing: -.03em; }
.tv-row {
  display: grid; grid-template-columns: 2fr 1.2fr 3fr 92px;
  gap: 16px; align-items: center; padding: 13px 8px;
  border-bottom: 1px solid var(--border); font-size: 16px;
}
.tv-row:last-child { border-bottom: none; }
.tv-row .util { text-align: right; font-weight: 750; font-variant-numeric: tabular-nums; }
.tv-row .bar { height: 12px; margin: 0; }

/* --- combobox (type-ahead search) ---------------------------------------- */
.combo { position: relative; display: block; width: 100%; }
.combo > input { width: 100%; }
.combo-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  max-height: 330px; overflow-y: auto;
  display: none;
}
.combo-list.open { display: block; }
.combo-item {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
}
.combo-item:last-child { border-bottom: none; }
.combo-item:hover, .combo-item.active { background: var(--brand-soft); }
.combo-item .t { font-weight: 600; font-size: 13.5px; }
.combo-item .m { font-size: 11.5px; color: var(--text-soft); }
.combo-item.disabled { cursor: not-allowed; opacity: .55; }
.combo-empty { padding: 10px 12px; color: var(--text-soft); font-size: 12.5px; }

/* inline account switcher inside the invoice table */
.inline-select {
  padding: 4px 8px;
  font-size: 12.5px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  max-width: 150px;
}
.inline-select:hover { border-color: var(--brand); }
.mono { font-family: "SF Mono", Consolas, monospace; font-size: 12px; }


/* --- vertical parameter panel (settings forms) --------------------------- */
.form-vert {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 12px;
}
/* The caption sits on top of its field in small type: four fields fit in a row
   and a whole account configures itself without scrolling. */
.form-vert.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 8px 12px;
}
.form-vert .f {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  border-bottom: none;
  min-width: 0;
}
.form-vert .f > .k {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-soft); font-weight: 700; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.form-vert .f > input,
.form-vert .f > select { padding: 5px 8px; font-size: 12.5px; }
.form-vert .f > input,
.form-vert .f > select,
.form-vert .f > textarea { width: 100%; background: var(--surface); }
.form-vert .f.wide { grid-column: 1 / -1; }
.form-vert .f.wide > textarea { min-height: 54px; }


/* --- compact metric strip (replaces the big tiles) ----------------------- */
.statbar {
  display: flex; flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  overflow: hidden;
}
.statbar .stat {
  flex: 1 1 148px;
  padding: 7px 12px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 1px;
  min-width: 0;
}
.statbar .stat:last-child { border-right: none; }
.statbar a.stat:hover { background: var(--surface-2); }
.statbar .k {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-soft); font-weight: 700;
}
.statbar .v {
  font-size: 16px; font-weight: 750; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.statbar .s { font-size: 10.5px; color: var(--text-soft); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.statbar .stat.hot .v { color: var(--red); }

/* --- bulk selection bar above the invoice table -------------------------- */
.bulkbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 12px;
  margin-bottom: 10px;
}
.bulkbar b { color: var(--text); }

/* --- chat dock (fixed panel, never scrolls with the page) ---------------- */
.chatdock {
  position: fixed; top: 58px; right: 0; bottom: 0; width: 360px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 60;
  box-shadow: -6px 0 18px rgba(16, 24, 40, .05);
}
.chatdock.hidden { display: none; }
body.has-chatdock .content { padding-right: 386px; }

.cd-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.cd-title b { font-size: 13.5px; display: block; }
.cd-title .small { font-size: 11px; }
.cd-actions { display: flex; gap: 6px; }
.cd-icon {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 4px 10px;
  font-size: 11.5px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; font-family: inherit;
}
.cd-icon:hover { border-color: var(--brand); color: var(--brand); }
.cd-icon.on { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.cd-icon.rec { background: var(--red-soft); color: var(--red); border-color: var(--red); }

.cd-body {
  flex: 1; overflow-y: auto; padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.cd-body .msg { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 8px 10px; }
.cd-body .msg.system { background: var(--brand-soft); border-color: #f7d9c9; }
.cd-body .msg.mine { background: #eef4ff; border-color: #dbe6ff; }
.cd-body .msg .meta { font-size: 10.5px; color: var(--text-soft); display: flex; justify-content: space-between; gap: 8px; }
.cd-body .msg .nick { color: var(--brand); font-weight: 700; }
.cd-body .msg .body { font-size: 12.5px; white-space: pre-wrap; word-break: break-word; margin-top: 3px; }
.cd-body .msg img.preview { max-width: 100%; border-radius: var(--r-sm); margin-top: 6px; cursor: zoom-in; }
.cd-body .msg audio { width: 100%; margin-top: 6px; }
.cd-reply-btn {
  background: none; border: none; padding: 2px 0 0; margin-top: 2px;
  color: var(--brand); font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit;
}

.cd-reply, .cd-attachments {
  border-top: 1px solid var(--border); padding: 7px 10px;
  font-size: 11.5px; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cd-reply.hidden, .cd-attachments.hidden { display: none; }
.cd-att { position: relative; display: flex; align-items: center; gap: 6px; }
.cd-att img { width: 54px; height: 54px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--border); }
.cd-att audio { height: 32px; max-width: 210px; }
.cd-file { font-size: 11px; background: var(--surface-2); border-radius: var(--r-sm); padding: 4px 8px; }

.cd-form { border-top: 1px solid var(--border); padding: 9px 10px; display: flex; flex-direction: column; gap: 7px; }
.cd-form textarea { width: 100%; resize: vertical; min-height: 46px; font-size: 12.5px; }
.cd-tools { display: flex; align-items: center; gap: 7px; }
.cd-tools label.cd-icon { display: inline-flex; align-items: center; }
.cd-rec-state { font-size: 10.5px; color: var(--text-soft); flex: 1; }

@media (max-width: 1100px) {
  .chatdock { width: 320px; }
  body.has-chatdock .content { padding-right: 24px; }
}

/* --- live chat extras: unread, typing, jump-to-new ----------------------- */
.cd-unread {
  background: var(--red); color: #fff;
  border-radius: var(--r-pill); padding: 2px 8px;
  font-size: 11px; font-weight: 700; align-self: center;
}
.cd-unread.hidden { display: none; }
.cd-typing {
  padding: 5px 12px; font-size: 11px; color: var(--brand);
  border-top: 1px solid var(--border); background: var(--brand-soft);
}
.cd-typing.hidden { display: none; }
.cd-jump {
  margin: 0 10px 6px; padding: 5px 10px; text-align: center; cursor: pointer;
  background: var(--ink); color: #fff; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 600;
}
.cd-jump.hidden { display: none; }

/* --- ticks, reactions, forward (Telegram-like) --------------------------- */
.cd-ticks { color: var(--text-soft); margin-left: 4px; font-size: 11px; cursor: default; }
.cd-ticks.read { color: var(--blue); }
.cd-body .msg .quote.jump { cursor: pointer; }
.cd-body .msg .quote.jump:hover { color: var(--brand); }
.cd-body .msg.hit { outline: 2px solid var(--brand); outline-offset: 1px; }
.cd-fwd { font-size: 10.5px; color: var(--brand); font-style: italic; margin-bottom: 3px; }

.cd-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; align-items: center; }
.cd-chip {
  background: var(--surface-3); border: 1px solid transparent; border-radius: var(--r-pill);
  padding: 1px 8px; font-size: 12px; cursor: pointer; font-family: inherit; line-height: 1.6;
}
.cd-chip b { font-size: 10.5px; color: var(--text-muted); }
.cd-chip.mine { background: var(--brand-soft); border-color: var(--brand); }
.cd-chip.add { color: var(--text-soft); padding: 1px 7px; }
.cd-add { position: relative; display: inline-block; }
.cd-palette {
  display: none; position: absolute; bottom: 120%; left: 0; z-index: 5;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg); padding: 3px 5px; white-space: nowrap;
}
.cd-add:hover .cd-palette { display: block; }
.cd-pick { background: none; border: none; font-size: 15px; cursor: pointer; padding: 2px 3px; }
.cd-pick:hover { transform: scale(1.2); }

.cd-actions-row { display: flex; gap: 10px; margin-top: 2px; }
.cd-forward {
  position: absolute; left: 10px; right: 10px; bottom: 110px; z-index: 8;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 10px;
}
.cd-forward.hidden { display: none; }
.cd-fwd-head { display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 700; margin-bottom: 7px; }
.cd-forward input { width: 100%; }
.cd-fwd-list { max-height: 210px; overflow-y: auto; margin-top: 7px;
  display: flex; flex-direction: column; gap: 2px; }
.cd-fwd-item {
  text-align: left; background: none; border: none; padding: 6px 8px;
  border-radius: var(--r-sm); font-size: 12.5px; cursor: pointer; font-family: inherit;
}
.cd-fwd-item:hover { background: var(--brand-soft); color: var(--brand); }

/* --- call bar in the chat dock (Telegram-ish) ---------------------------- */
.cd-call {
  border-bottom: 1px solid var(--border);
  background: #101828; color: #fff;
  padding: 8px 12px;
}
.cd-call.hidden { display: none; }
.cd-call.invite { background: var(--brand); }
.cd-call-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.cd-call-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #34d399;
  animation: cd-pulse 1.4s infinite;
}
@keyframes cd-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.cd-call-timer { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 12px; opacity: .85; }
.cd-call-people { display: flex; align-items: center; gap: 5px; margin-top: 7px; flex-wrap: wrap; }
.cd-peer {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255,255,255,.18); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.cd-peer.muted { opacity: .45; }
.cd-call-count { font-size: 11px; opacity: .8; margin-left: 4px; }
.cd-call-actions { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.cd-call-actions .cd-icon { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.cd-call-actions .cd-icon:hover { background: rgba(255,255,255,.26); color: #fff; }
.cd-call-actions .cd-icon.danger { background: #ef4444; }
.cd-call-note { font-size: 10.5px; opacity: .75; margin-left: auto; }

/* --- Telegram-style message list ---------------------------------------- */
.cd-body .msg { padding: 6px 9px; border-radius: 10px; position: relative; }
.cd-body .msg .meta { font-size: 10.5px; display: flex; align-items: baseline; gap: 6px; }
.cd-body .msg .meta .time { margin-left: auto; color: var(--text-soft); }
.cd-body .msg .nick { font-weight: 700; font-size: 11.5px; }
.cd-body .msg .body { font-size: 12.5px; line-height: 1.35; margin-top: 2px; }
.cd-body .msg .quote {
  border-left: 2px solid currentColor; padding: 2px 0 2px 7px; margin: 3px 0;
  font-size: 11px; color: var(--text-muted); cursor: pointer; opacity: .9;
}
.cd-body .msg .quote b { display: block; color: var(--brand); font-size: 10.5px; }
.cd-body .msg.picked { outline: 2px solid var(--brand); }
.cd-pinmark { font-size: 10px; }
.cd-sel { margin-right: 6px; }
.cd-reactions { display: flex; flex-wrap: wrap; gap: 3px; }
.cd-reactions:empty { display: none; }
.cd-chip { display: inline-flex; align-items: center; gap: 3px; }

/* pinned bar */
.cd-pinned {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 7px 12px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); font-size: 11.5px;
}
.cd-pinned.hidden { display: none; }
.cd-pin-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-pin-text b { color: var(--brand); margin-right: 4px; }

/* selection bar */
.cd-selbar {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px; border-bottom: 1px solid var(--border);
  background: var(--brand-soft); font-size: 11.5px; color: var(--brand);
}
.cd-selbar.hidden { display: none; }
.cd-selbar span { margin-right: auto; font-weight: 600; }

/* right-click menu */
.cd-menu {
  position: absolute; z-index: 90; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px;
}
.cd-menu.hidden { display: none; }
.cd-menu-emoji {
  display: flex; gap: 2px; padding: 4px 2px 8px; border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.cd-menu-emoji button {
  background: none; border: none; font-size: 19px; cursor: pointer; padding: 2px 3px;
  transition: transform .1s;
}
.cd-menu-emoji button:hover { transform: scale(1.25); }
.cd-menu-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 7px 10px; border-radius: 8px; font-size: 13px; cursor: pointer;
  font-family: inherit; color: var(--text);
}
.cd-menu-item:hover { background: var(--surface-2); }

/* --- chat list (phone first) --------------------------------------------- */
.chatlist { display: flex; flex-direction: column; }
.chatrow {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 14px; background: none; border: none; border-bottom: 1px solid var(--border);
  text-align: left; cursor: pointer; font-family: inherit;
}
.chatrow:last-child { border-bottom: none; }
.chatrow:hover { background: var(--surface-2); }
.chatrow-avatar {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.chatrow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chatrow-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.chatrow-top b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatrow-time { font-size: 10.5px; color: var(--text-soft); white-space: nowrap; }
.chatrow-last {
  font-size: 12px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chatrow-last b { color: var(--text); font-weight: 600; }
.chatrow.unread .chatrow-last { color: var(--text); }
.chatrow-badge {
  background: var(--brand); color: #fff; border-radius: var(--r-pill);
  padding: 1px 8px; font-size: 11px; font-weight: 700;
}

/* --- phone layout: progress bars, balances and chat ---------------------- */
@media (max-width: 760px) {
  /* the sidebar becomes a bottom bar with icons only */
  .layout { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    width: 100%; flex: none; height: 58px;
    flex-direction: row; align-items: center; justify-content: space-around;
    padding: 0; border-right: none; border-top: 1px solid var(--border);
    overflow: visible; z-index: 70;
  }
  .sidebar .brand, .sidebar .who, .sidebar .nav-group { display: none; }
  .sidebar nav {
    display: flex; width: 100%; padding: 0; justify-content: space-around; align-items: center;
  }
  .sidebar nav a { flex-direction: column; gap: 2px; font-size: 0; padding: 8px 6px; margin: 0; }
  .sidebar nav a svg { width: 21px; height: 21px; flex: none; }
  .sidebar nav a .badge { font-size: 9px; padding: 0 5px; position: absolute; margin: -14px 0 0 12px; }
  .sidebar nav a.active { background: none; color: var(--brand); }

  .topbar { padding: 0 14px; height: 50px; }
  .topbar .sync-info span:not(.sync-dot) { display: none; }
  .content { padding: 14px 12px 76px; }

  .page-title { font-size: 20px; }
  .page-sub, .filters .field, .page-head .btn.ghost { font-size: 12px; }

  /* metrics: two per row, still readable */
  .statbar .stat { flex: 1 1 45%; padding: 8px 10px; }
  .statbar .v { font-size: 15px; }

  /* the vendor card keeps name, balance and the bar; the rest steps aside */
  .vendor-grid { grid-template-columns: 1fr; gap: 8px; }
  .vendor-card { padding: 10px 12px; }
  .vendor-card .oval { max-width: 40%; font-size: 10px; }
  .acct-meta { font-size: 10px; }

  /* filters collapse to a scrolling row */
  .filters { gap: 8px; }
  .filters .field { flex: 1 1 130px; }

  /* tables stay readable by scrolling sideways */
  table.grid { font-size: 12px; }
  table.grid th, table.grid td { padding: 8px 9px; }

  /* the chat takes the whole screen on a phone */
  .chatdock { top: 0; left: 0; right: 0; bottom: 0; width: 100%; border-left: none; z-index: 80; }
  body.has-chatdock .content { padding-right: 12px; }
  body.has-chatdock .sidebar { display: none; }
  .cd-body { padding: 8px; }
  .cd-form textarea { font-size: 16px; }   /* 16px keeps iOS from zooming in */
  .cd-forward { bottom: 130px; }
}

/* --- payment thread inside a ticket -------------------------------------- */
.tchat-list {
  max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px;
  padding: 4px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r);
}
.tchat-list .msg { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 7px 9px; }
.tchat-list .msg.system { background: var(--brand-soft); border-color: #f7d9c9; }
.tchat-list .msg.mine { background: #eef4ff; border-color: #dbe6ff; }
.tchat-list .msg .meta { font-size: 10.5px; display: flex; justify-content: space-between; gap: 8px; }
.tchat-list .msg .nick { color: var(--brand); font-weight: 700; }
.tchat-list .msg .time { color: var(--text-soft); }
.tchat-list .msg .body { font-size: 12.5px; white-space: pre-wrap; margin-top: 2px; }
.tchat-list .msg img.preview { max-width: 100%; border-radius: var(--r-sm); margin-top: 5px; cursor: zoom-in; }

/* --- vendor metric strip -------------------------------------------------
   The terms come first and carry words rather than one figure, so with
   several accounts they need the room the aging bucket used to take. */
.statbar .stat.hot .v { color: var(--red); }
.statbar .stat.terms { flex: 2 1 300px; }
.statbar .stat.terms .muted { color: var(--text-muted); font-weight: 500; }
.statbar .v.small-v {
  font-size: 11.5px; font-weight: 500; letter-spacing: 0; line-height: 1.5;
  white-space: normal; color: var(--text-muted); margin-top: 2px;
}
.statbar .v.small-v b { color: var(--text-soft); font-weight: 700; font-size: 10px; }

/* a payment-thread message inside the vendor room */
.cd-ticket {
  background: var(--purple-soft); color: var(--purple);
  border-radius: var(--r-pill); padding: 0 7px;
  font-size: 10px; font-weight: 700; white-space: nowrap;
}
.cd-ticket:hover { background: var(--purple); color: #fff; }

/* --- ticket page: work on the left, thread and history on the right ------ */
.ticket-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px; align-items: start;
}
.ticket-side { display: flex; flex-direction: column; gap: 12px; }
.tchat-card { display: flex; flex-direction: column; }
.tchat-list.tall { max-height: 420px; min-height: 240px; }
.tchat-form { display: flex; flex-direction: column; gap: 7px; margin-top: 9px; }
.tchat-form textarea { width: 100%; resize: vertical; font-size: 12.5px; }
@media (max-width: 1250px) { .ticket-grid { grid-template-columns: 1fr; } }

/* statement totals block — shared by the statement page and the ticket view */
.grid.totals { max-width: 420px; margin-left: auto; }

/* ---------------------------------------------------------------------------
   Statement draft: money-code warnings, adjustments and notes
   --------------------------------------------------------------------------- */
.mc-warning {
  background: var(--red-soft); color: var(--red); border: 1px solid #f6c9c9;
  border-radius: var(--r-sm); padding: 9px 12px; font-size: 12.5px; margin-bottom: 10px;
}
.mc-warning strong { display: block; }
.grid tr.mc-row > td { background: var(--red-soft); }
.grid tr.mc-row.partial > td { background: var(--amber-soft); }
.grid .mc-total td { color: var(--red); }

.extras { margin-top: 14px; }
.extras-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.extra-list { list-style: none; margin: 0; padding: 0; display: flex;
              flex-direction: column; gap: 6px; }
.extra-list.saved .extra-row { border-color: var(--green); }
.extra-list .empty { padding: 6px 2px; }
.extra-row {
  display: flex; align-items: center; gap: 8px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px 8px;
}
.extra-row.dragging { opacity: .45; }
.extra-row .drag {
  flex: 0 0 auto; display: flex; align-items: center; color: var(--text-soft);
  cursor: grab; padding: 2px;
}
.extra-row .drag:active { cursor: grabbing; }
.extra-form { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; }
.extra-form.add { margin-top: 8px; padding-left: 22px; }
.extra-form input { font-size: 12.5px; padding: 5px 8px; }
.ex-title { flex: 1 1 220px; }
.ex-amount { flex: 0 0 120px; text-align: right; }
.ex-reason { flex: 1 1 180px; }
.ex-note { flex: 1 1 auto; }
.extra-form.static .ex-amount { font-variant-numeric: tabular-nums; }
.btn.ghost.danger { color: var(--red); border-color: #f0cfcf; }
.btn.ghost.danger:hover { background: var(--red-soft); border-color: var(--red); }

@media (max-width: 760px) {
  .extra-form { flex-wrap: wrap; }
  .ex-amount { flex: 0 0 90px; }
}

/* ---------------------------------------------------------------------------
   Ticket: shop parameters and the prepay period
   --------------------------------------------------------------------------- */
.paramlist { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.paramlist dt { color: var(--text-muted); font-size: 12px; }
.paramlist dd { margin: 0; font-size: 12.5px; font-weight: 600; }
.paramlist dd .small { font-weight: 400; }

.prepay-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.prepay-bar .pp {
  flex: 1 1 160px; display: flex; flex-direction: column; gap: 1px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 8px 10px;
}
.prepay-bar .pp .k { font-size: 11px; color: var(--text-muted); text-transform: uppercase;
                     letter-spacing: .03em; }
.prepay-bar .pp .v { font-size: 17px; font-weight: 700; }
.prepay-bar .pp .s { font-size: 11.5px; color: var(--text-soft); }
.prepay-bar .pp.pending { background: var(--amber-soft); border-color: #f0dcba; }
.prepay-bar .pp.pending .k, .prepay-bar .pp.pending .v { color: var(--amber); }
.prepay-bar .pp.actual { background: var(--green-soft); border-color: #cfe8d6; }
.prepay-bar .pp.actual .k, .prepay-bar .pp.actual .v { color: var(--green); }
.prepay-bar .pp.asked { background: var(--brand-soft); border-color: #f7d3c2; }
.prepay-bar .pp.asked .k, .prepay-bar .pp.asked .v { color: var(--brand-ink); }
.prepay-math { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px;
               color: var(--text-muted); }
.prepay-math strong { color: var(--text); }

/* tickets: active / archive */
.tabs { display: flex; gap: 6px; }
.tabs a {
  padding: 6px 12px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 600;
  color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border);
}
.tabs a.on { background: var(--brand-soft); color: var(--brand-ink); border-color: #f7d3c2; }
.tabs a .n { color: var(--text-soft); font-weight: 500; }

/* payment report — what the money is for, on the ticket and on the desk */
.report-head { display: flex; justify-content: space-between; align-items: flex-start;
               gap: 12px; margin-bottom: 8px; }
.report-head .r-vendor { font-weight: 700; }
.report-head .r-amount { text-align: right; display: flex; flex-direction: column; }
.report-head .r-amount strong { font-size: 19px; color: var(--brand-ink); }
.report-math { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px;
               color: var(--text-muted); }
.report-math strong { color: var(--text); }
.grid tr.r-total td { border-top: 1px solid var(--border-strong); font-weight: 700;
                      background: var(--surface-2); }
.modal .box.wide { max-width: 860px; width: 92vw; }

/* ---------------------------------------------------------------------------
   Account balance block — the same shape for a credit line and for prepay
   --------------------------------------------------------------------------- */
.balance {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 9px 11px; margin: 8px 0;
}
.balance.warn { background: var(--amber-soft); border-color: #f0dcba; }
.balance.crit { background: var(--red-soft); border-color: #f6c9c9; }
.balance .b-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.balance .b-main { display: flex; flex-direction: column; min-width: 0; }
.balance .b-label {
  font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600;
}
.balance .b-value { font-size: 23px; font-weight: 700; line-height: 1.15;
                    font-variant-numeric: tabular-nums; }
.balance.warn .b-value { color: var(--amber); }
.balance.crit .b-value { color: var(--red); }
.balance .b-util { text-align: right; display: flex; flex-direction: column; }
.balance .b-pct { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.balance .b-sub { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.balance .bar { margin: 7px 0 8px; }
.balance .b-rows { list-style: none; margin: 0; padding: 0; display: flex;
                   flex-direction: column; gap: 2px; }
.balance .b-rows li {
  display: flex; justify-content: space-between; gap: 10px; font-size: 12px;
  color: var(--text-muted);
}
.balance .b-rows b { color: var(--text); font-variant-numeric: tabular-nums; }
.balance .b-rows b.minus { color: var(--red); }
.balance .b-rows b.muted { color: var(--text-soft); font-weight: 500; }
.balance .b-rows .warnline b { color: var(--amber); }
.balance .b-rows .b-last { border-top: 1px dashed var(--border-strong); margin-top: 3px;
                           padding-top: 4px; }
.acct-meta .warm { color: var(--amber); }

/* payment desk: three numbers, nothing else */
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 860px) { .tiles.three { grid-template-columns: 1fr; } }

/* ticket progress: four steps instead of thirteen statuses */
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; padding: 0; }
.steps li {
  position: relative; font-size: 11.5px; font-weight: 600; padding: 3px 10px 3px 22px;
  border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-soft);
}
.steps li::before {
  content: ""; position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.steps li.done { background: var(--green-soft); color: var(--green); }
.steps li.current { background: var(--brand-soft); color: var(--brand-ink); }
.steps li.stopped { background: var(--red-soft); color: var(--red); }

/* two clocks: financial (Central) in front, office (Tashkent) behind it */
.clocks { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.clocks b { color: var(--text); }
.tzs { font-size: .82em; color: var(--text-soft); }

/* ---------------------------------------------------------------------------
   EFS money code badge + popover (one component, every table)
   --------------------------------------------------------------------------- */
.mc { position: relative; display: inline-block; }
.mc-btn { border: none; cursor: pointer; font: inherit; display: inline-flex; gap: 3px;
          align-items: center; }
.mc-btn:hover { filter: brightness(.97); }
.mc-caret { font-size: 8px; opacity: .7; }
.mc-pop {
  position: absolute; z-index: 60; top: calc(100% + 5px); right: 0; min-width: 270px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); box-shadow: var(--shadow-lg); padding: 8px 9px;
  text-align: left; white-space: nowrap;
}
.mc-pop.left { right: auto; left: 0; }
.mc-head { font-size: 11.5px; font-weight: 700; margin-bottom: 5px; display: flex;
           flex-direction: column; gap: 1px; }
.mc-line { display: flex; align-items: center; gap: 8px; padding: 3px 0;
           border-top: 1px solid var(--border); font-size: 12px; }
.mc-line:first-of-type { border-top: none; }
.mc-copy {
  border: 1px dashed var(--border-strong); background: var(--surface-2); cursor: pointer;
  border-radius: 6px; padding: 2px 7px; font: inherit; font-variant-numeric: tabular-nums;
  font-weight: 600; color: var(--text);
}
.mc-copy:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.mc-copy.copied { border-style: solid; border-color: var(--green); color: var(--green);
                  background: var(--green-soft); }
.mc-copy.mc-check { font-weight: 500; color: var(--text-muted); }
.mc-amt { font-variant-numeric: tabular-nums; margin-left: auto; }
.mc-foot { margin-top: 5px; padding-top: 4px; border-top: 1px solid var(--border); }

/* compact rebate cell: what we expect, what was approved */
.rebate-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rebate-cell .row-in { display: flex; gap: 4px; align-items: center; }
.rebate-cell input { width: 84px; text-align: right; }
.rebate-hint { font-size: 10.5px; color: var(--text-soft); }
.rebate-hint.diff { color: var(--amber); font-weight: 600; }

/* a rebate that walked away from the CMP figure blocks the statement */
.grid tr.rebate-off > td { background: var(--amber-soft); }
.rebate-cell input.off { border-color: var(--amber); background: #fffdf7; }
.rebate-warning { background: var(--amber-soft); color: var(--amber); border-color: #f0dcba; }
.btn.sm.amber { background: var(--amber); color: #fff; border-color: var(--amber); }
.btn.sm.amber:hover { filter: brightness(1.05); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------------------------------------------------------------------------
   Corner toasts — nothing on this portal interrupts the page any more
   --------------------------------------------------------------------------- */
.toasts {
  position: fixed; right: 16px; bottom: 16px; z-index: 900;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; flex-direction: column; gap: 1px;
  max-width: 360px; padding: 10px 30px 10px 12px; position: relative;
  background: var(--surface); color: var(--text); text-decoration: none;
  border: 1px solid var(--border-strong); border-left: 3px solid var(--blue);
  border-radius: var(--r-sm); box-shadow: var(--shadow-lg); font-size: 12.5px;
  opacity: 0; transform: translateY(8px); transition: opacity .18s, transform .18s;
}
.toast.in { opacity: 1; transform: translateY(0); }
.toast b { font-size: 12.5px; }
.toast span { color: var(--text-muted); }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }
a.toast:hover { border-color: var(--brand); }
.toast-x {
  position: absolute; top: 4px; right: 5px; border: none; background: none;
  color: var(--text-soft); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 4px;
}
.toast-x:hover { color: var(--text); }
.badge.tail.hidden { display: none; }

/* compact statement table */
.grid.tight th, .grid.tight td { padding: 5px 8px; font-size: 12px; }
.grid.tight .rebate-cell input { width: 74px; padding: 3px 6px; font-size: 12px; }
.btn.xs { padding: 3px 8px; font-size: 11px; border-radius: 7px; }
@media (max-width: 760px) { .toasts { left: 12px; right: 12px; } .toast { max-width: none; } }

/* the dock says what a message written here will be stamped with */
.cd-context {
  padding: 4px 10px; font-size: 11px; color: var(--brand-ink);
  background: var(--brand-soft); border-top: 1px solid #f7d3c2;
}
.cd-ticket.cd-stmt { background: var(--purple-soft); color: var(--purple); }
.cd-ticket.cd-stmt:hover { background: var(--purple); color: #fff; }

/* the desk tiles are doors now */
a.tile { text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; }
a.tile:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--brand); }

/* who read a message, and when — one click on the ticks */
.cd-readmark { position: relative; display: inline-block; }
.cd-ticks.read { cursor: pointer; }
.cd-ticks b { font-size: 9px; margin-left: 1px; font-weight: 700; }
.rd-pop {
  position: absolute; right: 0; bottom: calc(100% + 5px); z-index: 70; min-width: 168px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); box-shadow: var(--shadow-lg); padding: 7px 9px;
  text-align: left; white-space: nowrap;
}
.rd-head { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.rd-line {
  display: flex; justify-content: space-between; gap: 12px; font-size: 12px;
  padding: 2px 0; border-top: 1px solid var(--border);
}
.rd-line:first-of-type { border-top: none; }
.rd-at { color: var(--text-soft); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   Payment desk: a request opens in place, split in two
   --------------------------------------------------------------------------- */
.grid.queue tbody tr.q-row { cursor: pointer; }
.grid.queue tbody tr.q-row:hover > td { background: var(--surface-2); }
.grid.queue tbody tr.q-row.open > td { background: var(--brand-soft); }
.grid.queue .q-caret { color: var(--text-soft); font-size: 11px; transition: transform .15s; }
.grid.queue tr.q-row.open .q-caret { transform: rotate(180deg); display: inline-block; }

.desk-panel { border-color: var(--brand); }
.desk-split {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px 270px; gap: 18px;
}
.desk-split > div { min-width: 0; }
.desk-split .dp-chat,
.desk-split .dp-pay { border-left: 1px solid var(--border); padding-left: 18px; }
.desk-split .tchat-list.tall { max-height: 340px; min-height: 200px; }
.desk-split .field { margin-bottom: 6px; }
.desk-split .report-head .r-amount strong { font-size: 17px; }
.desk-split .grid th, .desk-split .grid td { padding: 5px 8px; font-size: 12px; }

/* narrower screens: invoices on top, conversation and payment side by side */
@media (max-width: 1340px) {
  .desk-split { grid-template-columns: minmax(0, 1fr) 270px; }
  .desk-split .dp-main { grid-column: 1 / -1; }
  .desk-split .dp-chat { border-left: none; padding-left: 0;
                         border-top: 1px solid var(--border); padding-top: 12px; }
  .desk-split .dp-pay { border-top: 1px solid var(--border); padding-top: 12px; }
}
@media (max-width: 900px) {
  .desk-split { grid-template-columns: 1fr; }
  .desk-split .dp-pay { border-left: none; padding-left: 0; }
}

/* ---------------------------------------------------------------------------
   Vendor bank details
   --------------------------------------------------------------------------- */
.bankbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 8px 12px; margin-top: 10px; font-size: 13px;
}
.bankbar .muted.small { display: block; font-size: 10.5px; letter-spacing: .04em; }
.bank-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px;
  border-top: 1px solid var(--border); padding: 12px 0;
}
.bank-row:first-of-type { border-top: none; }
.bank-row .bank-act { border-left: 1px solid var(--border); padding-left: 16px; }
.bank-fields { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.bf { display: flex; flex-direction: column; gap: 1px; }
.bf span { font-size: 10px; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.bf b { font-size: 13px; }
.bf .mono, .bf.copyable .mc-copy { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.bf.copyable { margin-bottom: 6px; }
.bank-proof { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }
@media (max-width: 900px) {
  .bank-row { grid-template-columns: 1fr; }
  .bank-row .bank-act { border-left: none; padding-left: 0; border-top: 1px solid var(--border);
                        padding-top: 10px; }
}

/* the payer's column: who we pay to, then the confirmation, both compact */
.bankcard {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 7px 9px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 2px;
}
.bankcard.warn { background: var(--amber-soft); border-color: #f0dcba; }
.bc-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-soft); margin-bottom: 2px;
}
.bc-eye {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted);
  border-radius: 6px; padding: 1px 6px; font-size: 10px; cursor: pointer; letter-spacing: .02em;
}
.bc-eye:hover { border-color: var(--brand); color: var(--brand); }
.bankcard .bl {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 11.5px; color: var(--text-muted);
}
.bankcard .bl b { font-weight: 500; color: var(--text); text-align: right;
                  font-variant-numeric: tabular-nums; }
.bankcard .bl .mc-copy { padding: 0 5px; font-size: 11.5px; font-weight: 500; }
.paycompact .field { margin-bottom: 7px; font-size: 11px; }
.paycompact input[type=text] { padding: 5px 8px; font-size: 12.5px; }
.paycompact input[type=file] { font-size: 11px; }
.paycompact .btn { width: 100%; }

/* thumbnail of whatever was pasted into an upload field */
.paste-preview:not(:empty) { margin-top: 6px; }
.paste-preview .cd-att { display: flex; align-items: center; gap: 8px; }
.paste-preview img { max-height: 90px; border-radius: 6px; border: 1px solid var(--border); }

/* the desk tiles are doors now */
a.tile { text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; }
a.tile:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--brand); }

/* who read a message, and when — one click on the ticks */
.cd-readmark { position: relative; display: inline-block; }
.cd-ticks.read { cursor: pointer; }
.cd-ticks b { font-size: 9px; margin-left: 1px; font-weight: 700; }
.rd-pop {
  position: absolute; right: 0; bottom: calc(100% + 5px); z-index: 70; min-width: 168px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); box-shadow: var(--shadow-lg); padding: 7px 9px;
  text-align: left; white-space: nowrap;
}
.rd-head { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.rd-line {
  display: flex; justify-content: space-between; gap: 12px; font-size: 12px;
  padding: 2px 0; border-top: 1px solid var(--border);
}
.rd-line:first-of-type { border-top: none; }
.rd-at { color: var(--text-soft); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   Payment desk: a request opens in place, split in two
   --------------------------------------------------------------------------- */
.grid.queue tbody tr.q-row { cursor: pointer; }
.grid.queue tbody tr.q-row:hover > td { background: var(--surface-2); }
.grid.queue tbody tr.q-row.open > td { background: var(--brand-soft); }
.grid.queue .q-caret { color: var(--text-soft); font-size: 11px; transition: transform .15s; }
.grid.queue tr.q-row.open .q-caret { transform: rotate(180deg); display: inline-block; }

.desk-panel { border-color: var(--brand); }
.desk-split {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px 270px; gap: 18px;
}
.desk-split > div { min-width: 0; }
.desk-split .dp-chat,
.desk-split .dp-pay { border-left: 1px solid var(--border); padding-left: 18px; }
.desk-split .tchat-list.tall { max-height: 340px; min-height: 200px; }
.desk-split .field { margin-bottom: 6px; }
.desk-split .report-head .r-amount strong { font-size: 17px; }
.desk-split .grid th, .desk-split .grid td { padding: 5px 8px; font-size: 12px; }

/* narrower screens: invoices on top, conversation and payment side by side */
@media (max-width: 1340px) {
  .desk-split { grid-template-columns: minmax(0, 1fr) 270px; }
  .desk-split .dp-main { grid-column: 1 / -1; }
  .desk-split .dp-chat { border-left: none; padding-left: 0;
                         border-top: 1px solid var(--border); padding-top: 12px; }
  .desk-split .dp-pay { border-top: 1px solid var(--border); padding-top: 12px; }
}
@media (max-width: 900px) {
  .desk-split { grid-template-columns: 1fr; }
  .desk-split .dp-pay { border-left: none; padding-left: 0; }
}

/* ---------------------------------------------------------------------------
   Vendor bank details
   --------------------------------------------------------------------------- */
.bankbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 8px 12px; margin-top: 10px; font-size: 13px;
}
.bankbar .muted.small { display: block; font-size: 10.5px; letter-spacing: .04em; }
.bank-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px;
  border-top: 1px solid var(--border); padding: 12px 0;
}
.bank-row:first-of-type { border-top: none; }
.bank-row .bank-act { border-left: 1px solid var(--border); padding-left: 16px; }
.bank-fields { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.bf { display: flex; flex-direction: column; gap: 1px; }
.bf span { font-size: 10px; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
.bf b { font-size: 13px; }
.bf .mono, .bf.copyable .mc-copy { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.bf.copyable { margin-bottom: 6px; }
.bank-proof { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }
@media (max-width: 900px) {
  .bank-row { grid-template-columns: 1fr; }
  .bank-row .bank-act { border-left: none; padding-left: 0; border-top: 1px solid var(--border);
                        padding-top: 10px; }
}

/* the payer's column: who we pay to, then the confirmation, both compact */
.bankcard {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 7px 9px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 2px;
}
.bankcard.warn { background: var(--amber-soft); border-color: #f0dcba; }
.bc-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-soft); margin-bottom: 2px;
}
.bc-eye {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted);
  border-radius: 6px; padding: 1px 6px; font-size: 10px; cursor: pointer; letter-spacing: .02em;
}
.bc-eye:hover { border-color: var(--brand); color: var(--brand); }
.bankcard .bl {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 11.5px; color: var(--text-muted);
}
.bankcard .bl b { font-weight: 500; color: var(--text); text-align: right;
                  font-variant-numeric: tabular-nums; }
.bankcard .bl .mc-copy { padding: 0 5px; font-size: 11.5px; font-weight: 500; }
.paycompact .field { margin-bottom: 7px; font-size: 11px; }
.paycompact input[type=text] { padding: 5px 8px; font-size: 12.5px; }
.paycompact input[type=file] { font-size: 11px; }
.paycompact .btn { width: 100%; }

/* thumbnail of whatever was pasted into an upload field */
.paste-preview:not(:empty) { margin-top: 6px; }
.paste-preview .cd-att { display: flex; align-items: center; gap: 8px; }
.paste-preview img { max-height: 90px; border-radius: 6px; border: 1px solid var(--border); }

/* ---------------------------------------------------------------------------
   TV dashboard — two screens, read from across the room
   --------------------------------------------------------------------------- */
body.tv {
  background: var(--bg); color: var(--text); margin: 0; padding: 18px 22px;
  height: 100vh; box-sizing: border-box; display: flex; flex-direction: column; gap: 14px;
  overflow: hidden;
}
.tvtop { display: flex; align-items: center; justify-content: space-between; }
.tvbrand { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.tvdots { display: flex; gap: 8px; }
.tvdots .dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong);
  cursor: pointer;
}
.tvdots .dot.on { background: var(--brand); }
.tvclock { text-align: right; font-size: 13px; }
.tvclock b { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.tvclock .bad { color: var(--red); font-weight: 700; }

.tvpage { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 14px; }
.tvpage.on { display: flex; }

.tvmetrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tvm {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px 18px; display: flex; flex-direction: column; gap: 2px;
}
.tvm .k { font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
          color: var(--text-muted); font-weight: 700; }
.tvm .v { font-size: 40px; font-weight: 800; line-height: 1.05;
          font-variant-numeric: tabular-nums; }
.tvm .v.amber { color: var(--amber); }
.tvm .v.green { color: var(--green); }
.tvm .s { font-size: 13px; color: var(--text-soft); }

.tvsplit { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; flex: 1 1 auto; min-height: 0; }
.tvbox {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px 16px; overflow: hidden; display: flex; flex-direction: column;
}
.tvbox h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .05em;
            color: var(--text-muted); margin: 0 0 8px; }
.tvline {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: baseline;
  padding: 9px 0; border-top: 1px solid var(--border); font-size: 18px;
}
.tvline:first-child { border-top: none; }
.tvline .n { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvline .tag { font-size: 12px; color: var(--text-soft); }
.tvline .a { font-weight: 800; font-variant-numeric: tabular-nums; }
.tvline .bar { grid-column: 1 / -1; height: 4px; margin-top: 4px; }
.tvline.warn .a { color: var(--amber); }
.tvline.crit .a { color: var(--red); }
.tvline.crit .bar > div { background: var(--red); }
.tvline.warn .bar > div { background: #f59e0b; }
.tvempty { color: var(--text-soft); font-size: 16px; padding: 10px 0; }

.tvcards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 10px; overflow: auto; align-content: start; flex: 1 1 auto;
}
.tvcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 9px 11px;
}
.tvcard .h { font-size: 13.5px; font-weight: 700; margin-bottom: 5px;
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvcard .acc { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
               padding-top: 5px; margin-top: 5px; border-top: 1px solid var(--border); }
.tvcard .acc:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }
.tvcard .acc .t { font-size: 11px; color: var(--text-muted); }
.tvcard .acc .m { font-size: 12.5px; font-weight: 700; text-align: right; }
.tvcard .acc .p { font-size: 11px; color: var(--text-soft); text-align: right; }
.tvcard .acc .bar { grid-column: 1 / -1; height: 4px; }
.tvcard .acc.warn .m { color: var(--amber); }
.tvcard .acc.warn .bar > div { background: #f59e0b; }
.tvcard .acc.crit .m { color: var(--red); }
.tvcard .acc.crit .bar > div { background: var(--red); }

@media (max-width: 1200px) {
  .tvmetrics { grid-template-columns: repeat(2, 1fr); }
  .tvsplit { grid-template-columns: 1fr; }
}

/* a line an EFS code already paid */
.mc-warning.partial { background: var(--amber-soft); color: var(--amber); border-color: #f0dcba; }
.mc-flag { font-size: 10px; color: var(--red); font-weight: 600; }
.stack { display: block; margin-bottom: 3px; }
.btn.xs.green { background: var(--green); color: #fff; border-color: var(--green); }
.mc-actions { margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--border);
              display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------------------------------------------------------------------------
   TV dashboard — the portal's own components, sized for a wall
   --------------------------------------------------------------------------- */
body.tv {
  background: var(--bg); padding: 20px 26px; height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; gap: 16px; box-sizing: border-box;
}
.tv-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.tv-head .brand { margin: 0; }
.tv-head .brand .name { font-size: 16px; }
.tv-nav { display: flex; gap: 8px; }
.tv-dot {
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer;
  border-radius: var(--r-pill); padding: 5px 14px; font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--text-muted);
}
.tv-dot.on { background: var(--brand-soft); color: var(--brand-ink); border-color: #f7d3c2; }
.tv-clock { text-align: right; font-size: 12.5px; color: var(--text-muted); }
.tv-clock b { display: block; font-size: 17px; color: var(--text);
              font-variant-numeric: tabular-nums; }
.tv-clock .bad { color: var(--red); font-weight: 700; }

.tv-page { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 16px; }
.tv-page.on { display: flex; }
body.tv .tiles { grid-template-columns: repeat(4, 1fr); }
body.tv .tile { padding: 16px 20px; }
body.tv .tile .label { font-size: 12px; }
body.tv .tile .value { font-size: 42px; margin-top: 8px; }
body.tv .tile .sub { font-size: 14px; }

.tv-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; flex: 1 1 auto; min-height: 0; }
.tv-split .card { overflow: hidden; display: flex; flex-direction: column; margin: 0; }
body.tv .section-title { font-size: 13px; }
.tv-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: baseline;
  padding: 10px 0; border-top: 1px solid var(--border); font-size: 19px;
}
.tv-row:first-of-type { border-top: none; }
.tv-row .who { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-row .muted { font-size: 14px; }
.tv-row .amt { font-weight: 800; font-variant-numeric: tabular-nums; }
.tv-row .bar { grid-column: 1 / -1; margin-top: 4px; }
.tv-row.warn .amt { color: var(--amber); }
.tv-row.crit .amt { color: var(--red); }

body.tv .vendor-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  overflow: auto; align-content: start; flex: 1 1 auto;
}
body.tv .vendor-card { padding: 10px 12px; }
body.tv .vc-name { font-size: 13.5px; }
body.tv .acct-figs { font-size: 13px; }
body.tv .acct-meta { font-size: 11px; }

@media (max-width: 1200px) {
  body.tv .tiles { grid-template-columns: repeat(2, 1fr); }
  .tv-split { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------------
   Density pass — the whole portal reads in one window
   --------------------------------------------------------------------------- */
.grid th, .grid td { padding: 6px 9px; }
.grid th { font-size: 10.5px; }
.grid td { font-size: 12.5px; }
.tiles { gap: 10px; margin-bottom: 10px; }
.tile { padding: 10px 13px; border-radius: var(--r); }
.tile .value { font-size: 22px; margin-top: 3px; }
.tile .sub { font-size: 11.5px; margin-top: 2px; }
.statbar { gap: 8px; margin-bottom: 10px; }
.statbar .stat { padding: 7px 11px; }
.statbar .stat .v { font-size: 19px; }
.filters { gap: 8px; }
.field { font-size: 11px; }
.field input, .field select, .field textarea { padding: 6px 9px; font-size: 12.5px; }
.btn { padding: 7px 13px; font-size: 12.5px; }
.btn.sm { padding: 4px 10px; font-size: 11.5px; }
.vendor-card { padding: 10px 12px; }
.mt { margin-top: 8px; }
.page-sub { font-size: 12.5px; }

/* the sidebar gives the content its width back */
:root { --sidebar-w: 208px; }
.sidebar nav a { padding: 7px 12px; font-size: 13px; }
.brand { padding: 12px 14px; }

/* more vendors per row, same card */
.vendor-grid { grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 10px; }
/* the tabs strip doubles as the page's own toolbar */
.tabs a { padding: 5px 11px; font-size: 12px; }

/* what the portal does on its own */
.autogrid { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; }
.chk { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.chk input { width: 15px; height: 15px; }
.chk b { font-weight: 700; }

/* an urgent payment stands out in the queue */
.grid.queue tr.q-row .rush { color: var(--red); border-color: #f0cfcf; }
.grid.queue tr.q-row .rush:hover { background: var(--red-soft); border-color: var(--red); }

/* the bot's wording: one box per message, emoji within reach */
.tplgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 12px; }
.tpl { background: var(--surface-2); border: 1px solid var(--border);
       border-radius: var(--r-sm); padding: 9px 10px; }
.tpl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 5px;
            font-size: 12.5px; }
.tpl-keys { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.chip {
  border: 1px dashed var(--border-strong); background: var(--surface); cursor: pointer;
  border-radius: 6px; padding: 1px 6px; font-size: 10.5px; color: var(--text-muted);
  font-family: inherit;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.tpl textarea { width: 100%; resize: vertical; font-size: 12.5px; line-height: 1.5;
                background: var(--surface); }
.emojibar { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.emoji { border: none; background: none; cursor: pointer; font-size: 16px; line-height: 1;
         padding: 2px 3px; border-radius: 6px; }
.emoji:hover { background: var(--brand-soft); }
.tpl-prev { margin-top: 6px; font-size: 11.5px; max-height: 120px; overflow: auto; }

/* one click from an invoice to the systems that can correct it */
.src { position: relative; display: inline-block; margin-left: 2px; }
.src-btn {
  border: none; background: none; cursor: pointer; color: var(--text-soft);
  font-size: 11px; line-height: 1; padding: 2px 3px; border-radius: 5px; opacity: .6;
}
.src-btn:hover, .src.open .src-btn {
  background: var(--brand-soft); color: var(--brand); opacity: 1;
}
/* fixed, so a table that scrolls sideways cannot cut it off */
.src-pop {
  position: fixed; z-index: 90; min-width: 148px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); box-shadow: var(--shadow-lg); padding: 4px;
  text-align: left; white-space: nowrap;
}
.src-pop[hidden] { display: none; }
.src-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 4px 7px; border-radius: 6px; font-size: 12px; color: var(--text);
  text-decoration: none;
}
a.src-item:hover { background: var(--brand-soft); color: var(--brand); }
.src-sys { font-weight: 600; }
.src-id { font-size: 11px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.src-item.off { opacity: .5; }

/* ---------------------------------------------------------------------------
   Analytics: forecast bars, duplicate groups
   --------------------------------------------------------------------------- */
.fcast { display: flex; gap: 4px; align-items: flex-end; overflow-x: auto; padding-bottom: 2px; }
.fc { flex: 1 1 26px; min-width: 26px; text-align: center; }
.fc-bar { height: 76px; display: flex; align-items: flex-end; justify-content: center;
          background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.fc-bar span { display: block; width: 100%; background: var(--border-strong);
               border-radius: 5px 5px 0 0; min-height: 2px; }
.fc.has .fc-bar span { background: var(--brand); }
.fc.today .fc-bar { outline: 2px solid var(--brand); outline-offset: 1px; }
.fc-day { font-size: 10px; color: var(--text-soft); margin-top: 3px; }
.fc-amt { font-size: 10px; font-weight: 700; color: var(--brand-ink); }

.dup { border-top: 1px solid var(--border); padding: 8px 0; }
.dup:first-of-type { border-top: none; }
.dup-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; }
.dup-rows { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.dup-row { font-size: 12px; color: var(--text-muted); }

/* ---------------------------------------------------------------------------
   Banners: news that has to be closed by hand
   --------------------------------------------------------------------------- */
.banner-wall { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.banner {
  display: flex; align-items: flex-start; gap: 16px;
  border: 1px solid var(--border-strong); border-left: 5px solid var(--brand);
  border-radius: 12px; padding: 16px 18px; background: var(--surface);
  box-shadow: 0 6px 20px rgba(20, 20, 19, .08);
}
.banner.good { border-left-color: var(--green, #17803d); }
.banner.warn { border-left-color: var(--amber, #b45309); }
.banner-body { flex: 1 1 auto; }
.banner-kicker {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-soft); font-weight: 700;
}
.banner h2 { margin: 4px 0 0; font-size: 19px; line-height: 1.25; }
.banner p { margin: 6px 0 0; font-size: 13px; color: var(--text-muted); }
.banner .btn { margin-top: 10px; }
.banner-x { flex: 0 0 auto; margin: 0; }
.banner-close {
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); font-size: 20px; line-height: 1;
}
.banner-close:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.banner-readers { font-size: 12px; color: var(--text-muted); }

.rebate-temp { display: flex; align-items: center; gap: 5px; justify-content: flex-end;
               font-size: 11px; color: var(--text-soft); margin-top: 3px; }
.rebate-temp input { margin: 0; }

/* a corrected copy, and adding invoices to an open draft */
.corr-box { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.add-lines { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.add-lines > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.add-lines > summary .muted { font-weight: 400; margin-left: 6px; }
.add-lines[open] > summary { margin-bottom: 8px; }

/* the X in a dialog's corner, and the part-paid rows under an invoice */
.modal .box { position: relative; }
.box-x {
  position: absolute; top: 10px; right: 12px; width: 30px; height: 30px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.box-x:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.grid tr.sub-line td { border-top: none; padding-top: 0; padding-bottom: 4px; }

/* ---------------------------------------------------------------------------
   EFS filter bar: which slice, how it is narrowed, what came back
   --------------------------------------------------------------------------- */
.filterbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 0 0 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border);
}
.fb-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px;
           border-radius: 11px; flex: 0 0 auto; }
.fb-tab {
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); text-decoration: none;
}
.fb-tab:hover { color: var(--text); background: var(--surface); }
.fb-tab.active { background: var(--text); color: var(--surface); }
.fb-tab .n {
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 1px 6px; border-radius: 20px; background: var(--border);
  color: var(--text-muted);
}
.fb-tab.active .n { background: rgba(255, 255, 255, .18); color: #fff; }

.fb-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
           flex: 1 1 420px; margin: 0; }
.fb-field { display: flex; flex-direction: column; gap: 4px; flex: 0 1 230px; }
.fb-field.wide { flex: 1 1 240px; }
.fb-field .k {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-soft); font-weight: 700;
}
.fb-field input { width: 100%; }
.fb-form .btn { flex: 0 0 auto; }
.fb-count { margin-left: auto; font-size: 12px; color: var(--text-muted);
            white-space: nowrap; }
.fb-count b { color: var(--text); font-variant-numeric: tabular-nums; }

/* what the ticked invoices add up to: pinned to the bottom of the screen,
   so the sums stay readable however far down the table you are */
.seltotal {
  position: sticky; bottom: 10px; z-index: 30;
  margin-top: 10px; padding: 11px 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(20, 20, 19, .14);
  font-size: 13px; color: var(--text-muted);
}
.seltotal b { color: var(--text); font-variant-numeric: tabular-nums; }
.seltotal .st-picked { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.seltotal .st-picked .st-n { color: var(--brand); font-weight: 600; }

/* the proof behind a "by ACH" badge */
.paid-proof {
  display: block; width: 100%; max-height: 220px; object-fit: contain;
  margin-top: 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: zoom-in;
}
.badge.faded { opacity: .72; }

/* Who has taken a shop on. A mark beside the name and not a column of its
   own: the dashboard is already eleven columns wide on a laptop, and this
   is read at a glance or not at all. Your own subscription is the brand
   colour, somebody else's is grey -- "is it covered" and "is it mine" are
   two different questions and the row answers both without being opened. */
.wmark {
  display: inline-block; margin-left: 5px; padding: 0 5px;
  border-radius: 9px; background: var(--surface-3); color: #555c69;
  font-size: 9.5px; font-weight: 700; letter-spacing: .4px; line-height: 15px;
  vertical-align: 1px; cursor: default;
}
.wmark.me { background: var(--brand-soft); color: var(--brand); }

/* How many cases on this shop nobody has read the amount on. Beside the
   balance dot and the watcher's initials, because it is the same kind of
   thing: read at a glance, or not at all. Amber, because it is work
   waiting rather than a figure being reported, and a link, because the
   whole point is to go and clear it. */
.chkmark {
  display: inline-block; min-width: 15px; margin-left: 5px; padding: 0 5px;
  border-radius: 9px; background: var(--amber-soft); color: var(--amber);
  font-size: 9.5px; font-weight: 700; line-height: 15px; text-align: center;
  text-decoration: none; vertical-align: 1px;
}
.chkmark:hover { background: var(--amber); color: #fff; }

/* Has anybody confirmed this invoice's amount. A dot rather than a badge:
   it sits in front of the number so the eye runs down one column instead
   of reading every row, and it takes the width of a full stop. `off` is
   the settled case -- it keeps the column aligned and says nothing. */
.vdot {
  display: inline-block; width: 7px; height: 7px; margin-right: 6px;
  border-radius: 50%; vertical-align: 1px;
}
.vdot.no { background: var(--red); }
.vdot.ok { background: var(--green); }
.vdot.off { background: transparent; }

/* The audit trail: one record is a line and, under it, what the line had no
   room for. Shut until somebody clicks, because most of the time the line
   is the whole answer. */
.grid.audit tbody.arow > tr > td { border-bottom: 0; }
.grid.audit tbody.arow + tbody.arow { border-top: 1px solid var(--border); }
.grid.audit tbody.arow:not(.bare) { cursor: pointer; }
.grid.audit tbody.arow:not(.bare):hover > tr > td { background: var(--surface-2); }
.grid.audit td.twist { width: 1%; color: var(--text-soft); padding-right: 0; }
.grid.audit td.twist .caret { display: inline-block; font-size: 9px; transition: transform .12s; }
.grid.audit tbody.arow.open td.twist .caret { transform: rotate(90deg); }
.grid.audit tr.detail { display: none; }
.grid.audit tbody.arow.open tr.detail { display: table-row; }
.grid.audit tr.detail > td { padding-top: 0; }

/* The values in full, not cut to fit a column -- that is the whole reason
   this opens at all. */
.achange { display: grid; gap: 3px; padding: 2px 0 8px; max-width: 110ch; }
.achange > div { font-size: 12.5px; line-height: 1.45; white-space: normal; }
.achange .k {
  display: inline-block; min-width: 86px; padding-right: 10px;
  color: var(--text-soft);
  font-size: 10px; text-transform: uppercase; letter-spacing: .4px;
}
.achange .was { color: var(--text-muted); }
.achange .was, .achange .now { font-variant-numeric: tabular-nums; }
.achange .now { color: var(--text); font-weight: 600; }
.achange .when { color: var(--text-soft); font-size: 11.5px; }

/* the same thing spelled out on the shop's own page, where there is room */
.watchline { display: inline-flex; align-items: center; gap: 5px; }
.watchline form { display: inline; margin: 0; }

/* the list of your own shops: one line until it is asked for */
.card.watchlist { padding: 10px 14px; }
.card.watchlist > summary { cursor: pointer; }
.card.watchlist[open] > summary { margin-bottom: 8px; }
.card.watchlist form { display: inline; margin: 0; }

/* tick as many filters as needed */
.invfilters { display: flex; flex-direction: column; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chips-k {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-soft); font-weight: 700; margin-right: 4px; min-width: 46px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 5px 11px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-muted); white-space: nowrap;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip input { margin: 0; }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }

/* an attachment can be taken off before the form is sent */
.cd-att { position: relative; }
.cd-drop {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px;
  border-radius: 50%; border: 1px solid var(--border-strong); cursor: pointer;
  background: var(--surface); color: var(--text-muted); font-size: 13px;
  line-height: 1; padding: 0;
}
.cd-drop:hover { background: var(--red, #b42318); border-color: var(--red, #b42318); color: #fff; }
.proof-item { position: relative; margin-top: 8px; }
.proof-item .cd-drop { top: 2px; right: 2px; }
.proof-add { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 8px; }
.proof-add input[type=file] { font-size: 11px; }

/* the only trace of a chat that was closed for good */
.chat-handle {
  position: fixed; right: 18px; bottom: 18px; z-index: 40;
  padding: 9px 16px; border-radius: 22px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-muted); font-size: 12px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(20, 20, 19, .12);
}
.chat-handle:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.share-in { width: 92px; text-align: right; }

/* the payer's one question: how much */
.r-amount.big { text-align: right; }
.r-amount.big strong { font-size: 34px; line-height: 1.05; letter-spacing: -.02em; }

/* ---------- split view: two portal pages in one window ------------------ */
/* A page loaded inside a pane keeps only its content: the window already
   has one sidebar, one topbar and one clock, and a second set of them would
   eat the room the tables need. */
.in-pane .sidebar,
.in-pane .topbar,
.in-pane .chat-handle,
.in-pane .banner-wall { display: none !important; }
.in-pane .layout { min-height: 0; }
.in-pane .content { padding: 10px 12px 18px; max-width: none; }
.in-pane body.has-chatdock .content { padding-right: 12px; }

.split-wrap {
  display: flex;
  gap: 8px;
  height: calc(100vh - 92px);
  min-height: 420px;
}
.split-wrap.rows { flex-direction: column; }
.split-wrap.cols { flex-direction: row; }

.split-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--card, #fff);
  border: 1px solid var(--line, #e6e6e4);
  border-radius: 12px;
  overflow: hidden;
}
.split-wrap.rows .split-pane { flex: 1 1 50%; }
.split-wrap.cols .split-pane { flex: 1 1 50%; }

.split-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line, #e6e6e4);
  background: var(--soft, #faf9f7);
  flex: 0 0 auto;
}
.split-bar .split-title {
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.split-bar select { max-width: 190px; }
.split-bar input.split-url {
  flex: 1 1 120px;
  min-width: 90px;
  font-size: 12px;
  padding: 3px 6px;
}
.split-bar .iconbtn {
  border: 1px solid var(--line, #e6e6e4);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 4px 7px;
  color: var(--muted, #6b6b68);
}
.split-bar .iconbtn:hover { border-color: var(--brand); color: var(--brand); }

.split-pane iframe {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  background: var(--bg, #fff);
}

/* the grip between the two panes */
.split-grip { flex: 0 0 6px; border-radius: 6px; background: transparent; }
.split-wrap.rows .split-grip { cursor: row-resize; }
.split-wrap.cols .split-grip { cursor: col-resize; }
.split-grip:hover, .split-grip.dragging { background: var(--brand); opacity: .35; }

@media (max-width: 900px) {
  .split-wrap.cols { flex-direction: column; }
  .split-wrap { height: auto; }
  .split-pane { height: 70vh; }
}

/* A figure that comes off what we owe. The class was already being written
   in desk_statement.html and in the direct-payment adjustments, and until
   now it did nothing, so a credit read exactly like a charge. */
.neg, .neg b, b.neg { color: var(--red); }

/* The dev instance, said on every page. Loud on purpose: it sits above
   data copied from production, so it has to be the first thing read. */
.devbar {
  margin: 0 0 14px; padding: 9px 14px; border-radius: 10px;
  background: repeating-linear-gradient(135deg, #fff4d6 0 12px, #ffecbd 12px 24px);
  border: 1px solid #e3b341; color: #7a5200; font-size: 13px;
}
.devbar b { letter-spacing: .08em; }
.devbar a { color: #7a5200; text-decoration: underline; }

/* --- the payment funnel ---------------------------------------------------
   Four lanes, read left to right the way the work moves. The lane carries the
   colour; the cards stay plain, so the one card with a flame on it is the one
   the eye lands on. */
.funnel {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 6px;
}
.lane {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  border-top: 3px solid var(--border-strong);
  padding: 8px;
  min-width: 230px;
}
.lane-need_to_pay { border-top-color: var(--blue); }
.lane-on_fire     { border-top-color: var(--red); }
.lane-in_process  { border-top-color: var(--amber); }
.lane-paid        { border-top-color: var(--green); }

.lane-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 4px 8px;
}
.lane-name { font-weight: 700; font-size: 13px; }
.lane-count {
  background: var(--surface-3);
  color: #555c69;
  border-radius: 10px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
}
.lane-sum { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.lane-empty { color: var(--text-soft); font-size: 12px; padding: 6px 4px; }

.fcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 9px;
  margin-bottom: 7px;
}
.fcard.is-hot { border-color: #f0cfcf; background: var(--red-soft); }
.fcard-name { font-weight: 600; font-size: 13px; color: var(--text); }
.fcard-name:hover { color: var(--brand); text-decoration: underline; }

.fcard-figure {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 5px 0 4px;
}
.fcard-figure b { font-size: 15px; }
.age {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-3);
  border-radius: 9px;
  padding: 0 6px;
}
.age.old { background: var(--amber-soft); color: var(--amber); font-weight: 600; }

.fcard-acc {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 11px;
  color: var(--text-muted);
  padding: 1px 0;
}
.fcard-acc .acc-name { color: var(--text); }
.fcard-acc .acc-util { margin-left: auto; font-weight: 600; }
.fcard-acc .acc-util.over { color: var(--red); }
.fcard-acc .acc-util.none { font-weight: 400; color: var(--text-soft); }

.fcard-ticket {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed var(--border);
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 12px;
}
.fcard-note {
  margin-top: 5px;
  font-size: 11px;
  color: var(--amber);
}

@media (max-width: 900px) {
  .funnel { grid-template-columns: repeat(4, minmax(210px, 1fr)); }
}
