/* ADIB POS back office. Built on tokens.css (shared with the till). Prefix: bo-.
   One family (Geist), calm neutral ground with white panels, ink for structure, signal red only for the main
   action of a screen and for problems. Figures: tabular only in number columns. */

/* ------------------------------------------------------------------ base */
:where(.bo-body) :where(*, *::before, *::after) { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
.bo-body {
  margin: 0;
  min-height: 100vh;
  background: var(--c-canvas);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:where(.bo-body) :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure) { margin: 0; }
:where(.bo-body) :where(ul, ol) { padding: 0; list-style: none; }
:where(.bo-body) :where(a) { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:where(.bo-body) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.bo-body) :where(img, svg) { display: block; max-width: 100%; }
.bo-body ::selection { background: var(--c-selection); }
.bo-body [hidden] { display: none !important; }
.bo-body :focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; border-radius: var(--r-sm); }
.bo-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.bo-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; white-space: nowrap; }
.bo-mono { font-family: var(--font-mono); font-size: 0.92em; letter-spacing: 0; }
.bo-muted { color: var(--c-text-2); }
.bo-hint { color: var(--c-text-3); font-size: var(--fs-xs); }
.bo-nowrap { white-space: nowrap; }
.bo-plain { max-width: 40rem; margin: 4rem auto; padding: 0 16px; }
.bo-body svg.bo-ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ buttons */
.bo-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  border: 0; border-radius: var(--r-md);
  background: var(--c-panel-2); color: var(--c-text);
  font-weight: var(--fw-medium); font-size: var(--fs-sm); line-height: 1.2;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.bo-btn:active { transform: translateY(1px); }
.bo-btn--primary { background: var(--c-primary); color: var(--c-on-primary); }
.bo-btn--strong { background: var(--c-strong); color: var(--c-on-strong); }
.bo-btn--quiet { background: var(--c-panel-2); }
.bo-btn--ghost { background: transparent; padding: 0 10px; }
.bo-btn--danger { background: var(--c-alert-bg); color: var(--c-alert-text); }
.bo-btn--sm { min-height: 32px; padding: 0 12px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.bo-btn--block { width: 100%; }
.bo-btn--icon { padding: 0; width: 40px; }
.bo-btn[disabled], .bo-btn[aria-disabled="true"] { background: var(--c-disabled-bg); color: var(--c-disabled-text); cursor: not-allowed; transform: none; }
@media (hover: hover) {
  .bo-btn:hover { background: var(--c-panel-3); }
  .bo-btn--primary:hover { background: var(--c-primary-hover); }
  .bo-btn--strong:hover { background: var(--c-strong-hover); }
  .bo-btn--ghost:hover { background: var(--c-panel-2); }
  .bo-btn--danger:hover { background: #FADBD9; }
  .bo-btn[disabled]:hover { background: var(--c-disabled-bg); }
}
.bo-btn .bo-spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: bo-spin 0.7s linear infinite; }
@keyframes bo-spin { to { transform: rotate(360deg); } }
.bo-link { background: none; border: 0; padding: 0; color: var(--c-text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; }

/* ------------------------------------------------------------------ form controls */
.bo-field { display: grid; gap: 6px; min-width: 0; }
.bo-label { font-weight: var(--fw-medium); font-size: var(--fs-xs); color: var(--c-text-2); }
.bo-input, .bo-select, .bo-textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--c-line-strong); border-radius: var(--r-md);
  background-color: var(--c-panel); color: var(--c-text);
  font-size: var(--fs-sm); line-height: 1.35;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.bo-textarea { min-height: 84px; resize: vertical; }
.bo-select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2352524C' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px;
}
.bo-input:focus, .bo-select:focus, .bo-textarea:focus { outline: none; border-color: var(--c-text); box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.08); }
.bo-input[aria-invalid="true"], .bo-select[aria-invalid="true"] { border-color: var(--c-alert); box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.1); }
.bo-input::placeholder { color: var(--c-text-3); }
.bo-input[readonly] { background: var(--c-panel-2); }
.bo-field__err { color: var(--c-alert-text); font-size: var(--fs-xs); }
.bo-field__help { color: var(--c-text-3); font-size: var(--fs-xs); }
.bo-affix { display: flex; align-items: stretch; }
.bo-affix > span { display: inline-flex; align-items: center; padding: 0 12px; background: var(--c-panel-2); border: 1px solid var(--c-line-strong); color: var(--c-text-2); font-size: var(--fs-sm); }
.bo-affix > span:first-child { border-right: 0; border-radius: var(--r-md) 0 0 var(--r-md); }
.bo-affix > span:last-child { border-left: 0; border-radius: 0 var(--r-md) var(--r-md) 0; }
.bo-affix > .bo-input { border-radius: 0; flex: 1; min-width: 0; }
.bo-affix > .bo-input:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.bo-affix > .bo-input:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.bo-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; line-height: 1.4; }
.bo-check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--c-strong); flex: none; }
.bo-checks { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-panel); }
.bo-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.bo-switch input { appearance: none; -webkit-appearance: none; width: 40px; height: 24px; border-radius: var(--r-pill); background: var(--c-line-strong); position: relative; flex: none; cursor: pointer; transition: background var(--dur) var(--ease-out); margin: 0; }
.bo-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform var(--dur) var(--ease-out); }
.bo-switch input:checked { background: var(--c-strong); }
.bo-switch input:checked::after { transform: translateX(16px); }
.bo-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bo-form { display: grid; gap: 18px; }
.bo-form__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bo-form__actions .bo-spacer { flex: 1; }
.bo-fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 12px; min-width: 0; }
.bo-fieldset > legend { padding: 0; margin-bottom: 4px; font-weight: var(--fw-semibold); font-size: var(--fs-sm); }

