/* Dropship OMS — bàn làm việc xử lý đơn: nền sáng, một màu nhấn xanh lá, bảng dày thông tin. */
:root {
  --bg: oklch(97.5% 0.005 160);
  --surface: #fff;
  --surface-2: oklch(96% 0.008 160);
  --ink: oklch(22% 0.02 250);
  --ink-2: oklch(45% 0.015 250);
  --ink-3: oklch(62% 0.01 250);
  --line: oklch(91% 0.008 160);
  --line-2: oklch(85% 0.01 160);
  --accent: oklch(55% 0.14 158);
  --accent-ink: oklch(40% 0.11 158);
  --accent-soft: oklch(95% 0.035 158);
  --warn: oklch(62% 0.15 65);  --warn-soft: oklch(96.5% 0.045 80);
  --bad: oklch(55% 0.19 27);   --bad-soft: oklch(96% 0.03 27);
  --good: oklch(52% 0.13 152);
  --coupang: oklch(60% 0.2 30); --naver: oklch(63% 0.16 150);
  --r: 12px; --r-sm: 8px;
  --shadow: 0 1px 2px oklch(30% 0.02 250 / .06), 0 8px 24px -10px oklch(30% 0.02 250 / .18);
  --font: "Be Vietnam Pro", system-ui, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(18% 0.01 250); --surface: oklch(22% 0.012 250); --surface-2: oklch(25.5% 0.012 250);
    --ink: oklch(94% 0.005 250); --ink-2: oklch(76% 0.01 250); --ink-3: oklch(60% 0.01 250);
    --line: oklch(30% 0.012 250); --line-2: oklch(37% 0.012 250);
    --accent: oklch(68% 0.14 158); --accent-ink: oklch(78% 0.12 158); --accent-soft: oklch(30% 0.05 158);
    --warn-soft: oklch(30% 0.05 70); --bad-soft: oklch(30% 0.06 27);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: var(--accent); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero h1 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.2; margin: 0; letter-spacing: -.02em; }
