:root {
  --bg: #0f1420;
  --panel: #171e2e;
  --panel2: #1f2838;
  --border: #2a3448;
  --text: #e8ecf4;
  --muted: #8d97ab;
  --accent: #4f8cff;
  --green: #35c488;
  --red: #ff5d6c;
  --amber: #f5b942;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  padding-top: env(safe-area-inset-top, 0px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
}
.topbar .brand { color: var(--text); font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.topbar .logout { color: var(--muted); text-decoration: none; font-size: 0.9rem; }

.content { max-width: 720px; margin: 0 auto; padding: 16px; }

.flash {
  background: #233047;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.flash p { margin: 0; }

h1 { font-size: 1.4rem; margin: 4px 0 16px; }
h2 { font-size: 1.05rem; color: var(--muted); margin: 24px 0 10px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.kpi .label { color: var(--muted); font-size: 0.78rem; margin-bottom: 4px; }
.kpi .value { font-size: 1.25rem; font-weight: 700; }
.kpi .value.pos { color: var(--green); }
.kpi .value.neg { color: var(--red); }

form { display: flex; flex-direction: column; gap: 14px; }
label { font-size: 0.85rem; color: var(--muted); display: block; margin-bottom: 6px; }
input, select, textarea {
  width: 100%;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  color: var(--text);
  font-size: 1rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); }
.field-row { display: flex; gap: 10px; }
.field-row > div { flex: 1; min-width: 0; }
.field-row input, .field-row select { max-width: 100%; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; color: var(--text); font-size: 0.9rem; }

button, .btn {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 1.02rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  display: block;
  cursor: pointer;
}
button.secondary, .btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
button.danger { background: var(--red); }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.row-tappable { cursor: pointer; }
.row-tappable:active { background: var(--panel2); }

.reorder-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.reorder-row:last-child { border-bottom: none; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.pill.in-stock { background: #3a1f24; color: var(--red); }
.pill.partial { background: #3a2f16; color: var(--amber); }
.pill.sold-out { background: #163a2a; color: var(--green); }
.pill.preorder { background: #1e2a3f; color: var(--accent); }

.money.pos { color: var(--green); }
.money.neg { color: var(--red); }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 90vh; }
.login-card { width: 100%; max-width: 340px; }

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 10;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 0 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.65rem;
  white-space: nowrap;
}
.tabbar a span { font-size: 1.1rem; }
.tabbar a.active { color: var(--accent); }

.export-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.export-links a { font-size: 0.82rem; color: var(--accent); text-decoration: none; }

.small-muted { color: var(--muted); font-size: 0.8rem; }

.icon-btn-row { display: flex; gap: 8px; align-items: center; }
.icon-btn-row button { padding: 6px 10px; font-size: 0.8rem; }
.icon-btn-row a.btn.secondary {
  display: inline-block;
  width: auto;
  padding: 6px 10px;
  font-size: 0.8rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.chart-row { display: flex; gap: 14px; flex-wrap: wrap; }
.chart-half { flex: 1 1 260px; min-width: 0; }

/* Mobile-friendly list cards (used on Purchases, Sales, Products) */
.list-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.list-card .lc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.list-card .lc-title { font-weight: 700; font-size: 0.98rem; line-height: 1.3; }
.list-card .lc-date { color: var(--muted); font-size: 0.78rem; white-space: nowrap; margin-top: 2px; }
.list-card .lc-meta { color: var(--muted); font-size: 0.82rem; margin-bottom: 10px; }
.list-card .lc-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.list-card .lc-stats.cols-4 { grid-template-columns: repeat(4, 1fr); }
.list-card .lc-stat .lc-label { color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; }
.list-card .lc-stat .lc-value { font-size: 0.95rem; font-weight: 600; }
.list-card .lc-footer { display: flex; justify-content: space-between; align-items: center; }
.list-card form { display: block; }
.list-card button.secondary { padding: 5px 10px; font-size: 0.75rem; }

.filter-bar { display: flex; gap: 8px; margin-bottom: 14px; }
.filter-bar input { flex: 2; }
.filter-bar select { flex: 1; }

.sort-toggle { display: flex; gap: 8px; margin-bottom: 14px; }
.sort-toggle button { padding: 7px 12px; font-size: 0.8rem; width: auto; }
.sort-toggle button.active { background: var(--accent); color: white; border-color: var(--accent); }

.lc-img-wrap { flex-shrink: 0; }
.lc-img, .lc-img-placeholder {
  width: 52px; height: 52px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--panel2);
  border: 1px solid var(--border);
}
.lc-img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.list-card .lc-top { align-items: center; }

.image-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.image-form input[type="url"] { font-size: 0.85rem; }
.quick-search-links { display: flex; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.quick-search-links a { color: var(--accent); text-decoration: none; font-size: 0.82rem; }

.segbar { display: flex; height: 10px; border-radius: 4px; overflow: hidden; gap: 2px; background: var(--panel2); }
.segbar-seg { min-width: 3px; }
.segbar-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.72rem; color: var(--muted); margin-top: 8px; }
.segbar-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* Searchable product picker (sale + purchase forms) */
.picker { position: relative; }
.picker-box { position: relative; }
.picker-box input { padding-right: 44px; }
.picker-clear {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; padding: 0; margin: 0;
  background: none; border: 0; color: var(--muted); font-size: 1.4rem; line-height: 1;
  cursor: pointer;
}
.picker-list {
  list-style: none; margin: 6px 0 0; padding: 4px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 10px;
  max-height: 46vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.picker-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 10px; border-radius: 8px; cursor: pointer; font-size: 0.95rem;
}
.picker-list li + li { border-top: 1px solid var(--border); }
.picker-list li.active, .picker-list li[role="option"]:hover { background: var(--panel); }
.picker-name { min-width: 0; overflow-wrap: anywhere; }
.picker-stock { flex: none; color: var(--green); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.picker-stock.out { color: var(--muted); }
.picker-none { color: var(--muted); cursor: default; }
.picker-msg { margin: 6px 0 0; }

/* Import review */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.imp-bulk { margin-bottom: 14px; }
.imp-row { display: block; }
.imp-row.imp-duplicate, .imp-row.imp-unmatched { border-color: var(--amber); }
.imp-note { background: var(--panel2); border-radius: 10px; padding: 10px 12px; font-size: 0.85rem; margin-bottom: 10px; }
.imp-note.warn { background: #3a2f16; color: #ffe2a3; }
.imp-field { margin-bottom: 10px; }
.imp-nearby { margin: 0 0 10px; }
.imp-details { margin-bottom: 12px; }
.imp-details summary { color: var(--muted); font-size: 0.85rem; cursor: pointer; padding: 6px 0; }
.imp-details .field-row { margin-top: 10px; }
.imp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.imp-actions button { flex: 1 1 auto; width: auto; padding: 10px 12px; font-size: 0.9rem; }
.list-card.imp-row button.secondary { padding: 10px 12px; font-size: 0.9rem; }
.imp-handled .reorder-row { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.imp-handled .reorder-row button { width: auto; padding: 6px 10px; font-size: 0.8rem; flex: none; }
.imp-handled .reorder-row > span { min-width: 0; overflow-wrap: anywhere; font-size: 0.88rem; }
input[type="file"] { padding: 10px; }
.imp-edit { padding: 6px 10px; font-size: 0.8rem; flex: none; }
.reorder-row > span { min-width: 0; overflow-wrap: anywhere; }

/* Expenses: always amber, so they can't be mistaken for sales figures */
.kpi.exp { border-left: 3px solid var(--amber); }
.kpi.exp .value { color: var(--amber); }
.kpi .small-muted { margin-top: 2px; }
.money.exp { color: var(--amber); }
.exp-kpis { margin: 14px 0 0; }
.cat-row { margin-bottom: 12px; }
.cat-row:last-child { margin-bottom: 0; }
.cat-head { display: flex; justify-content: space-between; gap: 10px; font-size: 0.88rem; margin-bottom: 5px; }
.cat-track { background: var(--panel2); border-radius: 4px; height: 8px; }
.cat-bar { background: var(--amber); height: 100%; border-radius: 4px; }
a.rep-row { color: inherit; text-decoration: none; gap: 10px; }
a.rep-row.ended { opacity: 0.55; }
.rep-row .small-muted { display: block; }
.rep-amount { flex: none; font-weight: 700; color: var(--amber); white-space: nowrap; }
.rep-amount .small-muted { display: inline; font-weight: 400; }
.rate-row { flex-direction: row; }
.rate-right { display: flex; align-items: center; gap: 10px; flex: none; }
.rate-right button { width: auto; padding: 5px 10px; font-size: 0.75rem; }
.order-no { font-variant-numeric: tabular-nums; color: var(--text); }

/* Brand */
.topbar .brand { display: flex; align-items: center; gap: 9px; letter-spacing: 0.02em; }
.topbar .brand img { display: block; }
.login-logo { display: block; width: 100%; max-width: 250px; height: auto; margin: 6px auto 4px; }
.login-title { text-align: center; font-size: 0.85rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; margin: 0 0 18px; }

/* iPhone: date boxes otherwise size themselves and spill over the next field */
input[type="date"] {
  -webkit-appearance: none; appearance: none;
  display: block; min-width: 0; max-width: 100%; height: 46px; line-height: 1.2;
  text-align: left;
}
input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
.field-row > div { overflow: hidden; }
.field-row input:focus, .field-row select:focus { outline-offset: -2px; }
.imp-actions .imp-wide { flex-basis: 100%; }
.imp-help { margin: 0 0 10px; }

/* Settings: purchase sources */
.src-row { border-bottom: 1px solid var(--border); }
.src-row:last-of-type { border-bottom: none; }
.src-row summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; cursor: pointer; list-style: none; }
.src-row summary::-webkit-details-marker { display: none; }
.src-edit { padding: 0 0 14px; gap: 10px; }

/* Stock check sheet */
.sc-head { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; }
.sc-title { font-weight: 700; font-size: 1.05rem; }
.sc-sub { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.sc-table { font-size: 0.9rem; }
.sc-table th, .sc-table td { white-space: normal; vertical-align: middle; padding: 8px 6px; }
.sc-c-img { width: 60px; }
.sc-c-img img, .sc-noimg { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; background: var(--panel2); display: block; }
.sc-name { font-weight: 600; line-height: 1.3; overflow-wrap: break-word; }
.sc-meta { color: var(--muted); font-size: 0.75rem; margin-top: 2px; }
.sc-num { text-align: center; width: 76px; font-variant-numeric: tabular-nums; }
.sc-expected { font-weight: 700; font-size: 1.05rem; }
.sc-count { width: 64px; padding: 8px 4px; text-align: center; }
.sc-diff { font-weight: 700; }
tr.sc-off .sc-diff { color: var(--red); }
tr.sc-ok .sc-diff { color: var(--green); }
.sc-foot { margin-top: 16px; }
.sc-result { font-weight: 600; margin-bottom: 10px; }
.sc-sign { display: none; }
.sc-note { color: var(--muted); font-size: 0.78rem; }
.sc-line { display: inline-block; border-bottom: 1px solid currentColor; width: 200px; margin: 0 14px 0 8px; }
.sc-line.short { width: 110px; }

/* Phone: product name on its own line, the three numbers underneath */
@media screen and (max-width: 640px) {
  .sc-table thead { display: none; }
  .sc-table tbody tr { display: grid; grid-template-columns: 60px repeat(3, 1fr); column-gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .sc-table td { border: 0; padding: 0; width: auto; }
  .sc-c-img { grid-row: 1 / span 2; align-self: start; }
  .sc-c-name { grid-column: 2 / -1; padding-bottom: 8px !important; }
  .sc-num { text-align: left; display: flex; flex-direction: column; gap: 3px; min-height: 58px; }
  .sc-num::before { content: attr(data-label); color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
  .sc-expected, .sc-diff { font-size: 1.15rem; }
  .sc-count { width: 100%; max-width: 84px; text-align: left; padding: 8px 10px; }
}

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  html, body { background: #fff !important; color: #000 !important; padding: 0 !important; }
  .topbar, .tabbar, .flash, .no-print { display: none !important; }
  .content { max-width: none; padding: 0; }
  .sc-head { margin-top: 0; }
  .sc-sub, .sc-meta, .sc-note { color: #444 !important; }
  .sc-table { font-size: 10.5pt; border-collapse: collapse; width: 100%; }
  .sc-table thead { display: table-header-group; }
  .sc-table th { color: #000; border-bottom: 1.5pt solid #000; font-size: 8.5pt; }
  .sc-table td { border-bottom: 0.5pt solid #999; padding: 4pt 5pt; }
  .sc-table tr { break-inside: avoid; page-break-inside: avoid; }
  .sc-c-img img, .sc-noimg { background: #fff; border: 0.5pt solid #ccc; width: 13mm; height: 13mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sc-count { background: #fff !important; color: #000 !important; border: 0.75pt solid #000 !important; border-radius: 0; width: 18mm; height: 9mm; font-size: 11pt; -moz-appearance: textfield; }
  .sc-count::-webkit-outer-spin-button, .sc-count::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .sc-diff { border-left: 0.5pt solid #999; color: #000 !important; }
  tr.sc-off .sc-diff, tr.sc-ok .sc-diff { color: #000 !important; }
  .sc-sign { display: block; margin: 10mm 0 4mm; font-size: 10pt; }
  .sc-result:empty { display: none; }
}

/* Sealed collection */
.held { color: #c9a2ff; }
.kpi.held { border-left: 3px solid #a678f0; }
.kpi-unit { font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.icon-btn-row a.btn { padding: 5px 10px; font-size: 0.75rem; }
.pos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.pos-grid .kpi { padding: 10px 12px; }
.pos-grid .kpi .value { font-size: 1.4rem; }
.move-row { flex-direction: row; align-items: center; gap: 10px; }
.move-row > span { min-width: 0; }
.move-row .small-muted { display: block; }
.move-row button { width: auto; padding: 5px 10px; font-size: 0.75rem; flex: none; }
.sc-tag { display: inline-block; padding: 1px 7px; border-radius: 999px; background: #2b2140; color: #c9a2ff; font-weight: 600; margin-right: 4px; }
@media print { .sc-tag { background: none; color: #000 !important; border: 0.75pt solid #000; } }

/* Messages stay in view wherever you are on the page */
.flash { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 66px); z-index: 9; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); }
@media print { .flash { position: static; } }
#productList .list-card { scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 150px); }
.list-card.just-saved { border-color: var(--accent); }
.img-form { display: flex; flex-direction: column; gap: 6px; }
.img-form label { margin: 6px 0 0; }
.img-form .field-row { margin-top: 8px; }

/* Product details panel on the Products page */
.pd-panel { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 4px; }
.pd-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 14px 0 6px; }
.pd-head h3 { margin: 0; font-size: 0.95rem; }
.pd-head h3 .small-muted { font-weight: 400; margin-left: 6px; }
.pd-head a.btn, .pd-actions a.btn, .pd-actions button { padding: 5px 10px; font-size: 0.75rem; width: auto; }
.pd-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.pd-row:last-of-type { border-bottom: none; }
.pd-main { min-width: 0; flex: 1; }
.pd-line1 { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; font-size: 0.9rem; }
.pd-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.pd-line2 { color: var(--muted); font-size: 0.78rem; margin-top: 3px; overflow-wrap: anywhere; }
.pd-notes { margin-top: 2px; font-style: italic; }
.pd-actions { display: flex; gap: 6px; flex: none; }
.pd-edit { margin-top: 12px; }
.pd-edit summary { color: var(--muted); font-size: 0.85rem; cursor: pointer; padding: 6px 0; }
.pd-edit form { margin-top: 8px; }

/* retailer orders (update 20) */
.pd-order { margin-top: 2px; }
.pd-order a, .list-card .lc-meta a { color: var(--accent); overflow-wrap: anywhere; }
.card a:not(.btn), .imp-note a { color: var(--accent); }

/* dashboard: awaiting delivery, grouped by product (update 25) */
.await-card { padding-top: 4px; padding-bottom: 4px; }
.await-row { border-bottom: 1px solid var(--border); padding: 10px 0; }
.await-row:last-child { border-bottom: none; }
.await-row summary { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; cursor: pointer; list-style: none; }
.await-row summary::-webkit-details-marker { display: none; }
.await-name { font-weight: 600; font-size: 0.92rem; line-height: 1.3; overflow-wrap: anywhere; }
.await-qty { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; text-align: right; }
.await-meta { grid-column: 1 / -1; }
.await-orders { margin-top: 8px; padding-left: 10px; border-left: 2px solid var(--border); display: grid; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.await-order { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.await-order > span { min-width: 0; overflow-wrap: anywhere; }
.await-order a.btn { width: auto; flex: none; padding: 4px 10px; font-size: 0.75rem; }
.await-orders a { color: var(--accent); }

/* dashboard: spending on stock and stock held over time (update 26) */
a.kpi.kpi-link { display: block; color: inherit; text-decoration: none; }
a.kpi.kpi-link:active { border-color: var(--accent); }
.chart-title { font-weight: 600; font-size: 0.92rem; margin-bottom: 10px; }
.chart-title .small-muted { font-weight: 400; }
.src-bar { margin-bottom: 10px; }
.src-bar:last-child { margin-bottom: 0; }
.src-bar-head { display: flex; justify-content: space-between; gap: 10px; font-size: 0.85rem; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.src-bar-track { height: 8px; }
.src-bar-fill { height: 8px; border-radius: 0 4px 4px 0; background: #ff8a5c; }

/* same-day batches of orders / purchases (updates 27-28) */
.batch { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 12px 4px; margin-bottom: 14px; background: #131a28; }
.batch > summary { display: grid; gap: 3px; cursor: pointer; list-style: none; padding-bottom: 8px; }
.batch > summary::-webkit-details-marker { display: none; }
.batch > summary::before { content: "▸"; color: var(--muted); position: absolute; right: 26px; }
.batch[open] > summary::before { content: "▾"; }
.batch-title { font-weight: 700; font-size: 0.98rem; padding-right: 24px; }
.batch-items { display: grid; gap: 1px; font-size: 0.82rem; overflow-wrap: anywhere; }
.batch-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 8px; }
.batch-tools button { width: auto; padding: 8px 14px; font-size: 0.85rem; }
.batch-order { border-top: 1px solid var(--border); padding: 10px 0; font-size: 0.86rem; }
.batch-order-top { margin-bottom: 4px; font-weight: 600; }
.batch-order a { color: var(--accent); overflow-wrap: anywhere; }
.batch-strong { color: var(--text); overflow-wrap: anywhere; }
.batch .list-card { margin-bottom: 10px; }
.batch { position: relative; }
.batch > summary::before { right: 14px; top: 12px; }
.sort-toggle { flex-wrap: wrap; align-items: center; }

/* update 37: tick boxes + floating bar shared by Orders, Purchases and Repayments */
.ord-pick { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 0.85rem; color: var(--muted); cursor: pointer; }
.ord-pick input { width: 22px; height: 22px; flex: none; }
.ord-float { position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 76px); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.ord-float[hidden] { display: none; }
.ord-float button { width: auto; padding: 8px 14px; flex: none; }
.ord-float select { width: auto; min-width: 0; flex: 1 1 auto; margin: 0; }
.ord-float > span { flex: none; font-size: 0.85rem; }
.sort-toggle a.btn { padding: 7px 12px; font-size: 0.8rem; width: auto; }
.pill.personal { background: #2f2440; color: #c9a2ff; margin-left: 4px; }
.rp-line { display: flex; align-items: flex-start; gap: 10px; border-top: 1px solid var(--border); padding: 9px 0; font-size: 0.86rem; }
.rp-line input[type=checkbox] { width: 22px; height: 22px; flex: none; margin: 0; }
.rp-line .rp-what { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.rp-line .rp-amt { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
.rp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rp-head h3 { margin: 0; font-size: 1rem; }
form.rp-inline, .rp-inline { display: flex; flex-direction: row; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.rp-inline input { width: auto; flex: 1 1 120px; min-width: 0; margin: 0; }
.rp-inline button { width: auto; flex: none; }
.pill.rp-open { background: #3a2f16; color: var(--amber); }
.pill.rp-done { background: #163a2a; color: var(--green); }

/* update 43: Orders tab badge */
.tabbar a .tab-icon { position: relative; display: inline-block; }
.tab-badge { position: absolute; top: -6px; right: -12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #ff5c5c; color: #fff; font-size: 0.65rem; font-weight: 700; line-height: 18px; text-align: center; }
.ord-jump { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.ord-jump a { display: inline-flex; gap: 6px; align-items: center; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); text-decoration: none; font-size: 0.82rem; }
.ord-jump a b { color: var(--accent); }
.ord-jump a.hot { border-color: #ff5c5c; }
.ord-jump a.hot b { color: #ff8a8a; }

/* update 44: eBay reconciliation */
.rec-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.86rem; }
.rec-table td { padding: 4px 0; border-bottom: 1px solid var(--border); white-space: normal; }
.rec-table .num { text-align: right; white-space: nowrap; padding-left: 10px; font-variant-numeric: tabular-nums; }
.rec-table .rec-total td { font-weight: 700; }
form.rp-line { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }

/* update 46 */
form.deliver-form { margin-top: 8px; }
form.deliver-form button { width: auto; padding: 6px 12px; }

/* update 49: Products "In hand only" */
.lc-stat.show-inhand { display: none; }
body.inhand-mode .lc-stat.show-inhand { display: block; }
body.inhand-mode .lc-stat.show-all { display: none; }

/* update 51: product mismatch on review cards; collector names */
.ord-item.mismatch { border-left: 3px solid #ff5c5c; padding-left: 10px; }
form.has-mismatch { border-color: #ff5c5c !important; }
.mm-count { color: #ff8a8a; font-weight: 600; }
.col-chip { display: inline-block; margin: 0 4px 8px 0; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 0.75rem; color: var(--accent); text-decoration: none; }
.col-chip.done { color: var(--green); }
.ord-float input[type=text] { flex: 1 1 auto; min-width: 0; margin: 0; width: auto; }
