/* Owner app layout: bottom tabs on phones, a left rail on desktop. */
.skip:focus { position: fixed !important; width: auto; height: auto; clip: auto; left: 16px; top: 16px; z-index: 60; background: var(--surface); padding: 12px 16px; }

.top {
  position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--rule);
  padding: max(env(safe-area-inset-top), 0px) var(--gutter) 0;
}
.biz { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 56px; }
.biz-name { display: flex; align-items: baseline; gap: var(--s-2); min-width: 0; }
.biz-sub { font-weight: 600; font-size: var(--fs-sm); color: var(--text-2); }
.rail-foot { display: none; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 60px;
  color: var(--text-2); text-decoration: none; font-weight: 700; font-size: var(--fs-sm);
}
.tabs a:hover { color: var(--text); background: var(--paper-2); }
.tabs a[aria-current="page"] { color: var(--accent); }
.tabs a[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; background: var(--accent); border-radius: 0 0 3px 3px; }

main { padding: var(--s-5) var(--gutter) calc(96px + env(safe-area-inset-bottom)); max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; outline: none; }
main > section + section { margin-top: var(--s-8); }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
  .top { position: sticky; top: 0; height: 100vh; border-bottom: 0; border-right: 1px solid var(--rule); padding: var(--s-6) var(--s-5); display: flex; flex-direction: column; gap: var(--s-6); }
  .biz { flex-direction: column; align-items: flex-start; min-height: 0; gap: var(--s-2); }
  .biz-name { flex-direction: column; gap: 0; }
  .biz-name .wordmark { font-size: 2.25rem; }
  .tabs { position: static; display: flex; flex-direction: column; border: 0; padding: 0; gap: 2px; background: transparent; }
  .tabs a { justify-content: flex-start; min-height: 44px; padding: 0 var(--s-3); border-radius: var(--r-2); font-size: var(--fs-base); }
  .tabs a[aria-current="page"] { background: var(--accent-tint); }
  .tabs a[aria-current="page"]::before { content: none; }
  .rail-foot { display: block; margin-top: auto; max-width: 22ch; }
  main { padding: var(--s-8) var(--gutter) var(--s-9); margin: 0; max-width: calc(var(--max) + 2 * var(--gutter)); width: 100%; justify-self: center; }
}

/* ---------- Results ---------- */
.intro { display: grid; gap: var(--s-4); }
.kicker { color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; }
.sub { color: var(--text-2); max-width: 46ch; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); font-size: var(--fs-sm); color: var(--text-2); margin-top: var(--s-2); }
.legend i { display: inline-block; width: 18px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.legend .k-sales i, .bar .sales { background: var(--sales); }
.legend .k-cost i, .bar .cost { background: var(--cost); }

.list-head { display: flex; align-items: end; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-3); }
.sort { display: flex; gap: 2px; background: var(--paper-2); border: 1px solid var(--rule); padding: 3px; border-radius: var(--r-2); }
.sort button { min-height: 44px; padding: 0 var(--s-3); border: 0; background: transparent; border-radius: 6px; font-weight: 700; font-size: var(--fs-sm); color: var(--text-2); cursor: pointer; }
.sort button:hover { color: var(--text); }
.sort button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

.ranks { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); }
.ranks li + li { border-top: 1px solid var(--rule); }
.rank {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px var(--s-3); align-items: baseline;
  padding: var(--s-4); color: inherit; text-decoration: none; min-height: 88px;
}
.rank:hover { background: var(--accent-tint); color: inherit; }
.rank:hover .handle { text-decoration: underline; text-underline-offset: 3px; }
.rank .pos { font-family: var(--font-display); font-weight: 750; font-size: var(--fs-md); color: var(--text-3); font-variant-numeric: tabular-nums; }
.rank .who { min-width: 0; }
.rank .meta { color: var(--text-2); font-size: var(--fs-sm); }
.rank .total { text-align: right; font-family: var(--font-display); font-variation-settings: "wdth" 82; font-weight: 750; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.rank .total small { display: block; font-family: var(--font-body); font-variation-settings: normal; font-weight: 400; font-size: var(--fs-sm); color: var(--text-2); }
.rank .bar { grid-column: 2 / 4; display: grid; gap: 3px; margin-top: var(--s-2); }
.bar span { display: block; height: 8px; border-radius: 2px; min-width: 2px; }
.rank .verdict { grid-column: 2 / 4; font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.rank .verdict b { color: var(--text); font-weight: 700; }

.feed { list-style: none; margin: var(--s-3) 0 0; padding: 0; }
.feed li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-3); align-items: baseline; padding: 12px 0; border-top: 1px solid var(--rule); }
.feed li:last-child { border-bottom: 1px solid var(--rule); }
.feed .when { color: var(--text-2); font-size: var(--fs-sm); display: block; }
.feed .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.feed .handle { font-weight: 600; }
.empty { padding: var(--s-6) 0; color: var(--text-2); }
.empty p + p, .empty p + .btn-row { margin-top: var(--s-3); }
.foot-actions { margin-top: var(--s-8); padding-top: var(--s-5); border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; justify-content: space-between; }

