/* The counter (UI-2) and the shared pickers, on the tokens of application.css. */

.panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.panel--narrow { max-width: 480px; }

.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.95em; letter-spacing: 0.04em; }
.input--num { max-width: 120px; text-align: right; font-variant-numeric: tabular-nums; }
.input--area { height: auto; padding: 10px 14px; resize: vertical; }
.list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.list li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.list .num { margin-left: auto; }

/* Key figures: a definition list of label / value rows. */
.figures { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.figures div { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.figures dt { color: var(--ink-muted); font-size: 13px; }
.figures dd { margin: 0; }
.figures__total { padding-top: 6px; border-top: 1px solid var(--line); font-weight: 600; font-size: 16px; }
.figures__cost dd { color: var(--warn-ink); }
.figures--inline { flex-direction: row; flex-wrap: wrap; gap: 8px 24px; }
.figures--inline div { flex-direction: column; align-items: flex-start; gap: 0; }
.is-short { color: var(--err-ink); }
.is-over { color: var(--ok-ink); }

/* The scan box: a wide code field, a narrow quantity and the button. */
.scanbox { display: flex; gap: 8px; margin: 0; }
.scanbox__input { flex: 1 1 auto; font-size: 16px; }
.scanbox__qty { flex: 0 0 72px; text-align: right; }

/* Counter home: scan on the left, the drawer on the right. */
.counter-home { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 20px; }
.counter-home__draft { padding: 10px 14px; border-radius: var(--radius); background: var(--info-bg); color: var(--info-ink); }

/* A sale: the lines on the left, customer and payment on the right. */
.sale { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 20px; align-items: start; }
.sale--new { grid-template-columns: minmax(0, 560px); }
.sale__main, .sale__side, .draft { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lines td { vertical-align: middle; }
.lines__actions { white-space: nowrap; }
.lines__actions form { display: inline-block; margin: 0 4px 0 0; }
.lines__actions .btn { height: 32px; padding: 0 10px; font-size: 13px; }
.totals .figures { max-width: 360px; margin-left: auto; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.split__item { display: flex; flex-direction: column; gap: 4px; }
.split__item .input--num { max-width: none; }

/* An issued document. */
.document { display: flex; flex-direction: column; gap: 16px; }
.document__title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.document__title h2 { font-size: 18px; }
.document__foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.void__form { display: flex; gap: 8px; max-width: 560px; margin: 0; }
.badge--draft { background: var(--warn-bg); color: var(--warn-ink); }
.badge--issued, .badge--open, .badge--unit-in_stock { background: var(--ok-bg); color: var(--ok-ink); }
.badge--voided, .badge--unit-lost, .badge--unit-scrapped { background: var(--err-bg); color: var(--err-ink); }
.badge--closed, .badge--unit-sold { background: var(--info-bg); color: var(--info-ink); }

/* Cash session. */
.session { display: flex; flex-direction: column; gap: 16px; }
.session__figures { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 16px; align-items: start; }
.takings tfoot th { border-top: 1px solid var(--line); border-bottom: 0; color: var(--ink); font-size: 14px; }

/* Labels. */
.labels { display: flex; flex-direction: column; gap: 16px; }
.labels__text { height: auto; min-height: 96px; padding: 8px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.labels__filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.labels__filters .field { flex: 0 1 220px; min-width: 140px; }
.labels__table td { vertical-align: top; }
.labels__table summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.labels__copies { max-width: 80px; }
.labels__count { margin: 12px 0; }
.labels__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tspl { margin: 6px 0 0; padding: 10px 12px; border-radius: var(--radius); background: var(--bg-muted); font-size: 12px; overflow-x: auto; }

/* Pickers: a Turbo Frame with a search box, the results and the choice. */
.picker { display: block; }
.picker__search { display: flex; gap: 8px; margin: 0; }
.picker__results { margin: 6px 0 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.picker__result {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--control-h);
  padding: 8px 12px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-soft);
}
.picker__results li:last-child .picker__result { border-bottom: 0; }
.picker__result:hover { background: var(--bg-muted); color: var(--ink); }
.picker__empty { padding: 8px 12px; }
.picker__choice {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: var(--control-h);
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-muted);
}
.picker__change { font-size: 13px; white-space: nowrap; }

@media (max-width: 900px) {
  .counter-home, .sale, .document__foot, .session__figures { grid-template-columns: minmax(0, 1fr); }
}

/* The printable receipt (counter/invoices/print, rendered without the shell). */
.print { max-width: 720px; margin: 0 auto; padding: 24px; font-family: var(--font); color: var(--ink); }
.print__head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.print__head h1 { font-size: 18px; }
.print__void { color: var(--err-ink); font-weight: 700; }
.print__party { padding: 12px 0; }
.print__lines { margin: 12px 0; }
.print__totals { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; margin: 0; }
.print__totals div { display: flex; gap: 24px; }
.print__totals dd { margin: 0; min-width: 120px; text-align: right; font-variant-numeric: tabular-nums; }
.print__grand { font-weight: 700; font-size: 16px; }
.print__notes { margin-top: 16px; color: var(--ink-muted); }
@media print {
  .print { padding: 0; max-width: none; }
}
