/* ============================================================================
   LIT-CRM — Chargeback desk
   [2026-08-30] One line per chargeback.

   The owner, looking at the first cut: "One line. Right now it looks horrible...
   it's like it almost has no structure." Three things were doing that damage:
   a second row printed under every chargeback carrying its latest note, three
   stacked lines inside WRITTEN BY, and ISO dates narrow enough to wrap to
   "2025-10-\n10". Every row was four lines tall, so no column ever lined up
   with the one above it and there was nothing to scan down.

   Fixed column widths, not auto: auto-layout re-measures on every load, so the
   same table lands differently depending on how long one customer's name is.
   A CEO scanning this every morning should find the same column in the same
   place. Names that outgrow their column are clipped with an ellipsis and keep
   the full text in the title attribute.
   ========================================================================== */

#cdTable {
  width: 100%;
  table-layout: fixed;              /* the columns hold still between loads */
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

/* ── header ──────────────────────────────────────────────────────────────── */
#cdTable thead th {
  padding: 0 12px 9px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.085em;
  text-transform: uppercase;
  opacity: 0.62;
  text-align: left;
  vertical-align: bottom;
  /* [2026-08-30] Headers wrap instead of running into each other. They were
     nowrap, so CHARGEBACK DATE overlapped WRITTEN BY the moment the column was
     narrower than its own label - the collision the owner saw. */
  white-space: normal;
  border-bottom: 2px solid rgba(100, 116, 139, 0.42);
}
#cdTable thead th.cd-r { text-align: right; }

/* Widths total 100%, over eight columns since POLICY moved into the expanded
   row: "if I'm gonna use the policy number, I'm gonna click on it." Its width
   went to the three columns that were truncating people's names - AGENT,
   CUSTOMER and WRITTEN BY - because a desk that prints "Nanette Herna..." and
   "Osc..." is not telling you who anybody is. */
#cdTable th.cd-w-caret  { width: 28px; }
#cdTable th.cd-w-agent  { width: 15%; }
#cdTable th.cd-w-cust   { width: 17%; }
#cdTable th.cd-w-sold   { width: 10.5%; }
#cdTable th.cd-w-cbdate { width: 10.5%; }
#cdTable th.cd-w-writer { width: 15%; }
/* [2026-08-30] STATUS pulled out of WRITTEN BY so the chip lines up down the
   table rather than trailing each name at a different length. */
#cdTable th.cd-w-status { width: 10%; }
/* TIME LEFT is right-aligned now: left-aligned days beside a right-aligned
   amount left a channel of empty space between the last two columns. */
#cdTable th.cd-w-time   { width: 9%;  }
/* [2026-08-30] Widened from 8%. Once COMM. PAID started printing what the
   associate actually holds, "100,000 COP" no longer fitted a column sized for
   "0 COP" and the figure bled out of the table: "I hate when these things go
   out of the box and then you have to scroll." TIME LEFT paid for it, having
   lost the word "left" - the column header already says it. */
#cdTable th.cd-w-paid   { width: 14%; }

/* ── rows ────────────────────────────────────────────────────────────────── */
#cdTable tbody td {
  padding: 10px 12px;
  vertical-align: middle;
  /* Fixed layout clips rather than widens, so a long value must not bleed over
     its neighbour - it gets an ellipsis inside its own column instead. */
  overflow: hidden;
  text-overflow: ellipsis;
  /* The separator the owner could not see. It was 0.14 alpha; at 0.30 the eye
     tracks one chargeback across the row without losing the line. */
  border-bottom: 1px solid rgba(100, 116, 139, 0.30);
}

#cdTable tbody tr.cd-main { cursor: pointer; }
#cdTable tbody tr.cd-main:hover td { background: rgba(100, 116, 139, 0.10); }
#cdTable tbody tr.cd-main:focus-visible { outline: 2px solid #0369a1; outline-offset: -2px; }

/* Zebra, applied by class rather than :nth-child — detail rows interleave with
   data rows, so nth-child counts the wrong things the moment one row opens. */
