/* Shopper. One stylesheet, phone first. The one loud thing is the shelf-edge price label; everything else stays quiet. */

:root {
  --paper: #f3f5f2;
  --surface: #ffffff;
  --ink: #17201b;
  --muted: #5d6963;
  --line: #d9e0db;
  --shelf: #ffd84a; /* promo shelf-label yellow */
  --shelf-ink: #17201b;
  --barbora: #cf4a2a;
  --rimi: #2b5ca6;
  --best: #1f7546;
  --error: #b42318;
  --focus: #2b5ca6;
  --radius: 6px;
  --display: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111613;
    --surface: #19201c;
    --ink: #e8ede9;
    --muted: #9aa69f;
    --line: #2c3631;
    --shelf: #f2cb3d;
    --shelf-ink: #141a16;
    --barbora: #f07a5a;
    --rimi: #7aa6ec;
    --best: #5cc58a;
    --error: #ff8a80;
    --focus: #7aa6ec;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #111613;
  --surface: #19201c;
  --ink: #e8ede9;
  --muted: #9aa69f;
  --line: #2c3631;
  --shelf: #f2cb3d;
  --shelf-ink: #141a16;
  --barbora: #f07a5a;
  --rimi: #7aa6ec;
  --best: #5cc58a;
  --error: #ff8a80;
  --focus: #7aa6ec;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 var(--body);
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 16px 48px;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

h1,
h2 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
}
h1 {
  font-size: 1.9rem;
  margin: 20px 0 12px;
}
h2 {
  font-size: 1.3rem;
  margin: 28px 0 10px;
}

.num {
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--muted);
}
.error {
  color: var(--error);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
code {
  font-family: var(--mono);
  font-size: 0.85em;
}

/* ---------- header ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
}
.brand {
  font: 800 1.25rem/1 var(--display);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand::after {
  /* a tiny shelf tag next to the name */
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 6px;
  background: var(--shelf);
  transform: rotate(45deg) translateY(-2px);
}
.top nav {
  display: flex;
  gap: 4px;
}
.top nav a {
  padding: 8px 10px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}
.top nav a.current {
  background: color-mix(in srgb, var(--paper) 16%, transparent);
}

/* ---------- controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 600 0.95rem/1 var(--body);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover {
  background: var(--paper);
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--ink) 85%, var(--paper));
}
.btn-on {
  background: var(--shelf);
  border-color: var(--shelf);
  color: var(--shelf-ink);
}
.btn-on:hover {
  background: var(--shelf);
}
.btn-quiet {
  border-color: var(--line);
  color: var(--muted);
  font-weight: 500;
}
.btn-small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.9rem;
}

input,
select {
  min-height: 44px;
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
input:focus,
select:focus {
  border-color: var(--ink);
}
input[type="checkbox"] {
  min-height: 0;
  width: 20px;
  height: 20px;
  accent-color: var(--ink);
}

form.inline {
  display: inline;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

/* ---------- lists ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.row-main {
  flex: 1;
  min-width: 0;
}
.row-title {
  display: block;
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.row-title:hover {
  text-decoration: underline;
}
.row-detail {
  margin-top: 2px;
  font-size: 0.9rem;
}
.row-extra {
  flex: none;
}

.thumb {
  flex: none;
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: #fff;
  border-radius: var(--radius);
}
.thumb-none {
  display: block;
  background: var(--line);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.9rem;
}
.chip .num {
  font-weight: 600;
  white-space: nowrap;
}
.chip-best {
  border-color: var(--best);
  box-shadow: inset 0 0 0 1px var(--best);
}
.chip-off {
  color: var(--muted);
}

.shop {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.shop-barbora {
  background: var(--barbora);
}
.shop-rimi {
  background: var(--rimi);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shop {
    color: #111613;
  }
}
:root[data-theme="dark"] .shop {
  color: #111613;
}

/* Verdict tags: small shelf tags with a punched hole. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 7px;
  border-radius: 3px 8px 8px 3px;
  font: 700 0.8rem/1.2 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--paper);
}
.tag-sm {
  font-size: 0.68rem;
  padding: 2px 7px 2px 5px;
}
.tag-good {
  background: color-mix(in srgb, var(--shelf) 45%, var(--surface));
  color: var(--shelf-ink);
}
.tag-great {
  background: var(--shelf);
  color: var(--shelf-ink);
}
.tag-lowest {
  background: var(--ink);
  color: var(--shelf);
}

.empty {
  padding: 16px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

/* ---------- search ---------- */