/* ---------- One source ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: calc(-1 * var(--s-2)) 0 var(--s-3) calc(-1 * var(--s-2)); padding: 0 var(--s-2); text-decoration: none; font-weight: 700; border-radius: var(--r-2); }
.back:hover { background: var(--accent-tint); }
.back svg { width: 18px; height: 18px; }
.who-head { display: grid; gap: var(--s-2); margin-bottom: var(--s-6); }
.who-head h1 { overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: 1fr 1fr; margin: var(--s-6) 0 0; border-top: 1px solid var(--rule); }
.facts div { padding: var(--s-4) var(--s-3) var(--s-4) 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.facts div:nth-child(even) { padding-left: var(--s-4); border-left: 1px solid var(--rule); }
.facts dt { font-size: var(--fs-sm); color: var(--text-2); }
.facts dd { margin: 2px 0 0; font-family: var(--font-display); font-variation-settings: "wdth" 82; font-weight: 750; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
.note { margin-top: var(--s-4); color: var(--text-2); font-size: var(--fs-sm); max-width: 52ch; }

.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); padding: var(--s-5); }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-4); }
.sec-head p { color: var(--text-2); font-size: var(--fs-sm); flex-basis: 100%; }

.share { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: var(--s-5); align-items: start; }
.share .qr { width: 132px; aspect-ratio: 1; border: 1px solid var(--rule); border-radius: var(--r-1); overflow: hidden; background: #fff; }
.share .link { font-weight: 700; overflow-wrap: anywhere; }
.share .code { font-family: var(--font-code); font-weight: 700; font-size: var(--fs-lg); letter-spacing: 0.06em; line-height: 1.1; }
.share .btn-row { margin-top: var(--s-4); }
@media (max-width: 420px) {
  .share { grid-template-columns: 1fr; }
  .share .qr { width: 168px; }
}

.details { display: grid; gap: var(--s-4); }
.details dl { margin: 0; display: grid; gap: var(--s-3); }
.details dt { font-size: var(--fs-sm); color: var(--text-2); }
.details dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- forms ---------- */
.form { display: grid; gap: var(--s-5); }
.form-head { display: grid; gap: var(--s-2); margin-bottom: var(--s-5); }
.form-head p { color: var(--text-2); max-width: 48ch; }
.form .actions { display: grid; gap: var(--s-3); margin-top: var(--s-2); }
.form-error { color: var(--error); font-weight: 600; }
@media (max-width: 359px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Counter ---------- */
.counter { display: grid; gap: var(--s-4); }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-2); }
.code-input { font-family: var(--font-code); font-weight: 700; font-size: var(--fs-xl); letter-spacing: 0.08em; text-transform: uppercase; min-height: 64px; padding: 8px 14px; }
.code-input::placeholder { color: var(--rule-2); letter-spacing: 0.08em; }
.bill-input { font-family: var(--font-display); font-variation-settings: "wdth" 82; font-weight: 750; font-size: var(--fs-xl); min-height: 64px; font-variant-numeric: tabular-nums; }
.affix.big > span { font-family: var(--font-display); font-weight: 750; font-size: var(--fs-xl); left: 16px; }
.affix.big > .input { padding-left: 40px; }
.scan-btn { min-height: 64px; padding: 0 var(--s-4); }
.check { min-height: 22px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.check.ok { color: var(--accent); }
.check.bad { color: var(--error); }

.done {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--s-3); align-items: start;
  background: var(--accent-tint); border: 1px solid var(--accent-ring); border-radius: var(--r-2); padding: var(--s-4);
}
.done .tick { width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; }
.done .tick svg { width: 22px; height: 22px; }
.done .tick path { stroke-dasharray: 24; stroke-dashoffset: 0; animation: draw 360ms var(--ease) both; }
@keyframes draw { from { stroke-dashoffset: 24; } }
.done strong { display: block; font-size: var(--fs-md); line-height: 1.3; }
.done .btn { margin-top: var(--s-3); min-height: 44px; }

