/* ============================================================================
   ATLAS REDESIGN — Pipeline screen styles  ·  Phase 1 → v1.6 pixel-match
   Branch: atlas-redesign-2026-06-29

   Prefix: .rd-pipeline. Tokens only (--r-*). The board base (.rd-board/.rd-col/
   .rd-card) lives in redesign-board.css; THIS file styles the page chrome
   (header + view control + New deal), the KPI strip wrapper, the empty states,
   and the Pipeline-specific column/card accents that ride on top of the shared
   Board component to reach the v1.6 mockup. Works in Calm + Operator
   automatically (every value is a token, so Operator's azure/mint swap in).
   ========================================================================== */

.rd-pipeline {
  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;
}

/* ---- page header (eyebrow + serif H1 + view control + New deal) ----------- */
.rd-pipe-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.rd-pipe-head-l {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.rd-pipe-eyebrow {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--r-clay);               /* mockup clay/terracotta eyebrow */
}
.rd-pipe-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-pipe-sub {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rd-pipe-org {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .06em;
  color: var(--r-muted);
  text-transform: uppercase;
}

/* ---- view control + New deal (right of header) --------------------------- */
.rd-pipe-head-r {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.rd-pipe-seg {
  display: flex;
  background: var(--r-canvas-raised);
  border: 1px solid var(--r-border);
  border-radius: var(--r-radius-control);
  padding: 3px;
}
.rd-pipe-seg-btn {
  border: none;
  background: transparent;
  color: var(--r-faint);
  border-radius: var(--r-radius-badge);
  padding: 6px 13px;
  font-family: var(--r-font-body);
  font-size: 12.5px;
  cursor: pointer;
  transition: background var(--r-dur) var(--r-ease), color var(--r-dur) var(--r-ease);
}
.rd-pipe-seg-btn.is-active {
  background: var(--r-surface);
  color: var(--r-primary);
  font-weight: 600;
  box-shadow: var(--r-shadow-card);
}
.rd-pipe-seg-btn:not(.is-active):not(:disabled):hover { color: var(--r-body); }
.rd-pipe-seg-btn:disabled { cursor: default; }

.rd-pipe-new {
  height: 38px;
  padding: 0 16px;
  border: none;
  border-radius: var(--r-radius-control);
  background: var(--r-primary);
  color: var(--r-primary-ink);
  font-family: var(--r-font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: filter var(--r-dur) var(--r-ease), box-shadow var(--r-dur) var(--r-ease);
}
.rd-pipe-new:not(:disabled):hover { filter: brightness(1.06); box-shadow: var(--r-shadow-hover); }
.rd-pipe-new:disabled { opacity: .55; cursor: default; }
.rd-pipe-new-ic { font-size: 15px; line-height: 1; font-weight: 700; }

/* ---- KPI strip (RDKpiCard — wrapper only; cards own their styling) -------- */
/* Fallback tiles (used only if RDKpiCard is unavailable). */
.rd-pipe-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.rd-pipe-kpi {
  background: var(--r-surface);
  border: 1px solid var(--r-hairline-2);
  border-radius: var(--r-radius-card);
  box-shadow: var(--r-shadow-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rd-pipe-kpi-label {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-eyebrow);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--r-faint);
}
.rd-pipe-kpi-value {
  font-family: var(--r-font-display);
  font-size: 23px;
  font-weight: 600;
  line-height: 1;
  color: var(--r-ink);
}

/* ---- board wrapper + empty states ---------------------------------------- */
.rd-pipe-board-slot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

/* the board scrolls horizontally inside the frame (no-scroll outer rule). */
.rd-pipe-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding: 4px 2px 12px;
}

.rd-pipe-emptynote {
  font-family: var(--r-font-body);
  font-size: var(--r-fs-body);
  color: var(--r-muted);
  margin: 0 2px;
}
.rd-pipe-empty {
  font-family: var(--r-font-mono);
  font-size: var(--r-fs-meta);
  letter-spacing: .04em;
  color: var(--r-faint);
  text-align: center;
  padding: 14px 6px;
  border: 1px dashed var(--r-border);
  border-radius: var(--r-radius-control);
}
/* per-column empty note — the shared Board component emits plain, unstyled
   ".rd-col-empty" text with no CSS anywhere (base or here); dress it up as a
   tight, honest placeholder instead of raw text sitting in the well. */
.rd-pipe-board .rd-col-empty {
  font-family: var(--r-font-mono);
  font-size: 11.5px;
  letter-spacing: .03em;
  line-height: 1.5;
  color: var(--r-faint);
  text-align: center;
  padding: 16px 8px;
  border: 1px dashed var(--r-border);
  border-radius: var(--r-radius-control);
}
/* ties the ghost-column count to its own stage accent (color used
   semantically), matching the live-column count chip below. */
.rd-pipe-board .rd-col-ghostnote strong { color: var(--col-accent, var(--r-ink)); }

/* ---- Pipeline column: soft raised well + stage accent (overrides base) ----
   2026-07-04: rescoped from ".rd-pipe-col" / ".rd-pipe-colhead" / ".rd-pipe-dot"
   — classes the shared board.js never emits (it only ever renders .rd-col /
   .rd-col-head / .rd-col-dot on real DOM), so this whole block was dead. Now
   scoped under .rd-pipe-board (applied via boardClass, confirmed live) so the
   intended raised-well column + full-bleed accent bar + stage dot actually
   render. No markup changed. */
.rd-pipe-board .rd-col {
  flex: 1 1 0;
  max-width: none;
  background: var(--r-canvas-raised);     /* soft raised well, slightly lighter than --r-well */
  border: 1px solid var(--r-hairline-2);
  border-radius: var(--r-radius-card);
  padding: 0 0 12px;
  overflow: hidden;                        /* lets the top accent bar bleed to the corners */
  gap: 0;
}
/* full-width colored top accent bar (the base ::before is inset; replace it). */
.rd-pipe-board .rd-col-head { border-bottom: none; padding: 12px 12px 11px; }
.rd-pipe-board .rd-col-head::before {
  left: 0; right: 0; top: 0;
  height: 3px; border-radius: 0;
  background: var(--col-accent, var(--r-primary));
}
/* rounded-square stage dot (mockup uses an 8px square w/ 3px radius, not a circle). */
.rd-pipe-board .rd-col-dot {
  width: 8px; height: 8px;
  border-radius: 3px;
  background: var(--col-accent, var(--r-primary));
}
.rd-pipe-board .rd-col-title {
  flex: 1 1 auto;               /* pushes count + $ value to the head's right edge */
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -.01em;
}
/* stage-tinted count chip — ties the number to the column's own accent
   instead of a neutral badge, reinforcing which stage is which at a glance. */
.rd-pipe-board .rd-col-count {
  background: color-mix(in srgb, var(--col-accent, var(--r-primary)) 14%, var(--r-surface));
  border-color: color-mix(in srgb, var(--col-accent, var(--r-primary)) 32%, var(--r-border));
  color: var(--col-accent, var(--r-primary));
  font-weight: 700;
}
/* column $-value chip (under contract / closing only — real per-row financials
   summed client-side; omitted, never zero-filled, when no row has a price). */
.rd-pipe-board .rd-col-meta { display: inline-flex; align-items: center; }
.rd-pipe-colval {
  font-family: var(--r-font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--r-faint);
}
.rd-pipe-board .rd-col-body { padding: 0 11px; gap: 9px; }

/* ---- Pipeline card: stage-colored edge + mockup card anatomy -------------- */
.rd-pipe-card {
  border-radius: 12px;
  padding: 10px 12px 10px 14px;
  transition: transform var(--r-dur) var(--r-ease), box-shadow var(--r-dur) var(--r-ease),
              border-color var(--r-dur) var(--r-ease), background var(--r-dur) var(--r-ease);
}
/* edge-strip follows the STAGE accent (overrides the base priority color),
   matching the mockup's stage-colored left strip. */
.rd-pipe-card .rd-card-edge { background: var(--col-accent, var(--r-primary)); }

/* richer hover/focus: stage-accent-tinted wash + border signal "this opens
   the loop detail panel" — every card here already carries real Dotloop
   financials + milestones, so it's a genuine drill-down target, not a stub. */
.rd-pipe-card:hover,
.rd-pipe-card:focus-visible {
  border-color: color-mix(in srgb, var(--col-accent, var(--r-primary)) 45%, var(--r-hairline-2));
  background: color-mix(in srgb, var(--col-accent, var(--r-primary)) 5%, var(--r-surface));
}

.rd-pipe-cardtop {
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 0;
}
.rd-pipe-addr {
  font-family: var(--r-font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--r-ink);
  line-height: 1.35;
  transition: color var(--r-dur) var(--r-ease);
}
.rd-pipe-card:hover .rd-pipe-addr,
.rd-pipe-card:focus-visible .rd-pipe-addr { color: var(--col-accent, var(--r-primary)); }

.rd-pipe-cardfoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.rd-pipe-price {
  font-family: var(--r-font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--r-primary);
}
.rd-pipe-meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--r-faint);
}
.rd-pipe-days {
  font-family: var(--r-font-mono);
  font-size: 12px;
  color: var(--r-faint);
  white-space: nowrap;
}
.rd-pipe-av {
  width: 22px; height: 22px;
  font-size: 10px;
  font-weight: 700;
  background: var(--r-well);
  color: var(--r-muted);
  box-shadow: 0 0 0 2px var(--r-surface), 0 0 0 3px var(--r-hairline-2);
}

