/* 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: 20px; }
.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: 10px; font-size: .88rem; color: var(--ink-3); }
.crumb a { display: inline-flex; align-items: center; min-height: 32px; text-decoration: none; font-weight: 600; color: var(--ink-2); }
.crumb a:hover { color: var(--primary); text-decoration: underline; }
.more-row { display: flex; justify-content: center; margin-top: 16px; }
.btn.big { min-height: 52px; font-size: 1.02rem; padding: 0 24px; border-radius: var(--radius-sm); }
a.chip { display: inline-flex; align-items: center; text-decoration: none; }
a.chip.active { color: #fff; }
.chips.block { margin-top: 0; margin-bottom: 16px; }
.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: 10px; align-items: flex-start; cursor: pointer; min-height: 32px; }
.check input, .pick { width: 20px; height: 20px; accent-color: var(--primary); flex: none; margin-top: 3px; cursor: pointer; }
.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: .88rem; color: var(--ink-2); line-height: 1.7; }
.table-wrap.flat { border: 0; border-radius: 0; box-shadow: none; }
.tbl.compact td, .tbl.compact th { padding: 10px 8px; }
.tbl.compact tr:first-child td { border-top: 0; }
.tbl.compact td:not(:nth-child(2)) { white-space: nowrap; }
.tbl a.code { font-weight: 700; text-decoration: none; color: var(--primary); }
.tbl a.code:hover { text-decoration: underline; }
.tbl tr.is-cancelled td { color: var(--ink-3); }
.tbl tr.is-cancelled strong { font-weight: 500; text-decoration: line-through; }
.card > .row.between:first-child { margin-bottom: 10px; }
.card > .row.between:first-child > h2, .card > .row.between:first-child > h3 { margin: 0; }

/* 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: 7px; padding: 14px 16px; 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: 500; color: var(--ink-3); }
  .tbl.stackable td > div { text-align: end; }
  .tbl.stackable tr.clickable:active { background: var(--surface-3); }
  /* filter chips: one swipeable line instead of a wrapped block */
  .chips.block { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -12px; padding-inline: 12px; scroll-padding-inline: 12px; }
  .chips.block::-webkit-scrollbar { display: none; }
  .chips.block .chip { flex: none; }
}

/* ── home ── */
.stat.alert { border-color: color-mix(in srgb, var(--bad) 40%, 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)); background: color-mix(in srgb, var(--warn-50) 45%, var(--surface)); }
.stat.attn .stat-value { color: var(--warn); }
.stat .money { font-weight: 700; }
/* the workshop as one strip of cloth, stage by stage */
.pipeline { display: grid; gap: 1px; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); }
.pipeline .stat { padding: 14px 14px 12px; border: 0; border-radius: 0; box-shadow: none; }
.pipeline .stat:hover { background: var(--surface-3); }
.pipeline .stat:focus-visible { outline-offset: -2px; }
.pipeline .stat-label { font-weight: 600; color: var(--ink); }
.pipeline .stat-note { display: block; min-height: 1.7em; }
@media (max-width: 760px) { .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ── order page ── */
.status-pair { display: flex; gap: 20px; flex-wrap: wrap; }
.status-pair > div { display: grid; gap: 4px; justify-items: start; }
.actions { gap: 8px; }
.actions .btn { flex: 0 1 auto; }
dl.kv { display: grid; gap: 16px 20px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 0; }
dl.kv dt { font-size: .8rem; color: var(--ink-3); font-weight: 500; }
dl.kv dd { margin: 2px 0 0; font-size: 1.2rem; font-weight: 600; }
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: 26px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 4px; top: 18px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brass); z-index: 1; }
.timeline li::after { content: ""; position: absolute; inset-inline-start: 8px; top: 0; bottom: 0; border-inline-start: 1px dashed var(--line-strong); }
.timeline li:first-child::after { top: 20px; } .timeline li:last-child::after { bottom: calc(100% - 20px); }
.timeline li:only-child::after { display: none; }

/* ── customers and measurements ── */
.people { display: grid; gap: 16px; 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: 14px 0 0; border-top: 1px solid var(--line); margin-top: 14px; }
dl.mgrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); margin: 6px 0 0; }
dl.mgrid > div { background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 7px 10px; }
dl.mgrid dt { font-size: .74rem; color: var(--ink-3); }
dl.mgrid dd { margin: 0; font-weight: 700; font-size: 1.08rem; font-variant-numeric: tabular-nums; }
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; font-size: .92rem; color: var(--primary); padding: 8px 0; width: fit-content; }
.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: 20px; grid-template-columns: minmax(0, 1fr) 328px; align-items: start; }
.no-summary { position: sticky; top: 84px; display: grid; gap: 12px; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .82rem; font-weight: 700; margin-inline-end: 6px; vertical-align: 1px; font-variant-numeric: tabular-nums; }
fieldset.no-line { margin: 0; min-width: 0; display: grid; gap: 16px; }
.line-head h3 { color: var(--ink); }
.with-btn { display: flex; gap: 6px; }
.with-btn .field { min-width: 0; }
.with-btn .btn { min-height: var(--tap); flex: none; }
.fld { min-width: 0; }
.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: 14px; background: var(--surface-3); border: 1px solid var(--line); 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(--brass-ink); border: 1px solid var(--line); flex: none; }
.glyph { width: 20px; height: 20px; }
.results { display: grid; gap: 6px; margin-top: 8px; }
.result { display: flex; justify-content: space-between; gap: 10px; align-items: center; width: 100%; min-height: 48px; padding: 8px 14px; text-align: start; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease); }
.result:hover, .result:focus-visible { border-color: var(--primary); background: var(--primary-50); }
.result:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.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: 9px; }
dl.sum > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
dl.sum dt { color: var(--ink-2); font-size: .92rem; } dl.sum dd { margin: 0; }
dl.sum .strong { padding-top: 10px; border-top: 1px dashed var(--line-strong); }
dl.sum .strong dt { color: var(--ink); font-weight: 700; } dl.sum .strong .money { font-size: 1.2rem; font-weight: 700; }
.no-summary .btn { width: 100%; }
@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)); padding: 12px; }
  .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: 12px; }
