/* ==========================================================================
   TapLayer Receipt -- demo stylesheet
   Three visually distinct surfaces on purpose:
     1. POS      -- deliberately plain "someone else's till software"
     2. Till     -- the TapLayer customer-facing tile at the counter
     3. Receipt  -- the customer's phone
   ========================================================================== */

:root {
  --ink: #14181f;
  --muted: #6b7280;
  --line: #e6e8ec;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #146ef5;
  --accent-ink: #0b3f94;
  --good: #16a34a;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }

.wrap { max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }
.wrap.narrow { max-width: 460px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--card);
}
.brand { font-weight: 700; letter-spacing: 0.2px; }
.brand small { color: var(--muted); font-weight: 500; margin-left: 8px; }
.nav a { margin-left: 16px; color: var(--muted); font-size: 14px; }
.nav a:hover { color: var(--ink); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 16px;
}
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.row { display: flex; justify-content: space-between; gap: 12px; }

.btn {
  display: inline-block; border: none; border-radius: 10px; padding: 12px 18px;
  font-size: 15px; font-weight: 600; cursor: pointer; text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-secondary { background: #eef1f5; color: var(--ink); }
.btn-secondary:hover { background: #e2e6ec; }
.btn-block { display: block; width: 100%; }

select, input[type=number] {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 600; background: #eef1f5; color: var(--muted);
}
.pill.good { background: #e8f7ee; color: var(--good); }

.line-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.line-item .name { font-weight: 600; }
.line-item .sub { color: var(--muted); font-size: 13px; }
.totals-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.totals-row.total { font-weight: 700; font-size: 18px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }

.qty-control { display: flex; align-items: center; gap: 8px; }
.footer-note { text-align: center; color: var(--muted); font-size: 12px; margin-top: 24px; }
.err-box { text-align: center; padding: 60px 20px; }

/* ==========================================================================
   1. SIMULATED POS -- intentionally plain retail till software.
      Grey, boxy, functional. It should read as "the shop's existing POS",
      NOT as part of the TapLayer product.
   ========================================================================== */

body.pos { background: #eceef1; }

.pos-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: #2b3038; color: #fff; padding: 12px 20px;
}
.pos-bar-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.pos-bar-title { font-weight: 700; font-size: 15px; letter-spacing: 0.3px; }
.pos-bar-store { color: #aeb6c2; font-size: 13px; }
.demo-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  border: 1px solid #565e6b; color: #aeb6c2;
  font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase;
  white-space: nowrap;
}
.pos-bar-links a { color: #aeb6c2; font-size: 13px; margin-left: 14px; }
.pos-bar-links a:hover { color: #fff; }

.pos-wrap { max-width: 1040px; margin: 0 auto; padding: 20px 16px 56px; }
.pos-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .pos-grid { grid-template-columns: 1fr; } }

.pos-panel {
  background: #fff; border: 1px solid #d5d9df; border-radius: 8px;
  margin-bottom: 16px; overflow: hidden;
}
.pos-panel-head {
  padding: 10px 16px; border-bottom: 1px solid #e3e6ea; background: #f4f6f8;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  color: #5b6472;
}
.pos-panel-body { padding: 14px 16px; }

.pos-fields { display: flex; flex-wrap: wrap; gap: 18px; }
.pos-field { display: flex; flex-direction: column; gap: 4px; }
.pos-field label { font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: #6b7280; }
.pos-field select, .pos-field input { border-color: #d5d9df; border-radius: 6px; min-width: 150px; }

.product-card {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid #e3e6ea; border-radius: 6px; padding: 11px 14px; margin-bottom: 8px;
  background: #fff;
}
.product-card:last-child { margin-bottom: 0; }
.product-name { font-weight: 600; font-size: 15px; }
.product-price { color: var(--muted); font-size: 13px; }
.qty-control button {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid #d5d9df;
  background: #f7f8fa; cursor: pointer; font-size: 16px; line-height: 1; color: #333;
}
.qty-control button:hover { background: #eceef1; }
.qty-control span { min-width: 22px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

.cart-lines { min-height: 40px; }
.pos-total-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; color: #4b5563; }
.pos-total-row.grand {
  font-weight: 800; font-size: 21px; color: var(--ink);
  border-top: 2px solid #2b3038; margin-top: 8px; padding-top: 10px;
}
.pos-tax-note { margin-top: 6px; font-size: 12px; color: var(--muted); text-align: right; }
.product-price .incl { font-size: 11px; color: #9aa2ae; }

.btn-sale {
  display: block; width: 100%; margin-top: 16px; border: none; border-radius: 6px;
  background: #1a7f4b; color: #fff; padding: 16px; cursor: pointer;
  font-size: 17px; font-weight: 800; letter-spacing: 0.8px;
}
.btn-sale:hover { background: #14663c; }
.receipt-choice {
  margin-top: 14px; padding: 14px; border: 1px solid #d5d9df;
  border-radius: 6px; background: #f7f8fa;
}
.receipt-choice-q {
  font-size: 13px; font-weight: 700; color: #4b5563; margin-bottom: 10px;
}
.btn-release, .btn-noreceipt {
  display: block; width: 100%; border-radius: 6px; padding: 13px;
  font-size: 15px; font-weight: 800; letter-spacing: 0.5px; cursor: pointer;
}
.btn-release { border: none; background: #146ef5; color: #fff; }
.btn-release:hover { background: #0b57d0; }
.btn-noreceipt {
  margin-top: 8px; border: 1px solid #d5d9df; background: #fff; color: #4b5563;
}
.btn-noreceipt:hover { background: #eceef1; }
.sale-note {
  border: 1px solid #d9dde3; background: #f7f8fa; border-radius: 6px;
  padding: 12px 14px; color: #4b5563;
}
.sale-note strong { display: block; font-size: 15px; margin-bottom: 2px; color: var(--ink); }
.sale-err strong { display: block; font-size: 15px; margin-bottom: 2px; }

.sale-result { margin-top: 14px; font-size: 14px; }
.sale-ok {
  border: 1px solid #bfe3cd; background: #eff9f3; border-radius: 6px;
  padding: 12px 14px; color: #14663c;
}
.sale-ok strong { display: block; font-size: 15px; margin-bottom: 2px; }
.sale-err { border: 1px solid #e8c5c5; background: #fdf2f2; border-radius: 6px; padding: 12px 14px; color: #9b1c1c; }

/* ==========================================================================
   2. TAPLAYER TILL -- the customer-facing screen on the counter.
      Dark, calm, very large type. Readable from a metre away.
   ========================================================================== */

body.till {
  background: #0e1116; color: #fff;
  min-height: 100vh;
}
.till-wrap {
  max-width: 620px; margin: 0 auto; padding: 32px 20px 40px;
  display: flex; flex-direction: column; min-height: 100vh;
}
.till-store {
  text-align: center; color: #8b95a5; font-size: 14px; letter-spacing: 1.6px;
  text-transform: uppercase; font-weight: 600; margin-bottom: 26px;
}
.till-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.till-headline {
  text-align: center; font-size: 40px; line-height: 1.15; font-weight: 800;
  margin: 0 0 6px; letter-spacing: -0.5px;
}
.till-amount { text-align: center; color: #8b95a5; font-size: 16px; margin: 0 0 26px; }
.till-qr {
  background: #fff; border-radius: 22px; padding: 22px;
  width: 300px; max-width: 84vw; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.till-qr img { width: 100%; height: auto; display: block; }
.till-sub {
  text-align: center; font-size: 22px; font-weight: 600; margin: 24px 0 0;
}
.till-promise {
  text-align: center; color: #8b95a5; font-size: 16px; margin: 10px 0 0; letter-spacing: 0.2px;
}
.btn-tap {
  display: block; width: 300px; max-width: 84vw; margin: 26px auto 0;
  background: #146ef5; color: #fff; border: none; border-radius: 14px;
  padding: 16px; font-size: 17px; font-weight: 700; text-align: center; cursor: pointer;
}
.btn-tap:hover { background: #0b57d0; }
button.btn-tap { font-family: inherit; cursor: pointer; }
.till-idle form { margin: 0; }
.till-idle { text-align: center; padding: 40px 0; }
.till-idle-mark {
  width: 72px; height: 72px; border-radius: 50%; border: 2px dashed #39414f;
  margin: 0 auto 20px; display: flex; align-items: center; justify-content: center;
  color: #5b6472; font-size: 30px;
}
.till-idle h1 { font-size: 26px; font-weight: 700; margin: 0 0 8px; }
.till-idle p { color: #8b95a5; margin: 0; font-size: 15px; }

.till-foot { margin-top: 28px; }
.till-earlier {
  border-top: 1px solid #232935; padding-top: 16px;
}
.till-earlier-title { color: #5b6472; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; font-weight: 700; margin-bottom: 8px; }
.till-earlier-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; font-size: 14px; color: #8b95a5;
}
.till-earlier-item a { color: #7fa9f2; font-size: 13px; }
.till-note {
  margin-top: 18px; text-align: center; color: #4a5261; font-size: 11px;
}
.till-note a { color: #4a5261; text-decoration: underline; }
.till-setup {
  background: #1c2333; border: 1px solid #2c3646; border-radius: 10px;
  padding: 12px 14px; color: #9fb0c9; font-size: 13px; margin-bottom: 20px;
}

/* ==========================================================================
   3. CUSTOMER RECEIPT -- mobile first. Looks like a real digital receipt.
   ========================================================================== */

body.receipt { background: #eef0f3; }
.r-wrap { max-width: 420px; margin: 0 auto; padding: 20px 14px 32px; }
.r-card {
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(16,24,40,0.08), 0 8px 28px rgba(16,24,40,0.08);
}
.r-top { padding: 26px 22px 20px; text-align: center; border-bottom: 1px solid #eef0f3; }
.r-check {
  width: 46px; height: 46px; border-radius: 50%; background: #e8f7ee; color: var(--good);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 12px;
  font-size: 22px; font-weight: 700;
}
.r-store { font-size: 20px; font-weight: 800; margin: 0 0 2px; letter-spacing: -0.2px; }
.r-addr { color: var(--muted); font-size: 13px; margin: 0; }
.r-paid { display: inline-block; margin-top: 12px; font-size: 12px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--good); background: #e8f7ee; padding: 4px 12px; border-radius: 999px; }

.r-meta { display: flex; justify-content: space-between; padding: 14px 22px; font-size: 13px; color: var(--muted); border-bottom: 1px solid #eef0f3; }
.r-meta .r-meta-val { color: var(--ink); font-weight: 600; }
.r-meta-col { display: flex; flex-direction: column; gap: 2px; }
.r-meta-col.right { text-align: right; }

.r-items { padding: 6px 22px 2px; }
.r-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f2f4f7; }
.r-item:last-child { border-bottom: none; }
.r-item-name { font-weight: 600; font-size: 15px; }
.r-item-qty { color: var(--muted); font-size: 13px; margin-top: 2px; }
.r-item-amt { font-weight: 600; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.r-totals { padding: 14px 22px 18px; border-top: 1px solid #eef0f3; }
.r-total-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; color: #4b5563; }
.r-total-row span:last-child { font-variant-numeric: tabular-nums; }
.r-total-row.grand {
  font-weight: 800; font-size: 22px; color: var(--ink);
  border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px;
}
.r-tax-note { margin-top: 8px; font-size: 12px; color: var(--muted); text-align: right; }
.r-actions { padding: 0 22px 22px; }
.r-actions .btn { border-radius: 12px; padding: 14px; }
.r-share-note {
  margin-top: 10px; text-align: center; font-size: 13px; color: var(--good);
  background: #e8f7ee; border-radius: 8px; padding: 8px 10px;
}
#shareBtn[disabled] { opacity: 0.6; cursor: default; }

.r-tl {
  text-align: center; padding: 16px 22px 20px; border-top: 1px solid #eef0f3;
  color: #9aa2ae; font-size: 12px;
}
.r-tl strong { color: #6b7280; font-weight: 700; }
.r-ref { display: inline-block; margin-top: 4px; font-size: 11px; color: #9ca3af; }
/* An unsettled invoice (e.g. Tally CREDIT) must not read as paid. */
.r-paid.r-unsettled { background: #fff4e5; color: #92400e; }
.r-privacy { text-align: center; color: #8a929e; font-size: 12px; margin: 16px 6px 0; line-height: 1.6; }

/* dev-only: transaction state table */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.state {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
  background: #eef1f5; color: #4b5563;
}
.state-ready { background: #e7f0ff; color: #0b3f94; }
.state-claimed { background: #e8f7ee; color: #14663c; }
.state-declined, .state-closed { background: #f2f4f7; color: #8a929e; }
.mini {
  border: 1px solid #d5d9df; background: #fff; border-radius: 6px;
  padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.mini:hover { background: #f4f6f8; }
.mini.danger { color: #9b1c1c; border-color: #e8c5c5; }

.claim-url {
  display: inline-block; background: #f4f6f8; border: 1px solid #e3e6ea;
  border-radius: 6px; padding: 8px 12px; font-size: 14px; word-break: break-all;
}
.dev-qr { width: 150px; height: 150px; border: 1px solid var(--line); border-radius: 8px; }
