/* Phone Stock & Khata, "Sky Dark Navy".
   Computers: light side menu and table-style lists. Phones: cards and a bottom bar.
   Colours with a meaning: green = sell / money in, red = log out / delete / undo, amber = in stock. */

:root {
  --bg: #F3F6FB;
  --card: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #55657D;
  --faint: #6B7A90;
  --line: #E2E8F0;
  --line-2: #EDF1F7;
  --ctl: #DCE3EE;

  --brand: #1E3A8A;
  --brand-2: #172F70;
  --brand-soft: #E2E7F2;
  --brand-tint: #EEF2FA;
  --side-bg: #E7EBF5;
  --side-line: #D5DCEC;
  --thead: #F5F7FB;

  --sell: #15803D;
  --sell-2: #166534;
  --sell-soft: #DCFCE7;
  --stock: #92400E;
  --stock-soft: #FEF3C7;
  --danger: #B91C1C;
  --danger-2: #991B1B;
  --danger-soft: #FEE2E2;
  --danger-line: #FECACA;

  --r-card: 20px;
  --r-ctl: 12px;
  --side: 232px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--brand); }
[hidden] { display: none !important; }
button { font: inherit; }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .01em; }
.good, .pos { color: var(--sell); }
.bad, .neg { color: var(--danger); }
.mob-only { display: none; }

/* ================= shell ================= */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side);
  background: var(--side-bg); border-right: 1px solid var(--side-line);
  display: flex; flex-direction: column; gap: 22px; padding: 24px 16px; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; padding: 0 8px; }
.brand b { display: block; font-size: 15px; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.logo { width: 36px; height: 36px; border-radius: 10px; }
.sidenav { display: flex; flex-direction: column; gap: 4px; }
.sidenav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14.5px;
}
.sidenav a:hover { background: rgba(30, 58, 138, .07); color: var(--ink); }
.sidenav a.on { background: var(--brand); color: #fff; }
.side-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--side-line); }
.side-user .who { flex: 1; min-width: 0; line-height: 1.2; font-size: 14px; }
.side-user .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .who small { color: var(--muted); font-size: 12px; }
.side-user .logout { color: var(--danger); font-size: 13px; font-weight: 700; text-decoration: none; padding: 6px 8px; border-radius: 8px; }
.side-user .logout:hover { background: var(--danger-soft); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; text-decoration: none;
}
.avatar.big { width: 52px; height: 52px; font-size: 21px; }
.avatar.soft { background: var(--brand-soft); color: var(--brand); }
.m-avatar { display: none; }
.me-menu { display: none; }

main { max-width: 1220px; padding: 32px 36px 56px; }
body.app main { padding-left: calc(var(--side) + 36px); max-width: calc(1220px + var(--side)); }
.narrow { max-width: 640px; }
.bottomnav { display: none; }

