/* ops.css — the "ops" screen group: Leads, Stock, Journal and their sheets (lead sheet, job form, item form, count,
   used a part). Prefixes: .leads-… .stock-… .journal-… .jobform-… .count-… .usedpart-…
   Colours and sizes from tokens.css only. Logical properties only (RTL). */

/* ---------- shared screen head (h1 + main action) ---------- */
.leads-head,.stock-head,.journal-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--sp-3);margin-bottom:var(--sp-4)}
.journal-head{margin-bottom:0}
.journal-head__actions{display:flex;flex-wrap:wrap;gap:var(--sp-2)}

/* visually hidden labels (the field still has a real <label>) */
.stock-search .field__label,.count-search .field__label,.journal-date .field__label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* ================= leads ================= */
.leads-filters{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;margin:0 calc(var(--gutter) * -1) var(--sp-4);padding:0 var(--gutter)}
.leads-filters::-webkit-scrollbar{display:none}
.leads-filters .chip{flex:none}

.leads-sheet{display:flex;flex-direction:column;gap:var(--sp-4)}
.leads-sheet__top{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;color:var(--text-2)}
.leads-sheet__car{color:var(--text-2)}
.leads-sheet__status{display:flex;flex-wrap:wrap;gap:8px}
.leads-sheet__book{display:flex;flex-wrap:wrap;gap:var(--sp-2)}
.leads-sheet__history{margin-top:var(--sp-2)}
.leads-history{display:flex;flex-direction:column;gap:10px}
.leads-history__row{display:flex;flex-direction:column;gap:2px;padding-inline-start:12px;border-inline-start:2px solid var(--line)}
.leads-history__when{color:var(--text-3);font-size:var(--fs-xs)}
.leads-history__text{font-size:var(--fs-sm);overflow-wrap:anywhere}
.leads-sheet__delete{padding-top:var(--sp-4);border-top:1px solid var(--line)}

