/* Order Desk — light SaaS look. Mist background, white surfaces, indigo brand.
   Desktop: sidebar. Tablet/phone: top bar + bottom navigation. Every order is a waybill with a COD stub. */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --sunk: #f7f8fc;
  --hover: #f1f3fa;
  --ink: #1d2340;
  --ink-2: #5a6285;
  --ink-3: #8a91ad;
  --line: #e6e9f2;
  --line-2: #d6dae7;
  --brand: #4f46e5;
  --brand-2: #7c5cff;
  --brand-ink: #ffffff;
  --brand-soft: #eef0ff;
  --brand-line: #c9cdfb;
  --ok: #0e9f6e;
  --ok-soft: #e3f7ee;
  --warn: #b25e00;
  --warn-soft: #fff4de;
  --bad: #e0344f;
  --bad-soft: #fdebee;
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.22);
  --sh-1: 0 1px 2px rgba(23, 31, 74, 0.05);
  --sh-2: 0 1px 2px rgba(23, 31, 74, 0.04), 0 8px 24px rgba(23, 31, 74, 0.06);
  --sh-3: 0 18px 50px rgba(23, 31, 74, 0.18);
  --r-xl: 18px;
  --r-lg: 14px;
  --r: 11px;
  --r-sm: 8px;
  --side: 252px;
  --font: 'Anek Bangla', 'Noto Sans Bengali', 'Hind Siliguri', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

