/* The Pipeline page (plan 32 §4, P4). Builds on /static/app.css: its tokens (light and dark), buttons, inputs, .card, .tiles, .tile,
   .table, .bar, .pill and .dialog. It defines no colour of its own, so every colour here follows the theme. */

.pl-boot { padding: 40px 24px; text-align: center; }
.login.signin-note { grid-template-columns: minmax(0, 1fr); }
.login.signin-note .login-card .brand { display: flex; }
/* Plan 36: the page sits in the shared shell (sidebar from shell.js). */
.pl-view { min-height: 0; overflow-y: auto; }
.pl-app, .pl-main, .pl-main > section { min-width: 0; }
.pl-main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 36px 56px; display: flex; flex-direction: column; gap: 16px; }
.pl-main > section { display: flex; flex-direction: column; gap: 16px; }
.pl-app svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; width: 16px; height: 16px; }
.pl-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pl-search { flex: 1 1 260px; max-width: 420px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); min-width: 0; box-shadow: var(--shadow-card); }
.pl-search:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.pl-search svg { color: var(--muted); width: 16px; height: 16px; flex-shrink: 0; }
.pl-search input { border: none; min-height: 34px; padding: 0; background: transparent; box-shadow: none !important; }
.pl-view-switch { flex-shrink: 0; margin-left: auto; }

/* -- head, messages --------------------------------------------------------------------------------------------- */
.pl-head { align-items: flex-start; }
.pl-head h1 { overflow-wrap: anywhere; }
.pl-source { margin-top: 4px; }
.pl-intro { margin-top: 2px; }
.pl-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pl-msg { padding: 10px 14px; border-radius: 10px; background: var(--info-soft); color: var(--info-ink); font-size: 14px; }
.pl-msg.bad { background: var(--bad-soft); color: var(--bad); }
.pl-msg a { color: inherit; font-weight: 600; }
.pl-emptycard { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
#pl-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* -- filters ---------------------------------------------------------------------------------------------------- */
.pl-filters { display: flex; flex-direction: column; gap: 10px; }
.pl-frow { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.pl-fgroup { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pl-flabel { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.pl-flabel select { min-height: 32px; width: auto; min-width: 160px; font-size: 13px; }
.pl-chip { min-height: 30px; padding: 0 11px; border-radius: 999px; background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 500; }
.pl-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.pl-chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.pl-chip .n { margin-left: 6px; font-family: var(--mono); font-size: 12px; opacity: 0.85; }

/* -- tiles, stage bar -------------------------------------------------------------------------------------------- */
.pl-tiles .tile .sub { min-height: 18px; }
.pl-tiles .value.neg, .pl-neg { color: var(--bad); }
.pl-stagecard { display: flex; flex-direction: column; gap: 10px; padding: 14px 20px; }
.pl-h2 { font-size: 14px; color: var(--muted); font-weight: 600; }
.pl-stack { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; background: var(--track); }
.pl-stack i { display: block; height: 100%; min-width: 4px; }
.pl-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink); }
.pl-legend li { display: inline-flex; align-items: center; gap: 8px; }
.pl-legend b { font-family: var(--mono); font-weight: 500; }
.pl-sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; box-shadow: inset 0 0 0 1px var(--line-strong); flex-shrink: 0; }
.st-early { background: var(--chip); }
.st-advanced { background: var(--info); }
.st-near { background: var(--accent); }
.st-rtb { background: var(--ok); background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--surface) 55%, transparent) 0 3px, transparent 3px 7px); }
.st-none { background: var(--line-strong); }

