.ph { font-size: 1.15em; vertical-align: -.16em; line-height: 1; }
:root {
  --ground: #f8f8f8; --surface: #ffffff; --ink: #0c090c; --muted: #79697b; --line: #e7e4e7;
  --accent: #1447e6; --accent-soft: #eff6ff;
  --ok: #079455; --ok-soft: #ecfdf3; --warn: #dc6803; --warn-soft: #fef6ee;
  --bad: #e7000b; --bad-soft: #fef2f2; --info: #1447e6; --info-soft: #eff6ff; --code: #f3f1f3;
  --body: "IBM Plex Sans", "Noto Sans Bengali", "Segoe UI", system-ui, sans-serif;
  --display: "Schibsted Grotesk", "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
/* Figma-style scrollbars: thin, no arrows, transparent track, rounded thumb that darkens on hover */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; }
::-webkit-scrollbar-thumb { min-height: 32px; border: 3px solid transparent; border-radius: 99px; background: rgb(12 9 12 / .18) padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgb(12 9 12 / .4); }
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: rgb(12 9 12 / .25) transparent; } }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font: 14px/1.5 var(--body); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 7px 12px; }
button:hover { border-color: var(--accent); }
.icon-only { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* app bar */
.appbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; height: 52px;
  padding-inline: 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font: 700 16px/1 var(--display); letter-spacing: -.01em; white-space: nowrap; }
.brand span { color: var(--accent); }
.appbar nav { display: flex; gap: 4px; height: 100%; overflow-x: auto; }
.appbar nav a { display: flex; align-items: center; padding-inline: 12px; color: var(--muted); text-decoration: none;
  font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.appbar nav a:hover { color: var(--ink); }
.appbar nav a.on { color: var(--ink); border-bottom-color: var(--accent); }
.appbar .spacer { flex: 1; }
.appbar .model { font: 500 12px var(--mono); color: var(--muted); white-space: nowrap; }

/* page */
.page { max-width: 1320px; margin: 0 auto; padding-inline: 20px; padding-block: 24px 60px; display: grid; gap: 16px; }
.page > * { min-width: 0; }  /* wide tables scroll inside their card instead of widening the page */
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font: 700 26px/1.1 var(--display); margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search], .toolbar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); min-width: 0; }
.toolbar input[type=search] { width: min(320px, 100%); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { border-radius: 99px; padding: 5px 12px; font-size: 13px; }
.tabs button.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.tabs .n { font: 500 11px var(--mono); opacity: .7; margin-left: 4px; }

/* table */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
thead th { border-top: 0; font: 600 11.5px/1.2 var(--body); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; background: #edefee; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--ground); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { display: block; color: var(--muted); font-size: 12.5px; }
.code { font: 500 13px var(--mono); }
.thumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; vertical-align: middle; background: var(--code); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* status badges */
.badge { display: inline-block; font: 500 12px/1 var(--body); padding: 4px 8px; border-radius: 99px; background: var(--code); color: var(--muted); white-space: nowrap; }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.confirmed, .badge.packed { background: var(--info-soft); color: var(--info); }
.badge.shipped { background: var(--accent-soft); color: var(--accent); }
.badge.delivered, .badge.known, .badge.on { background: var(--ok-soft); color: var(--ok); }
.badge.cancelled, .badge.returned, .badge.off { background: var(--bad-soft); color: var(--bad); }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgb(15 17 25 / .35); z-index: 30; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--surface); z-index: 31;
  display: flex; flex-direction: column; box-shadow: -12px 0 40px rgb(15 17 25 / .12); }
.drawer header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer header h2 { font: 700 18px/1.2 var(--display); margin: 0; }
.drawer .body { flex: 1; overflow: auto; padding: 18px 20px; display: grid; gap: 18px; align-content: start; }
.drawer footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); }
.section h3 { font: 600 12px/1 var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
dl.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.lines { width: 100%; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lines td, .lines th { padding: 8px 10px; white-space: normal; }
.lines tfoot td { font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.timeline li { display: flex; gap: 10px; align-items: baseline; }
.timeline time { font: 12px var(--mono); color: var(--muted); min-width: 110px; }

/* forms */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; }
.field label { font-weight: 500; font-size: 13px; }
.field .hint { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); width: 100%; }
.field textarea { min-height: 70px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; }
.checks label { display: flex; gap: 6px; align-items: center; }
.variants { display: grid; gap: 6px; }
.variant { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto auto; gap: 6px; align-items: center; }
.variant input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; min-width: 0; }
.variant.head { font-size: 12px; color: var(--muted); }
.error { background: var(--bad-soft); color: var(--bad); padding: 8px 12px; border-radius: 7px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 8px; z-index: 40; max-width: 90vw; }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } .variant { grid-template-columns: 1fr 1fr; } dl.kv { grid-template-columns: 1fr; } }