/* ------------------------------------------------------------------ app shell */
.bo-app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.bo-side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px 16px; border-right: 1px solid var(--c-line); background: var(--c-panel-2);
}
.bo-side__brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 18px; text-decoration: none; }
.bo-side__brand img { width: 112px; height: auto; }
.bo-side__brand span { font-weight: var(--fw-medium); font-size: var(--fs-xs); color: var(--c-text-2); border-left: 1px solid var(--c-line-strong); padding-left: 10px; line-height: 1.2; }
.bo-nav { display: grid; gap: 2px; }
.bo-nav__group { margin: 14px 10px 4px; font-size: var(--fs-xs); color: var(--c-text-3); font-weight: var(--fw-medium); }
.bo-nav a, .bo-nav button.bo-nav__item {
  display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px;
  border: 0; border-radius: var(--r-md); background: none; width: 100%; text-align: left;
  color: var(--c-text-2); font-weight: var(--fw-medium); text-decoration: none; cursor: pointer;
}
.bo-nav a[aria-current="page"] { background: var(--c-panel); color: var(--c-text); box-shadow: var(--shadow-1); }
@media (hover: hover) { .bo-nav a:hover { color: var(--c-text); background: rgba(255, 255, 255, 0.6); } .bo-nav a[aria-current="page"]:hover { background: var(--c-panel); } }
.bo-side__foot { margin-top: auto; padding-top: 16px; display: grid; gap: 2px; }
.bo-me { display: grid; gap: 2px; padding: 10px; border-radius: var(--r-md); text-decoration: none; }
.bo-me strong { font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bo-me span { font-size: var(--fs-xs); color: var(--c-text-2); }
@media (hover: hover) { .bo-me:hover { background: rgba(255, 255, 255, 0.6); } }
.bo-demo { margin: 0 10px 10px; padding: 6px 10px; border-radius: var(--r-sm); background: var(--c-notice-bg); color: var(--c-notice-text); font-size: var(--fs-xs); }

.bo-main { min-width: 0; padding: 28px 32px 64px; }
.bo-page { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.bo-stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.bo-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; }
.bo-head__text { display: grid; gap: 4px; min-width: 0; }
.bo-head h1 { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); line-height: var(--lh-tight); overflow-wrap: anywhere; }
.bo-head p { color: var(--c-text-2); }
.bo-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bo-back { display: inline-flex; align-items: center; gap: 6px; color: var(--c-text-2); text-decoration: none; font-weight: var(--fw-medium); font-size: var(--fs-xs); margin-bottom: 4px; }
@media (hover: hover) { .bo-back:hover { color: var(--c-text); } }

.bo-topbar { display: none; }
.bo-tabbar { display: none; }

