:root {
  --bg: #ebebee;
  --surface: #ffffff;
  --surface-hover: #f7f7f9;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --line: rgba(0, 0, 0, .08);
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .08);
  --accent: #0071e3;
  --danger: #e0352b;
  --heart: #ff2d55;
  --star: #f5a000; --star-off: rgba(118, 118, 128, .28);
  --accent-hover: #0077ed;
  --bar: rgba(235, 235, 238, .72);
  --grad: linear-gradient(90deg, #0a84ff 0%, #7d5cff 55%, #ec5f8f 100%);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .04);
  --sheet-shadow: 0 24px 80px rgba(0, 0, 0, .18);

  --s-ordered: #0071e3;   --s-ordered-bg: rgba(0, 113, 227, .10);
  --s-delivered: #248a3d; --s-delivered-bg: rgba(52, 199, 89, .14);
  --s-failed: #d70015;    --s-failed-bg: rgba(255, 59, 48, .10);
  --s-returned: #8944ab;  --s-returned-bg: rgba(175, 82, 222, .12);

  --mono-l: 95%; --mono-tl: 42%; --mono-s: 70%;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161618; --surface: #222225; --surface-hover: #2a2a2e;
    --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #8e8e93;
    --line: rgba(255, 255, 255, .09); --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .16);
    --accent: #0a84ff; --accent-hover: #409cff; --danger: #ff453a; --star: #ffb340; --star-off: rgba(160, 160, 170, .3); --bar: rgba(22, 22, 24, .72);
    --shadow: none; --sheet-shadow: 0 24px 80px rgba(0, 0, 0, .6);
    --s-ordered: #409cff;   --s-ordered-bg: rgba(10, 132, 255, .18);
    --s-delivered: #30d158; --s-delivered-bg: rgba(48, 209, 88, .16);
    --s-failed: #ff6961;    --s-failed-bg: rgba(255, 69, 58, .18);
    --s-returned: #da8fff;  --s-returned-bg: rgba(191, 90, 242, .2);
    --mono-l: 20%; --mono-tl: 78%; --mono-s: 45%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161618; --surface: #222225; --surface-hover: #2a2a2e;
  --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #8e8e93;
  --line: rgba(255, 255, 255, .09); --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .16);
  --accent: #0a84ff; --accent-hover: #409cff; --danger: #ff453a; --star: #ffb340; --star-off: rgba(160, 160, 170, .3); --bar: rgba(22, 22, 24, .72);
  --shadow: none; --sheet-shadow: 0 24px 80px rgba(0, 0, 0, .6);
  --s-ordered: #409cff;   --s-ordered-bg: rgba(10, 132, 255, .18);
  --s-delivered: #30d158; --s-delivered-bg: rgba(48, 209, 88, .16);
  --s-failed: #ff6961;    --s-failed-bg: rgba(255, 69, 58, .18);
  --s-returned: #da8fff;  --s-returned-bg: rgba(191, 90, 242, .2);
  --mono-l: 20%; --mono-tl: 78%; --mono-s: 45%;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Top bar ---------- */
.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--bar);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.bar .wrap { height: 56px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--grad);
  display: grid; place-items: center; color: #fff;
}
.bar-end { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.theme-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--fill); color: var(--text); display: grid; place-items: center; transition: background .2s; }
.theme-btn:hover { background: var(--fill-2); }
.theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }

.seg { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--fill); gap: 2px; }
.seg button {
  border: 0; background: none; padding: 6px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap;
  transition: background .2s, box-shadow .2s;
}
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 1px rgba(0,0,0,.04); }
.seg button .c { color: var(--text-3); margin-left: 4px; font-weight: 400; }

.btn {
  border: 0; border-radius: 980px; padding: 8px 16px; font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; transition: background .2s, transform .1s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--fill); }
.btn-danger { background: none; color: var(--s-failed); padding-left: 4px; padding-right: 4px; }
kbd {
  font-family: inherit; font-size: 11px; padding: 1px 5px; border-radius: 4px;
  background: rgba(255,255,255,.2); margin-left: 2px;
}

