/* Ashlit Reply — app styles (Ashlit Labs colours: charcoal + ember). Mobile first; sidebar becomes a drawer under 900px. */
:root {
  --bg: #f5f2ec;
  --surface: #ffffff;
  --surface-2: #f8f6f2;
  --text: #1b1a19;
  --muted: #6b665e;
  --line: #e2ddd3;
  --brand: #c2410c;
  --brand-2: #e8571f;
  --brand-soft: #fdebe0;
  --on-brand: #ffffff;
  --ok: #047857;
  --ok-soft: #d1fae5;
  --err: #be123c;
  --err-soft: #ffe4e6;
  --shadow: 0 1px 2px rgba(27, 24, 48, .06), 0 4px 16px rgba(27, 24, 48, .05);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416;
    --surface: #1f2023;
    --surface-2: #26272b;
    --text: #eceae6;
    --muted: #8b8e94;
    --line: #2e3034;
    --brand: #ff6a2b;
    --brand-2: #ff7a40;
    --brand-soft: #3a2015;
    --on-brand: #141416;
    --ok: #34d399;
    --ok-soft: #10342a;
    --err: #fb7185;
    --err-soft: #3d1621;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: 22px; }
h3 { font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { width: 20px; height: 20px; flex: none; }

/* ---------- buttons & forms ---------- */
.btn, .btn-ghost, .btn-link {
  font: inherit; cursor: pointer; border: 0; display: inline-flex; align-items: center; gap: 6px;
  justify-content: center; text-decoration: none;
}
.btn {
  background: var(--brand); color: var(--on-brand); padding: 10px 16px; border-radius: 10px; font-weight: 600;
}
.btn:hover { background: var(--brand-2); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--muted); padding: 8px 10px; border-radius: 8px; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-link { background: none; color: var(--brand); padding: 4px 6px; }
.btn-link.danger, .danger { color: var(--err); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn-block { width: 100%; }

.form { display: grid; gap: 14px; margin-top: 16px; }
.form label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.form label > input, .form label > select, .form label > textarea, .form label > .copy-row { display: block; margin-top: 6px; }
.form label > .copy-row { display: flex; }
.form label > small.err { display: block; margin-top: 4px; }
input, select {
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 42px;
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
input[readonly] { background: var(--surface-2); color: var(--muted); }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.form-row label { min-width: 140px; }
.err { color: var(--err); font-weight: 500; }
form.inline { display: inline; }
.inline select { min-height: 34px; padding: 4px 8px; width: auto; font-size: 13px; }

/* ---------- flash ---------- */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-err { background: var(--err-soft); color: var(--err); }

/* ---------- auth pages ---------- */
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 40px 16px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 20px; }
.auth-card h2 { margin-bottom: 4px; }
.auth-card .center { margin-top: 16px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 18px; }

.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; color: var(--text); }
.logo-mark { width: 32px; height: 32px; display: block; flex: none; }
.logo-b { font-weight: 600; color: var(--muted); }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-accent { border-color: var(--brand); background: var(--brand-soft); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; }
.pill-soft { background: var(--surface-2); color: var(--muted); }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: 248px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh;
}
.side-top { padding: 0 6px 14px; }
.ws-name { font-size: 13px; color: var(--muted); padding: 0 8px 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-switch { padding: 0 2px 12px; }
.ws-switch select { min-height: 36px; font-size: 13px; }
.side nav { display: grid; gap: 2px; }
.side nav a, .nav-soon {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text); font-weight: 500;
}
.side nav a:hover { background: var(--surface-2); text-decoration: none; }
.side nav a.on { background: var(--brand-soft); color: var(--brand); }
.nav-soon { color: var(--muted); opacity: .7; cursor: default; }
.nav-soon em { margin-left: auto; font-style: normal; font-size: 11px; background: var(--surface-2); padding: 1px 7px; border-radius: 999px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.me-txt { display: grid; min-width: 0; }
.me-txt b, .me-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-txt small { color: var(--muted); font-size: 12px; }
.side-foot .btn-ghost { justify-content: flex-start; width: 100%; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 10px; padding: 18px 28px 0; }
.top h1 { font-size: 20px; }
.menu-btn { display: none; background: none; border: 0; color: var(--text); padding: 6px; border-radius: 8px; cursor: pointer; }
.content { padding: 18px 28px 40px; max-width: 1100px; width: 100%; }
.scrim { display: none; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
  color: #fff; font-weight: 700; font-size: 13px;
}
.avatar-empty { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line); }

/* ---------- dashboard ---------- */
.hello { margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat small { color: var(--muted); display: block; font-size: 12px; }
.stat b { font-size: 22px; }
.stat b .muted { font-size: 14px; font-weight: 500; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.grid-2 .card { margin-bottom: 0; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps li > div { flex: 1; min-width: 0; }
.step-dot {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); flex: none; display: grid; place-items: center;
}
.steps li.done .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.done b { color: var(--muted); text-decoration: line-through; }
.step-dot .ic { width: 14px; height: 14px; }
.limits { list-style: none; padding: 0; margin: 0; }
.limits li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.limits li:last-child { border-bottom: 0; }
.limits span { color: var(--muted); }

/* ---------- lists (team) ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list li .grow { display: grid; }
.list li small { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.list li.pending b { color: var(--muted); }
.copy-row { display: flex; gap: 8px; margin-top: 12px; }
.copy-row input { font-size: 13px; }
.leave { text-align: right; }

/* ---------- shared bits (phase 2) ---------- */
.empty { padding: 18px 4px; display: grid; gap: 4px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 5px; vertical-align: 1px; }
.dot-ok { background: var(--ok); }
.dot-err { background: var(--err); }
.badge { background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.mono { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; }
.check input { width: auto; min-height: 0; }
.page-pic { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.btn-fb { background: #1877f2; }
.btn-fb:hover { background: #166fe5; }
.connect-row { margin-top: 14px; }
.pick-list { display: grid; gap: 8px; }
.pick { display: flex !important; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; color: var(--text) !important; cursor: pointer; }
.pick input { width: 18px; height: 18px; min-height: 0; flex: none; }

/* ---------- inbox ---------- */
.inbox { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.inbox:not(.has-conv) { grid-template-columns: minmax(0, 560px); }
.conv-list { padding: 6px; max-height: calc(100vh - 120px); overflow: auto; margin: 0; }
.conv { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; color: var(--text); }
.conv:hover { background: var(--surface-2); text-decoration: none; }
.conv.on { background: var(--brand-soft); }
.conv .grow { display: grid; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; }
.conv-top small { white-space: nowrap; font-size: 11px; }
.conv-prev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.conv img.avatar { object-fit: cover; }
.thread { display: flex; flex-direction: column; padding: 0; height: calc(100vh - 120px); margin: 0; overflow: hidden; }
.thread-head { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; }
.thread-head .back { display: none; }
.msgs { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: grid; gap: 3px; max-width: 75%; }
.msg small { font-size: 11px; }
.msg-in { justify-self: start; align-self: flex-start; }
.msg-out { justify-self: end; align-self: flex-end; text-align: right; }
.bubble { padding: 9px 13px; border-radius: 16px; background: var(--surface-2); text-align: left; white-space: normal; word-wrap: break-word; }
.msg-out .bubble { background: var(--brand); color: #fff; }
.msg-img { max-width: 220px; border-radius: 12px; display: block; }
.reply { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.reply textarea { flex: 1; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; resize: vertical; min-height: 44px; }
.window-closed { padding: 14px 16px; border-top: 1px solid var(--line); }

/* ---------- setup wizard ---------- */
.form textarea {
  font: inherit; color: var(--text); background: var(--surface); width: 100%;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; resize: vertical;
}
.form textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.form label .muted, .form legend .muted { font-weight: 400; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stepper { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.stepper::-webkit-scrollbar { display: none; }
.list li .grow .pill { justify-self: start; margin: 3px 0; }
.stepper > a, .stepper > span {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600;
}
.stepper > a:hover { text-decoration: none; border-color: var(--brand); }
.stepper b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 12px; }
.stepper .done { color: var(--text); }
.stepper .done b { background: var(--ok); color: #fff; }
.stepper .on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.stepper .on b { background: var(--brand); color: #fff; }
.stepper > span { opacity: .55; }
.wiz-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; }
.checks, .faqs { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.checks legend, .faqs legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; padding: 0; }
.check.locked { opacity: .6; }
.faq { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.prod-list li { align-items: flex-start; }
.prod-form { margin-top: 0; }
.bulk { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.bulk summary { cursor: pointer; color: var(--brand); font-weight: 600; }
.brief {
  white-space: pre-wrap; word-wrap: break-word; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; font: 13px/1.6 ui-monospace, Consolas, monospace; max-height: 60vh; overflow: auto; margin: 14px 0;
}

/* ---------- bot switch + test chat ---------- */
.bot-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-left: 4px solid var(--muted); }
.bot-switch.is-on { border-left-color: var(--ok); }
.bot-switch.is-on h3 { color: var(--ok); }
.test-msgs { max-height: 420px; min-height: 120px; background: var(--surface-2); border-radius: 12px; margin: 12px 0; }
.test-msgs .msg-in .bubble { background: var(--surface); }
.test-reply { border-top: 0; padding: 0; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; margin-top: 2px; text-align: left; }
.tag-warn { background: #fef3c7; color: #92400e; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.mode { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.mode-bot { background: var(--brand-soft); color: var(--brand); }
.mode-human { background: #fef3c7; color: #92400e; }
.handoff-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; background: #fef3c7; color: #92400e; font-size: 13px; flex-wrap: wrap; }

/* ---------- orders (phase 5) ---------- */
.nav-badge { margin-left: auto; }
a.stat { color: var(--text); display: block; }
a.stat:hover { text-decoration: none; border-color: var(--brand); }
.orders-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.tabs a:hover { text-decoration: none; border-color: var(--brand); }
.tabs a.on { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.tabs em { font-style: normal; opacity: .7; margin-left: 2px; }
.search { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.search input { flex: 1; }
.olist { padding: 6px; }
.orow { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 10px; color: var(--text); border-bottom: 1px solid var(--line); }
.orow:last-child { border-bottom: 0; }
.orow:hover { background: var(--surface-2); text-decoration: none; }
.orow .grow { display: grid; }
.ono { font-weight: 700; color: var(--muted); min-width: 40px; }
.oitems { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oright { display: grid; justify-items: end; gap: 2px; text-align: right; }
.oright small { font-size: 11px; white-space: nowrap; }
.ost { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; vertical-align: middle; }
.ost-new { background: var(--brand-soft); color: var(--brand); }
.ost-confirmed { background: #dbeafe; color: #1d4ed8; }
.ost-shipped { background: #fef3c7; color: #92400e; }
.ost-delivered { background: var(--ok-soft); color: var(--ok); }
.ost-cancelled { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
@media (prefers-color-scheme: dark) {
  .ost-confirmed { background: #1e2a4a; color: #93c5fd; }
  .ost-shipped, .tag-warn, .mode-human, .handoff-bar { background: #3a2e10; color: #fcd34d; }
}
.order-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.order-head h2 { display: flex; align-items: center; gap: 10px; }
.order-total { font-size: 24px; }
.mt { margin-top: 18px; }
.addr { text-align: right; font-weight: 500; max-width: 65%; }
.otable { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
.otable td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.otable .num { text-align: right; white-space: nowrap; padding-left: 10px; }
.otable .sub td { color: var(--muted); }
.otable .tot td { font-weight: 700; border-bottom: 0; }
.olog { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; font-size: 13px; }
.olog li { display: grid; gap: 1px; }
.items-edit { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.items-edit legend { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; padding: 0; }
.item-row { display: grid; grid-template-columns: 2fr 1.2fr 70px 1fr; gap: 8px; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.pager { display: flex; justify-content: space-between; }
a.tag:hover { text-decoration: none; filter: brightness(.95); }
@media (max-width: 560px) {
  .item-row { grid-template-columns: 1fr 1fr; }
  .orow { flex-wrap: wrap; }
  .oright { grid-auto-flow: column; align-items: center; justify-content: start; gap: 8px; width: 100%; padding-left: 52px; }
  .addr { max-width: 100%; }
  .search { flex-wrap: wrap; }
  .search input { flex-basis: 100%; }
}

/* ---------- inbox v2 (phase 6) ---------- */
.badge-warn { background: #d97706; }
.content:has(.inbox.has-conv) { max-width: 1500px; }
.inbox.has-conv { grid-template-columns: 300px minmax(0, 1fr) 270px; }
.inbox-tabs { padding: 4px 4px 8px; flex-wrap: wrap; overflow: visible; }
.inbox-tabs a { padding: 5px 10px; font-size: 12px; }
.inbox-tabs a.hot em { background: #d97706; color: #fff; opacity: 1; padding: 0 6px; border-radius: 999px; }
.conv-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.conv-tags:empty { display: none; }
.cpanel { margin: 0; padding: 14px; display: grid; gap: 12px; align-content: start; max-height: calc(100vh - 120px); overflow: auto; }
.cp-who { display: flex; gap: 10px; align-items: center; }
.cp-who > span { display: grid; min-width: 0; }
.cp-who small { font-size: 12px; }
.cp-who img.avatar { object-fit: cover; }
.cp-row { display: grid; gap: 4px; }
.cp-row select { min-height: 36px; font-size: 14px; }
.cp-sec { border-top: 1px solid var(--line); padding-top: 10px; }
.cp-sec summary { font-weight: 700; font-size: 14px; }
.cp-sec .form { margin-top: 10px; gap: 10px; }
.cp-order { display: flex; align-items: center; gap: 8px; padding: 6px 0; color: var(--text); font-size: 13px; }
.cp-order b { margin-left: auto; }
.cp-order:hover { text-decoration: none; color: var(--brand); }
@media (max-width: 1200px) {
  .inbox.has-conv { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox.has-conv .cpanel { grid-column: 2; max-height: none; }
}

/* ---------- comments (phase 7) ---------- */
.tabs a.hot em { background: #d97706; color: #fff; opacity: 1; padding: 0 6px; border-radius: 999px; }
.klist { padding: 6px 16px; }
.kitem { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.kitem:last-child { border-bottom: 0; }
.khead { display: flex; align-items: center; gap: 10px; }
.khead .grow { display: grid; }
.kpost { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kmsg { padding-left: 46px; }
.kreply { margin-left: 46px; padding: 8px 12px; background: var(--surface-2); border-radius: 10px; font-size: 14px; border-left: 3px solid var(--brand); }
.kdm { border-left-color: #1877f2; }
.kact { padding-left: 40px; display: flex; flex-wrap: wrap; gap: 2px; font-size: 13px; }
.kreply-form { margin-left: 46px; padding: 0; border-top: 0; }
.ost-failed { background: var(--err-soft); color: var(--err); }
@media (max-width: 560px) {
  .kmsg, .kreply, .kreply-form { margin-left: 0; padding-left: 0; }
  .kreply { padding-left: 12px; }
  .kact { padding-left: 0; }
}

/* ---------- plans & billing (phase 8) ---------- */
.pill-warn { background: #fef3c7; color: #92400e; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.plan-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 8px; align-content: start; color: var(--text); box-shadow: var(--shadow); }
.plan-card:hover { text-decoration: none; border-color: var(--brand); }
.plan-card.chosen { border: 2px solid var(--brand); }
.plan-card.cur { background: var(--brand-soft); }
.plan-card ul { list-style: none; padding: 0; margin: 0; font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
.plan-card .btn, .plan-card .pill { justify-self: start; }
.plan-price { font-size: 22px; font-weight: 800; }
.card-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin: 12px 0; }
.card-plan { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 6px; align-content: start; }
.card-plan.chosen { border: 2px solid var(--brand); }
.card-plan .btn { justify-self: start; margin-top: 4px; }
.card-plan .btn-ghost { border: 1px solid var(--line); color: var(--text); }
.plan-price small { font-size: 13px; font-weight: 500; color: var(--muted); }
.pay-steps { margin: 4px 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.pay-amount { font-size: 18px; color: var(--brand); }
.wallet { display: inline-block; margin: 2px 10px 2px 0; padding: 2px 8px; background: var(--surface-2); border-radius: 8px; }
.pay-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line); }
.reject-form { display: flex; gap: 6px; align-items: center; }
.reject-form input { min-height: 34px; padding: 4px 8px; font-size: 13px; width: 170px; }
.table-wrap { overflow-x: auto; }
.admin-table th { text-align: left; font-size: 12px; color: var(--muted); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
.admin-table td { padding-right: 8px; }
.plan-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.plan-form select, .plan-form input { min-height: 34px; padding: 4px 8px; font-size: 13px; width: auto; }
@media (prefers-color-scheme: dark) { .pill-warn { background: #3a2e10; color: #fcd34d; } }

/* ---------- landing page (phase 9) ---------- */
.land { background: var(--bg); }
.land-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; max-width: 1140px; margin: 0 auto; flex-wrap: wrap; }
.land-logo:hover { text-decoration: none; }
.land-top nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.land-top nav a:not(.btn) { color: var(--text); font-weight: 500; font-size: 14px; }
.hero { max-width: 1140px; margin: 0 auto; padding: 40px 24px 56px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero h1 { font-size: 50px; line-height: 1.08; letter-spacing: -.03em; margin: 14px 0 16px; }
.grad { background: linear-gradient(135deg, var(--brand), #ffa25c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: 18px; color: var(--muted); margin-bottom: 10px; max-width: 560px; }
.lead.bn { color: var(--text); font-weight: 600; }
.hero-cta { display: flex; gap: 10px; align-items: center; margin: 22px 0 10px; flex-wrap: wrap; }
.hero-cta .btn { padding: 13px 22px; font-size: 16px; }
.phone { background: var(--surface); border: 1px solid var(--line); border-radius: 28px; box-shadow: 0 20px 60px rgba(20, 20, 22, .18); overflow: hidden; max-width: 380px; justify-self: center; width: 100%; }
.phone-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.phone-head small { color: var(--ok); margin-left: auto; font-size: 12px; }
.phone-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.pm { padding: 9px 13px; border-radius: 18px; max-width: 85%; }
.pm.in { background: var(--surface-2); align-self: flex-start; border-bottom-left-radius: 6px; }
.pm.out { background: var(--brand); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.pm-tag { align-self: center; font-size: 12px; font-weight: 600; background: var(--ok-soft); color: var(--ok); padding: 4px 10px; border-radius: 999px; margin-top: 4px; }
.land-sec { max-width: 1140px; margin: 0 auto; padding: 48px 24px; }
.land-sec h2, .land-cta h2 { font-size: 32px; letter-spacing: -.02em; text-align: center; margin-bottom: 26px; }
.land-sec .center { margin: -14px 0 22px; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.feat b { font-size: 16px; display: block; margin-bottom: 6px; }
.feat p { color: var(--muted); font-size: 14px; }
.how { list-style: none; counter-reset: how; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.how li { counter-increment: how; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; position: relative; padding-top: 58px; }
.how li::before { content: counter(how); position: absolute; top: 18px; left: 20px; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.how p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.land-plans .plan-card { gap: 10px; }
.land-plans .btn, .land-plans .btn-ghost { justify-self: stretch; border: 1px solid var(--line); }
.faq-list { max-width: 760px; margin: 0 auto; display: grid; gap: 10px; }
.faq-list details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.faq-list summary { font-weight: 600; cursor: pointer; }
.faq-list details p { color: var(--muted); margin-top: 8px; font-size: 14px; }
.land-cta { text-align: center; padding: 56px 24px; background: linear-gradient(135deg, #26272b, #141416); color: #fff; }
.land-cta h2 { color: #fff; }
.land-cta .btn { background: #fff; color: var(--brand); padding: 13px 24px; font-size: 16px; }
.land-foot { max-width: 1140px; margin: 0 auto; padding: 24px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.land-foot nav { display: flex; gap: 16px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 20px; gap: 32px; }
  .hero h1 { font-size: 36px; }
  .feat-grid, .how { grid-template-columns: 1fr; }
  .land-top nav a:not(.btn):not([href="login.php"]) { display: none; }
  .land-top, .hero, .land-sec, .land-foot { padding-left: 16px; padding-right: 16px; }
  .land-sec h2, .land-cta h2 { font-size: 26px; }
}

/* ---------- admin area (separate login) ---------- */
.adm .side { background: #111827; border-right-color: #1f2937; }
.adm .side .logo, .adm .side nav a, .adm .me-txt b { color: #f3f4f6; }
.adm .side nav a:hover { background: #1f2937; }
.adm .side nav a.on { background: #3a2015; color: #fff; }
.adm .me-txt small, .adm .side-foot .btn-ghost { color: #9ca3af; }
.adm .side-foot { border-top-color: #1f2937; }
.adm-badge { font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: #f59e0b; color: #111827; padding: 2px 8px; border-radius: 6px; vertical-align: middle; }
.adm-auth { background: #111827; }
.adm-auth .auth-logo .logo { color: #f3f4f6; }
.stats-4 { grid-template-columns: repeat(4, 1fr); }
.stat b .muted { font-size: 12px; }
.attn a { font-weight: 700; }
.support-bar { background: #f59e0b; color: #111827; padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.support-bar .btn-link { color: #111827; text-decoration: underline; font-weight: 700; }
.btn-danger { background: var(--err); }
.btn-danger:hover { background: #9f1239; }
.danger-zone { border-color: var(--err); }
.danger-zone h3 { color: var(--err); }
.urow { flex-wrap: wrap; }
.udel { flex-basis: 100%; }
.udel[open] { padding: 8px 0; }
@media (max-width: 900px) { .stats-4 { grid-template-columns: 1fr 1fr; } }

/* ---------- public docs ---------- */
.doc-wrap { max-width: 720px; margin: 0 auto; padding: 32px 16px 60px; }
.doc-wrap h1 { font-size: 28px; margin: 18px 0 4px; }
.doc-wrap h2 { font-size: 18px; margin: 26px 0 8px; }
.doc-wrap p, .doc-wrap li { line-height: 1.65; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .side {
    position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s ease;
  }
  body.nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 20; }
  .menu-btn { display: inline-flex; }
  .top { padding: 12px 16px 0; }
  .content { padding: 14px 16px 32px; }
  .grid-2 { grid-template-columns: 1fr; }
  .inbox, .inbox:not(.has-conv), .inbox.has-conv { grid-template-columns: 1fr; }
 .inbox.has-conv .cpanel { grid-column: auto; }
  .inbox.has-conv .conv-list { display: none; }
  .thread-head .back { display: inline-flex; }
  .thread { height: calc(100vh - 90px); }
  .msg { max-width: 88%; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: span 2; }
  .card { padding: 16px; }
  .form-row label, .form-row .btn { width: 100%; }
  .row-2 { grid-template-columns: 1fr; }
}

/* Bot setup: which Page's brain is being edited */
.brain-pick { display: grid; gap: 8px; }
.brain-pick label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 600; }
.brain-pick select { max-width: 100%; }
.brain-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* =====================================================================
   v11 — the "complete" release: nav groups, KPIs, charts, products, customers,
   board, couriers, richer inbox, settings tabs, PWA bits.
   ===================================================================== */
.nav-group { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 4px; opacity: .8; }
.side nav { overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.side { overflow: hidden; }
.lang-switch { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.lang-switch button { flex: 1; font: inherit; font-size: 12px; font-weight: 600; border: 0; background: none; color: var(--muted); padding: 5px 6px; border-radius: 8px; cursor: pointer; }
.lang-switch button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.install-btn { color: var(--brand) !important; }
.top-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.top-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.top-pill .ic { width: 15px; height: 15px; }
.top-pill.warn { background: #fef3c7; color: #92400e; }
.top-pill:hover { text-decoration: none; filter: brightness(.97); }
.card h3 .ic { width: 18px; height: 18px; vertical-align: -3px; color: var(--brand); }
.btn .ic, .btn-ghost .ic, .btn-link .ic { width: 17px; height: 17px; }
.right { text-align: right; } .block { display: block; } .ellip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.grid-3 .card { margin-bottom: 0; }
.lead.small { font-size: 14px; margin-bottom: 14px; max-width: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-tabs { margin-bottom: 14px; }
.page-head .page-tabs { margin-bottom: 0; }
.page-tabs a { display: inline-flex; align-items: center; gap: 6px; }
.page-tabs a .ic { width: 16px; height: 16px; }
.page-pick select { min-height: 34px; width: auto; margin-left: 6px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { margin-bottom: 0; }
.search select, .filters select { width: auto; min-height: 40px; }
.filters { flex-wrap: wrap; }
.filters label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.filters input[type=date] { width: auto; min-height: 40px; padding: 6px 8px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg label span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg a .ic { width: 16px; height: 16px; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.on, .seg input:checked + span { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.seg label { display: inline-flex !important; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; letter-spacing: .03em; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl tr.dim td { opacity: .6; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #141416; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 60; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); transition: opacity .4s, transform .4s; max-width: calc(100vw - 32px); }
.toast.out { opacity: 0; transform: translate(-50%, 10px); }

/* KPIs + charts */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 2px; color: var(--text); }
a.kpi:hover { text-decoration: none; border-color: var(--brand); }
.kpi small { color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi b { font-size: 24px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi.kpi-main { background: linear-gradient(135deg, #26272b, #141416); border-color: #2e3034; color: #fff; }
.kpi.kpi-main small, .kpi.kpi-main .delta { color: #b9b6b0; }
.kpi.kpi-main b { color: #ffb37f; }
.delta { font-size: 12px; font-weight: 600; color: var(--muted); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--err); }
.kpi.kpi-main .delta.up { color: #6ee7b7; }
.kpi.kpi-main .delta.down { color: #fda4af; }
.chart-wrap { width: 100%; overflow: hidden; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .base { stroke: var(--muted); stroke-width: 1; opacity: .5; }
svg.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
svg.chart .bar { fill: var(--brand); }
svg.chart .hit { fill: transparent; cursor: crosshair; }
svg.chart .hit.on { fill: var(--brand); fill-opacity: .08; }
.chart-tip { position: fixed; z-index: 70; pointer-events: none; background: #141416; color: #fff; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 8px; white-space: nowrap; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 110px; }
.spk { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.spk i { display: block; width: 100%; max-width: 30px; background: var(--brand); border-radius: 4px 4px 0 0; }
.spk small { font-size: 10px; color: var(--muted); }
.hbar { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 0; font-size: 14px; }
.hbar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-t { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar-t span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.hbar-v { font-weight: 700; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.split-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: #f59e0b; margin: 6px 0 10px; }
.split-bar .sb-bot { background: var(--brand); border-right: 2px solid var(--surface); }
.progress.warn span { background: #d97706; }
.usage { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.usage span { color: var(--muted); }
.needs-card { border-left: 4px solid #d97706; }
.needs-card .conv { padding: 8px; }

/* Products */
.prod-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; background: linear-gradient(135deg, var(--brand-soft), var(--surface)); border-color: var(--brand); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.pcard.is-out .pimg img { filter: grayscale(.85); opacity: .65; }
.pimg { aspect-ratio: 1; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.pimg img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.pcard:hover .pimg img { transform: scale(1.04); }
.pimg .ph .ic, .photo-drop .ph .ic { width: 34px; height: 34px; color: var(--muted); }
.pbody { padding: 10px 12px 12px; display: grid; gap: 4px; }
.pname { font-weight: 600; color: var(--text); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pmeta { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.pmeta small { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pstock { margin-top: 2px; }
.stock-toggle { font: inherit; font-size: 11px; font-weight: 700; border: 0; border-radius: 999px; padding: 3px 9px; cursor: pointer; }
.stock-toggle.in { background: var(--ok-soft); color: var(--ok); }
.stock-toggle.out { background: var(--err-soft); color: var(--err); }
.prod-editor { grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: 20px; }
.form-fields { display: grid; gap: 14px; }
.photo-pick { display: grid; gap: 8px; }
.photo-drop { position: relative; aspect-ratio: 1; border: 2px dashed var(--line); border-radius: var(--radius); display: grid !important; place-items: center; overflow: hidden; cursor: pointer; background: var(--surface-2); }
.photo-drop:hover { border-color: var(--brand); }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo-drop .ph { display: grid; place-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.photo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Customers */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); font-family: inherit; cursor: default; }
a.chip, button.chip { cursor: pointer; }
a.chip:hover, button.chip:hover { text-decoration: none; border-color: var(--brand); }
.chip em { font-style: normal; color: var(--muted); }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.chip.off { opacity: .7; }
.chip-good { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip-bad { background: var(--err-soft); color: var(--err); border-color: transparent; }
.filter-chips { margin-bottom: 12px; }
.clist { padding: 6px; }
.crow { display: flex; align-items: center; gap: 12px; padding: 12px 10px; border-radius: 10px; color: var(--text); border-bottom: 1px solid var(--line); }
.crow:last-child { border-bottom: 0; }
.crow:hover { background: var(--surface-2); text-decoration: none; }
.crow img.avatar { object-fit: cover; }
.crow .chip { font-size: 11px; padding: 1px 8px; margin-left: 4px; }
.cust-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cust-head h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cust-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-lg { width: 64px; height: 64px; font-size: 20px; object-fit: cover; }
.risk { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.risk b { font-size: 26px; }
.risk.good { background: var(--ok-soft); color: var(--ok); }
.risk.mid { background: #fef3c7; color: #92400e; }
.risk.bad { background: var(--err-soft); color: var(--err); }

/* Orders: board, bulk, courier, tracker */
.view-seg { margin-right: 4px; }
.sum-line { margin: -4px 0 12px; }
.bulk-bar { position: sticky; top: 8px; z-index: 15; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #141416; color: #fff; padding: 10px 14px; border-radius: 12px; margin-bottom: 12px; box-shadow: 0 8px 26px rgba(0, 0, 0, .2); }
.bulk-bar[hidden] { display: none; }
.bulk-bar select { width: auto; min-height: 36px; }
.bulk-bar .btn-link { color: #ffb37f; }
.orow-sel { padding: 0; gap: 0; }
.osel { padding: 12px 4px 12px 10px; display: flex; align-items: center; }
.osel input, .bsel input, .sel-all input { width: 18px; height: 18px; min-height: 0; }
.orow-link { display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 6px; flex: 1; min-width: 0; color: var(--text); }
.orow-link:hover { text-decoration: none; }
.orow-link .grow { display: grid; }
.sel-all { display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.content:has(.board) { max-width: 1500px; }
.bcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-height: 200px; transition: background .15s, border-color .15s; }
.bcol.over { background: var(--brand-soft); border-color: var(--brand); }
.bcol header { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 10px; }
.bcol header em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--muted); }
.bdrop { display: grid; gap: 8px; min-height: 60px; }
.bcard { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); cursor: grab; }
.bcard.dragging { opacity: .5; }
.bcard:hover { border-color: var(--brand); }
.bbody { display: grid; gap: 2px; padding: 10px 12px 10px 34px; color: var(--text); font-size: 13px; }
.bbody:hover { text-decoration: none; }
.btop { display: flex; justify-content: space-between; }
.bsel { position: absolute; left: 10px; top: 11px; }
.bempty { padding: 20px 0; }
.track-steps { list-style: none; display: flex; padding: 0; margin: 12px 0 0; max-width: 520px; }
.track-steps li { flex: 1; position: relative; font-size: 12px; color: var(--muted); padding-top: 18px; text-align: center; }
.track-steps li span { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); z-index: 1; }
.track-steps li::before { content: ""; position: absolute; top: 5px; left: -50%; right: 50%; height: 2px; background: var(--line); }
.track-steps li:first-child::before { display: none; }
.track-steps li.done { color: var(--text); font-weight: 600; }
.track-steps li.done span { background: var(--ok); border-color: var(--ok); }
.track-steps li.done::before { background: var(--ok); }
.courier-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; margin: 8px 0; }
.courier-book { margin-top: 8px; }
.courier-card.is-on { border-color: var(--ok); }
.courier-card .form { gap: 10px; margin-top: 8px; }
.push-card { border-left: 4px solid var(--brand); }

/* Inbox extras */
.inbox-search { display: flex; align-items: center; gap: 6px; margin: 4px 4px 8px; background: var(--surface-2); border-radius: 10px; padding: 0 10px; }
.inbox-search .ic { width: 16px; height: 16px; color: var(--muted); }
.inbox-search input { border: 0; background: transparent; min-height: 38px; padding: 6px 0; }
.inbox-search input:focus { outline: 0; }
.conv.unread b { font-weight: 800; }
.conv.unread .conv-prev { color: var(--text); font-weight: 600; }
.mini-tag { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.mini-tag.bad { background: var(--err-soft); color: var(--err); border-color: transparent; }
.mini-tag.stage-ordering { background: #fef3c7; color: #92400e; border-color: transparent; }
.mini-tag.stage-ordered { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag-ai { background: var(--surface-2); color: var(--muted); font-weight: 500; max-width: 340px; }
.msg-audio { max-width: 260px; height: 36px; }
.qr-row { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.qr { font-size: 12px; font-weight: 600; color: var(--brand); border: 1px solid var(--brand); border-radius: 999px; padding: 2px 10px; background: var(--surface); }
.card-strip { display: flex; gap: 8px; overflow-x: auto; max-width: 420px; padding-bottom: 4px; }
.mini-card { flex: none; width: 120px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: grid; text-align: left; font-size: 12px; color: var(--text); }
.mini-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.mini-card b, .mini-card small { padding: 0 8px; }
.mini-card b { padding-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-card em { font-style: normal; color: var(--brand); font-weight: 700; border-top: 1px solid var(--line); padding: 6px 8px; margin-top: 4px; text-align: center; }
.reply-rich { flex-direction: column; align-items: stretch; gap: 6px; }
.reply-tools { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.reply-tools .btn-ghost { padding: 6px 8px; }
.reply-row { display: flex; gap: 8px; align-items: flex-end; }
.suggest-btn { color: var(--brand) !important; font-weight: 600; }
.pop { position: relative; }
.pop-body { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 25; width: 300px; max-height: 320px; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 34px rgba(0, 0, 0, .18); padding: 6px; display: grid; }
.pop-item { font: inherit; text-align: left; background: none; border: 0; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; display: grid; gap: 1px; }
.pop-item:hover { background: var(--surface-2); text-decoration: none; }
.pop-item small { font-size: 12px; }
.dlg { border: 0; border-radius: 18px; padding: 20px; max-width: 640px; width: calc(100vw - 32px); background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.dlg::backdrop { background: rgba(10, 10, 12, .5); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; max-height: 52vh; overflow: auto; }
.pick-grid .pick { flex-direction: column; align-items: stretch; padding: 6px; gap: 6px; position: relative; font-size: 12px; font-weight: 600; }
.pick-grid .pick img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.pick-grid .pick input { position: absolute; top: 10px; left: 10px; }
.pick-grid .pick span { display: grid; }
.pick-grid .pick small { color: var(--muted); font-weight: 500; }
.pick-grid .pick:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.cp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; background: var(--surface-2); border-radius: 12px; padding: 10px 6px; }
.cp-stats span { display: grid; }
.cp-stats b { font-size: 15px; }
.cp-stats small { font-size: 11px; color: var(--muted); }
.cp-stats .ic { width: 18px; height: 18px; }
.cp-block { border-top: 1px solid var(--line); padding-top: 8px; }

/* Wizard extras */
.day-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.day-pick label { display: inline-flex !important; cursor: pointer; position: relative; }
.day-pick input { position: absolute; opacity: 0; pointer-events: none; }
.day-pick span { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--muted); background: var(--surface); }
.day-pick input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.day-pick input:focus-visible + span { outline: 2px solid var(--brand); }
.inline-select { display: inline-block !important; width: auto !important; min-height: 30px !important; padding: 2px 6px !important; margin: 0 4px; }
.hours-set { margin-top: 4px; }
.lang-big { display: flex; gap: 8px; }

@media (prefers-color-scheme: dark) {
  .top-pill.warn, .risk.mid, .mini-tag.stage-ordering { background: #3a2e10; color: #fcd34d; }
  .kpi.kpi-main { background: linear-gradient(135deg, #2a1a12, #1f2023); border-color: #3a2015; }
  .bulk-bar, .toast, .chart-tip { background: #000; }
  .split-bar { background: #b45309; }
}
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .side { overflow-y: auto; }
  .prod-editor { grid-template-columns: 1fr; }
  .photo-pick { max-width: 260px; }
  .board { grid-template-columns: repeat(5, minmax(240px, 80vw)); scroll-snap-type: x mandatory; }
  .bcol { scroll-snap-align: start; }
  .top-actions { display: none; }
  .row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .stats.stats-4 .stat:last-child { grid-column: auto; }
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .kpi { grid-column: span 2; padding: 12px; min-width: 0; }
  .kpis:not(:has(> .kpi:nth-child(4))) .kpi { grid-column: span 3; }
  .kpi.kpi-main { grid-column: 1 / -1; padding: 14px 16px; }
  .kpi b { font-size: 19px; }
  .kpi small { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kpi .delta { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kpi.kpi-main b { font-size: 26px; }
  .kpis:has(> .kpi:nth-child(6)) .kpi { grid-column: span 3; }
  .kpis:has(> .kpi:nth-child(6)) .kpi.kpi-main b { font-size: 19px; }
  .pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .row-3 { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: minmax(0, 1fr) auto; }
  .hbar-t { grid-column: 1 / -1; order: 3; }
  .crow { flex-wrap: wrap; }
  .crow .oright { width: 100%; padding-left: 48px; grid-auto-flow: column; justify-content: start; gap: 8px; }
  .orow-link { flex-wrap: wrap; }
  .orow-link .oright { grid-auto-flow: column; align-items: center; justify-content: start; gap: 8px; width: 100%; padding-left: 52px; }
  .filters label { flex: 1 1 45%; }
  .filters input[type=date] { flex: 1; }
  .reply-tools .suggest-btn { margin-left: auto; }
}
@media print { .side, .top, .bulk-bar { display: none !important; } }

/* v12: WhatsApp channel */
.btn-wa { background: #25d366; color: #fff; display: inline-flex; align-items: center; gap: .4rem; }
.btn-wa:hover { background: #1ebe5b; }
.avatar-wa { background: #25d366; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.pill-wa { background: #25d366; color: #fff; }
.wa-connect { display: flex; flex-wrap: wrap; gap: .5rem; }
.ch-wa { display: inline-flex; vertical-align: -3px; color: #25d366; margin-right: .2rem; }
.ch-wa svg { width: 14px; height: 14px; }
.pay-other > summary { font-weight: 600; color: var(--brand); padding: 2px 0; }
.pay-other > summary::after { content: " ▾"; }
.pay-other[open] > summary { margin-bottom: 10px; }
.cur-switch { color: var(--muted); font-size: 13px; }
.cur-switch a { color: var(--brand); }
.geo-bar { text-align: center; font-size: 13px; padding: 8px 16px; background: var(--surface, #1c1c20); color: var(--muted); border-bottom: 1px solid var(--line, rgba(255,255,255,.08)); }
.geo-bar a { color: var(--brand); font-weight: 600; }

/* Referral card (billing) */
.ref-card { position: relative; overflow: hidden; padding: 0 0 18px; }
.ref-card > *:not(.ref-hero) { margin-left: 20px; margin-right: 20px; }
.ref-hero { display: flex; gap: 16px; align-items: flex-start; padding: 22px 20px 20px; margin-bottom: 18px;
  background: radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.18) 0, transparent 55%), linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%); color: #fff; }
.ref-hero h3 { margin: 2px 0 6px; font-size: 21px; line-height: 1.25; color: #fff; letter-spacing: -.01em; }
.ref-hero p { margin: 0; font-size: 14px; color: rgba(255,255,255,.9); line-height: 1.5; }
.ref-gift { flex: 0 0 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); }
.ref-eyebrow { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.85); }
.ref-steps { list-style: none; padding: 0; margin-top: 0; margin-bottom: 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ref-steps li { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.ref-steps span { flex: 0 0 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.ref-steps b { display: block; font-size: 13.5px; line-height: 1.3; }
.ref-steps small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.ref-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.ref-link { display: flex; align-items: center; gap: 6px; padding: 5px 5px 5px 14px; border: 1.5px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); border-radius: 12px; background: var(--surface-2); }
.ref-link input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 0; font-size: 14px; color: var(--text); box-shadow: none; outline: none; }
.ref-link .btn { flex: 0 0 auto; min-width: 84px; }
.ref-link .btn.is-done { background: var(--ok); border-color: var(--ok); color: #fff; }
.ref-wa { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; padding: 11px 14px; border-radius: 12px; background: #1fa855; color: #fff; font-weight: 600; font-size: 14px; text-decoration: none; transition: filter .15s; }
.ref-wa:hover { filter: brightness(.95); color: #fff; }
.ref-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.ref-stats div { text-align: center; padding: 12px 8px; border-radius: 12px; border: 1px solid var(--line); }
.ref-stats b { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ref-stats small { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.ref-stats .ref-stat-hl { background: var(--brand-soft); border-color: transparent; }
.ref-stats .ref-stat-hl b { color: var(--brand); }
.ref-note { margin-top: 12px; margin-bottom: 0; }
@media (max-width: 640px) {
  .ref-steps { grid-template-columns: 1fr; }
  .ref-hero h3 { font-size: 19px; }
}

/* Referral banner (home) */
.ref-banner { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; padding: 14px 44px 14px 16px; position: relative; border-radius: var(--radius); text-decoration: none; color: #fff;
  background: radial-gradient(120% 160% at 100% 0%, rgba(255,255,255,.2) 0, transparent 55%), linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%); box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--brand) 70%, transparent); transition: transform .15s, box-shadow .15s; }
.ref-banner[hidden] { display: none; }
.ref-banner:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--brand) 80%, transparent); }
.ref-banner b { display: block; font-size: 15.5px; line-height: 1.3; }
.ref-banner small { display: block; font-size: 13px; color: rgba(255,255,255,.88); margin-top: 2px; line-height: 1.4; }
.ref-banner-ico { flex: 0 0 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); animation: ref-wiggle 3.5s ease-in-out infinite; }
.ref-banner-cta { flex: 0 0 auto; padding: 8px 14px; border-radius: 10px; background: #fff; color: var(--brand); font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.ref-banner-x { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: rgba(255,255,255,.8); font-size: 20px; line-height: 1; cursor: pointer; padding: 0; }
.ref-banner-x:hover { background: rgba(255,255,255,.15); color: #fff; }
@keyframes ref-wiggle { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(-10deg); } 92% { transform: rotate(10deg); } 95% { transform: rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) { .ref-banner-ico { animation: none; } }
@media (max-width: 560px) { .ref-banner { flex-wrap: wrap; } .ref-banner .grow { flex: 1 1 calc(100% - 60px); } .ref-banner-cta { flex: 1 1 100%; text-align: center; } }
