/* cherry: only (a) components the kit does not have and (b) layout glue.
   Every value is a token; nothing here restyles a kit component. See KIT_GAPS.md. */

/* ---------------------------------------------------------------- sign-in art */
.ch-art { display: block; width: 100%; max-width: 30rem; height: auto; }
.ch-art-ring { fill: none; stroke: currentColor; }
.ch-art-faint { opacity: 0.35; }
.ch-art-mid { opacity: 0.6; }
.ch-art-phone { max-width: 15rem; padding-block: var(--sp-7) var(--sp-3); color: var(--primary); }
.ch-fill { height: 100vh; height: 100dvh; }

/* ---------------------------------------------------------------- layout glue */
.ch-phone { padding-block: var(--sp-4); }
.ch-ring-row { display: flex; align-items: center; gap: var(--sp-4); }
.ch-nowrap { white-space: nowrap; }
.ch-col-name { min-width: 11rem; }
.ch-col-file { min-width: 17.5rem; }
/* the two lines' group tables side by side only where each keeps its four columns on one line (KIT_GAPS 30) */
.ch-lines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.ch-lines > div { min-width: 0; }
.ch-lines > div > :last-child { flex: 1; }
@media (max-width: 85rem) { .ch-lines { grid-template-columns: minmax(0, 1fr); } }
.ch-sum { font-family: var(--font-heading); font-size: var(--fs-2xl); font-weight: 700; font-variant-numeric: tabular-nums; line-height: var(--lh-tight); }
.ch-lotno { font-family: var(--font-heading); font-size: var(--fs-lg); font-weight: 600; letter-spacing: 0.01em; white-space: nowrap; }
.ch-w-qty { width: 5.5rem; }
/* a size string shown as the customer typed it: the body font otherwise draws the "x" between two digits as a multiplication sign */
.ch-as-typed { font-variant-ligatures: no-contextual; }

/* ---------------------------------------------------------------- lot map: one square per lot of a PO */
.ch-lotmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.25rem, 1fr)); gap: var(--sp-1); margin: 0; padding: 0; list-style: none; }
.ch-lot { display: grid; place-items: center; min-height: 2.25rem; border: 1px solid var(--panel-border); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; text-decoration: none; }
.ch-lot:hover { border-color: var(--field-border-hover); color: var(--text); }
.ch-lot:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ch-lot[data-state="done"] { background: var(--primary-tint); border-color: var(--primary-tint-line); color: var(--on-primary-tint); }
.ch-lot[data-state="flag"] { background: var(--warn-bg); border: 2px solid var(--warn); color: var(--text); font-weight: 700; }
.ch-lot[data-state="todo"] { border-style: dashed; border-color: var(--field-border); }
.ch-lot[data-state="free"] { border-style: dotted; border-color: var(--field-border); background: var(--sunk); }
.ch-lotmap-legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin: 0; padding: 0; list-style: none; font-size: var(--fs-sm); color: var(--muted); }
.ch-lotmap-legend li { display: inline-flex; align-items: center; gap: var(--sp-2); }
.ch-lotmap-legend .ch-lot { width: 1.25rem; min-height: 1.25rem; }

