/* ============================================================================
   Command — layout
   Master/detail: the order list stays put on the left; the selected order opens
   on the right as a per-component READINESS CHECKLIST (machine · tool · NC ·
   fixture · material). Brand-restrained — neutral surfaces, status shown by the
   shared .st dot pills; the only saturated colour is a blocked check (error) and
   the due chips. One primary CTA ("Add work order"); inline fixes are link buttons.
   ========================================================================== */

/* ---- App grid + rail + pagehead (shared shell) -------------------------- */
.app { display: grid; grid-template-columns: 224px 1fr; min-height: calc(100vh - 34px); }
.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 { 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: 240px; }

.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: 0 1px 2px rgba(0,0,0,.12); }

/* ---- Split ------------------------------------------------------------- */
.split { display: grid; grid-template-columns: 360px 1fr; flex: 1; min-height: 0; }

/* ---- Master list ------------------------------------------------------- */
.list { border-right: 1px solid var(--sds-color-border); display: flex; flex-direction: column; min-height: 0; }
.list-tabs { display: flex; gap: var(--sds-space-300); padding: var(--sds-space-400) var(--sds-space-400) var(--sds-space-300); border-bottom: 1px solid var(--sds-color-border); overflow-x: auto; }
.list-tabs .lt { font-size: var(--sds-type-body-small-size); font-weight: var(--sds-font-weight-bold); color: var(--sds-color-text-muted); white-space: nowrap; padding-bottom: var(--sds-space-200); cursor: pointer; }
.list-tabs .lt.on { color: var(--sds-color-text); box-shadow: inset 0 -2px 0 var(--sds-color-text); }

.rows { list-style: none; margin: 0; padding: var(--sds-space-200); overflow-y: auto; display: grid; gap: 2px; }
.row { padding: var(--sds-space-300); border-radius: var(--sds-radius-m); cursor: pointer; display: grid; gap: var(--sds-space-100); border-left: 2px solid transparent; }
.row:hover { background: var(--sds-color-surface-hover); }
.row.sel { background: var(--sds-color-surface-strong); border-left-color: var(--sds-color-text); }
.r-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sds-space-200); }
.r-id { font-size: var(--sds-type-footnote-size); color: var(--sds-color-text-muted); }
.r-top .st { font-size: var(--sds-type-footnote-size); font-weight: var(--sds-font-weight-regular); color: var(--sds-color-text-muted); }
.r-name { font-weight: var(--sds-font-weight-bold); font-size: var(--sds-type-body-small-size); line-height: 1.25; }
.r-bot { display: flex; align-items: center; justify-content: space-between; gap: var(--sds-space-200); font-size: var(--sds-type-footnote-size); }
.r-prog { color: var(--sds-color-text-muted); }
.r-due { font-size: var(--sds-type-footnote-size); color: var(--sds-color-text-muted); }
.r-due.ok { color: var(--sds-color-success); } .r-due.warn { color: var(--sds-color-warning); } .r-due.crit { color: var(--sds-color-error); font-weight: var(--sds-font-weight-bold); }

/* ---- Detail ------------------------------------------------------------ */
.detail { min-width: 0; overflow-y: auto; padding: var(--sds-space-500) var(--sds-space-600) var(--sds-space-700); }
.d-head { display: flex; align-items: flex-start; gap: var(--sds-space-400); }
.d-kick { font-size: var(--sds-type-footnote-size); color: var(--sds-color-text-muted); letter-spacing: .02em; }
.d-head h2 { font-family: var(--sds-font-family-headline); font-size: var(--sds-type-headline-4-size); margin: 4px 0 4px; }
.d-sub { font-size: var(--sds-type-body-small-size); color: var(--sds-color-text-muted); }
.d-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sds-space-200); }
.d-status { width: 180px; }

/* metric strip — expressive numbers (Light weight per brand) */
.d-strip {
  display: flex; align-items: stretch; gap: var(--sds-space-500);
  margin: var(--sds-space-500) 0; padding: var(--sds-space-400) 0;
  border-top: 1px solid var(--sds-color-border); border-bottom: 1px solid var(--sds-color-border);
}
.d-strip sds-divider { height: auto; }
.ds { display: flex; flex-direction: column; gap: var(--sds-space-100); }
.ds .k { font-size: var(--sds-type-footnote-size); color: var(--sds-color-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.ds .v { font-family: var(--sds-font-family-headline); font-weight: 300; font-size: var(--sds-type-headline-3-size); line-height: 1; }
.ds .v.alert { color: var(--sds-color-error); }
.ds .v .vsub { font-size: var(--sds-type-body-small-size); font-weight: var(--sds-font-weight-regular); }

/* ---- Components / checklist -------------------------------------------- */
.sec-h { font-family: var(--sds-font-family-headline); font-weight: var(--sds-font-weight-bold); font-size: var(--sds-type-body-large-size); margin: var(--sds-space-500) 0 var(--sds-space-300); display: flex; align-items: baseline; gap: var(--sds-space-200); }
.comp { --sds-card-corner-radius: var(--sds-radius-l); display: block; margin-bottom: var(--sds-space-300); }
.comp.blocked { box-shadow: inset 3px 0 0 var(--sds-color-error); }
.comp-in { display: grid; gap: var(--sds-space-300); }
.comp-h { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sds-space-300); }
.comp-h h3 { margin: 0; font-size: var(--sds-type-body-large-size); font-weight: var(--sds-font-weight-bold); }
.comp-sub { font-size: var(--sds-type-footnote-size); color: var(--sds-color-text-muted); margin-top: 2px; }
.comp-h .st { font-weight: var(--sds-font-weight-regular); color: var(--sds-color-text-muted); }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--sds-color-border); border-radius: var(--sds-radius-m); overflow: hidden; }
.checklist li { display: flex; align-items: center; gap: var(--sds-space-300); padding: var(--sds-space-300); background: var(--sds-color-surface); font-size: var(--sds-type-body-small-size); }
.checklist .ck { width: 18px; height: 18px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; }
.checklist li.ok  .ck { background: var(--sds-color-success); } .checklist li.ok  .ck::before { content: "✓"; }
.checklist li.bad .ck { background: var(--sds-color-error); }   .checklist li.bad .ck::before { content: "✕"; }
.checklist li.warn .ck { background: var(--sds-color-warning); } .checklist li.warn .ck::before { content: "–"; }
.checklist .cl { font-weight: var(--sds-font-weight-bold); min-width: 120px; }
.checklist em { font-style: normal; color: var(--sds-color-text-muted); }
.checklist li.bad em { color: var(--sds-color-error); }
.checklist .fix { margin-left: auto; }

.comp-foot { display: inline-flex; align-items: center; gap: 7px; font-size: var(--sds-type-body-small-size); font-weight: var(--sds-font-weight-bold); }
.comp-foot.ok { color: var(--sds-color-success); }
.comp-foot .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sds-color-success); }

.note { background: var(--sds-color-surface-strong); border-radius: var(--sds-radius-m); padding: var(--sds-space-400); }
.note b { font-size: var(--sds-type-body-small-size); }
.note p { margin: var(--sds-space-100) 0 0; font-size: var(--sds-type-body-small-size); }

@media (max-width: 1000px) { .split { grid-template-columns: 280px 1fr; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; } .rail { display: none; }
  .split { grid-template-columns: 1fr; } .list { border-right: 0; border-bottom: 1px solid var(--sds-color-border); }
}
