/* =====================================================================
   Đa Sàn — lớp giao diện "sang" (luxe)
   Nạp SAU style.css / refinement.css / app.css nên chỉ cần ghi đè.
   Nguyên tắc: nền giấy ấm, chữ mực, cam Shopee chỉ dùng làm điểm nhấn,
   số liệu dùng chữ số đều cột (tabular) cho dễ so, viền mảnh + bóng rất nhẹ.
   Đợt này: vỏ app (menu trái, đầu trang, tiêu đề) + màn Tổng quan.
   ===================================================================== */

:root {
  --bg: #f5f4f0;
  --card: #ffffff;
  --text: #16171b;
  --ink: #141519;
  --muted: #86878e;
  --faint: #b3b3b8;
  --line: #e8e6e0;
  --line-soft: #f0eee9;
  --orange: #e8492a;
  --orange-2: #ff7a55;
  --soft: #fcefe9;
  --green: #17794f;
  --green-bg: #e9f4ee;
  --red: #c8392c;
  --red-bg: #fbecea;
  --amber: #a86a12;
  --amber-bg: #faf1e2;
  --radius: 20px;
  --radius-sm: 12px;
  --sh-1: 0 1px 0 rgba(20, 21, 25, .02), 0 1px 3px rgba(20, 21, 25, .04);
  --sh-2: 0 1px 2px rgba(20, 21, 25, .04), 0 12px 32px -14px rgba(20, 21, 25, .16);
  --serif: 'Be Vietnam Pro', sans-serif;
}
body.dark {
  --bg: #0e0f12;
  --card: #16171b;
  --text: #f1f0ec;
  --ink: #1b1c21;
  --muted: #8e8f96;
  --faint: #5d5e66;
  --line: #26272d;
  --line-soft: #1f2025;
  --soft: #2b1b16;
  --green: #4cc28f;
  --green-bg: #16271f;
  --red: #f0766a;
  --red-bg: #2c1a18;
  --amber: #e2a954;
  --amber-bg: #2a2216;
  --sh-1: 0 1px 0 rgba(0, 0, 0, .2);
  --sh-2: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 40px -18px rgba(0, 0, 0, .7);
}