/* ---------- Orders view ---------- */
.hero { padding: 56px 0 28px; }
.eyebrow { margin: 0 0 4px; color: var(--text-2); font-size: 15px; font-weight: 500; }
h1 { margin: 0; font-family: var(--font-display); font-size: 48px; line-height: 1.05; font-weight: 700; letter-spacing: -.035em; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: var(--surface); border-radius: 18px; padding: 18px 20px 20px; box-shadow: var(--shadow); }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.stat-value { font-family: var(--font-display); font-size: 32px; font-weight: 600; letter-spacing: -.03em; margin-top: 6px; line-height: 1.1; }
.stat-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.stat-value.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 40px 0 4px; flex-wrap: wrap; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input {
  width: 260px; height: 36px; border: 0; border-radius: 10px; background: var(--fill);
  padding: 0 12px 0 32px; font-size: 14px; outline: none; transition: box-shadow .2s;
}
.search input::placeholder { color: var(--text-3); }
.search input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }

.group-head { display: flex; align-items: baseline; justify-content: space-between; padding: 28px 4px 10px; }
.group-head h2 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.group-head span { color: var(--text-2); font-size: 15px; }
.group { background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); }

.row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 130px 104px 110px; gap: 16px; align-items: center;
  padding: 14px 20px; position: relative; cursor: pointer; transition: background .15s;
  width: 100%; border: 0; background: none; text-align: left;
}
.row + .row::before { content: ""; position: absolute; top: 0; left: 78px; right: 0; height: 1px; background: var(--line); }
.row:hover { background: var(--surface-hover); }
.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 12px; }
.mono {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 600; font-size: 17px; letter-spacing: -.01em;
  background: hsl(var(--h) var(--mono-s) var(--mono-l)); color: hsl(var(--h) 65% var(--mono-tl));
}
.mono.logo { background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,.07); overflow: hidden; }
.mono.logo img { width: 64%; height: 64%; object-fit: contain; display: block; }
.mono.logo.full img { width: 100%; height: 100%; object-fit: cover; }
.row .mono { transition: transform .15s; }
.row .mono:hover { transform: scale(1.06); }
.info { min-width: 0; }
.name { font-weight: 600; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.meta .arrow { color: var(--text-3); font-size: 12px; }
.meta .dur { margin-left: 4px; font-size: 12px; font-weight: 600; padding: 1px 7px; border-radius: 980px; }
.dur[data-s="delivered"] { color: var(--s-delivered); background: var(--s-delivered-bg); }
.dur[data-s="returned"]  { color: var(--s-returned);  background: var(--s-returned-bg); }
.dur[data-s="failed"]    { color: var(--s-failed);    background: var(--s-failed-bg); }
.who-inline { display: none; }
.row .rcol { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; pointer-events: none; }
.rate-inline { display: none; }
.who { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; min-width: 0; }
.who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .av { width: 22px; height: 22px; font-size: 10px; }
.av {
  width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 8px; font-weight: 700; color: #fff; background: hsl(var(--h) 55% 52%); flex: none;
}
.amount { font-weight: 600; font-size: 16px; text-align: right; letter-spacing: -.01em; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 9px; border-radius: 980px;
  font-size: 12px; font-weight: 500; white-space: nowrap; justify-self: start;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill[data-s="ordered"]   { color: var(--s-ordered);   background: var(--s-ordered-bg); }
.pill[data-s="delivered"] { color: var(--s-delivered); background: var(--s-delivered-bg); }
.pill[data-s="failed"]    { color: var(--s-failed);    background: var(--s-failed-bg); }
.pill[data-s="returned"]  { color: var(--s-returned);  background: var(--s-returned-bg); }

.empty { text-align: center; padding: 72px 20px; color: var(--text-2); }
.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }
.foot { text-align: center; color: var(--text-3); font-size: 13px; padding: 48px 0 64px; }

/* ---------- Stores view ---------- */
.stores-hero { text-align: center; padding: 72px 0 32px; }
.stores-hero .eyebrow { color: #bf4800; font-weight: 600; font-size: 17px; margin-bottom: 8px; }
.stores-hero h1 { font-size: clamp(48px, 9vw, 88px); letter-spacing: -.045em; }
.gradtext { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stores-hero p.sub { font-size: 21px; color: var(--text-2); margin: 16px 0 0; letter-spacing: -.01em; }
.cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 32px auto 0; max-width: 820px; }
.cats a {
  text-decoration: none; color: var(--text); background: var(--fill-2); padding: 8px 16px; border-radius: 980px;
  font-size: 14px; transition: background .2s;
}
.cats a:hover { background: var(--fill); }
.stores-tools { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin: 28px 0 8px; }
.tools-mid { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; }
.manage-btn { justify-self: end; }
.legend { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.legend i { width: 18px; height: 12px; border-radius: 980px; border: 2px solid transparent;
  background: linear-gradient(var(--bg), var(--bg)) padding-box, var(--grad) border-box; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 28px; }
.card { background: var(--surface); border-radius: 28px; padding: 32px; box-shadow: var(--shadow); scroll-margin-top: 80px; }
.card.wide { grid-column: 1 / -1; }
.card h2 { margin: 0; font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.card .count { color: var(--text-2); margin: 4px 0 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 2px solid transparent; background: var(--bg); padding: 9px 18px; border-radius: 980px;
  font-size: 16px; letter-spacing: -.01em; transition: transform .15s, box-shadow .2s;
}
.chip { display: inline-flex; align-items: center; gap: 8px; }
.chip .cl { width: 22px; height: 22px; border-radius: 6px; background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.07); }
.chip .cl img { width: 72%; height: 72%; object-fit: contain; display: block; }
.chip .cl.full img { width: 100%; height: 100%; object-fit: cover; }
.chip:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.chip.hot { background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box; }

/* ---------- Sheet ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.28);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 460px; background: var(--surface); border-radius: 24px; padding: 20px 24px 24px;
  box-shadow: var(--sheet-shadow); transform: translateY(16px) scale(.98); transition: transform .3s cubic-bezier(.2,.9,.3,1.1);
  max-height: calc(100vh - 32px); overflow: auto;
}
.backdrop.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h3 { margin: 0; font-size: 17px; font-weight: 600; }
.icon-btn { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--fill); display: grid; place-items: center; color: var(--text-2); }
.amount-input { display: flex; align-items: baseline; justify-content: center; padding: 24px 0 20px; }
.amount-input span { font-size: 36px; font-weight: 600; color: var(--text-3); margin-right: 2px; }
.amount-input input {
  border: 0; outline: none; background: none; font-family: var(--font-display);
  font-size: 56px; font-weight: 600; letter-spacing: -.04em; width: 4ch; max-width: 80%; text-align: left;
}
.amount-input input::placeholder { color: var(--text-3); opacity: .5; }
.fgroup { background: var(--fill-2); border-radius: 14px; }
.frow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; min-height: 48px; position: relative; }
.frow + .frow::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--line); }
.frow > span { font-weight: 500; }
.frow input { border: 0; outline: none; background: none; text-align: right; flex: 1; min-width: 0; font-size: 15px; }
.frow input::placeholder { color: var(--text-3); }
.flabel { font-size: 13px; color: var(--text-2); margin: 18px 4px 8px; font-weight: 500; }
.reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s cubic-bezier(.2,.9,.3,1), margin-top .3s; margin-top: 0; }
.reveal.open { grid-template-rows: 1fr; margin-top: 10px; }
.reveal > div { overflow: hidden; min-height: 0; }
.resolve-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; min-height: 48px; }
.resolve-row > span { font-weight: 500; }
.resolve-row input { border: 0; outline: none; background: none; text-align: right; font-size: 15px; }
.resolve-hint { font-size: 13px; margin: 8px 4px 0; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.resolve-hint b { font-weight: 600; padding: 1px 7px; border-radius: 980px; }
.resolve-hint.bad { color: var(--s-failed); }
@media (prefers-reduced-motion: reduce) { .reveal { transition: none; } }
.people { display: flex; gap: 8px; flex-wrap: wrap; }
.people { gap: 12px; }
.person {
  border: 0; background: none; padding: 0; border-radius: 50%; display: grid; place-items: center;
  box-shadow: 0 0 0 2px transparent; transition: box-shadow .15s, transform .15s;
}
.person:hover { transform: translateY(-1px); }
.person .av { width: 38px; height: 38px; font-size: 15px; }
.person[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.person:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.flabel .by-name { color: var(--text); margin-left: 4px; }
.seg.full { display: flex; }
.seg.full button { flex: 1; padding: 7px 8px; }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; gap: 12px; }
.sheet-foot .btn-primary { padding: 12px 28px; font-size: 15px; margin-left: auto; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 980px;
  font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px;
  opacity: 0; transition: opacity .25s, transform .3s cubic-bezier(.2,.9,.3,1.2); pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

[hidden] { display: none !important; }

/* ---------- Stores: collapse + add ---------- */
.more-wrap { display: flex; justify-content: center; margin-top: 14px; }
.more-btn {
  border: 0; background: none; color: var(--accent); font-size: 15px; font-weight: 500;
  padding: 6px 2px; display: inline-flex; align-items: center; gap: 4px;
}
.more-btn:hover { text-decoration: underline; }
.more-btn svg { transition: transform .2s; }
.more-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.chip.just-added { animation: pop 1.6s ease; }
@keyframes pop { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 30% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.frow select { border: 0; outline: none; background: none; text-align: right; font-size: 15px; color: var(--text); flex: 1; min-width: 0; cursor: pointer; }
.frow select option { color: #1d1d1f; }
.add-error { color: var(--s-failed); font-size: 13px; margin: 8px 4px 0; min-height: 18px; }
.stores-sheet { max-width: 480px; }
.add-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.add-row .add-error { margin: 0; }
.add-row .btn { padding: 9px 22px; flex: none; }
.s-section { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.s-section .flabel { margin: 0 4px; }
.search.mini input { width: 150px; height: 30px; font-size: 13px; border-radius: 8px; }
.search.mini svg { left: 9px; }
.store-list { margin-top: 8px; background: var(--fill-2); border-radius: 14px; max-height: min(46vh, 420px); overflow-y: auto; overscroll-behavior: contain; }
.srow { position: relative; }
.srow + .srow::before { content: ""; position: absolute; top: 0; left: 54px; right: 0; height: 1px; background: var(--line); }
.srow-main {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 10px; gap: 12px; align-items: center;
  width: 100%; border: 0; background: none; text-align: left; padding: 9px 14px; font-size: 15px;
}
.srow-main:hover { background: var(--fill-2); }
.srow-main:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px; }
.srow .mono { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
.srow .sname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.srow .scat { color: var(--text-3); font-size: 13px; white-space: nowrap; }
.srow .chev { color: var(--text-3); }
.srow.editing { padding: 12px; background: var(--surface); box-shadow: inset 0 0 0 2px var(--accent); border-radius: 14px; }
.srow.editing::before { display: none; }
.srow.editing + .srow::before { display: none; }
.srow.editing .fgroup { background: var(--fill-2); }
.s-hint { font-size: 12px; color: var(--text-3); margin: 8px 4px 0; }
.s-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.s-actions .btn-danger { margin-right: auto; }
.s-actions .btn { padding: 8px 16px; }
.s-empty { padding: 20px; text-align: center; color: var(--text-2); font-size: 14px; }
.new-row { animation: pop 1.6s ease; }

/* ---------- Up Next ---------- */
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 20px; align-items: start; }
.plan { background: var(--surface); border-radius: 24px; padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.plan-head { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.plan-head h2 { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -.025em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-head p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.plan-total { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -.025em; }
.plan-items { background: var(--fill-2); border-radius: 16px; overflow: hidden; }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; position: relative; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 76px; right: 0; height: 1px; background: var(--line); }
.item-main { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 4px 10px 12px; border: 0; background: none; text-align: left; width: 100%; min-width: 0; }
.item-main:hover { background: var(--fill-2); }
.item-main:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 12px; }
.thumb { width: 52px; height: 52px; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
  background: hsl(var(--h) var(--mono-s) var(--mono-l)); color: hsl(var(--h) 60% var(--mono-tl)); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-info { min-width: 0; }
.item-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-top: 3px; min-width: 0; }
.item-meta .d { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta .lnk { color: var(--accent); }
.item-price { font-weight: 600; font-size: 15px; }
.like { border: 0; background: none; padding: 8px 14px 8px 8px; display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--text-3); font-size: 11px; font-weight: 600; min-width: 40px; }
.like svg { width: 19px; height: 19px; transition: transform .15s; }
.like:hover svg { transform: scale(1.12); }
.like[aria-pressed="true"] { color: var(--heart); }
.plan-empty { padding: 22px; text-align: center; color: var(--text-2); font-size: 14px; }
.plan-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-foot .btn { padding: 8px 14px; }
.plan-foot .btn-primary { margin-left: auto; }
.link-danger { border: 0; background: none; color: var(--s-failed); font-size: 14px; padding: 8px 6px; }
.link-danger:hover { text-decoration: underline; }
.photo-pick { display: grid; place-items: center; height: 160px; margin-top: 18px; border-radius: 16px; background: var(--fill-2); cursor: pointer; overflow: hidden; color: var(--text-2); position: relative; }
.photo-pick:hover, .photo-pick.drop { background: var(--fill); }
.photo-pick.drop { outline: 2px dashed var(--accent); outline-offset: -6px; }
.photo-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
#photoPreview { width: 100%; height: 100%; display: grid; place-items: center; }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-pick .ph { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; }
.photo-pick .ph small { color: var(--text-3); font-weight: 400; font-size: 12px; text-align: center; padding: 0 16px; }
.photo-pick .change { position: absolute; right: 10px; bottom: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 980px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty-plans { grid-column: 1 / -1; text-align: center; color: var(--text-2); padding: 64px 20px; background: var(--surface); border-radius: 24px; }
.empty-plans strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 4px; }

/* ---------- Delete confirmation ---------- */
.confirm-bg {
  position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.35);
  display: grid; place-items: center; padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.confirm-bg.open { opacity: 1; pointer-events: auto; }
.confirm {
  width: 100%; max-width: 320px; background: var(--surface); border-radius: 22px; padding: 24px 20px 18px;
  text-align: center; box-shadow: var(--sheet-shadow); transform: scale(.94); transition: transform .25s cubic-bezier(.2,.9,.3,1.2);
}
.confirm-bg.open .confirm { transform: none; }
.confirm .mono { margin: 0 auto 14px; width: 52px; height: 52px; border-radius: 14px; }
.confirm h3 { margin: 0; font-size: 17px; font-weight: 600; }
.confirm p { margin: 6px 0 0; color: var(--text-2); font-size: 14px; }
.confirm .c-order { color: var(--text); font-weight: 500; }
.c-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 20px; }
.c-actions .btn { justify-content: center; padding: 11px 16px; font-size: 15px; }
.c-delete { background: var(--danger); color: #fff; }
.c-delete:hover { filter: brightness(1.08); }

/* ---------- Store drawer ---------- */
.drawer-bg {
  position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.28);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.drawer-bg.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 45; width: min(440px, 100%);
  background: var(--bg); box-shadow: var(--sheet-shadow); overflow-y: auto; overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) max(20px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 24px) 20px;
  transform: translateX(104%); transition: transform .35s cubic-bezier(.2,.9,.3,1); visibility: hidden;
  display: flex; flex-direction: column; gap: 20px;
}
.drawer.open { transform: none; visibility: visible; }
.d-head { display: flex; align-items: center; gap: 14px; }
.d-head .mono { width: 56px; height: 56px; border-radius: 15px; font-size: 22px; flex: none; }
.d-head h2 { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.d-head p { margin: 3px 0 0; color: var(--text-2); font-size: 14px; }
.d-head .icon-btn { margin-left: auto; align-self: flex-start; flex: none; }
.d-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.d-stats .stat { padding: 14px 16px 16px; }
.d-stats .stat-value { font-size: 24px; }
.d-stats .stat.rating { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.d-stats .stat.rating .stat-value { display: flex; align-items: center; gap: 10px; margin-top: 0; }
.d-title { margin: 4px 4px -8px; font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.drow {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  width: 100%; border: 0; background: none; text-align: left; padding: 12px 16px; position: relative; cursor: pointer;
}
.drow + .drow::before { content: ""; position: absolute; top: 0; left: 58px; right: 0; height: 1px; background: var(--line); }
.drow:hover { background: var(--surface-hover); }
.drow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 12px; }
.drow .av { width: 30px; height: 30px; font-size: 12px; }
.drow .amt { font-weight: 600; font-size: 15px; }
.drow .meta { margin-top: 2px; }
.drow .end { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.d-empty { text-align: center; color: var(--text-2); padding: 28px 16px; }
.d-new { justify-content: center; padding: 12px 20px; font-size: 15px; margin-top: 4px; }

.stars { display: inline-flex; gap: 2px; color: var(--star); }
.stars svg { width: var(--sz, 14px); height: var(--sz, 14px); }
.stars .off { color: var(--star-off); }
.rate { display: inline-flex; gap: 4px; }
.rate button { border: 0; background: none; padding: 2px; color: var(--star-off); line-height: 0; border-radius: 6px; transition: transform .1s; }
.rate button.on { color: var(--star); }
.rate button:hover { transform: scale(1.12); }
.rate button:focus-visible { outline: 2px solid var(--accent); }
.rate svg { width: 24px; height: 24px; }
.rate-row + .rate-row, .resolve-row + .resolve-row { border-top: 1px solid var(--line); margin-left: 16px; padding-left: 0; }

@media (max-width: 640px) {
  .drow .info, .drow .end, .drow .av { grid-area: auto; }
  .item .thumb, .item-info, .item-price { grid-area: auto; }
  .plan { padding: 16px; border-radius: 20px; }
  .item-main { grid-template-columns: 46px minmax(0, 1fr) auto; gap: 10px; }
  .thumb { width: 46px; height: 46px; }
  .item + .item::before { left: 68px; }
  .bar nav button { padding: 6px 11px; }
  .srow .mono, .srow .sname, .srow .scat, .srow .chev { grid-area: auto; }
  .srow .scat { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
  .search.mini input { width: 120px; }
  .drawer { width: 100%; top: auto; height: 92vh; border-radius: 24px 24px 0 0; transform: translateY(104%); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--bg); }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .cards { grid-template-columns: 1fr; }
}
@media (min-width: 641px) and (max-width: 1000px) {
  .row { grid-template-columns: 44px minmax(0, 1fr) 76px 110px 96px 96px; gap: 12px; }
  .row .rcol { position: static; transform: none; justify-self: center; }
}
@media (min-width: 641px) and (max-width: 820px) {
  .row { grid-template-columns: 44px minmax(0, 1fr) 76px 24px 96px 92px; }
  .who span:last-child { display: none; }
}
@media (max-width: 640px) {
  .stores-tools { grid-template-columns: 1fr; justify-items: stretch; }
  .tools-spacer { display: none; }
  .tools-mid { flex-direction: column; align-items: stretch; }
  .manage-btn { justify-self: end; }
  .wrap { padding: 0 16px; }
  .bar .wrap { grid-template-columns: auto 1fr auto; }
  .brand span { display: none; }
  .bar nav { justify-self: center; }
  .btn-primary .lbl, .btn-primary kbd { display: none; }
  .btn-primary.new { padding: 8px 10px; }
  .hero { padding: 32px 0 20px; }
  h1 { font-size: 36px; }
  .stat { padding: 14px 16px 16px; }
  .stat-value { font-size: 24px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .seg { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .toolbar .seg button { flex: none; }
  .toolbar { min-width: 0; }
  .search input { width: 100%; }
  .row { grid-template-columns: 40px 1fr auto; grid-template-areas: "m i a" "m i s"; row-gap: 4px; padding: 12px 16px; }
  .row + .row::before { left: 70px; }
  .row .mono { grid-area: m; width: 40px; height: 40px; }
  .row .info { grid-area: i; }
  .row .amount { grid-area: a; }
  .row .pill { grid-area: s; justify-self: end; }
  .who { display: none; }
  .row .rcol { display: none; }
  .rate-inline { display: inline-flex; margin-left: 4px; }
  .row .meta { flex-wrap: wrap; row-gap: 3px; }
  .card { padding: 24px; border-radius: 24px; }
  .backdrop { place-items: end center; padding: 0; }
  .sheet { border-radius: 24px 24px 0 0; max-height: 92vh; }
}

/* ---------- Live logos ---------- */
.mono > img { display: none; }
.mono.logo > img { display: block; }
.mono.logo > .ml { display: none; }
.cl:not(.logo) { display: none; }

/* ---------- Link autofill + errors ---------- */
.item-hint { font-size: 13px; color: var(--text-2); margin: 8px 4px 0; }
.item-hint:empty { display: none; }
.item-hint.ok { color: var(--s-delivered); }
.item-hint.warn { color: var(--s-failed); }
.toast.error { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }
