/* ============================================================================
   Pipeline — layout
   Kanban stage board for work orders: In preparation · In engineering ·
   In production · Completed. Brand-restrained — the columns are NEUTRAL; the
   only colour on the board is delivery-urgency (the due chip + an at-risk left
   edge), because colour is feedback, never decoration. Layout only; all
   colour/space/type from --sds-* tokens. Shared chrome (review-bar, .num,
   .muted) lives in ../_shared/base.css.
   ========================================================================== */

/* ---- App grid: rail | main ---------------------------------------------- */
.app { display: grid; grid-template-columns: 224px 1fr; min-height: calc(100vh - 34px); }

/* ---- Rail: brand over sidenav ------------------------------------------- */
.rail {
  border-right: 1px solid var(--sds-color-border);
  background: var(--sds-color-surface);
  position: sticky; top: 34px; height: calc(100vh - 34px);
  display: flex; flex-direction: column;
  padding: var(--sds-space-400) var(--sds-space-300);
  gap: var(--sds-space-200);
  overflow: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: var(--sds-space-200) var(--sds-space-200) var(--sds-space-300); }
.brand sds-logo { --sds-logo-height: 22px; height: 22px; display: inline-flex; }
.brand .product { font-family: var(--sds-font-family-headline); font-weight: var(--sds-font-weight-bold); font-size: 16px; letter-spacing: .01em; }
.brand .product .sub { color: var(--sds-color-text-muted); font-weight: var(--sds-font-weight-regular); }
.rail sds-sidenav { width: 100%; }

/* ---- Main column -------------------------------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.pagehead {
  display: flex; align-items: flex-end; gap: var(--sds-space-400);
  padding: var(--sds-space-500) var(--sds-space-600) var(--sds-space-400);
  border-bottom: 1px solid var(--sds-color-border);
}
.pagehead .title { font-family: var(--sds-font-family-headline); font-size: var(--sds-type-headline-4-size); line-height: var(--sds-type-headline-4-line); font-weight: var(--sds-type-headline-4-weight); margin: 0; }
.pagehead .sub { color: var(--sds-color-text-muted); font-size: var(--sds-type-body-small-size); margin-top: var(--sds-space-100); }
.pagehead .sub b { color: var(--sds-color-text); font-variant-numeric: tabular-nums; }
.pagehead .actions { margin-left: auto; display: flex; align-items: center; gap: var(--sds-space-200); }
.pagehead .actions sds-search { width: 260px; }

/* ---- View switch (neutral segmented nav across the five views) ---------- */
.viewseg {
  display: inline-flex; gap: 2px; margin: var(--sds-space-400) var(--sds-space-600) 0;
  padding: 3px; align-self: flex-start;
  background: var(--sds-color-surface-strong);
  border: 1px solid var(--sds-color-border);
  border-radius: var(--sds-radius-pill);
}
.viewseg .seg {
  font-size: var(--sds-type-body-small-size); font-weight: var(--sds-font-weight-bold);
  color: var(--sds-color-text-muted); padding: 6px 14px; border-radius: var(--sds-radius-pill);
  cursor: pointer; white-space: nowrap;
}
.viewseg a.seg:hover { color: var(--sds-color-text); background: var(--sds-color-surface-hover); }
.viewseg .seg.on { background: var(--sds-color-surface); color: var(--sds-color-text); box-shadow: var(--sds-shadow-s, 0 1px 2px rgba(0,0,0,.12)); }

/* ---- Board: horizontal columns of cards --------------------------------- */
.board {
  display: flex; gap: var(--sds-space-400); align-items: flex-start; flex: 1;
  padding: var(--sds-space-500) var(--sds-space-600) var(--sds-space-700);
  overflow-x: auto; min-height: 0;
}

/* ---- Column (neutral; no per-stage colour) ------------------------------ */
.column {
  width: 288px; flex: none;
  display: flex; flex-direction: column;
  background: var(--sds-color-surface);
  border: 1px solid var(--sds-color-border);
  border-radius: var(--sds-radius-l);
  border-top: 2px solid var(--sds-color-border-strong);
  max-height: 100%;
}
.col-done { opacity: .82; }

.col-head {
  display: flex; align-items: center; gap: var(--sds-space-200);
  padding: var(--sds-space-300) var(--sds-space-400);
  border-bottom: 1px solid var(--sds-color-border);
}
.col-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--sds-color-border-strong); }
.col-head .ttl { font-family: var(--sds-font-family-text); font-weight: var(--sds-font-weight-bold); font-size: var(--sds-type-body-regular-size); }
.col-head sds-badge { margin-left: var(--sds-space-100); }
.col-head .addcol { margin-left: auto; }

.col-body {
  padding: var(--sds-space-300);
  display: grid; gap: var(--sds-space-300);
  overflow-y: auto;
}

/* ---- Work-order card ---------------------------------------------------- */
.wo { --sds-card-corner-radius: var(--sds-radius-m); display: block; }
.wo-in { display: grid; gap: var(--sds-space-200); }
/* at-risk: the single restrained urgency cue on the card body */
.wo.at-risk { box-shadow: inset 3px 0 0 var(--sds-color-error); }

.wo-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sds-space-200); }
.wo-top .id { font-size: var(--sds-type-footnote-size); color: var(--sds-color-text-muted); letter-spacing: .02em; }
.wo h3 { margin: 0; font-size: var(--sds-type-body-regular-size); font-weight: var(--sds-font-weight-bold); line-height: 1.3; }
.wo .cust { font-size: var(--sds-type-body-small-size); color: var(--sds-color-text-muted); }

/* due-urgency chip — the only colour carrier on the board */
.due {
  font-size: var(--sds-type-footnote-size); font-weight: var(--sds-font-weight-bold);
  padding: 2px 8px; border-radius: var(--sds-radius-pill); white-space: nowrap;
  background: var(--sds-color-surface-strong); color: var(--sds-color-text-muted);
}
.due.ok   { background: color-mix(in srgb, var(--sds-color-success) 14%, transparent); color: var(--sds-color-success); }
.due.warn { background: color-mix(in srgb, var(--sds-color-warning) 16%, transparent); color: var(--sds-color-warning); }
.due.crit { background: color-mix(in srgb, var(--sds-color-error) 14%, transparent);   color: var(--sds-color-error); }

/* readiness micro-bar (multi-state: done / running / todo) — bespoke viz */
.prog { display: flex; gap: 2px; height: 6px; border-radius: var(--sds-radius-pill); overflow: hidden; }
.prog > span { display: block; border-radius: var(--sds-radius-pill); }
.seg-done { flex: 1; background: var(--sds-color-text); }
.seg-run  { flex: 1; background: var(--sds-color-border-strong); }
.seg-todo { flex: 1; background: var(--sds-color-surface-strong); box-shadow: inset 0 0 0 1px var(--sds-color-border); }

.meta { display: flex; align-items: center; justify-content: space-between; gap: var(--sds-space-200); font-size: var(--sds-type-footnote-size); }
.meta .mach { color: var(--sds-color-text-muted); font-variant-numeric: tabular-nums; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 1200px) { .board { padding-inline: var(--sds-space-400); } }
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } .rail { display: none; } }
