/* العمليات (Operations) in the office: the drawings with their parts, the trucks' map, the QR labels. */

/* ---------------------------------------------------------------- the head of an operation */
.op-back { margin: 0 0 8px; }
.op-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; }
.op-head > div { flex: 1 1 320px; min-width: 0; }
.op-head .page-title { line-height: 1.2; margin-bottom: 0; }
.op-head .page-sub { margin: 10px 0 0; }
.op-head .op-close { flex: none; margin-top: 8px; }
.op-closed { margin: 8px 0 0; }
/* «Scan a part» beside «Close the operation». */
.op-head > .op-head-acts { flex: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.op-head .op-head-acts .op-close { margin-top: 0; }

/* The office's own scanner (js/ops.js scanPanel): over the whole screen, the camera above, the steps around it. */
.op-scan { position: fixed; inset: 0; z-index: 110; background: #111110; color: #f1ece0; overflow-y: auto; padding: 14px 16px 28px; }
/* On the dark panel its own buttons are light; the part card keeps the office's buttons. */
.op-scan-h .btn, .op-scan-modes .btn, .op-scan-row .btn { background: transparent; color: #f1ece0; border: 1px solid rgba(241, 236, 224, .5); }
.op-scan-h .btn:hover, .op-scan-modes .btn:hover, .op-scan-row .btn:hover { border-color: #f1ece0; }
.op-scan-modes .btn.primary { background: #f1ece0; color: #111110; border-color: #f1ece0; }
.op-scan-in { max-width: 560px; margin: 0 auto; display: grid; gap: 12px; }
.op-scan-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.op-scan-h h3 { margin: 0; color: #f1ece0; }
.op-scan-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.op-scan label { color: #e9e3cb; }
.op-scan select, .op-scan input[type=text] { width: 100%; min-width: 0; }
.op-scan video { display: block; width: 100%; max-height: 46vh; object-fit: cover; border-radius: 10px; background: #000; outline: 3px solid transparent; transition: outline-color .2s; }
.op-scan.ok video { outline-color: #3d6a33; }
.op-scan.warn video { outline-color: #b8892c; }
.op-scan-msg { margin: 0; min-height: 1.4em; }
.op-scan-row { display: flex; gap: 8px; }
.op-scan-row input { flex: 1 1 auto; }
.op-scan-row .btn { flex: none; }
.op-scan-card { background: #fffdf6; color: #111110; border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; border-inline-start: 4px solid #3d6a33; }
.op-scan-card.warn { border-inline-start-color: #b8892c; }
.op-scan-card.bad { border-inline-start-color: #9a3b2e; }
.op-scan-cr { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.op-scan-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.op-scan-acts:empty { display: none; }
.op-dates { white-space: nowrap; }
.seg.op-tabs { display: flex; width: fit-content; max-width: 100%; margin: 20px 0 18px; }
.op-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 14px 0 16px; }
.op-intro { margin: 0 0 4px; max-width: 760px; line-height: 1.6; }

/* ---------------------------------------------------------------- cards and tables */
.card.op-card { padding: 16px 18px; margin: 0 0 14px; }
.card.op-tcard { padding: 0; margin: 0 0 14px; overflow: hidden; overflow: clip; }
/* A card that clips its corners is no scroller (clip), so a table's head still sticks under the top bar; where clip is
   not known, the head stays at the top of its table rather than float 150 px down over the rows. */
@supports not (overflow: clip) { .op-tcard table.grid th { position: static; } }
/* The office pads a paragraph laid straight in a card; these cards are padded already. */
#view .card.op-card > p, #view .card.op-tcard > p { padding-inline: 0; }
.op-time { white-space: nowrap; }
.op-card > .card-h, .op-tcard > .card-h { flex-wrap: wrap; row-gap: 6px; margin-bottom: 12px; }
.op-tcard > .card-h { padding: 16px 18px 0; }
/* The small pills beside a heading are set like every other pill, not in the heading's serif. */
.op-card .card-h .tag, .op-tcard .card-h .tag { font-family: var(--ui-font, system-ui, sans-serif); font-weight: 500; font-size: 11.5px; letter-spacing: 0; }
.op-card .card-h .op-kind { font-family: var(--ui-font, system-ui, sans-serif); font-weight: 400; font-size: 13px; color: var(--ui-muted); }
.op-card table.grid { background: transparent; }
.op-tbl td.op-acts { white-space: nowrap; }
.op-tbl td.op-acts .btn + .btn { margin-inline-start: 6px; }
.op-serial { white-space: nowrap; font-variant-numeric: tabular-nums; }
.op-plate { white-space: nowrap; unicode-bidi: isolate; }
.op-l { display: none; }

/* ---------------------------------------------------------------- the overview */
/* The tiles share the row's whole width (auto-fit: no empty tracks at the end), and their figures stand on one line
   whether a label takes one line or two. */
.op-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; margin: 0 0 16px; }
.card.op-fig { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; margin: 0; }
.op-fig small { font-size: 12px; color: var(--ui-muted); line-height: 1.3; }
.op-fig b { font-family: var(--ui-font, system-ui, sans-serif); font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; margin-top: auto; }
.op-fig.ok b { color: var(--ui-ok, #3d6a33); }
.op-fig.bad b { color: var(--ui-bad, #9a3b2e); }
.op-fig.zero b { color: var(--ui-muted); }
/* The Arabic zero is a dot: set larger, it reads as a figure. */
[dir=rtl] .op-fig b { font-size: 30px; }
.op-trs { display: grid; }
.op-tr { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px 18px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--ui-line); }
.op-tr:first-child { border-top: 0; padding-top: 2px; }
.op-tr:last-child { padding-bottom: 0; }
.op-tr-n { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.op-tr-n > .op-facts { flex-basis: 100%; }
.op-tr-s { padding-top: 2px; }
.op-dmgs { display: grid; }
.op-dmg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-top: 1px solid var(--ui-line); }
.op-dmg:first-child { border-top: 0; padding-top: 0; }
.op-dmg:last-child { padding-bottom: 0; }
.op-dmg > div { flex: 1 1 260px; min-width: 0; }

/* ---------------------------------------------------------------- pieces and their drawings */
.op-pieces { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 0 0 14px; }
.op-pc-pick { margin: 0; min-width: 0; flex: 0 1 420px; }
.op-pc-pick select { width: 100%; max-width: 100%; }
.op-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.op-tools .seg + .seg { margin: 0; }
.op-placing { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 12px 0 0; }
.op-draw-hint { margin: 10px 0 0; line-height: 1.6; }
.op-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; margin: 16px 0 14px; }
.op-add input[type=text] { flex: 1 1 220px; max-width: 380px; min-width: 0; }
.op-qty { display: inline-flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--ui-muted); margin: 0; }
.op-qty input[type=number] { width: 5.5em; }
.op-parts input[type=text] { width: 100%; min-width: 150px; }
.op-parts select { min-width: 96px; }
.op-on { white-space: nowrap; }
.op-on .btn { margin-inline-start: 6px; }
.op-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 16px; }

/* The drawing is fitted to the frame's width and to --fit-h both (js/ops.js), so at 100% it is seen whole and never scrolls. */
.op-draw { --fit-h: min(75vh, calc(100vh - 140px)); position: relative; max-width: 900px; border-radius: 10px; background: #f1ece0; margin: 14px auto; overflow: auto; max-height: 75vh; -webkit-overflow-scrolling: touch; }
.op-draw.fit { overflow: hidden; }
.op-draw > .empty { padding: 28px 16px; }
.op-zoomwrap { position: relative; margin: 0 auto; container-type: inline-size; }
.op-draw img, .op-zoomwrap img { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
/* The numbers grow and shrink with the drawing, so a phone's small drawing is not hidden under them. */
.op-pin { --pin: clamp(16px, 3cqi, 26px); position: absolute; transform: translate(-50%, -50%); box-sizing: border-box; display: flex; align-items: center; justify-content: center; min-width: var(--pin); height: var(--pin); padding: 0 calc(var(--pin) * .22); border-radius: 999px; background: rgba(17, 17, 16, .9); color: #e9e3cb; font: 600 calc(var(--pin) * .46) / 1 system-ui, sans-serif; font-style: normal; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); pointer-events: none; }
.op-pin.ok { background: rgba(61, 106, 51, .92); color: #fff; }
.op-pin[data-pid] { pointer-events: auto; cursor: pointer; }
/* A finger needs more than the number itself to hit. */
.op-pin[data-pid]::after { content: ''; position: absolute; inset: -9px; border-radius: 999px; }
.op-area { position: absolute; border: 2px solid #111110; background: rgba(189, 183, 151, .22); border-radius: 3px; pointer-events: none; box-sizing: border-box; }
.op-area.ok { border-color: #3d6a33; background: rgba(61, 106, 51, .14); }
.op-area.ghost { border-style: dashed; border-color: #9a3b2e; background: rgba(154, 59, 46, .1); }
.op-zoom a { min-width: 2.2em; text-align: center; }
.op-pick { display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; margin: 8px 0; }
.op-pick-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--ui-line-2, #e3dbc6); border-radius: 8px; cursor: pointer; flex-wrap: wrap; }
.op-pick-row input[type=text] { flex: 1 1 180px; min-width: 0; }
.op-photos { display: inline-flex; gap: 4px; vertical-align: middle; }
.op-photos img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid #ddd; }

/* ---------------------------------------------------------------- trucks */
.op-map { height: 420px; border-radius: 10px; overflow: hidden; background: #e8e2d2; position: relative; z-index: 0; }
.op-map.empty-map { height: auto; min-height: 140px; display: flex; align-items: center; justify-content: center; }
.op-map-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-top: 12px; }
.op-map-note p { margin: 0; flex: 1 1 280px; }
.op-map-off { position: absolute; inset-inline: 12px; bottom: 12px; z-index: 500; background: rgba(255, 253, 248, .94); border: 1px solid var(--ui-line-2); border-radius: 8px; padding: 8px 10px; }
.op-tip { font: 500 12px/1.3 system-ui, sans-serif; }
.op-facts { display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; color: var(--ui-ink-2); }
.op-facts > span:not(:last-child)::after { content: '·'; margin: 0 8px; color: var(--ui-muted); }
/* On the Arabic page «·» beside a figure reads as a zero («١٢ م · ق» as «١٢ م ٠ ق»): the office's «•». */
[dir=rtl] .op-facts > span:not(:last-child)::after { content: '•'; }
.op-status { margin: 8px 0 0; color: var(--ui-ink-2); line-height: 1.6; }
.op-card > .banner { margin: 12px 0 0; }
.op-tacts { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 16px; margin-top: 14px; }
.op-tacts > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.op-steps .btn[disabled] { opacity: 1; cursor: default; }

/* ---------------------------------------------------------------- kit */
.op-give { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 10px; }
.op-give select { flex: 0 1 320px; min-width: 0; }
.op-given { margin-top: 14px; }
.op-given td.op-acts { text-align: end; }

/* ---------------------------------------------------------------- labels */
.op-lb-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 0 0 14px; }
.op-lb-tools .fld { margin: 0; flex: 0 1 280px; min-width: 0; }
.op-lb-tools select { width: 100%; }
.op-lb-tools p { margin: 0; flex: 1 1 260px; }
.op-labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 12px; }
.op-label { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; align-items: center; border: 1px solid #ccc; border-radius: 8px; padding: 8px; background: #fff; color: #111; break-inside: avoid; page-break-inside: avoid; }
/* Every line of a label on one side: the left in English, the right on the Arabic page. */
.op-label > div:last-child { text-align: left; }
[dir=rtl] .op-label > div:last-child { text-align: right; }
.op-label > div:last-child > * { unicode-bidi: plaintext; overflow-wrap: anywhere; }
.op-label b { font-size: 17px; letter-spacing: .02em; }
.op-label .op-lb-code { display: block; white-space: nowrap; }
.op-qr svg { width: 96px; height: 96px; display: block; }
/* Every label carries the House's emblem (the owner, 2026-10-28): under its QR code, so the code and the words keep their room. */
.op-qrcol { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.op-lb-mark { width: 70px; height: auto; display: block; }
@media print { .op-lb-mark { width: 18mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
/* The labels tab (2026-10-28): each label with its tick, whether it was printed, and its own Print button. */
.op-lb-item { display: flex; flex-direction: column; gap: 6px; }
.op-lb-item.printed .op-label { border-color: #b9c9a8; }
.op-lb-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.op-lb-pick { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; cursor: pointer; }
.op-lb-tick { align-self: flex-end; }
.by-printed { margin-inline-start: 4px; }
/* Printing: one label to a 100 × 100 mm label (the House's labels are 10 × 10 cm; the page size is set only while labels print).
   The QR code and its number on the left, the emblem and the words on the right. */
.op-labels-big { display: none; }
@media print {
  #print-root .op-labels-big { display: block; }
  body.lb-big #view .op-labels { display: none !important; }
  /* While labels print, only the labels are on the page: nothing else may take room and add a blank label. */
  html:has(body.lb-big), body.lb-big { margin: 0 !important; padding: 0 !important; min-height: 0 !important; height: auto !important; overflow: visible !important; }
  body.lb-big > :not(#print-root) { display: none !important; }
  body.lb-big #print-root, body.lb-big .op-labels-big { margin: 0 !important; padding: 0 !important; }
  .op-label-big { width: 100mm; height: 99.6mm; break-inside: avoid; page-break-inside: avoid; box-sizing: border-box; padding: 5mm; display: grid; grid-template-columns: 53mm minmax(0, 1fr); gap: 4.5mm; align-items: center; background: #fff; color: #000; break-after: page; page-break-after: always; overflow: hidden; font-family: Helvetica, Arial, sans-serif; }
  .op-label-big:last-child { break-after: auto; page-break-after: auto; }
  .op-label-big .lb-left { display: flex; flex-direction: column; align-items: center; gap: 3mm; }
  .op-label-big .op-qr svg { width: 53mm; height: 53mm; display: block; }
  .op-label-big .op-lb-code { font-size: 5.8mm; letter-spacing: .02em; white-space: nowrap; }
  .op-label-big .lb-right { display: flex; flex-direction: column; align-items: flex-start; gap: 2.2mm; text-align: left; min-width: 0; }
  .op-label-big .lb-right > * { overflow-wrap: anywhere; }
  .op-label-big .op-lb-mark { width: 27mm; margin-bottom: 2mm; }
  .op-label-big .lb-piece { font-size: 4.3mm; font-weight: 600; }
  .op-label-big .lb-piece b { font-size: inherit; }
  .op-label-big .lb-part { font-size: 3.9mm; }
  .op-label-big .lb-side { font-size: 3.5mm; }
  .op-label-big .lb-event { font-size: 2.9mm; color: #333; }
  /* A long name never pushes the side or the event off the label: each line is held to a few rows (audit 2026-10-29). */
  .op-label-big .lb-piece, .op-label-big .lb-part { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
  .op-label-big .lb-side { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; flex-shrink: 0; }
  .op-label-big .lb-event { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  .op-label-big .lb-right { max-height: 89.6mm; overflow: hidden; }
}
@media print {
  body * { visibility: hidden; }
  .op-labels, .op-labels * { visibility: visible; }
  /* The office's own sheets (print-root: the packing list, the slips, the reports) print whatever page they leave from. */
  #print-root, #print-root * { visibility: visible; }
  /* Three labels across the sheet, whatever width the page is laid out at. */
  #print-root .op-labels { position: static; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4mm; padding: 6mm; }
  .op-labels { position: absolute; top: 0; left: 0; right: 0; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .op-label { border: .3mm solid #999; }
  .no-print { display: none !important; }
}

/* ---------------------------------------------------------------- what happened */
.op-log td.op-when { white-space: nowrap; color: var(--ui-ink-2); width: 1%; }
.op-log td.op-who { white-space: nowrap; width: 1%; }
.op-seen { white-space: nowrap; }

/* ---------------------------------------------------------------- a phone: every table a card per row */
@media (max-width: 760px) {
  .op-head .page-title { font-size: 25px; line-height: 1.18; }
  .op-head .page-sub { margin-top: 8px; }
  .op-head .op-close { margin-top: 0; }
  .seg.op-tabs { width: auto; margin: 16px 0 16px; -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%); }
  .card.op-card { padding: 14px 16px; }
  .op-tcard > .card-h { padding: 14px 16px 0; margin-bottom: 4px; }
  .op-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .op-figs > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .card.op-fig { padding: 10px 12px; }

  .card.op-tcard, .card:has(> table.op-tbl) { overflow: hidden; overflow: clip; }
  #view table.grid.op-tbl, #view table.op-tbl > tbody { display: block; width: 100%; min-width: 0; max-width: 100%; overflow: visible; background: transparent; }
  #view table.op-tbl > thead { display: none; }
  #view table.op-tbl > tbody > tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; padding: 12px 16px; border-bottom: 1px solid var(--ui-line); }
  #view table.op-tbl.c2 > tbody > tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #view table.op-tbl > tbody > tr:last-child { border-bottom: 0; }
  #view table.op-tbl > tbody > tr > td { display: block; width: auto; padding: 0; border: 0; min-width: 0; background: transparent; white-space: normal; overflow-wrap: anywhere; }
  #view table.op-tbl > tbody > tr > td.w { grid-column: 1 / -1; }
  #view table.op-tbl > tbody > tr > td:empty { display: none; }
  #view table.op-tbl .op-l { display: block; font-size: 11px; line-height: 1.3; color: var(--ui-muted); margin-bottom: 3px; }
  #view table.op-tbl > tbody > tr > td.op-acts { display: flex; flex-wrap: wrap; gap: 6px; }
  #view table.op-tbl td.op-acts .btn + .btn { margin: 0; }
  #view table.op-tbl .op-serial, #view table.op-tbl .op-dates { white-space: nowrap; overflow-wrap: normal; }
  #view .op-card table.op-tbl > tbody > tr { padding-inline: 0; }

  /* A part: its number and state, its name, its side and truck, its place on the drawing, then what can be done. */
  #view table.op-parts > tbody > tr > td:nth-child(1) { order: 1; align-self: center; font-weight: 600; }
  #view table.op-parts > tbody > tr > td:nth-child(6) { order: 2; justify-self: end; text-align: end; }
  #view table.op-parts > tbody > tr > td:nth-child(2) { order: 3; }
  #view table.op-parts > tbody > tr > td:nth-child(3) { order: 4; }
  #view table.op-parts > tbody > tr > td:nth-child(5) { order: 5; }
  #view table.op-parts > tbody > tr > td:nth-child(4) { order: 6; }
  #view table.op-parts > tbody > tr > td:nth-child(7) { order: 7; }
  .op-parts input[type=text], .op-parts select { width: 100%; min-width: 0; }
  /* What happened: when and who on one line, what below. */
  #view table.op-log > tbody > tr { gap: 4px 12px; }
  #view table.op-log > tbody > tr > td.op-what { order: 3; grid-column: 1 / -1; }
  #view table.op-log > tbody > tr > td.op-who { text-align: end; }
  #view table.op-log > tbody > tr > td.op-when { font-size: 12px; }
  #view table.op-given > tbody > tr > td.op-acts { justify-content: flex-start; }

  .op-map { height: 320px; }
  .op-tacts { justify-content: flex-start; }
  .op-tacts > .op-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .op-add input[type=text] { flex-basis: 100%; max-width: none; }
  .op-give select { flex: 1 1 100%; }
  .op-labels { grid-template-columns: minmax(0, 1fr); }
  .op-draw { max-height: 70vh; --fit-h: min(70vh, calc(100vh - 120px)); }
}

/* ---------------------------------------------------------------- the kit, from the Stores (logistics) */
.op-kit-head .op-facts { margin: 0 0 12px; row-gap: 6px; }
.op-kit-head .op-facts .btn { margin-inline-start: 4px; }
.op-kit-head .op-figs { margin: 0; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.op-bar.op-kit-bar { margin: 0 0 10px; }
.op-bar.op-kit-bar + .op-bar.op-kit-bar { margin-bottom: 16px; }
.op-bar .grow { flex: 1 1 0; }
.op-kit > .card-h { align-items: center; }
.op-kit-n { font-weight: 600; }
.op-kit-q { font-family: var(--ui-font, system-ui, sans-serif); font-size: 14px; font-weight: 600; white-space: nowrap; }
.op-kq { flex-direction: row; align-items: center; gap: 6px; }
.op-kq input[type=number] { width: 5em; padding-block: 4px; }
/* In a card's heading the label and its box are set in the office's own face, as every other «Qty» is, not the heading's serif. */
.card-h .op-kq { font-family: var(--ui-font, system-ui, sans-serif); font-weight: 400; font-size: 11.5px; letter-spacing: 0; }
.card-h .op-kq input[type=number] { font-family: var(--ui-font, system-ui, sans-serif); font-weight: 400; font-size: 14px; }
.op-why { margin: 0 0 12px; line-height: 1.6; color: var(--ui-ink-2); }
.op-why .btn { margin-inline-start: 6px; }
/* «Register it in the Stores» on a line of its own under its reason, flush with it. */
.op-why.op-reg > p { margin: 0 0 8px; }
.op-why.op-reg > .btn { margin: 0; }
div.op-why p { margin: 0 0 6px; line-height: 1.6; }
.op-kpick { max-height: 42vh; min-height: 60px; }
.op-pick-row.off { opacity: .62; cursor: default; }
.op-knew { padding: 8px 10px 2px; border-inline-start: 3px solid var(--ui-gold, #bdb797); margin: 6px 0 4px; }
.op-knew .row { gap: 10px; flex-wrap: wrap; }
.op-knew .row .fld { flex: 1 1 160px; min-width: 0; }
.op-kadd { margin: 12px 0 0; }
.op-kl-lines { flex-basis: 100%; line-height: 1.5; }
table.op-ret input[type=number], table.lg-lines input[type=number] { width: 5.5em; }
table.op-ret tr.off td { opacity: .8; }
.op-ret-n { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }

/* The packing list and the return sheet: A4, English first and the Arabic under it, nothing of money. */
.kit-sheet { width: 210mm; min-height: 297mm; padding: 12mm 13mm; box-sizing: border-box; background: #fff; color: #111; font-family: var(--ui-font, system-ui, sans-serif); font-size: 10.5px; line-height: 1.35; direction: ltr; text-align: left; }
.kit-sheet .ks-a { display: block; font-size: .86em; color: #555; font-weight: 400; direction: rtl; text-align: left; unicode-bidi: plaintext; }
.kit-sheet .ks-e { display: block; }
.ks-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid #111; padding-bottom: 8px; margin-bottom: 10px; }
.ks-head img { height: 44px; }
.ks-house b { font-family: var(--ui-serif, Georgia, serif); font-size: 18px; display: block; }
.ks-title { margin-inline-start: auto; text-align: end; font-family: var(--ui-serif, Georgia, serif); font-size: 21px; font-weight: 700; line-height: 1.15; }
.ks-title .ks-a { font-family: var(--ui-font, system-ui, sans-serif); font-size: 12px; text-align: end; }
.ks-title small { display: block; font-family: 'Courier Prime', ui-monospace, monospace; font-size: 10px; font-weight: 400; letter-spacing: .06em; color: #444; margin-top: 3px; }
.ks-facts { width: 100%; border-collapse: collapse; margin: 0 0 10px; }
.ks-facts th, .ks-facts td { border: 1px solid #bbb; padding: 4px 6px; vertical-align: top; text-align: start; }
.ks-facts th { width: 17%; background: #f2efe6; font-weight: 600; }
.ks-facts td { width: 33%; }
.ks-fill-in { display: inline-block; width: 30mm; border-bottom: 1px solid #111; height: 1.1em; }
.ks-lines { width: 100%; border-collapse: collapse; }
.ks-lines th { background: #111; color: #fff; padding: 4px 5px; text-align: start; font-weight: 600; vertical-align: bottom; }
.ks-lines th .ks-a { color: #ddd; }
.ks-lines td { padding: 5px; border-bottom: 1px solid #ccc; vertical-align: top; }
.ks-lines tr { break-inside: avoid; page-break-inside: avoid; }
.ks-lines .n { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; width: 1%; }
.ks-lines .c { text-align: center; width: 1%; }
.ks-lines td.ltr { white-space: nowrap; direction: ltr; }
.ks-lines .ks-carry { min-width: 38mm; }
.ks-lines td.ks-fill { min-width: 15mm; border: 1px solid #aaa; }
.ks-lines .ks-note { min-width: 30mm; }
.ks-tag { display: block; color: #555; font-size: .86em; }
.ks-box { display: inline-block; width: 4.2mm; height: 4.2mm; border: 1.2px solid #111; border-radius: 1px; vertical-align: middle; }
.ks-lost { margin: 10px 0 0; padding: 6px 8px; border: 1px solid #bbb; }
.ks-lost ul { margin: 4px 0 0; padding-inline-start: 16px; }
.ks-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 12mm; margin-top: 16mm; break-inside: avoid; page-break-inside: avoid; }
.ks-sig > b { display: block; font-size: 11.5px; margin-bottom: 2px; }
.ks-what { font-size: 9.5px; color: #444; margin-bottom: 6px; }
.ks-who { min-height: 2.6em; font-size: 11px; }
.ks-line { border-top: 1px solid #111; padding-top: 3px; margin-top: 10mm; font-size: 9.5px; color: #333; }
.ks-foot { margin-top: 12mm; font-size: 8.5px; color: #555; border-top: 1px solid #ccc; padding-top: 5px; }
@media print { #print-root .kit-sheet { min-height: 0; margin: 0; } }

@media (max-width: 760px) {
  .op-kit-head .op-facts { flex-direction: column; align-items: flex-start; }
  .op-kit-head .op-facts > span:not(:last-child)::after { content: none; }
  .op-kit-head .op-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .op-bar.op-kit-bar .grow { display: none; }
  .op-bar.op-kit-bar > .btn { flex: 1 1 calc(50% - 10px); }
  .op-kit > .card-h .grow { flex-basis: 100%; height: 0; }
  #view table.op-ret > tbody > tr, #modal table.op-ret > tbody > tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #view table.lg-ops > tbody > tr > td.op-acts { justify-content: flex-start; }
}
/* In a window as narrow as a phone, the return form is cards too: one per item, its three numbers side by side. */
@media (max-width: 760px) {
  #modal table.op-ret, #modal table.op-ret > tbody { display: block; width: 100%; }
  #modal table.op-ret > thead { display: none; }
  #modal table.op-ret > tbody > tr { display: grid; gap: 8px 10px; padding: 10px 0; border-bottom: 1px solid var(--ui-line); }
  #modal table.op-ret > tbody > tr > td { display: block; padding: 0; border: 0; min-width: 0; }
  #modal table.op-ret > tbody > tr > td.w { grid-column: 1 / -1; }
  #modal table.op-ret > tbody > tr > td:empty { display: none; }
  #modal table.op-ret .op-l { display: block; font-size: 11px; color: var(--ui-muted); margin-bottom: 3px; }
  #modal table.op-ret input[type=number] { width: 100%; }
}

/* ---------------------------------------------------------------- the review of 2026-10-24 (faults2-ops) */
/* Every operation: the page's own action at the head of the page, as on the other rooms. */
.op-hello { margin-bottom: 16px; }
.op-hello .page-sub { margin-bottom: 0; }
/* The place and the dates under a title: each one piece, the dot going with the dates when the line wraps. */
.op-sub-i { display: inline-block; }
.op-km { white-space: nowrap; }
.op-add .op-pname { flex: 1 1 220px; max-width: 380px; min-width: 0; }
.op-add .op-pname input { width: 100%; }
/* Hand-out tables line up from one card to the next. */
@media (min-width: 761px) {
  table.op-given { table-layout: fixed; width: 100%; }
  table.op-given th:nth-child(1) { width: 34%; }
  table.op-given th:nth-child(2) { width: 10%; }
  table.op-given th:nth-child(3) { width: 20%; }
  table.op-given th:nth-child(4) { width: 14%; }
}
.op-wk { display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 0; color: var(--ui-ink-2); }
/* The box keeps its size when the words wrap. */
.op-wk input { flex: none; }
@media (max-width: 760px) {
  /* The tab row fades only on the side where more tabs are hidden. */
  .seg.op-tabs { -webkit-mask-image: none; mask-image: none; }
  .seg.op-tabs.op-more-end { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 32px); mask-image: linear-gradient(to left, transparent 0, #000 32px); }
  .seg.op-tabs.op-more-start { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 32px); mask-image: linear-gradient(to right, transparent 0, #000 32px); }
  .seg.op-tabs.op-more-start.op-more-end { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%); }
  [dir=rtl] .seg.op-tabs.op-more-end { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 32px); mask-image: linear-gradient(to right, transparent 0, #000 32px); }
  [dir=rtl] .seg.op-tabs.op-more-start { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 32px); mask-image: linear-gradient(to left, transparent 0, #000 32px); }
  /* A truck's four steps: two by two, so no step is ever left alone on a row. */
  .op-tacts > .op-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .op-tacts > .op-steps .btn { width: 100%; justify-content: center; }
  /* A truck's state on the overview: always its own row under the vehicle. */
  .op-tr > .op-tr-s { flex-basis: 100%; }
  /* A toolbar of two buttons a row: the two of a row are one height. */
  .op-bar.op-kit-bar { align-items: stretch; }
  /* Taking someone off the team is a line of its own, on purpose. */
  #view table.op-team td.op-acts .op-off { flex: 1 1 100%; }
  .op-add .op-pname { flex-basis: 100%; max-width: none; }
}

/* ---------------------------------------------------------------- logistics purchasing (public/js/ops-buy.js) */
.by-amt { white-space: nowrap; font-variant-numeric: tabular-nums; }
/* The flow: expected → bought → received → stored → handed out by ID → returned. */
.by-flow { list-style: none; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin: 4px 0 16px; padding: 0; counter-reset: none; }
.by-step { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 10px 0; min-width: 0; }
.by-step::before { content: ''; position: absolute; top: 23px; inset-inline-start: 30px; inset-inline-end: 0; height: 2px; background: var(--ui-line-2, #e3dbc6); }
.by-step:last-child::before { display: none; }
.by-step-n { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 999px; border: 2px solid var(--ui-ink-2, #5c564a); background: var(--ui-cream, #f3ecda); font: 600 12px/1 var(--ui-font, system-ui, sans-serif); color: var(--ui-ink-2); }
.by-step.done .by-step-n { background: var(--ui-ink, #111110); border-color: var(--ui-ink, #111110); color: #f4eee0; }
.by-step.done::before { background: var(--ui-ink-2, #5c564a); }
.by-step b { font-family: var(--ui-font, system-ui, sans-serif); font-size: 13.5px; font-weight: 600; line-height: 1.3; margin-top: 4px; }
.by-step small { font-size: 12px; color: var(--ui-muted); line-height: 1.35; }
.by-mfigs { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.by-mfigs .op-fig b { font-size: 19px; }
[dir=rtl] .by-mfigs .op-fig b { font-size: 19px; }
.by-note { margin: -8px 0 14px; }
.by-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; }
.by-tools input[type=search] { flex: 1 1 240px; max-width: 360px; min-width: 0; }
.by-tools select { flex: 0 1 280px; min-width: 0; }
/* One line of the list: its name and state, its figures, its purchases, what can be done. */
.card.by-line { padding: 14px 18px; }
.by-line > .card-h { align-items: center; margin-bottom: 8px; }
.by-no { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: var(--ui-cream, #f3ecda); font: 600 12px/1 var(--ui-font, system-ui, sans-serif); color: var(--ui-ink-2); }
.by-name { font-weight: 600; }
.by-notes { margin: 0 0 8px; color: var(--ui-ink-2); }
.by-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 18px; margin: 0; }
.by-facts > div { min-width: 0; }
.by-facts dt { font-size: 11.5px; color: var(--ui-muted); margin: 0 0 2px; }
.by-facts dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.by-codes { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 2px; }
.by-buys { display: grid; gap: 8px; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--ui-line); }
.by-buy { display: grid; gap: 3px; padding-inline-start: 12px; border-inline-start: 3px solid var(--ui-line-2, #e3dbc6); line-height: 1.55; }
.by-got { margin: 2px 0 0; padding-inline-start: 18px; font-size: 13px; }
.by-got li { margin: 2px 0; }
.by-got .btn { margin-inline-start: 6px; }
.by-bacts, .by-acts { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.by-bacts { margin-top: 4px; }
.by-acts { margin-top: 12px; }
.by-check { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: nowrap; }
.by-check input { flex: none; }
.by-live { min-height: 1.4em; margin: 0 0 8px; }
.by-sups { max-height: 30vh; }
.by-prev { max-height: 42vh; overflow: auto; margin: 10px 0; border: 1px solid var(--ui-line); border-radius: 8px; }
.by-prev table.grid { margin: 0; }
.by-mode { margin-top: 10px; }
.by-mode .row { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0; }
.by-room { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.by-room select { flex: 1 1 200px; min-width: 0; }
table.by-ho { width: 100%; }
table.by-ho input[type=text] { width: 100%; min-width: 0; }
table.by-ho input[type=number] { width: 5em; }
table.by-ho tr.by-ho-h td { background: var(--ui-cream, #f3ecda); font-size: 12px; font-weight: 600; color: var(--ui-ink-2); padding-block: 5px; }
.by-opsec { margin: 0 0 22px; }
.by-oph { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 0 0 10px; }
.by-oph .section-h { margin: 0; }
.op-label.by-label > div:last-child { text-align: left; }
.by-sheet .ks-sigcell { min-width: 24mm; }
.by-sheet .ks-lines td { font-size: 10px; }
@media (max-width: 760px) {
  .by-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
  .by-step { padding: 8px 6px 8px 0; }
  .by-step::before { display: none; }
  .card.by-line { padding: 12px 14px; }
  .by-line > .card-h .grow { flex-basis: 100%; height: 0; }
  .by-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .by-tools input[type=search], .by-tools select { flex-basis: 100%; max-width: none; }
  .by-acts > .btn { flex: 1 1 calc(50% - 8px); }
  #modal table.by-ho, #modal table.by-ho > tbody { display: block; width: 100%; }
  #modal table.by-ho > thead { display: none; }
  #modal table.by-ho > tbody > tr { display: grid; grid-template-columns: minmax(0, 1fr) 5em; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid var(--ui-line); }
  #modal table.by-ho > tbody > tr > td { display: block; padding: 0; border: 0; min-width: 0; }
  #modal table.by-ho > tbody > tr > td.w { grid-column: 1 / -1; }
  #modal table.by-ho tr.by-ho-h { display: block; padding: 0; border: 0; }
  #modal table.by-ho tr.by-ho-h td { display: block; padding: 5px 8px; }
}
.by-sum { margin: 10px 0 0; color: var(--ui-ink-2); line-height: 1.6; }
.by-label .by-lbn { font-size: 13px; }
table.by-ho .by-ho-new { flex-wrap: nowrap; width: 100%; }
table.by-ho .by-ho-new input[type=text] { flex: 1 1 auto; }
/* The hand-out sheet's nine columns fit the A4 page: fixed shares that add up to the page, every cell wrapping inside
   its own, so the signature column is never cut off at the right margin (audit 2026-10-29). */
.by-sheet .ks-lines { table-layout: fixed; width: 100%; }
.by-sheet .ks-lines th, .by-sheet .ks-lines td { min-width: 0; overflow-wrap: anywhere; }
.by-sheet .ks-lines td.ltr { white-space: normal; }
.by-sheet .ks-lines .n { width: auto; }
.by-sheet .ks-lines .ks-sigcell { min-width: 0; }
.by-sheet .ks-lines .ks-fill-in { width: 100%; max-width: 18mm; }
.by-sheet .ks-lines col.c1 { width: 4%; } .by-sheet .ks-lines col.c2 { width: 17%; } .by-sheet .ks-lines col.c3 { width: 9%; }
.by-sheet .ks-lines col.c4 { width: 5%; } .by-sheet .ks-lines col.c5 { width: 15%; } .by-sheet .ks-lines col.c6 { width: 13%; }
.by-sheet .ks-lines col.c7 { width: 10%; } .by-sheet .ks-lines col.c8 { width: 12%; } .by-sheet .ks-lines col.c9 { width: 15%; }
/* The part's name in its labelled box: as tall as any field (in a column box a flex basis is a height). */
.op-add .op-pname input[type=text] { flex: none; width: 100%; max-width: none; }
/* Arabic is never letter-spaced: spaced, the heads lost their hamza («امام او خلف» for «أمام أو خلف»). */
[dir=rtl] :is(table.op-tbl, table.op-ret, table.by-ho, .by-prev table, .lg-lines, .lg-ops) th { letter-spacing: 0; }
/* A label reads left to right whoever prints it, on whichever screen. */
.op-labels .op-label[dir=ltr] > div:last-child { text-align: left; }
/* A choice's words stay beside its button on a phone, wrapping within themselves. */
#modal .op-pick-row > input[type=radio] + b { flex: 1 1 0; min-width: 0; }

/* ---------------------------------------------------------------- the review of 2026-10-24, third round (faults3-ops) */
/* The place and the dates under a title: two units; the separator goes before the dates and is clipped off whenever the
   dates start a line of their own, so no line ever starts with «·» (on the Arabic page «•», which never reads as «٠»). */
.page-sub.op-subp { overflow: hidden; }
.op-subp > .op-subline { display: flex; flex-wrap: wrap; margin-inline-start: -22px; }
.op-subline > .op-sub-i { position: relative; margin-inline-start: 22px; }
.op-subline > .op-sub-i + .op-sub-i::before { content: '·'; position: absolute; inset-inline-start: -14px; color: var(--ui-muted); }
[dir=rtl] .op-subline > .op-sub-i + .op-sub-i::before { content: '•'; }
/* «(Excel or CSV)» is one piece on a button that wraps. */
.by-nw { white-space: nowrap; }
/*
 * (audit 2026-10-29, the event-days simulation) On a phone the overview gives each piece one line, «installed 3 of 5»,
 * first; the table of seven counts per piece is for the wider screen (every count is on the pieces' own tab).
 */
.op-pc-compact { display: none; }
.op-pcs { display: grid; gap: 6px; }
.op-pc { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; text-align: start; background: none; border: 1px solid var(--line, #e3ddcc); border-radius: 10px; padding: 8px 10px; font: inherit; color: inherit; cursor: pointer; }
@media (max-width: 760px) {
  .op-pc-compact { display: block; }
  .op-pc-full { display: none; }
}
/* A position older than half an hour reads as old. */
.op-stale { opacity: .6; }