/* ---------------------------------------------------------------- defect counter card (phone lot sheet) */
.ch-counters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin: 0; padding: 0; list-style: none; }
.ch-counter { display: grid; grid-template-rows: auto 1fr auto; gap: var(--sp-2); padding: var(--sp-3); background: var(--surface); border: 1px solid var(--panel-border); border-radius: var(--radius-lg); box-shadow: var(--sh-1); }
.ch-counter[data-on] { border-color: var(--primary-tint-line); background: var(--primary-tint); }
.ch-counter-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-2); min-height: var(--tap); }
.ch-counter-name { display: block; font-weight: 600; line-height: var(--lh-tight); }
.ch-counter-hint { display: block; font-size: var(--fs-xs); color: var(--muted); }
/* the count sits just above the buttons, so two cards of one row keep their counts level when one name wraps */
.ch-counter-value { align-self: end; margin: 0; font-family: var(--font-heading); font-size: var(--fs-3xl); font-weight: 700; line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.ch-counter-input { width: 100%; min-height: var(--tap); border: 0; background: transparent; color: var(--text); font: inherit; text-align: center; padding: 0; }
.ch-counter-input:focus-visible { outline: 2px solid var(--focus); border-radius: var(--radius-sm); }
.ch-counter-btns { display: grid; grid-template-columns: 1fr 1.5fr; gap: var(--sp-2); }
.ch-counter-btn { display: grid; place-items: center; min-height: 4rem; border: 1px solid var(--field-border); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; touch-action: manipulation; }
.ch-counter-btn .icon { width: 1.75rem; height: 1.75rem; }
.ch-counter-btn[data-count="1"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.ch-counter-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ch-counter-btn:active { transform: translateY(1px); }
.ch-counter-btn[aria-disabled="true"] { background: var(--sunk); border-color: var(--panel-border); color: var(--muted); cursor: default; }

/* ---------------------------------------------------------------- product photo: a drawn metal O-seal, stands in for a camera picture */
.ch-photo { display: block; width: 100%; height: 100%; background: var(--sunk); }
.ch-photo-metal { fill: none; stroke: var(--muted); }
.ch-photo-shine { fill: none; stroke: var(--surface); opacity: 0.8; }
.ch-photo-edge { fill: none; stroke: var(--text); opacity: 0.35; }
.ch-photo-spot { fill: var(--text); opacity: 0.55; }
.ch-photo-mark { fill: none; stroke: var(--danger); }
.ch-annot-tools { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; }

/* ---------------------------------------------------------------- QR placeholder (drawn squares, not a real code) */
.ch-qr { display: block; width: 100%; height: 100%; fill: currentColor; }

/* ---------------------------------------------------------------- monthly report sheet head (screen), the customer's title rows */
.ch-sheet-head { display: grid; justify-items: center; gap: var(--sp-1); text-align: center; }
.ch-sheet-head p { margin: 0; }
.ch-sheet-org { font-weight: 700; justify-self: start; }
.ch-sheet-title { font-family: var(--font-heading); font-size: var(--fs-xl); font-weight: 700; }
.ch-sheet-sub { color: var(--muted); }

/* ---------------------------------------------------------------- letterhead preview and A4 print glue */
.ch-letter { display: grid; gap: var(--sp-2); padding: var(--sp-5); border: 1px solid var(--panel-border); border-radius: var(--radius); background: var(--surface); }
.ch-letter-title { margin: 0; padding-top: var(--sp-3); border-top: 1px solid var(--field-border); }
.ch-paper-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1mm 8mm; margin: 0; }
.ch-paper-meta div { display: flex; gap: 2mm; }
.ch-paper-meta dt { min-width: 34mm; }
.ch-paper-meta dd { margin: 0; font-weight: 700; }
.ch-paper-small { font-size: 8pt; }
/* tight rows: 40 lots, the head with the logo and the signature row stay on one A4 sheet */
.ch-paper-tight th, .ch-paper-tight td { padding-block: 0.25mm; line-height: 1.2; }
/* the Inspection Report's 15 columns (with inspection date and co-inspectors) inside the A4 portrait margins (KIT_GAPS 10) */
.ch-paper-narrow { font-size: 7.5pt; }
.ch-paper-narrow th, .ch-paper-narrow td { padding-inline: 0.7mm; }
/* the file's print area holds all 40 lots, the totals and the Note on one A4 page; with the logo and the signature row too (KIT_GAPS 10) */
.ch-paper-narrow th, .ch-paper-narrow td { padding-block: 0.2mm; line-height: 1.15; }
/* the paper sheets drawn larger on screen only, so a decimal comma reads at 100% zoom; print keeps A4 (KIT_GAPS 34) */
@media screen and (min-width: 80rem) {
  .ch-paper-zoom > .paper { zoom: 1.2; }
  .ch-paper-zoom > .paper-landscape { zoom: 1.09; }
}
@media screen and (min-width: 90rem) {
  .ch-paper-zoom > .paper { zoom: 1.35; }
  .ch-paper-zoom > .paper-landscape { zoom: 1.22; }
}
/* the monthly sheet's 19 columns on one A4 landscape width */
.ch-paper-wide { font-size: 6.5pt; }
.ch-paper-wide th, .ch-paper-wide td { padding-inline: 0.7mm; }
.paper-tbl + .ch-paper-meta { margin-top: 2.5mm; }
/* the head fields of the PO file's printed forms; on the certificate the boxed "PASSED" mark sits on the right */
.ch-paper-fields { display: flex; align-items: center; gap: 6mm; }
.ch-paper-fields .ch-paper-meta { flex: 1; min-width: 0; }
/* the certificate's 14 columns (8 NHC defect groups) and 40 lots on one A4 portrait sheet */
.ch-paper-cert { font-size: 7pt; }
.ch-paper-fields .ch-paper-meta { gap: 0.5mm 6mm; }
.ch-paper-fields .ch-paper-meta dt { min-width: 24mm; flex: none; white-space: nowrap; }
.ch-paper-fields .ch-paper-meta dd { white-space: nowrap; }
.ch-cert-stamp { margin: 0; padding: 2mm 5mm; border: 0.6mm solid currentColor; font-size: 14pt; font-weight: 700; letter-spacing: 0.1em; }
.ch-label-line { margin: 0; line-height: 1.25; }
.ch-label-qr { width: 20mm; height: 20mm; flex: none; }
.ch-label-row { display: flex; align-items: center; gap: 3mm; min-width: 0; }

/* ---------------------------------------------------------------- the PO chart as in the file: one series per defect group, the count inside each part (KIT_GAPS 33) */
.ch-po-chart { --cc-h: 24rem; }
.ch-po-chart :is(.cc-col, .cc-swatch)[data-series="5"] { --cc-fill: var(--muted); }
.ch-po-chart :is(.cc-col, .cc-swatch)[data-series="6"] { --cc-fill: color-mix(in srgb, var(--series-1) 35%, var(--text)); }
.ch-po-chart .cc-col::after { content: attr(data-value); position: absolute; inset: 0 0 2px; display: grid; place-items: center; color: var(--on-series); font-size: var(--fs-xs); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; pointer-events: none; }

/* ---------------------------------------------------------------- variants: states drawn by the variant files */
.ch-offline { position: sticky; top: var(--topbar-h); z-index: var(--z-sticky); }
.ch-conflict { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.ch-conflict > * { min-width: 0; }
.ch-blocked { opacity: 0.6; }
.ch-result-aql { font-family: var(--font-heading); font-size: var(--fs-2xl); font-weight: 700; }
@media (max-width: 40rem) {
  .ch-conflict { grid-template-columns: minmax(0, 1fr); }
}