/* -- the table ------------------------------------------------------------------------------------------------- */
.pl-scroll { max-width: 100%; overflow-x: auto; }
.pl-scroll:focus-visible { outline-offset: -2px; }
.pl-table { min-width: 980px; }
.pl-table th, .pl-table td { white-space: nowrap; }
.pl-table td.num, .pl-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pl-table td.num { font-family: var(--mono); font-size: 13px; }
.pl-table thead th { padding: 6px 12px; vertical-align: bottom; }
.pl-table th .pl-sort { min-height: 34px; padding: 0 4px; border: none; background: transparent; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; gap: 4px; border-radius: 6px; flex-direction: column; align-items: flex-end; justify-content: center; }
.pl-table th.text .pl-sort { align-items: flex-start; }
.pl-table th .pl-sort > span { display: inline-flex; align-items: center; gap: 4px; }
.pl-table th .pl-sort:hover { background: var(--chip); color: var(--ink); }
.pl-table th .pl-sort svg { width: 14px; height: 14px; opacity: 0.55; }
.pl-table th[aria-sort="ascending"] .pl-sort svg, .pl-table th[aria-sort="descending"] .pl-sort svg { opacity: 1; color: var(--accent-ink); }
.pl-table th[aria-sort="ascending"], .pl-table th[aria-sort="descending"] { color: var(--ink); }
.pl-sub { display: block; font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.pl-table th:first-child, .pl-table td:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.pl-table thead th:first-child { z-index: 3; }
.pl-table tr.run:hover td:first-child { background: var(--surface-2); }
.pl-table tbody tr { cursor: pointer; }
.pl-name { color: var(--ink); font-weight: 600; text-decoration: none; }
.pl-name:hover { text-decoration: underline; }
.pl-code { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pl-ready { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.pl-ready .bar { width: 64px; flex-shrink: 0; }
.pl-ready .bar > span { background: var(--accent); }
.pl-muted-stage { color: var(--muted); font-size: 13px; }
.pl-foot { padding: 10px 20px 14px; border-top: 1px solid var(--line-2); }
.pl-badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--chip); color: var(--ink-2); white-space: nowrap; }
.pl-badge.tool { background: var(--accent-soft); color: var(--accent-ink); }
.pl-badge.differ { background: var(--warn-soft); color: var(--warn-ink); }
.pl-badge.run { background: var(--info-soft); color: var(--info-ink); }
.pl-pill { text-transform: none; }

/* -- one project ------------------------------------------------------------------------------------------------ */
.pl-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-size: 14px; min-height: 36px; }
.pl-back:hover { text-decoration: underline; color: var(--ink); }
.pl-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.pl-why { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 14px; }
.pl-why .reason { color: var(--ink); }
.pl-banner { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 12px 16px; border-radius: 12px; background: var(--warn-soft); color: var(--warn-ink); }
.pl-banner.info { background: var(--info-soft); color: var(--info-ink); }
.pl-ext-head { font-size: 17px; }
.pl-ext-btn { width: 100%; justify-content: flex-start; min-height: 52px; padding: 0 20px; border: none; border-radius: 0; background: transparent; color: var(--ink); font-size: 16px; font-weight: 600; }
.pl-ext-btn:hover { background: var(--surface-2); }
.pl-ext-btn svg { width: 16px; height: 16px; transition: transform 0.15s ease; }
.pl-ext-btn[aria-expanded="true"] svg { transform: rotate(90deg); }
.pl-ext-line { padding: 0 20px 10px; }
.pl-viewbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.pl-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--chip); }
.pl-seg button { min-height: 34px; padding: 0 12px; border: none; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; }
.pl-seg button:hover:not(:disabled) { color: var(--ink); }
.pl-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.pl-seg button:disabled { opacity: 0.55; }
#pipeline-financials:empty { display: none; }
.pl-groups { display: flex; flex-direction: column; gap: 10px; }
.pl-group { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pl-group > summary { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 16px; cursor: pointer; font-weight: 600; min-height: 44px; }
.pl-group > summary::-webkit-details-marker { display: none; }
.pl-group > summary svg { width: 16px; height: 16px; overflow: visible; transition: transform 0.15s ease; flex-shrink: 0; }
.pl-group[open] > summary svg { transform: rotate(90deg); }
.pl-group > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pl-group .count { font-weight: 400; font-size: 13px; color: var(--muted); }
.pl-gmeta { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.pl-gtot { font-family: var(--mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pl-gtot-l { font-family: var(--sans); font-weight: 500; color: var(--ink-2); }
.pl-gside { white-space: nowrap; }
.pl-gwho { font-family: var(--sans); font-weight: 500; font-size: 13px; color: var(--ink-2); }
.pl-gdiff { margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--warn-soft); color: var(--warn-ink); }
.pl-lines { width: 100%; border-collapse: collapse; font-size: 14px; }
.pl-lines th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 8px 12px; border-top: 1px solid var(--line-2); }
.pl-lines td { padding: 10px 12px; border-top: 1px solid var(--line-2); vertical-align: top; }
.pl-lines th:first-child, .pl-lines td:first-child { padding-left: 16px; }
.pl-lines th:last-child, .pl-lines td:last-child { padding-right: 16px; }
.pl-lines .num { text-align: right; font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pl-lines .lab { overflow-wrap: anywhere; }
.pl-lines tr.differs td { background: var(--warn-soft); }
.pl-lines tr.differs td, .pl-lines tr.differs td .pl-diff { color: var(--warn-ink); }
.pl-diff { font-family: var(--mono); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pl-cellwrap { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; justify-content: flex-end; }
.pl-kind { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--chip); color: var(--ink-2); white-space: nowrap; }
.pl-kind.k-placeholder { background: var(--warn-soft); color: var(--warn-ink); font-weight: 600; }
.pl-kind.k-dashboard { background: var(--info-soft); color: var(--info-ink); font-weight: 600; }
.pl-kind.k-input { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.pl-notebtn { min-height: 28px; padding: 0 8px; border-radius: 6px; font-size: 12px; background: transparent; color: var(--ink-2); border: 1px solid var(--line-strong); }
.pl-notebtn:hover { background: var(--chip); }
.pl-notebtn[aria-expanded="true"] { background: var(--chip); }
.pl-note { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); text-align: left; white-space: normal; overflow-wrap: anywhere; font-family: var(--sans); }
.pl-cell { display: block; }
.pl-history { display: flex; flex-direction: column; gap: 0; }
.pl-history .table td, .pl-history .table th { white-space: normal; }
.pl-wd { color: var(--bad); font-weight: 600; }
.pl-hint-line { font-size: 13px; }

/* -- dialogs ----------------------------------------------------------------------------------------------------- */
.pl-dialog { display: block; }
.pl-dialog:not([open]) { display: none; }
.pl-dialog form { display: flex; flex-direction: column; gap: 14px; }
.pl-dialog dl { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; font-size: 14px; }
.pl-dialog dt { color: var(--muted); }
.pl-dialog dd { margin: 0; font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.pl-dialog label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.pl-dialog .row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.pl-dialog .err { color: var(--bad); font-size: 14px; }
.pl-dialog .keep { padding: 10px 12px; border-radius: 10px; background: var(--info-soft); color: var(--info-ink); font-size: 14px; }

/* -- narrow screens ------------------------------------------------------------------------------------------------ */
@media (max-width: 760px) {
  .pl-search { flex: 1 1 100%; max-width: none; }
  .pl-view-switch { margin-left: 0; }
  .pl-main { padding: 16px 12px 40px; }
  .pl-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .pl-flabel { width: 100%; }
  .pl-flabel select { flex: 1 1 auto; }
  .tile .value { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { .pl-group > summary svg, .pl-ext-btn svg { transition: none; } }