/* ================= job form (also used by the item / count / used-part sheets) ================= */
.jobform-foot{display:flex;flex-direction:column;gap:8px}
/* the main button gets the room; Cancel / Close keep their own width */
.jobform-foot .sheet__actions > .btn--ghost,.jobform-actions > .btn--ghost{flex:0 1 auto}
.jobform-note{padding:10px 12px;border-radius:var(--r-sm);background:var(--s2);color:var(--text-2);font-size:var(--fs-sm);overflow-wrap:anywhere}
.jobform-two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--sp-3);align-items:start}
.jobform-cust{display:flex;flex-direction:column;gap:8px}
.jobform-cust__tag{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.jobform-cust__hits{display:flex;flex-direction:column;gap:2px;padding:4px;border-radius:var(--r-sm);background:var(--s2);border:1px solid var(--line)}
.jobform-cust__hit{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:var(--tap);padding:8px 12px;border-radius:var(--r-xs);text-align:start}
.jobform-cust__hit:hover{background:var(--s3)}
.jobform-cust__name{font-weight:600;min-width:0;overflow-wrap:anywhere}
.jobform-cars{display:flex;flex-wrap:wrap;gap:4px 8px}

.jobform-paid{display:flex;flex-direction:column;gap:6px;min-width:0;margin:0;padding:0;border:0}
.jobform-paid > legend{float:left;width:100%;padding:0;margin-bottom:6px}
.jobform-seg{clear:both;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;padding:4px;border-radius:var(--r-sm);background:var(--s2);border:1.5px solid var(--line-strong)}
.jobform-seg__opt{position:relative;display:flex}
.jobform-seg__input{position:absolute;inset-inline-start:0;top:0;width:1px;height:1px;opacity:0;margin:0}
.jobform-seg__text{flex:1;display:grid;place-items:center;min-height:44px;padding:6px 8px;border-radius:var(--r-xs);color:var(--text-2);
  font:600 var(--fs-sm)/1.2 var(--font);text-align:center;cursor:pointer;transition:background-color var(--t) var(--ease),color var(--t)}
.jobform-seg__text:hover{background:var(--s3);color:var(--text)}
.jobform-seg__input:checked + .jobform-seg__text{background:var(--y);color:var(--ink)}
.jobform-seg__input:focus-visible + .jobform-seg__text{outline:2px solid var(--y);outline-offset:2px}
.jobform-owe{color:var(--ember);font-weight:600}
.jobform-warn,.usedpart-warn{color:var(--ember);font-weight:600}

.jobform-parts{display:flex;flex-direction:column;gap:var(--sp-3)}
.jobform-part{display:flex;flex-direction:column;gap:6px;padding:10px;border:1px solid var(--line);border-radius:var(--r-sm)}
/* the item picker gets the whole width (long part names, often Russian inside a Hebrew screen, were cut);
   quantity and remove sit under it */
.jobform-part__row{display:grid;grid-template-columns:96px minmax(0,1fr) auto;grid-template-areas:"item item item" "qty . rm";align-items:end;gap:8px}
.jobform-part__item{grid-area:item}
.jobform-part__qty{grid-area:qty}
.jobform-part__rm{grid-area:rm}
.jobform-part__qty .field__input{text-align:center}
.jobform-part__rm{color:var(--text-2)}
/* km / test date / next service: one quiet row until opened */
.jobform-more{display:flex;align-items:center;justify-content:space-between;gap:var(--sp-2);width:100%;min-height:var(--tap);padding:8px 14px;
  border-radius:var(--r-sm);background:var(--s2);color:var(--text-2);text-align:start;font-size:var(--fs-sm)}
.jobform-more:hover{color:var(--text)}
.jobform-more__text{display:flex;flex-direction:column;gap:2px;min-width:0}
.jobform-more__plus{flex:none;font-size:var(--fs-lg);font-weight:700;color:var(--y)}
.jobform-car{display:flex;flex-direction:column;gap:var(--sp-3);min-width:0;margin:0;padding:12px;border:1px solid var(--line);border-radius:var(--r-sm)}
.jobform-car > legend{padding:0 6px}
.jobform-void{display:flex;flex-direction:column;align-items:flex-start;gap:6px;margin-top:var(--sp-2);padding-top:var(--sp-4);border-top:1px solid var(--line)}

/* ================= stock ================= */
.stock-search{margin-bottom:var(--sp-3)}
.stock-actions{display:flex;flex-wrap:wrap;gap:var(--sp-2);margin-bottom:var(--sp-4)}
.stock-list{display:flex;flex-direction:column;gap:10px}
.stock-row{display:flex;align-items:center;gap:var(--sp-2);padding:6px;padding-inline-start:0;background:var(--s1);border:1px solid var(--line);
  border-inline-start:3px solid var(--line);border-radius:var(--r)}
/* rows off screen are not laid out or painted until scrolled near (long stock lists) */
.stock-row{content-visibility:auto;contain-intrinsic-size:auto 68px}
.stock-more{display:flex;flex-direction:column;gap:8px;margin-top:var(--sp-3)}
.stock-row--low{border-inline-start-color:var(--ember)}
.stock-row--queued{border-style:dashed;border-inline-start-style:solid}
.stock-row__main{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center;gap:4px;min-height:var(--tap);padding:6px 12px;
  border-radius:var(--r-sm);text-align:start;color:var(--text)}
.stock-row__main:hover{background:var(--s2)}
.stock-row__name{font-weight:600;line-height:1.3;overflow-wrap:anywhere}
.stock-row__meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;color:var(--text-3);font-size:var(--fs-xs)}
.stock-row__unsent{color:var(--text-2);font-weight:600}
.stock-row .stepper{flex:none;gap:0}
.stock-row .stepper__value{min-width:36px}  /* a little more room for the item name at 375 px; buttons stay 48 px */
.stock-moves-sec{margin-top:var(--sp-8)}
.stock-moves{display:flex;flex-direction:column}
.stock-move{display:flex;align-items:flex-start;gap:12px;padding:10px 0;border-bottom:1px solid var(--line)}
.stock-move__delta{flex:none;min-width:3.4em;padding:2px 8px;border-radius:var(--r-pill);font-weight:700;text-align:center;font-variant-numeric:tabular-nums}
.stock-move__delta--plus{background:var(--ok-soft);color:var(--ok)}
.stock-move__delta--minus{background:var(--ember-soft);color:var(--ember)}
.stock-move__body{display:flex;flex-direction:column;gap:2px;min-width:0}
.stock-move__name{font-weight:500;overflow-wrap:anywhere}

/* count sheet */
.count-hint{margin-bottom:var(--sp-3);font-size:var(--fs-sm)}
.count-tools{display:flex;flex-direction:column;gap:var(--sp-1);margin-bottom:var(--sp-2)}
.count-list{display:flex;flex-direction:column}
.count-row{display:grid;grid-template-columns:minmax(0,1fr) 80px 72px;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid var(--line)}
.count-row__label{display:flex;flex-direction:column;gap:2px;min-width:0;cursor:pointer}
.count-row__name{font-weight:600;line-height:1.3;overflow-wrap:anywhere}
.count-row__input{text-align:center;font-variant-numeric:tabular-nums;padding-inline:8px}
.count-row__diff{font-weight:700;font-size:var(--fs-sm);text-align:center;color:var(--text-3)}
.count-row__diff--plus{color:var(--ok)}
.count-row__diff--minus{color:var(--ember)}
.count-row__diff--same{font-size:var(--fs-xs);font-weight:600}
.count-row--bad .count-row__diff{color:var(--bad);font-size:var(--fs-xs);font-weight:600}
.count-empty{padding:var(--sp-4) 0}
.count-preview{margin-top:var(--sp-5);padding:var(--sp-4);border-radius:var(--r);background:var(--s2)}
.count-preview__title{margin-bottom:8px;font-size:var(--fs)}
.count-preview__list{display:flex;flex-direction:column;gap:6px}
.count-preview__row{display:flex;flex-wrap:wrap;gap:4px 8px;font-size:var(--fs-sm)}