.searchbar {
  display: flex;
  gap: 8px;
  margin: 20px 0 16px;
}
.searchbar input {
  flex: 1;
  min-width: 0;
  font-size: 1.05rem;
}

/* ---------- product ---------- */

.product-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 20px;
}
.product-head h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
  overflow-wrap: anywhere;
}
.product-head p {
  margin: 0;
}
.alt-title {
  font-size: 0.9rem;
  margin-top: 4px !important;
}
.hero-img {
  flex: none;
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: #fff;
  border-radius: var(--radius);
}

.compare {
  margin: 16px 0 0;
  font-size: 1.05rem;
}

.price-cards {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}
@media (min-width: 40rem) {
  .price-cards {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  }
}
.price-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.price-card > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.best-note {
  color: var(--best);
  font-weight: 700;
  font-size: 0.85rem;
}

/* The signature: a shelf-edge price label, notched like the paper tags clipped to a shelf rail. */
.label-price {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px 8px 18px;
  background: var(--paper);
  color: var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  border-top: 4px solid var(--ink);
}
.price-card-best .label-price {
  background: var(--shelf);
  color: var(--shelf-ink);
  border-top-color: var(--shelf-ink);
}
.label-amount {
  font: 800 2.6rem/1 var(--display);
  letter-spacing: -0.01em;
}
.label-caption {
  font: 600 0.75rem/1 var(--body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0;
}

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin: 0;
  font-size: 0.92rem;
}
.facts dt {
  color: var(--muted);
}
.facts dd {
  margin: 0;
  text-align: right;
}
.shop-link {
  margin-top: auto;
  font-weight: 600;
  font-size: 0.92rem;
}

