/* ============================================================================
   ATLAS REDESIGN — Revenue screen styles  ·  Phase 2 (Wave 2E net-new)
   Branch: atlas-redesign-2026-06-29

   Prefix: .rd-revenue. Tokens only (--r-*) so Calm (almanac) + Operator themes
   both work automatically. No hardcoded hex. Theme-specific selectors
   (html[data-rtheme="operator"] …) used only where a token can't express the
   tweak (the dark "Brokerage net" card's on-fill text + the chart gradient).
   ========================================================================== */

.rd-revenue {
  font-family: var(--r-font-body);
  color: var(--r-body);
  padding: var(--r-gutter);
  max-width: var(--r-page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---- header row ---------------------------------------------------------- */
.rd-rev-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.rd-rev-head-l { display: flex; flex-direction: column; gap: 6px; }
.rd-rev-eyebrow {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-clay);
}
.rd-rev-h1 {
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h1);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -.01em;
  color: var(--r-ink);
  margin: 0;
}
.rd-rev-head-r { display: flex; align-items: center; gap: 10px; }

/* segmented period control (Month / Quarter / Year) */
.rd-rev-period {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--r-well);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-control);
  padding: 3px;
}
.rd-rev-period-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--r-faint);
  font-family: var(--r-font-body);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  padding: 7px 13px;
  border-radius: calc(var(--r-radius-control) - 3px);
  cursor: pointer;
  transition: color var(--r-dur) var(--r-ease),
              background var(--r-dur) var(--r-ease),
              box-shadow var(--r-dur) var(--r-ease);
}
.rd-rev-period-btn:hover { color: var(--r-body); }
.rd-rev-period-btn.is-active {
  background: var(--r-surface);
  color: var(--r-primary);
  font-weight: 600;
  box-shadow: var(--r-shadow-card);
}
.rd-rev-period-btn:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

/* Export button (secondary / outline) */
.rd-rev-export {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  background: var(--r-surface);
  color: var(--r-body);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-control);
  font-family: var(--r-font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter var(--r-dur) var(--r-ease),
              transform var(--r-dur) var(--r-ease),
              box-shadow var(--r-dur) var(--r-ease),
              border-color var(--r-dur) var(--r-ease);
}
.rd-rev-export i { font-size: 15px; color: var(--r-muted); }
.rd-rev-export:hover {
  box-shadow: var(--r-shadow-hover);
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--r-primary) 40%, var(--r-border));
}
.rd-rev-export:active { transform: translateY(0); }
.rd-rev-export:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

/* ---- shared date-range filter row (Wave 1 2026-07-04) --------------------
   Gates the "Commission by closing" list only; sits between the KPI strip
   and the 2-col body so it reads as a filter for the list below, not the
   period toggle in the header (which drives the GCI rollup tiles instead). */
.rd-rev-datefilter {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.rd-rev-datefilter-label {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--r-muted);
}

/* ---- KPI strip (4-up, joined surface like the slice) --------------------- */
.rd-rev-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--r-surface);
  border: 1px solid var(--r-hairline-2);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  overflow: hidden;
}
.rd-rev-kpi {
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-right: 1px solid var(--r-hairline);
}
.rd-rev-kpi:last-child { border-right: none; }
.rd-rev-kpi-label {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--r-faint);
}
.rd-rev-kpi-value {
  font-family: var(--r-font-display);
  font-size: 25px;
  font-weight: 600;
  line-height: 1;
  color: var(--r-ink);
  margin-top: 2px;
}
.rd-rev-kpi-sub {
  font-size: 12px;
  color: var(--r-muted);
  font-weight: 500;
}
.rd-rev-kpi-sub[data-tone="good"] { color: var(--r-good); font-weight: 600; }