body { background: var(--bg); color: var(--text); font-feature-settings: 'ss01', 'cv11'; letter-spacing: -.005em; }
::selection { background: #e8492a33; }

/* Số liệu: đều cột để các con số thẳng hàng khi so */
.hero-value, .stat-tile strong, .chart-total b, .shopstats b, .roas, .wallet, .attention-count, .bestseller b, .count { font-variant-numeric: tabular-nums; }

/* ---------- Nút & ô chọn chung ---------- */
button { border-radius: var(--radius-sm); }
button:hover { border-color: var(--text); color: var(--text); }
button.primary { background: var(--ink); border-color: var(--ink); }
button.primary:hover { background: #000; color: #fff; }
body.dark button.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
select, .filters select {
  -webkit-appearance: none; appearance: none;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='m1 1 4 4 4-4' stroke='%2386878e' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  padding-right: 36px; border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--sh-1);
  font-size: 13px; font-weight: 500; color: var(--text); min-height: 40px; cursor: pointer;
}
.filters select { padding: 10px 38px 10px 16px; }
select:hover { border-color: var(--faint); }

/* ---------- Menu trái ---------- */
aside { background: var(--bg); border-right: 1px solid var(--line); padding: 26px 16px 18px; }
body.dark aside { background: var(--bg); border-color: var(--line); }
.brand { font-family: var(--serif); font-weight: 500; font-size: 22px; letter-spacing: -.02em; padding-left: 6px; gap: 10px; white-space: nowrap; }
.brand .mini { flex-basis: 100%; } /* dòng chữ nhỏ "QUẢN LÝ SHOP" xuống dưới, tên SellerMulti nằm cùng dòng với logo */
.brandmark {
  position: relative; width: 38px; height: 38px; line-height: 38px; border-radius: 11px;
  background: var(--ink); color: #fff; font-family: var(--serif); font-size: 20px; font-weight: 500;
  box-shadow: 0 6px 16px -6px rgba(20, 21, 25, .5);
}
.brandmark::after { content: ''; position: absolute; right: 6px; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
body.dark .brandmark { background: #f1f0ec; color: #0e0f12; }
.mini { font-family: 'Be Vietnam Pro', sans-serif; font-size: 8.5px; letter-spacing: .28em; font-weight: 600; padding-left: 50px; margin-top: -8px; color: var(--faint); }
.workspace { margin: 26px 0 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; box-shadow: var(--sh-1); }
body.dark .workspace { background: var(--card); }
.workspace .avatar, body.dark .workspace .avatar { background: var(--ink); color: #fff; border-radius: 9px; width: 32px; height: 32px; font-size: 10.5px; letter-spacing: .04em; }
body.dark .workspace .avatar { background: #2a2b31; }
.workspace b { font-size: 13px; }
.workspace small { font-size: 11px; line-height: 1.4; }
.navgroup { font-size: 10px; letter-spacing: .16em; font-weight: 600; color: var(--faint); margin: 22px 0 6px 12px; }
aside nav button {
  min-height: 38px; padding: 8px 12px; margin-bottom: 2px; gap: 11px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; color: var(--muted); border: 1px solid transparent;
}
aside nav button .icon { width: 18px; }
aside nav button .icon svg { width: 18px; height: 18px; }
aside nav button:hover { background: var(--line-soft); color: var(--text); border-color: transparent; }
aside nav button.active, body.dark aside nav button.active {
  background: var(--card); color: var(--text); border-color: var(--line); box-shadow: var(--sh-1);
}
aside nav button.active .icon { color: var(--orange); }
.sidebottom > button { font-size: 13px; color: var(--muted); padding: 8px 12px; min-height: 36px; border: 0; }
.sidebottom > button:hover { background: var(--line-soft); color: var(--text); }
.owner { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 8px; }
.owner .avatar { background: var(--line-soft); color: var(--text); }
.owner button { color: var(--muted); }

/* ---------- Đầu trang ---------- */
header {
  position: sticky; top: 0; z-index: 15; height: 60px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent;
}
.breadcrumb { font-size: 12.5px; }
.breadcrumb span { color: var(--faint); }
.headright button { color: var(--muted); border-radius: 10px; }
.headright button:hover { background: var(--line-soft); color: var(--text); }
.headright .avatar { background: var(--ink); color: #fff; width: 30px; height: 30px; font-size: 10px; }
body.dark .headright .avatar { background: #2a2b31; }

main { padding-top: 18px; }
.heading { align-items: flex-end; margin-bottom: 28px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 10.5px; letter-spacing: .18em; font-weight: 600; color: var(--muted); }
.eyebrow::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px #e8492a22; }
h1 { font-family: var(--serif); font-weight: 500; font-size: 42px; letter-spacing: -.025em; line-height: 1.1; margin: 10px 0 6px; font-style: normal; }
.heading p { font-size: 14px; color: var(--muted); }
h2 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }

/* =====================================================================
   MÀN TỔNG QUAN
   ===================================================================== */
.overview-top { grid-template-columns: minmax(0, 1.2fr) minmax(0, 2.2fr); gap: 16px; margin-bottom: 16px; }

/* Thẻ lãi: nền mực, quầng cam mờ, số lớn */
.profit-hero {
  isolation: isolate; background: var(--ink); color: #f5f4f0; border-radius: var(--radius); padding: 24px 26px 22px;
  min-height: 236px; display: flex; flex-direction: column; box-shadow: 0 24px 48px -28px rgba(20, 21, 25, .6);
  border: 1px solid rgba(255, 255, 255, .04);
}
.profit-hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(232, 73, 42, .38), transparent 55%),
    radial-gradient(80% 60% at 0% 100%, rgba(255, 122, 85, .10), transparent 60%);
}
.profit-hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 28px 28px; mask-image: linear-gradient(180deg, #000, transparent 85%); -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%);
}
body.dark .profit-hero { background: linear-gradient(160deg, #1d1e24, #141519); border-color: #2a2b31; }
.hero-top { font-size: 12.5px; color: rgba(245, 244, 240, .7); font-weight: 500; }
.hero-top svg { width: 17px; height: 17px; color: var(--orange-2); }
.hero-period { font-size: 11px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .05); color: #f5f4f0; padding: 5px 11px; border-radius: 999px; }
.hero-value { font-size: 50px; font-weight: 600; letter-spacing: -.035em; line-height: 1; margin: 26px 0 10px; color: #fff; }
.hero-value.neg { color: #ffb4a1; }
.hero-note { font-size: 11.5px; color: rgba(245, 244, 240, .5); opacity: 1; line-height: 1.5; max-width: 360px; }
.hero-growth { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 11.5px; color: rgba(245, 244, 240, .55); }
.hero-growth > span:not(.delta) { background: none; padding: 0; color: inherit; font-weight: 400; margin: 0; }
.hero-bottom { margin-top: auto; padding-top: 18px; font-size: 12px; color: rgba(245, 244, 240, .6); }
.hero-bottom b { color: #fff; font-size: 13px; }
.hero-bottom button {
  width: 36px; height: 36px; border-radius: 50%; background: #f5f4f0; color: var(--ink); border: 0; padding: 0;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), background .2s;
}
.hero-bottom button:hover { transform: rotate(45deg); background: var(--orange); color: #fff; }
.hero-bottom button svg { width: 16px; height: 16px; }
.hero-curve { position: absolute; z-index: -1; left: 0; right: 0; bottom: 0; width: auto; height: 70px; opacity: .35; transform: none; }
.hero-curve svg { width: 100%; height: 100%; display: block; }

/* Chip tăng/giảm dùng chung */
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--green); background: var(--green-bg); }
.delta.down { color: var(--red); background: var(--red-bg); }
.delta.flat { color: var(--faint); background: none; padding: 3px 0; }
.profit-hero .delta.up { color: #7fe0b1; background: rgba(76, 194, 143, .14); }
.profit-hero .delta.down { color: #ffb4a1; background: rgba(255, 122, 85, .16); }
.profit-hero .delta.flat { color: rgba(245, 244, 240, .5); background: none; padding: 0; }

/* 3 thẻ số */
.stat-stack { gap: 16px; }
.stat-tile {
  position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  padding: 20px 20px 16px; box-shadow: var(--sh-1); transition: box-shadow .25s, transform .25s, border-color .25s;
}
.stat-tile:hover { box-shadow: var(--sh-2); transform: translateY(-2px); border-color: transparent; }
.stat-top { gap: 10px; font-size: 12.5px; font-weight: 500; color: var(--muted); flex-wrap: nowrap; }
.stat-top > .stat-ico, body.dark .stat-top > .stat-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--line-soft); color: var(--text); display: grid; place-items: center; }
.stat-ico svg { width: 16px; height: 16px; }
.stat-top label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-tile strong { font-size: 30px; font-weight: 600; letter-spacing: -.03em; margin: 26px 0 6px; line-height: 1.1; }
.stat-baseline { align-items: flex-end; margin: 0 -20px -16px; padding: 0 0 0 20px; }
.stat-baseline small { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 11px; line-height: 1.3; color: var(--faint); padding-bottom: 16px; max-width: none; min-width: 0; flex: none; }
.stat-baseline svg { flex: 1; width: auto; max-width: none; height: 58px; margin-left: 8px; display: block; }

/* Nhịp bán hàng + Cần chú ý */
.overview-middle { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 16px; margin-bottom: 40px; }
.panel { border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); box-shadow: var(--sh-1); padding: 24px; }
.sectionhead p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.chart-total b { font-size: 32px; letter-spacing: -.03em; }
.chart-total span { font-size: 12.5px; }
.activity .chart {
  height: 168px; gap: 6px; padding-top: 12px; border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to top, transparent 0, transparent 41px, var(--line-soft) 41px, var(--line-soft) 42px);
}
.activity .bar, .activity .bar:nth-child(n+15):nth-child(-n+19) { background: #e9e6df; border-radius: 6px 6px 2px 2px; transition: background .2s, opacity .2s; }
body.dark .activity .bar, body.dark .activity .bar:nth-child(n+15):nth-child(-n+19) { background: #2a2b31; }
.activity .bar.peak, body.dark .activity .bar.peak { background: linear-gradient(180deg, var(--orange-2), var(--orange)); }
.activity .chart:hover .bar { opacity: .55; }
.activity .chart .bar:hover { opacity: 1; background: var(--text); }
.chartlabels { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.activity-foot { font-size: 12px; border-top: 0; padding-top: 12px; margin-top: 6px; }
.activity-foot .dot { background: var(--orange); }

.attention-panel, body.dark .attention-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--sh-1); display: flex; flex-direction: column; }
.attention-panel .sectionhead { margin-bottom: 8px; }
.attention-count, body.dark .attention-count { width: auto; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--line-soft); color: var(--muted) !important; font-weight: 600; font-size: 12px !important; }
.attention-count.hot, body.dark .attention-count.hot { background: var(--orange); color: #fff !important; }
.attention-item, body.dark .attention-item {
  gap: 14px; padding: 13px 10px; margin: 0 -10px; width: calc(100% + 20px); border: 0; border-radius: 12px; border-bottom: 0;
  position: relative;
}
.attention-item + .attention-item::before { content: ''; position: absolute; left: 10px; right: 10px; top: 0; height: 1px; background: var(--line-soft); }
.attention-item:hover { background: var(--line-soft); color: var(--text); }
.attention-item:hover::before, .attention-item:hover + .attention-item::before { opacity: 0; }
.attention-item b { font-size: 13.5px; font-weight: 600; }
.attention-item p { font-size: 12px; margin-top: 2px; line-height: 1.45; }
.notice-icon, body.dark .notice-icon { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px var(--red-bg); margin: 0 4px 0 2px; }
.notice-icon.amber, body.dark .notice-icon.amber { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-bg); }
.attention-item .go { margin-left: auto; color: var(--faint); transition: transform .2s, color .2s; }
.attention-item:hover .go { transform: translateX(3px); color: var(--text); }
.attention-note { font-size: 13px; margin: auto; padding: 24px 0; text-align: center; }

/* Toàn cảnh các shop */
.shop-section .sectionhead { align-items: flex-end; margin-bottom: 16px; }
.shop-section .sectionhead h2, .bestsellers .sectionhead h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; letter-spacing: -.02em; }
.shop-section .sectionhead p { font-size: 12.5px; margin-top: 6px; }
.count { font-family: 'Be Vietnam Pro', sans-serif; vertical-align: middle; font-size: 11px !important; font-weight: 600; border: 0; background: var(--line-soft); color: var(--muted) !important; padding: 3px 8px; border-radius: 999px; margin-left: 8px; }
.sort-label { font-size: 12px !important; color: var(--muted); }
.shopgrid { gap: 16px; }
.shopcard, body.dark .shopcard { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: var(--card); box-shadow: var(--sh-1); position: relative; overflow: hidden; }
.shopcard:hover { box-shadow: var(--sh-2); border-color: transparent; }
.shopcard.attention, body.dark .shopcard.attention { border-color: var(--line); }
.shopcard.attention::before { content: ''; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--red), var(--orange-2)); }
.shoplogo, body.dark .shoplogo { width: 36px; height: 36px; border-radius: 11px; background: var(--ink); color: #fff; font-family: var(--serif); font-size: 17px; font-weight: 500; }
body.dark .shoplogo { background: #2a2b31; }
.shophead h3 { font-size: 14.5px; font-weight: 600; }
.shophead .status, .status { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; color: var(--green); background: var(--green-bg); }
.status.loss { color: var(--red); background: var(--red-bg); }
.status.idle { color: var(--muted); background: var(--line-soft); }
.shopstats { align-items: end; } /* nhãn "Chi quảng cáo (chưa VAT)" xuống 2 dòng trên màn hẹp: số 3 ô vẫn thẳng hàng */
.shopstats small { font-size: 11px; color: var(--muted); }
.shopstats b { font-size: 20px; letter-spacing: -.02em; }
.roas { font-size: 12px; margin-top: 20px; align-items: baseline; }
.shopcard .track { height: 4px; margin: 10px 0 14px; background: var(--line-soft); border-radius: 99px; }
.shopcard .track i { background: var(--green); border-radius: 99px; }
.shopcard.attention .track i { background: linear-gradient(90deg, var(--red), var(--orange-2)); }
.wallet { font-size: 12px; }
.advice, .attention .advice { font-size: 12px; font-weight: 500; padding: 10px 12px; border-radius: 10px; margin-top: 16px; background: var(--green-bg); color: var(--green); }
.shopcard.attention .advice { background: var(--red-bg); color: var(--red); }

/* Bán chạy */
.bestsellers { margin-top: 40px; padding: 26px; }
.bestseller-grid { gap: 16px; }
.product-photo, body.dark .product-photo { height: 170px; border-radius: 14px; background: var(--line-soft); }
.product-photo:empty, .product-photo:not(:has(img)) { background: linear-gradient(135deg, var(--line-soft), var(--bg)); }
.product-photo > .rank {
  left: 10px; top: 8px; background: none; padding: 0; border-radius: 0; font-family: var(--serif); font-size: 28px; font-weight: 400;
  color: var(--text); opacity: .85; letter-spacing: -.02em; font-variant-numeric: lining-nums;
}
.product-photo:has(img) > .rank { color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .35); }
.bestseller h3 { font-size: 13px; font-weight: 600; margin-top: 12px; }
.bestseller > div:last-child { font-size: 11.5px; margin-top: 6px; align-items: center; }
.bestseller > div:last-child > span { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bestseller b { font-size: 11px; font-weight: 600; color: var(--text); background: var(--line-soft); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.empty { color: var(--muted); font-size: 13px; }

/* Vào trang: các khối hiện dần, rất nhẹ */
@media (prefers-reduced-motion: no-preference) {
  .overview-top > *, .overview-middle > *, .shop-section, .bestsellers { animation: luxe-rise .5s cubic-bezier(.2, .8, .2, 1) both; }
  .stat-stack > :nth-child(1) { animation: luxe-rise .5s .04s cubic-bezier(.2, .8, .2, 1) both; }
  .stat-stack > :nth-child(2) { animation: luxe-rise .5s .08s cubic-bezier(.2, .8, .2, 1) both; }
  .stat-stack > :nth-child(3) { animation: luxe-rise .5s .12s cubic-bezier(.2, .8, .2, 1) both; }
  .overview-middle > * { animation-delay: .1s; }
  .shop-section { animation-delay: .14s; }
  .bestsellers { animation-delay: .18s; }
  .stat-stack { animation: none !important; }
}
@keyframes luxe-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Màn vừa ---------- */
@media (max-width: 1200px) {
  .overview-top { grid-template-columns: 1fr; }
  .profit-hero { min-height: 220px; }
  .hero-value { font-size: 46px; }
  .hero-curve { left: 35%; }
  .overview-middle { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .overview-middle { grid-template-columns: 1fr; }
  .bestseller-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Điện thoại ---------- */
@media (max-width: 700px) {
  header { height: 56px; padding: 0 16px; }
  main { padding: 10px 16px 104px; }
  h1 { font-size: 34px; }
  .heading { margin-bottom: 20px; }
  .filters { margin-top: 16px; }
  .filters select { font-size: 13px; padding: 10px 34px 10px 14px; }
  .profit-hero { padding: 20px; min-height: 220px; border-radius: 18px; }
  .hero-value { font-size: 40px; margin-top: 20px; }
  .hero-curve { left: 0; bottom: 56px; height: 70px; }
  /* 3 thẻ số gộp thành 1 thẻ, mỗi số 1 dòng: số tiền dài không bị cắt */
  .stat-stack { grid-template-columns: 1fr; gap: 0; margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh-1); padding: 4px 16px; }
  .stat-tile, .stat-tile:hover { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; min-height: 0; padding: 12px 0; border: 0; border-radius: 0; box-shadow: none; transform: none; background: none; }
  .stat-tile + .stat-tile { border-top: 1px solid var(--line-soft); }
  .stat-top { font-size: 13px; }
  .stat-top > .stat-ico { display: grid; width: 28px; height: 28px; }
  .stat-tile strong { font-size: 18px; margin: 0 0 0 auto; }
  .stat-baseline { display: none; }
  .overview-middle { gap: 12px; margin-bottom: 28px; }
  .panel, .attention-panel, body.dark .attention-panel { padding: 18px; border-radius: 18px; }
  .activity .chart { height: 130px; gap: 3px; }
  .activity .bar { border-radius: 3px 3px 1px 1px; }
  .chartlabels { font-size: 10px; }
  .shop-section .sectionhead h2, .bestsellers .sectionhead h2 { font-size: 21px; }
  .bestsellers { padding: 18px; margin-top: 28px; }
  .bestseller-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .product-photo { height: 150px; }

  .bottomnav, body.dark .bottomnav {
    background: color-mix(in srgb, var(--ink) 92%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, .08); border-radius: 22px; box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .55);
  }
  .bottomnav button { color: rgba(245, 244, 240, .55); border: 0; background: transparent; }
  .bottomnav button.active, body.dark .bottomnav button.active { color: #fff; background: rgba(255, 255, 255, .08); }
  .bottomnav button.active .icon { color: var(--orange-2); }
}

/* =====================================================================
   CÁC MÀN KHÁC — Đơn hàng, Chuẩn bị hàng, Tiền & lãi, Giá vốn,
   Quảng cáo, Sản phẩm, Tin nhắn, Liên kết sàn, Đăng nhập
   ===================================================================== */

/* ---------- Ô nhập ---------- */
input, textarea { font: inherit; }
input[type=search], input[type=text], input[type=password], input[type=number], input[type=date], textarea, .formfield input {
  background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm);
  min-height: 40px; padding: 9px 14px; font-size: 13.5px; box-shadow: var(--sh-1); transition: border-color .2s, box-shadow .2s;
}
input[type=search] { border-radius: 999px; padding-left: 16px; }
input:hover, textarea:hover { border-color: var(--faint); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px rgba(20, 21, 25, .07); }
body.dark input:focus, body.dark textarea:focus, body.dark select:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, .08); }
input[type=date] { font-variant-numeric: tabular-nums; }
body.dark input[type=date]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .6; }
input[type=file] { font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-size: 13px; font-weight: 500; margin-right: 10px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
input[type=checkbox] { accent-color: var(--ink); }
body.dark input[type=checkbox] { accent-color: #f1f0ec; }

/* Nút: viền mảnh, bo tròn hẳn trong thanh công cụ */
.toolbar button, .toolbar.salework button, .toolbar select, .toolbar.salework select { border-radius: 999px; min-height: 38px; padding: 8px 16px; font-size: 13px; font-weight: 500; box-shadow: var(--sh-1); }
.toolbar.salework select { padding-right: 36px; }
button.primary:disabled, button:disabled { opacity: .4; }
.linkbutton, .sectionhead button { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }
a[href]:not([data-go]):not(.brand) { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }

/* ---------- Tab trạng thái đơn ---------- */
.tabs.salework { gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs.salework button { font-size: 13.5px; font-weight: 500; padding: 10px 14px 12px; border-radius: 0; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; box-shadow: none; }
.tabs.salework button:hover { color: var(--text); }
.tabs.salework button.selected { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.tabs.salework .t-cancel { color: var(--red); } .tabs.salework .t-return { color: var(--amber); } .tabs.salework .t-done { color: var(--green); }
.tabs.salework button.selected.t-cancel { border-bottom-color: var(--red); } .tabs.salework button.selected.t-return { border-bottom-color: var(--amber); } .tabs.salework button.selected.t-done { border-bottom-color: var(--green); }

/* ---------- Bảng ---------- */
.tablewrap, .dense .tablewrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--sh-1); }
table { font-variant-numeric: tabular-nums; }
th, .dense th { background: var(--card); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px solid var(--line); padding: 13px 12px; }
td { border-bottom: 1px solid var(--line-soft); }
tbody tr:last-child td { border-bottom: 0; }
.dense td { padding: 12px; border-bottom: 1px solid var(--line-soft); }
.dense tbody tr { transition: background .15s; }
.dense tbody tr:hover td { background: color-mix(in srgb, var(--line-soft) 60%, transparent); }
.dense tr.checked td, .dense tr.checked:hover td { background: var(--soft); }
.dense .sn { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.dense .sku { color: var(--text); font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11.5px; font-weight: 600; background: var(--line-soft); padding: 2px 7px; border-radius: 6px; display: inline-block; }
.dense .item span { color: var(--text); }
.dense .item img { border-radius: 8px; width: 34px; height: 34px; }
.st { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--line-soft); color: var(--muted); }
.st.new { background: #eef0ff; color: #3d4fc4; } .st.waiting, .st.done { background: var(--green-bg); color: var(--green); }
.st.shipping { background: var(--amber-bg); color: var(--amber); } .st.return { background: var(--amber-bg); color: #b4531a; } .st.cancel { background: var(--red-bg); color: var(--red); }
body.dark .st.new { background: #1c2040; color: #9aa7ff; }
.express { color: var(--orange); font-weight: 600; letter-spacing: .02em; }
.pager { font-size: 12.5px; color: var(--muted); padding: 14px 4px; }
.pager button { border-radius: 999px; min-width: 34px; min-height: 34px; padding: 6px 12px; }
.actionbar.salework { background: var(--ink); color: #f5f4f0; border-radius: 16px; padding: 10px 12px 10px 18px; box-shadow: 0 20px 40px -18px rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .06); }
.actionbar.salework button { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); color: #fff; border-radius: 999px; }
.actionbar.salework button:hover { background: rgba(255, 255, 255, .16); }
.actionbar.salework button.primary { background: #f5f4f0; color: var(--ink); border-color: #f5f4f0; }
.actionbar.salework button.primary:hover { background: var(--orange); border-color: var(--orange); color: #fff; }
body.dark .actionbar.salework { background: #22232a; }

/* ---------- Chuẩn bị hàng ---------- */
.prepare { gap: 16px; }
.prepare .shoplist, .prepare .side { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--sh-1); }
.prepare .shoplist { padding: 6px; }
.prepare .shoplist button { border-radius: 10px; padding: 10px 12px; font-weight: 500; color: var(--muted); }
.prepare .shoplist button:hover { background: var(--line-soft); color: var(--text); }
.prepare .shoplist button.selected { background: var(--ink); color: #fff; }
body.dark .prepare .shoplist button.selected { background: #f1f0ec; color: #0e0f12; }
.prepare .side { padding: 18px; gap: 12px; }
.prepare .side b { font-size: 14px; }
.prepare .side .primary { border-radius: 14px; padding: 14px; font-weight: 600; }
.modeswitch { border-radius: 999px; padding: 3px; background: var(--line-soft); border: 1px solid var(--line); }
.modeswitch button { border-radius: 999px; background: transparent; padding: 7px 16px; font-weight: 500; color: var(--muted); }
.modeswitch button.selected { background: var(--card); color: var(--text); box-shadow: var(--sh-1); }

/* ---------- Tiền & lãi ---------- */
.summary { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; font-size: 13px; box-shadow: var(--sh-1); }
.summary .sync { font-size: 12px; color: var(--muted); }
.summary .sync button { border-radius: 999px; padding: 6px 12px; font-size: 12px; margin-left: 6px; }
.moneygrid { gap: 16px; }
.moneygrid .metric { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 22px; box-shadow: var(--sh-1); }
.moneygrid .metric label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.moneygrid .metric strong { font-size: 30px; font-weight: 600; letter-spacing: -.03em; margin: 18px 0 6px; font-variant-numeric: tabular-nums; }
.moneygrid .metric small { font-size: 11.5px; color: var(--faint); }
.moneygrid .profit { background: var(--ink); border-color: var(--ink); color: #f5f4f0; position: relative; overflow: hidden; }
.moneygrid .profit::before { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 90% at 100% 0%, rgba(232, 73, 42, .35), transparent 55%); pointer-events: none; }
.moneygrid .profit label, .moneygrid .profit small, .moneygrid .profit small em { color: rgba(245, 244, 240, .6); }
.moneygrid .profit strong { color: #fff; }
body.dark .moneygrid .profit { background: linear-gradient(160deg, #1d1e24, #141519); border-color: #2a2b31; }
.panel.wide, .wide { margin-top: 16px; }
.linechart { height: 220px; }
.lower { gap: 16px; margin-top: 16px; }
.toprow { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.toprow b { font-size: 13px; }
.toprow small { font-size: 11.5px; }
.toprow > strong { font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- Quảng cáo ---------- */
.adscard .adsinput { font-size: 12px; color: var(--muted); }
.adscard .adsinput input { width: 84px; min-height: 34px; padding: 6px 10px; text-align: right; }
.adscard button { border-radius: 12px; font-weight: 500; }
.syncline { font-size: 11.5px; color: var(--faint); margin-top: 10px; }
.chart .bar { background: #e9e6df; border-radius: 6px 6px 2px 2px; }
body.dark .chart .bar { background: #2a2b31; }
.chart .bar:hover { background: var(--orange); }

/* ---------- Sản phẩm ---------- */
.productgrid { gap: 16px; }
.productcard { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--sh-1); overflow: hidden; transition: box-shadow .25s, transform .25s, border-color .25s; }
.productcard:hover { box-shadow: var(--sh-2); transform: translateY(-2px); border-color: transparent; }
.productcard .product-photo { border-radius: 0; height: 220px; }
.productcard > div { padding: 16px 18px 18px; }
.productcard h3 { font-size: 14px; font-weight: 600; line-height: 1.4; }
.productcard p { font-size: 12px; color: var(--muted); }

/* ---------- Tin nhắn ---------- */
.chatgrid { gap: 16px; }
.chatgrid > .panel { padding: 0; }
.chatlist .toolbar, .chatlist .chipline { padding: 0 14px; }
.chatlist > :first-child { padding-top: 14px; }
.conv { padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.conv:hover { background: var(--line-soft); color: var(--text); }
.conv.active { background: var(--line-soft); box-shadow: inset 2px 0 0 var(--orange); }
.conv b { font-size: 13.5px; }
.conv .unreadbadge { background: var(--orange); }
.chip { border-radius: 999px; font-size: 12px; font-weight: 500; padding: 5px 12px; box-shadow: none; }
.chip.selected, body.dark .chip.selected { background: var(--ink); color: #fff; border-color: var(--ink); }
body.dark .chip.selected { background: #f1f0ec; color: #0e0f12; border-color: #f1f0ec; }
.chatthread { padding: 16px !important; }
.chatside { padding: 16px !important; }
.threadhead { padding-bottom: 12px; }
.bubble { border-radius: 18px; padding: 9px 14px; font-size: 14px; line-height: 1.45; }
.bubble.them { background: var(--line-soft); border: 0; border-bottom-left-radius: 6px; }
.bubble.me { background: var(--ink); color: #f5f4f0; border-bottom-right-radius: 6px; }
body.dark .bubble.me { background: #f1f0ec; color: #0e0f12; }
.composer { padding-top: 12px; border-top: 1px solid var(--line-soft); }
.composer textarea { border-radius: 16px; }
.composer button.primary { border-radius: 999px; }
.quota { border-radius: 999px; font-size: 11.5px; }

/* ---------- Liên kết sàn ---------- */
.connection { padding: 18px 4px; border-bottom: 1px solid var(--line-soft); }
.connection:last-child { border-bottom: 0; }
.connection b { font-size: 14px; }
.connection button { border-radius: 999px; }

/* ---------- Đăng nhập ---------- */
.loginmode main { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.loginmode #content { width: 100%; }
.login, .panel.login {
  max-width: 400px; margin: 0 auto; padding: 40px 36px; border-radius: 24px; border: 1px solid var(--line); background: var(--card);
  box-shadow: 0 30px 60px -30px rgba(20, 21, 25, .25);
}
.login .brand { justify-content: center; margin-bottom: 28px; }
.login .brand .mini { display: none; }
.login h2 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.login input { width: 100%; }
.login button.primary { border-radius: 14px; padding: 14px; font-weight: 600; margin-top: 6px; }

/* ---------- Hộp thoại & thông báo ---------- */
dialog { border: 1px solid var(--line); border-radius: 24px; padding: 26px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .45); }
dialog::backdrop { background: rgba(14, 15, 18, .45); backdrop-filter: blur(6px); }
.dialoghead h2 { font-size: 18px; }
.dialoghead button { border-radius: 999px; width: 34px; height: 34px; padding: 0; display: grid; place-items: center; color: var(--muted); }
.dialogactions button { border-radius: 999px; padding: 10px 20px; font-weight: 500; }
#toast { background: var(--ink); color: #f5f4f0; border-radius: 14px; font-size: 13px; font-weight: 500; box-shadow: 0 20px 40px -16px rgba(0, 0, 0, .5); border: 1px solid rgba(255, 255, 255, .06); }
#toast.err { background: var(--red); }
body.dark #toast { background: #f1f0ec; color: #0e0f12; }
body.dark #toast.err { background: var(--red); color: #fff; }

/* Các màn khác cũng hiện dần nhẹ */
@media (prefers-reduced-motion: no-preference) {
  #content > * { animation: luxe-rise .45s cubic-bezier(.2, .8, .2, 1) both; }
  #content > :nth-child(2) { animation-delay: .04s; } #content > :nth-child(3) { animation-delay: .08s; } #content > :nth-child(n+4) { animation-delay: .12s; }
}

@media (max-width: 900px) {
  .dense tbody tr, .dense tr { border-radius: 16px; box-shadow: var(--sh-1); border-color: var(--line); }
  .dense tbody tr:hover td { background: none; }
  .prepare .shoplist { gap: 4px; }
  .prepare .shoplist button.selected { background: var(--ink); }
}
@media (max-width: 700px) {
  .moneygrid .metric { padding: 16px; }
  .moneygrid .metric strong { font-size: 21px; margin: 12px 0 4px; }
  .actionbar.salework { bottom: 96px; }
  .login, .panel.login { padding: 30px 22px; }
}
/* Chuẩn bị hàng: cột SKU hẹp → SKU không làm "viên thuốc", xuống dòng tự nhiên */
.prepare.dense .sku { display: block; background: none; padding: 0; border-radius: 0; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
td { padding-top: 12px; padding-bottom: 12px; }
td input[type=number] { min-height: 36px; padding: 7px 12px; }
@media (max-width: 700px) {
  /* Dòng tóm tắt: chữ trên, nút đồng bộ xuống dưới — không bóp nút thành cột */
  .summary { flex-direction: column; align-items: flex-start; gap: 10px; line-height: 1.6; }
  .summary .sync { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .summary .sync button { white-space: nowrap; margin-left: 0; }
}
@media (max-width: 900px) {
  .dense td, .prepare.dense td { border-bottom: 0; }
  .prepare.dense th.skucol, .prepare.dense td.skucol { width: auto; }
}

/* ===== Cố vấn ===== */
.advtabs { margin-top: 0; }
.advwarn { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0 12px; font-size: 13px; }
.advrun { align-items: center; gap: 12px; margin: 8px 0; }
.advsum, .advlist { margin-top: 16px; }
.advsum ul { margin: 6px 0 0 18px; padding: 0; }
.advcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--sh-1); padding: 14px 16px; margin: 10px 0; overflow-wrap: anywhere; }
.advhead { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.advkind { font-size: 11px; color: var(--muted); white-space: nowrap; }
.advreason { margin: 6px 0; color: var(--muted); font-size: 14px; }
.advmeta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.advmoney { font-weight: 600; color: var(--orange); }
.advwho { background: var(--soft); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.factline { margin: 6px 0; }
.factchip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.advgrades { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.advnote { width: 100%; box-sizing: border-box; resize: vertical; }
.advpersonhead { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.advtrend { display: block; color: var(--muted); }
.advdropped { display: block; color: var(--muted); font-size: 12px; }
.advgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 8px 0 14px; }
.advgrid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.advrules { width: 100%; box-sizing: border-box; }
.advrow { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.advswitch { display: flex; gap: 10px; align-items: center; }
.advstaff { border-bottom: 1px solid var(--line); padding: 10px 0; }
.advstaff input[name=name] { width: 100%; box-sizing: border-box; }
.shopick { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.advlist h3, .advsum h3 { margin: 0; }

/* Điện thoại: iPhone tự phóng to khi bấm vào ô có chữ < 16px rồi không thu lại → ô nhập luôn 16px trên màn chạm.
   Không phần nào được rộng hơn màn hình (rộng hơn là máy tự thu nhỏ cả trang); bảng rộng thì cuộn ngang trong khung của nó. */
@media (hover: none) and (pointer: coarse), (max-width: 760px) {
  input, select, textarea { font-size: 16px !important; }
}
html, body { max-width: 100%; overflow-x: hidden; }