/* used a part */
.usedpart-list{display:flex;flex-direction:column;gap:6px}
.usedpart-item{position:relative;display:flex}
.usedpart-item__input{position:absolute;inset-inline-start:0;top:0;width:1px;height:1px;opacity:0;margin:0}
.usedpart-item__box{flex:1;display:flex;flex-direction:column;gap:2px;min-height:var(--tap);padding:10px 14px;border-radius:var(--r-sm);
  background:var(--s2);border:1.5px solid var(--line);cursor:pointer}
.usedpart-item__box:hover{border-color:var(--line-strong)}
.usedpart-item__input:checked + .usedpart-item__box{border-color:var(--y);background:var(--y-soft)}
.usedpart-item__input:focus-visible + .usedpart-item__box{outline:2px solid var(--y);outline-offset:2px}
.usedpart-item__name{font-weight:600;overflow-wrap:anywhere}
.usedpart-qty{display:flex;flex-direction:column;align-items:flex-start;gap:6px}
.usedpart-chosen{display:flex;flex-direction:column;gap:6px}
.usedpart-chosen__row{display:flex;align-items:center;gap:var(--sp-2)}
.usedpart-chosen__box{min-width:0;border-color:var(--y);background:var(--y-soft);cursor:default}
.usedpart-chosen__row .btn{flex:none}

/* ================= journal ================= */
.journal-top{display:flex;flex-direction:column;gap:var(--sp-3);margin-bottom:var(--sp-5)}
.journal-day{display:flex;align-items:center;gap:var(--sp-2)}
.journal-day .icon-btn:disabled{opacity:.35;cursor:default}
.journal-date{flex:1}
.journal-date .field__input{text-align:center;font-weight:600}
.journal-dayline{display:flex;flex-wrap:wrap;align-items:center;gap:4px 6px;color:var(--text-2)}
.journal-dayline strong{color:var(--text)}
.journal-tiles{margin-bottom:var(--sp-2)}
.journal-job{flex-direction:column;align-items:stretch;gap:0}
.journal-job__top{display:flex;align-items:flex-start;gap:var(--sp-3)}
.journal-job__money{display:flex;flex-direction:column;align-items:flex-end;gap:6px}
.journal-job__actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:12px}
.journal-job__cam{position:relative;cursor:pointer}
.journal-job__cam:focus-within{outline:2px solid var(--y);outline-offset:3px}
.journal-job__cam input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);border:0;opacity:0}
/* old-part photo sheet */
.part-photo{display:grid;gap:var(--sp-3)}
.part-photo__foot{display:grid;gap:var(--sp-2)}
.part-photo__img{display:block;width:100%;max-height:52vh;object-fit:contain;border-radius:var(--r-md);background:var(--bg-2, #111)}
.part-photo__wait{display:flex;align-items:center;justify-content:center;gap:var(--sp-2);min-height:200px;color:var(--text-3)}
.journal-job__edit{margin-inline-start:auto}  /* edit sits at the end of the row: one row of buttons instead of three */
.journal-note__play{display:inline-flex;flex-wrap:wrap;align-items:center;gap:8px}
.journal-note__audio{flex-basis:100%;width:100%}
.journal-note__result{margin-top:6px;color:var(--ok);font-size:var(--fs-sm)}
.journal-pay__owed{color:var(--ember);font-weight:600}

.journal-events{display:flex;flex-direction:column}
.journal-ev{display:grid;grid-template-columns:auto auto minmax(0,1fr);align-items:start;gap:10px;padding:10px 0;border-bottom:1px solid var(--line)}
.journal-ev__time{min-width:3.1em;padding-top:4px;color:var(--text-3);font-size:var(--fs-xs);font-variant-numeric:tabular-nums}
.journal-ev__icon{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--s2);color:var(--text-2)}
.journal-ev--job .journal-ev__icon{background:var(--y-soft);color:var(--y)}
.journal-ev--money .journal-ev__icon{background:var(--ok-soft);color:var(--ok)}
.journal-ev--lead .journal-ev__icon,.journal-ev--reminder .journal-ev__icon{background:var(--volt-soft);color:var(--volt)}
.journal-ev--note .journal-ev__icon{background:color-mix(in srgb,var(--note) 14%,transparent);color:var(--note)}
.journal-ev--delete .journal-ev__icon{background:var(--bad-soft);color:var(--bad)}
.journal-ev--undo .journal-ev__icon{color:var(--text-3)}
.journal-ev__body{display:flex;flex-direction:column;align-items:stretch;gap:2px;min-width:0}
/* kind on the start side, Undo on the end side of the same line (no extra row per event) */
.journal-ev__head{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;min-height:24px}
.journal-ev__kind{padding-top:5px;color:var(--text-3);font-size:var(--fs-xs);font-weight:600}
.journal-ev__text{font-size:var(--fs-sm);line-height:1.45;overflow-wrap:anywhere}
.journal-ev__undo{flex:none;margin-block:-4px 0}
/* older saves: a small undo icon (48 px target) that does not make the row taller */
.journal-ev__undo--icon{margin-block:-12px;color:var(--text-3)}
