/* Gift Distribution — UI */
:root {
  --brand: #1d4ed8; --brand-600: #2563eb; --brand-50: #eff4ff; --brand-100: #dbe6ff; --brand-dark: #1e3a8a;
  --ok: #15803d; --ok-bg: #dcfce7; --ok-500: #22c55e;
  --bad: #b91c1c; --bad-bg: #fee2e2; --bad-500: #ef4444;
  --warn: #a16207; --warn-bg: #fef3c7; --warn-500: #f59e0b;
  --info: #0e7490; --info-bg: #cffafe;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e2e8f0; --line-2: #f1f5f9;
  --bg: #f4f6fb; --card: #fff; --side: #0f172a; --side-ink: #cbd5e1;
  --radius: 14px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, .12);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Bengali", sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
h1 { font-size: 1.45rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.02rem; margin: 0 0 .9rem; letter-spacing: -.005em; }
code { background: var(--line-2); padding: .1rem .35rem; border-radius: 5px; font-size: .88em; }
.icon { flex: none; vertical-align: middle; }
.muted { color: var(--muted); font-size: .88em; }
.nowrap { white-space: nowrap; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1.1rem .8rem; overflow-y: auto; }
.side .logo { display: flex; align-items: center; gap: .6rem; color: #fff; font-weight: 700; font-size: 1.05rem; padding: .2rem .6rem 1.2rem; }
.side .logo .mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); display: grid; place-items: center; color: #fff; }
.side .group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin: 1rem .7rem .4rem; }
.side a.nav { display: flex; align-items: center; gap: .7rem; color: var(--side-ink); padding: .55rem .7rem; border-radius: 9px; font-size: .93rem; margin-bottom: 2px; }
.side a.nav:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side a.nav.active { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(29, 78, 216, .45); }
.side .me { margin-top: auto; padding: .9rem .7rem .2rem; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; align-items: center; gap: .6rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-100); color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: .9rem; flex: none; }
.side .me .avatar { background: #1e293b; color: #93c5fd; }
.side .me .who { flex: 1; min-width: 0; line-height: 1.25; }
.side .me .who b { color: #fff; font-size: .9rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .me .who span { font-size: .78rem; color: #94a3b8; }
.icon-btn { background: transparent; border: 0; color: inherit; cursor: pointer; padding: .4rem; border-radius: 8px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(127, 127, 127, .15); }
.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 1.6rem 2rem 3rem; width: 100%; max-width: 1320px; margin: 0 auto; }
.content.narrow { max-width: 620px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: .2rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.backlink { display: inline-flex; align-items: center; gap: .25rem; font-size: .9rem; margin-bottom: .7rem; color: var(--muted); }

.tabbar, .sheet-handle, .sheet-only, #offline-bar { display: none; }
#nav-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: linear-gradient(90deg, #60a5fa, #22c55e); z-index: 100; opacity: 0; transition: width 8s cubic-bezier(.1, .7, .2, 1), opacity .3s; }
body.loading #nav-progress { width: 90%; opacity: 1; }


/* ---------- Cards & grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.15rem 1.25rem; margin-bottom: 1.1rem; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 1rem 1.25rem; margin: 0; border-bottom: 1px solid var(--line); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .9rem; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 1.1rem; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: .9rem; margin-bottom: 1.1rem; }
.two { grid-template-columns: 1fr; }
.three { grid-template-columns: 1fr; }
@media (min-width: 900px) { .two { grid-template-columns: 1fr 1fr; } .three { grid-template-columns: repeat(3, 1fr); } .two-1 { grid-template-columns: 2fr 1fr; } }

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1.05rem 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .35rem; min-width: 0; height: 100%; transition: border-color .15s, box-shadow .15s; }
a > .kpi:hover { border-color: var(--brand-100); box-shadow: var(--shadow-lg); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.kpi .l { color: var(--muted); font-size: .8rem; font-weight: 600; line-height: 1.3; min-width: 0; }
.kpi .chip { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.kpi .v { font-size: 1.6rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.kpi .v small { font-size: .82rem; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: .3rem; }
.kpi .s { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.kpi-bar { margin-top: auto; height: 5px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.kpi-bar > span { display: block; height: 100%; border-radius: 99px; background: var(--brand-600); }
.kpi .s + .kpi-bar, .kpi .v + .kpi-bar { margin-top: .45rem; }
.kpi.ok .chip { background: var(--ok-bg); color: var(--ok); }
.kpi.bad .chip { background: var(--bad-bg); color: var(--bad); }
.kpi.warn .chip { background: var(--warn-bg); color: var(--warn); }
.kpi.info .chip { background: var(--info-bg); color: var(--info); }
.kpi.ok .v { color: var(--ok); } .kpi.bad .v { color: var(--bad); } .kpi.warn .v { color: var(--warn); }
.kpi.ok .kpi-bar > span { background: var(--ok-500); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
th { background: #f8fafc; font-weight: 600; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; border-bottom: 1px solid var(--line); }
tbody tr:hover td { background: #fafbff; }
tfoot th { background: #f8fafc; color: var(--ink); font-size: .85rem; text-transform: none; letter-spacing: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.cell-title { font-weight: 600; color: var(--ink); }
.cell-title:hover { color: var(--brand); }

.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; min-width: 90px; display: flex; }
.bar > span { display: block; height: 100%; background: var(--ok-500); }
.bar > span.p { background: var(--warn-500); } .bar > span.f { background: var(--bad-500); }
.progress-cell { display: flex; align-items: center; gap: .55rem; min-width: 150px; }
.progress-cell .bar { flex: 1; }
.progress-cell b { font-size: .82rem; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.delivered, .badge.approved, .badge.ok, .badge.resolved { background: var(--ok-bg); color: var(--ok); }
.badge.failed, .badge.flagged, .badge.damaged, .badge.discrepancy { background: var(--bad-bg); color: var(--bad); }
.badge.pending, .badge.submitted, .badge.open { background: var(--warn-bg); color: var(--warn); }
.badge.in_progress, .badge.info { background: var(--info-bg); color: var(--info); }
.badge.lg { font-size: .85rem; padding: .35rem .85rem; }

/* ---------- Forms ---------- */
label { display: block; font-size: .82rem; color: var(--ink-2); margin-bottom: .3rem; font-weight: 600; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; font-size: .9rem; cursor: pointer; }
input[type=text], input[type=password], input[type=search], input[type=number], input[type=date], input[type=tel], input[type=file], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid #cbd5e1; border-radius: var(--radius-sm); font: inherit; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
input[disabled] { background: var(--line-2); color: var(--muted); }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 17px; height: 17px; accent-color: var(--brand); }
.field { margin-bottom: .95rem; }
.hint { color: var(--muted); font-size: .8rem; margin-top: .3rem; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; align-items: end; }
.filters .field { margin: 0; }
.filters .btns { display: flex; gap: .5rem; }
form.inline { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
form.inline .field { margin-bottom: 0; flex: 1; min-width: 150px; }
.search-box { position: relative; }
.search-box .icon { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 2.3rem; }
.segmented { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented a { padding: .35rem .8rem; border-radius: 8px; font-size: .84rem; color: var(--ink-2); font-weight: 500; }
.segmented a.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.choice label { margin: 0; border: 2px solid var(--line); border-radius: 12px; padding: .8rem; text-align: center; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; gap: .5rem; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-50); color: var(--brand); }
.choice label.bad:has(input:checked) { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .6rem 1.05rem; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--brand); color: #fff !important; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; text-decoration: none !important; transition: background .15s, transform .05s, box-shadow .15s; white-space: nowrap; }
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; padding: .9rem; font-size: 1rem; border-radius: 12px; }
.btn.ghost { background: #fff; color: var(--ink-2) !important; border-color: var(--line); box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }
.btn.ghost:hover { background: var(--line-2); }
.btn.soft { background: var(--brand-50); color: var(--brand) !important; }
.btn.soft:hover { background: var(--brand-100); }
.btn.ok { background: #16a34a; } .btn.ok:hover { background: var(--ok); }
.btn.bad { background: #dc2626; } .btn.bad:hover { background: var(--bad); }
.btn.sm { padding: .35rem .7rem; font-size: .82rem; border-radius: 8px; }
.btn:disabled, .btn.disabled { background: #cbd5e1 !important; border-color: #cbd5e1; color: #fff !important; cursor: not-allowed; pointer-events: none; box-shadow: none; }

/* ---------- Alerts & status ---------- */
.alert { display: flex; gap: .65rem; align-items: flex-start; padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1rem; font-size: .92rem; border: 1px solid transparent; }
.alert.ok { background: #f0fdf4; color: #14532d; border-color: #bbf7d0; }
.alert.bad { background: #fef2f2; color: #7f1d1d; border-color: #fecaca; }
.alert.warn { background: #fffbeb; color: #713f12; border-color: #fde68a; }
.alert.info { background: var(--brand-50); color: var(--brand-dark); border-color: var(--brand-100); }
.status-box { padding: .9rem; border-radius: 12px; text-align: center; font-weight: 700; margin: .8rem 0 0; background: var(--line-2); color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: .5rem; }
.status-box.ok { background: var(--ok-bg); color: var(--ok); } .status-box.bad { background: var(--bad-bg); color: var(--bad); }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.1rem; margin: 0; font-size: .92rem; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

/* Stepper */
.steps { display: flex; gap: 0; margin-bottom: 1rem; counter-reset: s; overflow-x: auto; }
.steps span { flex: 1; min-width: 48px; text-align: center; font-size: .7rem; color: var(--muted); position: relative; padding-top: 30px; }
.steps span::before { counter-increment: s; content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: .75rem; z-index: 1; }
.steps span::after { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.steps span:first-child::after { display: none; }
.steps span.done { color: var(--ok); } .steps span.done::before { background: var(--ok-500); border-color: var(--ok-500); color: #fff; content: "✓"; }
.steps span.done::after, .steps span.now::after { background: var(--ok-500); }
.steps span.now { color: var(--brand); font-weight: 700; } .steps span.now::before { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-100); }

.locked { opacity: .45; pointer-events: none; filter: grayscale(1); }
.photo { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #0f172a; aspect-ratio: 4/3; object-fit: cover; display: block; }
.cam { position: relative; background: #0f172a; border-radius: 12px; overflow: hidden; }
.cam video { width: 100%; display: block; aspect-ratio: 4/3; object-fit: cover; }
.cam .cam-empty { aspect-ratio: 4/3; display: grid; place-items: center; color: #64748b; }
.otp-input { font-size: 1.7rem; letter-spacing: .6rem; text-align: center; font-weight: 700; }
.map-frame { width: 100%; height: 250px; border: 1px solid var(--line); border-radius: 12px; display: block; }

/* Lists */
.list-item { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .8rem 0; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }
.outlet-card { display: flex; gap: .8rem; align-items: center; padding: .85rem; border: 1px solid var(--line); border-radius: 12px; margin-bottom: .6rem; background: #fff; color: inherit; }
.outlet-card:hover { border-color: var(--brand-100); background: #fafbff; color: inherit; }
.outlet-card .ic { width: 42px; height: 42px; border-radius: 11px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; flex: none; }
.outlet-card.delivered .ic { background: var(--ok-bg); color: var(--ok); }
.outlet-card.failed .ic { background: var(--bad-bg); color: var(--bad); }
.outlet-card .body { flex: 1; min-width: 0; }
.outlet-card .body b { display: block; }
.outlet-card .body span { font-size: .82rem; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty .icon { color: #cbd5e1; margin-bottom: .4rem; }

/* Charts */
.donut-wrap { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.legend { display: grid; gap: .5rem; font-size: .88rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .45rem; vertical-align: middle; }
.legend b { font-variant-numeric: tabular-nums; }
.hbars { display: grid; gap: .75rem; }
.hbar .top { display: flex; justify-content: space-between; font-size: .86rem; margin-bottom: .3rem; gap: .5rem; }
.hbar .top span { color: var(--muted); font-variant-numeric: tabular-nums; }
.hbar .bar { height: 10px; }
.vbars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 10px; border-bottom: 1px solid var(--line); }
.vbars .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 14px; position: relative; }
.vbars .col i { display: block; width: 100%; max-width: 34px; background: linear-gradient(180deg, #3b82f6, #1d4ed8); border-radius: 6px 6px 0 0; min-height: 2px; }
.vbars .col i.today { background: linear-gradient(180deg, #22c55e, #15803d); }
.vbars .col em { position: absolute; top: -2px; font-size: .68rem; font-style: normal; color: var(--muted); }
.vlabels { display: flex; gap: 6px; margin-top: .35rem; }
.vlabels span { flex: 1; text-align: center; font-size: .68rem; color: var(--muted); min-width: 14px; }

/* Pagination */
.pagination { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1rem 0 0; list-style: none; padding: 0; align-items: center; }
.pagination a, .pagination span { padding: .4rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: .85rem; color: var(--ink-2); }
.pagination .active span { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); font-weight: 600; }
.pagination .disabled span { color: #cbd5e1; }
.card.flush .pagination { padding: 0 1.25rem 1rem; }

/* Toast */
.toast { position: fixed; right: 1.2rem; top: 1.2rem; z-index: 60; max-width: 380px; box-shadow: var(--shadow-lg); animation: toast-in .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 960px) { .toast { left: .8rem; right: .8rem; top: 4rem; max-width: none; } }

/* Login */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.login-art { background: radial-gradient(circle at 20% 20%, #3b82f6 0, transparent 45%), radial-gradient(circle at 80% 80%, #22c55e55 0, transparent 40%), linear-gradient(160deg, #1e3a8a, #0f172a); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h2 { font-size: 2.1rem; line-height: 1.2; margin: 0 0 1rem; letter-spacing: -.02em; }
.login-art p { color: #cbd5e1; max-width: 440px; }
.login-art .flow { display: grid; gap: .8rem; margin-top: 2rem; max-width: 420px; }
.login-art .flow div { display: flex; gap: .8rem; align-items: center; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; padding: .75rem 1rem; }
.login-art .flow .icon { color: #93c5fd; }
.login-form { display: grid; place-items: center; padding: 2rem 1.2rem; }
.login-card { width: 100%; max-width: 380px; }
.login-card .mark { width: 52px; height: 52px; border-radius: 15px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); display: grid; place-items: center; color: #fff; margin-bottom: 1rem; box-shadow: 0 8px 24px rgba(29, 78, 216, .35); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--line-2); border-radius: 12px; padding: 4px; margin: 1.2rem 0; }
.tabs button { border: 0; background: transparent; padding: .6rem; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
@media (max-width: 860px) { .login-shell { grid-template-columns: 1fr; } .login-art { display: none; } }

/* Hero (BP) */
.hero { background: linear-gradient(135deg, #1d4ed8, #1e3a8a); color: #fff; border-radius: var(--radius); padding: 1.2rem 1.25rem; margin-bottom: 1.1rem; box-shadow: 0 10px 30px rgba(29, 78, 216, .25); }
.hero .row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.hero h1 { color: #fff; font-size: 1.25rem; }
.hero .sub { color: #bfdbfe; font-size: .88rem; }
.hero .ring { --p: 0; width: 76px; height: 76px; border-radius: 50%; background: conic-gradient(#4ade80 calc(var(--p) * 1%), rgba(255, 255, 255, .18) 0); display: grid; place-items: center; flex: none; }
.hero .ring b { width: 60px; height: 60px; border-radius: 50%; background: #1e40af; display: grid; place-items: center; font-size: 1rem; }
.hero .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: 1rem; }
.hero .stats div { background: rgba(255, 255, 255, .1); border-radius: 10px; padding: .55rem; text-align: center; }
.hero .stats b { display: block; font-size: 1.15rem; }
.hero .stats span { font-size: .72rem; color: #bfdbfe; }

details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "▾"; color: var(--muted); transition: transform .15s; }
details[open] > summary::after { transform: rotate(180deg); }

/* ---------- Phone: login as an app splash ---------- */
.login-mobile-head { display: none; }
@media (max-width: 860px) {
  .login-shell { background: #eef2f8; display: block; min-height: 100vh; }
  .login-mobile-head { display: block; background: radial-gradient(circle at 15% 10%, #3b82f6 0, transparent 50%), linear-gradient(160deg, #1d4ed8, #1e3a8a);
    color: #fff; padding: calc(2.2rem + env(safe-area-inset-top)) 1.4rem 4.5rem; text-align: center; border-radius: 0 0 32px 32px; }
  .login-mobile-head .mark { width: 64px; height: 64px; border-radius: 20px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; margin: 0 auto .9rem; }
  .login-mobile-head h2 { margin: 0; font-size: 1.35rem; }
  .login-mobile-head p { margin: .3rem 0 0; color: #bfdbfe; font-size: .9rem; }
  .login-form { padding: 0 1rem 2rem; margin-top: -3rem; display: block; }
  .login-card { background: #fff; border-radius: 22px; padding: 1.4rem 1.2rem; box-shadow: 0 10px 30px rgba(15, 23, 42, .1); margin: 0 auto; }
  .login-card > .mark { display: none; }
  .login-card h1 { font-size: 1.25rem; }
  .login-card input { font-size: 16px; padding: .8rem .9rem; border-radius: 12px; }
  .login-card .btn.block { min-height: 52px; border-radius: 14px; }
}

/* Phone: BP home hero stretches edge to edge */
@media (max-width: 960px) {
  .hero { margin: -.9rem -.8rem .9rem; border-radius: 0 0 26px 26px; padding: 1rem 1.1rem 1.2rem; box-shadow: none; background: linear-gradient(160deg, #1e3a8a, #1d4ed8); }
  .steps { position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 20; background: #eef2f8; margin: -.9rem -.8rem .8rem; padding: .7rem .4rem .5rem; }
}

/* ---------- Phone: native-app shell ---------- */
@media (max-width: 960px) {
  html, body { overscroll-behavior-y: none; }
  body { background: #eef2f8; -webkit-tap-highlight-color: transparent; }
  .shell { grid-template-columns: 1fr; }

  /* Top app bar */
  .topbar { display: flex; align-items: center; gap: .55rem; background: linear-gradient(135deg, #1d4ed8, #1e3a8a); color: #fff;
    padding: calc(.55rem + env(safe-area-inset-top)) .7rem .55rem; position: sticky; top: 0; z-index: 30; min-height: 56px; box-shadow: 0 2px 12px rgba(30, 58, 138, .25); }
  .topbar .title { font-weight: 700; font-size: 1.06rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .icon-btn { color: #fff; margin-left: -.3rem; }
  .topbar .app-mark { width: 32px; height: 32px; border-radius: 10px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; }
  .topbar .avatar { width: 34px; height: 34px; font-size: .8rem; border: 0; background: rgba(255, 255, 255, .18); color: #fff; cursor: pointer; }
  .backlink { display: none; }

  /* Menu = bottom sheet */
  .side { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; max-height: 82vh; width: auto; z-index: 50; border-radius: 22px 22px 0 0;
    transform: translateY(105%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); padding: .5rem .9rem calc(1rem + env(safe-area-inset-bottom)); }
  body.menu-open .side { transform: none; box-shadow: 0 -10px 40px rgba(0, 0, 0, .3); }
  .sheet-handle { order: -2; flex: none; display: block; width: 42px; height: 5px; border-radius: 9px; background: #334155; margin: .2rem auto .6rem; }
  .side .logo { padding-bottom: .6rem; }
  .side a.nav { padding: .8rem .8rem; font-size: 1rem; }
  .side .me { order: -1; margin: 0 0 .4rem; border-top: 0; border-bottom: 1px solid rgba(255, 255, 255, .08); padding: .3rem .4rem .9rem; }
  .side .me .icon-btn { background: rgba(239, 68, 68, .15); color: #fca5a5; padding: .5rem .8rem; gap: .35rem; display: inline-flex; font: inherit; font-size: .85rem; font-weight: 600; }
  .sheet-only { display: inline; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 40; backdrop-filter: blur(2px); }
  body.menu-open .scrim { display: block; }
  body.menu-open { overflow: hidden; }

  /* Bottom tab bar */
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255, 255, 255, .97); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); z-index: 30; padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom)); box-shadow: 0 -4px 20px rgba(15, 23, 42, .06); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: .12rem; font-size: .7rem; font-weight: 600; color: #94a3b8; padding: .4rem 0; border-radius: 12px; }
  .tabbar a.active { color: var(--brand); }
  .tabbar a.active .icon { background: var(--brand-50); border-radius: 99px; width: 52px; padding: 2px 0; height: 26px; }
  body.has-back .tabbar { display: none; }

  /* Content */
  .content { padding: .9rem .8rem calc(6rem + env(safe-area-inset-bottom)); }
  body.has-back .content { padding-bottom: calc(7rem + env(safe-area-inset-bottom)); }
  .card { border: 0; border-radius: 18px; padding: 1rem; margin-bottom: .8rem; box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
  .card.flush > .card-head { padding: .9rem 1rem; }
  .page-head { margin-bottom: .9rem; align-items: stretch; }
  .page-head > div:first-child { width: 100%; }
  .page-head h1 { font-size: 1.2rem; }
  .page-head .actions { width: 100%; }
  .page-head .search-box, .page-head .actions .search-box { min-width: 0 !important; flex: 1 1 100%; width: 100%; }
  .grid { gap: .8rem; }
  .kpis { grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: .8rem; }
  .kpi { border: 0; padding: .8rem .85rem; border-radius: 16px; gap: .3rem; }
  .kpi .chip { width: 28px; height: 28px; }
  .kpi .v { font-size: 1.35rem; }
  .segmented { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented a { white-space: nowrap; padding: .45rem .85rem; }
  .filters { grid-template-columns: 1fr 1fr; }
  .toast { top: calc(4.2rem + env(safe-area-inset-top)); }
  .map-frame { height: 200px; }

  /* Touch-friendly controls (16px inputs stop iPhone zoom-in) */
  input[type=text], input[type=password], input[type=search], input[type=number], input[type=date], input[type=tel], select, textarea { font-size: 16px; padding: .75rem .85rem; border-radius: 12px; }
  .btn { min-height: 44px; border-radius: 12px; user-select: none; -webkit-user-select: none; }
  .btn.sm { min-height: 34px; }
  .btn.block { min-height: 52px; font-size: 1.02rem; border-radius: 14px; }
  .btn:active, .outlet-card:active, .tabbar a:active, .side a.nav:active { transform: scale(.97); }
  .outlet-card { border: 0; box-shadow: 0 1px 3px rgba(15, 23, 42, .07); padding: .9rem; border-radius: 16px; transition: transform .1s; }
  .choice label { padding: 1rem .6rem; border-radius: 14px; }
  .otp-input { font-size: 1.8rem !important; }

  /* Sticky bottom action bar on step screens */
  .action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: rgba(255, 255, 255, .97); backdrop-filter: blur(10px);
    padding: .7rem .8rem calc(.7rem + env(safe-area-inset-bottom)); box-shadow: 0 -6px 24px rgba(15, 23, 42, .1); margin: 0 !important; }
  .action-bar .btn.block { margin: 0; }
  .action-bar .muted { display: block; text-align: center; margin: 0 0 .4rem; }

  /* Tables become stacked cards */
  table.m-cards thead { display: none; }
  table.m-cards, table.m-cards tbody, table.m-cards tfoot, table.m-cards tr, table.m-cards td, table.m-cards th { display: block; width: 100%; }
  table.m-cards tr { padding: .75rem 1rem; border-bottom: 8px solid #eef2f8; }
  table.m-cards tbody tr:hover td { background: transparent; }
  table.m-cards td, table.m-cards tfoot th { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .28rem 0; border: 0; text-align: right; min-height: 0; }
  table.m-cards td[data-label]::before, table.m-cards tfoot th[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; text-align: left; flex: none; }
  table.m-cards td:first-child, table.m-cards tfoot th:first-child { display: block; text-align: left; font-size: 1rem; padding-bottom: .4rem; }
  table.m-cards td:first-child::before, table.m-cards tfoot th:first-child::before { display: none; }
  table.m-cards td[colspan] { display: block; text-align: center; }
  table.m-cards td[colspan]::before { display: none; }
  table.m-cards td:empty { display: none; }
  table.m-cards td .bar, table.m-cards td .progress-cell { flex: 1; min-width: 0; }
  table.m-cards td.n:last-child:not([data-label]), table.m-cards td:last-child .btn { margin-top: .3rem; }
  table.m-cards tfoot th { background: transparent; }
  table.m-cards tfoot tr { background: var(--brand-50); }
  .table-wrap { overflow: visible; }

  #offline-bar:not([hidden]) { display: flex; align-items: center; gap: .4rem; justify-content: center; position: fixed; left: 0; right: 0; bottom: calc(4.4rem + env(safe-area-inset-bottom)); z-index: 60;
    background: #7f1d1d; color: #fff; font-size: .82rem; padding: .5rem .8rem; margin: 0 .8rem; border-radius: 12px; box-shadow: var(--shadow-lg); }
}

/* Phone: compact card rows (2 metrics per line) */
@media (max-width: 960px) {
  table.m-cards tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.1rem; }
  table.m-cards td:first-child, table.m-cards tfoot th:first-child, table.m-cards td[colspan],
  table.m-cards td:has(.bar), table.m-cards td:has(.btn), table.m-cards td:has(form), table.m-cards td:has(.progress-cell) { grid-column: 1 / -1; }
  table.m-cards td:has(.btn) { justify-content: flex-end; }
  table.m-cards td:has(.btn)::before { margin-right: auto; }
  table.m-cards td.m-wide { grid-column: 1 / -1; }
  table.m-cards td.m-empty { display: none; }
  table.m-cards td { align-items: flex-start; }
  table.m-cards td::before { padding-top: .15rem; }
  table.m-cards .cv { min-width: 0; text-align: right; word-break: break-word; }
  table.m-cards .cv > div { display: block; }
}
@media (max-width: 960px) { .search-box input { padding-left: 2.5rem; } .search-box .icon { left: .85rem; } }
@media (max-width: 960px) { table.m-cards td:has(.bar) .cv, table.m-cards td:has(.progress-cell) .cv { flex: 1; } }

/* Phone: polish across all pages */
@media (max-width: 960px) {
  /* Never push a value past the card edge */
  table.m-cards tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  table.m-cards td, table.m-cards th { min-width: 0; }
  table.m-cards td::before { flex: 0 0 auto; }
  table.m-cards .cv { flex: 1 1 auto; overflow-wrap: anywhere; }
  table.m-cards td .muted { overflow-wrap: anywhere; }

  /* Tables inside a padded card: thin separators instead of grey gaps */
  .card:not(.flush) table.m-cards tr { padding: .75rem 0; border-bottom: 1px solid var(--line); }
  .card:not(.flush) table.m-cards tbody tr:last-child { border-bottom: 0; }
  .card:not(.flush) table.m-cards tfoot tr { padding: .75rem; border-radius: 12px; border: 0; margin-top: .4rem; }

  /* Whole card is tappable when it leads to a detail page */
  table.m-cards tr[data-href] { cursor: pointer; position: relative; }
  table.m-cards tr[data-href]:active { background: var(--brand-50); }
  table.m-cards tr[data-href] td:first-child { padding-right: 1.6rem; }
  table.m-cards tr[data-href] td:first-child::after { content: "›"; position: absolute; right: 1rem; top: .7rem; font-size: 1.5rem; color: #cbd5e1; line-height: 1; }
  .card:not(.flush) table.m-cards tr[data-href] td:first-child::after { right: 0; }

  /* Form buttons: full width, thumb friendly */
  .card form > .btn:not(.sm), form.card > .btn:not(.sm), .card form > div:last-child > .btn:not(.sm) { width: 100%; min-height: 48px; margin-top: .3rem; }
  .card form > div:last-child:has(> .btn + .btn) { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
  .filters .btns { grid-column: 1 / -1; }
  .filters .btns .btn { flex: 1; }
  input[type=file] { font-size: 14px; padding: .55rem; }
  label.check { min-height: 36px; }

  /* Long page titles and headings wrap nicely */
  .page-head h1, .card h1, .card h2 { overflow-wrap: anywhere; }
  .card-head { gap: .6rem; }
  dl.kv { gap: .45rem .9rem; }
}
.form-actions { display: flex; gap: .5rem; }
@media (max-width: 960px) { .form-actions { display: grid; grid-template-columns: 1fr 1fr; } .form-actions .btn { min-height: 48px; } }
@media (max-width: 960px) { table.m-cards .nowrap, table.m-cards td.nowrap { white-space: normal; } select { max-width: 100%; } }

/* Polish: faded zeros, gift label on outlet cards */
td.zero, td.zero .cv { color: #c4ccd8; }
.outlet-card .body .gift-line { display: inline-flex; align-items: center; gap: .3rem; margin-top: .3rem; padding: .1rem .5rem; border-radius: 999px; background: var(--info-bg); color: var(--info); font-size: .74rem; font-weight: 600; max-width: 100%; white-space: normal; overflow: visible; line-height: 1.3; }
.outlet-card.delivered .body .gift-line { background: var(--line-2); color: var(--muted); }
