/* Record by Agency Handoff: shell and surfaces on top of record-glass.css (a copy of the Ops Hub Glass sheet). Tokens only. */

  /* ═══════════════════════════════════════════════════════════════════════
     NEW CSS, this file only. Everything below reads ops-glass.css tokens.
     No hardcoded colours outside var()/color-mix() against a token. No glow.
     Section A: structural plumbing the sheet assumes but does not ship
     (sidebar sub-layout, .main itself, .stats-grid), in the live app some
     of this lives in index.html's own inline <style>, not in ops-glass.css;
     .stats-grid does not exist anywhere in the sheet, so it is defined here.
     Section B: genuinely new surfaces, kanban board, card, the centered
     modal, onboarding stages/run strip.
     ═══════════════════════════════════════════════════════════════════ */

  /* ─── A1. Shell: .main needs position:relative as the modal's containing
     block; nothing else about the shell's own box model changes. ─── */
  .main { position: relative; }

  /* ─── A2. Sidebar sub-layout, Pipeline's own nav (no Ops Hub sections) ─── */
  .sidebar-logo {
    position: relative;
    padding: 22px 16px 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
  }
  .sidebar-logo img { height: 36px; width: auto; flex-shrink: 0; }
  .sidebar-logo-text { display: flex; flex-direction: column; }
  .sidebar-logo-title { font-size: 1.1rem; line-height: 1.3; }
  .sidebar-logo-endorse { font-size: 0.72rem; font-weight: 600; margin-top: 1px; }

  .sidebar-section { padding: var(--space-3) var(--space-3) 0; }
  .sidebar-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 10px; margin: 2px 0;
    font-size: 0.86rem; font-weight: 500;
    cursor: pointer; position: relative;
  }
  .sidebar-item-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .sidebar-badge {
    font-family: var(--font-head);
    font-size: 0.5rem; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase;
    padding: 3px 7px; border-radius: var(--c-radius-pill);
    flex-shrink: 0;
  }
  /* amber count badge: the item needs attention (overdue cards waiting) */
  .sidebar-badge.count {
    background: color-mix(in srgb, var(--c-attention), transparent 80%) !important;
    color: var(--c-attention) !important;
    -webkit-text-fill-color: var(--c-attention) !important;
    border: 1px solid color-mix(in srgb, var(--c-attention), transparent 55%) !important;
  }
  .sidebar-item.active .sidebar-badge.count {
    background: rgba(255,255,255,0.22) !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    border-color: rgba(255,255,255,0.4) !important;
  }

  /* bottom-of-sidebar user row: theme toggle + a muted name, sits above the footer */
  .pl-sidebar-user {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 10px;
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--glass-border);
  }
  .pl-sidebar-user .theme-toggle { margin: 0 !important; }
  .pl-user-name { font-size: 0.8rem; color: var(--c-text-70); -webkit-text-fill-color: var(--c-text-70); font-weight: 500; }

  /* ─── A3. Header row: title + the one primary action ─── */
  .pl-header-right { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

  /* ─── A4. Summary strip: .stats-grid does not exist in ops-glass.css at
     all (only the unrelated .ops-grid utility does), so the grid itself,
     not just its modifiers, is defined here. One row of five equal tiles
     at the working width; .stat-card already gets the frosted background
     straight from ops-glass's own selector list, only padding/layout and
     the one red-accent modifier (overdue only, brand rule) are new. ─── */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-4);
  }
  .stat-card {
    display: flex; flex-direction: column; gap: var(--space-2);
    padding: var(--space-6);
    position: relative;
    border-left: 3px solid transparent;
  }
  .stat-value { font-size: 1.5rem; line-height: 1.3; }
  .pl-summary .stat-card.pl-flag-red { border-left-color: var(--ah-red); }
  .pl-of { font-size: 0.95rem; font-weight: 500; color: var(--c-text-50); margin-left: 4px; }
  .pl-progress {
    margin-top: var(--space-1);
    height: 4px; border-radius: 4px;
    background: color-mix(in srgb, var(--c-border), transparent 20%);
    overflow: hidden;
  }
  .pl-progress-fill { height: 100%; background: var(--ah-teal-mid); border-radius: 4px; }
  @media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  /* ─── B1. Board, columns, empty state ─── */
  .pl-board {
    display: flex; gap: var(--space-4);
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: var(--space-2);
  }
  .pl-col {
    flex: 0 0 236px;
    min-width: 236px;
    display: flex; flex-direction: column;
    max-height: calc(100vh - 360px);
    min-height: 160px;
  }
  .pl-col.pl-collapsed { flex: 0 0 56px; min-width: 56px; align-items: center; padding: var(--space-3) var(--space-1); gap: var(--space-2); cursor: pointer; }
  .pl-col-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--space-4) var(--space-4) var(--space-3);
    flex-shrink: 0;
  }
  .pl-col-name {
    font-family: var(--font-head); font-weight: 700; font-size: 0.72rem;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-text-70);
  }
  .pl-cards {
    display: flex; flex-direction: column; gap: var(--space-3);
    padding: 0 var(--space-4) var(--space-4);
    overflow-y: auto;
    min-height: 40px;
  }
  .pl-empty {
    font-size: 0.76rem; color: var(--c-text-50);
    text-align: center; padding: var(--space-5) var(--space-2);
  }
  .pl-collapsed-name {
    writing-mode: vertical-rl; text-orientation: mixed;
    font-family: var(--font-head); font-weight: 700; font-size: 0.68rem;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-text-50);
  }
  .pl-collapsed-count { font-family: var(--font-num); font-weight: 700; font-size: 1.05rem; color: var(--c-text-70); }

  /* ─── B2. The card ─── */
  .pl-card {
    padding: var(--space-4);
    border-left: 3px solid transparent;
    cursor: pointer;
  }
  .pl-card.pl-overdue { border-left-color: var(--ah-red); }
  .pl-card.pl-today { border-left-color: var(--c-attention); }
  .pl-card.pl-open { outline: 1.5px solid var(--c-accent); outline-offset: -1px; }
  .pl-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
  .pl-card-id { flex: 1 1 auto; min-width: 0; }
  .pl-card-name {
    font-family: var(--font-head); font-weight: 700; font-size: 0.84rem; color: var(--c-text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25;
  }
  .pl-card-agency {
    font-family: var(--font-body); font-size: 0.78rem; color: var(--c-text-70);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .pl-card-next { margin-top: var(--space-3); font-size: 0.76rem; color: var(--c-text-70); }
  .pl-card-due-row { margin-top: var(--space-2); display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .pl-card-due { font-size: 0.76rem; color: var(--c-text-50); }
  .pl-due-status { font-family: var(--font-head); font-weight: 700; font-size: 0.65rem; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
  .pl-due-status.overdue { color: var(--ah-red); }
  .pl-due-status.today { color: var(--c-attention); }
  .pl-card-meta { margin-top: var(--space-3); display: flex; flex-wrap: wrap; gap: 5px; }
  .pl-sample { opacity: 0.75; }
  .pl-deal-strip { margin-top: var(--space-3); display: flex; gap: 10px; flex-wrap: wrap; }
  .pl-deal-step { font-size: 0.68rem; color: var(--c-text-50); display: flex; align-items: center; gap: 4px; }
  .pl-deal-step.done { color: var(--ah-teal-mid); }
  .pl-deal-dot { width: 7px; height: 7px; border-radius: 50%; border: 1.2px solid currentColor; flex-shrink: 0; }
  .pl-deal-step.done .pl-deal-dot { background: currentColor; }

  /* positive fit/attendance signal: the sheet already reserves .pl-status-pill
     for this (cyan/accent text, see the "off-brand colours" block), combined
     with .pill for the chip's shape/background/border. No new rule needed. */

  /* ─── B3. Modal: centered over the board, not a drawer. Reuses .modal-box
     (frosted glass-raised surface, already themed by ops-glass) and
     .modal-overlay (dimmed background on --overlay, already themed) for
     every colour/blur/shadow; only position, size and internal layout are
     new. The overlay is sized to the exact rectangle ops-glass already
     computes for .main (same insets, same --sidebar-w token), so "centered
     over the board" and "92% of the main panel" both fall out of it
     without any JS measurement. ─── */
  .pl-modal-overlay {
    position: fixed;
    top: 12px; right: 12px; bottom: 12px;
    left: calc(var(--sidebar-w) + 24px);
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  .pl-modal-overlay.open { display: flex; }
  /* only the off-canvas breakpoint (sidebar slides away) widens the overlay
     to the full panel; .has-nav-toggle alone is not the signal, it is
     present at every width, only this media query is width-gated */
  @media (max-width: 900px) {
    .pl-modal-overlay { left: 12px; }
  }
  .pl-modal {
    width: 92%;
    max-width: 1100px;
    max-height: 88vh;
    display: flex; flex-direction: column;
    overflow: hidden;
  }
  .pl-modal-head { padding: var(--space-5) var(--space-6) var(--space-4); border-bottom: 1px solid var(--c-border-soft); flex-shrink: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
  .pl-modal-id { display: flex; align-items: flex-start; gap: var(--space-5); flex-wrap: wrap; }
  .pl-modal-name { font-family: var(--font-head); font-weight: 800; font-size: 1.15rem; color: var(--c-text); }
  .pl-modal-agency { font-size: 0.86rem; color: var(--c-text-70); margin-top: 1px; }
  .pl-modal-link { font-size: 0.78rem; display: block; margin-top: 6px; }
  .pl-modal-email { font-size: 0.78rem; color: var(--c-text-50); margin-top: 2px; }
  .pl-modal-stage { min-width: 180px; }
  .pl-modal-close-row { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }

  .pl-modal-body {
    flex: 1 1 auto; overflow-y: auto;
    padding: var(--space-6);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-6);
    align-content: start;
  }
  @media (max-width: 900px) {
    .pl-modal-body { grid-template-columns: 1fr; }
  }
  .pl-col-stack { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
  .pl-section { min-width: 0; }
  /* section headers reuse .dash-section-title verbatim (Montserrat 700, 13px,
     uppercase, teal, the sheet's one sitewide section-heading rule); only
     the oversized sitewide top margin needs trimming inside a packed modal
     column, and inside the onboarding card. */
  .pl-modal .dash-section-title,
  .pl-view .dash-section-title { margin: 0 0 var(--space-3) !important; }
  .pl-row { display: flex; gap: var(--space-3); align-items: flex-end; flex-wrap: wrap; }
  .pl-row > div { flex: 1; min-width: 120px; }
  .pl-row-buttons { margin-top: var(--space-3); display: flex; gap: 8px; flex-wrap: wrap; }

  .pl-fit-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: var(--space-3); }
  .pl-fit-text { font-size: 0.78rem; color: var(--c-text); line-height: 1.35; }
  .pl-fit-confirmed { display: block; font-size: 0.68rem; color: var(--ah-teal-mid); margin-top: 2px; }
  .pl-answer { margin-bottom: var(--space-3); }
  .pl-answer-label { font-size: 0.66rem; color: var(--c-text-50); text-transform: uppercase; letter-spacing: 0.04em; }
  .pl-answer-value { font-size: 0.8rem; color: var(--c-text-70); margin-top: 1px; }

  .pl-call-line { font-size: 0.82rem; color: var(--c-text); margin-bottom: var(--space-3); }
  .pl-email-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
  .pl-email-chip {
    width: 24px; height: 24px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-num); font-size: 0.66rem; font-weight: 700;
    border: 1px solid var(--c-border-soft); color: var(--c-text-50);
    background: color-mix(in srgb, var(--c-text), transparent 95%);
  }
  .pl-email-chip.sent {
    color: var(--c-accent); border-color: color-mix(in srgb, var(--c-accent), transparent 60%);
    background: color-mix(in srgb, var(--c-accent), transparent 88%);
  }

  .pl-deal-chips { display: flex; gap: var(--space-2); margin-bottom: var(--space-3); flex-wrap: wrap; }
  .pl-deal-chip {
    font-size: 0.72rem; padding: 5px 10px; border-radius: var(--c-radius-pill);
    border: 1px solid var(--c-border-soft); color: var(--c-text-50);
    background: color-mix(in srgb, var(--c-text), transparent 95%);
  }
  .pl-deal-chip.done {
    color: var(--ah-teal-mid); border-color: color-mix(in srgb, var(--ah-teal-mid), transparent 55%);
    background: color-mix(in srgb, var(--ah-teal-mid), transparent 88%);
  }

  .pl-timeline-row { display: flex; gap: 10px; padding: var(--space-2) 0; border-bottom: 1px solid var(--c-border-soft); }
  .pl-timeline-row:last-child { border-bottom: none; }
  .pl-timeline-icon { color: var(--c-accent); flex-shrink: 0; margin-top: 1px; }
  .pl-timeline-time { font-size: 0.68rem; color: var(--c-text-50); }
  .pl-timeline-text { font-size: 0.8rem; color: var(--c-text-70); margin-top: 1px; }

  .pl-modal-foot {
    flex-shrink: 0; padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--c-border-soft);
    display: flex; justify-content: space-between; align-items: center;
  }

  /* ─── B4. Onboarding tab ─── */
  .pl-onb-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
  .pl-onb-client { font-family: var(--font-head); font-weight: 800; font-size: 1rem; color: var(--c-text); }
  .pl-onb-meta { font-size: 0.8rem; color: var(--c-text-50); }

  .pl-stages { display: flex; gap: var(--space-3); margin-top: var(--space-5); }
  .pl-stage { flex: 1; text-align: left; min-width: 0; }
  .pl-stage-bar { height: 6px; border-radius: 4px; background: color-mix(in srgb, var(--c-border), transparent 20%); overflow: hidden; }
  .pl-stage-bar-fill { height: 100%; background: color-mix(in srgb, var(--c-text), transparent 70%); }
  .pl-stage.done .pl-stage-bar-fill { background: var(--ah-teal-mid); width: 100%; }
  .pl-stage.current .pl-stage-bar-fill { background: var(--ah-teal-mid); width: 55%; }
  .pl-stage-name { margin: var(--space-5) 0; font-size: 0.68rem; color: var(--c-text-50); line-height: 1.4; }
  .pl-stage.current .pl-stage-name { color: var(--c-accent); font-weight: 600; }
  .pl-stage.done .pl-stage-name { color: var(--c-text-70); }

  .pl-run-steps { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-4) 0; }
  .pl-run-step {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.72rem; color: var(--c-text-50);
    padding: 5px 10px; border-radius: var(--c-radius-pill);
    border: 1px solid var(--c-border-soft);
    background: color-mix(in srgb, var(--c-text), transparent 95%);
    white-space: nowrap;
  }
  .pl-run-step.done { color: var(--ah-teal-mid); border-color: color-mix(in srgb, var(--ah-teal-mid), transparent 60%); background: color-mix(in srgb, var(--ah-teal-mid), transparent 90%); }
  .pl-run-step.failed { color: var(--ah-red); border-color: color-mix(in srgb, var(--ah-red), transparent 60%); background: color-mix(in srgb, var(--ah-red), transparent 90%); }

  .pl-blocker { background: var(--ah-paper-yellow) !important; color: var(--ah-ink) !important; border-radius: 6px; }
  .pl-blocker-note { font-size: 0.74rem; }

  /* ─── A5. Light-theme ink-floor exemptions ───
     ops-glass.css flattens every span/div inside .main to plain ink on light
     theme (the "NUCLEAR port" readability floor), and already carves out
     exceptions for its own .pill.ok/.warn/.bad so status colour survives.
     .pl-status-pill and .dash-section-title already carry their own
     sitewide colour rule elsewhere in the sheet, confirmed surviving on
     light in this file's own screenshots, so neither needs a carve-out
     here. Board and Onboarding live inside .main, so the rest of the new
     semantic colour introduced in this file needs the same carve-out,
     same selector shape, same !important, so it is not swept along with
     the plain text. (The modal is a sibling of .main, not inside it, so
     none of this applies there, its colour already survives untouched.) ─── */
  html[data-theme="light"] .main .pl-due-status.overdue {
    color: var(--ah-red) !important;
    -webkit-text-fill-color: var(--ah-red) !important;
  }
  html[data-theme="light"] .main .pl-due-status.today {
    color: var(--c-attention) !important;
    -webkit-text-fill-color: var(--c-attention) !important;
  }
  html[data-theme="light"] .main .pl-run-step.done {
    color: var(--ah-teal-mid) !important;
    -webkit-text-fill-color: var(--ah-teal-mid) !important;
  }
  html[data-theme="light"] .main .pl-run-step.failed {
    color: var(--ah-red) !important;
    -webkit-text-fill-color: var(--ah-red) !important;
  }
  html[data-theme="light"] .main .pl-stage.current .pl-stage-name {
    color: var(--c-accent) !important;
    -webkit-text-fill-color: var(--c-accent) !important;
  }
  html[data-theme="light"] .main .pl-stage.done .pl-stage-name {
    color: var(--ah-teal-mid) !important;
    -webkit-text-fill-color: var(--ah-teal-mid) !important;
  }

  /* ─── Responsive degrade ─── */
  @media (max-width: 760px) {
    .pl-col { flex: 0 0 210px; min-width: 210px; }
  }

/* ── Record app additions (bucket 0): hidden, empty panels, sign-in ─────── */
[hidden] { display: none !important; }

.pl-empty-panel { padding: var(--space-8) var(--space-7); text-align: center; }
.pl-empty-title { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; color: var(--c-text); }
.pl-empty-sub { margin: var(--space-2) 0 0; font-size: 0.88rem; color: var(--c-text-70); }

.pl-sidebar-user .btn-cancel { margin-left: auto; height: var(--btn-h-row); padding: 0 var(--space-3); font-size: 0.78rem; }

.rec-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--space-6) var(--space-4); }
.rec-login { width: 100%; max-width: 380px; padding: var(--space-7); border-radius: var(--c-radius-card); display: flex; flex-direction: column; gap: var(--space-2); }
.rec-login-logo { padding: 0 0 var(--space-5); border: 0; }
.rec-login label { margin-top: var(--space-3); font-size: 0.82rem; color: var(--c-text-70); }
.rec-login input { height: var(--btn-h); }
.rec-login button.primary { margin-top: var(--space-5); height: var(--btn-h); }
.rec-login-error { margin: var(--space-3) 0 0; font-size: 0.85rem; color: var(--c-danger); }
.rec-login-legal { margin: var(--space-5) 0 0; font-size: 0.72rem; color: var(--c-text-50); text-align: center; }
body.ops-shell .sidebar-footer { padding: var(--space-3) var(--space-4) var(--space-4); font-size: 0.72rem; line-height: 1.45; }