h1 { font-size: 28px; line-height: 1.2; margin: 0; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 10px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head p { margin: 2px 0 0; }
.kicker { margin: 0 0 2px !important; font-size: 13px; color: var(--muted); font-weight: 500; }
.narrow > h1 { margin-bottom: 16px; }
.head-actions { display: flex; gap: 8px; }
.section-title { margin: 0; font-size: 17px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }

/* ================= messages ================= */
.flash { padding: 12px 14px; border-radius: var(--r-ctl); margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.flash.ok { background: var(--sell-soft); color: var(--sell-2); }
.flash.err { background: var(--danger-soft); color: var(--danger-2); }
.flash ul { margin: 0; padding-left: 18px; }

/* ================= summary card ================= */
.summary {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 20px 24px; display: flex; flex-wrap: wrap; gap: 18px 20px; align-items: center; margin-bottom: 20px;
}
.sum-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sum-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.sum-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.sum-link { display: none; font-size: 13px; font-weight: 700; text-decoration: none; }
.sum-amt { font-size: 32px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.sum-main.clear .sum-amt { color: var(--sell); }
.sum-sub { font-size: 12.5px; color: var(--muted); }
.sum-stats { flex: 3 1 480px; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.ms { display: flex; flex-direction: column; gap: 2px; padding: 0 16px; border-left: 1px solid var(--line-2); min-width: 0; }
.ms-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.ms-value { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.ms-sub { font-size: 12px; color: var(--muted); }
.ms.pos .ms-value { color: var(--sell); }
.summary.tiles { padding: 20px 24px; }
.summary.tiles .sum-stats { flex: 1 1 100%; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.summary.tiles .ms { padding: 2px 20px; }
.summary.tiles .ms:first-child { border-left: 0; padding-left: 0; }
.summary.tiles .ms-label { font-weight: 600; }
.summary.tiles .ms-value { font-size: 26px; letter-spacing: -.02em; }
.ms.neg .ms-value { color: var(--danger); }
.summary.plain .sum-stats { flex: 1 1 100%; }
.summary.plain .ms:first-child { border-left: 0; padding-left: 0; }

/* ================= tabs ================= */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.tabs { display: flex; gap: 8px; }
.tabs a {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap;
  padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: #fff; border: 1px solid var(--ctl); color: var(--ink);
}
.tabs a span { font-weight: 600; }
.tabs a:hover { border-color: #C3CDDD; }
.tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ================= search + filters ================= */
.findbar { display: flex; gap: 8px; align-items: center; flex: 1 1 380px; min-width: 0; }
.search { position: relative; display: flex; flex: 1; min-width: 0; margin: 0; }
.search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 18px; height: 18px; pointer-events: none; }
.search input { padding-left: 40px !important; min-height: 44px; }
.fbtn {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px;
  border: 1px solid var(--brand); border-radius: var(--r-ctl); background: var(--brand); color: #fff;
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; flex: none;
}
.fbtn:hover { background: var(--brand-2); }
.fbtn.icon { width: 44px; padding: 0; justify-content: center; background: #fff; color: var(--ink); border-color: var(--ctl); }
.fbtn.icon:hover { background: var(--brand-tint); }
.fbtn .ic { width: 18px; height: 18px; }
.count-badge { background: #fff; color: var(--brand); border-radius: 999px; font-size: 11px; font-weight: 800; min-width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0 5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand);
  border: 0; border-radius: 999px; padding: 5px 8px 5px 12px; font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.chip .x { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: rgba(30, 58, 138, .12); font-size: 13px; line-height: 1; }
.chip:hover .x { background: rgba(30, 58, 138, .25); }

.fpanel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.fp-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.fp-label ~ .fp-label { margin-top: 4px; }
.dchips { display: flex; flex-wrap: wrap; gap: 8px; }
.dchip {
  display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--ctl); background: #fff; color: var(--ink);
  font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.dchip:hover { border-color: #C3CDDD; }
.dchip.dash { border-style: dashed; border-color: #AEB9CB; }
.dchip.on { background: var(--brand); border: 1px solid var(--brand); color: #fff; }
.custom-dates { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 0; }
.custom-dates .mini { flex: 0 1 190px; }
.fpanel-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
.filter-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.mini { margin: 0; font-weight: 600; font-size: 12px; color: var(--muted); }
.mini span { display: block; margin-bottom: 4px; }
.mini select, .mini input {
  width: 100%; min-height: 44px; padding: 9px 12px; font: inherit; font-size: 15px; font-weight: 500;
  color: var(--ink); border: 1px solid var(--ctl); border-radius: var(--r-ctl); background-color: #fff;
}
.mini select {
  -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2355657D' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
}
.filter-status { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); margin: 0 2px 10px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; font-weight: 700; color: var(--brand); cursor: pointer; }

/* ================= buttons ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--brand); border-radius: var(--r-ctl);
  padding: 11px 18px; font: inherit; font-size: 14.5px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap; vertical-align: middle;
  background: var(--brand); color: #fff;
}
.btn .ic { width: 18px; height: 18px; }
.btn:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.light { background: #fff; color: var(--ink); border-color: var(--ctl); }
.btn.light:hover { background: var(--brand-tint); }
.btn.sell { background: var(--sell); border-color: var(--sell); color: #fff; }
.btn.sell:hover { background: var(--sell-2); border-color: var(--sell-2); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: #FCD4D4; color: var(--danger-2); }
.btn.small { padding: 8px 13px; font-size: 13px; border-radius: 10px; }
.btn.small .ic { width: 16px; height: 16px; }
.btn.wide { flex: 1; }
.btn.block { display: flex; width: 100%; margin-top: 8px; }
.btn.block-mob { margin-bottom: 4px; }
.link-danger { background: none; border: 0; color: var(--danger); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; padding: 0; }
.link-danger:hover { text-decoration: underline; }

/* ================= forms ================= */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; margin-bottom: 14px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
.panel > label:first-of-type, .panel > h2 + label { margin-top: 4px; }
.optional { font-weight: 500; color: var(--faint); font-size: 12px; margin-left: 4px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=search] {
  width: 100%; padding: 11px 13px; min-height: 46px;
  border: 1px solid var(--ctl); border-radius: var(--r-ctl);
  font: inherit; font-size: 16px; background: #fff; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
input:focus, select:focus { outline: 3px solid rgba(30, 58, 138, .16); border-color: var(--brand); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row2.wide-left { grid-template-columns: 1.6fr 1fr; }
.row2.wide-left label { margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.danger-zone { text-align: right; margin-top: 4px; }
.phone-box .pmodel.big { font-size: 19px; }
.phone-box > div + div { margin-top: 4px; }

.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice .opt { margin: 0; flex: 1 1 120px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: block; text-align: center; padding: 11px 10px; border-radius: var(--r-ctl); border: 1.5px solid var(--ctl); font-weight: 600; cursor: pointer; background: #fff; }
.choice input:checked + span { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }
.choice input:focus-visible + span { outline: 3px solid rgba(30, 58, 138, .25); }

.toggle { display: flex; align-items: center; gap: 14px; padding: 13px 0; margin: 0; border-top: 1px solid var(--line); cursor: pointer; font-weight: 400; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 46px; height: 28px; border-radius: 999px; background: #CBD5E1; position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .15s; }
.toggle input:checked + .switch { background: var(--brand); }
.toggle input:checked + .switch::after { transform: translateX(18px); }
.toggle input:focus-visible + .switch { outline: 3px solid rgba(30, 58, 138, .25); }
.toggle-text { display: flex; flex-direction: column; }
.toggle-text small { color: var(--muted); font-size: 13px; }
.perm-title { margin-top: 22px; }

.me { display: flex; align-items: center; gap: 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.panel-head h2 { margin: 0; }
.partner-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.panel-head + .partner-row, .panel-head + p + .partner-row { border-top: 0; }
.partner-row .avatar { background: var(--brand-soft); color: var(--brand); }
.partner-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.partner-text small { color: var(--muted); font-size: 13px; }
.partner-text > .tag { align-self: flex-start; margin: 2px 0; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; color: var(--danger); background: var(--danger-soft); border-radius: 6px; padding: 1px 6px; vertical-align: 1px; }

/* ================= empty states ================= */
.empty { background: #fff; border: 1.5px dashed var(--ctl); border-radius: var(--r-card); padding: 30px 20px; text-align: center; color: var(--muted); }
.empty .ic { width: 36px; height: 36px; color: var(--faint); }
.empty p { margin: 8px 0 12px; }
.empty.small { padding: 16px; }

/* ================= phone list (computers: a table) ================= */
.plist {
  --cols: minmax(0, 2.2fr) minmax(0, 1.55fr) minmax(0, .75fr) minmax(0, .9fr) minmax(0, 1.6fr);
  --acts: 150px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden;
}
.cells { display: grid; grid-template-columns: var(--cols); gap: 12px; align-items: center; }
.plist-head, .prow-line { display: grid; grid-template-columns: minmax(0, 1fr) var(--acts); align-items: center; }
.plist-head { background: var(--thead); border-bottom: 1px solid var(--line-2); color: var(--muted); font-size: 12px; font-weight: 600; }
.plist-head .cells { padding: 13px 0 13px 18px; }
.plist-head .r, .plist-head .acts-h { text-align: right; }
.plist-head .s { padding-left: 14px; }
.plist-head .acts-h { padding-right: 18px; }
.prow { display: block; border-top: 1px solid var(--line-2); color: inherit; text-decoration: none; }
.plist-head + .prow { border-top: 0; }
.prow-head {
  width: 100%; padding: 13px 0 13px 18px; background: none; border: 0; text-align: left; cursor: pointer; color: inherit; font-size: 14px;
}
.prow:hover .prow-line, .prow.open .prow-line { background: #F8FAFD; }
.c-phone { min-width: 0; }
.c-phone b { font-size: 14.5px; font-weight: 700; }
.d-spec { font-size: 12px; color: var(--muted); margin-left: 6px; }
.m-line { display: none; }
.c-imei { color: #334155; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-bought { white-space: nowrap; }
.c-rate { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c-status { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; padding-left: 14px; }
.c-sdate, .c-seller { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-sprice { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c-profit { padding-left: 14px; }
.plist.mode-sold .c-status { display: none; }
.c-price { font-variant-numeric: tabular-nums; white-space: nowrap; }
.prow:not(.sold) .c-price { display: none; }
.c-when { flex-basis: 100%; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.stock { color: var(--stock); background: var(--stock-soft); }
.pill.pos { color: var(--sell-2); background: var(--sell-soft); }
.pill.neg { color: var(--danger); background: var(--danger-soft); }
.prow-acts { padding: 0 18px 0 8px; text-align: right; font-size: 14px; white-space: nowrap; }
.prow-acts a { text-decoration: none; font-weight: 600; }
.prow-acts a:hover { text-decoration: underline; }
.prow-acts .dot { color: var(--faint); margin: 0 6px; }
.act-sell {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 13px; border-radius: 999px;
  background: var(--sell); color: #fff !important; font-size: 13px; font-weight: 700 !important;
}
.act-sell .ic { width: 14px; height: 14px; }
.prow-acts a.act-sell:hover { background: var(--sell-2); text-decoration: none; }
.prow-acts .act-sell + .dot { display: none; }
.prow-acts .act-sell ~ .act-edit { margin-left: 12px; }
.act-main { color: var(--brand); }
.act-edit { color: var(--muted); }
.pdetail { padding: 4px 18px 16px; background: #F8FAFD; border-top: 1px dashed var(--line); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 18px; padding-top: 10px; }
.facts div span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.facts div b { font-weight: 600; font-size: 14px; }
.pactions { display: none; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.spec { display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--ink-2); background: var(--brand-tint); border-radius: 6px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.pnote { font-size: 13px; color: var(--muted); margin-top: 2px; }
.imei { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.pmodel { font-weight: 700; }

/* ================= khata ================= */
.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 24px 0 10px; }
.list-head .findbar { flex: none; }
.owe-table h2 { margin-bottom: 4px; }
.owe-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.owe-table h2 + .owe-row { border-top: 0; }
.owe-amt { font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.owe-amt.clear { color: var(--sell); }
.pay-form { margin-bottom: 14px; }
.pay-grid { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; }
.pay-grid > div { flex: 1 1 150px; }
.pay-grid > div.grow { flex: 2 1 220px; }
.pay-grid > div.submit { flex: 0 0 auto; padding-top: 12px; }
.pay-grid label { margin-top: 6px; }
.ledger { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.lrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 18px; border-top: 1px solid var(--line-2); }
.lrow:first-child { border-top: 0; }
.lmain { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; align-items: center; min-width: 0; flex: 1; }
.lmain::before { content: "Rs"; grid-row: span 2; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--sell-soft); color: var(--sell-2); font-weight: 800; font-size: 13px; }
.lamount { font-weight: 800; font-size: 16px; color: var(--sell); font-variant-numeric: tabular-nums; }
.lmeta { font-size: 13px; color: var(--muted); }
.lside { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.lrun { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ================= IMEI 1 / IMEI 2 and the scanner ================= */
.imei-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin: 14px 0 6px; }
.imei-head label { margin: 0; }
.imei-head .btn { padding: 7px 12px; }
input.filled { border-color: var(--sell); background: #F3FBF6; }
.c-imei .imei2 { display: block; font-size: 12px; color: var(--muted); }
.has-pic { display: inline-flex; color: var(--muted); }
.has-pic .ic { width: 15px; height: 15px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
body.no-scroll { overflow: hidden; }

.scanner { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.sc-box { width: 100%; max-width: 460px; background: #fff; border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 12px; max-height: 100%; overflow: auto; }
.sc-head { display: flex; justify-content: space-between; align-items: center; }
.sc-head b { font-size: 17px; }
.sc-close { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--brand-tint); font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink); }
.sc-video { position: relative; background: #0B1220; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; }
.sc-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-frame { position: absolute; left: 8%; right: 8%; top: 32%; bottom: 32%; border: 2px solid rgba(255, 255, 255, .9); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); }
.sc-msg { margin: 0; font-size: 14px; color: var(--ink-2); min-height: 20px; }
.sc-found { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sc-found div { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.sc-found div.ok { border-color: var(--sell); background: #F3FBF6; }
.sc-found span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.sc-found b { font-size: 13.5px; word-break: break-all; }
.sc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sc-actions .btn { flex: 1 1 160px; }

/* ================= photos ================= */
.photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 16px; }
.photo-field { border: 1px dashed #C3CDDD; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 4px; background: #FBFCFE; }
.pf-label { font-weight: 600; font-size: 14px; }
.pf-hint { font-size: 12.5px; color: var(--muted); }
.pf-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; }
.pf-pick { margin: 0; display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--ctl); background: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.pf-pick:hover { background: var(--brand-tint); }
.pf-pick .ic { width: 18px; height: 18px; }
.pf-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pf-preview { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.pf-current { display: flex; align-items: center; gap: 8px; }
.pf-remove { margin: 0; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--danger); cursor: pointer; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumb { display: inline-flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.thumb img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.pf-current .thumb img { width: 64px; height: 64px; }
.pf-current .thumb span { display: none; }
.lphoto .thumb img { width: 44px; height: 44px; border-radius: 10px; }
.lphoto .thumb span { display: none; }
.lightbox { position: fixed; inset: 0; z-index: 110; background: rgba(15, 23, 42, .88); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 20px; }
.lightbox img { max-width: 100%; max-height: calc(100% - 60px); border-radius: 12px; background: #fff; }
.lb-close { position: absolute; top: 14px; right: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; font-size: 26px; cursor: pointer; }
.lb-open { color: #fff; font-size: 13px; }

/* ================= Len-Den ================= */
.r { text-align: right; }
.mob-flex, .mob-grid { display: none !important; }
.desk-inline { display: inline; }
.sidenav a .nbadge { margin-left: auto; }
.nbadge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; line-height: 1;
}
.sidenav a.on .nbadge { background: #fff; color: var(--danger); }
.pill.wait { color: var(--stock); background: var(--stock-soft); display: inline-flex; align-items: center; gap: 4px; }
.pill.wait .ic, .pill .ic { width: 12px; height: 12px; }
.tabs a span { opacity: .8; }

.ld-av { width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; }
.ld-av.big { width: 52px; height: 52px; border-radius: 14px; }
.ld-av.big .ic { width: 26px; height: 26px; }

/* list */
.ld-waitbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 12px; border-radius: 14px;
  background: #FFFBEB; border: 1px solid #FDE68A; color: var(--stock); text-decoration: none; font-size: 14px; font-weight: 600;
}
.ld-waitbar span { flex: 1; }
.ldlist { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.ld-head, .ld-row {
  display: grid; align-items: center; gap: 12px; padding: 12px 18px;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1.75fr) minmax(0, .85fr) minmax(0, .95fr) minmax(0, .85fr) minmax(0, .8fr) 232px;
}
.ldlist.viewer .ld-head, .ldlist.viewer .ld-row { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1.75fr) minmax(0, .85fr) minmax(0, .95fr) minmax(0, .85fr) minmax(0, .8fr) 70px; }
.ld-head { background: var(--thead); border-bottom: 1px solid var(--line-2); color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 13px; padding-bottom: 13px; }
.ld-row { border-top: 1px solid var(--line-2); font-size: 14px; }
.ld-head + .ld-row { border-top: 0; }
.ld-row:hover { background: #F8FAFD; }
.ld-main { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.ld-name { display: flex; flex-direction: column; min-width: 0; }
.ld-name b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-name small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-name small.mob, .ld-bal .mob { display: none; }
.ld-last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ld-gave { color: var(--danger); font-weight: 600; font-variant-numeric: tabular-nums; }
.ld-recv { color: var(--sell); font-weight: 600; font-variant-numeric: tabular-nums; }
.ld-bal b { font-size: 15px; font-variant-numeric: tabular-nums; }
.ld-bal b.iowe, .sum-amt.iowe, .ld-balline.iowe strong, .ld-balline.iowe b { color: var(--danger); }
.ld-bal b.clear, .sum-amt.clear, .ld-balline.clear strong, .ld-balline.clear b { color: var(--sell); }
.ld-status { display: flex; flex-wrap: wrap; gap: 4px; }
.ld-acts { white-space: nowrap; display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.ld-acts a { text-decoration: none; font-size: 12.5px; font-weight: 700; }
.act-gave, .act-recv { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 999px; }
.act-gave .ic, .act-recv .ic { width: 13px; height: 13px; }
.act-gave { background: var(--danger-soft); color: var(--danger); }
.act-recv { background: var(--sell-soft); color: var(--sell-2); }
.act-open { margin-left: 6px; color: var(--brand); font-size: 13.5px !important; font-weight: 600 !important; }

/* one shop / person */
.ld-pagehead { align-items: center; }
.ld-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ld-subline { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 2px 0 0; font-size: 14px; }
.ld-subline span { display: inline-flex; align-items: center; gap: 5px; }
.ld-subline .ic { width: 15px; height: 15px; }
.ld-sees { color: var(--brand); font-weight: 600; }
.ld-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.ld-grid.one { grid-template-columns: minmax(0, 1fr); }
.ld-left { min-width: 0; }
.ld-sum { margin-bottom: 14px; }
.ld-sum .sum-stats { flex: 2 1 300px; }
.ld-sum .sum-top { justify-content: flex-start; gap: 10px; }
.ld-waitline { flex: 1 1 100%; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; background: #FFFBEB; border: 1px solid #FDE68A; color: var(--stock); font-size: 13px; font-weight: 600; }
.ld-waitline .ic { width: 17px; height: 17px; }
.btn.btn-gave { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.btn-gave:hover { background: var(--danger-2); border-color: var(--danger-2); }

.ld-check { background: #fff; border: 1.5px solid #F59E0B; border-radius: 18px; padding: 14px 16px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 6px 18px rgba(146, 64, 14, .08); }
.ld-check-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.ld-check-head b { display: inline-flex; align-items: center; gap: 6px; color: var(--stock); font-size: 14px; }
.ld-check-head .ic { width: 17px; height: 17px; }
.ld-check-entry, .ld-pending-top { display: flex; align-items: center; gap: 12px; }
.ld-check-acts { display: flex; gap: 8px; }
.ld-check-acts form:first-child { flex: 1; }
.ld-check-acts .btn { width: 100%; }
.ld-check p { margin: 0; }

.ld-pending { background: #FFFBEB; border: 1.5px dashed #F59E0B; border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 10px; }
.ld-pending.no { background: #FEF2F2; border-color: var(--danger-line); }
.ld-pending-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12.5px; color: var(--stock); margin: 0; }
.ld-pending.no .ld-pending-foot { color: var(--danger-2); }

.ld-types { margin-bottom: 10px; }
.ldh { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.ldh-headrow, .ldh-head {
  display: grid; align-items: center; gap: 12px;
  grid-template-columns: 112px 104px 104px minmax(0, 1fr) 48px 150px 22px;
}
.ldh-headrow { background: var(--thead); border-bottom: 1px solid var(--line-2); color: var(--muted); font-size: 12px; font-weight: 600; padding: 13px 18px; }
.ldh-row { border-top: 1px solid var(--line-2); }
.ldh-headrow + .ldh-row { border-top: 0; }
.ldh-head { width: 100%; padding: 12px 18px; background: none; border: 0; text-align: left; cursor: pointer; color: inherit; font-size: 14px; -webkit-tap-highlight-color: transparent; }
.ldh-row:hover .ldh-head, .ldh-row.open .ldh-head { background: #F8FAFD; }
.ldh-row.open { box-shadow: inset 3px 0 0 var(--brand); }
.ldh-ic { width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; }
.ldh-ic.gave { background: var(--danger-soft); color: var(--danger); }
.ldh-ic.received { background: var(--sell-soft); color: var(--sell); }
.ldh-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ldh-main b { font-size: 15px; }
.ldh-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ldh-meta .has-pic { vertical-align: -2px; margin-left: 4px; }
.t-gave { color: var(--danger); }
.t-received { color: var(--sell); }
.ldh-head .ldh-ic, .ldh-head .ldh-main { display: none; }
.ldh-date { white-space: nowrap; }
.ldh-amount { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ldh-note { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ldh-pic { color: var(--faint); }
.ldh-pic .ic { width: 18px; height: 18px; }
.ldh-after { display: flex; justify-content: flex-end; gap: 5px; align-items: baseline; font-weight: 600; white-space: nowrap; }
.ldh-after small { font-size: 13px; font-weight: 600; color: inherit; }
.ldh-after.clear { color: var(--sell); }
.ldh-after.iowe { color: var(--danger); }
.ldh-chev { color: var(--faint); display: flex; }
.ldh-chev .ic { width: 18px; height: 18px; transition: transform .15s; }
.ldh-row.open .ldh-chev { color: var(--brand); }
.ldh-row.open .ldh-chev .ic { transform: rotate(180deg); }
.ldh-detail { padding: 0 18px 14px; background: #F8FAFD; display: flex; flex-direction: column; gap: 10px; }
.ld-balline { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; background: #fff; border: 1px solid var(--line-2); border-radius: 12px; }
.ld-balline span { display: flex; flex-direction: column; min-width: 0; }
.ld-balline small { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.ld-balline b { font-size: 13.5px; }
.ld-balline strong { font-size: 18px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ld-check .ld-balline { background: var(--thead); }
.ldh-detail .ld-balline { display: none; }
.ldh-foot { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.ldh-by { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
.ldh-by b { color: var(--ink); font-size: 14px; }
.ldh-by span { display: inline-flex; align-items: center; gap: 6px; }
.ldh-by .ic { width: 14px; height: 14px; }
.ldh-acts { display: flex; gap: 6px; flex: none; }
.ldh-acts form { margin: 0; }

/* add an entry */
.ld-side { position: sticky; top: 20px; }
.ld-sheet-bg { display: none; }
.ld-form { margin: 0; display: flex; flex-direction: column; }
.ld-form label { margin: 12px 0 6px; }
.ld-form .flash { margin: 8px 0 0; }
.ld-form-head { display: flex; justify-content: space-between; align-items: center; }
.ld-form-head b { font-size: 16px; }
.ld-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--brand-soft); border-radius: 12px; margin-top: 12px; }
.ld-switch label { margin: 0 !important; }
.ld-switch input { position: absolute; opacity: 0; pointer-events: none; }
.ld-switch span { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 0; border-radius: 9px; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
.ld-switch .ic { width: 16px; height: 16px; }
.ld-switch .sw-gave input:checked + span { background: var(--danger); color: #fff; font-weight: 700; }
.ld-switch .sw-recv input:checked + span { background: var(--sell); color: #fff; font-weight: 700; }
.ld-switch input:focus-visible + span { outline: 3px solid rgba(30, 58, 138, .25); }
.ld-hint { margin: 8px 0 0; }
.ld-form.is-gave #ldAmount { border-color: var(--danger); }
.ld-form.is-recv #ldAmount { border-color: var(--sell); }
.ld-form #ldAmount { font-size: 20px; font-weight: 700; border-width: 1.5px; }
.ld-photo { grid-template-columns: 1fr; margin-top: 14px; }
.ld-after { margin-top: 12px; font-size: 13px; color: var(--muted); }
.ld-after b { color: var(--ink); }
.ld-info { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--brand-tint); color: var(--brand); font-size: 13px; font-weight: 600; }
.ld-info .ic { width: 17px; height: 17px; margin-top: 1px; }
.ld-form.is-gave #ldSave { background: var(--danger); border-color: var(--danger); }
.ld-form.is-recv #ldSave { background: var(--sell); border-color: var(--sell); }

/* add / edit shop or person, and the kind of user */
.choice span .ic { width: 18px; height: 18px; vertical-align: -4px; margin-right: 6px; }
.ld-radio { display: flex; flex-direction: column; gap: 8px; }
.ld-radio label { margin: 0; display: block; cursor: pointer; }
.ld-radio input { position: absolute; opacity: 0; pointer-events: none; }
.ld-radio span { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 12px 44px; border-radius: 12px; border: 1.5px solid var(--ctl); background: #fff; position: relative; }
.ld-radio span::before { content: ""; position: absolute; left: 14px; top: 14px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #A9B6CB; box-sizing: border-box; background: #fff; }
.ld-radio b { font-size: 14.5px; }
.ld-radio small { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.ld-radio input:checked + span { border-color: var(--brand); background: var(--brand-tint); }
.ld-radio input:checked + span::before { border: 6px solid var(--brand); }
.ld-radio input:focus-visible + span { outline: 3px solid rgba(30, 58, 138, .25); }

/* ================= login ================= */
body.guest main { max-width: 440px; margin: 0 auto; padding: 8vh 20px 40px; }
.login { max-width: 400px; margin: 0 auto; }
.login-head { text-align: center; margin-bottom: 20px; }
.login-logo { width: 72px; height: 72px; border-radius: 20px; }
.login-head h1 { margin-top: 14px; font-size: 24px; }

/* ================= phones ================= */
@media (max-width: 820px) {
  .side { display: none; }
  body.app main { position: relative; padding: calc(20px + env(safe-area-inset-top)) 20px 28px; max-width: none; }
  body.app { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
  .desk-only { display: none !important; }
  .mob-only { display: block; }

  .m-avatar { display: grid; position: absolute; top: calc(20px + env(safe-area-inset-top)); right: 20px; width: 44px; height: 44px; font-size: 16px; z-index: 2; }
  .m-avatar { -webkit-tap-highlight-color: transparent; }
  .m-avatar.open { outline: 3px solid rgba(30, 58, 138, .25); outline-offset: 2px; }
  .me-menu {
    display: flex; flex-direction: column; position: absolute; z-index: 40;
    top: calc(20px + env(safe-area-inset-top) + 52px); right: 20px; width: 220px; padding: 6px;
    background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 30px rgba(15, 23, 42, .14);
  }
  .me-who { display: flex; flex-direction: column; padding: 8px 10px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line-2); line-height: 1.3; }
  .me-who b { font-size: 14.5px; }
  .me-who small { font-size: 12.5px; color: var(--muted); }
  .me-menu a { display: flex; align-items: center; gap: 10px; padding: 11px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 600; -webkit-tap-highlight-color: transparent; }
  .me-menu a:active, .me-menu a:hover { background: var(--brand-tint); }
  .me-menu a.red { color: var(--danger); }
  .me-menu a.red:active, .me-menu a.red:hover { background: var(--danger-soft); }
  .me-menu a .ic { width: 19px; height: 19px; }
  .page-head, .narrow > h1, .narrow > .back { padding-right: 56px; }
  .flash { margin-right: 56px; }

  h1 { font-size: 26px; }
  .page-head { margin-bottom: 14px; min-height: 44px; }

  /* summary card: owed amount, then three numbers in a row */
  .summary { display: block; padding: 16px; margin-bottom: 16px; }
  .sum-link { display: inline; }
  .sum-amt { font-size: 30px; margin-top: 2px; }
  .sum-sub { display: none; }
  .sum-sub.keep { display: block; }
  .sum-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }
  .ms { padding: 0 0 0 12px; }
  .ms:first-child { border-left: 0; padding-left: 0; }
  .ms.desk { display: none; }
  .ms-value { font-size: 16px; }
  .ms-sub { display: none; }
  .summary.plain .sum-stats { margin-top: 0; padding-top: 0; border-top: 0; }

  /* tabs become a slide switch */
  .toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; padding: 4px; background: var(--brand-soft); border-radius: 14px; }
  .tabs a { justify-content: center; border: 0; background: none; color: var(--muted); border-radius: 11px; padding: 9px 4px; }
  .tabs a.on { background: #fff; color: var(--brand); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
  .findbar { flex: none; }
  .search input { min-height: 46px; border-radius: 14px; }
  .fbtn { height: 46px; width: 46px; padding: 0; justify-content: center; background: #fff; color: var(--ink); border-color: var(--ctl); border-radius: 14px; position: relative; }
  .fbtn:hover { background: var(--brand-tint); }
  .fbtn.on, .fbtn.active { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
  .fbtn .lbl { display: none; }
  .fbtn .count-badge { position: absolute; top: -6px; right: -6px; background: var(--brand); color: #fff; }

  .fpanel { padding: 14px; }
  .dchip { padding: 7px 12px; font-size: 13px; }
  .custom-dates .mini { flex: 1 1 130px; }
  .custom-dates .btn { flex: 1 1 100%; }

  .row2, .row2.wide-left { grid-template-columns: 1fr; }
  .row2.wide-left > div + div label { margin-top: 14px; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .panel { padding: 16px; }
  .danger-zone { text-align: center; }
  .danger-zone .btn { width: 100%; }

  /* phone list: separate cards */
  .plist { background: none; border: 0; border-radius: 0; overflow: visible; display: flex; flex-direction: column; gap: 8px; }
  .plist-head { display: none; }
  .prow { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
  .prow-line { display: flex; align-items: center; }
  .prow:hover .prow-line, .prow.open .prow-line { background: none; }
  .cells { display: flex; gap: 12px; }
  .prow-head { flex: 1; min-width: 0; padding: 12px 14px; }
  .c-imei, .c-bought, .c-rate, .d-spec, .c-when, .c-sdate, .c-seller, .c-sprice, .c-profit { display: none; }
  .plist.mode-sold .c-status { display: flex; }
  .c-phone { flex: 1; display: flex; flex-direction: column; gap: 2px; }
  .c-phone b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .m-line { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .c-status { flex: none; flex-direction: column; align-items: flex-end; gap: 4px; flex-wrap: nowrap; padding-left: 0; }
  .summary.tiles { padding: 4px 16px; }
  .summary.tiles .sum-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; padding-top: 0; border-top: 0; }
  .summary.tiles .ms { padding: 14px 0 14px 14px; }
  .summary.tiles .ms:nth-child(odd) { border-left: 0; padding-left: 0; }
  .summary.tiles .ms:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .summary.tiles .ms-value { font-size: 22px; }
  .summary.tiles .ms-sub { display: block; }
  .btn.block-mob { display: flex; width: 100%; }
  .prow:not(.sold) .c-price { display: inline; }
  .c-price { font-size: 15px; }
  .pill { font-size: 11px; padding: 2px 8px; }
  .prow-acts { display: none; }
  /* In stock tab: price with a green Sell button under it */
  .plist.quicksell .prow-line { position: relative; }
  .plist.quicksell .pill.stock { display: none; }
  .plist.quicksell .prow:not(.sold) .c-status { padding-bottom: 30px; }
  .plist.quicksell .prow:not(.sold) .prow-acts { display: block; position: absolute; right: 14px; bottom: 11px; padding: 0; }
  .plist.quicksell .prow-acts .act-edit, .plist.quicksell .prow-acts .dot, .plist.quicksell .prow-acts .muted { display: none; }
  .plist.quicksell .act-sell { padding: 4px 11px; font-size: 12px; }
  .pdetail { padding: 0 14px 14px; background: #F8FAFD; }
  .facts { grid-template-columns: 1fr 1fr; }
  .pactions { display: flex; }
  .pactions .btn { flex: 1; }

  .pay-grid > div, .pay-grid > div.grow { flex: 1 1 100%; }
  .pay-grid > div.submit .btn { width: 100%; }
  .list-head { margin-top: 18px; }
  .lrow { padding: 12px 14px; }
  .lrun { white-space: normal; max-width: 120px; text-align: right; }


  /* ---------- Len-Den on phones ---------- */
  .mob-flex { display: inline-flex !important; }
  .mob-grid { display: grid !important; }
  .desk-inline { display: none; }
  body.app.no-bottom { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .bottomnav .nicon { position: relative; display: flex; }
  .bottomnav .nbadge { position: absolute; top: -6px; right: -10px; border: 2px solid #fff; height: 19px; min-width: 19px; font-size: 10.5px; }

  .ldlist { background: none; border: 0; border-radius: 0; overflow: visible; display: flex; flex-direction: column; gap: 8px; }
  .ld-head { display: none; }
  #ldTabs a { font-size: 12.5px; padding: 9px 2px; gap: 4px; }
  .ld-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 16px; position: relative; -webkit-tap-highlight-color: transparent; }
  .ld-row:hover { background: #fff; }
  .ld-main { flex: 1; position: static; }
  .ld-main::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
  .ld-name small.desk, .ld-last, .ld-gave, .ld-recv, .ld-status, .ld-acts { display: none; }
  .ld-name small.mob { display: block; }
  .ld-bal { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
  .ld-bal .mob { display: block; }
  .fbtn.mob-flex { width: auto; padding: 0 14px; background: var(--brand); color: #fff; border-color: var(--brand); }
  .fbtn.mob-flex .lbl { display: inline; }

  .ld-pagehead { align-items: center; }
  .ld-title { gap: 10px; }
  .ld-av.big { width: 44px; height: 44px; }
  .ld-subline { font-size: 13px; gap: 2px 10px; }
  .ld-grid { display: block; }
  .ld-sum .sum-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ld-sum .ld-waitline { margin-top: 12px; }
  .ld-sum .sum-top { justify-content: space-between; }
  .ld-btns { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
  .ld-btns .btn { padding: 14px 10px; font-size: 15.5px; font-weight: 700; border-radius: 14px; }
  .ld-check-acts .btn { padding: 12px 10px; }

  .ldh { background: none; border: 0; border-radius: 0; overflow: visible; display: flex; flex-direction: column; gap: 8px; }
  .ldh-headrow { display: none; }
  .ldh-row { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
  .ldh-headrow + .ldh-row { border-top: 1px solid var(--line); }
  .ldh-row.open { box-shadow: none; border: 1.5px solid var(--brand); }
  .ldh-head { display: flex; gap: 12px; padding: 12px 14px; }
  .ldh-row:hover .ldh-head, .ldh-row.open .ldh-head { background: none; }
  .ldh-head .ldh-ic { display: grid; }
  .ldh-head .ldh-main { display: flex; }
  .ldh-date, .ldh-type, .ldh-amount, .ldh-note, .ldh-pic { display: none; }
  .ldh-after { flex-direction: column; align-items: flex-end; gap: 0; }
  .ldh-after small { font-size: 11px; font-weight: 500; color: var(--muted); }
  .ldh-after.clear small, .ldh-after.iowe small { color: inherit; font-weight: 600; }
  .ldh-after b { font-size: 14px; }
  .ldh-row.open .ldh-after { display: none; }
  .ldh-detail { background: #fff; padding: 0 14px 14px; }
  .ldh-detail .ld-balline { display: flex; background: var(--thead); border-color: var(--line-2); margin-top: -2px; }
  .ldh-foot { border: 0; padding: 0; flex-wrap: wrap; gap: 10px; }
  .ldh-by { flex: 1 1 100%; order: -1; }
  .ldh-by b { display: none; }
  .ldh-acts { margin-left: auto; }

  .ld-side { position: static; }
  .ld-sheet { display: none; position: fixed; inset: 0; z-index: 60; align-items: flex-end; }
  .ld-sheet.open { display: flex; }
  .ld-sheet-bg { display: block; position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
  .ld-form { position: relative; width: 100%; max-height: 92vh; overflow-y: auto; border-radius: 24px 24px 0 0; border: 0; padding: 18px 20px calc(22px + env(safe-area-inset-bottom)); }
  .ld-form .btn.block { padding: 15px; font-size: 16px; font-weight: 700; border-radius: 14px; }
  body.sheet-open { overflow: hidden; }
  .ld-pending-foot { flex-wrap: wrap; }

  .bottomnav {
    display: flex; align-items: center; justify-content: space-around; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: #fff; border-top: 1px solid var(--line);
    padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  }
  .bottomnav a {
    flex: 1; max-width: 80px; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 0; color: var(--faint); text-decoration: none; font-size: 11px; font-weight: 600;
    -webkit-tap-highlight-color: transparent;
  }
  .bottomnav a .ic { width: 22px; height: 22px; }
  .bottomnav a.on { color: var(--brand); font-weight: 700; }
  .bottomnav a.add { flex: none; width: 52px; height: 52px; max-width: none; padding: 0; justify-content: center; border-radius: 18px; background: var(--brand); color: #fff; }
  .bottomnav a.add .ic { width: 24px; height: 24px; stroke-width: 2.4; }
}

/* ================= v15: Scan a phone, Hisaab (close & start new, old pages) ================= */
.pill.navy { color: var(--brand); background: var(--brand-soft); }
.btn.big { padding: 15px 18px; font-size: 16px; font-weight: 700; border-radius: 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.flash .ic { width: 17px; height: 17px; vertical-align: -3px; }
.flash.hs-note { background: var(--stock-soft); color: var(--stock); }

/* the + button sheet (phones) */
.plus-sheet { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-end; }
.ps-bg { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.ps-box { position: relative; width: 100%; background: #fff; border-radius: 24px 24px 0 0; padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.ps-grip { align-self: center; width: 44px; height: 5px; border-radius: 999px; background: var(--ctl); display: block; }
.ps-title { font-size: 18px; }
.ps-opt { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; border: 1.5px solid var(--ctl); background: #fff; color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.ps-opt.main { border-color: var(--brand); background: var(--brand-tint); }
.ps-opt > .ic { color: var(--faint); }
.ps-opt.main > .ic { color: var(--brand); }
.ps-ic { width: 50px; height: 50px; flex: none; border-radius: 14px; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; }
.ps-opt.main .ps-ic { background: var(--brand); color: #fff; }
.ps-ic .ic { width: 26px; height: 26px; }
.ps-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ps-text b { font-size: 16.5px; }
.ps-text small { font-size: 13px; color: var(--muted); }
.ps-box .btn { width: 100%; }

/* Settings: Hisaab box and the pop-up */
.hs-box { border: 1.5px solid var(--brand); }
.hs-title { display: flex; align-items: center; gap: 10px; color: var(--brand); }
.hs-title h2 { margin: 0; color: var(--ink); }
.hs-title .ic { width: 22px; height: 22px; }
.hs-box p { margin: 6px 0 4px; font-size: 14px; line-height: 1.45; }
.hs-box .btn.block { padding: 14px; font-size: 16px; font-weight: 700; border-radius: 14px; margin-top: 10px; }
.hs-pop { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.hs-pop-bg { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.hs-pop-box { position: relative; width: 100%; max-width: 480px; max-height: 100%; overflow-y: auto; background: #fff; border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.hs-pop-box .ps-grip { display: none; }
.hs-pop-head { display: flex; align-items: flex-start; gap: 10px; }
.hs-pop-head > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.hs-pop-head b { font-size: 19px; }
.hs-pop-head small { font-size: 13.5px; color: var(--muted); }
.hs-pop-box > .btn { width: 100%; }
.hs-opt, .hs-oldlink { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px; border: 1.5px solid var(--ctl); background: #fff; color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
a.hs-opt:hover { border-color: var(--brand); background: var(--brand-tint); }
.hs-opt > .ic, .hs-oldlink > .ic { color: var(--brand); }
.hs-opt.done { border-style: dashed; background: var(--thead); color: var(--muted); }
.hs-oldlink { border: 0; border-top: 1px solid var(--line-2); border-radius: 0; padding: 12px 4px 2px; }
.hs-oldlink > .ic { color: var(--faint); }
.hs-ic { width: 46px; height: 46px; flex: none; border-radius: 14px; background: var(--brand-tint); color: var(--brand); display: grid; place-items: center; }
.hs-ic .ic { width: 23px; height: 23px; }
.hs-ic.ok { background: var(--sell-soft); color: var(--sell); }
.hs-ic.grey { background: var(--line-2); color: var(--muted); width: 40px; height: 40px; border-radius: 12px; }
.hs-ic.grey .ic { width: 19px; height: 19px; }
.hs-ic.solid { background: var(--brand); color: #fff; width: 40px; height: 40px; border-radius: 12px; }
.hs-ic.solid .ic { width: 19px; height: 19px; }
.hs-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hs-text b { font-size: 16px; color: var(--ink); }
.hs-text small { font-size: 13px; color: var(--muted); }
.hs-text em { font-style: normal; font-size: 12.5px; color: var(--brand); font-weight: 600; }
.hs-pick { display: flex; flex-direction: column; gap: 10px; }

/* the steps */
.hs-flow { display: flex; flex-direction: column; }
.hs-steps { display: flex; align-items: center; gap: 10px; }
.hs-steps > div { display: flex; flex-direction: column; }
.hs-steps small { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.hs-steps b { font-size: 18px; }
.hs-back { width: 40px; height: 40px; flex: none; border-radius: 12px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink); text-decoration: none; }
.hs-dots { display: flex; gap: 6px; margin: 12px 0 0; }
.hs-dots span { flex: 1; height: 5px; border-radius: 999px; background: var(--ctl); }
.hs-dots span.on { background: var(--brand); }
.hs-q { display: flex; flex-direction: column; gap: 4px; margin: 18px 2px 14px; }
.hs-q b { font-size: 23px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.hs-q span { font-size: 14px; color: var(--muted); }
.hs-card { padding: 14px 16px 6px; }
.hs-period { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; }
.hs-period .hs-ic { width: 40px; height: 40px; border-radius: 12px; }
.hs-period .hs-ic .ic { width: 20px; height: 20px; }
.hs-ptext { display: flex; flex-direction: column; }
.hs-ptext b { font-size: 16px; }
.hs-ptext small { font-size: 12.5px; color: var(--muted); }
.hs-lastday { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; padding: 8px 0 10px; font-size: 14px; color: var(--muted); font-weight: 500; }
.hs-lastday input { width: auto; max-width: 190px; padding: 8px 10px; }
.hs-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.hs-line > span:first-child { color: var(--muted); }
.hs-line .v { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.hs-line b { font-size: 15.5px; }
.hs-line small { font-size: 12px; color: var(--muted); }
.hs-hint { margin: 12px 4px 0; font-size: 13px; color: var(--muted); }
.hs-foot { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.hs-foot .btn { margin: 0; }
.hs-warn { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-top: 4px; border-radius: 14px; background: var(--danger-soft); color: var(--danger-2); text-decoration: none; font-size: 14px; }
.hs-warn .ic { flex: none; }
.hs-owed { border: 1px solid var(--line); margin: 0 0 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.hs-owed legend { float: left; width: 100%; padding: 0 0 4px; font-size: 16px; font-weight: 700; }
.hs-choice { display: flex; margin: 0; cursor: pointer; }
.hs-choice input { position: absolute; opacity: 0; pointer-events: none; }
.hs-choice > span { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 12px 44px; border-radius: 14px; border: 1.5px solid var(--ctl); background: #fff; position: relative; }
.hs-choice > span::before { content: ""; position: absolute; left: 12px; top: 13px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #A9B6CB; box-sizing: border-box; background: #fff; }
.hs-choice input:checked + span { border-color: var(--brand); background: var(--brand-tint); }
.hs-choice input:checked + span::before { border: 7px solid var(--brand); }
.hs-choice input:focus-visible + span { outline: 3px solid rgba(30, 58, 138, .25); }
.hs-choice b { font-size: 15px; color: var(--ink); }
.hs-choice small { font-size: 13px; color: var(--muted); font-weight: 500; }
.hs-ticks { padding: 2px 16px; }
.hs-tick { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line-2); font-size: 14.5px; line-height: 1.4; }
.hs-tick:first-child { border-top: 0; }
.hs-tic { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--sell-soft); color: var(--sell); display: grid; place-items: center; }
.hs-tic .ic { width: 15px; height: 15px; }
.hs-done { text-align: center; padding-top: 40px; display: flex; flex-direction: column; align-items: center; }
.hs-done h1 { margin: 16px 0 6px; font-size: 25px; }
.hs-done p { margin: 0 0 22px; font-size: 15px; }
.hs-bigtick { width: 96px; height: 96px; border-radius: 50%; background: var(--sell-soft); color: var(--sell); display: grid; place-items: center; }
.hs-bigtick .ic { width: 50px; height: 50px; }
.hs-done-acts { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 10px; }
.hs-done-acts .btn { margin: 0; padding: 14px; font-weight: 700; }
.hs-undo { font-size: 14px; padding: 8px; text-decoration: underline; }

/* Old hisaab list */
.hs-old .page-head { margin-bottom: 12px; }
.hs-tabs { margin-bottom: 14px; }
.hs-now { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--brand-tint); border: 1.5px solid var(--brand); border-radius: 16px; }
.hs-now > div { flex: 1; display: flex; flex-direction: column; }
.hs-now small { font-size: 12.5px; color: var(--muted); }
.hs-oldcard { display: flex; flex-direction: column; gap: 10px; padding: 14px; margin-bottom: 10px; background: #fff; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); text-decoration: none; }
.hs-oldcard:hover { border-color: var(--brand); }
.hs-oc-top { display: flex; align-items: center; gap: 10px; }
.hs-oc-top > .ic { color: var(--faint); }
.hs-oc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.hs-oc-stats span { display: flex; flex-direction: column; }
.hs-oc-stats small { font-size: 11.5px; color: var(--muted); }
.hs-oc-stats b { font-size: 14.5px; }

/* One old hisaab: works like the normal page, view only */
.oh-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.oh-head h1 { margin: 0; font-size: 24px; }
.oh-head p { margin: 2px 0 0; font-size: 13px; }
.oh-list { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.oh-wrap + .oh-wrap { border-top: 1px solid var(--line-2); }
.oh-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; background: #fff; border: 0; text-align: left; color: var(--ink); cursor: pointer; }
.oh-row:hover { background: #F8FAFD; }
.oh-row > .ic { color: var(--faint); width: 16px; height: 16px; }
.oh-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.oh-main b { font-size: 14.5px; }
.oh-main small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oh-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.oh-right b { font-size: 14px; }
.oh-right small { font-size: 12px; font-weight: 700; }
.oh-right small.stk { color: var(--stock); }
.oh-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.oh-foot form { margin: 0; }
.ohd-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-bottom: 10px; }
.ohd-top > div { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.ohd-model { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.ohf { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-2); font-size: 15px; }
.ohf span { font-size: 13px; color: var(--muted); font-weight: 600; }
.ohd-note { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; font-size: 13px; font-weight: 600; color: var(--stock); }
.ohd-note .ic { width: 17px; height: 17px; }
.oh-sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.oh-sheet-bg { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.oh-sheet-box { position: relative; width: 100%; max-width: 460px; max-height: 100%; overflow-y: auto; background: #fff; border-radius: 22px; padding: 18px 20px; }
.oh-sheet-box .ps-grip { display: none; }
.oh-sheet-box .btn.block { margin-top: 14px; }
.oh-person { background: #fff; border: 1px solid var(--line); border-radius: 18px; margin-bottom: 10px; overflow: hidden; }
.oh-person.open { border-color: var(--brand); }
.oh-ptop { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px 16px 10px; background: none; border: 0; text-align: left; color: var(--ink); cursor: pointer; }
.oh-ptop .oh-main { gap: 4px; align-items: flex-start; }
.oh-ptop .oh-main b { font-size: 16px; }
.oh-amt { font-size: 21px; font-weight: 800; }
.oh-lines { padding: 0 16px 12px; }
.oh-note { padding-top: 8px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); }
.oh-items { border-top: 1px solid var(--line-2); background: #F8FAFD; padding: 4px 16px 10px; }
.oh-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.oh-item:last-child { border-bottom: 0; }
.oh-item .thumb img { width: 40px; height: 40px; }
.oh-item .thumb span { display: none; }

/* Len-Den / Khata: brought forward */
.ld-bf { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-top: 8px; background: var(--thead); border: 1.5px dashed var(--ctl); border-radius: 16px; }
.ld-bf > .ic { color: var(--muted); }
.ld-bf > span:not(.ldh-after) { flex: 1; display: flex; flex-direction: column; }
.ld-bf small { font-size: 12.5px; color: var(--muted); }
.ld-bf .ldh-after { display: flex; flex-direction: column; align-items: flex-end; }
.lrow.bf-row { background: var(--thead); }
.lrow.bf-row .lmain::before { content: none; }
.lrow.bf-row .lmain { display: block; }
.hs-today { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 8px; padding: 10px 12px; border-radius: 12px; background: var(--stock-soft); color: var(--stock); font-size: 13px; font-weight: 600; }
.hs-today.soft { background: var(--brand-tint); color: var(--brand); }
.hs-today .ic { flex: none; width: 17px; height: 17px; margin-top: 1px; }
.lrow.bf-row .lamount { color: var(--ink-2); display: flex; align-items: center; gap: 6px; font-size: 15px; }
.lrow.bf-row .lamount .ic { width: 17px; height: 17px; color: var(--muted); }
.hs-locknote { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--stock-soft); color: var(--stock); font-size: 13.5px; font-weight: 600; }
.hs-locknote .ic { flex: none; width: 18px; height: 18px; margin-top: 1px; }

/* Scan a phone */
.scanpage { max-width: 560px; display: flex; flex-direction: column; gap: 14px; }
.sp-cam { background: #0B1220; color: #fff; border-radius: 22px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sp-head { display: flex; justify-content: space-between; align-items: center; }
.sp-head b { font-size: 19px; }
.sp-x { width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; display: grid; place-items: center; }
.sp-video { position: relative; background: #1E293B; border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3; }
.sp-video video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sp-frame { position: absolute; left: 8%; right: 8%; top: 26%; bottom: 26%; border: 2px solid rgba(255, 255, 255, .92); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .3); }
.sp-line { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: #EF4444; box-shadow: 0 0 8px #EF4444; }
.sp-msg { margin: 4px 0 0; font-size: 15px; font-weight: 600; text-align: center; }
.sp-tip { margin: 0; font-size: 13px; color: #94A3B8; text-align: center; }
.sp-tip b { color: #fff; }
.sp-photo { margin-top: 4px; }
.sp-type label { display: flex; align-items: center; gap: 6px; margin-top: 0; }
.sp-type label .ic { width: 18px; height: 18px; }
.sp-row { display: flex; gap: 8px; }
.sp-row input { flex: 1; min-width: 0; font-size: 17px; }
.sp-result .sp-rhead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sp-rhead h1 { margin: 0; font-size: 22px; flex: 1; }
.sp-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; }
.sp-dot .ic { width: 17px; height: 17px; }
.sp-dot.green { background: var(--sell-soft); color: var(--sell); }
.sp-dot.amber, .sp-big.amber { background: var(--stock-soft); color: var(--stock); }
.sp-card { padding: 16px 16px 8px; }
.sp-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-bottom: 12px; }
.sp-top > div { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.sp-model { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.sf { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); font-size: 15px; }
.sf b { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.sf > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.sp-match { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; padding: 3px 8px; }
.sp-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding-bottom: 6px; }
.sp-acts { display: flex; flex-direction: column; gap: 10px; }
.sp-acts .btn.block { margin: 0; }
.sp-two { display: flex; gap: 10px; }
.sp-two > .btn, .sp-two > form { flex: 1; }
.sp-two form .btn { width: 100%; }
.sp-none { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 10px 16px; }
.sp-none b { font-size: 20px; }
.sp-none p { margin: 0; }
.sp-big { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; }
.sp-big .ic { width: 36px; height: 36px; }

@media (max-width: 820px) {
  .hs-pop { align-items: flex-end; padding: 0; }
  .hs-pop-box { max-width: none; border-radius: 24px 24px 0 0; padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 92vh; }
  .hs-pop-box .ps-grip { display: block; }
  .hs-pop-head .sc-close { display: none; }
  .oh-sheet { align-items: flex-end; padding: 0; }
  .oh-sheet-box { max-width: none; border-radius: 24px 24px 0 0; padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 88vh; }
  .oh-sheet-box .ps-grip { display: block; margin-bottom: 10px; }
  body.oldmode main { padding-top: calc(12px + env(safe-area-inset-top)); }
  .oh-head h1 { font-size: 22px; }
  .oh-foot .btn, .oh-foot form { flex: 1 1 auto; }
  .oh-foot form .btn { width: 100%; }
  .scanpage { margin: calc(-8px - env(safe-area-inset-top)) -8px 0; }
  .sp-cam { border-radius: 20px; }
  .hs-flow .hs-foot { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 calc(10px + env(safe-area-inset-bottom)); margin-top: 14px; }
  .sp-result .sp-rhead { padding-right: 52px; }
}

/* v15.1: Phones page link to older sales */
.ph-older { text-align: center; margin: 14px 0 4px; }
.link-btn.ph-old { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.link-btn.ph-old .ic { width: 16px; height: 16px; }
.empty .ph-old { margin-top: 12px; }
.empty .btn + .ph-old { display: flex; justify-content: center; }

/* v16: scan from a photo when the live camera can't start (a phone on http, or the camera is off) */
.sp-shot { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; aspect-ratio: 4 / 3; border-radius: 16px; background: #1E293B; border: 2px dashed rgba(255, 255, 255, .26); color: #fff; cursor: pointer; padding: 18px; -webkit-tap-highlight-color: transparent; }
.sp-shot-ic { width: 88px; height: 88px; border-radius: 50%; background: #fff; color: var(--brand); display: grid; place-items: center; margin-bottom: 10px; box-shadow: 0 0 0 10px rgba(255, 255, 255, .08); transition: transform .12s; }
.sp-shot-ic .ic { width: 40px; height: 40px; }
.sp-shot b { font-size: 21px; letter-spacing: -.01em; }
.sp-shot small { font-size: 14px; color: #94A3B8; }
.sp-shot:active .sp-shot-ic { transform: scale(.94); }
.sp-shot-wait { display: none; }
.sp-cam.nolive .sp-video, .sp-cam.nolive .sp-photo { display: none; }
.sp-cam.nolive .sp-shot { display: flex; }
.sp-cam.reading .sp-shot { pointer-events: none; border-style: solid; }
.sp-cam.reading .sp-shot-go, .sp-cam.reading .sp-shot small { display: none; }
.sp-cam.reading .sp-shot-wait { display: block; }
.sp-cam.reading .sp-shot-ic { animation: sp-pulse 1s ease-in-out infinite; }
@keyframes sp-pulse { 50% { transform: scale(.88); opacity: .75; } }
.scanner.nolive .sc-video { display: none; }

/* v16: up to 5 photos in one photo field */
.pf-row { align-items: flex-start; }
.pf-current { flex-direction: column; align-items: center; gap: 4px; }
.pf-current .thumb img, .pf-slot .pf-preview { width: 72px; height: 72px; }
.pf-slot { position: relative; display: flex; }
.pf-slot[hidden] { display: none; }
.pf-slot.filled .pf-pick { display: none; }
.pf-pick { min-height: 44px; }
.pf-slot .pf-clear { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 2px solid #fff; background: var(--danger); color: #fff; font-size: 17px; line-height: 1; font-weight: 700; display: grid; place-items: center; cursor: pointer; box-shadow: 0 1px 3px rgba(15, 23, 42, .25); }
.pf-slot .pf-clear[hidden] { display: none; }
.pf-more { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 9px 14px; border-radius: 10px; border: 1.5px dashed #9FB0C8; background: #fff; color: var(--brand); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; align-self: center; }
.pf-more:hover { background: var(--brand-tint); }
.pf-more .ic { width: 18px; height: 18px; }
.pf-more[hidden] { display: none; }
.lphoto { display: flex; flex-wrap: wrap; gap: 6px; }
.thumb { position: relative; }
.th-more { position: absolute; right: 4px; top: 4px; min-width: 22px; height: 20px; padding: 0 5px; border-radius: 10px; background: rgba(15, 23, 42, .78); color: #fff; font-style: normal; font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center; }
.lphoto .th-more { right: 2px; top: 2px; min-width: 18px; height: 17px; line-height: 17px; font-size: 10.5px; padding: 0 4px; }
.thumb[hidden] { display: none; }
.lb-nav { display: none; position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .16); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lightbox.many .lb-nav { display: grid; place-items: center; }
.lb-count { color: #fff; font-size: 13px; font-weight: 700; min-height: 16px; }
.lightbox img { max-height: calc(100% - 90px); }
.sp-cam.reading .sp-msg { visibility: hidden; }
.lightbox { background: rgba(15, 23, 42, .95); }
