:root {
  --bg: #f5f6f8;
  --panel: #fff;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-soft: #475467;
  --muted: #667085;
  --accent: #1f6f4a;
  --accent-hover: #1a5c3e;
  --accent-soft: #e8f3ed;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warn: #b54708;
  --warn-soft: #fffaeb;
  --warn-border: #f5d491;

  /* One spacing scale, so padding stops being invented per component. */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);

  color-scheme: light;
}

/* Visible focus everywhere, since this is worked by keyboard as much as mouse. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

*, *::before, *::after { box-sizing: border-box; }

/* Author display rules below would otherwise beat the UA's [hidden] rule. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 26px 20px 60px; }

header.page { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
header.page h1 { margin: 0; font-size: 21px; letter-spacing: -0.015em; }
.sub { margin: 5px 0 0; color: var(--muted); font-size: 13px; max-width: 62ch; }

.banner { padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 13.5px; }
.banner.mock { background: var(--warn-soft); border: 1px solid var(--warn-border); }
.banner.error { background: var(--danger-soft); border: 1px solid #fda29b; color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 13px 15px; }
.stat .label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat .value { font-size: 23px; font-weight: 600; margin-top: 3px; letter-spacing: -0.02em; }

/* Two rows, by intent: what you're looking at, then how it's narrowed.
   Eight controls in one undifferentiated row was unreadable. */
.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.controls-primary { margin-bottom: 8px; }
.controls-filters { margin-bottom: 14px; }
.controls-filters select { font-size: 13px; padding: 6px 9px; }
.controls-filters .toggle { font-size: 13px; padding: 6px 11px; }

/* A filter that is doing something should look different from one that isn't —
   with this many controls it is otherwise easy to forget one is on. */
