/* Lead Sources (win_tab_lead_sources.py). Phone first: the table scrolls inside .ls-scroll, never the page.
   Frozen header row and source column (Tannor 10-21, ask 348): the tables scroll inside their own box with a max
   height, the header cells stick to its top, the source cells to its left, the top-left cell sits above both.
   Every sticky cell has an opaque background (the card colour, a tint layered on it where the row has one). */
.ls-root { display: grid; gap: 14px; min-width: 0; max-width: 100%; overflow-x: clip; padding: 16px 32px 24px; }
.ls-head { display: grid; gap: 8px; min-width: 0; }
.ls-head h2 { font-size: 20px; }
.ls-sub, .ls-period, .ls-read { margin: 0; color: var(--muted); font-size: 13px; }
.ls-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; min-width: 0; }
.ls-pick { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.ls-pick select { background: var(--secondary); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font: inherit; max-width: 100%; }
.ls-toggle { display: flex; flex-wrap: wrap; gap: 4px; background: rgba(34, 38, 51, .5); border-radius: 8px; padding: 4px;
  min-width: 0; max-width: 100%; }
.ls-toggle button { border: 0; background: none; color: var(--muted); border-radius: 6px; padding: 6px 12px;
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.ls-toggle button[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); }
.ls-range { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; min-width: 0; max-width: 100%; }
.ls-date { display: grid; gap: 3px; font-size: 12px; color: var(--muted); min-width: 0; }
.ls-date input { background: var(--secondary); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 8px; font: inherit; font-size: 14px; min-height: 40px; min-width: 0; max-width: 100%; }
.ls-apply { border: 0; border-radius: 8px; background: var(--gold); color: var(--gold-ink); font: inherit;
  font-weight: 650; padding: 8px 16px; min-height: 40px; cursor: pointer; }
.ls-refused { margin: 0; color: var(--rose); font-size: 13px; }
.ls-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid;
  gap: 10px; min-width: 0; max-width: 100%; }
.ls-scroll { overflow-x: auto; overflow-y: auto; max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px);
  max-width: 100%; min-width: 0; -webkit-overflow-scrolling: touch; }
.ls-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 2180px; font-size: 13px; }
.ls-table th, .ls-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: right;
  white-space: nowrap; }
.ls-table thead th { vertical-align: bottom; white-space: normal; min-width: 64px; }
.ls-table thead th { position: sticky; top: 0; z-index: 2; background: var(--card); }
.ls-table .ls-src { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: left;
  min-width: 150px; max-width: 220px; white-space: normal; overflow-wrap: anywhere; font-weight: 600; }
.ls-table thead .ls-src { z-index: 3; }
.ls-sort { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; padding: 0; text-align: inherit; }
.ls-sort.on { color: var(--gold); }
.ls-source { border: 0; background: none; color: var(--gold); font: inherit; font-weight: 650; padding: 3px 0;
  text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(212, 175, 55, .45);
  text-underline-offset: 3px; }
.ls-table tbody tr:hover td { background: rgba(255, 255, 255, .03); }
.ls-table tbody tr:hover th { background: linear-gradient(rgba(255, 255, 255, .03), rgba(255, 255, 255, .03)), var(--card); }
/* spend groups (ask 397): a dashed line above, the name in italics, not a drill button */
.ls-group-row th, .ls-group-row td { border-top: 1px dashed var(--line); }
.ls-group { display: inline-block; padding: 3px 0; font-style: italic; font-weight: 650; color: var(--text); }
.ls-total th, .ls-total td { font-weight: 700; border-top: 2px solid var(--gold); background: rgba(212, 175, 55, .08); }
.ls-total .ls-src { background: #1f1d18; }
/* GCI (ask 393): "N without a commission" sits under the amount, small, and wraps inside its own cell */
.ls-gci-note { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 500;
  white-space: normal; overflow-wrap: anywhere; }
.ls-gci { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 0; font-size: 13px; font-weight: 650;
  min-width: 0; }
.ls-gci > span { min-width: 0; overflow-wrap: anywhere; }
.ls-good { color: var(--green); background: rgba(52, 211, 153, .12); }
.ls-bad { color: var(--rose); background: rgba(251, 113, 133, .12); }
.ls-empty { margin: 0; color: var(--muted); }
.ls-notes { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; display: grid; gap: 4px; }
.ls-drill { gap: 18px; }
.ls-drill-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.ls-drill-head h2, .ls-drill-section h4 { margin: 0; }
.ls-close { border: 1px solid var(--line); border-radius: 8px; background: var(--secondary); color: var(--text);
  padding: 7px 11px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.ls-drill-section { display: grid; gap: 7px; min-width: 0; }
.ls-drill-section h4 { font-size: 14px; }
.ls-drill-scroll { overflow-x: auto; overflow-y: auto; max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px); max-width: 100%; -webkit-overflow-scrolling: touch; }
.ls-drill-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 520px; font-size: 13px; }
.ls-drill-table th, .ls-drill-table td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left;
  white-space: nowrap; }
.ls-drill-table .num { text-align: right; }
/* the name column wraps (a long appointment type pushed every number off a phone screen) */
.ls-drill-table td:first-child, .ls-drill-table th:first-child { white-space: normal; overflow-wrap: anywhere;
  min-width: 110px; }
.ls-drill-table thead th { color: var(--muted); font-size: 11px; }
.ls-drill-table thead th { position: sticky; top: 0; z-index: 2; background: var(--card); }
.ls-drill-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); }
.ls-drill-table thead th:first-child { left: 0; z-index: 3; }
.ls-drill-total td { border-top: 2px solid var(--gold); font-weight: 700; background: rgba(212, 175, 55, .08); }
.ls-drill-total td:first-child { background: linear-gradient(rgba(212, 175, 55, .08), rgba(212, 175, 55, .08)), var(--card); }
.ls-drill-table tbody tr:last-child td { border-bottom: 0; }  /* separate borders: the gold line alone, as before */
.ls-names { min-width: 0; }
.ls-names-block { display: grid; gap: 6px; min-width: 0; }
.ls-names-block h4 { margin: 0; font-size: 13px; }
.ls-names-scroll { overflow-x: auto; max-width: 100%; min-width: 0; -webkit-overflow-scrolling: touch; }
.ls-names-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 0; }
.ls-names-table th, .ls-names-table td { border-bottom: 1px solid var(--line); padding: 7px 8px; text-align: left;
  white-space: nowrap; }
.ls-names-table .num { text-align: right; }
.ls-names-table th { color: var(--muted); font-size: 11px; }
.ls-names-table td:first-child, .ls-names-table th:first-child { white-space: normal; overflow-wrap: break-word;
  min-width: 140px; max-width: 220px; }   /* the name never collapses to a letter a line: the box scrolls */
.ls-name { color: var(--gold); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 720px) {
  .ls-root { padding: 12px 16px 20px; }
  .ls-range { flex: 1 1 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ls-date input { width: 100%; min-height: 44px; }
  .ls-apply { grid-column: 1 / -1; min-height: 44px; }
  .ls-card { padding: 8px; border-radius: 12px; }
  .ls-table { font-size: 12.5px; min-width: 1860px; }
  .ls-table .ls-src { min-width: 112px; max-width: 128px; }
  .ls-table thead th { min-width: 54px; }
}
@media (max-width: 390px) {
  .ls-root { padding: 10px 16px 18px; }
  .ls-table th, .ls-table td { padding: 6px 5px; }
  .ls-card { padding: 4px; }
  .ls-table .ls-src { min-width: 96px; max-width: 100px; }
  .ls-table thead th { min-width: 48px; }
  .ls-toggle button { padding: 6px 8px; }
  .ls-drill-head { display: grid; }
  .ls-close { width: 100%; }
  .ls-drill-table { min-width: 0; }
  .ls-drill-table th, .ls-drill-table td { padding: 6px 5px; }
  .ls-drill-table thead th { white-space: normal; }
  .ls-drill-table td:first-child, .ls-drill-table th:first-child { min-width: 96px; max-width: 140px; }
  .ls-names-table th, .ls-names-table td { padding: 6px 5px; }
  .ls-names-table th { white-space: normal; }
  .ls-names-table td:first-child, .ls-names-table th:first-child { min-width: 120px; max-width: 160px; }
}
.ls-goal { color: var(--green); background: rgba(52, 211, 153, .22); font-weight: 600; }
.ls-goal-mark { font-weight: 700; }
/* 5x ROI check (Tannor 11-28, ask 1593): one tap-open row per source, the month lines inside, no sideways scroll */
.ls-roi-title { margin: 0; font-size: 15px; }
.ls-roi-list, .ls-roi-months { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.ls-roi-row { border-bottom: 1px solid var(--line); padding-bottom: 6px; min-width: 0; }
.ls-roi-total .ls-roi-name { font-weight: 700; }
.ls-roi-toggle { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%;
  min-height: 44px; border: 0; background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left;
  padding: 4px 2px; cursor: pointer; min-width: 0; }
.ls-roi-name { min-width: 0; overflow-wrap: anywhere; }
.ls-roi-members { color: var(--muted); font-size: 12px; }
.ls-roi-off { white-space: nowrap; font-weight: 600; flex: 0 0 auto; }
.ls-roi-above { color: var(--green); }
.ls-roi-below { color: var(--rose); }
.ls-roi-no_spend, .ls-roi-none { color: var(--muted); font-weight: 500; }
.ls-roi-more { display: grid; gap: 8px; padding: 4px 2px 2px; min-width: 0; }
.ls-roi-more[hidden] { display: none; }
.ls-roi-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 10px; min-width: 0; }
.ls-roi-fig { display: grid; gap: 1px; min-width: 0; }
.ls-roi-k { color: var(--muted); font-size: 11.5px; }
.ls-roi-v { font-size: 13px; overflow-wrap: anywhere; }
.ls-roi-month { border-left: 2px solid var(--line); padding-left: 8px; display: grid; gap: 4px; min-width: 0; }
.ls-roi-label { margin: 0; font-size: 12.5px; color: var(--muted); }
@media (max-width: 390px) {
  .ls-roi-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
