/* Luxury Notes — light, clean, bilingual (EN / AR).
   Layout uses logical properties throughout, so dir="rtl" mirrors it for free. */

:root {
  --bg:          #f6f7f7;
  --surface:     #ffffff;
  --surface-2:   #fbfcfc;
  --surface-3:   #f1f4f4;

  --line:        #e3e7e7;
  --line-soft:   #eef1f1;

  --text:        #16201f;
  --text-2:      #4a5654;
  --muted:       #74807e;
  --faint:       #97a2a0;

  /* Brand slate, taken from theluxurynotes.com (--color-primary: 74, 93, 110). */
  --accent:      #4a5d6e;
  --accent-hi:   #5d7386;
  --accent-soft: #eaeef1;
  --accent-ring: rgba(74, 93, 110, .18);
  /* The site's gold, kept for the one place a highlight has to shout. */
  --gold:        #ffd700;

  /* Validated categorical pair (light, surface #FFFFFF) */
  --c-revenue:   #01897C;
  --c-profit:    #B0490C;

  --good:        #12704f;
  --good-soft:   #e7f4ee;
  --warn:        #8a5a08;
  --warn-soft:   #fdf2e0;
  --bad:         #a3352a;
  --bad-soft:    #fbeceb;

  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(16, 32, 30, .05);
  --shadow-md: 0 4px 14px -6px rgba(16, 32, 30, .16);
  --shadow-lg: 0 24px 56px -26px rgba(16, 32, 30, .38);

  --display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --body:    "IBM Plex Sans Arabic", system-ui, sans-serif;

  --ease: cubic-bezier(.32, .72, .27, 1);
  --rail-w: 226px;
}

* { box-sizing: border-box; }

/* display rules below would otherwise beat the hidden attribute */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  color: var(--text);
  margin: 0;
  letter-spacing: -.015em;
}

/* Arabic sets its own rhythm: slightly larger, looser, and no letter-spacing tricks. */
:root[dir="rtl"] {
  --display: "Readex Pro", "IBM Plex Sans Arabic", system-ui, sans-serif;
}
:root[dir="rtl"] body { font-size: 15.5px; line-height: 1.75; }
:root[dir="rtl"] h1, :root[dir="rtl"] h2, :root[dir="rtl"] h3 { letter-spacing: 0; }
:root[dir="rtl"] .eyebrow, :root[dir="rtl"] .tile-label,
:root[dir="rtl"] thead th, :root[dir="rtl"] .field > label,
:root[dir="rtl"] .preview-title, :root[dir="rtl"] .pill,
:root[dir="rtl"] .brand-sub {
  letter-spacing: 0;
  text-transform: none;
  font-size: 11.5px;
}

.num, td.num, .num-cell, .tile-value, tfoot td, .field input.num-in {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ---------- layout ---------- */

.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px 16px 20px;
  background: var(--surface);
  border-inline-end: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; padding-inline-start: 6px; }
.brand-mark { width: 24px; height: 30px; color: var(--accent); flex: none; }
.brand-name { font-family: var(--display); font-size: 18px; font-weight: 600; color: var(--text); margin: 0; line-height: 1.15; }
.brand-sub { margin: 1px 0 0; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center;
  padding: 9px 12px;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--text-2);
  font-family: var(--body); font-size: 14px; font-weight: 400;
  text-align: start; cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }

.main { min-width: 0; padding: 26px 30px 70px; }

.topbar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; padding-bottom: 18px; margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.eyebrow { margin: 0 0 2px; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); }
.page-title { font-size: 28px; line-height: 1.2; }

.lang-switch { display: inline-flex; background: var(--surface-3); border-radius: var(--r-sm); padding: 2px; }
.lang-btn {
  min-width: 38px; padding: 6px 10px;
  background: none; border: 0; border-radius: 5px;
  font-family: var(--body); font-size: 13px; font-weight: 500; color: var(--muted);
  cursor: pointer; transition: all .18s var(--ease);
}
.lang-btn:hover { color: var(--text); }
.lang-btn.is-on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.lang-btn[lang="ar"] { font-size: 15px; }