/* ------------------------------------------------------------------ panels, tabs, sections */
.bo-panel { background: var(--c-panel); border: 1px solid var(--c-line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); min-width: 0; }
.bo-panel__pad { padding: 20px; }
.bo-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--c-line); }
.bo-panel__head h2 { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.bo-section-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.bo-tabs { display: inline-flex; flex-wrap: nowrap; gap: 2px; padding: 4px; background: var(--c-panel-2); border-radius: var(--r-lg); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.bo-tabs::-webkit-scrollbar { display: none; }
.bo-tabs a { flex: none; display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: var(--r-md); color: var(--c-text-2); text-decoration: none; font-weight: var(--fw-medium); white-space: nowrap; }
.bo-tabs a[aria-current="page"] { background: var(--c-panel); color: var(--c-text); box-shadow: var(--shadow-1); }
@media (hover: hover) { .bo-tabs a:hover { color: var(--c-text); } }
.bo-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.bo-cols--side { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

/* ------------------------------------------------------------------ list toolbar */
.bo-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bo-search { position: relative; flex: 1 1 240px; max-width: 360px; min-width: 0; }
.bo-search .bo-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--c-text-3); pointer-events: none; }
.bo-search .bo-input { padding-left: 38px; }
.bo-toolbar__end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.bo-sortpick { display: none; }
.bo-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--c-strong); color: #fff; font-size: 12px; font-weight: var(--fw-semibold); }
.bo-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; padding: 16px; background: var(--c-panel); border: 1px solid var(--c-line); border-radius: var(--r-lg); }
.bo-filters__foot { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.bo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bo-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 6px 0 12px; border: 0; border-radius: var(--r-pill); background: var(--c-panel-3); font-size: var(--fs-xs); font-weight: var(--fw-medium); cursor: pointer; max-width: 100%; }
.bo-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bo-chip .bo-ico { width: 14px; height: 14px; }
@media (hover: hover) { .bo-chip:hover { background: var(--c-line-strong); } }

/* ------------------------------------------------------------------ tables */
.bo-tablewrap { overflow-x: auto; }
.bo-table { width: 100%; border-collapse: collapse; }
.bo-table th, .bo-table td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--c-line); }
.bo-table thead th { padding-top: 12px; padding-bottom: 10px; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--c-text-2); white-space: nowrap; background: var(--c-panel); }
.bo-table tbody tr:last-child td { border-bottom: 0; }
.bo-table .r { text-align: right; }
.bo-table td.r { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; white-space: nowrap; }
.bo-table tr[data-href] { cursor: pointer; }
.bo-table tr[data-href]:focus-visible { outline: 2px solid var(--c-focus); outline-offset: -2px; }
@media (hover: hover) { .bo-table tr[data-href]:hover td { background: #FAFAF8; } }
.bo-table td .bo-strong, .bo-strong { font-weight: var(--fw-medium); }
.bo-table td a.bo-rowlink { text-decoration: none; font-weight: var(--fw-medium); overflow-wrap: anywhere; }
.bo-table .bo-sub { display: block; color: var(--c-text-2); font-size: var(--fs-xs); margin-top: 2px; overflow-wrap: anywhere; }
.bo-sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: inherit; }
.bo-sort .bo-ico { width: 14px; height: 14px; opacity: 0.35; }
.bo-sort[aria-pressed="true"] { color: var(--c-text); }
.bo-sort[aria-pressed="true"] .bo-ico { opacity: 1; }
.bo-table tfoot td { font-weight: var(--fw-semibold); border-top: 1px solid var(--c-line-strong); border-bottom: 0; }
.bo-row--off td { color: var(--c-text-3); }
.bo-strike { text-decoration: line-through; text-decoration-thickness: 1px; }
.bo-ph-label { display: none; }
.bo-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--c-line); color: var(--c-text-2); font-size: var(--fs-xs); }
.bo-pager__btns { display: flex; gap: 6px; }

/* status: dot + words, never a pill on every row */
.bo-status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.bo-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c-text); flex: none; }
.bo-status--off::before { background: var(--c-line-strong); }
.bo-status--off { color: var(--c-text-2); }
.bo-status--alert::before { background: var(--c-alert); }
.bo-status--alert { color: var(--c-alert-text); }
.bo-status--wait::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c-text-2); }
.bo-mark { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: var(--r-sm); background: var(--c-notice-bg); color: var(--c-notice-text); font-size: 12px; font-weight: var(--fw-medium); white-space: nowrap; vertical-align: 1px; }
.bo-mark--alert { background: var(--c-alert-bg); color: var(--c-alert-text); }
.bo-mark--plain { background: var(--c-panel-2); color: var(--c-text-2); }
.bo-diff--neg { color: var(--c-alert-text); }