.chart-box {
  margin-top: 8px;
}
.seg {
  display: inline-flex;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.seg a {
  padding: 6px 12px;
  text-decoration: none;
  font-size: 0.9rem;
}
.seg a.on {
  background: var(--ink);
  color: var(--paper);
}

.chart {
  display: block;
  width: 100%;
  height: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}
.chart .tick {
  fill: var(--muted);
  font: 11px var(--body);
  font-variant-numeric: tabular-nums;
}
.chart .line {
  fill: none;
  stroke-width: 2.5;
  stroke-linejoin: round;
}
.chart .s-barbora {
  stroke: var(--barbora);
  fill: var(--barbora);
}
.chart .s-rimi {
  stroke: var(--rimi);
  fill: var(--rimi);
}
.chart path.line {
  fill: none;
}
.chart .ref {
  stroke: var(--muted);
  stroke-dasharray: 4 4;
}
.chart .ref-label {
  fill: var(--muted);
  font: 11px var(--body);
}
.chart .chart-empty {
  fill: var(--muted);
  font: 14px var(--body);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.key::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 3px;
  margin-right: 6px;
  vertical-align: middle;
}
.key-barbora::before {
  background: var(--barbora);
}
.key-rimi::before {
  background: var(--rimi);
}
.key-ref::before {
  border-top: 2px dashed var(--muted);
  height: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
}
.staple-form {
  display: flex;
  flex: 1 1 18rem;
  gap: 8px;
}
.staple-form input {
  flex: 1;
  min-width: 0;
}

.evidence {
  margin-top: 24px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

/* ---------- deals ---------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1.5px solid var(--line);
  margin-bottom: 12px;
}
.tabs a {
  padding: 10px 14px;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 3px solid transparent;
  margin-bottom: -1.5px;
}
.tabs a.on {
  border-bottom-color: var(--ink);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 8px;
}
.filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}
.filters label.check {
  flex-direction: row;
  color: var(--ink);
  font-size: 0.95rem;
}
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
}

/* ---------- settings, login, footer ---------- */

.notice {
  padding: 10px 14px;
  background: color-mix(in srgb, var(--best) 14%, var(--surface));
  border-radius: var(--radius);
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th,
td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
th {
  color: var(--muted);
  font-weight: 600;
}
.r {
  text-align: right;
}

.login {
  max-width: 22rem;
  margin: 18vh auto 0;
}
.brand-big {
  font-size: 2.6rem;
}
.login input[type="password"] {
  width: 100%;
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.82rem;
}

@media (prefers-reduced-motion: no-preference) {
  .htmx-request .btn,
  .btn.htmx-request {
    opacity: 0.6;
    transition: opacity 0.15s;
  }
}

/* ================= dashboard ================= */

:root {
  --receipt: #fffffb;
  --receipt-ink: #24302a;
  --receipt-line: #c9d1cb;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --receipt: #222b26;
    --receipt-ink: #e3e9e4;
    --receipt-line: #3b4741;
  }
}
:root[data-theme="dark"] {
  --receipt: #222b26;
  --receipt-ink: #e3e9e4;
  --receipt-line: #3b4741;
}

main.wide {
  max-width: 74rem;
}
.small {
  font-size: 0.85rem;
}
.lede {
  max-width: 40rem;
  margin-top: -4px;
}
.count {
  font: 600 0.95rem var(--body);
}
.more {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}
.crumbs {
  margin: 16px 0 -8px;
  font-size: 0.9rem;
}
.crumbs a::before {
  content: "← ";
}

/* Header: on phones the nav becomes its own scrolling row. */
@media (max-width: 47.99rem) {
  .top {
    flex-wrap: wrap;
    padding-bottom: 0;
  }
  .top nav {
    order: 3;
    width: calc(100% + 32px);
    margin: 0 -16px;
    padding: 2px 10px 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .top nav a {
    flex: none;
  }
}

.dash {
  display: grid;
  gap: 8px 32px;
  margin-top: 20px;
}
.dash-main > section:first-child h1,
.dash-main > .section-head:first-child h1 {
  margin-top: 0;
}
@media (min-width: 60rem) {
  .dash {
    grid-template-columns: minmax(0, 1fr) 21rem;
    align-items: start;
  }
  .dash-side {
    order: 2;
    position: sticky;
    top: 76px;
  }
}

/* ---------- the receipt ---------- */

.receipt-wrap {
  filter: drop-shadow(0 1px 0 var(--receipt-line)) drop-shadow(0 8px 14px rgb(0 0 0 / 0.07));
}
.receipt {
  --zz: 9px;
  position: relative;
  padding: 18px 18px calc(18px + var(--zz));
  background: var(--receipt);
  color: var(--receipt-ink);
  font: 0.86rem/1.55 var(--mono);
  -webkit-mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--zz)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--zz)) var(--zz) repeat-x;
  mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--zz)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(2 * var(--zz)) var(--zz) repeat-x;
}
.receipt p {
  margin: 0;
}
.rc-head {
  font: 800 1.35rem/1.1 var(--display);
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
}
.rc-meta {
  margin-top: 2px !important;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}
.rc-shop {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1.5px dashed var(--receipt-line);
}
.rc-shopname {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rc-shopname span:first-child::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  vertical-align: 1px;
}
.rc-barbora span:first-child::before {
  background: var(--barbora);
}
.rc-rimi span:first-child::before {
  background: var(--rimi);
}
.rc-shopname span:last-child {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.rc-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.rc-dots {
  flex: 1;
  border-bottom: 1.5px dotted var(--receipt-line);
  transform: translateY(-4px);
}
.rc-sub {
  margin-top: 2px;
}
.rc-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 14px;
  padding: 10px 0 4px;
  border-top: 3px double var(--receipt-ink);
  font: 800 1.9rem/1 var(--display);
}
.rc-total span:first-child {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rc-foot,
.rc-note {
  color: var(--muted);
  font-size: 0.78rem;
}
.rc-foot {
  margin-top: 6px !important;
}
.rc-warn {
  margin-top: 4px !important;
  color: var(--error);
  font-size: 0.8rem;
  font-weight: 700;
}
.rc-blank {
  margin: 18px 0 4px !important;
  text-align: center;
  font-size: 1rem;
}
.receipt-empty .rc-note {
  text-align: center;
}
.rc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  font-family: var(--body);
}
.rc-actions .btn {
  flex: 1 1 auto;
}
.new-cart {
  display: block;
  margin-top: 12px;
  text-align: center;
}

/* ---------- freshness lamps ---------- */

.fresh {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--muted);
}
.lamp::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--best);
  vertical-align: 1px;
}
.lamp-warn::before {
  background: #d98a00;
}
.lamp-plain::before {
  background: var(--line);
}