/* courier colours */
.c-steadfast { --c: #0f9488; }
.c-pathao { --c: #e2231a; }
.c-redx { --c: #ea580c; }
.c-carrybee { --c: #d29a00; }
.c-paperfly { --c: #7c3aed; }
.c-manual { --c: #7c849f; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; }
body { background: radial-gradient(1100px 520px at 78% -12%, #ebe9ff 0%, rgba(235, 233, 255, 0) 62%), radial-gradient(800px 420px at -10% 110%, #e7f6f1 0%, rgba(231, 246, 241, 0) 60%), var(--bg); background-attachment: fixed; }
body { -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden; }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.22; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.45rem, 1.1rem + 1.2vw, 1.9rem); font-weight: 700; }
h2 { font-size: 1.16rem; }
h3 { font-size: 1.02rem; }
p { margin: 0; }
svg { flex: none; }
.muted { color: var(--ink-2); }
.small { font-size: 0.875rem; }
.grow { flex: 1; }
.err-text { color: var(--bad); min-height: 1.3em; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--ring); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------------- form controls ---------------- */
input, select, textarea {
  font: inherit; font-size: 0.97rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 11px; width: 100%; min-width: 0;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input, select { min-height: 40px; }
input:hover, select:hover, textarea:hover { border-color: #c3c8da; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m6 8 4 4 4-4' fill='none' stroke='%238a91ad' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
select:disabled { opacity: 0.55; cursor: not-allowed; }
textarea { resize: vertical; line-height: 1.6; }
input[type='checkbox'] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); margin: 0; flex: none; cursor: pointer; }
input[type='number'] { -moz-appearance: textfield; }
input[type='number']::-webkit-outer-spin-button, input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.btn {
  font: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; border-radius: 10px; padding: 9px 16px; min-height: 40px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-shadow: var(--sh-1);
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.06s;
}
.btn:hover { background: var(--hover); border-color: #c3c8da; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #5d55f0, var(--brand)); color: var(--brand-ink); border-color: #463dd9; box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25), 0 6px 16px rgba(79, 70, 229, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn.primary:hover { background: linear-gradient(180deg, #5148e6, #4338ca); border-color: #4338ca; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 0.875rem; border-radius: 9px; }
.btn.lg { padding: 11px 22px; min-height: 46px; font-size: 1.02rem; border-radius: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.busy::before { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 1rem; line-height: 1; width: 32px; height: 32px; border-radius: 8px; display: inline-grid; place-items: center; }
.icon-btn:hover { color: var(--bad); background: var(--bad-soft); }
.link-btn { border: 0; background: none; padding: 0; color: var(--brand); font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 550; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }

/* ---------------- shell ---------------- */
.mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); position: relative; flex: none; display: inline-block; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); }
.mark::before { content: ''; position: absolute; inset: 10px 9px 9px; border: 2px solid #fff; border-radius: 3px; }
.mark::after { content: ''; position: absolute; left: 9px; right: 9px; top: 15px; border-top: 2px solid #fff; }
.mark.big { width: 52px; height: 52px; border-radius: 15px; }
.mark.big::before { inset: 15px 13px 13px; }
.mark.big::after { left: 13px; right: 13px; top: 22px; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 1.06rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-text span { font-size: 0.8rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side); z-index: 30; display: flex; flex-direction: column; gap: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbff 100%); border-right: 1px solid var(--line); padding: 22px 14px 18px;
}
.sidebar .brand { padding: 0 8px; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 0; background: none;
  color: var(--ink-2); font: inherit; font-size: 0.98rem; font-weight: 550; cursor: pointer; text-align: left;
}
.nav-item svg { width: 21px; height: 21px; }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item { position: relative; transition: background 0.12s, color 0.12s; }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.nav-item.active::before { content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: linear-gradient(180deg, var(--brand), var(--brand-2)); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 9px; padding: 14px; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-lg); }
.side-label { font-size: 0.78rem; color: var(--ink-3); }
.side-foot .lang { margin-top: 4px; width: 100%; }
.side-foot .lang button { flex: 1; }

.topbar { display: none; }
.bottom-nav { display: none; }
.content { margin-left: var(--side); padding: 30px clamp(16px, 3vw, 44px) 40px; min-width: 0; }
.content-inner { max-width: 1200px; margin: 0 auto; min-width: 0; }
.page-head { margin-bottom: 22px; }
.page-head h1 { background: linear-gradient(90deg, var(--ink) 0%, #3d3a8f 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-head p { color: var(--ink-2); margin-top: 4px; }
.page { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* language segmented control */
.lang { display: inline-flex; padding: 3px; gap: 2px; background: var(--hover); border: 1px solid var(--line); border-radius: 10px; }
.lang button { border: 0; background: transparent; font: inherit; font-size: 0.84rem; font-weight: 600; padding: 4px 11px; border-radius: 7px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.lang button.on { background: var(--surface); color: var(--brand); box-shadow: var(--sh-1); }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 0.8rem; font-weight: 600; padding: 4px 11px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); white-space: nowrap; border: 1px solid var(--line); }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.pill.live { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.test { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.on { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.ai-pill { cursor: pointer; }
.ai-pill::before { display: none; }
.ai-pill svg { width: 14px; height: 14px; }
.ai-pill:hover { border-color: var(--brand-line); color: var(--brand); }

/* ---------------- cards ---------------- */
.card { background: var(--surface); border: 1px solid #e4e7f1; border-radius: var(--r-xl); box-shadow: var(--sh-2); padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; gap: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.panel-head p { margin-top: 4px; max-width: 68ch; }

/* ---------------- paste & book ---------------- */
.step-head { display: flex; gap: 14px; align-items: flex-start; }
.step-num {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700; font-size: 1.02rem; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.step-head p { color: var(--ink-2); margin-top: 3px; max-width: 70ch; }
.step-head.bare { padding: 6px 2px 0; }
.step { min-width: 0; }
#step3 { display: flex; flex-direction: column; gap: 14px; }

.paste-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; }
#pasteBox { min-height: 236px; border-radius: var(--r-lg); padding: 14px 16px; background: var(--sunk); font-size: 0.97rem; }
#pasteBox:focus { background: var(--surface); }
.format-card { background: linear-gradient(180deg, var(--brand-soft), #f7f7ff 70%); border: 1px solid var(--brand-line); border-radius: var(--r-lg); padding: 16px 18px; align-self: start; }
.format-card > summary { list-style: none; font-weight: 650; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.format-card > summary::-webkit-details-marker { display: none; }
.format-card > summary::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg) translateY(-3px); transition: transform 0.15s; }
.format-card[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.format-card[open] > summary { margin-bottom: 8px; }
.format-card ol { margin: 10px 0 12px; padding-left: 1.3em; display: flex; flex-direction: column; gap: 4px; font-size: 0.95rem; }
.format-card li::marker { color: var(--brand); font-weight: 700; }

/* courier picker */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 228px), 1fr)); gap: 10px; }
.acc-tile {
  display: flex; align-items: center; gap: 12px; text-align: left; min-width: 0; min-height: 60px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 11px 14px; cursor: pointer; font: inherit; color: var(--ink);
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.acc-tile:hover { border-color: var(--brand-line); box-shadow: var(--sh-2); }
.acc-tile .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 16%, transparent); }
.acc-tile .txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.acc-tile .txt b { font-weight: 650; overflow-wrap: anywhere; }
.acc-tile .txt small { color: var(--ink-2); font-size: 0.8rem; }
.acc-tile .tick { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; color: transparent; }
.acc-tile .tick svg { width: 14px; height: 14px; }
.acc-tile[aria-checked='true'] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }
.acc-tile[aria-checked='true'] .tick { background: var(--brand); border-color: var(--brand); color: #fff; }
.acc-tile.add { border-style: dashed; justify-content: center; color: var(--brand); font-weight: 600; background: transparent; }

/* toolbar */
.toolbar { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px 16px; padding: 12px 16px; border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.stats { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 0.92rem; color: var(--ink-2); }
.stats b { color: var(--ink); font-weight: 650; }
.stats .s-ok b { color: var(--ok); }
.stats .s-warn b { color: var(--warn); }
.stats .s-err b { color: var(--bad); }
.toolbar .bulk { width: auto; min-width: 240px; font-size: 0.9rem; }

/* sticky book bar */
.book-bar {
  position: sticky; bottom: 16px; z-index: 15; display: flex; align-items: center; gap: 16px; justify-content: space-between;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--r-xl); padding: 12px 12px 12px 20px; box-shadow: var(--sh-3);
}
.bb-sum { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.bb-sum strong { font-size: 1rem; }
.bb-sum span { font-size: 0.88rem; color: var(--ink-2); }

/* ---------------- waybill rows ---------------- */
.waybills { display: flex; flex-direction: column; gap: 14px; }
.waybill {
  display: grid; grid-template-columns: minmax(0, 1fr) 270px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-2);
}
.waybill { transition: box-shadow 0.15s, border-color 0.15s; }
.waybill:not(.booked):hover { box-shadow: 0 1px 2px rgba(23, 31, 74, 0.04), 0 12px 30px rgba(23, 31, 74, 0.09); }
.waybill.has-err { border-color: #f4b9c4; box-shadow: 0 0 0 1px #f4b9c4 inset, var(--sh-1); }
.waybill.booked { box-shadow: var(--sh-1); }
.waybill.booked .main input, .waybill.booked .main textarea, .waybill.booked .stub select { pointer-events: none; background: transparent; border-color: transparent; box-shadow: none; resize: none; }
.waybill.booked .stub select { background-image: none; padding-left: 0; }
.waybill .main { padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.wb-head { display: flex; align-items: center; gap: 10px; min-height: 32px; flex-wrap: wrap; }
.wb-no { font-size: 0.95rem; font-weight: 700; color: var(--ink-3); min-width: 2ch; }
.internal {
  display: inline-flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; font-size: 0.82rem; color: var(--ink-2);
  background: var(--sunk); border: 1px dashed var(--line-2); border-radius: 8px; padding: 3px 10px; max-width: 100%; min-width: 0;
}
.internal > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.internal .k { color: var(--ink-3); }
.wb-head .state { margin-left: auto; }
.state { font-size: 0.8rem; font-weight: 650; padding: 4px 11px; border-radius: 999px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.state::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.state.ready { background: var(--ok-soft); color: var(--ok); }
.state.warn { background: var(--warn-soft); color: var(--warn); }
.state.err { background: var(--bad-soft); color: var(--bad); }
.state.booked { background: var(--ok); color: #fff; }
.state.booked::before { background: #fff; }
.wb-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1.1fr); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > .lbl { font-size: 0.8rem; font-weight: 600; color: var(--ink-3); }
.field textarea { min-height: 88px; }
.field .phone { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.field .hint { font-size: 0.8rem; color: var(--ink-2); }
.wt { display: inline-flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--ink-2); }
.wt input { width: 78px; min-height: 34px; padding: 5px 9px; }
.issues { display: flex; flex-direction: column; gap: 5px; padding: 10px 12px; border-radius: var(--r); background: var(--sunk); }
.issue { display: flex; gap: 9px; align-items: baseline; font-size: 0.88rem; line-height: 1.4; }
.issue::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex: none; transform: translateY(-1px); }
.issue.error { color: var(--bad); }
.issue.error::before { background: var(--bad); }
.issue.warn { color: var(--warn); }
.issue.warn::before { background: var(--warn); }
.issue.info { color: #3940a8; }
.issue.info::before { background: var(--brand); }
.issue .link-btn { margin-left: 8px; font-size: 0.84rem; color: inherit; font-weight: 700; white-space: nowrap; }
.issue.error .link-btn { background: var(--surface); border: 1px solid #f5c2cb; border-radius: 7px; padding: 1px 9px; text-decoration: none; }
.issue.error .link-btn { color: var(--bad); }
.src { font-size: 0.8rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the COD stub */
.stub-cod, .stub-courier { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.stub {
  position: relative; border-left: 2px dashed var(--line-2); background: linear-gradient(180deg, #fafbff, var(--sunk));
  border-radius: 0 var(--r-xl) var(--r-xl) 0; padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 9px; min-width: 0;
}
.stub::before, .stub::after { content: ''; position: absolute; left: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line); }
.stub::before { top: -12px; clip-path: inset(50% 0 0 0); }
.stub::after { bottom: -12px; clip-path: inset(0 0 50% 0); }
.stub .lbl { font-size: 0.8rem; font-weight: 600; color: var(--ink-3); }
.cod-line { display: flex; align-items: baseline; gap: 2px; }
.cod-line .tk { font-size: 1.45rem; font-weight: 600; color: var(--ink-2); }
.cod-input {
  font-size: 2.05rem; font-weight: 700; letter-spacing: -0.02em; border: 1px solid transparent; background: transparent; box-shadow: none;
  padding: 0 6px; min-height: 0; line-height: 1.2; font-variant-numeric: tabular-nums;
}
.cod-input:hover { border-color: var(--line-2); background: var(--surface); }
.cod-input.locked { color: var(--brand); }
.cod-input.missing { border-color: var(--bad); background: var(--surface); }
.cod-src { font-size: 0.8rem; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.stub select { font-size: 0.92rem; }
.acc-select { border-left: 4px solid var(--c, var(--line-2)); }
.booked-box { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.track { display: flex; align-items: center; gap: 8px; font-weight: 650; font-variant-numeric: tabular-nums; word-break: break-all; }
.copy { border: 1px solid var(--line-2); background: var(--surface); border-radius: 7px; font: inherit; font-size: 0.75rem; font-weight: 600; padding: 2px 9px; cursor: pointer; color: var(--ink-2); flex: none; }
.copy:hover { color: var(--brand); border-color: var(--brand-line); }

/* ---------------- orders ---------------- */
.filters { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; padding: 18px 20px; }
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: 0.84rem; font-weight: 550; color: var(--ink-2); min-width: 150px; }
.filters label.grow { flex: 1; min-width: 200px; }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.summary { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px; }
.total-card {
  border-radius: var(--r-xl); padding: 22px 24px; display: flex; flex-direction: column; justify-content: center; gap: 4px; color: #fff;
  background: linear-gradient(135deg, #4f46e5 0%, #6d4ef5 55%, #8b5cf6 100%); box-shadow: 0 10px 30px rgba(79, 70, 229, 0.28);
}
.total-card .k { font-size: 0.92rem; opacity: 0.88; }
.total-card .v { font-size: clamp(2rem, 1.4rem + 2vw, 2.7rem); font-weight: 750; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.total-card .s { font-size: 0.92rem; opacity: 0.9; }
.split { padding: 18px 20px; gap: 12px; }
.split-row { display: grid; grid-template-columns: minmax(110px, 200px) minmax(0, 1fr) auto auto; gap: 12px; align-items: center; font-size: 0.92rem; }
.split-row .name { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.split-row .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split-row .name i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--ink-3)); flex: none; }
.split-row .barwrap { height: 8px; background: var(--hover); border-radius: 99px; overflow: hidden; }
.split-row .bar { display: block; height: 100%; background: var(--c, var(--ink-3)); border-radius: 99px; }
.split-row .n { color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.split-row .amt { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; min-width: 80px; white-space: nowrap; }
.people { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.86rem; color: var(--ink-2); padding-top: 10px; border-top: 1px solid var(--line); }
.people b { color: var(--ink); font-weight: 600; }
.people .k { color: var(--ink-3); font-weight: 600; }
.cn-pending { color: var(--warn); font-weight: 600; font-size: 0.88rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; font-size: 0.8rem; font-weight: 650; color: var(--ink-2); padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--sunk); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { color: var(--ink-2); font-size: 0.84rem; }
td .addr { max-width: 280px; }
td.code { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cour { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; }
.cour i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--ink-3)); flex: none; }
.st { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--hover); color: var(--ink-2); white-space: nowrap; }
.st.good { background: var(--ok-soft); color: var(--ok); }
.st.bad { background: var(--bad-soft); color: var(--bad); }
.st.wait { background: var(--warn-soft); color: var(--warn); }
.cn-input { display: flex; gap: 6px; }
.cn-input input { width: 140px; min-height: 34px; padding: 5px 9px; font-size: 0.86rem; }
.empty { text-align: center; color: var(--ink-2); padding: 40px 20px; }

/* sync bar + status tabs */
.sync-bar { flex-direction: row; align-items: center; gap: 12px; padding: 12px 16px 12px 20px; }
.sync-text { flex: 1; min-width: 0; font-size: 0.9rem; color: var(--ink-2); }
.sync-bar .btn svg { width: 16px; height: 16px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); flex: none; position: relative; }
.live-dot.on { background: var(--ok); }
.live-dot.on::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok); opacity: 0; animation: pulse 2.4s ease-out infinite; }
.live-dot.busy { background: var(--brand); }
.live-dot.busy::after { border-color: var(--brand); animation-duration: 1s; }
@keyframes pulse { 0% { transform: scale(0.6); opacity: 0.7; } 100% { transform: scale(1.5); opacity: 0; } }
.status-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.stab { display: inline-flex; align-items: center; gap: 8px; flex: none; font: inherit; font-size: 0.88rem; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px 6px 14px; cursor: pointer; white-space: nowrap; box-shadow: var(--sh-1); }
.stab b { min-width: 24px; padding: 1px 7px; border-radius: 999px; background: var(--hover); color: var(--ink); font-size: 0.8rem; text-align: center; font-variant-numeric: tabular-nums; }
.stab:hover { border-color: var(--line-2); color: var(--ink); }
.stab.good b { background: var(--ok-soft); color: var(--ok); }
.stab.bad b { background: var(--bad-soft); color: var(--bad); }
.stab.wait b { background: var(--warn-soft); color: var(--warn); }
.stab.info b { background: var(--brand-soft); color: var(--brand); }
.stab.on { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, 0.22); }
.stab.on b { background: rgba(255, 255, 255, 0.22); color: #fff; }
.st.info { background: var(--brand-soft); color: var(--brand); }
.st-wrap { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.st-wrap .sub { font-size: 0.78rem; color: var(--ink-3); }
.row-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.act { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; text-decoration: none; font: inherit; font-size: 0.84rem; font-weight: 600; }
.act svg { width: 17px; height: 17px; }
.act:hover { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }
.act.del:hover { color: var(--bad); border-color: #f5c2cb; background: var(--bad-soft); }
.act.warn:hover { color: var(--warn); border-color: #f3d6a5; background: var(--warn-soft); }
.hint.inv { display: block; font-size: 0.78rem; color: var(--ink-2); background: var(--sunk); border: 1px dashed var(--line-2); border-radius: 7px; padding: 3px 8px; word-break: break-all; }
.hint.inv b { font-size: 0.68rem; letter-spacing: 0.04em; color: var(--ink-3); margin-right: 2px; }
.det-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; grid-column: 1 / -1; }
.det { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.det.wide { grid-column: 1 / -1; }
.det .k { font-size: 0.76rem; font-weight: 600; color: var(--ink-3); }
.det .v { font-size: 0.94rem; word-break: break-word; }
.act .lbl { display: none; }
td.acts { white-space: nowrap; width: 1%; }
.cust b { font-weight: 600; }
.cust .when { color: var(--ink-3); font-size: 0.78rem; margin-top: 2px; }
td .prod { min-width: 110px; }
td .addr { min-width: 160px; }
.cod-v { white-space: nowrap; font-weight: 600; }
.cour-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.cour-cell .cour { white-space: normal; align-items: baseline; }
.cour-cell .cour i { transform: translateY(-1px); }
.trk { display: inline-flex; align-items: center; gap: 6px; }
.trk .code { font-variant-numeric: tabular-nums; font-size: 0.86rem; color: var(--ink); }
th.acts-h { text-align: right; }
tr.row-missing td { background: #fff9fa; }
tr.row-missing td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.changed { color: var(--warn); font-weight: 800; cursor: help; }
.history h4 { margin: 0 0 6px; font-size: 0.9rem; }
.history ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; max-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; background: var(--sunk); }
.history:empty { display: none; }
#orderNote { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
#orderFields label.locked input, #orderFields label.locked textarea { background: var(--sunk); color: var(--ink-2); border-style: dashed; cursor: default; box-shadow: none; }
#orderFields label > span { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
#orderFields .lock { font-style: normal; font-size: 0.74rem; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
dialog.wide-dlg { width: min(720px, calc(100% - 32px)); }
.del-body { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.warn-text { color: var(--warn); font-weight: 550; }

/* performance */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-2); padding: 18px 20px; display: flex; flex-direction: column; gap: 2px; min-width: 0; position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand); }
.kpi.good::before { background: var(--ok); }
.kpi.bad::before { background: var(--bad); }
.kpi .k { font-size: 0.86rem; color: var(--ink-2); font-weight: 600; }
.kpi .v { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); font-weight: 750; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi.good .v { color: var(--ok); }
.kpi.bad .v { color: var(--bad); }
.kpi .s { font-size: 0.84rem; color: var(--ink-3); }
td.good-t { color: var(--ok); font-weight: 650; }
td.bad-t { color: var(--bad); font-weight: 650; }
.person { display: flex; flex-direction: column; }
.person b { font-weight: 650; }
.rate { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.rate-bar { flex: 1; display: flex; height: 8px; border-radius: 99px; background: var(--hover); overflow: hidden; min-width: 70px; }
.rate-bar .ok { background: var(--ok); }
.rate-bar .no { background: var(--bad); opacity: 0.8; }
.rate-n { font-weight: 650; font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.rep-notes { gap: 12px; }
.rep-notes h3 { margin-bottom: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips:empty { display: none; }
#rPostersWrap { display: flex; flex-direction: column; gap: 8px; }
#rPostersWrap.hidden { display: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 0.86rem; padding: 4px 12px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); color: var(--ink-2); }
.chip b { color: var(--ink); }
.chip.add { cursor: pointer; color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); font-weight: 600; }
.chip.add:hover { background: #e3e6ff; }
#rTests:empty { display: none; }

/* ---------------- settings ---------------- */
.mode-panel { flex-direction: row; align-items: center; justify-content: space-between; gap: 20px; }
.mode-panel p { margin-top: 4px; max-width: 70ch; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; flex: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .slider { width: 50px; height: 28px; border-radius: 999px; background: var(--line-2); position: relative; transition: background 0.15s; }
.switch .slider::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(23, 31, 74, 0.25); }
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::after { transform: translateX(22px); }
.switch input:focus-visible + .slider { box-shadow: var(--ring); }
.switch-label { font-weight: 700; color: var(--ink-2); }
.switch input:checked ~ .switch-label { color: var(--ok); }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 14px; }
.acc-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); position: relative; overflow: hidden; min-width: 0; }
.acc-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c, var(--line-2)); }
.acc-card .t { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.acc-card .name { font-weight: 650; font-size: 1.02rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-card .type { font-size: 0.8rem; font-weight: 600; color: var(--c, var(--ink-2)); white-space: nowrap; }
.facts { display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; color: var(--ink-2); }
.facts .ok::before { content: '✓ '; color: var(--ok); font-weight: 700; }
.facts .bad { color: var(--bad); }
.facts .bad::before { content: '! '; font-weight: 700; }
.acc-card .actions { gap: 6px; }
.empty-box { border: 1px dashed var(--line-2); border-radius: var(--r-lg); padding: 28px; text-align: center; color: var(--ink-2); background: var(--sunk); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px 20px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; font-weight: 600; min-width: 0; }
.form-grid label.wide { grid-column: 1 / -1; }
.form-grid label small { font-weight: 400; }
.form-grid label.check { flex-direction: row; font-weight: 500; }
.hint-box { font-size: 0.86rem; color: var(--ink-2); background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }

/* team */
.team-head, .team-row { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr) 34px; gap: 10px; align-items: center; }
.team-head { font-size: 0.82rem; font-weight: 650; color: var(--ink-2); }
.team-rows { display: flex; flex-direction: column; gap: 8px; }

/* live updates (webhook) block on account cards */
.hook { border-top: 1px dashed var(--line-2); padding-top: 10px; font-size: 0.86rem; display: flex; flex-direction: column; gap: 8px; }
.hook:not([open]) { gap: 0; }
.hook summary { cursor: pointer; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; list-style: none; }
.hook summary::-webkit-details-marker { display: none; }
.hook summary::before { content: '▸'; color: var(--ink-3); margin-right: -2px; transition: transform 0.15s; }
.hook[open] summary::before { transform: rotate(90deg); }
.hook summary > span:first-of-type { flex: 1; min-width: 0; }
.hook summary:hover { color: var(--brand); }
.hook-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 0.76rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--sunk); color: var(--ink-3); border: 1px solid var(--line); white-space: nowrap; }
.hook-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.hook-chip.on { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.hook-chip.wait { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.hook-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 7px 10px; }
.hook-row .k { grid-column: 1 / -1; font-size: 0.7rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.hook-row code { font-size: 0.78rem; word-break: break-all; color: var(--ink); }
.hook-steps { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 3px; color: var(--ink-2); font-size: 0.84rem; }
.hook-steps li::marker { color: var(--brand); font-weight: 700; }
.hook p { font-size: 0.82rem; }
.hook .warn-text { font-weight: 500; background: var(--warn-soft); border-radius: var(--r-sm); padding: 8px 10px; }
.hook .actions { gap: 8px 12px; }

/* public link card */
.pub-state { display: flex; flex-direction: column; gap: 8px; }
.pub-now { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.pub-now code { font-weight: 600; word-break: break-all; }
.pub-state .warn-text { background: var(--warn-soft); border-radius: var(--r-sm); padding: 8px 10px; font-weight: 500; }
.pub-row { display: flex; gap: 10px; flex-wrap: wrap; }
.pub-row input { flex: 1 1 260px; }
.words-wrap { display: flex; flex-direction: column; gap: 6px; grid-column: 1 / -1; }
.words-wrap > label { font-size: 0.9rem; font-weight: 600; }
.words-wrap textarea { min-height: 96px; font-size: 0.92rem; }
.words-foot { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.words-foot small { flex: 1 1 260px; }
.alert { background: var(--bad-soft); color: #9f1f35; border: 1px solid #f5c2cb; border-left: 4px solid var(--bad); border-radius: var(--r-lg); padding: 14px 16px; font-weight: 550; line-height: 1.5; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input[type='file'] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
#backupPanel .actions .btn { min-width: 160px; }

/* AI panel */
.ai-panel { border-color: var(--brand-line); background: linear-gradient(180deg, #fbfbff, var(--surface) 140px); }
.ai-title { display: flex; align-items: center; gap: 10px; }
.ai-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.ai-icon svg { width: 18px; height: 18px; }
.ai-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ai-points li { display: flex; gap: 10px; align-items: flex-start; }
.ai-points svg { width: 18px; height: 18px; color: var(--brand); margin-top: 3px; }
.ai-key { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: var(--r-lg); background: var(--sunk); border: 1px solid var(--line); }
.ai-key > label { font-size: 0.9rem; font-weight: 600; }
.ai-key-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ai-key-row input { flex: 1 1 260px; font-variant-numeric: tabular-nums; }
.ai-how ol { margin: 8px 0 10px; padding-left: 1.3em; display: flex; flex-direction: column; gap: 5px; }
.ai-how li::marker { color: var(--brand); font-weight: 700; }

/* ---------------- guide ---------------- */
.guide { max-width: 780px; display: flex; flex-direction: column; gap: 22px; }
.guide > h1 { display: none; }
.guide .lead { color: var(--ink-2); font-size: 1.04rem; }
.gpart { display: flex; flex-direction: column; gap: 12px; }
.gpart > h2 { font-size: 1.22rem; display: flex; align-items: center; gap: 10px; }
.gpart > h2::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.guide ol.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.guide .gstep { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-1); }
.guide .gstep .gn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700; box-shadow: 0 4px 10px rgba(79, 70, 229, 0.22); }
.guide .gstep h3 { margin: 6px 0 8px; }
.guide .gstep ul { margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 6px; }
.guide .gstep li::marker { color: var(--ink-3); }
.creds { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--sunk); }
.creds div { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.creds div:last-child { border-bottom: 0; }
.creds code { font-family: inherit; font-weight: 600; word-break: break-all; }
.note-box { background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: var(--r-xl); padding: 18px 20px; }
.note-box h3 { margin-bottom: 6px; color: var(--brand); }
.guide .trouble { margin: 8px 0 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 6px; }
.guide .format-card { align-self: stretch; }

/* ---------------- login / dialogs / toast ---------------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 400px at 50% -10%, #e6e8ff, transparent 70%), var(--bg); }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 32px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--sh-3); }
.login-card h1 { font-size: 1.6rem; }
dialog { border: 1px solid var(--line); border-radius: 20px; padding: 24px; width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); color: var(--ink); box-shadow: var(--sh-3); }
dialog::backdrop { background: rgba(29, 35, 64, 0.32); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
dialog form { display: flex; flex-direction: column; gap: 16px; }
.confirm-table { width: 100%; font-size: 0.95rem; }
.confirm-table td { padding: 7px 0; border: 0; }
.confirm-table td:last-child { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.confirm-table tr.total td { border-top: 1px solid var(--line); padding-top: 10px; font-weight: 700; }
.live-note { color: var(--bad); font-weight: 650; }
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 60; width: max-content; max-width: min(520px, calc(100% - 32px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--ok);
  padding: 12px 18px; border-radius: 12px; font-size: 0.95rem; font-weight: 550; box-shadow: var(--sh-3);
}
.toast.err { border-left-color: var(--bad); background: #fff8f9; color: #9f1f35; }

/* ================= responsive ================= */

/* laptops */
@media (max-width: 1280px) {
  .waybill { grid-template-columns: minmax(0, 1fr) 250px; }
  .wb-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .wb-fields .field:nth-child(3) { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: 10px; }
  .wb-fields .field:nth-child(3) > .lbl { grid-column: 1 / -1; }
}

/* tablets and phones: no sidebar, top bar + bottom nav */
@media (max-width: 1023px) {
  .sidebar { display: none; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 30; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 16px; background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .mark { width: 30px; height: 30px; border-radius: 9px; }
  .topbar .mark::before { inset: 9px 8px 8px; }
  .topbar .mark::after { left: 8px; right: 8px; top: 14px; }
  .topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }
  .content { margin-left: 0; padding: 20px 16px calc(96px + var(--safe-b)); }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-b));
  }
  .bn-item { border: 0; background: none; font: inherit; color: var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; cursor: pointer; font-size: 0.74rem; font-weight: 600; min-width: 0; }
  .bn-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bn-item svg { width: 23px; height: 23px; }
  .bn-item.active { color: var(--brand); }
  .bn-item.active svg { background: var(--brand-soft); border-radius: 10px; padding: 2px 8px; width: 40px; box-sizing: content-box; height: 21px; }
  .book-bar { bottom: calc(76px + var(--safe-b)); }
  .toast { top: 66px; }
  .page-head { margin-bottom: 16px; }
  .paste-grid { grid-template-columns: 1fr; }
  .waybill { grid-template-columns: minmax(0, 1fr); }
  .stub { border-left: 0; border-top: 2px dashed var(--line-2); border-radius: 0 0 var(--r-xl) var(--r-xl); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); align-items: start; gap: 10px 20px; }
  .stub::before { top: -12px; left: -12px; clip-path: inset(0 0 0 50%); }
  .stub::after { top: -12px; bottom: auto; left: auto; right: -12px; clip-path: inset(0 50% 0 0); }
  .stub > .booked-box { grid-column: 1 / -1; }
  .summary { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* phones */
@media (max-width: 640px) {
  html, body { font-size: 15.5px; }
  .card { padding: 18px 16px; border-radius: var(--r-lg); }
  .step-head { gap: 12px; }
  .step-num { width: 30px; height: 30px; font-size: 0.95rem; }
  #pasteBox { min-height: 190px; }
  .actions > .btn.primary { flex: 1; }
  .toolbar { padding: 12px; }
  .toolbar .bulk { min-width: 0; width: 100%; flex: 1 1 100%; }
  .waybill .main { padding: 14px 14px 16px; }
  .wb-fields { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .wb-fields .field:nth-child(3) { grid-column: auto; grid-template-columns: minmax(0, 1fr); }
  .stub { grid-template-columns: minmax(0, 1fr); padding: 14px; gap: 12px; }
  .cod-input { font-size: 1.8rem; }
  .book-bar { padding: 10px 10px 10px 14px; gap: 10px; border-radius: var(--r-lg); }
  .book-bar .btn.lg { padding: 10px 16px; min-height: 44px; }
  .bb-sum strong { font-size: 0.92rem; }
  .bb-sum span { font-size: 0.82rem; }
  .topbar .brand-text span { display: none; }
  .topbar .ai-pill.icon-only span { display: none; }
  .topbar .ai-pill.icon-only { padding: 6px 8px; }
  .topbar .pill.js-mode { padding: 4px 9px; }
  .filters { padding: 16px; }
  .filters label { min-width: 0; flex: 1 1 calc(50% - 8px); }
  .filters label.grow { flex-basis: 100%; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1; }
  .split-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .split-row .barwrap { display: none; }
  .mode-panel { flex-direction: column; align-items: flex-start; }
  .creds div { grid-template-columns: minmax(0, 1fr) auto; }
  .creds div > span { grid-column: 1 / -1; }
  .guide .gstep { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 16px; }

  /* orders table becomes cards */
  table.orders thead { display: none; }
  table.orders, table.orders tbody, table.orders tr, table.orders td { display: block; width: 100%; }
  table.orders tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  table.orders tbody tr:last-child { border-bottom: 0; }
  table.orders td { border: 0; padding: 4px 0; display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; text-align: left; white-space: normal; }
  table.orders td::before { content: attr(data-label); color: var(--ink-3); font-size: 0.8rem; font-weight: 600; padding-top: 2px; }
  table.orders td .addr { max-width: none; }
  table.orders td.code { word-break: break-all; }
  tbody tr:hover td { background: transparent; }
  table.orders td.acts { grid-template-columns: minmax(0, 1fr); padding-top: 10px; width: 100%; }
  table.orders td.acts::before { display: none; }
  .row-actions { justify-content: flex-start; gap: 8px; }
  .act { width: auto; flex: 1; padding: 0 10px; height: 38px; }
  .act .lbl { display: inline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .act.del { flex: 0 0 44px; }
  .act.del .lbl { display: none; }
  .det-grid { grid-template-columns: minmax(0, 1fr); padding: 12px; }

  td .prod, td .addr { min-width: 0; }
  tr.row-missing td:first-child { box-shadow: none; }
  tr.row-missing { box-shadow: inset 3px 0 0 var(--bad); background: #fff9fa; }
  /* performance rows: compact cards — name, 4 numbers, then rate + COD */
  table.report tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 8px; }
  table.report td { display: flex; flex-direction: column; gap: 1px; padding: 0; min-width: 0; font-size: 1.02rem; font-weight: 650; }
  table.report td::before { font-size: 0.72rem; padding: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.report td.num { text-align: left; }
  table.report td:nth-child(1) { grid-column: 1 / -1; font-size: 1.05rem; }
  table.report td:nth-child(1)::before { display: none; }
  table.report td:nth-child(6) { grid-column: 1 / span 2; }
  table.report td:nth-child(7) { grid-column: 3 / span 2; text-align: right; align-items: flex-end; }
  .rate { min-width: 0; }
  .rate-bar { min-width: 0; }
  .sync-bar { flex-wrap: wrap; padding: 12px 14px; }
  .sync-bar .btn { margin-left: auto; }
  .kpi { padding: 14px 14px 14px 16px; }
  .team-head { display: none; }
  .team-row { grid-template-columns: minmax(0, 1fr) 34px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--sunk); }
  .team-row .tm-alias { grid-column: 1; grid-row: 2; }
  .team-row .icon-btn { grid-column: 2; grid-row: 1 / span 2; }
  dialog.wide-dlg { width: 100%; }
  .bn-item { font-size: 0.7rem; }

  /* dialogs become bottom sheets */
  dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 22px 22px 0 0; padding: 22px 18px calc(18px + var(--safe-b)); max-height: 88vh; }
  dialog .actions.end .btn { flex: 1; }
}

/* very small phones */
@media (max-width: 380px) {
  .topbar .lang button { padding: 4px 7px; }
  .topbar .brand-text strong { font-size: 0.98rem; }
  .topbar-right { gap: 6px; }
}
@media (max-width: 340px) {
  .topbar .pill.js-mode { display: none; }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .bn-item.active svg { padding: 2px 4px; width: 32px; }
  .picker { grid-template-columns: minmax(0, 1fr); }
  .filters label { flex-basis: 100%; }
}

/* printing */
.btn svg { width: 16px; height: 16px; flex: none; }
.printed { display: inline-flex; align-items: center; gap: 4px; width: fit-content; margin-top: 4px; font-size: 0.74rem; font-weight: 600; color: var(--ok); background: var(--ok-soft); border-radius: 999px; padding: 2px 8px; }
.printed svg { width: 12px; height: 12px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-opt { position: relative; display: block; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt > span { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); transition: border-color 0.15s, background 0.15s; }
.seg-opt b { font-weight: 650; }
.seg-opt small { font-size: 0.8rem; color: var(--ink-2); line-height: 1.4; }
.seg-opt:hover > span { border-color: var(--brand-line); }
.seg-opt input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-soft); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.field-row { display: flex; flex-direction: column; gap: 6px; font-weight: 550; }
.field-row select { width: 100%; }
#printDlg .hint-box { margin: 0; }
#printDlg p { margin: 0; }

@media (max-width: 640px) {
  .row-actions { flex-wrap: wrap; }
  .act.del, .act.warn { flex: 1 1 auto; }
  .act.del .lbl { display: inline; }
}
@media (max-width: 420px) {
  .seg { grid-template-columns: 1fr; }
}

/* ================= v1.6: sheet import, customer check, logo ================= */

/* source switch: Messenger paste | Google Sheet / Excel */
.src-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--sunk); border: 1px solid var(--line); border-radius: 13px; align-self: flex-start; max-width: 100%; }
.src-tab { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; font: inherit; font-size: 0.92rem; font-weight: 600; color: var(--ink-2); padding: 8px 16px; border-radius: 10px; cursor: pointer; white-space: nowrap; min-width: 0; }
.src-tab svg { width: 18px; height: 18px; }
.src-tab:hover { color: var(--ink); }
.src-tab.active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgba(23, 31, 74, 0.08), 0 2px 8px rgba(23, 31, 74, 0.06); }
#pastePane { display: flex; flex-direction: column; gap: 16px; }
.sheet-pane { display: flex; flex-direction: column; gap: 16px; }
.sheet-src { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; min-height: 190px; padding: 24px;
  border: 2px dashed var(--brand-line); border-radius: var(--r-lg); background: linear-gradient(180deg, #f7f7ff, #fbfbff); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop .up-btn { margin-top: 10px; }
.drop .up-btn svg { width: 18px; height: 18px; }
.drop-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); color: var(--brand); box-shadow: var(--sh-2); margin-bottom: 6px; }
.drop-ic svg { width: 28px; height: 28px; }
.drop b { font-weight: 650; }
.sheet-link { display: flex; flex-direction: column; gap: 8px; justify-content: center; padding: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--sunk); }
.field-title { font-size: 0.9rem; font-weight: 650; }
.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; }
.sheet-map { display: flex; flex-direction: column; gap: 12px; }
.sheet-map h4 { margin: 4px 0 0; font-size: 1rem; }
.sheet-info { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--sunk); }
.sheet-info b { display: block; font-weight: 650; overflow-wrap: anywhere; }
.sheet-info small { display: block; }
.sheet-badge { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); flex: none; }
.sheet-badge svg { width: 22px; height: 22px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px 14px; }
.map-item { display: flex; flex-direction: column; gap: 5px; font-size: 0.84rem; font-weight: 600; color: var(--ink-2); min-width: 0; }
.map-item select { font-size: 0.9rem; min-height: 38px; }
.map-item .req { color: var(--bad); font-style: normal; }
.map-item.need.unset select { border-color: var(--bad); background-color: #fffafb; }
.sheet-preview { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); max-width: 100%; }
.sheet-preview table { font-size: 0.82rem; }
.sheet-preview th, .sheet-preview td { padding: 7px 10px; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-preview th { vertical-align: bottom; }
.sheet-preview th span { display: block; overflow: hidden; text-overflow: ellipsis; }
.sheet-preview th em { display: inline-block; margin-top: 3px; font-style: normal; font-size: 0.7rem; font-weight: 700; color: #fff; background: var(--brand); padding: 1px 7px; border-radius: 999px; }
.sheet-preview th.on { background: var(--brand-soft); color: var(--brand); }
.sheet-preview td.on { background: #fafaff; }
.sheet-tag { color: var(--ok) !important; font-weight: 600; }

/* customer check chip (under the phone number) */
.cust-chip {
  display: inline-flex; align-items: center; gap: 7px; width: fit-content; max-width: 100%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font: inherit; font-size: 0.8rem; font-weight: 650; padding: 3px 11px 3px 4px; border-radius: 999px; cursor: pointer; line-height: 1.3; transition: box-shadow 0.12s, transform 0.06s;
}
.cust-chip:hover { box-shadow: var(--sh-2); }
.cust-chip:active { transform: translateY(1px); }
.cust-chip > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-chip .ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 0.72rem; font-weight: 800; flex: none; background: var(--ink-3); }
.cust-chip.lv-good { background: var(--ok-soft); border-color: #bfe9d6; color: #0b7a55; }
.cust-chip.lv-good .ic { background: var(--ok); }
.cust-chip.lv-ok { background: var(--warn-soft); border-color: #f3dcae; color: #8f4b00; }
.cust-chip.lv-ok .ic { background: #e08a00; }
.cust-chip.lv-risky { background: var(--bad-soft); border-color: #f5c2cb; color: #b0213a; }
.cust-chip.lv-risky .ic { background: var(--bad); }
.cust-chip.lv-new { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.cust-chip.lv-new .ic { background: var(--brand); }
.cust-chip.lv-wait, .cust-chip.lv-off { background: var(--sunk); padding-left: 9px; }
.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--brand); animation: spin 0.8s linear infinite; flex: none; display: inline-block; }

/* customer dialog / panel */
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg-head .icon-btn:hover { color: var(--ink); background: var(--hover); }
.cust-panel { display: flex; flex-direction: column; gap: 16px; }
.cust-panel.loading { flex-direction: row; align-items: center; gap: 10px; color: var(--ink-2); padding: 18px; background: var(--sunk); border-radius: var(--r-lg); }
.cust-score { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 18px; align-items: center; padding: 16px 18px; border-radius: var(--r-lg); background: var(--sunk); border: 1px solid var(--line); }
.cust-score p { margin-top: 2px; }
.cust-score small { display: block; margin-top: 3px; }
.ring { position: relative; width: 92px; height: 92px; color: var(--ink-3); }
.ring svg { width: 100%; height: 100%; display: block; }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.3rem; font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }
.lv-good { --lv: var(--ok); }
.lv-ok { --lv: #e08a00; }
.lv-risky { --lv: var(--bad); }
.lv-new { --lv: var(--brand); }
.ring.lv-good, .ring.lv-ok, .ring.lv-risky, .ring.lv-new { color: var(--lv); }
.lv-text { font-size: 1.15rem; font-weight: 700; color: var(--lv, var(--ink)); }
.cb-list { display: flex; flex-direction: column; gap: 12px; }
.cb-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; font-size: 0.9rem; }
.cb-name { font-weight: 650; }
.cb-bar { display: flex; height: 10px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.cb-bar i { display: block; height: 100%; }
.cb-bar i.d { background: var(--ok); }
.cb-bar i.x { background: var(--bad); opacity: 0.85; }
.cb-num { color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cb-num b { color: var(--ink); }
.cb-split { display: inline-flex; gap: 10px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cb-split .ok { color: var(--ok); }
.cb-split .bad { color: var(--bad); }
.cb-row.err .cb-err { grid-column: 2 / -1; color: var(--warn); font-size: 0.85rem; }
.own { border-top: 1px dashed var(--line-2); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.own h4 { margin: 0; font-size: 0.92rem; }
.own-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.own-list li { display: grid; grid-template-columns: 92px 100px auto 80px minmax(0, 1fr); gap: 10px; align-items: center; padding: 7px 12px; font-size: 0.84rem; border-bottom: 1px solid var(--line); }
.own-list li:last-child { border-bottom: 0; }
.own-list li > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.own-list .sg { font-size: 0.74rem; font-weight: 650; padding: 1px 8px; border-radius: 999px; background: var(--hover); color: var(--ink-2); width: fit-content; }
.own-list .sg-delivered, .own-list .sg-partial { background: var(--ok-soft); color: var(--ok); }
.own-list .sg-cancelled, .own-list .sg-returned { background: var(--bad-soft); color: var(--bad); }
.cust-panel.compact .cust-score { grid-template-columns: 70px minmax(0, 1fr); padding: 12px 14px; gap: 14px; }
.cust-panel.compact .ring { width: 70px; height: 70px; }
.cust-panel.compact .ring .pct { font-size: 1.02rem; }
.cust-panel.compact .own { border-top: 0; padding-top: 0; }
.order-cust { display: flex; flex-direction: column; gap: 8px; }
.order-cust:empty { display: none; }
.oc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.oc-head h4 { margin: 0; font-size: 0.92rem; }
#custDlg .actions { gap: 8px 10px; }

/* shop logo */
.logo-field { display: flex; flex-direction: column; gap: 8px; }
.logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo-prev { height: 52px; width: auto; max-width: 170px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; padding: 5px; background: #fff; }

@media (max-width: 1023px) {
  .sheet-src { grid-template-columns: minmax(0, 1fr); }
  .drop { min-height: 150px; }
}
@media (max-width: 640px) {
  .src-tabs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .src-tab { justify-content: center; padding: 8px 8px; font-size: 0.86rem; }
  .src-tab span { overflow: hidden; text-overflow: ellipsis; }
  .link-row { flex-direction: column; }
  .cust-score { grid-template-columns: 74px minmax(0, 1fr); gap: 14px; padding: 14px; }
  .ring { width: 74px; height: 74px; }
  .cb-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
  .cb-row .cb-bar { grid-column: 1 / -1; grid-row: 2; }
  .cb-row .cb-split { grid-column: 2; grid-row: 1; }
  .cb-row .cb-num { grid-column: 1 / -1; grid-row: 3; font-size: 0.82rem; }
  .cb-row.err .cb-err { grid-column: 1 / -1; }
  .own-list li { grid-template-columns: auto auto minmax(0, 1fr); }
  .own-list li > span:last-child { grid-column: 1 / -1; }
  .sheet-info { flex-wrap: wrap; }
}

/* ================= v1.7 ================= */
.ver { font-size: 0.72rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
#verWarn { margin-bottom: 16px; }
.alert.soft { background: var(--warn-soft); color: #7a4100; border-color: #f3d6a5; border-left-color: var(--warn); font-weight: 500; }

/* quick customer look-up on the paste page */
.cust-quick { flex-direction: row; align-items: center; gap: 14px; padding: 14px 18px; background: linear-gradient(90deg, #f1fbf6, var(--surface) 60%); border-color: #cdeedd; }
.cq-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--ok); color: #fff; flex: none; box-shadow: 0 4px 12px rgba(14, 159, 110, 0.25); }
.cq-ic svg { width: 22px; height: 22px; }
.cq-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cq-text b { font-weight: 650; }
.cq-form { display: flex; gap: 8px; flex: 0 1 380px; min-width: 0; }
.cq-form input { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }

/* sheet sources: upload | link + copy-paste */
.src-card { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--sunk); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.src-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sheet-src .drop { border: 2px dashed var(--brand-line); background: linear-gradient(180deg, #f7f7ff, #fbfbff); }
.sheet-paste textarea { min-height: 70px; font-size: 0.86rem; font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface); }
.sheet-paste .actions { gap: 8px 12px; }
.sheet-paste .actions small { flex: 1 1 200px; }
.sheet-busy { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.tab-pick { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; font-weight: 600; color: var(--ink-2); }
.tab-pick select { width: auto; min-width: 150px; min-height: 34px; font-size: 0.86rem; }
#sheetMapBody { display: flex; flex-direction: column; gap: 10px; }
#sheetBuild { min-width: 220px; }

/* settings: customer check service */
.cset-panel { border-color: #cdeedd; background: linear-gradient(180deg, #f6fdf9, var(--surface) 140px); }
.ai-icon.green { background: linear-gradient(135deg, #10b981, #0e9f6e); }
.cset-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cset-sources .k { font-size: 0.84rem; font-weight: 600; color: var(--ink-2); margin-right: 2px; }
.src-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8rem; font-weight: 650; padding: 3px 11px; border-radius: 999px; background: var(--surface); border: 1px dashed var(--line-2); color: var(--ink-3); }
.src-chip.on { background: var(--ok-soft); border: 1px solid #bfe9d6; color: #0b7a55; }
.cset-test { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cset-test input { flex: 0 1 220px; min-height: 34px; font-variant-numeric: tabular-nums; }
#custPanel .ai-key .field-row { font-size: 0.9rem; }

/* settings: customer check — own courier logins, saved history, optional paid service */
.chk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.chk-card { position: relative; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: 14px 14px 12px 18px; display: flex; flex-direction: column; gap: 10px; overflow: hidden; min-width: 0; }
.chk-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--c, var(--line-2)); }
.chk-card.off { background: var(--sunk); border-style: dashed; }
.chk-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chk-head b { font-size: 1rem; color: var(--ink); }
.chk-head .pill { font-size: 0.74rem; padding: 2px 9px; }
.chk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.chk-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 6px; align-items: center; padding: 7px 6px 7px 10px; border-radius: var(--r); background: var(--sunk); border: 1px solid var(--line); min-width: 0; }
.chk-item .who { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.chk-item .sub { grid-column: 1; font-size: 0.76rem; color: var(--ink-2); overflow-wrap: anywhere; line-height: 1.35; }
.chk-item .acts { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 0; }
.chk-item .acts .icon-btn { width: 30px; height: 30px; }
.chk-item .acts .icon-btn svg { width: 16px; height: 16px; }
.chk-item .acts .icon-btn.plain:hover { color: var(--brand); background: var(--brand-soft); }
.chk-item.acc { background: var(--surface); border-style: dashed; }
.chk-item.off { opacity: 0.6; }
.st-ok { color: var(--ok); font-weight: 600; }
.st-bad { color: var(--bad); font-weight: 600; }
.chk-empty { font-size: 0.84rem; color: var(--ink-2); }
.chk-foot { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; margin-top: auto; }
.chk-foot a { font-size: 0.8rem; font-weight: 600; color: var(--brand); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.chk-foot a svg { width: 13px; height: 13px; }
.chk-note { margin-top: -6px; }
.chk-saved { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid #cdeedd; }
.chk-saved-num { display: flex; gap: 12px; align-items: flex-start; flex: 1 1 280px; min-width: 0; }
.chk-saved-num .ai-icon { background: linear-gradient(135deg, #10b981, #0e9f6e); flex: none; }
.chk-saved-num b { font-size: 1.05rem; }
.chk-saved-act { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.chk-saved-act .field-row { font-size: 0.84rem; }
.chk-saved-act select { min-height: 34px; width: auto; min-width: 180px; }
.cset-paid { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: 0 16px; }
.cset-paid > summary { cursor: pointer; padding: 13px 0; font-weight: 650; display: flex; align-items: center; gap: 10px; list-style: none; }
.cset-paid > summary > span:first-child { flex: 1 1 auto; min-width: 0; }
.cset-paid > summary .pill { flex: none; }
.cset-paid > summary::-webkit-details-marker { display: none; }
.cset-paid > summary::before { content: '▸'; color: var(--ink-3); transition: transform 0.15s; }
.cset-paid[open] > summary::before { transform: rotate(90deg); }
.cset-paid[open] { padding-bottom: 16px; }
.cset-paid > :not(summary) + :not(summary) { margin-top: 12px; }
.cset-paid #custKeyDel { align-self: flex-start; }
#chkDlg .hint-box a { color: var(--brand); font-weight: 600; }
#chkDlg .hint-box ol { margin: 6px 0 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 3px; }
.cb-row .cb-when { grid-column: 1 / -1; font-size: 0.74rem; color: var(--ink-3); }
.cust-saved-note { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: #0b7a55; background: var(--ok-soft); border-radius: 999px; padding: 2px 10px; font-weight: 600; }
@media (max-width: 640px) {
  .chk-saved-act { width: 100%; }
  .chk-saved-act .field-row, .chk-saved-act select { flex: 1 1 auto; width: 100%; min-width: 0; }
}

/* customer history: strip under the phone, ratings, reports */
.cust-strip { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.cs-list { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.cs-c { font-size: 0.74rem; color: var(--ink-2); background: var(--sunk); border: 1px solid var(--line); border-radius: 7px; padding: 1px 7px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cs-c b { color: var(--ink); font-weight: 650; }
.cs-c .ok { color: var(--ok); font-weight: 700; }
.cs-c.bad { color: var(--bad); background: var(--bad-soft); border-color: #f5c2cb; font-weight: 650; }
.cs-c.lv-good { color: #0b7a55; }
.cs-c.lv-ok { color: #8f4b00; }
.cs-c.lv-risky { color: #b0213a; background: var(--bad-soft); }
.cust-chip.lv-unknown, .cust-chip.lv-off { background: var(--sunk); color: var(--ink-2); }
.cust-chip.lv-unknown .ic, .cust-chip.lv-off .ic { background: var(--ink-3); }
.lv-unknown, .lv-off { --lv: var(--ink-3); }
.ring.lv-unknown, .ring.lv-off { color: var(--ink-3); }
.cb-rating { grid-column: 2 / 4; font-weight: 700; color: var(--lv, var(--ink)); }
.setup-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.setup-box p { flex: 1 1 260px; }
.reports { border: 1px solid #f5c2cb; background: #fff8f9; border-radius: var(--r-lg); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.reports h4 { margin: 0; font-size: 0.92rem; color: var(--bad); }
.reports ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow: auto; }
.reports li { border-top: 1px dashed #f5c2cb; padding-top: 8px; }
.reports li:first-child { border-top: 0; padding-top: 0; }
.rp-top { display: flex; justify-content: space-between; gap: 10px; font-size: 0.86rem; }
.reports p { margin-top: 2px; color: var(--ink-2); }

@media (max-width: 1023px) {
  .cust-quick { flex-wrap: wrap; }
  .cq-form { flex: 1 1 100%; }
}
@media (max-width: 640px) {
  .cust-quick { padding: 14px; }
  .cq-text small { display: none; }
  .tab-pick { flex: 1 1 100%; }
  .tab-pick select { flex: 1; }
  #sheetBuild { width: 100%; }
  .cb-rating { grid-column: 1 / -1; }
}

/* after reading a paste: phone numbers counted against orders */
.parse-check { margin-top: 10px; border-radius: var(--r); padding: 10px 14px; font-size: 0.9rem; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); }
.parse-check.ok { background: var(--ok-soft); border-color: #bfe9d6; color: #0b7a55; }
.parse-check.warn { background: var(--warn-soft); border-color: #f3d6a5; color: #7a4100; }
.parse-check.bad { background: var(--bad-soft); border-color: #f5c2cb; color: #9f1f35; }
.parse-check p { margin: 0; }
.parse-check .ok { font-weight: 600; }
.parse-check .bad, .parse-check .warn { font-weight: 600; }
.parse-check .list { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; font-weight: 600; }
.parse-check.bad .warn { color: #7a4100; }

/* ---------------- big pastes: reading progress, filters and pages, booking progress (v1.10) ---------------- */
.read-bar, .book-progress { display: block; width: 100%; height: 8px; margin-top: 10px; accent-color: var(--brand); border-radius: 99px; }
.read-bar.hidden, .book-progress.hidden { display: none; }
.book-progress { margin-top: 6px; min-width: 160px; }
.review-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; justify-content: space-between; margin: 0 0 14px; }
.review-nav:empty { display: none; }
.review-nav.bottom { margin: 14px 0 0; justify-content: flex-end; }
.review-nav .chips { gap: 6px; }
.review-nav .chip { cursor: pointer; background: var(--surface); }
.review-nav .chip:hover { border-color: var(--brand-line); }
.review-nav .chip.on { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); font-weight: 600; }
.review-nav .chip.f-err b { color: var(--bad); }
.review-nav .chip.f-warn b { color: var(--warn); }
.review-nav .chip.f-ready b { color: var(--ok); }
.pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager .pg { font-size: 0.86rem; color: var(--ink-2); white-space: nowrap; }
.pager .pg-size { width: auto; font-size: 0.84rem; padding: 4px 8px; min-height: 32px; }
.field .add-alt { align-self: flex-start; font-size: 0.8rem; margin: -2px 0 2px; }
.field .name-tool { align-self: flex-start; font-size: 0.76rem; font-weight: 500; color: var(--ink-3); margin: -4px 0 2px; text-decoration-style: dotted; }
.field .name-tool:hover { color: var(--brand); }
.more-btn { display: block; margin: 14px auto 4px; }
.more-btn.hidden { display: none; }
@media (max-width: 640px) {
  .review-nav { gap: 8px; }
  .pager { width: 100%; justify-content: space-between; }
  .pager .pg-size { display: none; }
}

/* ---- Messenger "copy everything" strip + dialog (v1.11) */
.msgr-strip { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid var(--brand-line); border-radius: var(--r-lg); background: linear-gradient(90deg, var(--brand-soft), var(--surface) 70%); }
.ms-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--brand); color: #fff; flex: none; }
.ms-ic svg { width: 20px; height: 20px; }
.ms-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ms-text b { font-weight: 650; }
.mc-steps { margin: 10px 0 12px; padding-left: 22px; display: flex; flex-direction: column; gap: 9px; }
.mc-steps li { padding-left: 4px; }
.mc-drag { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }
.bookmarklet { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: var(--brand); color: #fff; font-weight: 700; text-decoration: none; cursor: grab; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3); }
.bookmarklet svg { width: 18px; height: 18px; }
.bookmarklet:active { cursor: grabbing; }
.mc-manual { margin-top: 6px; }
.mc-manual summary { cursor: pointer; color: var(--ink-2); font-size: 0.88rem; }
.mc-manual p { margin: 6px 0; }
@media (max-width: 640px) {
  .msgr-strip { flex-wrap: wrap; }
  .msgr-strip .btn { width: 100%; }
}