/* ------------------------------------------------------------------ states */
.bo-empty { display: grid; justify-items: center; gap: 8px; padding: 48px 24px; text-align: center; }
.bo-empty .bo-ico { width: 28px; height: 28px; color: var(--c-text-3); margin-bottom: 4px; }
.bo-empty h2, .bo-empty h3 { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.bo-empty p { color: var(--c-text-2); max-width: 44ch; }
.bo-empty .bo-btn { margin-top: 8px; }
.bo-alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-md); background: var(--c-alert-bg); color: var(--c-alert-text); }
.bo-alert .bo-ico { margin-top: 2px; }
.bo-note { padding: 12px 16px; border-radius: var(--r-md); background: var(--c-notice-bg); color: var(--c-notice-text); }
.bo-skel { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--c-panel-2) 0%, #F6F6F4 50%, var(--c-panel-2) 100%); background-size: 200% 100%; animation: bo-shimmer 1.4s ease-in-out infinite; }
@keyframes bo-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .bo-skel { animation: none; } }
.bo-boot { min-height: 100vh; }

/* ------------------------------------------------------------------ figures and chart */
/* figure grid: hairlines drawn by each cell (right + bottom), the outer edge clipped by the wrapper */
.bo-figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); overflow: hidden; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.bo-fig { display: grid; gap: 4px; align-content: start; padding: 18px 20px; min-width: 0; box-shadow: 1px 0 0 var(--c-line), 0 1px 0 var(--c-line); margin: 0 -1px -1px 0; }
.bo-fig__label { color: var(--c-text-2); font-size: var(--fs-xs); font-weight: var(--fw-medium); overflow-wrap: anywhere; }
.bo-fig__value { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); line-height: 1.15; overflow-wrap: anywhere; }
.bo-fig__sub { color: var(--c-text-2); font-size: var(--fs-xs); }
.bo-hero { display: grid; gap: 6px; padding: 20px; }
.bo-hero__value { font-size: 3rem; font-weight: var(--fw-semibold); letter-spacing: -0.02em; line-height: 1; overflow-wrap: anywhere; }
.bo-dl { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 10px 24px; }
.bo-dl dt { color: var(--c-text-2); }
.bo-dl dd { overflow-wrap: anywhere; }
.bo-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px 24px; }
.bo-kv > div { display: grid; gap: 2px; min-width: 0; }
.bo-kv dt, .bo-kv .k { color: var(--c-text-2); font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.bo-kv dd, .bo-kv .v { font-weight: var(--fw-medium); overflow-wrap: anywhere; }

.bo-chart { position: relative; padding: 8px 20px 16px; }
.bo-chart svg { max-width: 100%; height: auto; overflow: visible; }
.bo-chart .grid { stroke: var(--c-line); stroke-width: 1; shape-rendering: crispEdges; }
.bo-chart .axis { fill: var(--c-text-3); font-size: 12px; font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.bo-chart .bar { fill: var(--c-strong); }
.bo-chart .bar--today { fill: var(--c-primary); }
.bo-chart .bar--zero { fill: var(--c-line-strong); }
.bo-chart .hit { fill: transparent; cursor: default; }
.bo-chart .hit:hover + .bar, .bo-chart .bar.is-on { opacity: 0.82; }
.bo-tip { position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 10px)); padding: 8px 10px; border-radius: var(--r-md); background: var(--c-ink-panel); color: #fff; font-size: var(--fs-xs); line-height: 1.35; white-space: nowrap; box-shadow: var(--shadow-2); z-index: 2; }
.bo-tip strong { display: block; font-weight: var(--fw-semibold); font-size: var(--fs-sm); }
.bo-legend-note { display: flex; gap: 16px; flex-wrap: wrap; color: var(--c-text-2); font-size: var(--fs-xs); padding: 0 20px 14px; }
.bo-legend-note i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c-strong); }
.bo-legend-note i.today { background: var(--c-primary); }
.bo-bars { display: grid; gap: 10px; }
.bo-hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.bo-hbar__track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--c-panel-2); overflow: hidden; }
.bo-hbar__fill { height: 100%; border-radius: 4px; background: var(--c-strong); }