.controls-filters select.on {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 500;
}
.ctl-divider { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }
#clearFilters { margin-left: 2px; }
.group { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
.group button { border: none; border-right: 1px solid var(--border); border-radius: 0; background: transparent; }
.group button:last-child { border-right: none; }
.group button.active { background: var(--accent); color: #fff; }
.group button.active:hover { background: var(--accent); }

button, select, input[type="text"] {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 11px;
}
button { cursor: pointer; }
button:hover { background: var(--accent-soft); }
select:focus, input:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }
.right { text-align: right; }
td.right { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.empty { color: var(--muted); font-style: italic; text-align: center; padding: 26px; }

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

/* One line per product, ellipsised — full name is in the title attribute.
   Stacking long names in full made a single row fill the screen. */
.items { font-size: 12.5px; color: var(--muted); max-width: 26ch; }
.items .item {
  color: var(--text); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.45;
}
.items .qty { color: var(--muted); font-weight: 400; }
.items .itemcount { font-size: 11px; letter-spacing: 0.01em; margin-bottom: 1px; }
.moreitems summary {
  cursor: pointer; color: var(--accent); font-size: 11.5px;
  list-style: none; margin-top: 2px;
}
.moreitems summary::-webkit-details-marker { display: none; }
.moreitems summary:hover { text-decoration: underline; }
.moreitems[open] summary { margin-bottom: 2px; }
.moreitems .lbl-less { display: none; }
.moreitems[open] .lbl-more { display: none; }
.moreitems[open] .lbl-less { display: inline; }

.links { display: flex; flex-direction: column; gap: 3px; font-size: 13px; white-space: nowrap; }
.links a { color: var(--accent); text-decoration: none; }
.links a:hover { text-decoration: underline; }



.note { margin-top: 22px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 28px; width: 100%; max-width: 380px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.05);
}
.login-card h1 { margin: 0; font-size: 19px; letter-spacing: -0.015em; }
.login-card .sub { margin: 3px 0 20px; color: var(--muted); font-size: 13px; }
.login-step { display: flex; flex-direction: column; gap: 7px; }
.login-step label { font-weight: 500; font-size: 13px; }
.login-step .hint { color: var(--muted); font-size: 12.5px; margin: 0 0 4px; }

.phone-input { display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.phone-input .prefix { display: flex; align-items: center; padding: 0 10px; background: #f2f4f6; color: var(--muted); font-size: 13.5px; border-right: 1px solid var(--border); }
.phone-input input { border: none; border-radius: 0; flex: 1; padding: 9px 11px; letter-spacing: 0.02em; }
.phone-input input:focus { outline: none; }
.phone-input:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }

.otp-input { font-size: 20px; letter-spacing: 0.35em; text-align: center; padding: 10px; font-variant-numeric: tabular-nums; }

button.primary { background: var(--accent); color: #fff; border-color: var(--accent); padding: 9px 14px; font-weight: 500; margin-top: 4px; }
button.primary:hover:not(:disabled) { background: #1a5c3e; }
button.primary:disabled { opacity: 0.6; cursor: default; }
button.link { background: none; border: none; color: var(--accent); padding: 4px 0; font-size: 12.5px; }
button.link:hover:not(:disabled) { background: none; text-decoration: underline; }
button.link:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.row { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }

/* signed-in chip in the board header */
.session { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }

/* ---------- drop stage / risk ---------- */
.risk { display: inline-block; margin-top: 3px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.risk-high { background: #fee4e2; color: #b42318; }
.risk-medium { background: #fef0c7; color: #b54708; }
.risk-low { background: #d1fadf; color: #05603a; }
.risk-control { background: #eef0f3; color: var(--muted); }

/* ---------- v2: callbacks, tags, insights ---------- */
.stat.stat-alarm { border-color: #fda29b; background: #fffbfa; }
.stat.stat-alarm .value { color: var(--danger); }
.stat.stat-warn { border-color: var(--warn-border); background: var(--warn-soft); }
.stat.stat-warn .value { color: #b54708; }

button.toggle { border-radius: 8px; }
button.toggle.active { background: var(--accent); color: #fff; border-color: var(--accent); }
button.toggle.active:hover { background: #1a5c3e; }

.cb { display: inline-block; margin-top: 4px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.cb-overdue { background: #fee4e2; color: #b42318; }
.cb-due-today { background: #fef0c7; color: #b54708; }
.cb-scheduled { background: #eef0f3; color: var(--muted); font-weight: 400; }


.tagpick { margin-top: 4px; }
.tagpick summary { cursor: pointer; font-size: 12px; color: var(--accent); list-style: none; }
.tagpick summary::-webkit-details-marker { display: none; }
.tagpick summary:hover { text-decoration: underline; }
.tagmenu { display: flex; flex-direction: column; gap: 3px; padding: 8px; margin-top: 5px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.tagmenu label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; cursor: pointer; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.chip { background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  padding: 1px 8px; font-size: 11px; white-space: nowrap; }

.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; margin-top: 22px; }
.insight { padding: 16px 18px; overflow: visible; }
.insight header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.insight h2 { font-size: 14px; margin: 0; letter-spacing: -0.01em; }

.bar-row { display: grid; grid-template-columns: 13rem 1fr 2.5rem; align-items: center; gap: 10px; margin-bottom: 7px; font-size: 12.5px; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { background: #eef0f3; border-radius: 999px; height: 8px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-count { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

table.mini { white-space: nowrap; }
table.mini th, table.mini td { padding: 7px 10px; font-size: 12.5px; }
table.mini th { position: static; }

/* ---------- mobile ----------
   NOTE: this block still contains rules for the retired table board
   (td::before, td[data-label], .status-cell, tbody tr) sitting alongside live
   ones (.links a is the 44px Call target, .insights, .bar-row, table.mini).
   They are deliberately left entangled rather than untangled during a
   correctness phase — separating them needs visual verification at three
   widths and belongs with the P4 mobile work. */
@media (max-width: 760px) {
  .wrap { padding: 16px 12px 48px; }
  header.page h1 { font-size: 18px; }

  /* Eight controls are too many to scroll sideways through on a phone, so they
     wrap and share the width instead. The range group stays one strip. */
  .controls { gap: 6px; }
  .controls-primary #search { flex: 1 1 100%; min-width: 0; }
  .controls-primary #rangeGroup { flex: 1 1 100%; }
  .controls-primary #rangeGroup button { flex: 1 1 0; min-height: 38px; }
  .controls-filters select { flex: 1 1 45%; min-width: 0; min-height: 38px; }
  .controls-filters .toggle { flex: 1 1 0; min-height: 38px; }
  .ctl-divider { display: none; }
  #clearFilters { flex: 1 1 100%; text-align: center; padding: 6px; }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat .value { font-size: 19px; }

  .panel { overflow-x: visible; border: none; background: transparent; }
  table, thead, tbody, tr, td { display: block; width: auto; }
  thead { display: none; }

  tbody tr {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
  }
  tbody tr:hover { background: var(--panel); }

  td { border: none; padding: 3px 0; white-space: normal; }
  td::before {
    content: attr(data-label);
    display: block;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 1px;
  }
  /* The customer name is the card's heading; it needs no label above it. */
  td[data-label="Customer"]::before { display: none; }
  td.right, td.right::before { text-align: left; }
  .items .item { white-space: normal; overflow: visible; text-overflow: clip; }
  td.empty::before { display: none; }

  /* Contact actions: full-width tap targets, Call and WhatsApp first. */
  td[data-label="Contact"] { margin: 10px 0 4px; }
  .links { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .links a {
    flex: 1 1 auto;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 0 14px;
    font-weight: 500;
    text-decoration: none;
  }
  .links a:hover { background: var(--accent-soft); text-decoration: none; }
  .links .muted { align-self: center; }

  .status-cell select,
  .status-cell input[type="text"],
  .tagmenu label { min-height: 32px; white-space: normal; }

  .insights { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr 4rem 2rem; gap: 8px; }
  table.mini { white-space: normal; }
}

/* ---------- search + result note ---------- */
#search { min-width: 240px; flex: 1 1 240px; max-width: 340px; }
.result-note { margin: 0 0 10px; font-size: 12.5px; color: var(--muted); }
@media (max-width: 760px) {
  #search { min-width: 200px; max-width: none; }
}

/* ---------- GoKwik outreach + repeat-buyer context ---------- */
.touched, .repeat {
  display: inline-block; margin-bottom: 3px; padding: 1px 7px;
  border-radius: 999px; font-size: 11px; font-weight: 500;
}
.touched { background: #eef2ff; color: #3538cd; }
.repeat { background: var(--accent-soft); color: var(--accent); }

a.btnlink {
  display: inline-flex; align-items: center;
  padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit;
  text-decoration: none; cursor: pointer;
}
a.btnlink:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ---------- admin / members ---------- */
.banner.success { background: #ecfdf3; border: 1px solid #a6f4c5; color: #05603a; }

.addrow { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 500; }
.field input[type="text"] { min-width: 160px; padding: 8px 11px; }
.addrow .phone-input { min-width: 190px; }
.addrow .phone-input input { padding: 8px 11px; }
.checkline { display: flex; align-items: center; gap: 7px; font-size: 13px; padding-bottom: 9px; cursor: pointer; }
.addrow button.primary { margin-top: 0; }
.hint { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }

td.actions { white-space: nowrap; }
td.actions button { padding: 5px 10px; font-size: 12.5px; margin-right: 5px; }
td.actions button:disabled { opacity: 0.45; }
td.actions button.danger { color: var(--danger); border-color: #fda29b; }
td.actions button.danger:hover:not(:disabled) { background: var(--danger-soft); }

tr.inactive { opacity: 0.55; }
.logline { display: flex; gap: 10px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.logline:last-child { border-bottom: none; }
.logline .muted { flex: 0 0 11rem; }

@media (max-width: 760px) {
  .addrow { flex-direction: column; align-items: stretch; }
  .addrow button.primary { width: 100%; min-height: 44px; }
  td.actions button { min-height: 38px; margin-bottom: 5px; }
  .logline { flex-direction: column; gap: 2px; }
  .logline .muted { flex: none; }
}

/* ---------- inline member editing ---------- */
input.js-name {
  width: 100%; min-width: 120px; max-width: 200px;
  padding: 6px 9px; font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent; background: transparent; border-radius: 6px;
}
input.js-name:hover { border-color: var(--border); background: var(--panel); }
input.js-name:focus { border-color: var(--accent); background: var(--panel); outline: none; }
.mono { font-variant-numeric: tabular-nums; }
button.linky {
  border: none; background: none; color: var(--accent);
  padding: 2px 4px; font-size: 12px; margin-left: 6px;
}
button.linky:hover { background: none; text-decoration: underline; }

/* ---------- assignment ---------- */
.callcard[data-mine="true"] { box-shadow: inset 3px 0 0 var(--accent); }

/* Header actions shouldn't break mid-label ("Export / CSV", "Sign / out"). */
.session > * { white-space: nowrap; }
@media (max-width: 760px) {
  header.page { gap: 10px; }
  .session { flex-wrap: wrap; gap: 6px; }
  .session button, .session a.btnlink { min-height: 38px; padding: 0 12px; }
  #sessionPhone { flex: 1 1 100%; }
}

/* Pack size is the detail that distinguishes two otherwise identical products,
   and it sits at the end of the name where truncation eats it. Keep it out. */
.items .item { display: flex; align-items: baseline; gap: 5px; }
.items .iname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.items .pack {
  flex: 0 0 auto; background: #eef0f3; color: var(--muted);
  border-radius: 4px; padding: 0 5px; font-size: 10.5px; font-weight: 500;
}
@media (max-width: 760px) {
  .items .item { display: block; }
  .items .iname { white-space: normal; overflow: visible; }
}

/* ---------- board column widths ----------
   Auto layout gave Customer 448px of mostly-empty space and pushed the table to
   1450px inside a 1240px panel, so "Status & notes" — the column callers
   actually use — fell off the right edge. Fixed layout, widths by importance. */

/* Long values must ellipsise rather than force the column wider. */

/* The disclosure was picking up a focus ring that made it look like an input. */
.moreitems summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

@media (max-width: 760px) {
  /* Cards, not columns — widths must not apply. */
}

#sessionPhone { font-weight: 500; color: var(--text); }

/* ---------- admin dashboard ---------- */
.stat.stat-good { border-color: #a6f4c5; background: #f6fffa; }
.stat.stat-good .value { color: #05603a; }

.onliner { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.onliner .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #12b76a;
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.15); flex: 0 0 auto;
}
.onliner .oname { font-weight: 500; }
.onliner .muted { margin-left: auto; }

/* Recovered is drawn over the total, so the shaded part is the win. */
.bar { position: relative; }
.bar-fill.bar-good { position: absolute; left: 0; top: 0; background: #12b76a; }

#dashRange { flex: 0 0 auto; }
#dashRange button { font-size: 13px; padding: 6px 11px; }

@media (max-width: 760px) {
  #dashRange { flex: 1 1 100%; }
  #dashRange button { flex: 1 1 0; min-height: 38px; }
}

/* ==========================================================================
   UI pass — hierarchy for scanning a call list
   ========================================================================== */

/* The column headers must stay visible; this list gets long. */


/* --- what the eye should land on first: who, how much, how urgent --- */

td.right .amount { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; }
td.right .disc { font-size: 11.5px; color: var(--muted); }

/* --- "Dropped at" was four stacked lines of unequal worth.
       Risk is the signal; the stage is near-constant, so it recedes. --- */
.touched, .repeat, .risk { margin-bottom: var(--s1); }

/* --- contact: these are the actions, so they look like actions --- */
.links { display: flex; flex-direction: column; gap: var(--s1); align-items: stretch; }
.links a {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 30px; padding: 0 var(--s2);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 500; text-decoration: none;
  color: var(--text-soft); background: var(--panel);
  transition: background 90ms ease, border-color 90ms ease;
}
.links a:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); text-decoration: none; }
.links a.call { background: var(--accent); border-color: var(--accent); color: #fff; }
.links a.call:hover { background: var(--accent-hover); color: #fff; }
.links .muted { font-size: 12px; text-align: center; padding: var(--s1) 0; }

/* --- status cell: group the controls so it reads as one unit --- */

/* --- skeleton rows beat the word "Loading" --- */
.sk {
  display: block; height: 10px; border-radius: 999px;
  background: linear-gradient(90deg, #eef0f3 25%, #e4e7ec 37%, #eef0f3 63%);
  background-size: 400% 100%; animation: sk 1.3s ease infinite;
}
.sk + .sk { margin-top: 6px; }
.sk.w60 { width: 60%; } .sk.w40 { width: 40%; } .sk.w80 { width: 80%; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* --- empty state that says what to do --- */
.empty-state { padding: var(--s6) var(--s4); text-align: center; }
.empty-state h3 { margin: 0 0 var(--s1); font-size: 14px; color: var(--text); }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }

/* --- panels and cards --- */
.panel { box-shadow: var(--shadow-sm); }
.stat { box-shadow: var(--shadow-sm); }
.stat .label { font-size: 11px; }
.stat .value { letter-spacing: -0.025em; }

/* Chips wrapping to two lines was most of the visual noise in this column. */
.risk, .touched, .repeat, .chip { white-space: nowrap; }
.risk { padding: 1px 8px; font-size: 11px; }

/* Two lines is enough for a timestamp; three was noise. */

/* A relative time reading "3d / ago" over two lines is just noise. */

/* Tighten the status cell without turning the <td> into a flex container —
   doing that broke table cell sizing and pushed rows from 150px to 270px. */

@media (max-width: 760px) {
  /* On a phone the carts are the job; everything above them is overhead.
     This cut the distance to the first cart roughly in half. */
  header.page .sub { display: none; }
  header.page h1 { font-size: 17px; }

  /* Downloading a CSV is not a phone task. */
  #exportCsv { display: none; }

  .stats { grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: var(--s3); }
  .stat { padding: 8px 10px; }
  .stat .label { font-size: 10px; letter-spacing: 0.03em; }
  .stat .value { font-size: 17px; margin-top: 1px; }

  .result-note { margin-bottom: var(--s2); font-size: 12px; }
  .wrap { padding-top: var(--s3); }
}

@media (max-width: 760px) {
  /* A card was 877px — one cart per screen. Most of that was the contact
     buttons stacking and a label above every single field. */
  tbody tr { padding: 10px 12px; margin-bottom: 8px; }
  td { padding: 2px 0; }
  td::before { font-size: 9.5px; margin-bottom: 0; }

  /* Obvious fields don't need a caption. */
  td[data-label="Value"]::before,
  td[data-label="Contact"]::before,
  td[data-label="Items"]::before { display: none; }

  /* Actions in one row, thumb-sized. */
  td[data-label="Contact"] { margin: 8px 0 4px; }
  .links { flex-direction: row; gap: 6px; }
  .links a { flex: 1 1 0; min-height: 42px; font-size: 13px; }

  /* Value sits with the name rather than owning a row of its own. */
  td[data-label="Value"] { margin-top: -2px; }
  td[data-label="Value"] .amount { font-size: 17px; }

  td[data-label="Abandoned"] { margin-bottom: 2px; }
  td[data-label="Abandoned"] .cb { margin-left: 6px; }


  .items .item { line-height: 1.35; }
}

/* Stat cards are the "which ones?" control, so they look pressable. */
button.stat {
  font: inherit; text-align: left; width: 100%; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel);
}
button.stat:hover { border-color: var(--accent); background: #fbfdfc; }
button.stat.stat-alarm:hover, button.stat.stat-alarm.stat-on { border-color: #fda29b; background: var(--danger-soft); }
button.stat.stat-warn:hover, button.stat.stat-warn.stat-on { border-color: var(--warn-border); background: var(--warn-soft); }

a.stat.stat-click { text-decoration: none; color: inherit; display: block; }
a.stat.stat-click:hover { border-color: var(--accent); background: #fbfdfc; }
#periodGroup button { font-size: 12.5px; padding: 5px 10px; }

/* ---------------------------------------------------------------------------
   Call queue
   ---------------------------------------------------------------------------
   The board used to be an eight-column table whose last column was an editing
   form, so a caller read a dropdown per row to see where a cart stood. These
   cards put the same controls in three fixed zones — who and why, the act of
   calling, recording what happened — which reads the same on a phone and on a
   desktop without a separate mobile layout.
--------------------------------------------------------------------------- */
.queue { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }

.callcard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(280px, 320px);
  gap: 18px;
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s3) var(--s4);
}
.callcard + .callcard { margin-top: 0; }

/* Worked, but deliberately still on screen — see saveRow. */
.callcard.cc-done { opacity: .5; }

.cc-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cc-value { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.cc-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cc-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.cc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.cc-items { margin-top: 8px; font-size: 12.5px; }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 550; border: 1px solid var(--border);
}
.tag-stage { color: var(--muted); }
.tag.risk-high { background: var(--danger-soft); border-color: #fda29b; color: #b42318; }
.tag.risk-medium { background: var(--warn-soft); border-color: var(--warn-border); color: #b54708; }
.tag.risk-low, .tag.risk-control { color: var(--muted); }

/* Calling is the job, so it gets its own zone and the only filled button. */
.cc-act .links { display: flex; flex-direction: column; gap: 6px; min-width: 104px; }
.cc-act .links a {
  display: block; text-align: center; padding: 9px 14px; border-radius: var(--r-md);
  border: 1px solid var(--border); text-decoration: none; font-size: 13px; font-weight: 550;
}
.cc-act .links a.call { background: var(--accent); border-color: var(--accent); color: #fff; }

.cc-record { display: flex; flex-direction: column; gap: 6px; }
/* Status and callback time share a line only while both stay readable. At
   phone width they were splitting it 50/50, which truncated the status to
   "Callback s…" — the one word on the card that has to be legible. */
.cc-outcome { display: flex; gap: 6px; flex-wrap: wrap; }
.cc-outcome select { flex: 1 1 11rem; min-width: 0; }
.cc-outcome input[type="datetime-local"] { flex: 1 1 11rem; min-width: 0; }
.cc-record select, .cc-record input[type="text"], .cc-record input[type="datetime-local"] {
  width: 100%; font-size: 13px;
}
.cc-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; }
.cc-foot .js-assign { width: auto; flex: 1 1 120px; font-size: 12px; }
.cc-foot .saved { color: var(--muted); }
.cc-foot .saved.pending { color: var(--accent); }
.cc-foot .saved.failed { color: var(--danger); }

.callcard.skeleton { display: block; }
.callcard.skeleton .sk { display: block; margin-bottom: 8px; }

@media (max-width: 900px) {
  /* One column, in working order: who, then call, then record. */
  .callcard { grid-template-columns: 1fr; gap: 12px; }
  .cc-act .links { flex-direction: row; }
  .cc-act .links a { flex: 1; padding: 11px 14px; }   /* ~44px touch targets */
}

/* --- outcome: notes, reasons, history ------------------------------------ */
.cc-record textarea.js-notes {
  width: 100%; font: inherit; font-size: 13px; line-height: 1.45;
  padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--r-sm);
  resize: vertical; min-height: 44px; background: var(--panel); color: var(--text);
}
.cc-record textarea.js-notes:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* A callback with no time is the one save the server refuses, so the field
   says so itself rather than leaving the caller to find a banner. */
.js-callback.needed { border-color: var(--warn-border); background: var(--warn-soft); }
.cb-hint { font-size: 11.5px; color: var(--warn); }
.cb.cb-missing { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }

/* Reasons read as one question with tappable answers, not a checkbox list. */
.tagpick > summary { font-size: 12px; color: var(--muted); cursor: pointer; padding: 2px 0; }
.tagpick[open] > summary { color: var(--text-soft); margin-bottom: 4px; }
/* Overrides the original stacked checkbox list above. The selectors carry the
   extra class deliberately: `.tagmenu label` beats a bare `.rtag` on
   specificity, so the pills would silently stay full-width rows without it. */
.cc-record .tagmenu {
  display: flex; flex-direction: row; flex-wrap: wrap; gap: 5px;
  padding: 2px 0 4px; margin-top: 0; background: none; border: none;
}
.tagmenu .rtag {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 10px; font-size: 12px; cursor: pointer; user-select: none;
}
.tagmenu .rtag:hover { border-color: var(--border-strong); }
.tagmenu .rtag.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.tagmenu .rtag input { margin: 0; }

.history > summary { font-size: 12px; color: var(--muted); cursor: pointer; padding: 2px 0; }
.hist { display: flex; flex-direction: column; gap: 3px; padding: 4px 0 2px; font-size: 11.5px; }
.hist-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; }
.hist-when { color: var(--muted); white-space: nowrap; }
.hist-what { color: var(--text-soft); overflow-wrap: anywhere; }
.hist-who { color: var(--muted); white-space: nowrap; }

@media (max-width: 900px) {
  /* Three columns of log line do not fit a phone; stack the attribution. */
  .hist-row { grid-template-columns: 1fr; gap: 0; padding-bottom: 4px; }
  .hist-who::before { content: '— '; }
}

/* The range group is inert inside the Callbacks queue — callbacks are shown
   whatever the range, and a live-looking control that changes nothing is
   exactly how that bug stayed hidden. */
.group.disabled { opacity: .45; pointer-events: none; }
.cb.cb-due-now { background: var(--danger-soft); border-color: #fda29b; color: var(--danger); font-weight: 600; }

/* Members: module access */
.module-selects { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.module-selects .field select { padding: 7px 9px; font-size: 13px; }
.chip.muted-chip { background: #F2F4F7; color: #667085; }
tr.module-editor td { background: #FAFAFB; }
.module-editor .module-selects { padding: 6px 0; }
.module-editor .row-actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
