/* ═══════════════════════════════════════════════════════════════════════
   Pipeline page — Calendar / Agenda / Journey sub-views (pv- namespace).
   Ported from libre-crm's pursuits-views.css; CCI edits: indigo accent
   (--color-primary) instead of VMDO teal, no pv-toggle/pv-viewbar (the
   pipeline-view-toggle owns view switching), no pv-mode-alt (each wrap
   self-scrolls), day-precision rules only (no year-grid/monthly variants).
   Consumed by milestone-views.js / deal-milestones.js via pages/pipeline.js.
   ═══════════════════════════════════════════════════════════════════════ */

/* Host wraps inside #pipeline-page-root (overflow:hidden flex column) —
   each view owns its scroll, same as the charts/map sibling wraps. */
.pipeline-mv-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 0.5rem;
}

/* ── Shared bits ── */
.pv-btn {
    padding: 4px 12px;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
}
.pv-btn:hover { background: var(--bg-secondary); }

.pv-note { font-size: 0.8125rem; color: var(--text-muted); margin: 4px 0; }
.pv-note-warn { color: var(--warning-text); background: var(--warning-bg); padding: 4px 10px; border-radius: var(--radius-md); display: inline-block; }

.pv-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-left: auto; }
.pv-legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.pv-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.pv-chip {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    cursor: grab;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 3px 7px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: filter 0.15s;
}
.pv-chip:hover { filter: brightness(0.94); }
/* Read-only sessions render chips draggable=false — click affordance only. */
.pv-chip[draggable="false"] { cursor: pointer; }
.pv-chip-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; flex: none; }
.pv-chip-label { white-space: nowrap; }
.pv-dragging { opacity: 0.4; }
.pv-drop-over { box-shadow: inset 0 0 0 2px var(--color-primary); background: rgba(79, 70, 229, 0.06); }