/* Needs a look */
.bo-looks { display: grid; }
.bo-look { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px 20px; border-top: 1px solid var(--c-line); text-decoration: none; }
.bo-look:first-child { border-top: 0; }
.bo-look__dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--c-alert); }
.bo-look__dot--calm { background: var(--c-text-3); }
.bo-look__text { overflow-wrap: anywhere; }
.bo-look__when { color: var(--c-text-3); font-size: var(--fs-xs); white-space: nowrap; margin-top: 2px; }
@media (hover: hover) { a.bo-look:hover { background: #FAFAF8; } }

/* sale lines */
.bo-line-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--c-text-2); font-size: var(--fs-xs); margin-top: 3px; }
.bo-totals { display: grid; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--c-line); }
.bo-totals > div { display: flex; justify-content: space-between; gap: 16px; }
.bo-totals .big { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.bo-weighings { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; color: var(--c-text-2); font-size: var(--fs-xs); }

/* mix editor */
.bo-mix { display: grid; gap: 8px; }
.bo-mix__row { display: grid; grid-template-columns: minmax(0, 1fr) 120px 40px; gap: 8px; align-items: center; }
.bo-mix__sum { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--c-panel-2); font-weight: var(--fw-medium); }
.bo-mix__sum--bad { background: var(--c-alert-bg); color: var(--c-alert-text); }

/* buying (1.3.0): order and receive line editors, low bar, record meta */
.bo-lines { display: grid; }
.bo-lines__row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(130px, 1fr) minmax(160px, 1.1fr) minmax(96px, 0.7fr) 40px; gap: 10px 12px; align-items: start; padding: 12px 20px; border-bottom: 1px solid var(--c-line); }
.bo-lines__head { padding-top: 10px; padding-bottom: 8px; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--c-text-2); }
.bo-lines__head .r, .bo-lines__total { text-align: right; }
.bo-lines__item { display: grid; gap: 4px; min-width: 0; }
.bo-lines__item .bo-strong { overflow-wrap: anywhere; }
.bo-lines__item .bo-sub { color: var(--c-text-2); font-size: var(--fs-xs); }
.bo-lines__total { padding-top: 10px; white-space: nowrap; }
.bo-lines__label { display: none; }
.bo-lines .bo-affix > span { padding: 0 10px; white-space: nowrap; }
.bo-po-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.bo-grv-meta { display: grid; gap: 4px; color: var(--c-text-2); }
.bo-grv-meta a { color: var(--c-text); font-weight: var(--fw-medium); }
.bo-lowbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 12px 16px; border-radius: var(--r-md); background: var(--c-panel); border: 1px solid var(--c-line); }
.bo-stockvalue { padding: 0 2px; }
.bo-row--low td.ph-main a { color: var(--c-text); }
.bo-fold { margin-top: 4px; color: var(--c-text-2); font-size: var(--fs-xs); }
.bo-fold summary { cursor: pointer; }
.bo-checklist { display: grid; border: 1px solid var(--c-line); border-radius: var(--r-md); background: var(--c-panel); }
.bo-checklist__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 14px; border-top: 1px solid var(--c-line); }
.bo-checklist__row:first-child { border-top: 0; }
.bo-checklist__row > :nth-child(3) { grid-column: 1 / -1; font-size: var(--fs-xs); }
.bo-checklist__row .bo-strong { overflow-wrap: anywhere; }
.bo-lowrow { display: grid; grid-template-columns: minmax(0, 1fr) 90px 90px 90px; gap: 8px; align-items: center; }
.bo-lowrow--head { font-size: var(--fs-xs); color: var(--c-text-2); font-weight: var(--fw-medium); }
.bo-lowrow .r { text-align: right; }
.bo-lowrow .bo-check span { overflow-wrap: anywhere; }
.bo-printbar { display: flex; align-items: center; gap: 12px; }
.bo-printbar .bo-spacer { flex: 1; }