/* ---- shared page chrome */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--accent); }
.crumbs [aria-current] { color: var(--accent); font-weight: 500; }
a.btn, .btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 7px 12px; font-weight: 500; }
a.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small, button.small { padding: 4px 10px; font-size: 13px; }
.req { color: var(--bad); }

/* ---- orders list */
.list-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px 10px; }
.list-head input { padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; width: min(340px, 100%); background: var(--surface); }
.keyrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 0 16px 16px; }
.keyrow input { padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; width: min(340px, 100%); background: var(--surface); }
.seg { display: flex; gap: 2px; margin: 0 16px 12px; padding: 3px; background: var(--ground); border-radius: 9px; width: fit-content; max-width: calc(100% - 32px); overflow-x: auto; }
.seg button { border: 0; background: transparent; border-radius: 7px; padding: 6px 12px; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(15 17 25 / .08); }
.seg .n { font: 500 11px var(--mono); margin-left: 6px; padding: 1px 5px; border-radius: 4px; background: var(--code); color: var(--muted); }
table.orders td { vertical-align: top; }
table.orders td .sub { display: block; }
.inv { font-weight: 600; color: var(--ink); text-decoration: none; } .inv:hover { color: var(--accent); }
.chips { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.chip.cod { color: var(--warn); border-color: #f9dbaf; background: var(--warn-soft); }
.chip.ai { color: var(--accent); border-color: #bedbff; background: var(--accent-soft); }
.chip.manual { color: var(--ink); border-color: var(--line); background: var(--code); }
.phone { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 2px 4px 2px 8px; border: 1px solid var(--line); border-radius: 6px; }
.copy { border: 0; padding: 0 4px; background: none; color: var(--muted); }
td.note { white-space: normal; max-width: 280px; color: var(--muted); font-size: 13px; }

/* ---- order page */
.order-grid { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.col { display: grid; gap: 18px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: grid; gap: 12px; }
.panel.flush { padding: 0; gap: 0; overflow: hidden; }
.panel h2 { font: 700 16px/1.2 var(--display); margin: 0; }
.panel input, .panel select, .panel textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); width: 100%; }
.panel input:disabled, .panel select:disabled, .panel textarea:disabled { background: var(--ground); color: var(--muted); }
.readonly { padding: 8px 10px; border-radius: 7px; background: var(--ground); color: var(--muted); display: grid; gap: 2px; }
.combo { position: relative; }
.combo-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 10; background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; box-shadow: 0 10px 30px rgb(15 17 25 / .12); max-height: 300px; overflow: auto; }
.combo-list button { display: grid; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 8px 12px; }
.combo-list button:hover { background: var(--accent-soft); }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; max-height: 330px; overflow: auto; padding-right: 2px; }
.pick { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 9px; }
.pick .thumb { width: 40px; height: 40px; }
.pinfo { display: grid; gap: 3px; min-width: 0; }
.pinfo strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinfo select { padding: 3px 6px; font-size: 12.5px; }
table.items th { background: var(--ground); }
.item { display: flex; align-items: center; gap: 10px; white-space: normal; min-width: 180px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.stepper button { border: 0; border-radius: 0; padding: 4px 10px; background: var(--surface); }
.stepper span { min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.sub.warn { color: var(--warn); }
button.icon { border: 0; background: none; padding: 4px; }
.totals { display: grid; border-top: 1px solid var(--line); }
.trow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.trow .money { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.trow input { width: 110px; text-align: right; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; }
.trow.grand { background: var(--accent-soft); font-weight: 700; font-size: 16px; }
.field.pad { padding: 14px 18px 18px; }
@media (max-width: 900px) { .order-grid { grid-template-columns: 1fr; } }

/* ---- customers */
.list-head .spacer { flex: 1; }
.list-head select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.chips.row { flex-direction: row; flex-wrap: wrap; margin-top: 4px; }
.badge.tier-regular { background: var(--code); color: var(--muted); }
.badge.tier-vip { background: #fbf3d9; color: #7a5c00; }
.badge.tier-wholesale { background: var(--info-soft); color: var(--info); }
.h2 { font: 700 18px/1.2 var(--display); margin: 0 0 10px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, max-content)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: grid; gap: 8px; align-content: start; min-width: 240px; }
.stat-head { display: flex; align-items: center; gap: 8px; }
.stat .phone { width: fit-content; }
.pill-dashed { width: fit-content; padding: 3px 10px; border: 1px dashed var(--line); border-radius: 7px; color: var(--muted); font-size: 13px; }
.nums { display: flex; gap: 26px; }
.nums div { display: grid; justify-items: center; }
.nums b { font: 700 22px/1.2 var(--display); font-variant-numeric: tabular-nums; }
.nums span { font-size: 12px; color: var(--muted); }
.nums .ok b { color: var(--ok); } .nums .bad b { color: var(--bad); }
.addr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.addr-card { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.addr-card .sub, .addr-edit .sub { display: block; color: var(--muted); font-size: 12.5px; }
.addr-actions { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.addr-head { display: flex; justify-content: space-between; align-items: center; }
.addr-list { display: grid; gap: 8px; }
.addr-edit { display: grid; gap: 10px; padding: 14px; border: 1px dashed var(--accent); border-radius: 10px; background: #f5f9ff; }
.addr-edit-head { display: flex; justify-content: space-between; align-items: center; color: var(--accent); }
button.link.danger { color: var(--bad); }
.icon-btn { padding: 6px 10px; }
button.primary.danger-btn { background: var(--bad); border-color: var(--bad); }
p.sub { color: var(--muted); margin: 0; }

/* ---- products */
.tabbar { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 16px 12px; }
.tabbar .seg { margin: 0; }
.warn-text { color: var(--warn); } .bad-text { color: var(--bad); }
.type-row { display: flex; gap: 12px; flex-wrap: wrap; }
.type-card { display: grid; gap: 6px; min-width: 260px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.type-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.type-card.off { opacity: .55; }
.type-name { font: 700 17px/1.2 var(--display); color: var(--accent); }
.type-card.off .type-name { color: var(--muted); }
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.switch input { width: 32px; height: 18px; appearance: none; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }
@media (prefers-reduced-motion: reduce) { .switch input, .switch input::after { transition: none; } }
.label-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.imgbox { display: grid; gap: 8px; justify-items: center; padding: 14px; border: 1px dashed var(--line); border-radius: 10px; }
.imgbox img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; }
.money-in { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); padding-left: 10px; }
.money-in span { color: var(--muted); }
.panel .money-in input { border: 0; }
.row2.wide { grid-template-columns: 2fr 1fr; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tagbox { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 4px 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.panel .tagbox input { border: 0; padding: 4px; flex: 1; min-width: 80px; width: auto; }
.tagbox .chip button { padding: 0 2px; }
.vtable td { padding: 6px 8px; }
.panel .vtable input { padding: 6px 8px; min-width: 70px; }
@media (max-width: 700px) { .row3, .row4, .row2.wide { grid-template-columns: 1fr 1fr; } }

/* ---- accounts */
.brand small { font: 500 12px var(--body); color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.usermenu { display: flex; align-items: center; gap: 10px; }
.who-am-i { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.who-am-i b { font-size: 13px; }
.who-am-i small { font-size: 11.5px; color: var(--muted); }
.stat .big { font: 700 24px/1.1 var(--display); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .appbar .model, .who-am-i small { display: none; } }
.who-am-i .ph { font-size: 20px; color: var(--muted); }
.imp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 99px; background: #fff4d6; color: #7a4d00; border: 1px solid #f1d58a; font-size: 12.5px; white-space: nowrap; }
.imp-chip button { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; }
.imp-chip button:hover { background: rgb(122 77 0 / .12); }
body:not(.show-cost) #chatCost, body:not(.show-cost) .msg .cost, body:not(.show-cost) .trace-cost { display: none !important; }
#costToggle.on { color: #079455; border-color: #abefc6; background: #ecfdf3; }