.board { display: grid; gap: 12px; grid-template-columns: repeat(6, minmax(204px, 1fr)); overflow-x: auto; align-items: start; padding-bottom: 8px; scrollbar-width: thin; }
.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: 4px 4px 2px; }
.ws-n { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ws-none { text-align: center; padding: 14px 0; }
.ws-card { display: grid; gap: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; box-shadow: var(--shadow-1); }
.ws-card.late { border-inline-start: 4px solid var(--bad); }
.ws-card a.code { text-decoration: none; font-weight: 700; }
.ws-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.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; }
}

/* ── home: the day's essentials ── */
.home-quick { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin-bottom: 20px; }
.home-new { flex: none; }
.home-search { position: relative; flex: 1 1 280px; min-width: 0; }
.home-search .field { min-height: 52px; font-size: 1rem; padding-inline-end: 16px; padding-inline-start: 44px; background-position: right 15px center; box-shadow: var(--shadow-1); border-color: var(--line-strong); }
.home-search-results { position: absolute; inset-inline: 0; top: calc(100% + 8px); z-index: 15; padding: 6px; display: grid; gap: 2px; max-height: 60dvh; overflow: auto; box-shadow: var(--shadow-2); }
.home-search-results a { display: flex; gap: 10px; align-items: center; min-height: var(--tap); padding: 10px; border-radius: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.home-search-results a > span:last-child { margin-inline-start: auto; }
.home-search-results a:hover, .home-search-results a:focus-visible { background: var(--primary-50); }
.home-search-msg { padding: 10px; }
.home-essentials { display: grid; gap: 12px; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
@media (max-width: 1100px) { .home-essentials { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); } .home-tile.money { grid-column: 1 / -1; } }
.home-tile { position: relative; display: grid; gap: 2px; align-content: start; padding: 18px 20px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease); }
/* a short length of thread marks what the tile is about */
.home-tile::before { content: ""; width: 26px; height: 3px; border-radius: 3px; background: var(--line-strong); margin-bottom: 10px; }
.home-tile:hover { border-color: var(--ink-3); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.home-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.home-tile-label { font-weight: 600; color: var(--ink-2); font-size: .9rem; }
.home-tile-value { font-size: 2.1rem; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.home-tile-value .money { font-weight: 700; }
.home-tile-value small { font-size: .88rem; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.home-tile-note { font-size: .82rem; color: var(--ink-3); }
.home-tile-cta { margin-top: 10px; font-size: .84rem; font-weight: 600; color: var(--primary); }
/* the money owed to the shop is the featured figure */
.home-tile.money { background: var(--deep); border-color: var(--deep); color: var(--on-deep); background-image: radial-gradient(420px 160px at 0% 0%, rgba(216,176,106,.16), transparent 70%); }
.home-tile.money::before { background: var(--brass-lit); }
.home-tile.money .home-tile-label { color: rgba(255,255,255,.78); }
.home-tile.money .home-tile-note, .home-tile.money .home-tile-value small { color: var(--on-deep-2); }
.home-tile.money .home-tile-cta { color: var(--brass-lit); }
.home-tile.money:hover { border-color: var(--brass-lit); }
.home-tile.money:focus-visible { outline-color: var(--brass); }
.home-tile.ok::before { background: var(--ok); } .home-tile.ok .home-tile-value { color: var(--ok); }
.home-tile.warn::before { background: var(--warn); } .home-tile.warn .home-tile-value { color: var(--warn); }
.home-tile.bad { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: color-mix(in srgb, var(--bad-50) 55%, var(--surface)); }
.home-tile.bad::before { background: var(--bad); } .home-tile.bad .home-tile-value { color: var(--bad); }
.home-counts { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
/* secondary figures sit side by side on a wide screen */
.home-band { display: grid; gap: 20px 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); align-items: start; margin-top: 28px; }
.home-band > .block { margin-top: 0; }
.home-band:not(:has(*)) { display: none; }
.home-band .grid-cards, .home-band .grid-cards.wide { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
.home-band .home-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#h-body h2 { font-size: 1.04rem; }
#h-body > .block, #h-body > .two-col { margin-top: 28px; }
#h-body > .notice.block:first-child { margin-top: 0; margin-bottom: 16px; }
@media (max-width: 560px) {
  .home-quick { flex-direction: column; }
  .home-band .home-counts { gap: 8px; } .home-band .home-counts .stat { padding: 12px 10px; }
  .home-band .home-counts .stat-label { font-size: .78rem; line-height: 1.45; min-height: 2.9em; }
  .home-new { width: 100%; }
  .home-search { flex: none; }
  .home-essentials { gap: 8px; }
  .home-tile { padding: 12px 12px 10px; min-width: 0; }
  .home-tile::before { margin-bottom: 6px; }
  .home-tile-label { font-size: .8rem; line-height: 1.4; }
  .home-tile-value { font-size: 1.6rem; }
  .home-tile-value small { font-size: .76rem; }
  .home-tile-cta, .home-tile:not(.money) .home-tile-note { display: none; }
  .home-tile.money { padding: 16px; }
  .home-tile.money .home-tile-label { font-size: .9rem; }
  .home-tile.money .home-tile-value { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) { .home-tile { transition: none; } .home-tile:hover { transform: none; } }