/* printable order / GRV (A4) */
.bo-doc { background: #fff; border: 1px solid var(--c-line); border-radius: var(--r-lg); padding: 40px 44px; display: grid; gap: 24px; max-width: 840px; width: 100%; margin: 0 auto; color: var(--c-text); }
.bo-doc h1 { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); }
.bo-doc h2 { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--c-text-2); margin-bottom: 4px; }
.bo-doc__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; padding-bottom: 20px; border-bottom: 2px solid var(--c-text); }
.bo-doc__biz { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.bo-doc__pre { white-space: pre-line; }
.bo-doc__title { text-align: right; }
.bo-doc__no { font-size: var(--fs-lg); font-weight: var(--fw-medium); }
.bo-doc__parties { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.bo-doc__parties p { overflow-wrap: anywhere; }
.bo-doc__table { width: 100%; border-collapse: collapse; }
.bo-doc__table th, .bo-doc__table td { padding: 9px 8px; border-bottom: 1px solid var(--c-line); text-align: left; vertical-align: top; }
.bo-doc__table th { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--c-text-2); border-bottom-color: var(--c-line-strong); }
.bo-doc__table .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bo-doc .bo-totals { margin-left: auto; width: min(320px, 100%); padding: 0; border: 0; }
.bo-doc__note p { white-space: pre-line; }
.bo-doc__foot { color: var(--c-text-2); border-top: 1px solid var(--c-line); padding-top: 14px; }
@media print {
  @page { size: A4; margin: 14mm; }
  .bo-body { background: #fff; }
  .bo-side, .bo-topbar, .bo-tabbar, .bo-noprint, .bo-toasts, .bo-scrim, .bo-more, .bo-demo { display: none !important; }
  .bo-app { display: block; }
  .bo-main { padding: 0; }
  .bo-page { max-width: none; gap: 0; }
  .bo-doc { border: 0; border-radius: 0; padding: 0; max-width: none; box-shadow: none; }
  .bo-doc__parties { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bo-doc__table tr { break-inside: avoid; }
}

/* secret shown once (pairing code, starter password) */
.bo-secret { display: grid; gap: 8px; padding: 16px; border-radius: var(--r-lg); background: var(--c-ink-panel); color: #fff; }
.bo-secret__value { font-family: var(--font-mono); font-size: 2rem; font-weight: var(--fw-medium); letter-spacing: 0.04em; overflow-wrap: anywhere; user-select: all; }
.bo-secret p { color: var(--c-text-on-ink-2); font-size: var(--fs-xs); }
.bo-secret .bo-btn { justify-self: start; background: #262624; color: #fff; }

/* ------------------------------------------------------------------ sheet, confirm, toast */
.bo-scrim { position: fixed; inset: 0; background: rgba(10, 10, 10, 0.32); z-index: 50; animation: bo-fade var(--dur) var(--ease-out); }
.bo-sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51;
  width: min(520px, 100vw); display: flex; flex-direction: column;
  background: var(--c-canvas); box-shadow: var(--shadow-3);
  animation: bo-slide var(--dur-slow) var(--ease-out);
}
.bo-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; background: var(--c-panel); border-bottom: 1px solid var(--c-line); }
.bo-sheet__head h2 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); overflow-wrap: anywhere; min-width: 0; }
.bo-sheet__body { flex: 1; overflow-y: auto; padding: 20px; display: grid; gap: 20px; align-content: start; }
.bo-sheet__foot { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 20px; background: var(--c-panel); border-top: 1px solid var(--c-line); }
.bo-sheet__foot .bo-spacer { flex: 1; }
.bo-dialog { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 61; width: min(440px, calc(100vw - 32px)); display: grid; gap: 14px; padding: 22px; border-radius: var(--r-xl); background: var(--c-panel); box-shadow: var(--shadow-3); animation: bo-fade var(--dur) var(--ease-out); }
.bo-dialog h2 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.bo-dialog p { color: var(--c-text-2); }
.bo-dialog__btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.bo-scrim--top { z-index: 60; }
@keyframes bo-fade { from { opacity: 0; } }
@keyframes bo-slide { from { transform: translateX(24px); opacity: 0; } }
.bo-toasts { position: fixed; left: 16px; right: 16px; bottom: 20px; z-index: 80; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.bo-toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; max-width: 42rem; width: max-content; max-width: min(42rem, 100%); padding: 12px 14px 12px 16px; border-radius: var(--r-md); background: var(--c-ink-panel); color: #fff; box-shadow: var(--shadow-3); animation: bo-fade var(--dur) var(--ease-out); }
.bo-toast--error { background: var(--c-alert-text); }
.bo-toast p { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bo-toast button { background: none; border: 0; color: inherit; cursor: pointer; padding: 2px; opacity: 0.8; }

/* ------------------------------------------------------------------ sign-in */
.bo-auth-page { display: grid; }
.bo-auth { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 20px; padding: 32px 16px; }
.bo-auth__card { width: min(400px, 100%); display: grid; gap: 16px; padding: 32px; border-radius: var(--r-xl); background: var(--c-panel); border: 1px solid var(--c-line); box-shadow: var(--shadow-2); }
.bo-auth__logo { width: 140px; height: auto; }
.bo-auth__product { color: var(--c-text-2); font-size: var(--fs-xs); font-weight: var(--fw-medium); margin-top: -8px; }
.bo-auth__title { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); line-height: var(--lh-snug); margin-top: 4px; }
.bo-auth__text { color: var(--c-text-2); }
.bo-auth__form { display: grid; gap: 16px; }
.bo-auth__error { padding: 10px 14px; border-radius: var(--r-md); background: var(--c-alert-bg); color: var(--c-alert-text); }
.bo-auth__note { padding: 10px 14px; border-radius: var(--r-md); background: var(--c-panel-2); }
.bo-auth__link { justify-self: center; color: var(--c-text-2); font-weight: var(--fw-medium); }
.bo-auth__foot { color: var(--c-text-3); font-size: var(--fs-xs); text-align: center; }
.bo-auth .bo-btn { min-height: 46px; }
.bo-pw { position: relative; }
.bo-pw .bo-input { padding-right: 48px; }
.bo-pw__toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 36px; display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: none; color: var(--c-text-2); cursor: pointer; }
.bo-pw__toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.bo-pw__hide, .bo-pw__toggle[aria-pressed="true"] .bo-pw__show { display: none; }
.bo-pw__toggle[aria-pressed="true"] .bo-pw__hide { display: block; }
@media (hover: hover) { .bo-pw__toggle:hover { background: var(--c-panel-2); color: var(--c-text); } }
.bo-credit { color: var(--c-text-3); font-size: var(--fs-xs); text-align: center; }
.bo-credit a { color: var(--c-text-2); }
.bo-gate { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }

/* ------------------------------------------------------------------ tablet and phone */
@media (max-width: 1100px) {
  .bo-cols, .bo-cols--side { grid-template-columns: minmax(0, 1fr); }
  .bo-main { padding: 24px 20px 64px; }
}
@media (max-width: 900px) {
  .bo-app { display: block; }
  .bo-side { display: none; }
  .bo-topbar {
    position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px;
    height: 56px; padding: 0 16px; padding-top: env(safe-area-inset-top);
    background: rgba(243, 243, 241, 0.96); border-bottom: 1px solid var(--c-line);
  }
  .bo-topbar img { width: 92px; height: auto; }
  .bo-topbar__spacer { flex: 1; }
  .bo-topbar a.bo-me-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--c-panel-2); text-decoration: none; font-weight: var(--fw-semibold); font-size: var(--fs-xs); }
  .bo-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--c-panel); border-top: 1px solid var(--c-line);
  }
  .bo-tabbar a, .bo-tabbar button { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; min-height: 52px; border: 0; background: none; border-radius: var(--r-md); color: var(--c-text-2); font-size: 12px; font-weight: var(--fw-medium); text-decoration: none; cursor: pointer; }
  .bo-tabbar .bo-ico { width: 22px; height: 22px; }
  .bo-tabbar [aria-current="page"] { color: var(--c-text); }
  .bo-tabbar [aria-current="page"] .bo-ico { stroke-width: 2.25; }
  .bo-main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .bo-head h1 { font-size: var(--fs-xl); }
  .bo-more { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 85vh; overflow-y: auto; padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--c-panel-2); box-shadow: var(--shadow-3); animation: bo-up var(--dur-slow) var(--ease-out); }
  .bo-more .bo-nav a, .bo-more .bo-nav button.bo-nav__item { min-height: 48px; }
  .bo-sheet { width: 100vw; top: auto; height: 94vh; border-radius: var(--r-xl) var(--r-xl) 0 0; animation: bo-up var(--dur-slow) var(--ease-out); }
  .bo-sheet__head { border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .bo-sheet__foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .bo-toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .bo-input, .bo-select, .bo-textarea { font-size: 16px; min-height: 44px; } /* 16px: iPhone does not zoom */
  .bo-btn { min-height: 44px; }
  .bo-btn--sm { min-height: 36px; }
  .bo-search { max-width: none; flex-basis: 100%; }
  .bo-toolbar__end { margin-left: 0; }
  .bo-sortpick { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--c-line); }
  .bo-sortpick .bo-select { min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
  .bo-grid2 { grid-template-columns: minmax(0, 1fr); }
  .bo-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bo-fig { padding: 14px 16px; }
  .bo-fig__value { font-size: var(--fs-lg); }
  .bo-hero__value { font-size: 2.5rem; }
  .bo-dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .bo-dl dd { margin-bottom: 10px; }
  .bo-panel__pad { padding: 16px; }
  .bo-panel__head { padding: 14px 16px; }

  /* tables stack into rows: main cell left, end cell right, sub cells under the main one */
  .bo-table--stack, .bo-table--stack tbody, .bo-table--stack tfoot { display: block; }
  .bo-table--stack thead { display: none; }
  /* line 1: the main cell and the amount; line 2: the other cells joined with dots */
  .bo-table--stack tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 12px 16px; border-bottom: 1px solid var(--c-line); }
  .bo-table--stack tr::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
  .bo-table--stack tbody tr:last-child { border-bottom: 0; }
  .bo-table--stack td { display: block; padding: 0; border: 0; text-align: left; }
  .bo-table--stack td.ph-main { order: 0; flex: 1 1 0; min-width: 0; }
  .bo-table--stack td.ph-end { order: 1; flex: none; text-align: right; max-width: 55%; }
  .bo-table--stack td.ph-sub { order: 3; flex: none; max-width: 100%; color: var(--c-text-2); font-size: var(--fs-xs); margin-right: -6px; }
  .bo-table--stack td.ph-sub ~ td.ph-sub::before { content: "·"; margin-right: 6px; color: var(--c-text-3); }
  .bo-table--stack td.ph-sub .bo-sub { display: inline; margin: 0 0 0 4px; }
  .bo-table--stack td.ph-hide, .bo-table--stack td.ph-sub:has(> .bo-ph-empty) { display: none; }
  .bo-table--stack td .bo-ph-label { display: inline; color: var(--c-text-3); }
  .bo-table--stack tfoot tr { border-top: 1px solid var(--c-line-strong); }
  .bo-pager { justify-content: center; text-align: center; }
  .bo-look { padding: 14px 16px; }

  /* buying line editors: item on its own row, then quantity + cost, then the line total */
  .bo-lines__head { display: none; }
  .bo-lines__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; padding: 12px 16px; }
  .bo-lines__item { grid-column: 1 / 3; }
  .bo-lines__row > .bo-btn--icon, .bo-lines__row > span:last-child { grid-column: 3; grid-row: 1; }
  .bo-lines__total { grid-column: 1 / -1; display: flex; justify-content: space-between; padding-top: 0; }
  .bo-lines__label { display: inline; color: var(--c-text-2); font-size: var(--fs-xs); }
  .bo-lines__row > div:nth-child(2) { grid-column: 1; }
  .bo-lines__row > div:nth-child(3) { grid-column: 2 / -1; }
  .bo-buyactions .bo-btn { flex: 1 1 auto; }
  .bo-buyactions .bo-spacer { display: none; }
  .bo-doc { padding: 20px 16px; }
  .bo-doc__parties { grid-template-columns: minmax(0, 1fr); }
  .bo-doc__title { text-align: left; }
  .bo-doc__table th, .bo-doc__table td { padding: 8px 4px; font-size: var(--fs-xs); }
  .bo-doc__table .r { white-space: normal; }
  .bo-lowrow { grid-template-columns: minmax(0, 1fr) 70px 70px 70px; font-size: var(--fs-xs); }
}
@keyframes bo-up { from { transform: translateY(32px); opacity: 0; } }
@media (max-width: 420px) {
  .bo-mix__row { grid-template-columns: minmax(0, 1fr) 96px 40px; }
  .bo-auth__card { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .bo-sheet, .bo-scrim, .bo-dialog, .bo-toast, .bo-more { animation: none; }
}
