:root{
  --bg:#f4f7fb;
  --surface:#ffffff;
  --surface-2:#f8fafc;
  --text:#111827;
  --muted:#64748b;
  --line:#e2e8f0;
  --primary:#2563eb;
  --primary-dark:#1d4ed8;
  --green:#0f766e;
  --amber:#d97706;
  --red:#dc2626;
  --shadow:0 16px 35px rgba(15,23,42,.08);
  --radius:22px;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color:var(--text);
  background:var(--bg);
}
.app-shell{display:grid;grid-template-columns:300px minmax(0,1fr);min-height:100vh}
.sidebar{
  position:sticky;top:0;height:100vh;
  background:#0f172a;color:#fff;padding:26px 22px;
  display:flex;flex-direction:column;gap:26px;
}
.brand{display:flex;gap:14px;align-items:center}
.brand-mark{
  width:52px;height:52px;border-radius:16px;
  background:linear-gradient(135deg,#3b82f6,#14b8a6);
  display:grid;place-items:center;font-weight:900;
  box-shadow:0 16px 25px rgba(0,0,0,.25);
}
.brand h1{font-size:20px;margin:0}
.brand p{font-size:12px;line-height:1.5;margin:4px 0 0;color:#cbd5e1}
.nav{display:grid;gap:8px}
.nav-link{
  color:#cbd5e1;text-decoration:none;padding:12px 14px;border-radius:14px;font-weight:700;font-size:14px;
}
.nav-link:hover,.nav-link.active{background:rgba(255,255,255,.1);color:#fff;text-decoration:none}
.side-card{
  margin-top:auto;background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.1);border-radius:18px;padding:16px;
}
.side-card p{font-size:12px;line-height:1.55;color:#cbd5e1;margin:8px 0 0}
.content{padding:28px;max-width:1480px;width:100%;margin:0 auto}
.hero,.section,.panel,.kpi{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.hero{
  padding:34px;display:flex;justify-content:space-between;gap:24px;align-items:center;
  background:radial-gradient(circle at 85% -20%,rgba(37,99,235,.18),transparent 35%),#fff;
}
.eyebrow{margin:0 0 8px;color:var(--primary);text-transform:uppercase;letter-spacing:.12em;font-weight:900;font-size:11px}
h2,h3{margin:0}
.hero h2{font-size:36px;line-height:1.05;max-width:820px}
.muted{color:var(--muted);line-height:1.6}
.hero .muted{max-width:820px}
.btn,.chip,.tab{
  appearance:none;border:1px solid var(--line);background:#fff;color:var(--text);
  padding:12px 16px;border-radius:14px;font-weight:800;cursor:pointer;
}
.btn:hover,.chip:hover,.tab:hover{border-color:#bfdbfe}
.btn.primary{background:var(--primary);border-color:var(--primary);color:#fff}
.btn.primary:hover{background:var(--primary-dark)}
.btn.small{font-size:12px;padding:8px 12px;border-radius:10px}
.hero-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.section{margin-top:24px;padding:24px}
.section-head,.panel-head{display:flex;justify-content:space-between;gap:20px;align-items:center;margin-bottom:18px}
.section-head.compact{margin-bottom:14px}
.import-status{
  padding:10px 14px;border-radius:999px;background:#eff6ff;color:#1d4ed8;font-weight:800;font-size:13px;
}
.upload-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.upload-card{
  min-height:190px;border:2px dashed #cbd5e1;border-radius:22px;background:var(--surface-2);
  display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:22px;cursor:pointer;
  transition:.2s ease;
}
.upload-card:hover,.upload-card.dragover{border-color:var(--primary);background:#eff6ff;transform:translateY(-1px)}
.upload-card input{display:none}
.upload-icon{font-size:36px;margin-bottom:8px}
.upload-card strong{font-size:18px}
.upload-card small{display:block;max-width:420px;color:var(--muted);line-height:1.45;margin:8px 0 12px}
.upload-card em{font-style:normal;color:var(--primary);font-weight:800;font-size:13px}
.tips{margin-top:16px;background:#fffbeb;border:1px solid #fde68a;color:#92400e;padding:14px 16px;border-radius:16px;line-height:1.55}
.filter-actions{display:flex;gap:8px;flex-wrap:wrap}
.chip{font-size:12px;padding:9px 12px}
.filter-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}
label{font-size:12px;color:var(--muted);font-weight:800}
input,select{
  width:100%;margin-top:6px;border:1px solid var(--line);border-radius:12px;padding:12px 12px;background:#fff;color:var(--text);
  font:inherit;font-size:14px;
}
.kpi-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:14px;margin-top:24px}
.kpi{padding:18px}
.kpi span{display:block;color:var(--muted);font-size:12px;font-weight:900;text-transform:uppercase;letter-spacing:.08em}
.kpi strong{display:block;font-size:24px;margin:8px 0 4px;word-break:break-word}
.kpi small{color:var(--muted)}
.kpi.success{border-color:#99f6e4;background:linear-gradient(180deg,#ecfdf5,#fff)}
.chart-grid{display:grid;grid-template-columns:1.1fr .9fr;gap:18px;margin-top:24px}
.panel{padding:22px;min-width:0}
.panel.split{display:grid;grid-template-columns:1fr 1fr;gap:22px}
.table-section{box-shadow:none;border:0;background:transparent;padding:0}
.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:16px;max-height:520px;background:#fff}
table{width:100%;border-collapse:collapse;font-size:13px;min-width:760px}
th,td{padding:11px 12px;border-bottom:1px solid var(--line);text-align:left;vertical-align:top}
th{position:sticky;top:0;background:#f8fafc;z-index:1;color:#334155;font-size:12px;text-transform:uppercase;letter-spacing:.06em}
td.num,th.num{text-align:right;font-variant-numeric:tabular-nums}
tr:hover td{background:#f8fafc}
.badge{display:inline-flex;align-items:center;padding:4px 8px;border-radius:999px;background:#eff6ff;color:#1d4ed8;font-weight:800;font-size:12px}
.badge.green{background:#ecfdf5;color:#047857}
.badge.amber{background:#fffbeb;color:#b45309}
.badge.red{background:#fef2f2;color:#b91c1c}
.tabs{display:flex;gap:8px;margin-bottom:12px}
.tab.active{background:#0f172a;color:#fff;border-color:#0f172a}
.small-text{font-size:12px}
.toast{
  position:fixed;right:22px;bottom:22px;z-index:99;max-width:430px;
  padding:14px 16px;border-radius:16px;background:#0f172a;color:#fff;box-shadow:var(--shadow);display:none;
}
.toast.show{display:block;animation:pop .2s ease}
@keyframes pop{from{transform:translateY(8px);opacity:0}to{transform:translateY(0);opacity:1}}
.empty{
  padding:38px;text-align:center;color:var(--muted);
}
canvas{width:100%;display:block}
@media (max-width:1180px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{position:relative;height:auto}
  .nav{grid-template-columns:repeat(3,1fr)}
  .side-card{margin-top:0}
  .filter-grid{grid-template-columns:repeat(3,1fr)}
  .kpi-grid{grid-template-columns:repeat(3,1fr)}
  .chart-grid,.panel.split,.upload-grid{grid-template-columns:1fr}
}
@media (max-width:720px){
  .content{padding:16px}
  .hero{padding:24px;display:block}
  .hero h2{font-size:28px}
  .hero-actions{justify-content:flex-start;margin-top:16px}
  .nav{grid-template-columns:1fr 1fr}
  .filter-grid,.kpi-grid{grid-template-columns:1fr 1fr}
}
@media (max-width:480px){
  .filter-grid,.kpi-grid{grid-template-columns:1fr}
}

.btn.danger{
  border-color:#fecaca;
  color:#b91c1c;
  background:#fff7f7;
}
.btn.danger:hover{background:#fef2f2;border-color:#fca5a5}
.chart-tooltip{
  position:fixed;
  z-index:120;
  display:none;
  min-width:190px;
  max-width:280px;
  padding:12px 13px;
  border-radius:14px;
  background:#0f172a;
  color:#fff;
  box-shadow:0 18px 45px rgba(15,23,42,.25);
  pointer-events:none;
  font-size:12px;
}
.chart-tooltip.show{display:block}
.chart-tooltip b{
  display:block;
  margin-bottom:8px;
  font-size:13px;
}
.chart-tooltip div{
  display:flex;
  justify-content:space-between;
  gap:18px;
  padding:3px 0;
  border-top:1px solid rgba(255,255,255,.08);
}
.chart-tooltip span{color:#cbd5e1}
.chart-tooltip strong{font-variant-numeric:tabular-nums;text-align:right}
canvas{cursor:crosshair}

/* Layout refinement */
.content{max-width:1560px}
.filter-grid{grid-template-columns:repeat(auto-fit,minmax(170px,1fr))}
.kpi-grid{grid-template-columns:repeat(auto-fit,minmax(185px,1fr));align-items:stretch}
.kpi{position:relative;min-height:128px;transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease}
.kpi:hover{transform:translateY(-2px);border-color:#bfdbfe;box-shadow:0 18px 42px rgba(15,23,42,.12)}
.kpi span{display:flex;align-items:center;gap:6px}
.kpi span i{
  width:17px;height:17px;border-radius:999px;display:inline-grid;place-items:center;
  font-style:normal;font-size:11px;font-weight:900;color:#1d4ed8;background:#dbeafe;
}
.has-tip::after{
  content:attr(data-tooltip);
  position:absolute;left:16px;right:16px;bottom:calc(100% + 10px);
  z-index:50;display:none;padding:11px 12px;border-radius:13px;
  background:#0f172a;color:#fff;box-shadow:0 18px 45px rgba(15,23,42,.28);
  font-size:12px;line-height:1.45;font-weight:700;text-transform:none;letter-spacing:0;
}
.has-tip::before{
  content:"";position:absolute;left:28px;bottom:calc(100% + 3px);display:none;
  border:7px solid transparent;border-top-color:#0f172a;z-index:51;
}
.has-tip:hover::after,.has-tip:focus::after,.has-tip:hover::before,.has-tip:focus::before{display:block}
.made-by{
  color:#cbd5e1;font-size:12px;line-height:1.5;padding:14px 16px;border-radius:16px;
  background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.08);text-align:center;
}
.made-by strong{color:#fff;font-size:14px}
.footer-credit{
  margin:26px 0 8px;text-align:center;color:#64748b;font-size:13px;
}
.footer-credit strong{color:#111827}
.filters{position:relative;z-index:5}
.chart-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
.panel-head h3{line-height:1.25}
@media (max-width:720px){
  .filter-actions{width:100%}
  .chip{flex:1 1 auto}
  .has-tip::after{left:0;right:0;bottom:calc(100% + 8px)}
}

/* Shopee-style metric layout */
.shopee-kpi{grid-template-columns:repeat(auto-fit,minmax(210px,1fr))}
.kpi.accent-red{border-top:4px solid #ef4444}
.kpi.secondary{background:#fbfdff}
.kpi.secondary strong{font-size:22px}
.kpi.success strong{color:#0f766e}


/* Final layout polish */
.hero{align-items:flex-start}
.section.filters{padding:24px 24px 22px}
.filter-grid label{display:flex;flex-direction:column;gap:2px}
.shopee-kpi{grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}
.kpi{display:flex;flex-direction:column;justify-content:space-between;gap:2px;min-height:118px}
.kpi strong{letter-spacing:-.03em}
.kpi small{line-height:1.35}
.panel,.section,.hero,.kpi{border-color:#dbe3ee}
.table-wrap{box-shadow:inset 0 1px 0 rgba(15,23,42,.02)}
@media (max-width:1280px){.shopee-kpi{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:820px){.shopee-kpi{grid-template-columns:repeat(2,minmax(0,1fr))}.section-head,.panel-head{align-items:flex-start;flex-direction:column}}
@media (max-width:520px){.shopee-kpi{grid-template-columns:1fr}}


/* Chart height stability fix: canvas intrinsic height changes during retina redraw,
   but the visual chart area must stay fixed when filters change. */
.chart-grid .panel{overflow:hidden}
.panel canvas{
  width:100%;
  height:280px !important;
  max-height:280px;
  display:block;
}
@media (max-width:720px){
  .panel canvas{height:240px !important;max-height:240px}
  .chart-grid{gap:14px}
}

/* Checklist multi-select filters */
.multi-filter{
  position:relative;
  margin-top:6px;
  z-index:20;
}
.multi-trigger{
  width:100%;
  min-height:46px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  color:var(--text);
  font:inherit;
  font-size:14px;
  font-weight:900;
  text-align:left;
  padding:12px 42px 12px 14px;
  cursor:pointer;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  position:relative;
}
.multi-trigger::after{
  content:"";
  position:absolute;
  right:15px;
  top:50%;
  width:9px;
  height:9px;
  border-right:2px solid #0f172a;
  border-bottom:2px solid #0f172a;
  transform:translateY(-65%) rotate(45deg);
  transition:transform .16s ease;
}
.multi-filter.open .multi-trigger{
  border-color:#93c5fd;
  box-shadow:0 0 0 4px rgba(37,99,235,.10);
}
.multi-filter.open .multi-trigger::after{transform:translateY(-35%) rotate(225deg)}
.multi-trigger.has-selection{
  color:#1d4ed8;
  background:#eff6ff;
  border-color:#bfdbfe;
}
.multi-menu{
  position:absolute;
  left:0;
  right:0;
  top:calc(100% + 8px);
  min-width:260px;
  max-height:360px;
  display:none;
  background:#fff;
  border:1px solid #dbe3ee;
  border-radius:18px;
  box-shadow:0 24px 60px rgba(15,23,42,.22);
  overflow:hidden;
  z-index:80;
}
.multi-filter.open .multi-menu{display:block}
.multi-search-wrap{
  padding:10px;
  border-bottom:1px solid #edf2f7;
  background:#f8fafc;
}
.multi-search{
  margin:0;
  border-radius:12px;
  padding:10px 12px;
  font-size:13px;
  font-weight:700;
}
.multi-options{
  max-height:240px;
  overflow:auto;
  padding:6px;
}
.multi-option{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:38px;
  padding:9px 10px;
  border-radius:12px;
  color:#172033;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  line-height:1.3;
}
.multi-option:hover{background:#f1f5f9}
.multi-option input{
  width:17px;
  height:17px;
  margin:0;
  accent-color:#2563eb;
  flex:0 0 auto;
}
.multi-option span{
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}
.multi-option.all-option{
  color:#1d4ed8;
  background:#eff6ff;
  margin-bottom:4px;
}
.multi-empty{padding:16px;text-align:center;color:#64748b;font-size:13px;font-weight:700}
.multi-footer{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  padding:10px;
  border-top:1px solid #edf2f7;
  background:#f8fafc;
}
.multi-footer button{
  border:1px solid #cbd5e1;
  background:#fff;
  color:#0f172a;
  border-radius:10px;
  padding:8px 10px;
  font-size:12px;
  font-weight:900;
  cursor:pointer;
}
.multi-footer button[data-action="apply"]{
  background:#2563eb;
  border-color:#2563eb;
  color:#fff;
}
.filter-grid label{min-width:0}
.filters{overflow:visible}
@media (max-width:720px){
  .multi-menu{
    position:fixed;
    left:16px;
    right:16px;
    top:auto;
    bottom:18px;
    max-height:70vh;
    min-width:0;
  }
  .multi-options{max-height:48vh}
}
.filter-field{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
  font-size:12px;
  color:var(--muted);
  font-weight:800;
}
.filter-field > span{display:block}


/* Update 2026-06: sidebar toggle, cleaner multi-select rows, and fixed metric tooltip layering */
.brand{position:relative}
.brand-copy{min-width:0;flex:1}
.sidebar-toggle{
  width:38px;
  height:38px;
  border:1px solid rgba(255,255,255,.14);
  border-radius:12px;
  background:rgba(255,255,255,.08);
  color:#fff;
  font-size:28px;
  line-height:1;
  font-weight:900;
  cursor:pointer;
  display:inline-grid;
  place-items:center;
  flex:0 0 auto;
}
.sidebar-toggle:hover{background:rgba(255,255,255,.16)}
.sidebar-open-btn{
  position:fixed;
  left:18px;
  top:18px;
  z-index:5000;
  display:none;
  align-items:center;
  gap:8px;
  border:1px solid #dbe3ee;
  border-radius:14px;
  background:#0f172a;
  color:#fff;
  padding:11px 14px;
  font-weight:900;
  box-shadow:0 18px 45px rgba(15,23,42,.22);
  cursor:pointer;
}
.sidebar-open-btn:hover{background:#1e293b}
body.sidebar-hidden .app-shell{display:block;min-height:100vh}
body.sidebar-hidden .sidebar{display:none}
body.sidebar-hidden .sidebar-open-btn{display:inline-flex}
body.sidebar-hidden .content{padding-top:74px}

/* The global .filter-grid label rule made checkbox rows stack vertically. Keep checkbox and text aligned. */
.filter-grid .multi-options label.multi-option,
.multi-options label.multi-option{
  display:flex !important;
  flex-direction:row !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:12px !important;
  width:100%;
  min-width:0;
  text-align:left;
}
.filter-grid .multi-option input,
.multi-option input{
  display:block;
  margin:0 !important;
  flex:0 0 18px;
  width:18px;
  height:18px;
}
.filter-grid .multi-option span,
.multi-option span{
  display:block;
  flex:1 1 auto;
  min-width:0;
  text-align:left;
}
.multi-options{scrollbar-width:thin}
.multi-menu{z-index:2500}
.multi-filter.open{z-index:2600}

/* Keep metric tooltips above filters/cards instead of being hidden behind surrounding sections. */
.kpi-grid{position:relative;z-index:60;overflow:visible}
.kpi.has-tip{overflow:visible}
.kpi.has-tip:hover,
.kpi.has-tip:focus-within{z-index:3000}
.has-tip::after{z-index:3100;pointer-events:none;max-width:min(360px,calc(100vw - 36px))}
.has-tip::before{z-index:3101;pointer-events:none}
.filters{z-index:40}
.chart-grid,.section.table-section{position:relative;z-index:1}

@media (max-width:1180px){
  .sidebar-toggle{margin-left:auto}
  body.sidebar-hidden .content{padding-top:72px}
}
@media (max-width:720px){
  .sidebar-open-btn{left:12px;top:12px;padding:10px 12px;border-radius:12px}
  body.sidebar-hidden .content{padding-top:68px}
  .brand{align-items:flex-start}
  .sidebar-toggle{margin-top:4px}
}


/* Update 2026-06: keep opened checklist dropdown above metric cards */
.section.filters{
  position:relative;
  overflow:visible;
}
body.filter-menu-open .section.filters,
.section.filters:has(.multi-filter.open){
  z-index:9000 !important;
  overflow:visible !important;
}
body.filter-menu-open .kpi-grid,
body.filter-menu-open .chart-grid,
body.filter-menu-open .section.table-section{
  z-index:1 !important;
}
.section.filters .multi-filter.open{
  z-index:9100 !important;
}
.section.filters .multi-filter.open .multi-menu{
  z-index:9200 !important;
}
/* Keep rows readable and prevent cards underneath from visually cutting the menu */
.multi-menu{
  isolation:isolate;
  background:#fff;
}
.multi-options label.multi-option{
  background-clip:padding-box;
}
.multi-options label.multi-option span{
  line-height:1.25;
}


/* Update 2026-06: make checklist search work even when row display has !important rules */
.multi-options .multi-option.is-hidden,
.multi-options .multi-search-empty.is-hidden{
  display:none !important;
}
.multi-search-empty{
  margin:8px 6px;
}

/* Update 2026-06: robust live search in checklist filters */
.multi-options .multi-option[hidden],
.multi-options .multi-search-empty[hidden]{
  display:none !important;
}
.multi-options .multi-option:not([hidden]){
  display:flex !important;
}
.multi-search-empty:not([hidden]){
  display:block !important;
}

/* Update 2026-06: fix ranking tables overflowing outside card layout */
.panel.split{
  grid-template-columns:minmax(0,1fr) minmax(0,1fr) !important;
  align-items:start;
  overflow:hidden;
  width:100%;
  max-width:100%;
}
.panel.split > div{
  min-width:0;
  max-width:100%;
  overflow:hidden;
}
.panel.split .panel-head{
  min-width:0;
}
.panel.split .panel-head > div{
  min-width:0;
}
.panel.split .panel-head h3,
.panel.split .panel-head .eyebrow{
  overflow:hidden;
  text-overflow:ellipsis;
}
.panel.split .panel-head .btn{
  flex:0 0 auto;
}
.table-wrap{
  width:100%;
  max-width:100%;
  overflow-x:auto;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
}
.table-wrap table{
  min-width:760px;
  width:100%;
}
.panel.split .table-wrap table{
  width:max-content;
  min-width:100%;
}
.panel.split td:first-child,
.panel.split th:first-child{
  max-width:260px;
}
.panel.split td:first-child{
  overflow:hidden;
  text-overflow:ellipsis;
}
@media (max-width:1180px){
  .panel.split{grid-template-columns:1fr !important;overflow:visible}
  .panel.split > div{overflow:visible}
}


/* Update 2026-06: selectable KPI cards for dynamic metric chart */
.selectable-metric{position:relative;cursor:pointer;transition:border-color .18s ease, box-shadow .18s ease, transform .12s ease}
.selectable-metric:hover{transform:translateY(-1px)}
.metric-check{
  position:absolute;
  right:14px;
  top:14px;
  width:24px;
  height:24px;
  border-radius:8px;
  border:1.5px solid #cbd5e1;
  background:#fff;
  display:grid;
  place-items:center;
  padding:0;
  cursor:pointer;
  z-index:3;
}
.metric-check span{font-size:14px;line-height:1;color:transparent;font-weight:900}
.metric-check.active{background:#2563eb;border-color:#2563eb;box-shadow:0 6px 18px rgba(37,99,235,.18)}
.metric-check.active span{color:#fff}
.metric-selected{border-color:#93c5fd !important;box-shadow:0 0 0 3px rgba(37,99,235,.08), 0 10px 28px rgba(15,23,42,.05)}
.kpi.selectable-metric span{padding-right:28px}
.panel-note{margin:4px 0 0;color:#64748b;font-size:12px;line-height:1.45;max-width:720px}


/* Update 2026-06: simpler full-width trend chart + cleaner metric checklist UI */
.single-chart-grid{grid-template-columns:minmax(0,1fr) !important;}
.full-chart-panel{min-width:0;}
.full-chart-panel canvas{height:340px !important;max-height:340px;}
@media (max-width:720px){.full-chart-panel canvas{height:260px !important;max-height:260px;}}

.selectable-metric{padding-right:62px;}
.metric-check{
  right:16px;
  top:16px;
  width:32px;
  height:32px;
  border-radius:10px;
  border:2px solid #cbd5e1;
  background:linear-gradient(180deg,#ffffff,#f8fafc);
  box-shadow:0 2px 8px rgba(15,23,42,.05);
}
.metric-check:hover{border-color:#93c5fd; box-shadow:0 6px 16px rgba(37,99,235,.12);}
.metric-check span{font-size:16px;}
.metric-check.active{background:linear-gradient(180deg,#3b82f6,#2563eb);border-color:#2563eb;box-shadow:0 10px 22px rgba(37,99,235,.18);}
.kpi.selectable-metric span{padding-right:0;}
.kpi.selectable-metric span i{margin-right:2px;}
.kpi.metric-selected{box-shadow:0 0 0 3px rgba(37,99,235,.10),0 18px 42px rgba(15,23,42,.08);}
.kpi.metric-selected::after{
  content:'Dipilih untuk chart';
  position:absolute;
  right:16px;
  top:54px;
  font-size:10px;
  font-weight:800;
  color:#2563eb;
  letter-spacing:.02em;
}
@media (max-width:720px){
  .selectable-metric{padding-right:56px;}
  .metric-check{right:14px; top:14px; width:30px; height:30px;}
  .kpi.metric-selected::after{top:50px; right:14px; font-size:9px;}
}


/* Update 2026-06: final metric checklist polish + single chart focus */
.chart-grid.single-chart-grid{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) !important;
  gap:22px;
}
.chart-grid.single-chart-grid > .panel{
  grid-column:1 / -1;
  width:100%;
}
.kpi-grid.shopee-kpi{
  align-items:stretch;
}
.kpi.selectable-metric{
  padding-right:60px !important;
  user-select:none;
}
.metric-check{
  position:absolute !important;
  right:16px !important;
  top:16px !important;
  width:28px !important;
  height:28px !important;
  border-radius:9px !important;
  border:2px solid #cbd5e1 !important;
  background:#fff !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding:0 !important;
  margin:0 !important;
  line-height:1 !important;
  box-shadow:none !important;
}
.metric-check span{
  display:block !important;
  font-size:17px !important;
  line-height:1 !important;
  color:transparent !important;
  font-weight:900 !important;
  transform:translateY(-1px);
}
.metric-check.active{
  background:#2563eb !important;
  border-color:#2563eb !important;
  box-shadow:0 8px 18px rgba(37,99,235,.18) !important;
}
.metric-check.active span{color:#fff !important;}
.kpi.metric-selected{
  border-color:#93c5fd !important;
  box-shadow:0 0 0 3px rgba(37,99,235,.09),0 14px 34px rgba(15,23,42,.06) !important;
}
.kpi.metric-selected::after{content:none !important;}
.kpi.selectable-metric span{padding-right:0 !important;}
.kpi.selectable-metric:hover .metric-check{border-color:#93c5fd !important;}
.metric-check:focus-visible{outline:3px solid rgba(37,99,235,.25);outline-offset:3px;}
.full-chart-panel canvas{height:360px !important;max-height:360px !important;}
@media (max-width:720px){
  .kpi.selectable-metric{padding-right:54px !important;}
  .metric-check{right:14px !important;top:14px !important;width:26px !important;height:26px !important;border-radius:8px !important;}
  .full-chart-panel canvas{height:280px !important;max-height:280px !important;}
}

/* 2026-06 date filter refinement */
.refined-filter-grid{
  grid-template-columns: minmax(260px, 1.25fr) repeat(4, minmax(180px, 1fr)) !important;
  align-items:end;
  gap:14px;
}
.date-filter-field{position:relative;z-index:70;}
.date-filter{position:relative;margin-top:6px;}
.date-trigger{
  width:100%;
  min-height:54px;
  border:1px solid var(--line);
  border-radius:16px;
  background:#fff;
  color:#0f172a;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:center;
  gap:2px;
  padding:10px 44px 10px 14px;
  cursor:pointer;
  font-weight:900;
  text-align:left;
  position:relative;
}
.date-trigger::after{
  content:"";
  position:absolute;
  right:16px;
  top:50%;
  width:10px;
  height:10px;
  border-right:2px solid #0f172a;
  border-bottom:2px solid #0f172a;
  transform:translateY(-65%) rotate(45deg);
  transition:transform .16s ease;
}
.date-trigger b{font-size:14px;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;}
.date-trigger small{font-size:11px;color:#64748b;font-weight:800;line-height:1.1;}
.date-filter.open .date-trigger{
  border-color:#93c5fd;
  box-shadow:0 0 0 4px rgba(37,99,235,.10);
}
.date-filter.open .date-trigger::after{transform:translateY(-35%) rotate(225deg);}
.date-menu{
  display:none;
  position:absolute;
  top:calc(100% + 10px);
  left:0;
  width:min(560px, calc(100vw - 64px));
  background:#fff;
  border:1px solid #dbe3ee;
  border-radius:20px;
  box-shadow:0 24px 60px rgba(15,23,42,.22);
  padding:14px;
  z-index:3000;
}
.date-filter.open .date-menu{display:block;}
.date-presets{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;margin-bottom:12px;}
.date-presets button{
  border:1px solid #dbe3ee;
  background:#f8fafc;
  border-radius:12px;
  padding:9px 8px;
  font-size:12px;
  font-weight:900;
  color:#0f172a;
  cursor:pointer;
}
.date-presets button:hover{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8;}
.date-input-row{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:10px;}
.date-menu label,
.filter-grid .date-menu label{
  display:flex;
  flex-direction:column;
  gap:5px;
  color:#64748b;
  font-size:12px;
  font-weight:900;
  min-width:0;
}
.date-menu input,
.date-menu select{min-height:42px;border-radius:12px;font-size:13px;font-weight:800;}
.date-month-label{margin-bottom:12px;}
.date-menu-footer{display:flex;justify-content:flex-end;gap:8px;padding-top:10px;border-top:1px solid #edf2f7;}
.btn-lite,.btn-apply{
  border:1px solid #cbd5e1;
  border-radius:12px;
  padding:10px 13px;
  font-size:13px;
  font-weight:900;
  cursor:pointer;
  background:#fff;
  color:#0f172a;
}
.btn-apply{background:#2563eb;border-color:#2563eb;color:#fff;}
.btn-lite:hover{background:#f8fafc;}
.btn-apply:hover{background:#1d4ed8;}
body.filter-menu-open .date-filter.open{z-index:3200;}
body.filter-menu-open .date-filter.open .date-menu{z-index:3300;}
@media (max-width:1180px){
  .refined-filter-grid{grid-template-columns:repeat(3,minmax(0,1fr)) !important;}
  .date-filter-field{grid-column:span 1;}
}
@media (max-width:720px){
  .refined-filter-grid{grid-template-columns:1fr !important;}
  .date-menu{
    position:fixed;
    left:16px;
    right:16px;
    top:auto;
    bottom:18px;
    width:auto;
    max-height:78vh;
    overflow:auto;
  }
  .date-presets{grid-template-columns:1fr 1fr;}
  .date-input-row{grid-template-columns:1fr;}
}

/* 2026-06: secondary performance charts below main trend */
.secondary-chart-grid{
  display:grid !important;
  grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  gap:22px;
  margin-top:22px;
}
.secondary-chart-grid .panel{
  min-width:0;
  overflow:hidden;
}
.secondary-chart-panel canvas{
  height:300px !important;
  max-height:300px !important;
}
@media (max-width:980px){
  .secondary-chart-grid{grid-template-columns:1fr !important;}
}
@media (max-width:720px){
  .secondary-chart-panel canvas{height:260px !important;max-height:260px !important;}
}

/* 2026-06 performance + responsive polish */
html{scroll-padding-top:18px}
body{overflow-x:hidden}
.content{padding:clamp(14px,2vw,28px)}
.hero,.section,.panel{padding:clamp(18px,2vw,28px)}
.hero h2{font-size:clamp(26px,3vw,36px)}
.panel-head{min-width:0}
.panel-head > div{min-width:0}
.panel-head .btn{flex:0 0 auto}
.kpi-grid.shopee-kpi{grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr));gap:clamp(12px,1.4vw,18px)}
.kpi strong{font-size:clamp(23px,2.2vw,30px)}
.kpi span{line-height:1.25}
.refined-filter-grid{grid-template-columns:minmax(220px,1.05fr) repeat(4,minmax(170px,1fr)) !important}
.upload-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr))}
.table-section,.secondary-chart-grid,.chart-grid{content-visibility:auto;contain-intrinsic-size:680px}
.panel,.kpi,.section,.hero{will-change:auto}
.table-wrap{contain:content;overscroll-behavior:contain}
canvas{touch-action:pan-y}
.full-chart-panel canvas{height:clamp(260px,30vw,360px) !important;max-height:360px !important}
.secondary-chart-panel canvas{height:clamp(240px,26vw,300px) !important;max-height:300px !important}

@media (max-width:980px){
  :root{--shadow:0 10px 24px rgba(15,23,42,.07);--radius:20px}
  .hero{display:block}
  .hero-actions{justify-content:flex-start;margin-top:16px}
  .section-head,.panel-head{align-items:flex-start;flex-direction:column;gap:12px}
  .panel-head .btn{align-self:flex-start}
  .refined-filter-grid{grid-template-columns:repeat(2,minmax(0,1fr)) !important}
}

@media (max-width:900px){
  .app-shell{display:block;min-height:100vh}
  .sidebar{
    position:fixed;inset:0 auto 0 0;z-index:6000;
    width:min(86vw,320px);height:100dvh;overflow:auto;
    transform:translateX(0);box-shadow:0 28px 70px rgba(15,23,42,.35);
  }
  body.sidebar-hidden .sidebar{display:none}
  body.sidebar-hidden .sidebar-open-btn{display:inline-flex}
  body:not(.sidebar-hidden) .sidebar-open-btn{display:none}
  body:not(.sidebar-hidden)::before{
    content:"";position:fixed;inset:0;background:rgba(15,23,42,.34);z-index:5900;
  }
  .content{max-width:100%;padding-top:clamp(14px,2vw,22px)}
  body.sidebar-hidden .content{padding-top:68px}
}

@media (max-width:720px){
  .content{padding:12px}
  .hero,.section,.panel{border-radius:18px;padding:16px}
  .refined-filter-grid{grid-template-columns:1fr !important;gap:10px}
  .kpi-grid.shopee-kpi{grid-template-columns:1fr 1fr;gap:10px}
  .kpi{min-height:112px;padding:15px}
  .kpi.selectable-metric{padding-right:48px !important}
  .metric-check{right:12px !important;top:12px !important;width:24px !important;height:24px !important}
  .full-chart-panel canvas{height:260px !important;max-height:260px !important}
  .secondary-chart-panel canvas{height:240px !important;max-height:240px !important}
  .table-wrap{max-height:430px}
  th,td{padding:10px 11px}
  .btn,.chip,.tab{padding:10px 12px;border-radius:12px}
}

@media (max-width:460px){
  .kpi-grid.shopee-kpi{grid-template-columns:1fr}
  .hero h2{font-size:24px}
  .brand-mark{width:46px;height:46px}
  .brand h1{font-size:18px}
  .date-presets{grid-template-columns:1fr !important}
  .multi-menu,.date-menu{left:10px !important;right:10px !important;bottom:10px !important}
  .table-wrap table{font-size:12px}
}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;scroll-behavior:auto !important;transition:none !important}
}

/* 2026-06: KPI 4x2 layout + month-over-month delta on every metric */
.kpi-grid.shopee-kpi{
  grid-template-columns:repeat(4,minmax(0,1fr)) !important;
  align-items:stretch;
}
.kpi{
  min-height:152px;
  padding:18px 18px 16px;
}
.kpi.selectable-metric{
  padding-right:58px !important;
}
.metric-delta{
  display:inline-flex;
  align-items:center;
  gap:6px;
  width:max-content;
  max-width:100%;
  margin-top:8px;
  padding:5px 8px;
  border-radius:999px;
  font-size:11px;
  line-height:1;
  font-weight:900;
  letter-spacing:0;
  white-space:nowrap;
  background:#f1f5f9;
  color:#64748b;
}
.metric-delta b{font-size:11px;font-weight:900;}
.metric-delta span{font-size:10px !important;text-transform:none !important;letter-spacing:0 !important;color:inherit !important;font-weight:800 !important;display:inline !important;padding:0 !important;}
.metric-delta.delta-up{background:#ecfdf5;color:#047857;}
.metric-delta.delta-down{background:#fef2f2;color:#dc2626;}
.metric-delta.delta-flat{background:#f1f5f9;color:#64748b;}
.metric-delta.delta-new{background:#eff6ff;color:#2563eb;}

@media (max-width:1280px){
  .kpi-grid.shopee-kpi{grid-template-columns:repeat(2,minmax(0,1fr)) !important;}
}
@media (max-width:720px){
  .kpi-grid.shopee-kpi{grid-template-columns:repeat(2,minmax(0,1fr)) !important;}
  .kpi{min-height:142px;}
  .kpi.selectable-metric{padding-right:46px !important;}
  .metric-delta{font-size:10px;padding:4px 7px;gap:4px;}
  .metric-delta span{display:none !important;}
}
@media (max-width:460px){
  .kpi-grid.shopee-kpi{grid-template-columns:1fr !important;}
  .metric-delta span{display:inline !important;}
}

/* 2026-07: Cloud Sync + mobile/PC friendly layout */
.cloud-section{scroll-margin-top:20px}
.cloud-card{
  display:grid;
  grid-template-columns:minmax(260px,.9fr) minmax(300px,1.1fr);
  gap:18px;
  align-items:start;
  background:linear-gradient(135deg,#f8fafc,#fff);
  border:1px solid var(--line);
  border-radius:20px;
  padding:18px;
}
.cloud-copy strong{font-size:17px;display:block;margin-bottom:8px}
.cloud-copy p{margin:0;color:var(--muted);line-height:1.6}
.cloud-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;align-items:end}
.cloud-grid label{min-width:0}
.cloud-grid input[type="text"],.cloud-grid input[type="password"]{margin-top:8px;height:46px}
.switch-row{
  grid-column:1/-1;
  display:flex !important;
  flex-direction:row !important;
  align-items:center;
  gap:10px;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  color:#334155;
}
.switch-row input{width:auto;margin:0;accent-color:var(--primary)}
.switch-row span{font-size:13px;line-height:1.35}
.cloud-actions{grid-column:1/-1;display:flex;gap:10px;flex-wrap:wrap;margin-top:2px}
.cloud-status{
  padding:10px 14px;
  border-radius:999px;
  background:#f1f5f9;
  color:#334155;
  font-weight:900;
  font-size:13px;
  max-width:100%;
}
.cloud-status.success{background:#ecfdf5;color:#047857}
.cloud-status.danger{background:#fef2f2;color:#b91c1c}
.cloud-tips{background:#eff6ff;border-color:#bfdbfe;color:#1e40af}
.mobile-bottom-nav{display:none}

@media (min-width:1440px){
  .content{max-width:1600px}
  .app-shell{grid-template-columns:320px minmax(0,1fr)}
  .hero h2{max-width:980px}
  .table-wrap{max-height:620px}
}
@media (max-width:980px){
  .cloud-card{grid-template-columns:1fr}
  .cloud-grid{grid-template-columns:1fr 1fr}
}
@media (max-width:720px){
  body{padding-bottom:74px}
  .hero-actions .btn{width:100%;justify-content:center;text-align:center}
  .upload-card{min-height:152px;padding:18px}
  .cloud-card{padding:14px;border-radius:18px;gap:14px}
  .cloud-grid{grid-template-columns:1fr}
  .cloud-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px}
  .cloud-actions .btn{width:100%;padding-left:8px;padding-right:8px}
  .cloud-status{width:100%;border-radius:14px;line-height:1.35}
  .table-wrap{border-radius:14px;overflow:auto;-webkit-overflow-scrolling:touch}
  table{min-width:720px}
  .mobile-bottom-nav{
    position:fixed;
    left:10px;
    right:10px;
    bottom:10px;
    z-index:6500;
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:6px;
    padding:8px;
    border:1px solid rgba(226,232,240,.9);
    border-radius:20px;
    background:rgba(255,255,255,.94);
    box-shadow:0 18px 45px rgba(15,23,42,.18);
    backdrop-filter:blur(12px);
  }
  .mobile-bottom-nav a{
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:42px;
    border-radius:14px;
    color:#334155;
    text-decoration:none;
    font-size:12px;
    font-weight:900;
  }
  .mobile-bottom-nav a:active,.mobile-bottom-nav a:hover{background:#eff6ff;color:#1d4ed8}
  .toast{left:12px;right:12px;bottom:86px;max-width:none}
}
@media (max-width:420px){
  .cloud-actions{grid-template-columns:1fr}
  .mobile-bottom-nav{left:8px;right:8px;bottom:8px}
  .mobile-bottom-nav a{font-size:11px;min-height:40px}
}
