/* QR Suite — "Ink & module" design system.
   Ink on paper, square modules, the QR finder pattern as the brand mark.
   Emerald = action, marigold = attention (Zambian green & eagle-orange). */
:root {
  --paper: #f2f4f1; --surface: #ffffff; --sunk: #f7f8f6;
  --ink: #12201a; --ink-2: #1c2e26; --ink-3: #2f4339;
  --line: #dce2dd; --line-2: #c9d2cb;
  --text: #12201a; --muted: #5b6b63; --faint: #8c9a93;
  --primary: #0a7550; --primary-dark: #075c3f; --primary-soft: #e2f1ea;
  --mari: #f4b000; --mari-soft: #fff4d1; --mari-ink: #7a5600;
  --ok: #0a7550; --ok-soft: #e2f1ea; --warn: #8a5a00; --warn-soft: #fff4d1; --danger: #c2352b; --danger-soft: #fcecea;
  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --display: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --font: 'Instrument Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --lift: 0 18px 50px -12px rgba(18, 32, 26, .28);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 400 15px/1.55 var(--font); background: var(--paper); color: var(--text); -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum' 0; }
a { color: var(--primary); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -.015em; line-height: 1.15; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Finder pattern — the brand mark and the "you are here" marker */
.finder { display: inline-block; width: 22px; height: 22px; border: 3px solid currentColor; position: relative; flex: none; border-radius: 3px; }
.finder::after { content: ''; position: absolute; inset: 3px; background: currentColor; border-radius: 1px; }
.brand-mark { width: 30px; height: 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; flex: none; }
.brand-mark i { border: 2.5px solid currentColor; border-radius: 2px; position: relative; }
.brand-mark i::after { content: ''; position: absolute; inset: 2.5px; background: currentColor; }
.brand-mark i.dot { border: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.brand-mark i.dot::after { position: static; inset: auto; background: var(--mari); border-radius: 1px; grid-column: 2; grid-row: 2; }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; font: 700 1.12rem var(--display); letter-spacing: -.02em; }

/* ── Shell ─────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #b8c6bf; padding: 22px 12px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.side > .brand { padding: 0 10px 22px; }
.side .create { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 4px 16px; padding: 10px 12px; border-radius: var(--r); background: var(--mari); color: var(--ink); font-weight: 700; text-decoration: none; font-size: .92rem; }
.side .create:hover { background: #ffc21a; }
.nav-sec { font-size: .76rem; color: #74877e; padding: 18px 12px 6px; font-weight: 600; }
.side a.nv { display: flex; align-items: center; gap: 12px; color: #c9d5cf; text-decoration: none; padding: 9px 12px; border-radius: var(--r-sm); font-size: .92rem; font-weight: 500; position: relative; }
.side a.nv:hover { background: var(--ink-2); color: #fff; }
.side a.nv.on { background: var(--ink-2); color: #fff; font-weight: 600; }
.side a.nv.on::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; background: var(--mari); border-radius: 0 3px 3px 0; }
.side .ico { width: 18px; height: 18px; flex: none; opacity: .85; }
.side a.nv.on .ico { opacity: 1; color: var(--mari); }
.side .pill { margin-left: auto; background: var(--mari); color: var(--ink); border-radius: 5px; font-size: .72rem; padding: 0 6px; font-weight: 800; line-height: 1.6; }
.side-foot { margin-top: auto; padding: 14px 12px 4px; border-top: 1px solid var(--ink-2); font-size: .82rem; }
.side-foot .biz { color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .side-plan { color: #8fa39a; margin-top: 2px; }
.side-foot .side-plan a { color: var(--mari); }
.side-foot form { margin: 10px 0 0; }
.side-foot button { background: none; border: 0; color: #8fa39a; cursor: pointer; padding: 0; font: inherit; text-decoration: underline; text-underline-offset: 3px; }
.side-foot button:hover { color: #fff; }
.main { min-width: 0; padding: 30px 40px 64px; max-width: 1400px; }
.topbar { display: none; }
.page-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-title h1 { margin: 0; font-size: 2rem; font-weight: 700; letter-spacing: -.025em; }
.page-title p { margin: 6px 0 0; color: var(--muted); max-width: 64ch; }
.page-title .actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(18, 32, 26, .5); }
  .topbar { display: flex; align-items: center; gap: 14px; background: var(--ink); color: #fff; padding: 12px 16px; position: sticky; top: 0; z-index: 50; }
  .topbar button { background: none; border: 0; color: #fff; cursor: pointer; padding: 4px; display: grid; }
  .main { padding: 22px 16px 56px; }
  .page-title h1 { font-size: 1.6rem; }
}

/* ── Building blocks ───────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; }
.panel + .panel { margin-top: 18px; }
.grid > .panel + .panel, .grid > div > .panel:first-child { margin-top: 0; }
.panel h2, .panel h3 { margin: 0 0 14px; font-size: 1.08rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* Stats sit in one ruled strip instead of separate floating cards */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.stats > div { padding: 18px 22px; border-left: 1px solid var(--line); }
.stats > div:first-child { border-left: 0; }
@media (max-width: 900px) { .stats { grid-template-columns: 1fr 1fr; } .stats > div:nth-child(3) { border-left: 0; } .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); } }
.stat .k, .stats .k { color: var(--muted); font-size: .84rem; font-weight: 500; }
.stat .v, .stats .v { font: 700 2.1rem/1.1 var(--display); margin-top: 4px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .s, .stats .s { color: var(--faint); font-size: .8rem; margin-top: 2px; }
.stats .v.hot { color: var(--primary); }
.stat { padding: 18px 20px; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.mt { margin-top: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.empty { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty .big { width: 54px; height: 54px; margin: 0 auto 14px; color: var(--line-2); }
.empty .big .finder { width: 54px; height: 54px; border-width: 7px; }
.empty .big .finder::after { inset: 7px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid transparent; background: var(--sunk); color: var(--text); font: 600 .9rem var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; line-height: 1.4; }
.btn:hover { background: #e8ece8; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: var(--surface); border-color: var(--line-2); }
.btn-outline:hover { background: var(--sunk); border-color: var(--faint); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #f8d9d6; }
.btn-ok { background: var(--primary); color: #fff; }
.btn-ok:hover { background: var(--primary-dark); }
.btn-mari { background: var(--mari); color: var(--ink); }
.btn-mari:hover { background: #ffc21a; }
.btn-small, .btn-sm { padding: 6px 11px; font-size: .82rem; }
.btn-lg { padding: 12px 22px; font-size: 1rem; border-radius: var(--r); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.linkish { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 4px; font-size: .76rem; font-weight: 600; background: var(--primary-soft); color: var(--primary-dark); letter-spacing: 0; text-transform: none; }
.badge.ok { background: var(--ok-soft); color: var(--primary-dark); }
.badge.warn { background: var(--mari-soft); color: var(--mari-ink); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.grey { background: #edf0ed; color: var(--muted); }

.alert { padding: 12px 16px; border-radius: var(--r); margin-bottom: 20px; font-size: .92rem; border: 1px solid; border-left-width: 4px; }
.alert-ok { background: var(--ok-soft); color: #064a33; border-color: #b6dcc9; border-left-color: var(--primary); }
.alert-warn { background: var(--mari-soft); color: #5e4300; border-color: #f1dc9a; border-left-color: var(--mari); }
.alert-error { background: var(--danger-soft); color: #8a221a; border-color: #f2c4bf; border-left-color: var(--danger); }
.alert a { color: inherit; font-weight: 700; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .lbl { font-size: .86rem; font-weight: 600; color: var(--ink-3); }
.field .help { font-size: .8rem; color: var(--muted); font-weight: 400; }
.req { color: var(--danger); }
.in, .field input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font: 400 .95rem var(--font); background: #fff; color: var(--text); min-width: 0; }
.field textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.in:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10, 117, 80, .15); }
.field input[type=color] { width: 54px; height: 40px; padding: 3px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; cursor: pointer; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: .92rem; cursor: pointer; margin-bottom: 12px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .frow { grid-template-columns: 1fr; } }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }

/* Scan chart: square modules stacked like a QR column */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 10px; border-bottom: 1px solid var(--line-2); }
.bars .b { flex: 1; background: var(--primary); border-radius: 2px 2px 0 0; min-height: 3px; position: relative; opacity: .9; }
.bars .b:last-child { background: var(--mari); opacity: 1; }
.bars .b:hover { opacity: 1; background: var(--primary-dark); }
.bars .b:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: .76rem; padding: 4px 8px; border-radius: 4px; white-space: nowrap; z-index: 2; }
.bars-x { display: flex; justify-content: space-between; color: var(--faint); font-size: .78rem; margin-top: 8px; }
.meter { height: 8px; background: #e9ede9; border-radius: 2px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--primary); }
.split { display: flex; flex-direction: column; gap: 12px; }
.split .r { display: grid; grid-template-columns: 84px 1fr 42px; align-items: center; gap: 12px; font-size: .88rem; }
.split .r span:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* ── QR code grid ───────────────────────────────────── */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.toolbar .in { max-width: 260px; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s; }
.qcard:hover { border-color: var(--line-2); }
.qcard .img { background: var(--sunk); display: grid; place-items: center; padding: 20px; position: relative; border-bottom: 1px solid var(--line); }
.qcard .img img { width: 148px; height: 148px; object-fit: contain; mix-blend-mode: multiply; }
.qcard .img .badge { position: absolute; top: 12px; left: 12px; background: #fff; border: 1px solid var(--line); }
.qcard .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.qcard h3 { margin: 0; font: 600 1rem var(--font); letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qcard h3 a { color: inherit; text-decoration: none; }
.qcard .meta { color: var(--muted); font-size: .82rem; display: flex; gap: 10px; flex-wrap: wrap; }
.qcard .acts { display: flex; gap: 6px; margin-top: auto; padding-top: 10px; flex-wrap: wrap; }
.qcard.paused .img img { opacity: .3; filter: grayscale(1); }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); font-size: .85rem; font-weight: 500; color: var(--ink-3); text-decoration: none; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--ink-3); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Type picker */
.picker-search { max-width: 520px; font-size: 1.05rem !important; padding: 13px 16px !important; border-radius: var(--r) !important; }
.cat { margin-top: 34px; }
.cat h2 { font-size: 1.25rem; margin: 0 0 14px; display: flex; gap: 10px; align-items: baseline; }
.cat h2 .n { color: var(--faint); font: 500 .9rem var(--font); }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.tcard { display: flex; gap: 14px; align-items: flex-start; padding: 16px; background: var(--surface); text-decoration: none; color: var(--text); transition: background .12s; }
.tcard:hover { background: var(--primary-soft); }
.tcard .ti { font-size: 1.3rem; width: 40px; height: 40px; display: grid; place-items: center; background: var(--sunk); border-radius: var(--r-sm); flex: none; }
.tcard:hover .ti { background: #fff; }
.tcard b { display: block; font-size: .95rem; font-weight: 600; }
.tcard span { display: block; font-size: .82rem; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.tcard .kind { display: inline-flex; gap: 6px; align-items: center; margin-top: 8px; font-size: .76rem; font-weight: 600; color: var(--primary-dark); }
.tcard .kind::before { content: ''; width: 7px; height: 7px; background: currentColor; border-radius: 1px; }
.tcard .kind.k-static { color: var(--muted); }
.tcard .kind.k-redirect { color: var(--mari-ink); }
.tgrid .tcard[hidden] { display: none; }

/* ── Editor ─────────────────────────────────────────── */
.ed { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 26px; align-items: start; }
.ed-side { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1150px) { .ed { grid-template-columns: 1fr; } .ed-side { position: static; } }
.tabs { display: flex; gap: 2px; margin: -6px -6px 22px; padding: 4px; background: var(--sunk); border-radius: var(--r); overflow-x: auto; }
.tab { flex: 1; padding: 9px 14px; border: 0; background: none; font: 600 .9rem var(--font); color: var(--muted); cursor: pointer; border-radius: var(--r-sm); white-space: nowrap; }
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(18, 32, 26, .12); }
.ed h4.sub { margin: 26px 0 14px; font: 700 1rem var(--display); color: var(--ink); padding-top: 22px; border-top: 1px solid var(--line); }
.ed h4.sub:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.lst { border: 1px solid var(--line); border-radius: var(--r); background: var(--sunk); padding: 12px; margin-bottom: 16px; }
.lst > .lbl { display: block; margin: 0 2px 10px; }
.lst-item { background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 12px 2px; margin-bottom: 8px; position: relative; }
.lst-item .lst { background: var(--sunk); }
.lst-head { display: flex; align-items: center; gap: 6px; margin: -4px 0 12px; }
.lst-head .t { font-size: .86rem; font-weight: 600; color: var(--ink-3); flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.icon-btn { width: 28px; height: 28px; border-radius: 5px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: inline-grid; place-items: center; font-size: .82rem; color: var(--ink-3); padding: 0; text-decoration: none; }
.icon-btn:hover { background: var(--sunk); border-color: var(--line-2); }
.icon-btn.del:hover { background: var(--danger-soft); color: var(--danger); border-color: #f2c4bf; }
.lst-item.collapsed > :not(.lst-head) { display: none; }
.lst-item.collapsed { padding-bottom: 8px; }
.add-btn { width: 100%; border: 1px dashed var(--line-2); background: #fff; border-radius: var(--r-sm); padding: 10px; font: 600 .88rem var(--font); color: var(--primary); cursor: pointer; }
.add-btn:hover { border-style: solid; border-color: var(--primary); background: var(--primary-soft); }
.up { border: 1px dashed var(--line-2); border-radius: var(--r-sm); padding: 10px; display: flex; gap: 12px; align-items: center; background: #fff; flex-wrap: wrap; }
.up .thumb { width: 52px; height: 52px; border-radius: 5px; background: var(--sunk); flex: none; display: grid; place-items: center; font-size: 1.3rem; overflow: hidden; }
.up .thumb img { width: 100%; height: 100%; object-fit: cover; }
.up .nm { flex: 1; min-width: 120px; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up .nm small { display: block; color: var(--muted); }
.up input[type=file] { display: none; }
.up.busy { opacity: .55; pointer-events: none; }
.gallery-up { display: flex; flex-wrap: wrap; gap: 8px; }
.gallery-up .g { width: 74px; height: 74px; border-radius: 6px; overflow: hidden; position: relative; background: var(--sunk); }
.gallery-up .g img { width: 100%; height: 100%; object-fit: cover; }
.gallery-up .g button { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 4px; border: 0; background: rgba(18, 32, 26, .78); color: #fff; font-size: .7rem; cursor: pointer; padding: 0; }
.gallery-up label.addimg { width: 74px; height: 74px; border-radius: 6px; border: 1px dashed var(--line-2); display: grid; place-items: center; color: var(--primary); cursor: pointer; font-size: 1.4rem; background: #fff; }
.hours { display: grid; grid-template-columns: 100px 1fr 1fr 64px; gap: 6px 10px; align-items: center; font-size: .88rem; }
.hours input[type=time] { padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 5px; font: inherit; }
.phone-frame { width: 100%; max-width: 350px; margin: 0 auto; border-radius: 40px; border: 9px solid var(--ink); background: #fff; overflow: hidden; box-shadow: var(--lift); height: 640px; position: relative; }
.phone-frame iframe { border: 0; width: 100%; height: calc(100% - 34px); margin-top: 34px; display: block; }
.phone-frame .notch { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 92px; height: 24px; background: var(--ink); border-radius: 14px; z-index: 2; }
.qr-prev { text-align: center; }
.qr-prev img { width: 200px; height: auto; border-radius: 6px; }
.qr-prev .payload { font-size: .78rem; color: var(--muted); word-break: break-all; margin-top: 10px; max-height: 60px; overflow: hidden; }
.savebar { position: sticky; bottom: 0; background: rgba(242, 244, 241, .94); backdrop-filter: blur(10px); border-top: 1px solid var(--line); margin: 24px -40px -64px; padding: 14px 40px; display: flex; gap: 12px; align-items: center; z-index: 5; }
@media (max-width: 900px) { .savebar { margin: 24px -16px -56px; padding: 12px 16px; } }
.savebar .err { color: var(--danger); font-size: .9rem; font-weight: 600; flex: 1; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.mode-pick label { border: 1px solid var(--line-2); border-radius: var(--r); padding: 12px 14px; cursor: pointer; font-size: .84rem; color: var(--muted); }
.mode-pick label b { display: block; color: var(--text); font-size: .94rem; margin-bottom: 2px; }
.mode-pick input { display: none; }
.mode-pick label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.swatches button { width: 26px; height: 26px; border-radius: 5px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; }

/* Show page */
.show { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1000px) { .show { grid-template-columns: 1fr; } }
.show .qrbig { text-align: center; }
.show .qrbig img { width: 100%; max-width: 270px; }
.copy { display: flex; margin-top: 14px; }
.copy input { flex: 1; min-width: 0; border: 1px solid var(--line-2); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); padding: 9px 11px; font: .86rem var(--font); background: var(--sunk); }
.copy button { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; font-size: .92rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }

/* Inbox */
.sub-item { border: 1px solid var(--line); border-radius: var(--r); background: #fff; padding: 16px 18px; margin-bottom: 10px; }
.sub-item.new { box-shadow: inset 4px 0 0 var(--mari); }
.sub-item.winner { box-shadow: inset 4px 0 0 var(--primary), 0 0 0 2px var(--mari); }
.sub-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.sub-top .t { font: 700 1.02rem var(--display); }
.ans { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 6px 16px; font-size: .9rem; }
.ans dt { color: var(--muted); }
.ans dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.items-mini { font-size: .9rem; margin: 8px 0 12px; background: var(--sunk); border-radius: var(--r-sm); padding: 10px 12px; font-variant-numeric: tabular-nums; }
.items-mini div { display: flex; justify-content: space-between; padding: 2px 0; }

/* Billing */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; display: flex; flex-direction: column; position: relative; }
.plan.pop { border: 2px solid var(--ink); padding: 23px; }
.plan .tag { position: absolute; top: -12px; left: 22px; background: var(--mari); color: var(--ink); font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 4px; }
.plan h3 { margin: 0; font-size: 1.3rem; }
.plan .price { font: 700 2.3rem/1.1 var(--display); letter-spacing: -.03em; margin: 14px 0 0; font-variant-numeric: tabular-nums; }
.plan .price small { font: 500 .9rem var(--font); color: var(--muted); letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 18px 0 22px; font-size: .92rem; display: flex; flex-direction: column; gap: 9px; }
.plan li { display: flex; gap: 10px; }
.plan li::before { content: ''; width: 8px; height: 8px; margin-top: .45em; background: var(--primary); border-radius: 1px; flex: none; }
.plan .btn { margin-top: auto; }
.substatus { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.substatus .ring { width: 52px; height: 52px; border-radius: var(--r); display: grid; place-items: center; font-size: 1.4rem; flex: none; font-weight: 800; }

/* Modal (payment) */
.modal { position: fixed; inset: 0; background: rgba(18, 32, 26, .55); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal.open { display: flex; }
.modal-box { background: #fff; border-radius: 18px; width: 100%; max-width: 440px; max-height: 94vh; overflow-y: auto; box-shadow: var(--lift); }
.modal-head { padding: 22px 24px 0; display: flex; align-items: flex-start; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 1.3rem; }
.modal-head p { margin: 4px 0 0; font-size: .88rem; color: var(--muted); }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 18px 24px 24px; }
.ops { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ops label { border: 1px solid var(--line-2); border-radius: var(--r); padding: 11px 6px; text-align: center; cursor: pointer; }
.ops label b { display: block; font-size: .86rem; }
.ops label small { color: var(--muted); font-size: .74rem; }
.ops input { display: none; }
.ops label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--sunk); }
.op-mtn b { color: #8a6a00; } .op-airtel b { color: #c2352b; } .op-zamtel b { color: var(--primary); }
.amount-box { background: var(--ink); color: #fff; border-radius: var(--r); padding: 16px 18px; margin-bottom: 18px; display: flex; align-items: center; gap: 12px; }
.amount-box .muted { color: #9fb3aa; }
.amount-box .tot { font: 700 1.7rem var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; align-items: center; border: 1px solid #3b5148; border-radius: var(--r-sm); overflow: hidden; }
.stepper button { width: 34px; height: 34px; border: 0; background: var(--ink-2); color: #fff; font-size: 1.1rem; cursor: pointer; }
.stepper span { min-width: 34px; text-align: center; font-weight: 700; }
.phone-in { display: flex; }
.phone-in span { padding: 11px 12px; background: var(--sunk); border: 1px solid var(--line-2); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); font-weight: 700; font-size: .95rem; }
.phone-in input { border-radius: 0 var(--r-sm) var(--r-sm) 0 !important; font-size: 1.08rem !important; letter-spacing: .04em; }
.status-ico { width: 72px; height: 72px; border-radius: 16px; margin: 6px auto 16px; display: grid; place-items: center; border: 2px solid var(--primary); background: var(--primary-soft); font-size: 1.9rem; }
.spinner { width: 28px; height: 28px; border: 3px solid #b6dcc9; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sandbox-note { margin-top: 12px; background: var(--mari-soft); color: #5e4300; border-radius: var(--r-sm); padding: 10px; font-size: .84rem; text-align: center; }
.otp { text-align: center; font-size: 1.4rem !important; letter-spacing: .5em; font-weight: 800; }

/* Toasts (live inbox alerts) */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; max-width: 340px; }
.toast { background: var(--ink); color: #fff; border-radius: var(--r); padding: 13px 16px; box-shadow: var(--lift); font-size: .9rem; display: flex; gap: 12px; align-items: flex-start; animation: pop .25s ease-out; text-decoration: none; border-left: 4px solid var(--mari); }
.toast b { display: block; }
.toast .e { font-size: 1.3rem; }
@keyframes pop { from { transform: translateY(12px); opacity: 0; } }

/* Legacy card pages inside the new shell */
.main .generator-card { margin-top: 0; border: 1px solid var(--line); box-shadow: none; border-radius: var(--r-lg); }
.main .page-head h2 { font: 700 2rem var(--display); letter-spacing: -.025em; }
.main .card-tile { box-shadow: none; border: 1px solid var(--line); }

/* Auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-art { background: var(--ink); color: #c9d5cf; padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ''; position: absolute; top: 44px; right: 52px; width: 112px; height: 112px; border: 16px solid var(--ink-2); border-radius: 14px; box-shadow: inset 0 0 0 14px var(--ink), inset 0 0 0 60px var(--ink-2); }
.auth-art h2 { font-size: 2.5rem; line-height: 1.08; color: #fff; margin: 0 0 22px; max-width: 14ch; letter-spacing: -.03em; }
.auth-art ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; max-width: 40ch; position: relative; z-index: 1; }
.auth-art li { display: flex; gap: 12px; }
.auth-art li::before { content: ''; width: 9px; height: 9px; background: var(--mari); margin-top: .5em; border-radius: 1px; flex: none; }
.auth-art small { position: relative; z-index: 1; color: #8fa39a; }
.auth-form { display: grid; place-items: center; padding: 40px 20px; background: var(--surface); }
.auth-form .box { width: 100%; max-width: 400px; }
.auth-form h1 { margin: 0 0 6px; font-size: 2rem; letter-spacing: -.025em; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* Print sheet */
.sheet { display: flex; flex-wrap: wrap; gap: 8mm; padding: 10mm; }
.sheet .cell { text-align: center; font: 600 9pt var(--font); break-inside: avoid; }
.sheet .cell img { display: block; margin: 0 auto 2mm; }
@media print { .no-print { display: none !important; } body { background: #fff; } }

/* ════════════════════════════════════════════════════════════════
   Phones & small tablets: native-app shell
   ════════════════════════════════════════════════════════════════ */
.tabbar, .sheet-wrap, .install-banner { display: none; }
.install-cta[hidden] { display: none !important; }
.side button.nv { background: none; border: 0; width: 100%; font: inherit; cursor: pointer; text-align: left; }
.d-hide { display: none !important; }

@media (max-width: 900px) {
  :root { --tabbar: 62px; --topbar: 54px; }
  html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
  body.app { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); background: var(--paper); }
  body.no-scroll { overflow: hidden; }
  .m-hide { display: none !important; }
  .d-hide { display: revert !important; }

  /* Top bar: translucent, title appears once the large heading scrolls away */
  .shell { display: block; }
  .side { display: none !important; }
  .topbar { display: flex; align-items: center; gap: 4px; position: sticky; top: 0; z-index: 50; height: calc(var(--topbar) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 6px 0; background: rgba(242, 244, 241, .86); -webkit-backdrop-filter: blur(16px) saturate(1.6); backdrop-filter: blur(16px) saturate(1.6); color: var(--ink); border-bottom: 1px solid transparent; transition: border-color .2s, background .2s; }
  .topbar.scrolled { border-bottom-color: var(--line); background: rgba(242, 244, 241, .94); }
  .topbar .tb-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--ink); text-decoration: none; position: relative; flex: none; }
  .topbar .tb-btn:active { background: rgba(18, 32, 26, .08); }
  .topbar .tb-btn .ico { width: 22px; height: 22px; opacity: 1; }
  .topbar .tb-brand .brand-mark { width: 26px; height: 26px; color: var(--ink); }
  .topbar .tb-title { flex: 1; min-width: 0; text-align: center; font: 700 1.02rem var(--display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transform: translateY(4px); transition: opacity .18s, transform .18s; }
  .topbar.show-title .tb-title { opacity: 1; transform: none; }
  .tb-dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--mari); box-shadow: 0 0 0 2px var(--paper); }

  .main { padding: 4px 16px 28px; max-width: none; animation: enter .24s cubic-bezier(.2, .8, .3, 1); }
  @keyframes enter { from { opacity: 0; transform: translateY(6px); } }
  .page-title { margin-bottom: 18px; align-items: stretch; flex-direction: column; gap: 12px; }
  .page-title h1 { font-size: 1.85rem; line-height: 1.08; letter-spacing: -.03em; }
  .page-title p { font-size: .94rem; margin-top: 6px; }
  .page-title .actions { width: 100%; }
  .page-title .actions > *, .page-title .actions form .btn { flex: 1 1 auto; }

  /* Bottom tab bar with a raised “New” button */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom); background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font: 600 .7rem var(--font); color: var(--muted); background: none; border: 0; text-decoration: none; position: relative; padding: 0; cursor: pointer; transition: transform .12s; }
  .tabbar a:active, .tabbar button:active { transform: scale(.92); }
  .tabbar .ico { width: 23px; height: 23px; opacity: 1; }
  .tabbar .on { color: var(--ink); }
  .tabbar .on .ico { color: var(--primary); stroke-width: 2.1; }
  .tabbar .fab-in { width: 50px; height: 50px; margin-top: -24px; border-radius: 16px; background: var(--mari); color: var(--ink); display: grid; place-items: center; box-shadow: 0 8px 20px -6px rgba(122, 86, 0, .55), 0 0 0 4px var(--paper); }
  .tabbar .fab-in .ico { width: 26px; height: 26px; stroke-width: 2.2; color: var(--ink) !important; }
  .tabbar .fab.on span:last-child { color: var(--ink); }
  .tabbar .badge-dot { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--mari); color: var(--ink); font: 800 .66rem/18px var(--font); text-align: center; box-shadow: 0 0 0 2px #fff; }

  /* “More” bottom sheet */
  .sheet-wrap { display: flex; position: fixed; inset: 0; z-index: 90; background: rgba(18, 32, 26, 0); align-items: flex-end; pointer-events: none; transition: background .25s; }
  .sheet-wrap.open { background: rgba(18, 32, 26, .45); pointer-events: auto; }
  .bsheet { width: 100%; max-height: 88vh; overflow-y: auto; background: var(--paper); border-radius: 22px 22px 0 0; padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform .32s cubic-bezier(.2, .9, .25, 1); overscroll-behavior: contain; }
  .sheet-wrap.open .bsheet { transform: none; }
  .bsheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 4px auto 14px; }
  .sheet-head { display: flex; gap: 12px; align-items: center; padding: 4px 4px 16px; }
  .sheet-head .sh-av { width: 44px; height: 44px; border-radius: 12px; background: var(--ink); color: var(--mari); display: grid; place-items: center; font: 800 1.2rem var(--display); flex: none; }
  .sheet-head b { display: block; font: 700 1.05rem var(--display); }
  .sheet-head span { color: var(--muted); font-size: .86rem; }
  .sheet-sec { font-size: .8rem; color: var(--muted); font-weight: 600; margin: 14px 6px 8px; }
  .sheet-list { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 0 0 10px; }
  .sheet-list a, .sheet-list button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); text-decoration: none; font: 500 1rem var(--font); text-align: left; cursor: pointer; }
  .sheet-list > :first-child { border-top: 0; }
  .sheet-list a:active, .sheet-list button:active { background: var(--sunk); }
  .sheet-list .ico { width: 21px; height: 21px; color: var(--primary); opacity: 1; }
  .sheet-list .danger, .sheet-list .danger .ico { color: var(--danger); }

  /* Install banner */
  .install-banner { display: flex; align-items: center; gap: 12px; background: var(--ink); color: #fff; border: 0; padding: 12px 12px 12px 14px; border-radius: 14px; }
  .install-banner[hidden] { display: none; }
  .install-banner .ib-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--ink-2); display: grid; place-items: center; flex: none; color: #fff; }
  .install-banner .ib-ico .brand-mark { width: 22px; height: 22px; }
  .install-banner .ib-txt { flex: 1; font-size: .84rem; color: #b8c6bf; line-height: 1.35; }
  .install-banner .ib-txt b { display: block; color: #fff; font-size: .94rem; }
  .install-banner .icon-btn { background: transparent; border-color: #3b5148; color: #b8c6bf; }

  /* Touch-sized controls, no iOS zoom on focus */
  .btn { min-height: 44px; border-radius: 10px; }
  .btn-sm, .btn-small { min-height: 36px; }
  .btn:active { transform: scale(.97); }
  .in, .field input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), .field select, .field textarea { font-size: 16px; padding: 12px 13px; border-radius: 10px; }
  .check input { width: 22px; height: 22px; margin-top: 0; }
  .check { align-items: center; min-height: 40px; }

  /* Surfaces */
  .panel { padding: 18px 16px; border-radius: 16px; }
  .grid { gap: 14px; }
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .stats > div { padding: 14px 16px; }
  .stats .v, .stat .v { font-size: 1.7rem; }
  .alert { border-radius: 12px; }

  /* Horizontal scrollers instead of wrapping rows */
  .chip-row { flex-wrap: nowrap; overflow-x: auto; margin-left: -16px; margin-right: -16px; padding: 2px 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip-row .chip { scroll-snap-align: start; padding: 8px 14px; flex: none; }
  .toolbar { gap: 8px; }
  .toolbar .in { max-width: none !important; flex: 1 1 100%; }
  .toolbar > .btn { flex: 1; }
  .tbl-wrap { margin: 0 -16px; padding: 0 16px; -webkit-overflow-scrolling: touch; }
  .tbl { font-size: .88rem; }

  /* Tables marked .stack become cards */
  .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .tbl.stack tr:first-child:has(th) { display: none; }
  .tbl.stack tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .tbl.stack tr:last-child { border-bottom: 0; }
  .tbl.stack td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right !important; }
  .tbl.stack td::before { content: attr(data-label); color: var(--muted); text-align: left; font-size: .84rem; }
  .tbl.stack td:empty { display: none; }
  .tbl.stack td.full { display: block; text-align: left !important; padding-top: 8px; }
  .tbl.stack td.full::before { display: none; }

  /* QR codes: app-style list */
  .qgrid { grid-template-columns: 1fr; gap: 10px; }
  .qcard { flex-direction: row; border-radius: 14px; }
  .qcard .img { padding: 10px; border-bottom: 0; border-right: 1px solid var(--line); flex: none; }
  .qcard .img img { width: 84px; height: 84px; }
  .qcard .img .sel { width: 15px !important; height: 15px !important; top: 6px !important; right: 6px !important; }
  .qcard .body { padding: 10px 12px; min-width: 0; }
  .qcard h3 { font-size: .98rem; }
  .qcard .meta { font-size: .78rem; gap: 6px; }
  .qcard .acts { padding-top: 6px; }
  .qcard .acts .btn { min-height: 32px; padding: 5px 10px; font-size: .8rem; }

  /* Type picker */
  .picker-search { position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top) + 6px); z-index: 5; max-width: none; box-shadow: 0 6px 20px -10px rgba(18, 32, 26, .25); }
  .tgrid { grid-template-columns: 1fr; border-radius: 14px; }
  .tcard { padding: 14px; }
  .tcard:active { background: var(--primary-soft); }
  .cat { margin-top: 26px; }

  /* Editor: full-screen task, tab bar hidden, save bar at the bottom, preview in a sheet */
  body.is-editor { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.is-editor .tabbar { display: none; }
  .ed { display: block; }
  .ed > .panel { border-radius: 16px; }
  .tabs { position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top)); z-index: 6; margin: -6px -4px 18px; box-shadow: 0 6px 16px -12px rgba(18, 32, 26, .4); }
  .savebar { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .95); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); z-index: 40; flex-wrap: wrap; }
  .savebar .err:empty { display: none; }
  .savebar .err { flex: 1 1 100%; order: -1; font-size: .84rem; }
  .savebar #save { flex: 1; }
  .savebar .pv-btn { display: inline-flex; }
  .ed-side { position: fixed; inset: 0; z-index: 80; background: rgba(18, 32, 26, .55); padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 16px); overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .ed-side.open { opacity: 1; pointer-events: auto; }
  .ed-side .phone-frame { height: min(640px, 72vh); max-width: 340px; }
  .ed-side .qr-prev { width: 100%; max-width: 340px; }
  .ed-side .pv-close { display: inline-flex; }
  .mode-pick { grid-template-columns: 1fr; }
  .hours { grid-template-columns: 82px 1fr 1fr 40px; font-size: .82rem; }
  .lst { padding: 10px; margin-left: -4px; margin-right: -4px; }

  /* Show page */
  .show { gap: 14px; }
  dl.kv { grid-template-columns: 1fr; gap: 2px 0; }
  dl.kv dd { margin-bottom: 10px; }
  .copy button { min-height: 42px; }

  /* Inbox */
  .sub-item { padding: 14px; border-radius: 14px; }
  .ans { grid-template-columns: 1fr; gap: 0; }
  .ans dt { margin-top: 8px; font-size: .8rem; }

  /* Billing & payment sheet */
  .plans { grid-template-columns: 1fr; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-box { max-width: none; border-radius: 22px 22px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); animation: up .3s cubic-bezier(.2, .9, .25, 1); }
  @keyframes up { from { transform: translateY(100%); } }
  .toasts { left: 12px; right: 12px; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 10px); max-width: none; }
  .empty { padding: 36px 12px; }
}
.pv-btn, .pv-close { display: none; }

/* Installed app: no browser-ish bits */
@media (display-mode: standalone) {
  .install-cta, .install-banner { display: none !important; }
  .tabbar, .topbar, .bsheet { -webkit-user-select: none; user-select: none; }
}
