/* Operational screens: home, orders, new order, customers, workshop.
   Built on the tokens in core.css; nothing here redefines a shared class. */

/* ── small shared pieces ── */
.block { margin-top: 18px; }
.stack.tight { gap: 8px; }
.row.tight { gap: 6px; }
.row.end { justify-content: flex-end; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.crumb { margin-bottom: 8px; font-size: .9rem; color: var(--ink-3); }
.crumb a { text-decoration: none; font-weight: 600; }
.more-row { display: flex; justify-content: center; margin-top: 14px; }
.btn.big { min-height: 50px; font-size: 1.02rem; padding: 0 22px; }
a.chip { display: inline-flex; align-items: center; text-decoration: none; color: var(--ink); }
a.chip.active { color: #fff; }
.two-col { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
.grid-cards.wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.plain { margin: 0; padding-inline-start: 18px; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input, .pick { width: 20px; height: 20px; accent-color: var(--green); flex: none; margin-top: 3px; }
.explain { margin: 0; padding-inline-start: 18px; display: grid; gap: 4px; }
.explain strong { color: var(--ink-2); }
.msum { font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--ink-2); }
.table-wrap.flat { border: 0; border-radius: 0; }
.tbl.compact td, .tbl.compact th { padding: 9px 8px; }
.tbl.compact tr:first-child td { border-top: 0; }
.tbl a.code { font-weight: 700; text-decoration: none; }
.tbl tr.is-cancelled td { color: var(--ink-3); }
.tbl tr.is-cancelled strong { font-weight: 500; text-decoration: line-through; }

/* a table that becomes a list of cards on a phone */
@media (max-width: 700px) {
  .tbl.stackable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tbl.stackable, .tbl.stackable tbody { display: block; }
  .tbl.stackable tr { display: grid; gap: 6px; padding: 12px 14px; border-top: 1px solid var(--line); }
  .tbl.stackable tr:first-child { border-top: 0; }
  .tbl.stackable td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0; border: 0; text-align: start; }
  .tbl.stackable td:empty { display: none; }
  .tbl.stackable td[data-label]::before { content: attr(data-label); flex: none; font-size: .8rem; font-weight: 600; color: var(--ink-3); }
  .tbl.stackable td > div { text-align: end; }
}

/* ── home ── */
.stat.alert { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: var(--bad-50); }
.stat.alert .stat-value { color: var(--bad); }
.stat.attn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.stat .money { font-weight: 700; }
.pipeline { display: grid; gap: 10px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pipeline .stat { padding: 12px; }
.pipeline .stat-note { display: block; min-height: 1.5em; }
@media (max-width: 760px) { .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ── order page ── */
.status-pair { display: flex; gap: 18px; flex-wrap: wrap; }
.status-pair > div { display: grid; gap: 4px; justify-items: start; }
.actions .btn { flex: 0 1 auto; }
dl.kv { display: grid; gap: 14px 18px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 0; }
dl.kv dt { font-size: .82rem; color: var(--ink-2); }
dl.kv dd { margin: 0; font-size: 1.12rem; }
dl.kv .due dd .money { color: var(--bad); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { position: relative; padding: 10px 0; padding-inline-start: 22px; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 4px; top: 19px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }

/* ── customers and measurements ── */
.people { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); align-items: start; }
.person h3 .hint { font-weight: 500; }
.mv { display: grid; gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); margin-top: 12px; }
dl.mgrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); margin: 4px 0 0; }
dl.mgrid > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 7px 10px; }
dl.mgrid dt { font-size: .76rem; color: var(--ink-2); }
dl.mgrid dd { margin: 0; font-weight: 700; font-size: 1.05rem; }
dl.mgrid dd small { font-weight: 500; color: var(--ink-3); font-size: .72rem; }
details.older { margin-top: 10px; }
details.older summary, details.inline-new summary { cursor: pointer; font-weight: 600; color: var(--green); padding: 6px 0; }
.extra-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.measure-fields { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

/* ── new order ── */
.no-layout { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.no-summary { position: sticky; top: 76px; display: grid; gap: 12px; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--green-50); color: var(--green); font-size: .86rem; margin-inline-end: 4px; }
fieldset.no-line { margin: 0; min-width: 0; display: grid; gap: 14px; }
.line-head h3 { color: var(--green); }
.with-btn { display: flex; gap: 6px; }
.with-btn .field { min-width: 0; }
.with-btn .btn { min-height: 42px; flex: none; }
.fld.wide { grid-column: span 2; }
.fld.end-btn { align-self: end; }
.spec-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.spec-grid .lbl { display: flex; align-items: center; gap: 6px; }
.glyph-box { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--surface); color: var(--green); border: 1px solid var(--line); }
.glyph { width: 20px; height: 20px; }
.results { display: grid; gap: 4px; margin-top: 8px; }
.result { display: flex; justify-content: space-between; gap: 10px; align-items: center; width: 100%; min-height: 46px; padding: 8px 12px; text-align: start; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.result:hover, .result:focus-visible { border-color: var(--green); background: var(--green-50); }
.inline-new { margin-top: 10px; } .inline-new .form-grid { margin-top: 8px; }
.cust-name { font-size: 1.1rem; }
dl.sum { margin: 0; display: grid; gap: 8px; }
dl.sum > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
dl.sum dt { color: var(--ink-2); } dl.sum dd { margin: 0; }
dl.sum .strong { padding-top: 8px; border-top: 1px solid var(--line); }
dl.sum .strong dt { color: var(--ink); font-weight: 700; } dl.sum .strong .money { font-size: 1.15rem; font-weight: 700; }
@media (max-width: 980px) {
  .no-layout { grid-template-columns: 1fr; }
  .no-summary { position: static; }
}
@media (max-width: 560px) {
  .fld.wide { grid-column: auto; }
  .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .no-line .form-grid { grid-template-columns: 1fr 1fr; }
  .no-line .form-grid .fld.wide, .no-line .form-grid .fld:has(.with-btn) { grid-column: 1 / -1; }
}

/* ── workshop ── */
.ws-count { margin-bottom: 10px; }
.board { display: grid; gap: 12px; grid-template-columns: repeat(6, minmax(200px, 1fr)); overflow-x: auto; align-items: start; padding-bottom: 6px; }
.ws-col { display: grid; gap: 10px; align-content: start; background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-width: 0; }
.ws-col > header { padding: 2px 4px; }
.ws-n { font-weight: 700; color: var(--ink-2); }
.ws-none { text-align: center; padding: 10px 0; }
.ws-card { display: grid; gap: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; }
.ws-card.late { border-inline-start: 4px solid var(--bad); }
.ws-card a.code { text-decoration: none; }
.ws-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ws-actions .btn { flex: 1 1 auto; }
.ws-tailor .ws-actions .btn { min-height: 48px; font-size: 1rem; }
.ws-tailor .ws-card { padding: 14px; font-size: 1.02rem; }
@media (max-width: 1100px) {
  .board { grid-template-columns: 1fr; overflow: visible; }
  .ws-col.is-empty { display: none; }
  .ws-col { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
  .ws-col > header { grid-column: 1 / -1; }
}

/* ── printed documents (receipt, job card) ── */
.sheet-wrap { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; overflow: auto; }
.sheet { background: #fff; color: #000; margin: 0 auto; max-width: 720px; padding: 22px; border: 1px solid var(--line); min-height: 120px; }
.sheet.thermal { max-width: 302px; padding: 10px; }
.doc { display: grid; gap: 12px; font-size: 14px; line-height: 1.55; color: #000; }
.doc h3 { font-size: 13px; border-bottom: 1px solid #000; padding-bottom: 3px; margin-bottom: 6px; }
.doc h3 small { font-weight: 500; }
.doc p { margin: 0; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 2px solid #000; padding-bottom: 8px; }
.doc-shop { font-weight: 700; font-size: 16px; }
.doc-kind { font-weight: 700; }
.doc-no { text-align: end; display: grid; }
.doc-no .code { font-size: 30px; font-weight: 800; line-height: 1.1; }
.jobcard .doc-no .code { font-size: 44px; }
.doc-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px 14px; margin: 0; }
.doc-kv dt, .doc-measures dt { font-size: 11px; color: #444; }
.doc-kv dd, .doc-measures dd { margin: 0; font-weight: 700; }
.doc-measures { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; margin: 6px 0 0; }
.doc-measures > div { border: 1px solid #000; border-radius: 4px; padding: 5px 8px; }
.doc-measures dd { font-size: 22px; line-height: 1.2; }
.doc-measures dd small { font-size: 11px; font-weight: 500; }
.doc-basis { font-size: 12px; }
.doc-note { border: 1px dashed #000; border-radius: 4px; padding: 8px; min-height: 44px; white-space: pre-wrap; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th { text-align: start; font-size: 11px; border-bottom: 1px solid #000; padding: 4px 2px; }
.doc-table td { padding: 5px 2px; border-bottom: 1px dotted #999; vertical-align: top; }
.doc-table .end { text-align: end; }
.doc .money small { color: #000; }
.doc-totals { margin: 0; display: grid; gap: 3px; }
.doc-totals > div { display: flex; justify-content: space-between; gap: 10px; }
.doc-totals dd { margin: 0; }
.doc-totals .strong { font-weight: 800; font-size: 16px; border-top: 1px solid #000; padding-top: 3px; }
.doc-disclaimer { text-align: center; font-weight: 700; border: 1px solid #000; padding: 5px; }
.doc-small { font-size: 11px; color: #333; }
.thermal .doc { font-size: 12px; gap: 8px; }
.thermal .doc-head { flex-direction: column; align-items: stretch; }
.thermal .doc-no { text-align: start; }
.thermal .doc-kv { grid-template-columns: 1fr 1fr; }
.thermal .doc-measures { grid-template-columns: 1fr 1fr; }
.thermal .doc-measures dd { font-size: 18px; }

#print-root { display: none; }
@page ops-a4 { size: A4; margin: 14mm; }
@page ops-thermal { size: 80mm auto; margin: 3mm; }
@media print {
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; page: ops-a4; background: #fff; }
  body.printing #print-root.thermal { page: ops-thermal; width: 72mm; }
  .doc, .doc section, .doc-measures > div, .doc-table tr { break-inside: avoid; }
}