.view { display: none; animation: rise .32s var(--ease) both; }
.view.is-active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* ---------- panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 14px; margin-bottom: 15px; }
.panel-head h2 { font-size: 17px; }
.panel-head .hint { font-size: 12px; color: var(--faint); }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Column ratios live here, not inline, so the mobile breakpoint can still collapse them. */
.grid.cols-2.lean-right { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid.cols-2.lean-left { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- stat tiles ---------- */

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile {
  padding: 15px 17px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.tile-label { margin: 0 0 7px; font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--faint); }
.tile-value {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 24px; font-weight: 600; color: var(--text); letter-spacing: -.02em; line-height: 1.15;
}
.tile-value .cur { font-size: 12px; font-weight: 500; color: var(--faint); letter-spacing: 0; }
.tile-foot { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

.tile.is-hero {
  grid-column: span 2;
  background: linear-gradient(135deg, #4a5d6e, #354553);
  border-color: transparent;
  color: #fff;
}
.tile.is-hero .tile-label { color: rgba(255, 255, 255, .72); }
.tile.is-hero .tile-value { font-size: 38px; color: #fff; }
.tile.is-hero .tile-value .cur { color: rgba(255, 255, 255, .68); }
.tile.is-hero .tile-foot { color: rgba(255, 255, 255, .8); }

/* ---------- buttons & fields ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px;
  font-family: var(--body); font-size: 13.5px; font-weight: 500;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2);
  cursor: pointer;
  transition: all .18s var(--ease);
  box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: #cfd6d5; color: var(--text); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: #fff; }
.btn-plus { font-size: 15px; line-height: 1; margin-top: -1px; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-quiet { box-shadow: none; color: var(--muted); }
.btn-danger:hover { border-color: #e0b5b0; color: var(--bad); background: var(--bad-soft); }

.icon-btn {
  background: none; border: 0; color: var(--muted);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 7px;
  border-radius: var(--r-sm); transition: all .18s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font-family: var(--body); font-size: 14.5px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.field .help { font-size: 12px; color: var(--faint); }

/* Date inputs need explicit handling: Safari (especially on iOS) gives them an intrinsic
   width that ignores width:100%, sizes them 2px taller than a text input, and renders the
   value inside a shadow element that ignores the field's own alignment. Left alone they sit
   misaligned next to Quantity and drift right on iPhone. */
.field input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  line-height: 1.2;
}
/* The picker's shadow wrapper adds its own height, so every field gets one explicit
   height instead — that is the only way date and text inputs line up on the same row. */
.field input:not([type="checkbox"]), .field select { height: 40px; }
.field input[type="date"]::-webkit-date-and-time-value {
  text-align: start;
  margin: 0;
  line-height: normal;
}
.field input[type="date"]::-webkit-datetime-edit { padding: 0; line-height: normal; }
.field input[type="date"]::-webkit-datetime-edit-fields-wrapper { padding: 0; }
.field input[type="date"]::-webkit-calendar-picker-indicator { opacity: .5; cursor: pointer; }
/* The date input computes direction:ltr regardless of the page, so `start` resolves to
   left and the field ends up alone against the grain of an Arabic form. Pin the side
   explicitly; direction stays ltr so 02/08/2026 keeps its digit order. */
:root[dir="rtl"] .field input[type="date"] { text-align: right; }
:root[dir="rtl"] .field input[type="date"]::-webkit-date-and-time-value { text-align: right; }
:root[dir="ltr"] .field input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.field select {
  appearance: none; padding-inline-end: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 14px center, right 9px center;
  background-size: 5px 5px; background-repeat: no-repeat;
}
/* Mirroring the arrow means swapping the two halves, not just the side. */
:root[dir="rtl"] .field select { background-position: left 9px center, left 14px center; }
/* Names and notes stay readable whichever script they are typed in. Number and date
   fields are excluded: with only digits inside, plaintext resolves the paragraph to LTR
   and drags them to the left edge of an otherwise right-aligned Arabic form. */
.field input:not([type="number"]):not([type="date"]), .field textarea,
td, .item-name { unicode-bidi: plaintext; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font-family: var(--body); font-size: 13px; cursor: pointer;
  transition: all .18s var(--ease);
}
.chip:hover { border-color: #cfd6d5; color: var(--text); }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.is-on span { color: rgba(255, 255, 255, .78) !important; }
.chip:disabled { opacity: .4; cursor: not-allowed; }

.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 15px; }
.toolbar .field { min-width: 152px; }
.toolbar .spacer { flex: 1; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; border-radius: var(--r-md); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 13px; text-align: start; white-space: nowrap;
  background: var(--surface-3);
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--accent); }
thead th .caret { font-size: 8px; }
tbody td { padding: 10px 13px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; color: var(--text-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .14s var(--ease); }
tbody tr:hover { background: var(--surface-3); }
td.r, th.r { text-align: end; }
td.num, .num-cell { font-size: 13px; color: var(--text); }
tfoot td { padding: 11px 13px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text); font-weight: 600; background: var(--surface-2); }
.item-name { color: var(--text); font-weight: 500; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .16s; }
:root[dir="rtl"] .row-actions { justify-content: flex-start; }
tr:hover .row-actions, tr:focus-within .row-actions { opacity: 1; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 500; letter-spacing: .04em;
  background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.pill.teal { background: var(--accent-soft); color: var(--accent); }
.pill.amber { background: var(--warn-soft); color: var(--warn); }
.pos { color: var(--good); }
.neg { color: var(--bad); }

.empty { padding: 38px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.empty strong { display: block; font-family: var(--display); font-size: 17px; color: var(--text); margin-bottom: 4px; font-weight: 600; }

/* ---------- bottle cards ---------- */

.bottle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 13px; }
.bottle-card {
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}
.bottle-card:hover { transform: translateY(-2px); border-color: #d3dbda; box-shadow: var(--shadow-md); }
.bottle-card.is-empty { opacity: .62; }

/* Remaining-stock bar. The track is clipped, so a fill of any width stays inside it.
   Colour steps every 10%: red when nearly gone, through amber, to teal when full.
   The percentage is printed beside it, so the level never rests on colour alone. */
.stock-row { display: flex; align-items: center; gap: 9px; margin-top: 9px; }
.stock-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.stock-bar > i {
  display: block; height: 100%; max-width: 100%;
  border-radius: 999px;
  background: var(--lv, var(--accent));
  transition: width .5s var(--ease), background .3s var(--ease);
}
.stock-pct {
  min-width: 34px; text-align: end;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--lv, var(--muted));
}

.lv-0   { --lv: #9aa5a3; }
.lv-10  { --lv: #b3261e; }
.lv-20  { --lv: #bf4318; }
.lv-30  { --lv: #c2620d; }
.lv-40  { --lv: #b07c07; }
.lv-50  { --lv: #99890a; }
.lv-60  { --lv: #7a8f10; }
.lv-70  { --lv: #56921f; }
.lv-80  { --lv: #2c9153; }
.lv-90  { --lv: #0e8d78; }
.lv-100 { --lv: #4a5d6e; }

.bottle-name { font-family: var(--display); font-size: 15.5px; font-weight: 600; color: var(--text); line-height: 1.25; }
.bottle-meta { font-size: 12px; color: var(--faint); margin: 3px 0 9px; }
.bottle-stock { font-size: 13px; color: var(--text-2); }
.bottle-stock b { color: var(--accent); font-weight: 600; }
.price-row { display: flex; gap: 6px; margin-top: 10px; }
.price-cell { flex: 1; padding: 7px 4px; text-align: center; background: var(--surface-3); border-radius: var(--r-sm); }
.price-cell .sz { font-size: 10px; color: var(--muted); }
.price-cell .pr { font-size: 13px; font-weight: 600; color: var(--text); }
.price-cell .lf { font-size: 10.5px; color: var(--faint); }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }

/* ---------- chart ---------- */

.chart-legend { display: flex; gap: 14px; align-items: center; font-size: 12.5px; color: var(--muted); }
.legend-key { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; }
.chart-shell { position: relative; }
/* Charts mirror themselves in RTL by computing their own coordinates. Left as dir:rtl the
   SVG would flip text-anchor a second time, throwing every label out of the frame. */
.chart-svg { width: 100%; height: 214px; display: block; overflow: visible; direction: ltr; }
.chart-svg text { unicode-bidi: plaintext; }
.chart-svg .axis-line { stroke: #d5dcdb; stroke-width: 1; }
.chart-svg .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart-svg .tick { font-family: var(--body); font-size: 10px; fill: var(--faint); }
.chart-svg g.col .band { fill: transparent; }
.chart-svg g.col:hover .band { fill: rgba(0, 114, 106, .05); }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; opacity: 0;
  transform: translate(-50%, -110%);
  padding: 8px 11px; min-width: 138px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 12.5px; box-shadow: var(--shadow-md);
  transition: opacity .13s;
}
.chart-tip.on { opacity: 1; }
.chart-tip .tip-date { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.chart-tip .tip-row { display: flex; justify-content: space-between; gap: 14px; color: var(--text-2); }
.chart-tip .tip-row span:last-child { color: var(--text); font-weight: 600; }

/* ---------- meters ---------- */

.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.amber > i { background: var(--c-profit); }
.lot-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }

/* ---------- modal ---------- */

.modal-root { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 20px; }
.modal-scrim { position: absolute; inset: 0; background: rgba(16, 32, 30, .42); backdrop-filter: blur(2px); animation: fade .22s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.modal {
  position: relative; width: min(680px, 100%); max-height: 88vh; overflow: auto;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  animation: pop .28s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.99); } }
.modal-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 17px 21px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 19px; }
.modal-body { padding: 19px 21px 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line-soft); }
:root[dir="rtl"] .form-actions { justify-content: flex-start; }

.preview { margin-top: 4px; padding: 13px 15px; background: var(--surface-3); border-radius: var(--r-md); }
.preview-title { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 9px; font-weight: 500; }
.preview-rows { display: flex; flex-direction: column; gap: 6px; }
.preview-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--text-2); }
.preview-row > span:first-child { min-width: 0; }
.preview-row b { flex: 0 0 auto; white-space: nowrap; }
.preview-row b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.preview-row.total { padding-top: 8px; border-top: 1px solid #dde3e2; font-size: 14.5px; }
.preview-row.total b { color: var(--accent); font-size: 17px; }
.preview-warn {
  margin-top: 10px; padding: 7px 10px; border-radius: var(--r-sm);
  font-size: 12.5px; color: var(--warn); background: var(--warn-soft);
}

/* ---------- toasts ---------- */

.toasts { position: fixed; inset-inline-end: 20px; bottom: 20px; z-index: 900; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 15px; max-width: 360px;
  background: var(--surface); border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--r-sm); font-size: 13.5px; color: var(--text-2);
  box-shadow: var(--shadow-md);
  animation: slide .26s var(--ease) both;
}
.toast.err { border-inline-start-color: var(--bad); color: var(--bad); background: var(--bad-soft); }
.toast.ok { border-inline-start-color: var(--good); }
@keyframes slide { from { opacity: 0; transform: translateY(10px); } }

/* ---------- misc ---------- */

.note { font-size: 12.5px; color: var(--muted); line-height: 1.65; }
.kbd { font-size: 12px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-3); color: var(--text-2); }
.rule { height: 1px; background: var(--line-soft); margin: 16px 0; border: 0; }
.formula {
  font-size: 13px; color: var(--accent);
  background: var(--accent-soft); border-radius: var(--r-sm);
  padding: 11px 14px; line-height: 1.9; overflow-x: auto;
  white-space: pre-wrap; margin: 0;
  unicode-bidi: plaintext;
}

@media (max-width: 1120px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static; height: auto; flex-direction: row; align-items: center;
    gap: 14px; padding: 12px 14px; overflow-x: auto;
    border-inline-end: 0; border-bottom: 1px solid var(--line);
  }
  .rail .brand-sub { display: none; }
  .nav { flex-direction: row; }
  .nav-item { white-space: nowrap; }
  .rail-foot { flex-direction: row; margin-top: 0; margin-inline-start: auto; }
  .main { padding: 18px 14px 56px; }
  .page-title { font-size: 23px; }
  .topbar { flex-wrap: wrap; }
  .tiles, .grid.cols-2, .grid.cols-3,
  .grid.cols-2.lean-right, .grid.cols-2.lean-left { grid-template-columns: minmax(0, 1fr); }
  .chart-legend { flex-wrap: wrap; gap: 6px 12px; }
  .tile.is-hero { grid-column: span 1; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- dashboard ---------- */

/* Validated 5-series categorical palette (light surface #FFFFFF) */
:root {
  --s1: #01897C; --s2: #B0490C; --s3: #3B6FBF; --s4: #7A8B1F; --s5: #9A4CA0;
  --in:  #01897C;  /* money arriving */
  --out: #B0490C;  /* money leaving  */
}

.dash { display: flex; flex-direction: column; gap: 16px; }

/* headline band */
.kpi-band { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi {
  position: relative; overflow: hidden;
  padding: 16px 18px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 3px;
}
.kpi-label { font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--faint); margin: 0; }
.kpi-value {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-value .cur { font-size: 12px; font-weight: 500; color: var(--faint); }
.kpi-foot { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.kpi.lead { background: linear-gradient(135deg, #4a5d6e, #354553); border-color: transparent; color: #fff; }
.kpi.lead .kpi-label { color: rgba(255,255,255,.72); }
.kpi.lead .kpi-value, .kpi.lead .kpi-value .cur { color: #fff; }
.kpi.lead .kpi-value { font-size: 34px; }
.kpi.lead .kpi-foot { color: rgba(255,255,255,.82); }
.kpi .spark { margin-top: 8px; height: 26px; width: 100%; display: block; overflow: visible; }

.mini-band { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.mini {
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
}
.mini .k { margin: 0 0 4px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.mini .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mini .s { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }

/* panel grid */
.dash-grid { display: grid; gap: 16px; }
.dash-grid.split { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); }
.dash-grid.thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r-sm); padding: 2px; }
.seg button {
  padding: 5px 11px; border: 0; background: none; border-radius: 5px;
  font-family: var(--body); font-size: 12.5px; font-weight: 500; color: var(--muted); cursor: pointer;
  transition: all .16s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.is-on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }

/* charts */
.chart-svg .mark { transition: opacity .16s; }
.chart-svg .value-label { font-family: var(--body); font-size: 10.5px; font-weight: 600; fill: var(--text-2); }
.chart-svg .connector { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-svg .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }

/* 100% stacked mix bar */
.mix-bar { display: flex; height: 34px; border-radius: var(--r-sm); overflow: hidden; gap: 2px; background: var(--surface-3); }
.mix-seg {
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: #fff; min-width: 3px;
  transition: filter .16s var(--ease);
}
.mix-seg:hover { filter: brightness(1.12); }
.mix-legend { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 14px; }
.mix-key { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.mix-key i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.mix-key b { font-weight: 600; font-variant-numeric: tabular-nums; }
.mix-key span { color: var(--muted); }

/* supplier + mover rows */
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.bar-row:last-child { border-bottom: none; }
.bar-row .nm { font-size: 13px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .fig { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.bar-row .sub { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; }
.bar-row .sub .note { white-space: nowrap; }
.dual { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.dual .track { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.dual .track > i { display: block; height: 100%; border-radius: 3px; }

.pct-chip {
  font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pct-chip.hot { background: var(--good-soft); color: var(--good); }
.pct-chip.mid { background: var(--warn-soft); color: var(--warn); }
.pct-chip.cold { background: var(--surface-3); color: var(--muted); }

details.numbers { margin-top: 12px; }
details.numbers > summary { cursor: pointer; font-size: 12.5px; color: var(--muted); list-style: none; }
details.numbers > summary::-webkit-details-marker { display: none; }
details.numbers > summary::before { content: "▸ "; }
details.numbers[open] > summary::before { content: "▾ "; }

@media (max-width: 1200px) {
  .kpi-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-band { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-grid.split, .dash-grid.thirds { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .kpi-band { grid-template-columns: minmax(0, 1fr); }
  .mini-band { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* A sale dated after today is usually a slip — flag it without blocking it. */
.future-flag { color: var(--warn); font-size: 11px; cursor: help; }

/* ---------- touch ergonomics ----------
   On a finger-driven screen the compact desktop hit areas are too small; 44px is the
   comfortable minimum. Scoped to coarse pointers so the desktop stays tight. */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding-inline: 16px; }
  .btn-sm { min-height: 40px; font-size: 13px; }
  .chip { min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; }
  .icon-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .lang-btn { min-height: 40px; }
  .nav-item { min-height: 44px; }
  .field input:not([type="checkbox"]), .field select { height: 44px; font-size: 16px; }
  .seg button { min-height: 40px; }
  .row-actions { opacity: 1; }
  thead th, tbody td { padding-block: 13px; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; }
}

/* ---------- order basket ---------- */

.btn-add-line {
  width: 100%; margin-top: 12px;
  border-style: dashed; border-color: #cfd6d5;
  color: var(--accent); background: var(--surface);
}
.btn-add-line:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-add-line:disabled { opacity: .45; cursor: not-allowed; }

.basket { margin-top: 14px; }
.basket-empty {
  margin: 0; padding: 14px; text-align: center;
  font-size: 12.5px; color: var(--faint);
  border: 1px dashed var(--line); border-radius: var(--r-md);
}
.basket-title {
  margin: 0 0 8px; font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
}
.basket-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px; align-items: center;
  padding: 9px 11px; margin-bottom: 6px;
  background: var(--surface-3); border-radius: var(--r-sm);
}
.basket-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.basket-name { font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.basket-fig { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.basket-total { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.basket-line .icon-btn { font-size: 18px; padding: 0 4px; }
.basket-sum {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 11px 11px 2px; border-top: 1px solid var(--line); margin-top: 8px;
  font-size: 14px; color: var(--text-2);
}
.basket-sum b { font-size: 17px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.basket-profit { font-size: 12px; font-weight: 500; color: var(--muted); margin-inline-start: 8px; }

.order-chip {
  display: inline-block; margin-inline-start: 6px;
  font-size: 10.5px; padding: 1px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}

@media (max-width: 860px) {
  .basket-line { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .basket-main { grid-column: 1; }
  .basket-line .icon-btn { grid-column: 2; grid-row: 1 / span 2; }
  .basket-fig { grid-column: 1; }
  .basket-total { grid-column: 1; justify-self: start; }
}

/* ---------- searchable dropdown ---------- */

.combo { position: relative; }
.combo-native { display: none; }
.combo-input { width: 100%; padding-inline-end: 30px !important; cursor: text; }
.combo-caret {
  position: absolute; inset-block: 0; inset-inline-end: 11px; margin: auto;
  width: 0; height: 0; pointer-events: none;
  border-inline: 4px solid transparent;
  border-top: 5px solid var(--muted);
}
.combo.is-open .combo-caret { transform: rotate(180deg); }

.combo-list {
  position: absolute; z-index: 40; inset-inline: 0; top: calc(100% + 4px);
  max-height: 264px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 4px;
}
.combo-group {
  padding: 8px 10px 4px;
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); font-weight: 600;
}
:root[dir="rtl"] .combo-group { letter-spacing: 0; text-transform: none; font-size: 11.5px; }
.combo-opt {
  padding: 9px 10px; border-radius: var(--r-sm);
  font-size: 14px; color: var(--text-2); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-opt.is-active { background: var(--surface-3); color: var(--text); }
.combo-opt.is-selected { color: var(--accent); font-weight: 600; }
.combo-opt.is-selected.is-active { background: var(--accent-soft); }
.combo-none { padding: 14px 10px; text-align: center; font-size: 13px; color: var(--faint); }

@media (pointer: coarse) {
  .combo-opt { padding: 12px 10px; font-size: 15px; }
  .combo-list { max-height: 46vh; }
}

/* ---------- installed app ---------- */

/* Standalone mode has no browser chrome, so the app owns the notch and home indicator. */
@supports (padding: max(0px)) {
  .rail { padding-top: max(26px, env(safe-area-inset-top)); }
  .main { padding-bottom: max(70px, calc(env(safe-area-inset-bottom) + 40px)); }
  .toasts { bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px)); }
}
@media (display-mode: standalone) {
  /* No address bar to pull on, so give the top row a little breathing room. */
  .rail { padding-top: max(18px, env(safe-area-inset-top)); }
  body { overscroll-behavior-y: none; }
}

.stale-bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 800;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: var(--warn-soft); color: var(--warn);
  font-size: 13px; border-top: 1px solid color-mix(in srgb, var(--warn) 24%, transparent);
}

/* ---- privacy mode -------------------------------------------------------------
   A screenshot you can send to a supplier, a customer, or a group chat without
   handing over your margins. Figures, supplier names and customer details become
   asterisks; dates, item names and quantities stay, so the picture still says
   something. */

/* .icon-btn sizes a text glyph, not an SVG — without an explicit box this collapses
   to the browser's 300×150 default and the button disappears from the bar. */
.privacy-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; }
.privacy-btn svg { width: 19px; height: 19px; display: block; }
.privacy-btn .eye-shut { display: none; }
.privacy-btn.is-on { color: var(--accent); background: var(--accent-soft); }
.privacy-btn.is-on .eye-open { opacity: .45; }
.privacy-btn.is-on .eye-shut { display: inline; }

/* Masked figures keep the column width they would have had, so turning privacy on
   does not make the whole table jump about. */
body.is-private .masked,
body.is-private .kpi-value,
body.is-private .num,
body.is-private .money {
  letter-spacing: .12em;
}

/* Never leak through a colour: a red total still says the month went badly. */
body.is-private .pos,
body.is-private .neg,
body.is-private .masked {
  color: var(--muted) !important;
}

/* Charts are shapes, not words, and a shape leaks whatever the labels hide: one bar
   four times its neighbour says "most of the money went on stock" no matter what the
   axis reads. Blurring does not fix that — a blurred bar is still a measurable length.
   So the graphics are hidden outright, with the boxes left in place so nothing on the
   page jumps when you toggle. */
body.is-private .chart-svg,
body.is-private .spark,
body.is-private .track,
body.is-private .dual,
body.is-private .mix-bar {
  visibility: hidden;
}

/* The chips are colour-coded by how well something is doing, which survives having
   its number masked. Flatten them to one neutral tone. */
body.is-private .pct-chip,
body.is-private .pct-chip.hot,
body.is-private .pct-chip.mid,
body.is-private .pct-chip.cold {
  background: var(--surface-3) !important;
  color: var(--muted) !important;
}

/* An empty panel reads as a bug. Say why it is empty instead. The text comes from a
   custom property so it can be translated — CSS content cannot read the i18n table. */
body.is-private .panel:has(.chart-svg),
body.is-private .panel:has(.track),
body.is-private .panel:has(.mix-bar) {
  position: relative;
}

body.is-private .panel:has(.chart-svg)::after,
body.is-private .panel:has(.track)::after,
body.is-private .panel:has(.mix-bar)::after {
  content: var(--privacy-label, "Hidden");
  position: absolute;
  inset-inline: 0;
  top: 58%;
  transform: translateY(-50%);
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  pointer-events: none;
}

/* Product photograph on a bottle card. Contained rather than cropped: a decant bottle
   is tall and a cover crop would cut the cap off. */
.bottle-card .shot {
  width: 100%; height: 132px; object-fit: contain;
  background: var(--surface-3); border-radius: var(--r-sm);
  margin-bottom: 10px;
}

/* ---- orders from the storefront ---------------------------------------------- */

.nav-badge {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px;
  margin-inline-start: auto; padding: 0 5px; border-radius: 99px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
}
.nav-item { justify-content: flex-start; gap: 8px; }

.order-card { display: flex; flex-direction: column; gap: 12px; }
.order-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.order-head > div:first-child { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.order-ref { font-size: 15px; letter-spacing: .04em; }
.order-total { font-size: 19px; font-weight: 700; }
.order-who { font-size: 13.5px; line-height: 1.6; }
.order-lines { display: flex; flex-direction: column; gap: 2px;
  border-block: 1px solid var(--line-soft); padding-block: 8px; }
.order-line { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 10px;
  align-items: baseline; font-size: 13.5px; padding: 4px 0; }
.order-line.is-short { color: var(--bad); }
.ol-qty { font-weight: 700; font-variant-numeric: tabular-nums; }
.ol-name { min-width: 0; }
.ol-stock { font-size: 12px; color: var(--muted); }
.order-line.is-short .ol-stock { color: var(--bad); font-weight: 600; }
.ol-total { font-weight: 600; }
.order-foot { font-size: 12.5px; }

@media (max-width: 720px) {
  /* Place every cell explicitly. The old rule moved the stock note to its own row but
     left the price to flow into whatever came next — which on a phone was a new row of
     its own, so each line read as three stacked fragments. */
  .order-line { grid-template-columns: 30px 1fr auto; row-gap: 2px; padding: 6px 0; }
  .ol-qty   { grid-column: 1; grid-row: 1; }
  .ol-name  { grid-column: 2; grid-row: 1; }
  .ol-total { grid-column: 3; grid-row: 1; text-align: right; }
  .ol-stock { grid-column: 2 / -1; grid-row: 2; }
}

.sub-head { margin: 22px 0 4px; font-size: 13px; font-weight: 600; letter-spacing: .04em; }


/* ---- shipping and receipts ---------------------------------------------------- */

.ship-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.way-in { flex: 1; min-width: 150px; min-height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px; font-size: 15px; }
.ship-done { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.ship-done .way { font-variant-numeric: tabular-nums; letter-spacing: .04em; direction: ltr; }

/* The receipt is money evidence: big enough to read the amount without opening it. */
.receipt { display: flex; gap: 10px; align-items: center; margin: 10px 0 0;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
.receipt img { width: 64px; height: 64px; object-fit: cover; border-radius: 7px; }
.receipt span { font-size: 13px; font-weight: 700; color: var(--ink-2); }

/* Full-screen viewfinder; tapping anywhere, or Escape, stops the camera. */
.scan-wrap { position: fixed; inset: 0; z-index: 200; background: #000;
  display: grid; place-items: center; }
.scan-wrap video { width: 100%; height: 100%; object-fit: contain; }
.scan-hint { position: absolute; inset-inline: 0; bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  margin: 0; text-align: center; color: #fff; font-size: 14px; font-weight: 600;
  text-shadow: 0 1px 4px rgba(0,0,0,.6); }


/* ---- storefront funnel --------------------------------------------------------- */

.funnel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.fn-step { padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  display: flex; flex-direction: column; gap: 2px; }
.fn-step.good { border-color: var(--teal, #2f7d6b); }
.fn-n { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fn-l { font-size: 12.5px; color: var(--muted); }
/* The step-to-step rate is the number that tells you where people leave. */
.fn-p { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.fn-sets { list-style: none; margin: 14px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px; }
.fn-sets li { display: flex; gap: 8px; align-items: baseline;
  padding: 6px 10px; background: var(--mist, #f4f6f7); border-radius: 8px; font-size: 13px; }

@media (max-width: 720px) {
  .funnel { grid-template-columns: repeat(2, 1fr); }
}

/* ---- bookings ------------------------------------------------------------------ */

/* Four small figures across the top. "Committed" is deliberately the plainest of them:
   it is a forecast, and it must not sit on the page looking like takings. */
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel.stat { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; }
.stat-l { font-size: 12px; color: var(--muted); }
.stat-v { font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; }
.panel.stat.is-good { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.panel.stat .note { font-size: 11.5px; }

/* Past the date the customer was given, and still not here. */
tr.is-late td { background: var(--warn-soft); }
.is-bad { color: var(--warn); font-weight: 600; }

@media (max-width: 900px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }


/* ---- booking lines -------------------------------------------------------------- */

/* One row per item, in both the editor and the fulfil dialog. Grid rather than flex so
   the columns line up down the list however long the names are. */
.bl-row, .fl-row { display: grid; gap: 6px; align-items: center; margin-bottom: 6px; }
.bl-row { grid-template-columns: minmax(0, 2.2fr) 1fr 68px 100px 34px; }
.fl-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) 100px 100px; }
.bl-row input, .bl-row select, .fl-row input, .fl-row select { min-height: 36px; }
.bl-row .btn { padding: 0; min-height: 36px; }
.fl-item { font-size: 13.5px; }
.bl { padding: 1px 0; }
.bl + .bl { border-top: 1px dashed var(--line-soft); margin-top: 3px; padding-top: 4px; }

@media (max-width: 760px) {
  .bl-row { grid-template-columns: 1fr 1fr; }
  .bl-row .bl-item { grid-column: 1 / -1; }
  .fl-row { grid-template-columns: 1fr; }
}


/* ---- what is spoken for ---------------------------------------------------------- */

/* The shopping list: one row per item, biggest demand first. The bar is there so the
   thing you need eight of is obvious before you have read a single number. */
.demand { display: flex; flex-direction: column; gap: 9px; }
.dm { display: grid; gap: 4px 12px; align-items: center;
      grid-template-columns: minmax(0, 1.7fr) minmax(90px, 1fr) 96px 150px 92px; }
.dm-name { font-size: 13.5px; min-width: 0; }
.dm-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.dm-bar i { display: block; height: 100%; background: var(--accent); }
.dm-qty b { font-size: 17px; font-variant-numeric: tabular-nums; }
.dm-qty .note { margin-inline-start: 5px; }
.dm-split { display: flex; gap: 5px; flex-wrap: wrap; }
.dm-val { text-align: end; font-size: 13.5px; }

@media (max-width: 860px) {
  /* Two lines per item rather than five squeezed columns. */
  .dm { grid-template-columns: 1fr auto; }
  .dm-name { grid-column: 1 / -1; }
  .dm-bar { grid-column: 1 / -1; }
  .dm-split { grid-row: 3; }
  .dm-val { grid-row: 3; }
}

/* ---- bookings on a phone --------------------------------------------------------- */

/* Seven columns do not fit a phone, and side-scrolling a table you need to act on is
   miserable. Below 760px each row becomes a card: who and what stay together, the
   status sits top-right, and the buttons are always visible instead of waiting for a
   hover that a touchscreen cannot give. */
@media (max-width: 760px) {
  .bookings-table thead { display: none; }
  .bookings-table, .bookings-table tbody, .bookings-table tr, .bookings-table td { display: block; }
  .bookings-table tr {
    position: relative;
    padding: 13px 14px;
    border-bottom: 1px solid var(--line-soft);
  }
  .bookings-table td { padding: 2px 0; border: 0; }
  .bookings-table td:empty { display: none; }
  /* Date and status ride together on the top line. */
  .bookings-table .bk-date { font-size: 12px; color: var(--muted); }
  .bookings-table .bk-status { position: absolute; inset-inline-end: 14px; top: 12px; }
  .bookings-table .bk-total { font-weight: 600; }
  .bookings-table .row-actions { opacity: 1; justify-content: flex-start; flex-wrap: wrap; margin-top: 8px; }
}

/* Shown under the page title while the figures are converted, so a number on screen is
   never in a different currency than the reader assumes. */
.fx-note {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--accent, #B0490C);
}

/* ---------- pagination ---------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 4px 2px;
}
.pager .btn[disabled] { opacity: .4; pointer-events: none; }
.pager-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.3;
  min-width: 12ch;
}
.pager-info b { font-size: 13px; font-weight: 600; }
.pager-range { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- date window ---------- */

.range-switch { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.range-switch select,
.range-switch input[type="date"] {
  height: 34px;
  padding: 0 8px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--card, #fff);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.range-switch input[type="date"] { max-width: 9.5rem; }