/* ---------- rows: actions ---------- */

.btn-add {
  border-color: var(--ink);
  min-width: 64px;
}
.in-cart {
  display: inline-block;
  padding: 7px 10px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--best) 14%, transparent);
  color: var(--best);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}
.row-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
@media (max-width: 30rem) {
  .row-actions .btn-quiet {
    display: none;
  }
}
.soon {
  margin-top: 10px;
}
.soon summary {
  padding: 10px 0;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- charts: bars and purchase marks ---------- */

.chart .bar.s-barbora {
  fill: var(--barbora);
  stroke: none;
}
.chart .bar.s-rimi {
  fill: var(--rimi);
  stroke: none;
}
.chart .bar-total {
  fill: var(--ink);
  font-weight: 600;
}
.chart .mark {
  stroke: var(--surface);
  stroke-width: 1.5;
}
.key-bought::before {
  width: 9px;
  height: 9px;
  background: var(--ink);
  transform: rotate(45deg);
}

/* ---------- staples ---------- */

.due {
  display: block;
  width: 112px;
  height: 10px;
}
.due-track {
  fill: var(--line);
}
.due-fill {
  fill: var(--muted);
}
.due-basic .due-fill {
  fill: var(--shelf);
  stroke: var(--shelf-ink);
  stroke-width: 0.6;
}
.due-soon .due-fill {
  fill: color-mix(in srgb, var(--shelf) 55%, var(--muted));
}
.due-mark {
  stroke: var(--surface);
  stroke-width: 1.5;
}
.due-none {
  font-size: 0.8rem;
  color: var(--muted);
}
.staples {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 48rem) {
  .staples {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 72rem) {
  .staples {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.staple {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.staple-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.staple-gauge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.staple-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  margin: 0;
  font-size: 0.86rem;
}
.staple-facts dt {
  color: var(--muted);
}
.staple-facts dd {
  margin: 0;
}
.staple-edit {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}
.staple-edit summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 0;
}
.edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 10px;
  align-items: end;
  margin: 8px 0;
}
.edit-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}
.edit-grid label.wide {
  grid-column: 1 / -1;
}
.edit-grid input {
  width: 100%;
  min-width: 0;
}
.edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- cart ---------- */

.reason {
  margin: -4px 0 12px;
  font-size: 1.02rem;
}
.scns {
  display: grid;
  gap: 10px;
}
@media (min-width: 40rem) {
  .scns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.scn {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.scn header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.scn h3 {
  margin: 0;
  font: 700 1.05rem var(--display);
  letter-spacing: 0.02em;
}
.scn p {
  margin: 0;
}
.scn-rec {
  border: 2px solid var(--ink);
}
.scn-badge {
  padding: 2px 8px;
  border-radius: 3px 8px 8px 3px;
  background: var(--shelf);
  color: var(--shelf-ink);
  font: 700 0.7rem/1.4 var(--display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.scn-total {
  font: 800 1.8rem/1 var(--display);
}
.scn-break {
  font-size: 0.82rem;
}
.scn-shops {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 0.9rem;
}
.scn-miss {
  font-size: 0.85rem;
  color: var(--error);
}
.scn-miss.muted {
  color: var(--muted);
}
.scn form {
  margin-top: auto;
  padding-top: 6px;
}
.scn .btn {
  width: 100%;
}
.btn[disabled] {
  cursor: default;
}
.shop-block h2 .shop {
  vertical-align: 3px;
}
.cart-row .row-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sub-note {
  color: var(--rimi);
  font-weight: 600;
}
.line-cost {
  font-weight: 700;
  font-size: 1.05rem;
}
.line-ctl {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 8px;
}
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.step {
  width: 40px;
  height: 38px;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 1.2rem/1 var(--body);
  cursor: pointer;
}
.step:disabled {
  color: var(--line);
  cursor: default;
}
.step-n {
  min-width: 2ch;
  text-align: center;
  font-weight: 700;
}
.pin-form {
  display: inline-flex;
  gap: 4px;
}
select.pin {
  min-height: 38px;
  padding: 4px 8px;
  font-size: 0.88rem;
}

/* checklist */
.checklist {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.check-form {
  display: contents;
}
.tick {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--surface);
  color: var(--shelf-ink);
  font: 800 1.1rem/1 var(--body);
  cursor: pointer;
}
.done .tick {
  background: var(--shelf);
  border-color: var(--shelf-ink);
}
.check-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.check-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.done .check-title {
  text-decoration: line-through;
  color: var(--muted);
}
.check-cost {
  font-weight: 700;
}

/* ---------- orders ---------- */

.order-row {
  align-items: center;
}
.order-date {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 48px;
  padding: 4px 0;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  line-height: 1;
}
.od-day {
  font: 800 1.3rem/1 var(--display);
}
.od-mon {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.order-total,
.order-grand {
  font-weight: 700;
}
.order-grand {
  font: 800 1.6rem var(--display);
}
.order-table td.wrap {
  white-space: normal;
  min-width: 12rem;
}
.order-table tr.unmatched td {
  background: color-mix(in srgb, var(--shelf) 16%, transparent);
}
.delta {
  margin-left: 4px;
  font-size: 0.7rem;
}
.delta.down {
  color: var(--best);
}
.delta.up {
  color: var(--error);
}
.tag-link {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--error);
}
.warn-list {
  padding: 10px 14px 10px 30px;
  border-left: 4px solid var(--shelf);
  background: var(--surface);
  font-size: 0.9rem;
}
.import {
  margin-top: 28px;
}
.import summary {
  font-weight: 600;
  cursor: pointer;
}
.import textarea {
  width: 100%;
  padding: 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 0.85rem/1.4 var(--mono);
}

/* resolve queue */
.resolve {
  margin-top: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.resolve-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}
.cands {
  display: grid;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.cand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 4px 10px 4px 4px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.cand-btn:hover {
  border-color: var(--ink);
}
.cand-btn .thumb {
  width: 40px;
  height: 40px;
}
.cand-title {
  flex: 1;
  min-width: 0;
}
.resolve-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.resolve-actions .searchbar {
  flex: 1 1 16rem;
  margin: 0;
}

/* ---------- product extras, settings ---------- */

.cart-add {
  display: inline-flex;
  gap: 6px;
}
.cart-add input {
  width: 4.5rem;
}
.prefs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.fee-forms {
  display: grid;
  gap: 14px;
}
@media (min-width: 48rem) {
  .fee-forms {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.fee-form {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.fee-unverified {
  border-color: var(--shelf);
  box-shadow: inset 4px 0 0 var(--shelf);
}
.fee-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---------- round 2 ---------- */

.bars-sm {
  display: none;
}
@media (max-width: 34rem) {
  .bars-sm {
    display: block;
  }
  .bars-lg {
    display: none;
  }
}
.row-actions > form {
  display: block;
}
.row-actions .btn,
.row-actions .in-cart {
  width: 100%;
  text-align: center;
}
.due-done {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}
.due-done .in-cart {
  margin-right: 6px;
  padding: 2px 8px;
}
.linkish {
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 0.88rem var(--body);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.linkish:hover {
  color: var(--error);
}
@media (max-width: 47.99rem) {
  .top nav a {
    padding: 8px 9px;
    font-size: 0.9rem;
  }
}
/* On the cart page the lines come first on a phone; the receipt closes the page. */
.dash-cart .dash-side {
  order: 2;
}

/* htmx indicators (htmx's own inline styles are off because of the CSP): hidden until a request is in flight. */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: block;
}
.chat-thinking {
  color: var(--muted, #5b6660);
  font-style: italic;
}
/* Chat input: full width, comfortable height. */
#agent-msg,
#mem-text {
  display: block;
  width: 100%;
  min-height: 4.5rem;
  box-sizing: border-box;
  padding: 0.6rem 0.7rem;
  font: inherit;
  border: 1px solid #b9c2bd;
  border-radius: 8px;
  resize: vertical;
}
.chat-form {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.chat-form .btn {
  justify-self: start;
}

/* Collapsible cart groups: native details, the summary is the section head. */
details.group-block > summary {
  cursor: pointer;
  list-style: none;
}
details.group-block > summary::-webkit-details-marker {
  display: none;
}
details.group-block > summary h2::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 0.4em;
  transition: transform 0.15s;
}
details.group-block[open] > summary h2::before {
  transform: rotate(90deg);
}
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