/* ── Month calendar ── */
.pv-cal-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.pv-cal-label { font-size: 1rem; font-weight: 700; min-width: 150px; text-align: center; }
.pv-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.pv-cal-dow {
    background: var(--bg-secondary);
    padding: 6px 8px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-align: center;
}
.pv-cal-cell { background: var(--bg-primary); min-height: 96px; padding: 6px; min-width: 0; }
.pv-cal-other-month { background: var(--bg-secondary); }
.pv-cal-other-month .pv-cal-daynum { opacity: 0.5; }
.pv-cal-today { box-shadow: inset 0 0 0 2px var(--color-primary); }
.pv-cal-daynum {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

/* Scheduled milestone variants: dashed outline on the kind color. */
.pv-chip-sched { border: 1px dashed currentColor; }
.pv-legend-sched { font-style: italic; }
.pv-ag-dot--sched { background: transparent !important; border: 2px dashed; }

/* ── Agenda (month-paged milestone list) ── */
.pv-ag {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}
.pv-ag-day {
    display: flex;
    gap: var(--spacing-sm);
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-color);
}
.pv-ag-day:last-child { border-bottom: none; }
.pv-ag-day--today { background: rgba(79, 70, 229, 0.05); }
.pv-ag-date {
    flex: 0 0 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding-top: 2px;
}
.pv-ag-dow {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.pv-ag-num {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.05;
    color: var(--text-primary);
}
.pv-ag-day--today .pv-ag-num { color: var(--color-primary); }
.pv-ag-rel { font-size: 0.6rem; color: var(--text-muted); white-space: nowrap; }
.pv-ag-items {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.pv-ag-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    width: 100%;
    font-family: inherit;
    color: var(--text-primary);
}
.pv-ag-row:hover { background: var(--bg-secondary); }
.pv-ag-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 2px; }
.pv-ag-title {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pv-ag-meta {
    flex: 1 1 auto;
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pv-ag-badge {
    flex: 0 0 auto;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

/* ── Journey swim lanes ── */
.pv-jrn-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 4px 0 8px; }
.pv-jrn-wrap {
    overflow: auto;
    max-height: calc(100vh - 260px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background: var(--bg-primary);
}
.pv-jrn { border-collapse: separate; border-spacing: 0; }
.pv-jrn th, .pv-jrn td { border-bottom: 1px solid var(--border-color); border-right: 1px solid var(--border-color); }

.pv-jrn thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-secondary);
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 4px 6px;
    text-align: center;
    white-space: nowrap;
}
.pv-jrn-th-lane, .pv-jrn-lane {
    position: sticky;
    left: 0;
    min-width: 180px;
    max-width: 180px;
    text-align: left !important;
}
.pv-jrn-th-tray, .pv-jrn-tray {
    position: sticky;
    left: 180px;
    min-width: 130px;
    max-width: 130px;
}
.pv-jrn thead .pv-jrn-th-lane, .pv-jrn thead .pv-jrn-th-tray { z-index: 4; }
.pv-jrn tbody .pv-jrn-lane, .pv-jrn tbody .pv-jrn-tray { z-index: 3; background: var(--bg-primary); }
.pv-jrn tbody .pv-jrn-tray { background: var(--bg-secondary); }

.pv-jrn-day { min-width: 34px; }
.pv-jrn-day.is-weekend { background: #eef1f5; }
.pv-jrn-day.is-today { background: var(--color-primary); color: #fff; }
.pv-jrn-day.is-today .pv-jrn-dow, .pv-jrn-day.is-today .pv-jrn-dnum, .pv-jrn-day.is-today .pv-jrn-month { color: #fff; }
.pv-jrn-month { font-size: 0.625rem; font-weight: 800; color: var(--color-primary); text-transform: uppercase; }
.pv-jrn-dow { font-size: 0.5625rem; font-weight: 600; color: var(--text-muted); }
.pv-jrn-dnum { font-size: 0.75rem; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }

.pv-jrn-cell { min-width: 34px; height: 44px; padding: 2px; vertical-align: top; background: var(--bg-primary); }
.pv-jrn-cell.is-weekend { background: #f4f6f9; }
.pv-jrn-cell.is-today { background: rgba(79, 70, 229, 0.07); }

.pv-jrn-lane { padding: 6px 10px; vertical-align: top; }
.pv-jrn-name {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    padding: 0;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--link-color);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pv-jrn-name:hover { color: var(--link-hover); text-decoration: underline; }
.pv-jrn-sub { font-size: 0.6875rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

.pv-jrn-tray .pv-chip { margin-bottom: 2px; }
.pv-chip-ghost { opacity: 0.62; border: 1px dashed rgba(0, 0, 0, 0.18); }
.pv-chip-ghost:hover { opacity: 1; }

/* Journey chips inside day cells: three-letter kind abbreviation (CLS, EXP,
   WON…) on the kind-colored tint; full name stays in the tooltip. The dot is
   dropped — the abbr text carries the color. */
.pv-chip-abbr { padding: 3px 2px; text-align: center; }
.pv-chip-abbr .pv-chip-dot { display: none; }
.pv-chip-abbr .pv-chip-label {
    display: block;
    font-size: 0.625rem;
    font-weight: 800;
    letter-spacing: 0.03em;
}

/* ── Mobile ── */
@media (max-width: 700px) {
    .pv-cal-cell { min-height: 64px; padding: 4px; }
    .pv-chip { font-size: 0.625rem; padding: 2px 4px; }
    .pv-cal-label { min-width: 0; flex: 1; }
    .pv-legend { margin-left: 0; width: 100%; }
    .pv-jrn-th-lane, .pv-jrn-lane { min-width: 120px; max-width: 120px; }
    .pv-jrn-th-tray, .pv-jrn-tray { left: 120px; min-width: 100px; max-width: 100px; }
    .pv-jrn-wrap { max-height: calc(100vh - 220px); }
    .pv-ag-date { flex-basis: 54px; }
    .pv-ag-badge { display: none; }
}