.auth-hero p { opacity: .85; max-width: 40ch; }
.auth-form { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(380px, 100%); }
.auth-card h2 { margin: 0 0 20px; font-size: 22px; }
.logo { font-weight: 700; font-size: 18px; display: flex; gap: 8px; align-items: center; }
.logo i { width: 26px; height: 26px; border-radius: 7px; background: #fff; color: var(--accent); display: grid; place-items: center; font-style: normal; font-size: 14px; }
@media (max-width: 760px) { .auth { grid-template-columns: 1fr; } .auth-hero { padding: 28px 16px; } }

/* ---------- form ---------- */
label.f { display: block; margin-bottom: 12px; font-size: 13px; color: var(--ink-2); }
label.f > span { display: block; margin-bottom: 4px; font-weight: 500; }
.in { width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); outline: none; }
.in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.in { min-height: 140px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.btn { border: 1px solid var(--line-2); background: var(--surface); padding: 8px 14px; border-radius: var(--r-sm); cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.pri:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; padding: 11px; }
.err { color: var(--bad); font-size: 13px; min-height: 20px; }
.muted { color: var(--ink-3); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.side .logo { color: var(--ink); margin: 0 8px 18px; }
.side .logo i { background: var(--accent); color: #fff; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav:hover { background: var(--surface-2); }
.nav.on { background: var(--accent-soft); color: var(--accent-ink); }
.nav .badge { margin-left: auto; }
.side .foot { margin-top: auto; font-size: 12px; color: var(--ink-3); padding: 8px 10px; }
.main { padding: 24px 28px 60px; min-width: 0; }
.page-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-h h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.mock-banner { background: var(--warn-soft); border: 1px solid var(--warn); color: var(--ink); padding: 8px 12px; border-radius: var(--r-sm); margin-bottom: 16px; font-size: 13px; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 8px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .logo, .side .foot { display: none; }
  .nav { flex: none; }
  .main { padding: 16px; }
}

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi .l { color: var(--ink-3); font-size: 12.5px; font-weight: 500; }
.kpi .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.kpi .s { font-size: 12px; color: var(--ink-3); }
.todo { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.todo a { text-decoration: none; color: inherit; }
.todo .card { transition: border-color .15s, transform .15s; height: 100%; }
.todo .card:hover { border-color: var(--accent); transform: translateY(-1px); }
.todo .n { font-size: 28px; font-weight: 700; }
.todo .card.hot .n { color: var(--accent-ink); }
.section-t { font-size: 15px; font-weight: 600; margin: 0 0 12px; }

/* ---------- tabs + table ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tab { padding: 9px 12px; border: 0; background: none; cursor: pointer; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-weight: 600; text-align: center; line-height: 18px; }
.tab.on .badge, .nav.on .badge { background: var(--accent); color: #fff; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar .sp { flex: 1; }
.toolbar .in { width: 220px; }
.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--ink-3); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.sel { background: var(--accent-soft); }
td.r, th.r { text-align: right; }
td .sub { font-size: 12px; color: var(--ink-3); }
.pname { max-width: 280px; }
.pname b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plat { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.plat.coupang { background: var(--coupang); } .plat.naver { background: var(--naver); }
.chip { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.chip.ok { background: var(--accent-soft); color: var(--accent-ink); }
.chip.warn { background: var(--warn-soft); color: oklch(45% 0.12 60); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.pos { color: var(--good); } .neg { color: var(--bad); }
.empty { padding: 48px 16px; text-align: center; color: var(--ink-3); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* ---------- drawer / modal ---------- */
.scrim { position: fixed; inset: 0; background: oklch(20% 0.02 250 / .35); z-index: 20; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--surface); z-index: 21; box-shadow: var(--shadow); display: flex; flex-direction: column; animation: slide .2s cubic-bezier(.23, 1, .32, 1); }
.drawer header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.drawer header h3 { margin: 0; font-size: 16px; }
.drawer .body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.drawer footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.drawer h4 { font-size: 13px; margin: 18px 0 8px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.drawer h4:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 12px; font-size: 13.5px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; word-break: break-all; }
.pnl { background: var(--surface-2); border-radius: var(--r-sm); padding: 12px; font-size: 13.5px; }
.pnl div { display: flex; justify-content: space-between; padding: 2px 0; }
.pnl .tot { border-top: 1px solid var(--line-2); margin-top: 6px; padding-top: 6px; font-weight: 700; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100% - 32px)); max-height: 90vh; overflow-y: auto; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); z-index: 21; padding: 20px; animation: fade .15s; }
.modal h3 { margin: 0 0 6px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; }
#toast div { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r-sm); box-shadow: var(--shadow); max-width: 90vw; animation: fade .2s; }
#toast div.bad { background: var(--bad); color: #fff; }
/* ---------- tìm hàng 1688 ---------- */
.src-form { display: grid; gap: 10px; }
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--r-sm); padding: 14px; text-align: center; color: var(--ink-3); font-size: 13px; display: flex; gap: 12px; align-items: center; justify-content: center; outline: none; transition: border-color .15s, background .15s; }
.drop.over, .drop:focus { border-color: var(--accent); background: var(--accent-soft); }
.drop img { height: 56px; border-radius: 6px; }
.link { color: var(--accent-ink); text-decoration: underline; cursor: pointer; }
.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.offer { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.offer .thumb { aspect-ratio: 1; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-3); font-weight: 700; letter-spacing: .05em; }
.offer .thumb img { width: 100%; height: 100%; object-fit: cover; }
.offer .ob { padding: 10px 12px 12px; display: grid; gap: 8px; }
.offer .ot { font-size: 13.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.offer .oe { font-size: 12.5px; background: var(--surface-2); border-radius: 6px; padding: 6px 8px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 8px; }
.gallery img { height: 120px; border-radius: 8px; flex: none; }
code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.stores { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.store-card h3 { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; }
.bars .b { display: grid; grid-template-columns: 120px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; margin-bottom: 8px; }
.bars .t { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bars .t i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