/* status chips (HOT / BLOCK / TODAY / AGING) — semantic colour only */
.rd-pipe-chips {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
}
.rd-pipe-chip {
  font-family: var(--r-font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  border-radius: var(--r-radius-pill);
  padding: 1px 6px;
  background: var(--r-well);
  color: var(--r-muted);
}
.rd-pipe-chip[data-tone="alert"] { background: color-mix(in srgb, var(--r-alert) 16%, transparent); color: var(--r-alert); }
.rd-pipe-chip[data-tone="warn"]  { background: color-mix(in srgb, var(--r-amber) 18%, transparent); color: var(--r-amber); }
.rd-pipe-chip[data-tone="good"]  { background: var(--r-mint-surface); color: var(--r-mint-ink); }

/* ---- per-column "Add deal" dashed affordance (matches mockup) ------------- */
.rd-pipe-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border: 1px dashed var(--r-border);
  border-radius: var(--r-radius-control);
  background: transparent;
  color: var(--r-faint);
  font-family: var(--r-font-body);
  font-size: 12px;
  font-weight: 600;
  padding: 8px;
  cursor: pointer;
  transition: background var(--r-dur) var(--r-ease), color var(--r-dur) var(--r-ease);
}
.rd-pipe-add:not(:disabled):hover { background: var(--r-well); color: var(--r-body); }
.rd-pipe-add:disabled { cursor: default; opacity: .85; }
.rd-pipe-add-ic { font-size: 13px; line-height: 1; font-weight: 700; }