#cdTable tbody tr.cd-alt td { background: rgba(100, 116, 139, 0.045); }
#cdTable tbody tr.cd-alt:hover td { background: rgba(100, 116, 139, 0.10); }

/* An open row and its panel read as one object. */
#cdTable tbody tr.cd-main.cd-open td {
  background: rgba(3, 105, 161, 0.09);
  border-bottom-color: transparent;
  font-weight: 600;
}

.cd-caret { opacity: 0.45; font-size: 0.8rem; }

/* ── cell contents ───────────────────────────────────────────────────────── */
/* Clip rather than wrap: a wrapped name is what made every row multi-line. */
.cd-clip {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A cell that carries a chip beside a name needs the NAME to absorb the
   clipping, never the chip. Put the ellipsis on the whole cell and a narrow
   column eats "UNASSIGNED" first - which is the one thing on that line anybody
   has to act on. So: flex, name shrinks, chip never does. */
.cd-line {
  display: flex;
  align-items: center;
  min-width: 0;
}
.cd-line > .cd-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cd-line > .cd-chip { flex: none; margin-left: 6px; }
.cd-strong { font-weight: 650; }
.cd-gone { opacity: 0.6; }          /* a writer who has left, without a second line */

/* Dates and money line up digit over digit. */
.cd-num {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cd-r { text-align: right; }

.cd-warn { color: #b45309; font-weight: 700; }

/* Chips carry what used to be its own stacked line. */
.cd-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.6;
  white-space: nowrap;
  vertical-align: 1px;
}
.cd-chip-un  { background: #fde68a; color: #78350f; }
.cd-chip-new { background: #0369a1; color: #ffffff; }

/* ── the expanded panel ──────────────────────────────────────────────────── */
#cdTable tbody tr.cd-detail > td {
  overflow: visible;
  white-space: normal;
  padding: 16px 18px 20px 42px;
  background: rgba(100, 116, 139, 0.07);
  border-bottom: 2px solid rgba(100, 116, 139, 0.34);
}

.cd-panel-top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* Facts as a labelled grid instead of a run-on paragraph. */
.cd-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 12px 24px;
  flex: 1 1 420px;
}
.cd-fact-l {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0.58;
  margin-bottom: 2px;
}
.cd-fact-v { font-weight: 600; font-variant-numeric: tabular-nums; }

.cd-sec { margin-top: 18px; }
.cd-sec-h {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0.58;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(100, 116, 139, 0.22);
}
.cd-quote {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid rgba(100, 116, 139, 0.35);
  max-width: 82ch;
}
.cd-quote-by { font-size: 0.8rem; opacity: 0.62; margin-top: 4px; }

@media (max-width: 900px) {
  #cdTable { font-size: 0.84rem; }
  #cdTable tbody td { padding: 8px 8px; }
  #cdTable tbody tr.cd-detail > td { padding-left: 18px; }
}


/* ── the owner's panel: notes, then what the protocol asks next ───────────
   [2026-08-30] Rebuilt around the trail. The panel used to reprint the whole
   seven-step plan with every instruction paragraph, plus the carrier note
   duplicated from the latest update, plus seven bodyless history headings —
   "all of that information is visual noise". */
.cd-note {
  padding: 8px 0;
  border-top: 1px solid rgba(100, 116, 139, 0.18);
}
.cd-note:first-of-type { border-top: 0; padding-top: 2px; }
/* The newest entry is the one being scanned for; the rest are context. */
.cd-note-latest .cd-quote { border-left-color: #0369a1; }
.cd-note:not(.cd-note-latest) { opacity: 0.72; }

.cd-next {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 0;
  border-top: 1px dashed rgba(100, 116, 139, 0.22);
}
.cd-next:first-of-type { border-top: 0; }
.cd-next-t { opacity: 0.78; }
.cd-next-d {
  flex: none;
  font-size: 0.82rem;
  opacity: 0.55;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