.scanner { position: fixed; inset: 0; z-index: 70; background: #000; display: grid; grid-template-rows: 1fr auto; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; left: 50%; top: 42%; width: min(64vw, 280px); aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid #fff; border-radius: var(--r-3); box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
.scanner .bar-bottom { padding: var(--s-4) var(--gutter) calc(var(--s-4) + env(safe-area-inset-bottom)); background: #000; color: #fff; display: grid; gap: var(--s-3); text-align: center; }


/* ---------- Yogelo additions ---------- */
.sec-title { font-size: var(--fs-lg); margin-bottom: var(--s-3); }
.sec-sub { color: var(--text-2); font-size: var(--fs-sm); max-width: 52ch; margin: calc(-1 * var(--s-2)) 0 var(--s-4); }
.rank .name, .slist .name, .eng .name { font-weight: 700; overflow-wrap: anywhere; }
.rank .meta { display: block; }
.rank.is-dead .total { color: var(--text-3); }
.rank.is-dead .verdict b { color: var(--error); }
.rank.is-dead .pos { visibility: hidden; }
#dead:focus { outline: none; }
.feed .fname { font-weight: 600; }

/* engagement check: three numbers in a row, a calm flag when likes are high and customers aren't */
.eng { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); }
.eng li + li { border-top: 1px solid var(--rule); }
.eng a { display: grid; gap: var(--s-2); padding: var(--s-4); color: inherit; text-decoration: none; }
.eng a:hover { background: var(--accent-tint); }
.eng-who .meta { display: block; color: var(--text-2); font-size: var(--fs-sm); }
.eng-nums { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-5); font-size: var(--fs-sm); color: var(--text-2); }
.eng-nums b { font-family: var(--font-display); font-size: var(--fs-md); color: var(--text); font-weight: 750; margin-right: 4px; }
.eng-nums .cust b { color: var(--pista-700); }
.eng li.is-hollow .eng-nums .cust b { color: var(--error); }
.eng-line { font-size: var(--fs-sm); color: var(--text-2); }
.eng-line b, .eng-verdict b { color: var(--text); }
.eng li.is-hollow .eng-line { background: var(--paper-2); border-radius: var(--r-1); padding: var(--s-3); color: var(--text); }
.eng-verdict.is-hollow { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); padding: var(--s-4); color: var(--text); }
.eng-form { display: grid; gap: var(--s-3); }
.eng-verdict { margin-top: var(--s-4); font-size: var(--fs-sm); color: var(--text-2); max-width: 56ch; }
.grid-3 { display: grid; gap: var(--s-3); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-3 > * { min-width: 0; }
.static { min-height: var(--tap); display: flex; align-items: center; font-family: var(--font-display); font-weight: 750; font-size: var(--fs-md); }

/* sources list */
.sgroup { margin-top: var(--s-7); }
.slist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); }
.slist li + li { border-top: 1px solid var(--rule); }
.slist a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s-3); align-items: baseline; padding: var(--s-4); min-height: 72px; color: inherit; text-decoration: none; }
.slist a:hover { background: var(--accent-tint); }
.slist .meta { grid-column: 1 / -1; color: var(--text-2); font-size: var(--fs-sm); }
.code-chip { font-family: var(--font-code); font-weight: 700; font-size: var(--fs-sm); letter-spacing: .06em; padding: 2px 8px; border: 1px solid var(--rule-2); border-radius: var(--r-1); }
.tag { display: inline-block; font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 700; color: var(--text-2); background: var(--paper-2); border-radius: var(--r-1); padding: 0 6px; vertical-align: 2px; }
.mono { font-family: var(--font-code); letter-spacing: .04em; }
.sentence.sm { font-size: clamp(1.75rem, 8vw, 2.75rem); }
.who-head .kicker { font-weight: 600; }
.code-in { font-family: var(--font-code); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.today { margin-top: var(--s-7); }
.share .link { margin-top: var(--s-2); color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; }

/* ---------- Print ---------- */
.print-bar { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; justify-content: space-between; margin-bottom: var(--s-5); }
.preview { display: grid; justify-items: center; padding: var(--s-5) 0; }
.preview .flyer { width: min(100%, 105mm); }
.preview .voucher { width: min(100%, 90mm); }
.sheet { display: none; }

/* the flyer: A6, the offer is the one bold thing, raspberry block on white paper */
.flyer {
  aspect-ratio: 105 / 148; background: #fff; color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r-3); overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto auto; container-type: inline-size;
}
.flyer header { display: flex; justify-content: space-between; align-items: baseline; padding: 7cqw 7cqw 0; }
.flyer .f-logo { font-size: 10cqw; }
.flyer .f-where { font-weight: 700; font-size: 3.6cqw; color: var(--ink-2); }
.flyer .f-offer {
  margin: 5cqw 7cqw 0; align-self: start; font-family: var(--font-display); font-variation-settings: "wdth" 80; font-weight: 800;
  font-size: 15cqw; line-height: .92; letter-spacing: -0.03em; color: var(--berry-700);
}
.flyer .f-sub { margin: 0 7cqw; font-size: 4cqw; color: var(--ink-2); align-self: end; padding-bottom: 4cqw; }
.flyer .f-bottom { display: grid; grid-template-columns: 30cqw 1fr; gap: 5cqw; align-items: center; margin: 0 7cqw; padding: 4cqw 0; border-top: 1px solid var(--rule); }
.flyer .f-qr svg { width: 100%; height: auto; }
.flyer .f-code span { display: block; font-size: 3.4cqw; color: var(--ink-2); font-weight: 600; }
.flyer .f-code b { display: block; font-family: var(--font-code); font-weight: 700; font-size: 12cqw; letter-spacing: .05em; line-height: 1.1; color: var(--ink); }
.flyer footer { background: var(--berry-700); color: #fff; padding: 4cqw 7cqw 5cqw; display: grid; gap: .6cqw; font-size: 3.4cqw; }
.flyer footer span:first-child { font-weight: 700; font-size: 3.8cqw; }
.flyer .f-terms { opacity: .85; }

/* the voucher: credit-card proportions, for clubs and schools */
.voucher {
  aspect-ratio: 90 / 50; background: #fff; color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r-2); overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) 38%; container-type: inline-size;
}
.voucher .v-main { padding: 5cqw 5cqw 4cqw; display: grid; align-content: space-between; }
.voucher .v-logo { font-size: 7.5cqw; }
.voucher .v-offer { font-family: var(--font-display); font-variation-settings: "wdth" 80; font-weight: 800; font-size: 9cqw; line-height: .95; letter-spacing: -0.02em; color: var(--berry-700); }
.voucher .v-addr { font-size: 3.2cqw; color: var(--ink-2); font-weight: 600; }
.voucher .v-side { background: var(--berry-700); display: grid; align-content: center; justify-items: center; gap: 2cqw; padding: 4cqw; }
.voucher .v-qr { width: 100%; background: #fff; border-radius: 1.5cqw; padding: 1cqw; }
.voucher .v-qr svg { width: 100%; height: auto; }
.voucher .v-code { font-family: var(--font-code); color: #fff; font-size: 6cqw; letter-spacing: .06em; }

.wordmark { font-family: var(--font-display); font-variation-settings: "wdth" 85; font-weight: 800; letter-spacing: -0.035em; color: var(--berry-700); line-height: 1; font-size: 1.75rem; }

@media print {
  @page { size: A4 portrait; margin: 0; }
  body { background: #fff; }
  .top, .no-print, .toast, .skip { display: none !important; }
  .shell { display: block; }
  main { padding: 0; margin: 0; max-width: none; }
  .sheet { display: grid; width: 210mm; }
  .sheet-flyer { grid-template-columns: repeat(2, 105mm); grid-auto-rows: 148.5mm; }
  .sheet-flyer .flyer { width: 105mm; height: 148.5mm; aspect-ratio: auto; border-radius: 0; border: 0; outline: 0.2mm dashed #ccc; outline-offset: -0.1mm; }
  .sheet-voucher { grid-template-columns: repeat(2, 90mm); grid-auto-rows: 50mm; gap: 6mm 10mm; padding: 13mm 10mm; }
  .sheet-voucher .voucher { width: 90mm; height: 50mm; aspect-ratio: auto; border: 0.2mm dashed #bbb; }
  .flyer, .voucher { break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.grid-2, .grid-3 { align-items: start; }
