:root {
  --green: #00a36c;
  --green-600: #008458;
  --green-700: #006b47;
  --green-50: #ecfdf5;
  --blue: #3b82f6;   --blue-50: #eff6ff;
  --violet: #8b5cf6; --violet-50: #f5f3ff;
  --amber: #f59e0b;  --amber-50: #fffbeb;
  --red: #ef4444;    --red-50: #fef2f2;
  --ink: #0b1220;
  --ink-2: #344054;
  --muted: #667085;
  --line: #eaecf0;
  --line-2: #f2f4f7;
  --bg: #f7f8fa;
  --card: #fff;
  --side: #07130e;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .03);
  --shadow-lg: 0 12px 32px -12px rgba(16, 24, 40, .18);
  --side-w: 248px;
  --top-h: 68px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--green-600); text-decoration: none; }
a:hover { color: var(--green-700); }
h1, h2, h3 { font-family: var(--font-head); letter-spacing: -.02em; color: var(--ink); }
h1 { font-size: 1.75rem; margin: 0 0 .25rem; line-height: 1.2; font-weight: 800; }
h2 { font-size: 1.02rem; margin: 0; font-weight: 700; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
h3 { font-size: .92rem; margin: 1.3rem 0 .6rem; }
code, .code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .76rem; color: var(--muted); letter-spacing: .02em; }
.muted { color: var(--muted); }
.small, small { font-size: .8rem; }
.empty { padding: 1.5rem 0; text-align: center; margin: 0; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 20;
  display: flex; flex-direction: column; padding: 1.2rem .9rem;
  background: radial-gradient(120% 60% at 0% 0%, #0f3a28 0%, transparent 60%), var(--side);
  color: #cfe0d8;
}
.brand { display: flex; align-items: center; gap: .7rem; padding: .2rem .5rem 1.4rem; color: #fff; }
.brand:hover { color: #fff; }
.brand-mark {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, #34d399, #00a36c 55%, #047857); color: #fff;
  font-family: var(--font-head); font-weight: 800; font-size: .85rem;
  box-shadow: 0 6px 16px -6px rgba(16, 185, 129, .7), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-text { font-family: var(--font-head); font-weight: 800; font-size: 1rem; line-height: 1.15; }
.brand-text small { display: block; font-family: var(--font); font-weight: 500; font-size: .72rem; color: #7fa493; letter-spacing: .02em; }
.nav-label { display: block; padding: 0 .75rem .5rem; font-size: .68rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #5f8574; }
.sidenav { display: flex; flex-direction: column; gap: .2rem; }
.sidenav a {
  display: flex; align-items: center; gap: .75rem; padding: .65rem .75rem; border-radius: 11px;
  color: #b7cdc3; font-weight: 500; transition: background .15s, color .15s;
}
.sidenav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidenav a.on { background: rgba(52, 211, 153, .14); color: #fff; box-shadow: inset 0 0 0 1px rgba(52, 211, 153, .18); }
.sidenav a.on .icon { color: #34d399; }
.sidenav a span:first-of-type { flex: 1; }
.count { background: #34d399; color: #04261a; border-radius: 99px; padding: 0 .5rem; font-size: .7rem; font-weight: 700; line-height: 1.5; }
.side-user {
  margin-top: auto; display: flex; align-items: center; gap: .65rem; padding: .7rem;
  border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .06);
}
.side-user-text { flex: 1; min-width: 0; line-height: 1.25; }
.side-user-text strong { display: block; color: #fff; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text small { color: #7fa493; font-size: .74rem; }
.side-user form { margin: 0; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: #b7cdc3; cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.shell { margin-left: var(--side-w); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 10; height: var(--top-h);
  display: flex; align-items: center; gap: 1rem; padding: 0 2rem;
  background: rgba(247, 248, 250, .82); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(234, 236, 240, .8);
}
.topsearch { position: relative; flex: 1; max-width: 520px; }
.topsearch .icon { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topsearch input[type=search] { width: 100%; padding: .65rem 1rem .65rem 2.6rem; border-radius: 12px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.topmeta { margin-left: auto; display: flex; align-items: center; gap: .45rem; font-size: .82rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(0, 163, 108, .15); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(0, 163, 108, 0); } }

.main { padding: 2rem; max-width: 1480px; }
.no-nav .main { max-width: none; min-height: 100vh; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(60% 50% at 50% 0%, rgba(0, 163, 108, .12), transparent 70%), var(--bg); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.page-head p { margin: 0; }
.eyebrow { font-size: .72rem !important; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--green-600); margin-bottom: .35rem !important; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.crumbs { margin: 0 0 .3rem !important; font-size: .8rem; color: var(--muted); }
.shop-head { align-items: center; justify-content: flex-start; }
.shop-head-text { flex: 1; min-width: 260px; }
.shop-head h1 { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* ── Cards & grids ─────────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.35rem 1.4rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.card.flush { padding: 0; overflow: hidden; }
.card > h2 { margin-bottom: 1rem; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.card-head p { margin: .15rem 0 0; }
.card-head.padded { padding: 1.35rem 1.4rem 0; margin-bottom: .6rem; }
.card-head > .icon { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.grid-3-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.25rem; }
.stack-cards { display: flex; flex-direction: column; }
.more { margin-left: auto; font-size: .8rem; font-weight: 600; display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.more .icon { width: 14px; height: 14px; }
.legend { text-align: right; line-height: 1.1; }
.legend .big { display: block; font-family: var(--font-head); font-size: 1.5rem; font-weight: 800; }

/* ── Stats ─────────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-5 .hero { grid-column: 1 / -1; }
@media (min-width: 1320px) {
  .stats-5 { grid-template-columns: 1.25fr repeat(4, minmax(0, 1fr)); }
  .stats-5 .hero { grid-column: auto; }
}
.stat { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); overflow: hidden; }
.stat-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.stat-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--line-2); color: var(--ink-2); }
.stat-value { font-family: var(--font-head); font-size: 1.75rem; font-weight: 800; margin: .45rem 0 .15rem; letter-spacing: -.03em; line-height: 1.15; }
.stat-value small { font-size: .95rem; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.stat-sub { color: var(--muted); font-size: .78rem; display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.tone-green .stat-icon { background: var(--green-50); color: var(--green-600); }
.tone-blue .stat-icon { background: var(--blue-50); color: var(--blue); }
.tone-violet .stat-icon { background: var(--violet-50); color: var(--violet); }
.tone-amber .stat-icon { background: var(--amber-50); color: #d97706; }
.stat.tone-warn { border-color: #fde7c2; }
.stat.tone-warn .stat-icon { background: var(--amber-50); color: #d97706; }
.stat.tone-bad { border-color: #fecaca; background: linear-gradient(180deg, #fff, #fff8f8); }
.stat.tone-ok { border-color: #bbf7d0; }
.stat.hero { border: 0; color: #fff; background: radial-gradient(120% 120% at 100% 0%, #34d399 0%, transparent 50%), linear-gradient(135deg, #047857, #065f46 60%, #064e3b); box-shadow: 0 16px 32px -16px rgba(4, 120, 87, .6); }
.stat.hero .stat-label, .stat.hero .stat-sub { color: rgba(255, 255, 255, .78); }
.stat.hero .stat-icon { background: rgba(255, 255, 255, .15); color: #fff; }
.stat.hero .stat-value { font-size: 2.1rem; }
.trend { display: inline-flex; align-items: center; gap: .2rem; padding: .05rem .5rem; border-radius: 99px; font-weight: 600; font-size: .74rem; }
.trend.up { background: rgba(255, 255, 255, .18); color: #fff; }
.trend.down { background: rgba(0, 0, 0, .15); color: #fff; }

/* ── Charts ────────────────────────────────────────────────────────────── */
.chart-wrap { position: relative; }
.chart-max { position: absolute; top: -2px; left: 0; font-size: .7rem; color: var(--muted); }
.chart { width: 100%; height: 190px; display: block; overflow: visible; }
.chart .gridlines line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.chart .line { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: rgba(16, 24, 40, .04); }
.chart-green .line { stroke: var(--green); }
.chart-green .stop-a { stop-color: var(--green); stop-opacity: .28; }
.chart-green .stop-b { stop-color: var(--green); stop-opacity: 0; }
.chart-blue .line { stroke: var(--blue); }
.chart-blue .stop-a { stop-color: var(--blue); stop-opacity: .25; }
.chart-blue .stop-b { stop-color: var(--blue); stop-opacity: 0; }
.chart-violet .line { stroke: var(--violet); }
.chart-violet .stop-a { stop-color: var(--violet); stop-opacity: .25; }
.chart-violet .stop-b { stop-color: var(--violet); stop-opacity: 0; }
.chart-amber .line { stroke: var(--amber); }
.chart-amber .stop-a { stop-color: var(--amber); stop-opacity: .25; }
.chart-amber .stop-b { stop-color: var(--amber); stop-opacity: 0; }
.chart-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; margin-top: .5rem; }

/* ── Funnel & bars ─────────────────────────────────────────────────────── */
.funnel { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .85rem; }
.funnel-row { display: flex; justify-content: space-between; align-items: baseline; font-size: .84rem; margin-bottom: .35rem; color: var(--ink-2); }
.funnel-row strong { font-family: var(--font-head); color: var(--ink); }
.bar { height: 8px; border-radius: 99px; background: var(--line-2); overflow: hidden; flex: 1; }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #34d399, var(--green-600)); }
.funnel li:nth-child(4) .bar span { background: linear-gradient(90deg, #60a5fa, var(--blue)); }
.funnel li:nth-child(n+5) .bar span { background: linear-gradient(90deg, #a78bfa, var(--violet)); }
.country-list { display: flex; flex-direction: column; gap: .7rem; }
.country { display: flex; align-items: center; gap: .8rem; }
.cc { width: 34px; font-weight: 700; font-size: .78rem; color: var(--ink-2); font-family: ui-monospace, Menlo, monospace; }
.country strong { min-width: 2ch; text-align: right; font-size: .85rem; }

/* ── Avatars & shop rows ───────────────────────────────────────────────── */
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 12px;
  font-family: var(--font-head); font-weight: 800; font-size: .8rem; letter-spacing: .02em;
  color: hsl(var(--h) 55% 28%); background: linear-gradient(135deg, hsl(var(--h) 80% 92%), hsl(var(--h) 70% 84%));
  box-shadow: inset 0 0 0 1px hsl(var(--h) 60% 80% / .6);
}
.avatar.sm { width: 30px; height: 30px; border-radius: 9px; font-size: .7rem; }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.3rem; }
.side-user .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: .72rem; }
.shop-list { display: flex; flex-direction: column; padding: .3rem .6rem .7rem; }
.shop-row {
  display: grid; grid-template-columns: auto minmax(0, 1.3fr) minmax(0, 1fr) auto auto; align-items: center; gap: .9rem;
  padding: .75rem .8rem; border-radius: 13px; color: var(--ink); transition: background .15s;
}
.shop-row:hover { background: var(--bg); color: var(--ink); }
.shop-row.compact { grid-template-columns: auto minmax(0, 1fr) 90px 36px; padding: .6rem .8rem; }
.shop-main, .shop-owner { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.shop-main strong, .shop-owner span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-owner { font-size: .84rem; color: var(--ink-2); }
.shop-when { white-space: nowrap; }
.mini-bar { height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.mini-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #60a5fa, var(--blue)); }
.cell-shop { display: flex; align-items: center; gap: .75rem; color: var(--ink); }
.cell-shop:hover { color: var(--green-700); }
.cell-shop > span { display: flex; flex-direction: column; line-height: 1.3; }

/* ── Pills & badges ────────────────────────────────────────────────────── */
.pills { display: inline-flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .18rem .6rem .18rem .5rem; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; border: 1px solid; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-active { color: #067647; background: #ecfdf3; border-color: #abefc6; }
.pill-active i { box-shadow: 0 0 0 3px rgba(23, 178, 106, .18); }
.pill-quiet { color: #b54708; background: #fffaeb; border-color: #fedf89; }
.pill-inactive { color: #b42318; background: #fef3f2; border-color: #fecdca; }
.pill-neutral { color: var(--ink-2); background: var(--line-2); border-color: var(--line); }
.badge { display: inline-block; padding: .16rem .55rem; border-radius: 7px; font-size: .72rem; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.badge-neutral { background: var(--line-2); color: var(--ink-2); }
.badge-ok, .badge-active { background: #ecfdf3; color: #067647; }
.badge-warn, .badge-quiet { background: #fffaeb; color: #b54708; }
.badge-bad, .badge-inactive { background: #fef3f2; color: #b42318; }
.badge-info { background: var(--blue-50); color: #1d4ed8; }

/* ── Issues (dashboard) & alerts (shop) ────────────────────────────────── */
.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.issue { display: flex; align-items: center; gap: .85rem; padding: .75rem .8rem; border-radius: 13px; border: 1px solid var(--line); color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; }
.issue:hover { border-color: #d0d5dd; box-shadow: var(--shadow-lg); color: var(--ink); transform: translateY(-1px); }
.issue-icon, .feed-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; flex: none; background: var(--line-2); color: var(--ink-2); }
.tone-warn.issue-icon, .feed-icon.tone-warn { background: var(--amber-50); color: #d97706; }
.tone-info.issue-icon, .feed-icon.tone-info { background: var(--blue-50); color: var(--blue); }
.tone-bad.issue-icon, .feed-icon.tone-bad { background: var(--red-50); color: var(--red); }
.feed-icon.tone-ok { background: var(--green-50); color: var(--green-600); }
.issue-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.issue-text span { color: var(--muted); font-size: .82rem; }
.issue-go { color: #98a2b3; }
.all-good { display: flex; align-items: center; gap: .9rem; padding: 1rem; border-radius: 13px; background: var(--green-50); color: var(--green-700); }
.all-good p { margin: 0; }
.alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.alert { display: flex; flex-direction: column; gap: .15rem; padding: .75rem .9rem; border-radius: 12px; border: 1px solid; font-size: .88rem; }
.alert-warn { background: #fffcf5; border-color: #fedf89; color: #93370d; }
.alert-bad { background: #fffbfa; border-color: #fecdca; color: #912018; }
.alert-info { background: #f5f8ff; border-color: #c7d7fe; color: #1d3a8a; }
.ok-line { color: #067647; font-weight: 600; background: #ecfdf3; padding: .75rem .9rem; border-radius: 12px; margin: 0; }
.plain { margin: 0; padding-left: 1.1rem; }
.plain li { margin: .3rem 0; }

/* ── Feed ──────────────────────────────────────────────────────────────── */
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { display: flex; gap: .85rem; padding: .7rem 0; border-bottom: 1px solid var(--line-2); }
.feed-item:last-child { border-bottom: 0; }
.feed-icon { width: 34px; height: 34px; border-radius: 10px; }
.feed-icon .icon { width: 16px; height: 16px; }
.feed-body { flex: 1; min-width: 0; }
.feed-top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.feed-shop { font-weight: 600; color: var(--ink); }
.feed-time { margin-left: auto; color: #98a2b3; font-size: .76rem; white-space: nowrap; }
.feed-title { margin-top: .15rem; font-size: .88rem; }
.feed-amount { margin-left: .3rem; }
.feed-meta { color: var(--muted); font-size: .78rem; margin-top: .1rem; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th, .table td { text-align: left; padding: .8rem 1rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.card:not(.flush) .table th:first-child, .card:not(.flush) .table td:first-child { padding-left: 0; }
.card:not(.flush) .table th:last-child, .card:not(.flush) .table td:last-child { padding-right: 0; }
.table th { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; white-space: nowrap; background: #fcfcfd; border-bottom-color: var(--line); }
.card:not(.flush) .table th { background: none; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.selected { background: var(--green-50) !important; }
.table tfoot td { border-bottom: 0; color: var(--ink-2); }
.table tfoot tr.total td { font-weight: 800; font-size: 1.05rem; color: var(--ink); border-top: 1px solid var(--line); font-family: var(--font-head); }
.table-nowrap td { white-space: nowrap; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.neg { color: var(--red); }
.pos { color: var(--green-600); }

/* ── Details, tabs ─────────────────────────────────────────────────────── */
.details { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1.2rem; margin: 0; font-size: .88rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-word; font-weight: 500; }
.details.cols-3 { grid-template-columns: repeat(3, max-content 1fr); margin-bottom: 1.2rem; }
.tabs { display: flex; gap: .25rem; padding: .3rem; margin-bottom: 1.4rem; overflow-x: auto; background: #eef0f3; border-radius: 14px; width: fit-content; max-width: 100%; }
.tabs a { padding: .5rem .9rem; color: var(--ink-2); font-weight: 500; border-radius: 10px; white-space: nowrap; font-size: .86rem; transition: background .15s, color .15s; }
.tabs a:hover { color: var(--ink); background: rgba(255, 255, 255, .6); }
.tabs a.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }

/* ── Forms & buttons ───────────────────────────────────────────────────── */
input, select, button, textarea { font: inherit; }
input[type=search], input[type=text], input[type=password], input[type=date], input:not([type]), select {
  padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(0, 163, 108, .14); }
.filters { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.1rem; padding: .7rem; background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.filters input[type=search] { flex: 1; min-width: 220px; }
.filters .inline { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .84rem; }
.filters .check { display: inline-flex; align-items: center; gap: .35rem; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: .35rem .75rem; font-size: .8rem; cursor: pointer; font-weight: 500; }
.filters .check:has(input:checked) { background: var(--green-50); border-color: #a7f3d0; color: var(--green-700); }
.check input { accent-color: var(--green-600); }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .86rem; }
.stack input { width: 100%; padding: .7rem .85rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .58rem 1rem; border-radius: 11px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow);
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.btn:hover { border-color: #d0d5dd; background: #fcfcfd; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(180deg, #10b981, var(--green-600)); border-color: var(--green-600); color: #fff; box-shadow: 0 6px 14px -6px rgba(0, 132, 88, .6), inset 0 1px 0 rgba(255, 255, 255, .2); }
.btn-primary:hover { background: linear-gradient(180deg, #059669, var(--green-700)); border-color: var(--green-700); color: #fff; }
.btn-wa { color: #128c4b; }
.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; border-radius: 9px; }

.pager { display: flex; align-items: center; gap: .5rem; justify-content: flex-end; margin: -.3rem 0 1.25rem; }
.pager-info { color: var(--muted); font-size: .8rem; margin-right: auto; }
p.pager-info { margin: -.3rem 0 1.25rem; }
.flash { padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1.1rem; font-weight: 500; border: 1px solid; }
.flash-ok { background: #ecfdf3; color: #067647; border-color: #abefc6; }
.flash-err { background: #fef3f2; color: #b42318; border-color: #fecdca; }

/* ── Login ─────────────────────────────────────────────────────────────── */
.auth-card { width: min(420px, 94vw); background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 24px; padding: 2.2rem; box-shadow: 0 30px 60px -30px rgba(16, 24, 40, .3); }
.auth-brand { display: flex; align-items: center; gap: .7rem; font-family: var(--font-head); font-weight: 800; margin-bottom: 1.6rem; }
.auth-card h1 { margin-bottom: .8rem; }
.auth-card .btn { width: 100%; padding: .8rem; margin-top: .3rem; }

/* ── Roles, messages ───────────────────────────────────────────────────── */
.role { padding: .85rem 0; border-bottom: 1px solid var(--line-2); }
.role:last-child { border-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.chip { background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: .12rem .6rem; font-size: .74rem; color: var(--ink-2); }
.message.is-new { box-shadow: inset 3px 0 0 var(--blue), var(--shadow); }
.message-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.message-actions { display: flex; gap: .4rem; align-items: flex-start; }
.message-body { margin: .9rem 0 0; }

@media (max-width: 1180px) {
  .grid-3-1 { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .details.cols-3 { grid-template-columns: max-content 1fr; }
  .shop-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .shop-row .shop-owner, .shop-row .shop-when { display: none; }
}
@media (max-width: 760px) {
  :root { --side-w: 0px; }
  .sidebar { position: sticky; top: 0; inset: auto; width: 100%; height: auto; flex-direction: row; align-items: center; padding: .6rem .8rem; gap: .5rem; }
  .brand { padding: 0; }
  .brand-text, .nav-label, .side-user-text, .side-user .avatar { display: none; }
  .sidenav { flex-direction: row; overflow-x: auto; flex: 1; }
  .sidenav a { padding: .5rem .6rem; }
  .sidenav a span:first-of-type { display: none; }
  .side-user { margin: 0; padding: 0; background: none; border: 0; }
  .topbar { position: static; padding: 0 1rem; }
  .topmeta { display: none; }
  .main { padding: 1.1rem; }
}

/* ═════════════════════════════════════════════════════════════════════════
   Customer dashboard — light sidebar, InHand brand green
   ═════════════════════════════════════════════════════════════════════════ */
:root {
  --green: #0f9d58;
  --green-600: #0b7a4b;
  --green-700: #08603b;
  --green-50: #ebf8f1;
  --side-w: 256px;
}
.nowrap { white-space: nowrap; }
td.wrap { white-space: normal; min-width: 180px; }

/* Sidebar */
.sidebar { background: #fff; color: var(--ink-2); border-right: 1px solid var(--line); overflow-y: auto; padding: 1.1rem .85rem; }
.brand { color: var(--ink); padding: .1rem .45rem 1rem; }
.brand:hover { color: var(--ink); }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; box-shadow: 0 6px 14px -6px rgba(11, 122, 75, .55); }
.brand-text small { color: var(--muted); }
.shop-switch { display: flex; align-items: center; gap: .65rem; padding: .6rem .7rem; margin: 0 0 1rem; border-radius: 13px; background: var(--bg); border: 1px solid var(--line); color: var(--ink); }
.shop-switch:hover { border-color: #cfd4dc; color: var(--ink); background: #fff; box-shadow: var(--shadow); }
.shop-switch > span { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.shop-switch strong { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-switch small { color: var(--muted); font-size: .72rem; }
.shop-switch > .icon { color: var(--muted); width: 16px; height: 16px; }
.shop-switch.static:hover { background: var(--bg); box-shadow: none; border-color: var(--line); }
.nav-label { color: #98a2b3; padding: .9rem .75rem .35rem; }
.sidenav { gap: .1rem; }
.sidenav .nav-label:first-child { padding-top: 0; }
.sidenav a { color: var(--ink-2); padding: .55rem .75rem; }
.sidenav a .icon { color: #98a2b3; }
.sidenav a:hover { background: var(--bg); color: var(--ink); }
.sidenav a:hover .icon { color: var(--ink-2); }
.sidenav a.on { background: var(--green-50); color: var(--green-700); box-shadow: none; font-weight: 600; }
.sidenav a.on .icon { color: var(--green-600); }
.count { background: var(--green-600); color: #fff; }
.count-warn { background: #fef0c7; color: #93370d; }
.side-user { margin-top: 1.2rem; background: var(--bg); border-color: var(--line); }
.side-user-text strong { color: var(--ink); }
.side-user-text small { color: var(--muted); }
.icon-btn { color: var(--muted); }
.icon-btn:hover { background: #fff; color: var(--red); }

/* Top bar */
.sync-state { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .7rem; border-radius: 99px; background: #fff; border: 1px solid var(--line); margin-right: .4rem; }
.live-dot.stale { background: var(--amber); box-shadow: 0 0 0 4px rgba(245, 158, 11, .15); animation: none; }
.foot { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; text-align: center; }

/* Hero stat in brand green */
.stat.hero { background: radial-gradient(120% 120% at 100% 0%, #34d399 0%, transparent 55%), linear-gradient(135deg, #0f9d58, #0b7a4b 55%, #075a37); box-shadow: 0 16px 32px -16px rgba(11, 122, 75, .6); }
.trend { background: var(--green-50); color: var(--green-700); }
.trend.down { background: var(--red-50); color: #b42318; }
.stat.hero .trend.up { background: rgba(255, 255, 255, .2); color: #fff; }
.stat.hero .trend.down { background: rgba(0, 0, 0, .18); color: #fff; }

/* Period picker */
.period-picker { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.seg { display: inline-flex; gap: .2rem; padding: .25rem; background: #eef0f3; border-radius: 12px; overflow-x: auto; max-width: 100%; }
.seg a { padding: .42rem .75rem; border-radius: 9px; color: var(--ink-2); font-weight: 500; font-size: .82rem; white-space: nowrap; }
.seg a:hover { color: var(--ink); background: rgba(255, 255, 255, .6); }
.seg a.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }
.seg-page { margin-bottom: 1rem; }
.range { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.range input[type=date] { padding: .38rem .55rem; font-size: .8rem; border-radius: 9px; }
.page-head .head-actions { align-items: center; }

/* Grids */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.grid-3-1.reverse { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.stack-cards > .card:last-child { margin-bottom: 1.25rem; }

/* Bars */
.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .9rem; }
.bar-list a { display: block; color: inherit; border-radius: 10px; margin: -.35rem -.5rem; padding: .35rem .5rem; }
.bar-list a:hover { background: var(--bg); }
.bar-list li.on a { background: var(--amber-50); }
.bar-row { display: flex; justify-content: space-between; gap: .8rem; font-size: .85rem; margin-bottom: .35rem; color: var(--ink-2); }
.bar-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row strong { font-family: var(--font-head); color: var(--ink); white-space: nowrap; }
.bar-sub { font-size: .74rem; color: var(--muted); margin-top: .25rem; }
.bar-blue .bar span { background: linear-gradient(90deg, #93c5fd, var(--blue)); }
.bar-violet .bar span { background: linear-gradient(90deg, #c4b5fd, var(--violet)); }
.bar-amber .bar span { background: linear-gradient(90deg, #fcd34d, var(--amber)); }

/* Ranked list, stock list, people */
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.rank li { display: flex; align-items: center; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--line-2); }
.rank li:last-child { border-bottom: 0; }
.rank-n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--line-2); font-weight: 700; font-size: .76rem; color: var(--ink-2); flex: none; }
.rank li:first-child .rank-n { background: #fef3c7; color: #92400e; }
.rank-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; font-size: .88rem; }
.rank-name small, .stock-list small, .people small { color: var(--muted); font-size: .75rem; }
.rank strong { font-family: var(--font-head); font-size: .88rem; white-space: nowrap; }
.stock-list, .people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.stock-list li, .people li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line-2); font-size: .88rem; }
.stock-list li:last-child, .people li:last-child { border-bottom: 0; }
.stock-list li > span, .people li > span { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.people strong, .stock-list strong { font-family: var(--font-head); white-space: nowrap; }
.owed { display: flex; flex-direction: column; padding: 1rem 1.1rem; border-radius: 14px; background: var(--blue-50); margin-bottom: .6rem; }
.owed.has-overdue { background: var(--red-50); }
.owed-value { font-family: var(--font-head); font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }

/* Latest sales list */
.sale-list { list-style: none; margin: 0 -.6rem; padding: 0; }
.sale-list a { display: flex; align-items: center; gap: .85rem; padding: .65rem .6rem; border-radius: 12px; color: var(--ink); }
.sale-list a:hover { background: var(--bg); color: var(--ink); }
.sale-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--green-50); color: var(--green-600); flex: none; }
.sale-icon.refund { background: var(--amber-50); color: #d97706; }
.sale-icon .icon { width: 16px; height: 16px; }
.sale-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.sale-main small { color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sale-side { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.sale-side strong { font-family: var(--font-head); white-space: nowrap; }
.sale-side small { color: #98a2b3; font-size: .74rem; white-space: nowrap; }

/* Summary strip */
.summary-strip { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.1rem; }
.summary-strip > div { display: flex; flex-direction: column; padding: .7rem 1rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; min-width: 140px; box-shadow: var(--shadow); }
.summary-strip span { font-size: .74rem; color: var(--muted); font-weight: 500; }
.summary-strip strong { font-family: var(--font-head); font-size: 1.1rem; }

/* Receipt */
.receipt { border-top: 4px solid var(--green); }
.receipt-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; }
.receipt-head > div:first-child { flex: 1; }
.receipt-head h2 { font-size: 1.25rem; }
.receipt-head p { margin: .2rem 0 0; }
.receipt-total { text-align: right; display: flex; flex-direction: column; }
.receipt-total strong { font-family: var(--font-head); font-size: 1.6rem; font-weight: 800; }

/* Table cells with avatars */
.cell-person { display: inline-flex; align-items: center; gap: .6rem; }
.cell-person > span { display: flex; flex-direction: column; line-height: 1.3; }
.cell-person small { color: var(--muted); font-size: .74rem; }
.mini-bar { margin-top: .3rem; min-width: 60px; }
.mini-bar span { background: linear-gradient(90deg, #6ee7b7, var(--green)); }
.table .btn-wa { margin-left: .3rem; padding: .25rem .45rem; }

/* Staff cards */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.person-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .7rem; }
.person-card.inactive { opacity: .6; }
.person-card header { display: flex; align-items: center; gap: .75rem; }
.person-card header > div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.person-card header small { color: var(--muted); font-size: .76rem; }
.person-value { font-family: var(--font-head); font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; }
.person-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 0; }
.person-stats div { background: var(--bg); border-radius: 10px; padding: .45rem .6rem; }
.person-stats dt { font-size: .7rem; color: var(--muted); }
.person-stats dd { margin: 0; font-weight: 700; font-size: .88rem; }
.person-card footer { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; border-top: 1px solid var(--line-2); padding-top: .65rem; }
.person-card footer .icon { width: 13px; height: 13px; vertical-align: -2px; }

/* Reports */
.pnl-table td { padding: .7rem 0 !important; font-size: .9rem; }
.pnl-table td:last-child { width: 80px; }
.pnl-table tr.sub td { font-weight: 700; border-top: 1px solid var(--line); background: #fcfcfd; }
.pnl-table tr.total td { font-family: var(--font-head); font-weight: 800; font-size: 1.15rem; color: var(--green-700); border-top: 2px solid var(--ink); border-bottom: 0; }
.pnl-table tr.total.loss td { color: #b42318; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; height: 110px; align-items: end; }
.weekday { display: flex; flex-direction: column; align-items: center; gap: .35rem; height: 100%; justify-content: flex-end; }
.weekday span { width: 100%; max-width: 46px; border-radius: 8px 8px 4px 4px; background: #d1fae5; }
.weekday.top span { background: linear-gradient(180deg, #34d399, var(--green-600)); }
.weekday small { color: var(--muted); font-size: .72rem; }
.day-table { max-height: 440px; overflow-y: auto; }
.quiet-row td { color: #98a2b3; }

/* My shop */
.shop-hero { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding: 1.5rem; margin-bottom: 1.25rem; border-radius: var(--radius); color: #fff;
  background: radial-gradient(80% 140% at 100% 0%, rgba(52, 211, 153, .5), transparent 60%), linear-gradient(135deg, #0b7a4b, #075a37); box-shadow: 0 16px 32px -16px rgba(11, 122, 75, .6); }
.shop-hero h1 { color: #fff; }
.shop-hero .eyebrow { color: #a7f3d0; }
.shop-hero p { margin: 0; }
.shop-hero .muted { color: rgba(255, 255, 255, .75); }
.shop-hero > div:nth-child(2) { flex: 1; min-width: 220px; }
.shop-hero-stats { display: flex; gap: .6rem; flex-wrap: wrap; }
.shop-hero-stats div { display: flex; flex-direction: column; align-items: center; padding: .6rem .95rem; border-radius: 13px; background: rgba(255, 255, 255, .12); min-width: 84px; }
.shop-hero-stats strong { font-family: var(--font-head); font-size: 1.2rem; }
.shop-hero-stats span { font-size: .72rem; color: rgba(255, 255, 255, .75); }
.steps { margin: 0 0 .8rem; padding-left: 1.2rem; color: var(--ink-2); }
.steps li { margin: .25rem 0; }
.join-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.7rem; font-weight: 700; letter-spacing: .25em; text-align: center; padding: .9rem; border-radius: 14px; background: var(--green-50); color: var(--green-700); border: 1px dashed #86efac; margin-bottom: .6rem; }
.till-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; padding: 0 1.4rem 1.4rem; }
.till { border: 1px solid var(--line); border-radius: 15px; padding: 1rem; background: #fcfcfd; }
.till.inactive { opacity: .6; }
.till-top { display: flex; align-items: center; gap: .7rem; margin-bottom: .8rem; }
.till-top > div { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.till-top small { color: var(--muted); font-size: .75rem; }
.till-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--green-50); color: var(--green-600); }
.till dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: 0; }
.till dt { font-size: .7rem; color: var(--muted); }
.till dd { margin: 0; font-weight: 600; font-size: .84rem; }

/* Sign in */
.no-nav .main { background: radial-gradient(60% 50% at 20% 0%, rgba(15, 157, 88, .14), transparent 70%), radial-gradient(50% 50% at 100% 100%, rgba(59, 130, 246, .08), transparent 70%), var(--bg); }
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); width: min(980px, 96vw); background: #fff; border-radius: 28px; overflow: hidden; box-shadow: 0 40px 80px -40px rgba(16, 24, 40, .35); border: 1px solid var(--line); }
.auth-side { padding: 3rem; color: #fff; display: flex; flex-direction: column; justify-content: center;
  background: radial-gradient(90% 80% at 100% 0%, rgba(52, 211, 153, .55), transparent 60%), linear-gradient(160deg, #0f9d58, #0b7a4b 50%, #064e30); }
.auth-logo { border-radius: 20px; box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .4); margin-bottom: 1.6rem; }
.auth-side h2 { color: #fff; font-size: 1.9rem; line-height: 1.15; margin-bottom: .8rem; }
.auth-side p { color: rgba(255, 255, 255, .82); margin: 0 0 1.4rem; font-size: .98rem; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.auth-points li { display: flex; align-items: center; gap: .55rem; padding: .6rem .7rem; border-radius: 12px; background: rgba(255, 255, 255, .12); font-size: .84rem; font-weight: 500; }
.auth .auth-card { width: auto; border: 0; border-radius: 0; box-shadow: none; padding: 3rem 2.6rem; background: #fff; }
.auth-card.wide { width: min(520px, 94vw); }
.auth-brand img { border-radius: 10px; }
.auth-lead { margin: 0 0 1.4rem; }
.pin-input { letter-spacing: .6em; font-size: 1.2rem !important; font-family: ui-monospace, Menlo, monospace; }
.auth-card .btn { width: 100%; padding: .85rem; margin-top: .3rem; font-size: .95rem; }
.auth-help { margin: 1.3rem 0 0; }
.shop-pick { display: flex; flex-direction: column; gap: .55rem; }
.shop-pick-item { display: flex; align-items: center; gap: .85rem; width: 100%; padding: .85rem 1rem; border-radius: 15px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s; }
.shop-pick-item:hover { border-color: #86efac; box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.shop-pick-item.on { border-color: var(--green); background: var(--green-50); }
.shop-pick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.shop-pick-text small { color: var(--muted); font-size: .78rem; }
.shop-pick-item > .icon { color: var(--muted); }
.auth-card .shop-pick-item { width: 100%; padding: .85rem 1rem; margin: 0; font-size: inherit; }
.auth-foot { margin-top: 1.2rem; text-align: center; }
.auth-foot .btn { width: auto !important; }

@media (max-width: 1180px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3-1.reverse { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 2rem; }
  .auth-side h2 { font-size: 1.4rem; }
  .auth-points { display: none; }
  .auth .auth-card { padding: 2rem; }
}
@media (max-width: 760px) {
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .shop-switch { margin: 0; padding: .3rem; }
  .shop-switch > span, .shop-switch > .icon { display: none; }
  .brand-logo { width: 34px; height: 34px; }
  .sync-state { margin: 0; }
  .topmeta { display: flex; }
  .topmeta > .muted { display: none; }
  .period-picker { width: 100%; }
  .stats-5 .hero { grid-column: auto; }
  .stats-5 { grid-template-columns: 1fr; }
}

/* Keep avatars and badges their natural size inside flex rows */
.people li > .avatar, .stock-list li > .badge, .stock-list li > .avatar { flex: none; }
.shop-switch > .avatar { flex: none; display: inline-grid; }

/* ═════════════════════════════════════════════════════════════════════════
   Responsive
   ═════════════════════════════════════════════════════════════════════════ */
.table-scroll { -webkit-overflow-scrolling: touch; }
.card, .stat, .grid-2 > *, .grid-3 > *, .grid-3-1 > * { min-width: 0; }

/* Tablet: icon-only sidebar */
@media (min-width: 761px) and (max-width: 1100px) {
  :root { --side-w: 78px; }
  .sidebar { padding: 1rem .6rem; align-items: center; }
  .brand { padding: 0 0 1rem; justify-content: center; }
  .brand-text, .nav-label, .side-user-text, .shop-switch > span:not(.avatar), .shop-switch > .icon { display: none; }
  .shop-switch { padding: .4rem; margin-bottom: .6rem; justify-content: center; }
  .sidenav { width: 100%; align-items: center; gap: .25rem; }
  .sidenav a { position: relative; justify-content: center; padding: .7rem; width: 48px; }
  .sidenav a span:first-of-type { display: none; }
  .sidenav a .count { position: absolute; top: 2px; right: 0; font-size: .62rem; padding: 0 .35rem; }
  .side-user { flex-direction: column; padding: .45rem; gap: .4rem; }
  .main { padding: 1.5rem; }
  .topbar { padding: 0 1.5rem; }
}

/* Phone */
@media (max-width: 760px) {
  :root { --side-w: 0px; --top-h: auto; }
  html, body { overflow-x: hidden; }

  .sidebar {
    position: sticky; top: 0; inset: auto; z-index: 30; width: 100%; height: auto;
    display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .55rem;
    padding: .6rem .8rem .5rem; overflow: visible;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  .brand { order: 1; padding: 0; gap: .55rem; }
  .brand-text { display: block; font-size: .92rem; }
  .brand-text small { display: none; }
  .brand-logo { width: 34px; height: 34px; border-radius: 10px; }
  .shop-switch { order: 2; margin: 0 0 0 auto; padding: .3rem .55rem .3rem .3rem; max-width: 46vw; border-radius: 11px; }
  .shop-switch > span:not(.avatar) { display: flex; }
  .shop-switch small { display: none; }
  .shop-switch strong { font-size: .8rem; }
  .shop-switch > .icon { display: block; width: 14px; height: 14px; }
  .side-user { order: 3; margin: 0; padding: 0; background: none; border: 0; }
  .side-user .avatar, .side-user-text { display: none; }
  .icon-btn { width: 36px; height: 36px; background: var(--bg); }

  .sidenav {
    order: 4; flex: 0 0 100%; flex-direction: row; gap: .35rem; overflow-x: auto; min-width: 0;
    margin: 0 -.8rem; padding: .15rem .8rem .2rem; scrollbar-width: none;
  }
  .sidenav::-webkit-scrollbar { display: none; }
  .nav-label { display: none; }
  .sidenav a { flex: none; padding: .45rem .75rem; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); font-size: .82rem; gap: .4rem; }
  .sidenav a .icon { width: 15px; height: 15px; }
  .sidenav a span:first-of-type { display: inline; flex: none; }
  .sidenav a.on { background: var(--green-600); border-color: var(--green-600); color: #fff; }
  .sidenav a.on .icon { color: #fff; }
  .sidenav a .count { font-size: .64rem; padding: 0 .4rem; }

  .shell { margin-left: 0; }
  .topbar { position: static; height: auto; padding: .7rem 1rem 0; gap: .5rem; flex-wrap: wrap; background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .topsearch { flex: 1 1 100%; max-width: none; order: 2; }
  .topmeta { display: flex; order: 1; margin: 0; width: 100%; justify-content: space-between; }
  .topmeta > .muted { display: inline; font-size: .76rem; }
  .sync-state { margin: 0; padding: .2rem .6rem; font-size: .76rem; }

  .main { padding: 1rem; }
  h1 { font-size: 1.4rem; }
  .page-head { flex-direction: column; align-items: stretch; gap: .8rem; margin-bottom: 1.1rem; }
  .page-head > *, .page-head .head-actions, .period-picker > * { min-width: 0; max-width: 100%; }
  .page-head .head-actions { flex-direction: column; align-items: stretch; }
  .page-head .head-actions > .btn { align-self: flex-start; }
  .period-picker { flex-direction: column; align-items: stretch; width: 100%; }
  .seg { width: 100%; }
  .seg a { flex: 1 0 auto; text-align: center; }
  .range { width: 100%; }
  .range input[type=date] { flex: 1; min-width: 0; }

  .card { padding: 1.05rem; border-radius: 16px; margin-bottom: 1rem; }
  .card-head { margin-bottom: .8rem; }
  .card-head.padded { padding: 1.05rem 1.05rem 0; }
  .grid-2, .grid-3, .grid-3-1, .grid-3-1.reverse { gap: 1rem; }
  .table th, .table td { padding: .65rem .75rem; }

  .stats, .stats-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-bottom: 1rem; }
  .stats-5 .hero, .stats > .stat:only-child { grid-column: 1 / -1; }
  .stat { padding: .85rem .9rem; border-radius: 15px; }
  .stat-icon { width: 30px; height: 30px; border-radius: 9px; }
  .stat-icon .icon { width: 16px; height: 16px; }
  .stat-value { font-size: 1.15rem; word-break: break-word; }
  .stat.hero .stat-value { font-size: 1.7rem; }
  .stat-sub { font-size: .72rem; }
  .support-stats .stat-value { font-size: 1.15rem; }

  .chart { height: 150px; }
  .legend .big { font-size: 1.1rem; }

  .filters { flex-direction: column; align-items: stretch; padding: .6rem; }
  .filters input[type=search], .filters select, .filters .inline { width: 100%; min-width: 0; }
  .filters .inline input { flex: 1; min-width: 0; }
  .filters .btn { width: 100%; }

  .summary-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .summary-strip > div { min-width: 0; padding: .6rem .8rem; }
  .summary-strip strong { font-size: .98rem; }

  .receipt-head { flex-wrap: wrap; }
  .receipt-head > div:first-child { flex: 1 1 100%; }
  .receipt-total { text-align: left; }
  .details, .details.cols-3 { grid-template-columns: max-content minmax(0, 1fr); gap: .45rem .9rem; }

  .sale-main small { white-space: normal; }
  .people-grid, .till-grid { grid-template-columns: 1fr; }
  .till-grid { padding: 0 1.05rem 1.05rem; }
  .shop-hero { padding: 1.2rem; }
  .shop-hero-stats { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); }
  .shop-hero-stats div { min-width: 0; padding: .5rem .3rem; }
  .join-code { font-size: 1.3rem; letter-spacing: .15em; }
  .pnl-table td:last-child { width: 64px; }
  .weekdays { height: 90px; gap: .3rem; }
  .pager { flex-wrap: wrap; }
  .foot { font-size: .72rem; }
}

@media (max-width: 380px) {
  .stats, .stats-5 { grid-template-columns: 1fr; }
  .brand-text { display: none; }
}
