/* 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 { font-family: var(--font-display); font-variation-settings: "wdth" 82; font-weight: 700; font-size: var(--fs-md); line-height: 1.2; min-width: 0; overflow-wrap: anywhere; }
.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(--green-700); }
.tabs a[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; background: var(--green-700); 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 { font-size: var(--fs-lg); }
  .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(--green-50); }
  .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(--marigold); }
.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(--green-50); 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; }

/* ---------- Influencer ---------- */
.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(--green-50); }
.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; }
}

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: var(--s-4); }
.photos figure { position: relative; margin: 0; aspect-ratio: 4 / 5; background: var(--paper-2); border-radius: var(--r-1); overflow: hidden; }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.photos .del { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; border: 0; border-radius: var(--r-1); background: rgba(23,25,26,.72); color: #fff; cursor: pointer; display: grid; place-items: center; }
.photos .del:hover { background: var(--ink); }
.photos .del svg { width: 18px; height: 18px; }
.photos figcaption { position: absolute; left: 6px; bottom: 6px; background: rgba(255,255,255,.92); color: var(--ink); font-size: var(--fs-xs); font-weight: 700; padding: 1px 6px; border-radius: 3px; }
.photo-empty { border: 1px dashed var(--rule-2); border-radius: var(--r-2); padding: var(--s-5); color: var(--text-2); margin-bottom: var(--s-4); }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

.captions { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.captions li { border: 1px solid var(--rule); border-radius: var(--r-2); padding: var(--s-4); background: var(--surface); }
.captions p { white-space: pre-line; overflow-wrap: anywhere; }
.captions .btn { margin-top: var(--s-3); min-height: 44px; }

.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(--green-700); }
.check.bad { color: var(--error); }

.done {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: var(--s-3); align-items: start;
  background: var(--green-50); border: 1px solid var(--green-100); border-radius: var(--r-2); padding: var(--s-4);
}
.done .tick { width: 40px; height: 40px; border-radius: 50%; background: var(--green-700); 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; }

/* ---------- Shortlist ---------- */
.plug { border: 1px dashed var(--rule-2); border-radius: var(--r-2); padding: var(--s-4); font-size: var(--fs-sm); color: var(--text-2); }
.plug b { color: var(--text); }
.slist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.slist li { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); padding: var(--s-4); display: grid; gap: var(--s-2); }
.slist li.is-no { background: transparent; }
.slist li.is-no .handle { color: var(--text-2); }
.slist .nums { font-size: var(--fs-sm); color: var(--text-2); }
.slist .notes { font-size: var(--fs-sm); }
.slist .row { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-top: var(--s-2); }
.slist select.input { width: auto; min-width: 150px; font-weight: 600; font-size: var(--fs-sm); }
