/* Sales reps: the rep's own one-screen app (repApp.mjs, repProspect.mjs)
   and Montar's Reps tab (repsPane.mjs). Built from the shared tokens; the
   only colour with a meaning of its own is --won for a target hit. */

/* ------------------------------------------------------------ rep app */

.rep-app { min-height: 100dvh; display: flex; flex-direction: column; background: var(--canvas); }

.rep-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  padding: var(--s3) var(--s6);
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--canvas) 88%, transparent);
  backdrop-filter: blur(10px);
}
/* The demo's sandbox banner is sticky at the top too. */
.is-sandbox .rep-bar { top: calc(var(--t-12) * 1.5 + var(--s1) * 2); }
.rep-brand { display: flex; align-items: center; gap: var(--s2); color: var(--text); }
.rep-brand-name { font-family: var(--font-brand); font-weight: 700; font-size: var(--t-15); letter-spacing: var(--track-title); }
.rep-brand-tag {
  font-size: var(--t-11); font-weight: 650; letter-spacing: var(--track-label); text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--r-full); background: var(--surface-3); color: var(--text-2);
}
.rep-me { display: flex; align-items: center; gap: var(--s2); }
.rep-me-name { font-size: var(--t-13); font-weight: 600; }

.rep-main {
  width: 100%; max-width: 1180px; margin: 0 auto;
  padding: var(--s7) var(--s6) var(--s9);
  display: flex; flex-direction: column; gap: var(--s5);
}

/* The day, as one line you can read across the room. */
.rep-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s6); align-items: end;
  padding-bottom: var(--s5); border-bottom: 1px solid var(--line);
}
.rep-hero-copy { gap: var(--s1); }
.rep-hero-copy .faint { font-size: var(--t-14); }
.rep-count { display: grid; justify-items: end; gap: 4px; min-width: 220px; }
.rep-count-figure { display: flex; align-items: baseline; gap: var(--s2); font-variant-numeric: tabular-nums; }
.rep-count-figure strong {
  font-family: var(--font-brand); font-size: var(--t-display); font-weight: 800;
  letter-spacing: var(--track-display); line-height: 0.95;
}
.rep-count-figure span { font-size: var(--t-17); color: var(--text-3); font-weight: 600; }
.rep-count .faint { font-size: var(--t-12); letter-spacing: var(--track-label); text-transform: uppercase; }
.rep-meter { width: 220px; flex: none; margin-top: var(--s1); }
.rep-meter .meter-fill { background: var(--accent); }
.rep-count.is-hit .rep-count-figure strong { color: var(--won-text); }
.rep-count.is-hit .meter-fill { background: var(--won); }

.rep-stat .home-stat-value { margin-bottom: 2px; }
.rep-stat > span:nth-child(2) { font-size: var(--t-13); font-weight: 600; }
.rep-stat.is-good .home-stat-value { color: var(--won-text); }

.rep-body { display: flex; flex-direction: column; }

/* My shops */
.rep-tools { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.rep-search { width: min(280px, 100%); }
.rep-list { padding: 0; overflow: hidden; }
.rep-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 130px 180px auto; gap: var(--s4); align-items: center;
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line);
  transition: background var(--fast) var(--ease);
}
.rep-row:last-child { border-bottom: 0; }
.rep-row:hover { background: var(--surface-2); }
.rep-row .chip { justify-self: start; }
.rep-who { min-width: 0; gap: 2px; }
.rep-who .faint { font-size: var(--t-12); }
.rep-follow { font-size: var(--t-12); color: var(--text-2); }
.rep-follow.is-due { color: var(--booked-text); font-weight: 600; }
.rep-follow.is-late { color: var(--attention-text); }
.rep-empty { padding: var(--s6) var(--s4); color: var(--text-3); font-size: var(--t-13); text-align: center; }

/* The record panel */
.rep-facts { grid-template-columns: 1fr; }
.rep-notes { display: flex; flex-direction: column; gap: 6px; margin-top: var(--s3); padding: 0; list-style: none; }
.rep-notes li {
  font-size: var(--t-13); color: var(--text-2); line-height: 1.45;
  padding-left: var(--s3); border-left: 2px solid var(--line-2);
}
.rep-notes li:first-child { color: var(--text); border-left-color: var(--accent-line); }

@media (max-width: 760px) {
  .rep-bar { padding: var(--s2) var(--s4); }
  .rep-main { padding: var(--s5) var(--s4) var(--s8); }
  .rep-hero { grid-template-columns: 1fr; align-items: start; gap: var(--s4); }
  .rep-count { justify-items: start; }
  .rep-hide-sm { display: none; }
  .rep-me-name { display: none; }
  .rep-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: var(--s1); }
  .rep-row .chip { grid-row: 2; }
  .rep-follow { grid-row: 2; grid-column: 2; justify-self: end; }
  .rep-row .hot-acts { grid-row: 1; grid-column: 2; }
}

/* ------------------------------------------------------------ Reps tab */

.reps-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: var(--s4); align-items: start; }
.reps-board { padding: 0; overflow-x: auto; }
.reps-board table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.reps-board th {
  font-size: var(--t-11); font-weight: 650; letter-spacing: var(--track-label); text-transform: uppercase;
  color: var(--text-3); text-align: right; padding: var(--s2) var(--s4); background: var(--surface-2); white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.reps-board th:first-child, .reps-board td:first-child { text-align: left; }
.reps-board td { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); text-align: right; font-size: var(--t-13); }
.reps-board tr:last-child td { border-bottom: 0; }
.reps-board tbody tr:hover td { background: var(--surface-2); }
.reps-who { display: flex; align-items: center; gap: var(--s2); }
.reps-who strong { font-size: var(--t-13); }
.reps-who .faint { font-size: var(--t-11); }
.reps-today { display: grid; justify-items: end; gap: 4px; }
.reps-today .meter-track { width: 90px; height: 4px; flex: none; }
.reps-today .meter-fill { background: var(--accent); }
.reps-today.is-hit .meter-fill { background: var(--won); }
.reps-rank { color: var(--text-3); font-size: var(--t-11); width: 18px; display: inline-block; }
.reps-side { display: flex; flex-direction: column; gap: var(--s4); }
.reps-handout .card-body { display: flex; flex-direction: column; gap: var(--s3); }
.reps-handout .field-grid { grid-template-columns: minmax(0, 1fr) 96px; }
.reps-manage li {
  display: flex; align-items: center; gap: var(--s2); padding: var(--s2) 0;
  border-bottom: 1px solid var(--line); font-size: var(--t-13);
}
.reps-manage li:last-child { border-bottom: 0; }
.reps-manage .grow { min-width: 0; }
.reps-manage .input { width: 64px; }
.reps-gone { opacity: 0.55; }

/* The sidebar takes its share of the window, so the side column stacks
   under the board well before a phone width. */
@media (max-width: 1240px) {
  .reps-layout { grid-template-columns: 1fr; }
  .reps-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
}
@media (max-width: 640px) {
  .reps-board .reps-hide-sm { display: none; }
}
