:root {
  --ink: #172c26; --muted: #5b6e66; --bg: #f3f7f4; --card: #fff; --line: #dce8e0;
  --brand: #147657; --brand-dark: #124c3c; --soft: #e4efe8; --softer: #f6faf7; --danger: #a33434; --warn-bg: #fff6e0; --err-bg: #fff1ee; --ok-bg: #e7f4ec;
  --tap: 44px; --bottom-nav: 64px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; color: var(--ink); background: var(--bg);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); }
img, svg { max-width: 100%; }

/* ---------- Header ---------- */
header.top { background: var(--brand-dark); color: #fff; padding: 10px max(calc((100% - 1080px) / 2), 16px);
  padding-top: max(10px, env(safe-area-inset-top)); display: flex; gap: 12px; justify-content: space-between; align-items: center; }
header.top a { color: #fff; text-decoration: none; }
header.top .brand { font-weight: 700; white-space: nowrap; }
header.top nav { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; }
header.top nav.main a { padding: 10px 0; }
header.top nav.main a.active { text-decoration: underline; text-underline-offset: 6px; }
header.top .brand { flex: 0 0 auto; }
header.top .tools { display: flex; gap: 10px; align-items: center; justify-content: flex-end; min-width: 0; flex: 1 1 auto; }
header.top .tools form { min-width: 0; margin: 0; }
header.top .tools form:first-child { flex: 0 1 auto; }
header.top select { background: #ffffff1a; color: #fff; border: 1px solid #ffffff55; border-radius: 8px;
  padding: 8px 10px; width: 100%; max-width: 260px; min-width: 0; min-height: 40px; text-overflow: ellipsis; }
header.top select option { color: var(--ink); }
button.link { background: none; color: #fff; padding: 8px 4px; font-weight: 500; min-height: 40px; }

/* ---------- Bottom navigation (phones) ---------- */
.bottom-nav { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff;
  border-top: 1px solid var(--line); box-shadow: 0 -4px 16px #123b2a14;
  grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--bottom-nav); color: var(--muted); text-decoration: none; font-size: .75rem; font-weight: 600; }
.bottom-nav a svg { width: 24px; height: 24px; }
.bottom-nav a.active { color: var(--brand); }

/* ---------- Layout ---------- */
main { max-width: 1080px; margin: 28px auto; padding: 0 16px; }
h1 { font-size: clamp(1.5rem, 4vw, 2.4rem); letter-spacing: -.02em; margin: 2px 0 12px; line-height: 1.2; overflow-wrap: anywhere; }
h2 { margin-top: 0; font-size: 1.2rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.eyebrow { color: var(--muted); margin: 0; font-size: .9rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 16px 0; box-shadow: 0 6px 22px #123b2a0a; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--ok-bg); margin: 0 0 12px; }
.notice.error { background: var(--err-bg); }
.notice.warn { background: var(--warn-bg); }
.flash-toast { position: fixed; z-index: 90; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%);
  width: min(520px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px; padding: 12px 8px 12px 14px;
  background: var(--brand-dark); color: #fff; border-radius: 14px; box-shadow: 0 10px 30px #0b2b2155;
  animation: toast-in .25s ease-out; transition: opacity .3s, transform .3s; }
.flash-toast + .flash-toast { top: calc(84px + env(safe-area-inset-top)); }
.flash-toast.hide { opacity: 0; transform: translate(-50%, -12px); }
.flash-icon { flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; background: #fff; color: var(--brand-dark);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; }
.flash-text { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.flash-text strong { font-size: 1rem; }
.flash-close { flex: 0 0 auto; background: none; color: #fff; font-size: 1.5rem; width: 44px; min-height: 44px; padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -16px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .flash-toast { animation: none; transition: none; } }
.invite-box { display: grid; gap: 10px; border: 1px solid #b9dcc6; }
.invite-box input { font-size: 14px; }
header.top .store-name, header.top .admin-link { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
header.top .admin-link { padding: 0 4px; font-weight: 600; }
header.top .brand, header.top .admin-link { display: inline-flex; align-items: center; min-height: 44px; }
.status { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.status.trial { background: var(--warn-bg); color: #8a5a00; }
.status.active { background: #dff3e6; color: var(--brand-dark); }
.status.suspended, .status.expired { background: var(--err-bg); color: var(--danger); }

/* ---------- Forms ---------- */
form.stack { display: grid; gap: 14px; }
label { font-weight: 600; display: grid; gap: 6px; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; min-height: var(--tap); }
label.check input { width: 22px; height: 22px; min-height: 0; flex: 0 0 auto; accent-color: var(--brand); }
/* 16px text stops iOS from zooming into fields on focus. */
input, textarea, select { width: 100%; border: 1px solid #cad9d0; border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 16px; background: #fff; color: var(--ink); min-height: var(--tap); }
textarea { min-height: 80px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; display: flex; gap: 4px 20px; flex-wrap: wrap; margin: 0; }
legend { font-weight: 600; padding: 0 6px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.hint { color: var(--muted); font-size: .875rem; margin: -6px 0 0; }

button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--brand); color: #fff;
  border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  min-height: var(--tap); touch-action: manipulation; }
.button.secondary, button.secondary { background: var(--soft); color: var(--ink); }
button.danger, .button.danger { background: #fbeaea; color: var(--danger); }
button:active, .button:active { transform: translateY(1px); }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions form { display: inline-flex; margin: 0; }
.actions > a:not(.button) { padding: 10px 4px; }

/* ---------- Page toolbar & filters ---------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; justify-content: space-between; }
.toolbar > div { min-width: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input, .filters select { width: auto; min-width: 160px; flex: 1 1 160px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 10px 8px; border-bottom: 1px solid #e5eee8; vertical-align: top; overflow-wrap: anywhere; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.inactive td { opacity: .55; }
td.row-actions { width: 1%; white-space: nowrap; overflow-wrap: normal; }
td.row-actions .actions { flex-wrap: nowrap; justify-content: flex-end; }

.badge { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--ink); text-decoration: none; vertical-align: middle; }
.badge.warn { background: var(--warn-bg); color: #8a5a00; }
.badge.service { background: #e8eefc; color: #2a4a9a; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .badge { font-size: .875rem; padding: 6px 14px; min-height: 40px; display: inline-flex; align-items: center; }
.chips .badge.on { background: var(--brand); color: #fff; }
.inline-choice { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.inline-choice legend { width: 100%; }
.split { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
tfoot td { border-top: 2px solid var(--line); }
.sent-status { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  border-radius: 12px; padding: 10px 12px; }
.sent-status form { margin: 0; }
.sent-status.sent { background: var(--ok-bg); }
.sent-status.unsent { background: var(--warn-bg); }
.text-btn { background: none; color: var(--brand); padding: 6px 0; min-height: 36px; font-weight: 600; text-decoration: underline; }
.badge.unsent { background: var(--warn-bg); color: #8a5a00; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 99px; background: var(--soft); color: var(--ink); text-decoration: none; font-weight: 600; min-height: 40px; display: inline-flex; align-items: center; }
.tabs a.on { background: var(--brand); color: #fff; }
.period-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 8px; }
.period-tabs a { justify-content: center; text-align: center; min-height: 38px; padding: 6px 4px; font-size: .85rem; line-height: 1.15; }
.tabs .count { margin-left: 6px; background: var(--danger); color: #fff; border-radius: 99px; padding: 0 7px; font-size: .8rem; }
.badge.late { background: var(--err-bg); color: var(--danger); font-weight: 700; }
.badge.ready { background: var(--ok-bg); color: var(--brand-dark); }
.badge.custom { background: #f3e8fc; color: #6a2a9a; }
.custom-box { border: 1px dashed #c9b3dc; border-radius: 12px; padding: 10px 12px; background: #fbf8fe; }
.order-line { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0 0 10px; display: grid; gap: 10px; min-width: 0; }
.order-line .line-head { display: flex; gap: 8px; align-items: center; }
.order-line .line-head select { flex: 1 1 auto; min-width: 0; }
.order-line .line-head { align-items: flex-end; }
.order-line .item-search { flex: 1 1 auto; min-width: 0; margin: 0; }
.order-line .item-picked { flex: 1 1 auto; min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--ok-bg); border-radius: 10px; padding: 8px 10px; }
.order-line .item-results { margin-top: -4px; max-height: 320px; overflow-y: auto; }
.order-line .item-results .customer-option { display: block; line-height: 1.3; }
.order-line .line-numbers { align-items: end; }
.order-line .line-total { display: flex; flex-direction: column; padding-bottom: 8px; }
.order-line input[readonly] { background: #f3f7f4; color: var(--muted); }
.dp-chip { display: inline-block; background: var(--ok-bg); color: var(--brand-dark); font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.money-grid .paid { background: var(--ok-bg); }
.money-grid .unpaid { background: var(--warn-bg); }
.picked-customer { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--ok-bg); border-radius: 12px; padding: 10px 12px; }
.customer-results { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.customer-results li { border-bottom: 1px solid #eef3ef; }
.customer-results li:last-child { border-bottom: 0; padding: 8px 12px; }
.customer-option { width: 100%; text-align: left; justify-content: flex-start; background: #fff; color: var(--ink); font-weight: 600; min-height: 44px; padding: 8px 12px; border-radius: 0; }
details.card summary { cursor: pointer; min-height: 32px; }
.bday-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid #eef3ef; }
.bday-row:last-of-type { border-bottom: 0; }
.bday-main { display: flex; flex-direction: column; min-width: 0; }
.bday-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: 0 0 auto; }
.button.wa.small-btn { min-height: 40px; padding: 6px 14px; font-size: .9rem; }
.log-row { padding: 10px 0; border-bottom: 1px solid #eef3ef; }
.log-row:last-of-type { border-bottom: 0; }
.log-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.log-text { margin: 4px 0 2px; overflow-wrap: anywhere; }
.badge.log-sale { background: #e7f4ec; color: var(--brand-dark); }
.badge.log-order { background: #fff3cd; color: #8a5a00; }
.badge.log-product { background: #e8eefc; color: #2a4a9a; }
.badge.log-customer { background: #f3e8fc; color: #6a2a9a; }
.badge.log-team, .badge.log-auth { background: #ffe1dc; color: #a33434; }
.period-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 12px; }
.period-form input { min-width: 0; width: 100%; }
@media (max-width: 720px) { .period-form { grid-template-columns: 1fr 1fr; } .period-form button { grid-column: 1 / -1; } }
.commission-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.commission-form input[name=commission_percent] { width: 5.5em; min-width: 0; text-align: right; }
.commission-form button { min-height: 40px; padding: 6px 12px; }
.commission-form label.check { flex: 1 0 100%; min-height: 32px; font-weight: 400; justify-content: inherit; }
a.wa-link { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-weight: 600; }
a.wa-link::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #25d366; flex: 0 0 auto; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; text-decoration: none; color: inherit; }
.stat strong { display: block; font-size: 1.9rem; line-height: 1.2; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 16px 0; }
.pager { display: flex; gap: 12px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.pager a { padding: 10px 4px; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid #e5eee8; }
.list-plain li:last-child { border-bottom: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; flex: 1 1 260px; min-width: 0; margin: 0; }
.inline-form input { flex: 1 1 auto; min-width: 0; }
.inline-form button { flex: 0 0 auto; }
details summary { cursor: pointer; padding: 8px 0; }
.store-plan + .store-plan { border-top: 1px solid #e5eee8; margin-top: 12px; }
.category-list { list-style: none; margin: 0; padding: 0; }
.category-list li { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid #e5eee8; }
.category-list li:last-child { border-bottom: 0; }
.category-meta { display: flex; gap: 12px; align-items: center; margin-left: auto; }
.category-meta a { white-space: nowrap; padding: 10px 0; }
.category-meta form { margin: 0; }
.list-plain li.split { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.list-plain li.split > :last-child { white-space: nowrap; }

/* ---------- POS (cashier) ---------- */
body.no-scroll { overflow: hidden; }
.pos-top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0; }
.pos-search { display: flex; gap: 8px; align-items: center; }
.pos-search input { flex: 1 1 auto; min-width: 0; }
.pos-search .button, .pos-search button { flex: 0 0 auto; }
.pos-cats { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.pos-cats::-webkit-scrollbar { display: none; }
.chip { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: 8px 14px;
  min-height: 40px; font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.pos-card { position: relative; display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 2px;
  background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 8px; font-weight: 400; }
.pos-card.empty { opacity: .5; }
.pos-img { width: 100%; aspect-ratio: 4 / 5; object-fit: contain; border-radius: 10px; background: #eef4f0; }
.placeholder { display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 700; color: var(--brand);
  background: var(--soft); }
.pos-name { font-weight: 600; line-height: 1.25; margin-top: 4px; overflow-wrap: anywhere; }
.pos-sku { font-size: .75rem; color: var(--muted); letter-spacing: .02em; }
.pos-price { font-weight: 700; color: var(--brand-dark); }
.pos-stock { font-size: .8rem; color: var(--muted); }
.pos-qty { position: absolute; top: 4px; right: 4px; background: var(--brand); color: #fff; border-radius: 99px;
  min-width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-weight: 700; padding: 0 6px; }
.pos-viewbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.pos-view { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; background: #fff; }
.pos-view button { background: none; color: var(--ink); min-height: 34px; padding: 4px 12px; font-size: .85rem; font-weight: 600; border-radius: 0; }
.pos-view button[aria-pressed="true"] { background: var(--brand); color: #fff; }
/* List view: one text line per product */
.pos-grid.list { grid-template-columns: 1fr; gap: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pos-card.pos-row { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px;
  border: 0; border-bottom: 1px solid #eef3ef; border-radius: 0; padding: 7px 12px; min-height: 48px; }
.pos-grid.list .pos-card.pos-row:last-child { border-bottom: 0; }
.pos-row-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.pos-row .pos-name { margin-top: 0; font-size: .88rem; line-height: 1.2; }
.pos-row .pos-sku { font-size: .72rem; }
.pos-row-side { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.pos-row .pos-price { white-space: nowrap; font-size: .9rem; }
.pos-row .pos-qty { min-width: 24px; height: 24px; font-size: .85rem; }
.pos-row .pos-qty { position: static; }
.pos-links { text-align: center; margin: 16px 0 90px; }
.cart-bar { position: fixed; left: 12px; right: 12px; bottom: 16px; z-index: 25; display: flex; justify-content: space-between;
  align-items: center; gap: 10px; padding: 14px 18px; border-radius: 14px; box-shadow: 0 8px 24px #0b2b2140; min-height: 56px;
  max-width: 1056px; margin: 0 auto; }
.cart-total { font-size: 1.15rem; font-weight: 800; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 150px; z-index: 60; background: #172c26ee; color: #fff;
  padding: 10px 16px; border-radius: 99px; font-weight: 600; max-width: calc(100% - 32px); text-align: center; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: #0b1f1a80; display: flex; align-items: flex-end; justify-content: center; }
.sheet { position: relative; background: #fff; width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 18px 16px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom)); max-height: 92vh; overflow-y: auto; }
.sheet-full { height: 100%; max-height: 100%; border-radius: 0; padding-bottom: 0; }
@media (min-width: 720px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 18px; } .sheet-full { height: auto; max-height: 92vh; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; position: sticky; top: -18px; background: #fff;
  margin: -18px -16px 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); z-index: 2; }
.sheet-head h2 { margin: 0; }
.sheet-close { position: absolute; top: 8px; right: 8px; background: #eef4f0; color: var(--ink); width: 44px; height: 44px;
  border-radius: 50%; font-size: 1.5rem; padding: 0; }
.sheet-head .sheet-close { position: static; }
.ps-image { display: flex; justify-content: center; margin-bottom: 8px; }
.ps-img { width: min(260px, 72vw); aspect-ratio: 4 / 5; max-height: 46vh; object-fit: contain; border-radius: 14px; background: #eef4f0; }
.ps-price { font-size: 1.6rem; font-weight: 800; color: var(--brand-dark); margin: 4px 0; }
.stepper { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.stepper button { width: 48px; font-size: 1.4rem; padding: 0; }
.stepper input { width: 80px; text-align: center; font-size: 1.2rem; }
.stepper.small { margin: 0; gap: 4px; }
.stepper.small button { width: 40px; min-height: 40px; }
.stepper.small span { min-width: 24px; text-align: center; font-weight: 700; }
.sheet-actions { display: grid; gap: 8px; }
.sticky-actions { position: sticky; bottom: 0; background: #fff; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); }
.sticky-actions button { min-height: 52px; font-size: 1.1rem; }
.co-block { padding: 12px 0; border-bottom: 1px solid #eef3ef; }
.co-block h3 { margin: 0 0 8px; font-size: 1rem; }
.co-items { list-style: none; margin: 0; padding: 0; }
.co-items li { display: grid; grid-template-columns: 44px 1fr auto; grid-template-areas: "img main step" "img main line";
  gap: 2px 10px; align-items: center; padding: 8px 0; }
.co-img { grid-area: img; width: 44px; height: 44px; border-radius: 8px; object-fit: contain; background: #eef4f0; font-size: 1.1rem; }
.co-item-main { grid-area: main; display: grid; min-width: 0; overflow-wrap: anywhere; }
.co-items .stepper { grid-area: step; justify-self: end; }
.co-line { grid-area: line; justify-self: end; font-weight: 700; }
.co-results { list-style: none; margin: 6px 0 0; padding: 0; }
.co-results li { border-bottom: 1px solid #eef3ef; }
.link-btn { background: none; color: var(--brand); padding: 10px 0; font-weight: 600; text-align: left; width: 100%; }
.co-picked { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--ok-bg); padding: 8px 12px; border-radius: 10px; }
.small-btn { min-height: 40px; padding: 6px 12px; }
.segmented { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: 0 0 auto; }
.segmented button { background: #fff; color: var(--ink); border-radius: 0; font-weight: 600; padding: 10px 14px; }
.segmented button.on { background: var(--brand); color: #fff; }
.segmented.wide { display: grid; grid-template-columns: repeat(2, 1fr); }
.segmented.wide button { border-bottom: 1px solid var(--line); }
.co-change { font-size: 1.1rem; margin: 8px 0 0; }
.co-change .bad { color: var(--danger); }
#co-quick { margin-top: 8px; }
.co-summary { padding: 12px 0; }
.co-summary p { display: flex; justify-content: space-between; margin: 4px 0; }
.co-grand { font-size: 1.3rem; font-weight: 800; }

.scanner { position: fixed; inset: 0; z-index: 70; background: #000; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; padding: 16px; }
.scanner-frame { position: relative; width: min(92vw, 480px); aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; background: #111; }
.scanner-frame video { width: 100%; height: 100%; object-fit: cover; }
.scanner-line { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: #3ee08a; box-shadow: 0 0 12px #3ee08a; }
.scanner-msg { color: #fff; text-align: center; max-width: 420px; margin: 0; }
.scanner-msg.error { color: #ffd0c8; }
.scanner-close { min-width: 160px; }

/* ---------- Sales & invoice ---------- */
.sale-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid #e5eee8;
  color: inherit; text-decoration: none; }
.sale-row:last-child { border-bottom: 0; }
.sale-row .amount { font-weight: 700; text-align: right; }
.sale-row.void .amount { text-decoration: line-through; color: var(--muted); }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.summary-grid div, .summary-grid > a { display: block; background: var(--softer); border-radius: 10px; padding: 10px; min-width: 0; }
.summary-grid strong { display: block; font-size: clamp(.95rem, 4vw, 1.25rem); white-space: nowrap; }
.receipt-lines { list-style: none; margin: 0; padding: 0; }
.receipt-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed #d5e2da; }
.receipt-lines li > span:last-child { white-space: nowrap; font-weight: 600; }
.totals p { display: flex; justify-content: space-between; margin: 4px 0; }
.totals .grand { font-size: 1.3rem; font-weight: 800; }
.big-actions { display: grid; gap: 10px; }
.big-actions .button, .big-actions button { min-height: 52px; font-size: 1.05rem; width: 100%; }
.button.wa { background: #1f9e55; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0 2px;
  padding: 10px 12px; background: var(--softer); border-radius: 10px; }
.switch { flex: 0 0 auto; position: relative; width: 56px; min-height: 32px; height: 32px; padding: 0; border-radius: 99px;
  background: #c9d6ce; transition: background .2s; }
.switch .knob { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px #0003; transition: left .2s; }
.switch.on { background: var(--brand); }
.switch.on .knob { left: 27px; }
.switch:focus-visible { outline: 3px solid #9fd3b6; outline-offset: 2px; }
.logo-header { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; background: #fff; padding: 2px; flex: 0 0 auto; }
.logo-title { width: 56px; height: 56px; border-radius: 12px; object-fit: contain; background: #fff; border: 1px solid var(--line); padding: 4px; flex: 0 0 auto; }
.store-title { display: flex; gap: 12px; align-items: center; }
.store-title h1 { margin-bottom: 8px; }
.logo-preview { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: #fff; display: block; margin: 4px 0; }
.logo-receipt { display: block; max-width: 120px; max-height: 72px; object-fit: contain; margin: 0 auto 8px; }
.receipt-head { text-align: center; }
.action-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.action-pair form { margin: 0; display: flex; }
.action-pair .button, .action-pair button { width: 100%; min-height: 52px; font-size: 1.05rem; }
.button.warn-btn { background: #fff3dc; color: #7a4d00; border: 1px solid #f0d49a; }
button.danger { border: 1px solid #f1c9c9; }
.sale-item { display: flex; gap: 10px; align-items: center; border-bottom: 1px solid #e5eee8; }
.sale-item:last-child { border-bottom: 0; }
.sale-item .sale-row { flex: 1 1 auto; border-bottom: 0; min-width: 0; }
.sale-item form { margin: 0; flex: 0 0 auto; }
.sale-item .row-btn { white-space: nowrap; flex: 0 0 auto; min-height: 40px; padding: 6px 12px; font-size: .9rem; }
.sale-row strong { white-space: nowrap; }
@media (max-width: 719px) {
  .sale-item .sale-row { grid-template-columns: 1fr; }
  .sale-item .sale-row .amount { text-align: left; grid-row: 2; }
}
.product-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: contain; background: #eef4f0; float: left; margin-right: 10px; }
.image-preview { width: auto; height: auto; max-width: min(220px, 100%); max-height: 220px; border-radius: 12px; object-fit: contain; display: block; margin: 4px 0; }
.input-with-button { display: flex; gap: 8px; }
.input-with-button input { flex: 1 1 auto; min-width: 0; }

/* ---------- Phones ---------- */
@media (max-width: 719px) {
  header.top nav.main { display: none; }
  header.top { gap: 8px; }
  .cart-bar { bottom: calc(var(--bottom-nav) + 10px + env(safe-area-inset-bottom)); }
  .pos-grid { grid-template-columns: repeat(2, 1fr); }
  .toast { bottom: calc(var(--bottom-nav) + 84px); }
  header.top .brand-long { display: none; }
  .bottom-nav { display: grid; }
  main { margin: 16px auto; padding-bottom: calc(var(--bottom-nav) + 24px + env(safe-area-inset-bottom)); }
  .card { padding: 14px; border-radius: 12px; margin: 12px 0; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat strong { font-size: 1.6rem; }
  .quick-actions { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .quick-actions .button { padding: 10px 6px; font-size: .95rem; }
  .toolbar { align-items: stretch; }
  .toolbar > .actions { width: 100%; }
  .toolbar > .actions > .button, .toolbar > .button { flex: 1; }
  .filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .filters input, .filters select, .filters button { min-width: 0; width: 100%; padding-left: 10px; padding-right: 10px; }
  .filters input[type=search] { grid-column: 1 / 4; }
  .filters button { grid-column: 4; grid-row: 1; }
  .filters select:first-of-type { grid-column: 1 / 3; }
  .filters select:nth-of-type(2) { grid-column: 3 / 5; }
  .filters select:only-of-type, .filters .full-row { grid-column: 1 / 5; }
  .form-actions > button, .form-actions > .button { flex: 1 1 100%; }
  .form-actions > a { width: 100%; text-align: center; }

  /* Tables turn into stacked cards: each cell shows its column name from data-label. */
  .table-wrap { overflow: visible; }
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
  table.cards td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-align: right; white-space: normal; }
  table.cards td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; flex: 0 0 auto; }
  table.cards td.primary { display: block; text-align: left; font-size: 1.05rem; padding-bottom: 6px; }
  table.cards td.primary::before, table.cards td.row-actions::before { content: none; }
  table.cards td.row-actions { width: 100%; white-space: normal; justify-content: flex-start; padding-top: 8px; margin-top: 4px; border-top: 1px solid #eef3ef; }
  table.cards td.row-actions .actions { width: 100%; flex-wrap: wrap; justify-content: stretch; }
  table.cards td.row-actions .actions > * { flex: 1; }
  table.cards td.row-actions .actions > a { text-align: center; border-radius: 10px; background: var(--soft); color: var(--ink); font-weight: 700; text-decoration: none; }
  table.cards td.row-actions .actions button { width: 100%; }
  table.cards td.hide-mobile { display: none; }
  table.cards tfoot { display: block; }
  table.cards tfoot tr { background: var(--softer); }
  table.cards td:empty { display: none; }
  table.cards td .commission-form { width: 100%; justify-content: flex-end; }
}

/* ---------- Printing (kept last so it beats the phone rules: A4's printable width is < 720px) ---------- */
@page { size: auto; margin: 10mm; }
@media print {
  html, body, :root { background: #fff !important; min-height: 0 !important; height: auto !important; }
  header.top, .bottom-nav, .cart-bar, .no-print, .notice, .toast, .sheet-backdrop, .scanner { display: none !important; }
  main, .invoice { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .card { border: 0 !important; box-shadow: none !important; padding: 0 !important; margin: 0 !important; }
  .receipt { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

.install-card { border-color: #cfe3d7; }
.install-row { display: flex; gap: 12px; align-items: center; }
.install-row img { border-radius: 12px; flex: 0 0 auto; border: 1px solid var(--line); }

.delivery-box { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #f3f7f4; }
.delivery-box p { margin: 0 0 4px; }
.delivery-fields { padding: 12px; border-radius: 12px; background: #f3f7f4; }
.sell-tabs { margin: 0 0 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px; }
.sell-tabs a { flex: 0 0 auto; padding: 6px 12px; min-height: 36px; font-size: .9rem; }
.refund-box { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: #f3f7f4; }

.billing-summary > div { display: flex; flex-direction: column; gap: 2px; }
.bill-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.bill-row:first-of-type { border-top: 0; }
.bill-row.needs { box-shadow: inset 3px 0 0 #e0a100; padding-left: 10px; }
.bill-main .badge { margin: 4px 6px 0 0; }
.bill-money { text-align: right; display: flex; flex-direction: column; }
.bill-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bill-actions form { margin: 0; }
@media (max-width: 560px) { .bill-row { grid-template-columns: 1fr; } .bill-money { text-align: left; } }
.segmented-radio { display: flex; gap: 16px; flex-wrap: wrap; }
.day-bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; overflow-x: auto; padding-top: 4px; }
.day-bar { flex: 1 0 14px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.day-bar .bar { width: 100%; min-height: 2px; background: var(--brand); border-radius: 4px 4px 0 0; }
.day-bar .small { font-size: .65rem; }
.backdate-block { background: #fff6e0; border-radius: 12px; padding: 12px; }
.co-price-label { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.co-price { width: 110px; padding: 4px 8px; min-height: 32px; }
#pos-backdate-toggle[aria-pressed="true"] { background: #e0a100; color: #fff; }

/* Loading feedback for slow pages: a thin bar at the top, a spinner in the tapped button, and after a while a
   small "Memuat…" card. Added by base.html after a short delay so fast pages never flicker. */
.load-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 1000; overflow: hidden; pointer-events: none;
  opacity: 0; transition: opacity .15s; }
.load-bar::before { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--brand);
  border-radius: 3px; box-shadow: 0 0 8px rgba(20, 118, 87, .5); animation: load-slide 1.1s ease-in-out infinite; }
html.is-loading .load-bar { opacity: 1; }
@keyframes load-slide { 0% { left: -40%; width: 40%; } 50% { width: 55%; } 100% { left: 100%; width: 40%; } }
.spinner { display: inline-block; width: 1em; height: 1em; flex: none; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -0.15em; }
@keyframes spin { to { transform: rotate(360deg); } }
.load-card { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 1001; display: flex; align-items: center;
  gap: 10px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px;
  box-shadow: 0 10px 30px rgba(18, 76, 60, .18); font-weight: 600; opacity: 0; visibility: hidden; transition: opacity .2s; }
.load-card .spinner { width: 22px; height: 22px; border-width: 3px; color: var(--brand); }
html.is-slow .load-card { opacity: 1; visibility: visible; }
html.is-slow main { opacity: .55; transition: opacity .2s; }
@media (prefers-reduced-motion: reduce) {
  .load-bar::before { animation: none; left: 0; width: 100%; opacity: .7; }
  .spinner { animation-duration: 2s; }
}

/* PO flow: Dipesan -> Barang diantar/diambil -> Invoice terkirim -> Lunas -> Tutup. */
.po-steps { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 0; padding: 0; }
.po-steps li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; position: relative;
  font-size: .72rem; color: var(--muted); line-height: 1.2; }
.po-steps li::before { content: ""; position: absolute; top: 12px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.po-steps li:first-child::before { display: none; }
.po-steps li.done::before, .po-steps li.next::before { background: var(--brand); }
.po-steps .dot { position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 2px solid var(--line); font-weight: 700; font-size: .78rem; }
.po-steps li.done { color: var(--brand-dark); }
.po-steps li.done .dot { background: var(--brand); border-color: var(--brand); color: #fff; }
.po-steps li.next { color: var(--ink); font-weight: 700; }
.po-steps li.next .dot { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 3px var(--ok-bg); }
.po-steps.compact { margin-top: 6px; max-width: 220px; }
.po-steps.compact .label { display: none; }
.po-steps.compact .dot { width: 18px; height: 18px; font-size: .62rem; border-width: 1.5px; }
.po-steps.compact li::before { top: 8px; }

/* Back-dated PO: always stands out. */
.backdate-box { border-left: 4px solid var(--danger); }
.backdate-item { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 10px; }
.backdate-item .action-pair input { width: 100%; margin-bottom: 6px; }

/* Team page: sections a staff member may open */
.sections-box { margin-top: 8px; }
.sections-box summary { cursor: pointer; font-size: .92rem; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-weight: normal; }
.check-row input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.role-pick { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 0; display: grid; gap: 8px; }
.role-pick legend { font-weight: 600; padding: 0 4px; }
.role-row { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 8px; }
.role-row label.check { display: inline-flex; gap: 6px; align-items: center; font-weight: normal; }
.role-row input[type=checkbox] { width: 20px; height: 20px; }

/* ---------- Beranda ---------- */
.dash-hero { display: block; background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff;
  border-radius: 18px; padding: 18px 18px 16px; margin: 0 0 14px; box-shadow: 0 10px 28px #124c3c33; }
.hero-top { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; opacity: .85; }
.hero-amount { display: block; color: #fff; text-decoration: none; font-size: clamp(1.9rem, 9vw, 2.6rem); font-weight: 800;
  letter-spacing: -.02em; line-height: 1.15; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.hero-sub { font-size: .85rem; opacity: .85; }
.meter { display: flex; height: 8px; border-radius: 99px; background: #ffffff33; overflow: hidden; margin: 14px 0 8px; }
.meter span { background: #8ff0c0; border-radius: 99px; }
.meter-legend { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .85rem; }
.hero-chip { display: inline-block; margin-top: 12px; background: #ffffff22; border-radius: 99px; padding: 5px 12px; font-size: .85rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.card-head h2 { margin: 0; font-size: 1.05rem; }
.card-head .total { font-weight: 800; font-size: 1.15rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.srow { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 12px; align-items: center; gap: 10px;
  padding: 11px 4px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; min-height: 52px; }
.srow:first-child { border-top: 0; }
a.srow:hover { background: var(--softer); }
.srow-dot { width: 10px; height: 10px; border-radius: 50%; background: #b8c9bf; }
.srow.ok .srow-dot, .stackbar .ok { background: #1f9d6b; }
.srow.warn .srow-dot, .stackbar .warn { background: #e8a317; }
.srow.info .srow-dot, .stackbar .info { background: #3b74d6; }
.srow.bad .srow-dot { background: var(--danger); }
.srow-label { font-weight: 600; line-height: 1.3; }
.srow-n { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--soft); color: var(--ink);
  font-size: .75rem; font-weight: 700; text-align: center; vertical-align: 2px; }
.srow.warn .srow-n { background: var(--warn-bg); color: #8a5a00; }
.srow-sub { display: block; color: var(--muted); font-size: .8rem; }
.srow-amt { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.srow-go { color: var(--muted); font-size: 1.3rem; line-height: 1; }
.stackbar { display: flex; gap: 2px; height: 10px; border-radius: 99px; overflow: hidden; background: #eef3ef; margin: 8px 0 4px; }
.howto summary { color: var(--muted); font-size: .85rem; cursor: pointer; margin-top: 8px; min-height: 32px; display: flex; align-items: center; }
.howto p { margin: 4px 0 0; }

/* ---------- Theme colour picker (Pengaturan toko) ---------- */
.theme-pick { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }
.theme-pick legend { font-weight: 600; padding: 0 4px; }
.theme-pick label { cursor: pointer; }
.theme-auto { display: flex; gap: 10px; align-items: center; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.swatches label { display: grid; justify-items: center; gap: 4px; padding: 8px 4px; border-radius: 10px; border: 2px solid transparent; text-align: center; }
.swatches label:has(input[type=radio]:checked), .theme-auto:has(input:checked) { border-color: var(--brand); background: var(--softer); }
.theme-auto { border: 2px solid transparent; border-radius: 10px; padding: 8px; }
.theme-pick input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-pick input[type=radio]:focus-visible + .swatch { outline: 3px solid var(--brand); outline-offset: 2px; }
.swatch { display: inline-block; width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 2px #ffffff88, 0 1px 3px #0003; flex: 0 0 auto; }
.swatches input[type=color] { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.theme-pick label { font-weight: 500; }
.swatches input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.swatches input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; box-shadow: inset 0 0 0 2px #ffffff88; }
.swatches input[type=color]::-moz-color-swatch { border: 0; border-radius: 50%; }

/* ---------- Phones with a large system text size ---------- */
/* Nothing may make the page wider than the screen: the fixed bottom menu would stretch past the edge with it. */
html { overflow-x: hidden; overflow-x: clip; }
.card-head { flex-wrap: wrap; }
.card-head .total { margin-left: auto; }
@media (max-width: 719px) {
  .stats, .quick-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quick-actions .button { white-space: normal; overflow-wrap: anywhere; text-align: center; line-height: 1.2; }
  .stat strong { overflow-wrap: anywhere; }
  header.top .brand { min-width: 0; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
  header.top button.link { flex: 0 0 auto; padding-left: 2px; padding-right: 2px; }
}
.split > * { min-width: 0; overflow-wrap: anywhere; }
.stat { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 719px) {
  header.top .tools { min-width: 0; }
  header.top .store-name { min-width: 0; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  header.top .tools form { flex: 0 0 auto; }
}
.srow-amt { white-space: normal; text-align: right; }
.srow-go { justify-self: end; }
/* Rows wrap instead of squeezing: with large text the amount moves under the label. */
.srow { display: flex; flex-wrap: wrap; column-gap: 10px; row-gap: 2px; }
.srow-dot { flex: 0 0 10px; }
.srow-main { flex: 1 1 6em; min-width: 0; overflow-wrap: anywhere; }
.srow-amt { margin-left: auto; white-space: nowrap; max-width: 100%; overflow-wrap: anywhere; }
.srow-go { flex: 0 0 12px; text-align: right; }
.card-head .total { max-width: 100%; overflow-wrap: anywhere; }
/* Bottom menu: every item gets an equal share of the screen, whatever the phone's text size. */
.bottom-nav { width: 100%; max-width: 100vw; overflow: hidden; }
.bottom-nav a { min-width: 0; padding: 0 2px; font-size: clamp(10px, 3.1vw, .75rem); }
.bottom-nav .bn-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 400px) { header.top:has(.store-name) .brand { display: none; } }
/* Long text wraps instead of pushing the page wider than the phone. */
main { overflow-wrap: break-word; }
fieldset { min-width: 0; }
input[type=file] { max-width: 100%; min-width: 0; }
.summary-grid { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); }
.summary-grid strong { white-space: normal; overflow-wrap: anywhere; }
/* Grid/flex children may shrink below their text width, so long names wrap inside the card. */
form.stack > *, label, .row > * { min-width: 0; }
.row { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.sale-row { grid-template-columns: minmax(0, 1fr) auto; }
.sale-row > * { min-width: 0; overflow-wrap: anywhere; }
.sale-row strong { white-space: normal; overflow-wrap: break-word; }
.sale-row > :nth-child(even) { text-align: right; }
.list-plain li.split > :last-child { white-space: normal; text-align: right; }
.po-steps { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.po-steps li, .po-steps .label { min-width: 0; overflow-wrap: anywhere; }