/* ---- focus visibility (keyboard) ----------------------------------------- */
.rd-pipeline .rd-card:focus-visible { outline: var(--r-focus); outline-offset: 2px; }
.rd-pipeline .rd-pipe-new:focus-visible,
.rd-pipeline .rd-pipe-seg-btn:focus-visible,
.rd-pipeline .rd-pipe-add:focus-visible { outline: var(--r-focus); outline-offset: 2px; }

/* ---- responsive: KPI strip + board collapse on narrow widths ------------- */
@media (max-width: 1180px) {
  .rd-pipe-kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .rd-pipe-kpis { grid-template-columns: 1fr; }
  .rd-pipe-board { grid-auto-columns: minmax(260px, 1fr); }
  /* title row + segmented view control wrap instead of forcing min-content
     width through the flex chain (which clipped the screen off-viewport) */
  .rd-pipe-head,
  .rd-pipe-head-r { flex-wrap: wrap; }
  /* the board is a flex item in .rd-pipe-board-slot — min-width:auto let its
     kanban min-content (5 x 260px cols) size the whole screen; with 0 the
     board fits the viewport and its own overflow-x:auto does the swiping */
  .rd-pipe-board { min-width: 0; }
}

/* ============================================================================
   W-F5S1 Stage 1 additions — source-attribution footer + list-view price cell.
   ========================================================================== */
.rd-pipe-src {
  margin-top: 14px; padding-top: 10px;
  border-top: 1px solid var(--r-hairline);
  font-family: var(--r-font-mono); font-size: 12px; color: var(--r-muted);
}
.rd-pipe-lprice { font-family: var(--r-font-mono); color: var(--r-ink); white-space: nowrap; }
.rd-pipe-list { margin-top: 2px; }
