/* Venly Mart: the corner shop where agents do the buying. System faces only: nothing is loaded from elsewhere. */
:root {
  --aisle: #e8ecf1;          /* the shop floor */
  --shelf: #ffffff;
  --ink: #1d2a44;            /* labels, text */
  --ink-soft: #55607a;
  --line: #cfd6e1;
  --tag: #ffd23f;            /* shelf price tags */
  --tag-ink: #2a2100;
  --receipt: #fdfdfb;
  --receipt-ink: #34343a;
  --good: #1f8a5b;           /* captured */
  --bad: #d63a2a;            /* failed */
  --wait: #b7791f;           /* in progress */
  --round: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tight: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --till: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--aisle); color: var(--ink); font-family: var(--round); font-size: 16px; line-height: 1.45; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }

/* ---- the awning: the shop's sign ---------------------------------------------------------------------------- */
.awning {
  background: var(--ink);
  color: #fff;
  position: relative;
  padding: 18px 16px 30px;
}
.awning::after {
  /* the scalloped canvas edge */
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -14px; height: 28px;
  background:
    radial-gradient(circle at 14px 14px, var(--ink) 13px, transparent 14px) 0 0 / 28px 28px repeat-x; /* centred on the edge: half hangs below */
}
.awning .stripes {
  position: absolute; inset: 0 0 auto 0; height: 10px;
  background: repeating-linear-gradient(90deg, var(--tag) 0 28px, var(--ink) 28px 56px);
}
.awning .inner { max-width: 1180px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: end; gap: 10px 24px; padding-top: 8px; }
.sign { font-family: var(--tight); font-weight: 800; font-size: clamp(40px, 8vw, 64px); line-height: 0.9; letter-spacing: -0.01em; margin: 0; }
.sign small { display: block; font-family: var(--round); font-weight: 600; font-size: 15px; letter-spacing: 0; color: #c9d3e6; margin-top: 8px; }
.awning nav { margin-left: auto; display: flex; gap: 14px; font-size: 14px; }
.awning nav a { color: #fff; }

main { max-width: 1180px; margin: 0 auto; padding: 34px 16px 60px; }

/* ---- storefront --------------------------------------------------------------------------------------------- */
.store { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
@media (max-width: 900px) {
  .store { grid-template-columns: minmax(0, 1fr); }
  .till { order: -1; }          /* on a phone the live orders come first */
  .roll { max-height: 210px; }
}

.lead { max-width: 62ch; margin: 0 0 18px; color: var(--ink-soft); }
.lead strong { color: var(--ink); }

.find { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.find input[type="search"] {
  flex: 1 1 220px; min-width: 0; padding: 11px 14px; border-radius: 999px; border: 2px solid var(--ink); background: var(--shelf);
}
.aisles { display: flex; flex-wrap: wrap; gap: 6px; }
.aisles button { border: 2px solid var(--ink); background: transparent; border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 14px; }
.aisles button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.item {
  background: var(--shelf); border-radius: 6px; padding: 14px 14px 18px; position: relative;
  border-bottom: 6px solid var(--line); display: grid; grid-template-rows: auto auto 1fr auto; gap: 8px; min-height: 260px;
}
.item .pic { height: 96px; border-radius: 4px; display: grid; place-items: center; font-size: 46px; }
.item h3 { margin: 4px 0 0; font-size: 17px; line-height: 1.2; }
.item p { margin: 0; font-size: 14px; color: var(--ink-soft); }
.item .foot { display: flex; align-items: end; justify-content: space-between; gap: 8px; }
.item .stock { font-size: 13px; color: var(--ink-soft); }
.item.out .pic { filter: grayscale(1); opacity: 0.5; }
.item.out .stock { color: var(--bad); font-weight: 700; }

/* The price tag: the shop's one loud thing. */
.tag {
  background: var(--tag); color: var(--tag-ink); font-family: var(--tight); font-weight: 800; font-size: 26px; line-height: 1;
  padding: 7px 12px 7px 22px; position: relative; border-radius: 3px 8px 8px 3px; transform: rotate(-2deg);
  box-shadow: 0 2px 0 rgba(42, 33, 0, 0.25);
}
.tag::before { /* the punched hole */
  content: ''; position: absolute; left: 7px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: var(--shelf);
}
.tag .cents { font-size: 0.58em; vertical-align: 0.62em; margin-left: 1px; }

.empty { padding: 30px 0; color: var(--ink-soft); }

/* ---- the till roll: live orders --------------------------------------------------------------------------------- */
@media (min-width: 901px) { .till { position: sticky; top: 16px; } } /* beside the shelves only: on a phone it scrolls with the page */
.till h2 { font-family: var(--tight); font-weight: 800; font-size: 26px; margin: 0 0 4px; }
.till .hint { margin: 0 0 12px; font-size: 14px; color: var(--ink-soft); }
.roll {
  background: var(--receipt); color: var(--receipt-ink); font-family: var(--till); font-size: 13px; padding: 14px 14px 22px; position: relative;
  max-height: 70vh; overflow-y: auto;
  -webkit-mask: linear-gradient(#000 calc(100% - 10px), transparent);
          mask: linear-gradient(#000 calc(100% - 10px), transparent);
}
.roll::before { /* the torn top edge */
  content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px;
  background: linear-gradient(-45deg, var(--receipt) 6px, transparent 0) 0 0 / 12px 8px repeat-x,
              linear-gradient(45deg, var(--receipt) 6px, transparent 0) 0 0 / 12px 8px repeat-x;
}
.roll ol { list-style: none; margin: 0; padding: 0; }
.roll li { padding: 8px 0; border-bottom: 1px dashed #b9b9b0; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.roll li:last-child { border-bottom: 0; }
.roll .who { font-weight: 700; }
.roll .sum { text-align: right; font-weight: 700; }
.roll .meta { color: #77776f; }
.roll .state { text-align: right; }
.roll li.printing { animation: print 700ms ease-out; }
@keyframes print { from { clip-path: inset(0 0 100% 0); background: #fff6c8; } to { clip-path: inset(0 0 0 0); background: transparent; } }
@media (prefers-reduced-motion: reduce) { .roll li.printing { animation: none; } }

.state.held { color: var(--wait); }
.state.capturing, .state.refunding { color: var(--wait); }
.state.captured { color: var(--good); }
.state.refunded { color: var(--ink-soft); }
.state.failed { color: var(--bad); font-weight: 700; }

.how { margin: 36px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; counter-reset: step; padding: 0; list-style: none; }
@media (max-width: 700px) { .how { grid-template-columns: minmax(0, 1fr); } }
.how li { counter-increment: step; background: var(--shelf); border-radius: 6px; padding: 14px 16px 16px; }
.how li::before { content: counter(step); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.how h3 { margin: 0 0 4px; font-size: 16px; }
.how p { margin: 0; font-size: 14px; color: var(--ink-soft); }

/* ---- back office -------------------------------------------------------------------------------------------- */
.office { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
@media (max-width: 980px) { .office { grid-template-columns: minmax(0, 1fr); } }
.office h2 { font-family: var(--tight); font-weight: 800; font-size: 28px; margin: 0 0 10px; }
.office section + section { margin-top: 30px; }
.facts { font-size: 14px; color: var(--ink-soft); margin: -4px 0 14px; }

.order { background: var(--shelf); border-radius: 6px; padding: 14px 16px; margin-bottom: 12px; border-left: 6px solid var(--line); }
.order.authorized { border-left-color: var(--tag); }
.order.capture_pending, .order.refund_pending { border-left-color: var(--wait); }
.order.shipped, .order.partially_shipped { border-left-color: var(--good); }
.order.failed { border-left-color: var(--bad); background: #fff3f1; }
.order header { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.order header b { font-size: 17px; }
.order header .money { margin-left: auto; font-family: var(--tight); font-weight: 800; font-size: 22px; }
.order .who { font-size: 13px; color: var(--ink-soft); }
.order table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 14px; }
.order td { padding: 4px 0; border-bottom: 1px solid #eef0f4; }
.order td.num { text-align: right; white-space: nowrap; }
.order .pick input[type="number"] { width: 4.2em; padding: 3px 4px; }
.order .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.order details { margin-top: 8px; font-size: 13px; }
.order details li { margin: 2px 0; }
.order .events { margin: 6px 0 0; padding-left: 18px; color: var(--ink-soft); }
.order .events .finance_failed, .order .events .capture_refused, .order .events .refund_refused { color: var(--bad); }
.order .alert { margin: 8px 0 0; color: var(--bad); font-weight: 700; font-size: 14px; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: #eef0f4; }
.chip.authorized { background: var(--tag); color: var(--tag-ink); }
.chip.capture_pending, .chip.refund_pending { background: #f7e3c2; color: #6b4a10; }
.chip.shipped, .chip.partially_shipped { background: #d5efe2; color: #11583a; }
.chip.cancelled { background: #e4e7ed; color: #3c465c; }
.chip.failed { background: var(--bad); color: #fff; }

.btn { border: 2px solid var(--ink); background: var(--shelf); border-radius: 6px; padding: 6px 13px; font-weight: 700; font-size: 14px; }
.btn.go { background: var(--ink); color: #fff; }
.btn.stop { border-color: var(--bad); color: var(--bad); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.panel { background: var(--shelf); border-radius: 6px; padding: 14px 16px; }
.switch { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid #eef0f4; }
.switch:last-child { border-bottom: 0; }
.switch input[type="checkbox"] { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--ink); }
.switch b { display: block; }
.switch span { font-size: 13px; color: var(--ink-soft); }
.switch select { margin-top: 6px; width: 100%; padding: 5px; }

.stocklist { width: 100%; border-collapse: collapse; font-size: 14px; }
.stocklist td { padding: 5px 4px; border-bottom: 1px solid #eef0f4; }
.stocklist input { width: 5.2em; padding: 3px 5px; }
.stocklist .low { color: var(--bad); font-weight: 700; }

.calls { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.calls li { border-bottom: 1px solid #eef0f4; }
.calls button { width: 100%; text-align: left; background: none; border: 0; padding: 7px 0; display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; }
.calls .verb { font-weight: 800; }
.calls .path { overflow-wrap: anywhere; }
.calls .status.ok { color: var(--good); }
.calls .status.bad { color: var(--bad); font-weight: 700; }
.calls .why { grid-column: 2 / 4; color: var(--ink-soft); }
.calls pre { margin: 0 0 8px; background: #f3f5f8; padding: 8px; overflow-x: auto; font-family: var(--till); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 10; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 6px; font-size: 14px; }
.toast.bad { background: var(--bad); }

/* Phones: two narrower shelf columns, shorter tiles. */
@media (max-width: 560px) {
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .item { min-height: 0; padding: 10px 10px 14px; gap: 6px; }
  .item .pic { height: 64px; font-size: 34px; }
  .item h3 { font-size: 15px; }
  .item p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; }
  .item .foot { flex-direction: column; align-items: flex-start; gap: 8px; }
  .tag { font-size: 22px; }
  main { padding-top: 26px; }
}