/* ---- 2-col body ---------------------------------------------------------- */
.rd-rev-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  align-items: start;
  min-height: 0;
}
.rd-rev-col-l,
.rd-rev-col-r {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

/* ---- shared section chrome ------------------------------------------------
   (renamed from .rd-rev-card* — a class containing "-card" gets re-skinned
   by v6-shell; this content is a section of the screen, not a shell card.) */
.rd-rev-section {
  background: var(--r-surface);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 20px 22px;
  min-width: 0;
}
.rd-rev-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.rd-rev-section-title {
  margin: 0;
  font-family: var(--r-font-display);
  font-size: var(--r-fs-h2);
  font-weight: 600;
  color: var(--r-ink);
}
.rd-rev-section-note {
  font-size: 12px;
  color: var(--r-muted);
  text-align: right;
}

/* ---- "Commission by closing" list ---------------------------------------- */
.rd-rev-close-list {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  overflow: auto;
  margin: 0 -4px;
  padding: 0 2px;
}
.rd-rev-close-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 6px;
  border-top: 1px solid var(--r-hairline);
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--r-dur) var(--r-ease);
}
.rd-rev-close-row:first-child { border-top: none; }
.rd-rev-close-row:hover,
.rd-rev-close-row:focus-visible { background: var(--r-canvas-raised); }
.rd-rev-close-row:focus-visible { outline: var(--r-focus); outline-offset: -2px; }
.rd-rev-close-id { flex: 1 1 auto; min-width: 0; }
.rd-rev-close-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--r-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-rev-close-meta {
  font-size: 12px;
  color: var(--r-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-rev-close-gross { flex: none; text-align: right; }
.rd-rev-close-gross-v {
  font-family: var(--r-font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--r-ink);
}
.rd-rev-close-gross-l {
  font-size: 12px;
  color: var(--r-faint);
  margin-top: 1px;
}
.rd-rev-close-comm {
  flex: none;
  width: 84px;
  text-align: right;
  font-family: var(--r-font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--r-good);
}
.rd-rev-close-comm[data-empty="1"] { color: var(--r-faint); font-weight: 500; }

/* drill-down affordance — hidden until hover/focus, then eases in. */
.rd-rev-close-caret {
  flex: none;
  font-size: 14px;
  color: var(--r-faint);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity var(--r-dur) var(--r-ease), transform var(--r-dur) var(--r-ease);
}
.rd-rev-close-row:hover .rd-rev-close-caret,
.rd-rev-close-row:focus-visible .rd-rev-close-caret { opacity: 1; transform: translateX(0); }

/* ---- "GCI · last 6 months" chart (honest empty) -------------------------- */
.rd-rev-chart-plot {
  position: relative;
  margin-top: 12px;
}
.rd-rev-chart-plot svg { display: block; width: 100%; }
.rd-rev-grid { stroke: var(--r-hairline); stroke-width: 1; }
.rd-rev-baseline {
  stroke: var(--r-border);
  stroke-width: 1.5;
  stroke-dasharray: 5 6;
}
.rd-rev-chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .04em;
  color: var(--r-faint);
}
.rd-rev-chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--r-font-mono);
  font-size: 12px;
  color: var(--r-faint);
}

/* ---- "Brokerage net" dark evergreen card --------------------------------- */
.rd-rev-net {
  background: var(--r-primary);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 20px 22px;
  color: var(--r-primary-ink);
}
.rd-rev-net-label {
  font-family: var(--r-font-mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--r-primary-ink) 72%, transparent);
}
.rd-rev-net-value {
  font-family: var(--r-font-display);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.05;
  margin-top: 6px;
  color: var(--r-primary-ink);
}
.rd-rev-net-lines {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid color-mix(in srgb, var(--r-primary-ink) 18%, transparent);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.rd-rev-net-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}
.rd-rev-net-line-l { color: color-mix(in srgb, var(--r-primary-ink) 82%, transparent); }
.rd-rev-net-line-v {
  font-family: var(--r-font-mono);
  font-weight: 600;
  color: var(--r-primary-ink);
}

/* Operator: azure --r-primary is bright; its ink token (#06101F) is already
   dark-on-fill, so the shared rules above hold. No override needed beyond the
   color-mix transparencies, which adapt to whichever ink token is active. */

/* ---- "Top producers" bar list -------------------------------------------- */
.rd-rev-prod-list { display: flex; flex-direction: column; }
.rd-rev-prod-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 6px;
  margin: 0 -6px;
  border-top: 1px solid var(--r-hairline);
  border-radius: 8px;
  transition: background var(--r-dur) var(--r-ease);
}
.rd-rev-prod-row:first-child { border-top: none; }
.rd-rev-prod-row:hover { background: var(--r-canvas-raised); }
.rd-rev-prod-av {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--r-font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--r-well);
  color: var(--r-muted);
}
.rd-rev-prod-id { flex: 1 1 auto; min-width: 0; }
.rd-rev-prod-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--r-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-rev-prod-bar {
  height: 5px;
  border-radius: 4px;
  background: var(--r-hairline);
  margin-top: 5px;
  overflow: hidden;
}
.rd-rev-prod-bar span {
  display: block;
  height: 100%;
  background: var(--r-primary);
  border-radius: 4px;
  transition: width var(--r-dur) var(--r-ease);
}
.rd-rev-prod-bar[data-empty="1"] span { background: transparent; }
.rd-rev-prod-vol {
  flex: none;
  font-family: var(--r-font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--r-ink);
}
.rd-rev-prod-vol[data-empty="1"] { color: var(--r-faint); font-weight: 500; }

/* ---- honest dashed empty state ------------------------------------------- */
.rd-rev-empty {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .03em;
  color: var(--r-faint);
  text-align: center;
  padding: 26px 12px;
  border: 1px dashed var(--r-border);
  border-radius: var(--r-radius-control);
  margin: 8px 2px 4px;
}
/* distinct tone for a genuine fetch failure (pipeRes === null) vs. the
   default "not connected / no data" empty states above. */
.rd-rev-empty[data-tone="error"] {
  color: var(--r-alert);
  border-color: color-mix(in srgb, var(--r-alert) 45%, var(--r-border));
  background: color-mix(in srgb, var(--r-alert) 6%, transparent);
}

/* ---- responsive ---------------------------------------------------------- */
@media (max-width: 980px) {
  .rd-rev-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .rd-rev-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* keep inner dividers tidy when wrapped to 2-up */
  .rd-rev-kpi:nth-child(2) { border-right: none; }
  .rd-rev-kpi:nth-child(1),
  .rd-rev-kpi:nth-child(2) { border-bottom: 1px solid var(--r-hairline); }
  .rd-rev-close-comm { width: 70px; }
}
