:root{
  --bg:#f4f7fb;
  --panel:#ffffff;
  --panel-2:#f8fafc;
  --line:#e7ebf1;
  --text:#0f172a;
  --muted:#64748b;
  --navy:#101827;
  --navy-2:#172033;
  --accent:#ee5b42;
  --accent-soft:#fff0ec;
  --green:#0f9f6e;
  --green-soft:#e8f8f1;
  --amber:#d97706;
  --amber-soft:#fff7e6;
  --red:#dc2626;
  --red-soft:#feecec;
  --blue:#2563eb;
  --blue-soft:#eaf1ff;
  --purple:#7c3aed;
  --purple-soft:#f2ebff;
  --shadow:0 12px 30px rgba(15,23,42,.06);
  --shadow-lg:0 24px 64px rgba(15,23,42,.16);
  --radius:18px;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;background:var(--bg);color:var(--text)}
button,input,select{font:inherit}
button{cursor:pointer}
svg{display:block}
.app-shell{display:grid;grid-template-columns:260px minmax(0,1fr);min-height:100vh}
.sidebar{position:sticky;top:0;height:100vh;background:var(--navy);color:#fff;padding:28px 20px 22px;display:flex;flex-direction:column;z-index:40}
.brand{display:flex;align-items:center;gap:12px;padding:0 8px 28px;border-bottom:1px solid rgba(255,255,255,.10)}
.brand-mark{width:42px;height:42px;border-radius:14px;display:grid;place-items:center;background:linear-gradient(135deg,#fff,#ffd9cf);color:var(--accent);font-weight:900;font-size:22px;box-shadow:inset 0 0 0 1px rgba(255,255,255,.6)}
.brand-name{font-size:22px;font-weight:800;letter-spacing:-.02em}
.brand-sub{color:#aeb9cb;font-size:12px;margin-top:2px}
.nav{display:flex;flex-direction:column;gap:7px;padding-top:24px}
.nav-item{display:flex;align-items:center;gap:12px;padding:13px 14px;border:0;border-radius:14px;background:transparent;color:#cbd5e1;text-align:left;font-weight:650;transition:.18s ease}
.nav-item:hover{background:rgba(255,255,255,.06);color:#fff}
.nav-item.active{background:linear-gradient(135deg,#7f3e3d,#8f4441);color:#fff;box-shadow:0 10px 24px rgba(0,0,0,.16)}
.nav-icon{width:19px;height:19px}
.sidebar-footer{margin-top:auto;padding:18px 8px 0;border-top:1px solid rgba(255,255,255,.10)}
.api-status{display:flex;gap:10px;align-items:center;margin-bottom:16px}
.status-dot{width:10px;height:10px;border-radius:50%;background:#f59e0b;box-shadow:0 0 0 4px rgba(245,158,11,.12)}
.status-dot.ok{background:#18c38e;box-shadow:0 0 0 4px rgba(24,195,142,.12)}
.status-dot.bad{background:#ef4444;box-shadow:0 0 0 4px rgba(239,68,68,.12)}
.small-label{font-size:11px;font-weight:800;letter-spacing:.07em;text-transform:uppercase;color:#94a3b8}
.tiny{font-size:12px}
.muted{color:var(--muted)}
.main{min-width:0}
.topbar{background:#fff;border-bottom:1px solid var(--line);padding:26px 34px;display:flex;align-items:center;justify-content:space-between;gap:20px;position:sticky;top:0;z-index:30}
.topbar-left{display:flex;align-items:center;gap:14px}
.eyebrow{font-size:11px;font-weight:800;letter-spacing:.09em;text-transform:uppercase;color:var(--accent)}
h1,h2,h3,p{margin-top:0}
h1{font-size:30px;margin-bottom:5px;letter-spacing:-.035em}
h2{font-size:22px;letter-spacing:-.02em}
h3{font-size:16px;margin-bottom:5px}
#pageSubtitle{margin:0;color:var(--muted);font-size:14px}
.topbar-actions{display:flex;align-items:center;gap:10px}
.sync-meta{text-align:right;padding-right:6px}
.sync-time{font-size:13px;font-weight:700;margin-top:3px}
.btn{border:0;border-radius:12px;padding:11px 14px;display:inline-flex;align-items:center;justify-content:center;gap:8px;font-weight:750;transition:.16s ease}
.btn svg{width:17px;height:17px}
.btn:hover{transform:translateY(-1px)}
.btn-primary{background:var(--accent);color:white;box-shadow:0 8px 20px rgba(238,91,66,.22)}
.btn-dark{background:var(--navy);color:#fff}
.btn-light{background:#fff;color:var(--text);border:1px solid var(--line)}
.btn-ghost{background:transparent;color:var(--muted)}
.icon-btn{width:40px;height:40px;border-radius:12px;border:1px solid var(--line);background:#fff;display:grid;place-items:center;color:var(--text)}
.icon-btn svg{width:18px;height:18px}
.mobile-only{display:none}
.filter-bar{padding:14px 34px;background:#fff;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;gap:16px}
.filter-summary,.filter-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.pill{display:inline-flex;align-items:center;gap:8px;padding:8px 11px;border-radius:999px;background:var(--panel-2);border:1px solid var(--line);font-size:12px;font-weight:700;color:#475569}
.pill svg{width:15px;height:15px}
.content{padding:26px 34px 50px}
.page{display:none}
.page.active{display:block}
.hero-strip{display:flex;justify-content:space-between;gap:18px;align-items:flex-end;margin-bottom:18px}
.hero-strip p{margin:0;color:var(--muted)}
.hero-title{font-size:18px;font-weight:800;margin-bottom:4px}
.section{margin-top:24px}
.section-head{display:flex;justify-content:space-between;align-items:flex-end;gap:12px;margin-bottom:12px}
.section-kicker{font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--muted);margin-bottom:4px}
.section-title{font-size:18px;font-weight:850;margin:0}
.section-note{font-size:12px;color:var(--muted);margin:0}
.kpi-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}
.kpi-card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);padding:18px;box-shadow:var(--shadow);position:relative;overflow:hidden}
.kpi-card::after{content:"";position:absolute;right:-25px;bottom:-30px;width:90px;height:90px;border-radius:50%;background:var(--kpi-soft,#f3f4f6)}
.kpi-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start;position:relative;z-index:1}
.kpi-icon{width:42px;height:42px;border-radius:13px;background:var(--kpi-soft,#f3f4f6);color:var(--kpi-color,#475569);display:grid;place-items:center}
.kpi-icon svg{width:21px;height:21px}
.kpi-title{font-size:12px;color:var(--muted);font-weight:750;margin-top:8px}
.kpi-value{font-size:26px;font-weight:900;letter-spacing:-.035em;margin:8px 0 11px;position:relative;z-index:1}
.kpi-bench{display:grid;grid-template-columns:auto 1fr auto;gap:5px 8px;font-size:11px;position:relative;z-index:1}
.kpi-bench .lbl{color:var(--muted);font-weight:700}
.kpi-bench .val{font-weight:800}
.delta{font-weight:850;text-align:right}
.delta.pos{color:var(--green)}
.delta.neg{color:var(--red)}
.delta.neutral{color:var(--muted)}
.grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
.card{background:var(--panel);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
.card-head{padding:17px 18px 12px;display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.card-title{font-size:15px;font-weight:850;margin:0}
.card-sub{font-size:12px;color:var(--muted);margin-top:4px}
.chart-wrap{height:300px;padding:4px 14px 8px}
.chart-wrap.tall{height:360px}
.chart-wrap.short{height:240px}
.insight-box{border-top:1px solid var(--line);background:#fbfcfe;padding:14px 16px}
.insight-head{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:850;margin-bottom:7px}
.insight-head svg{width:16px;height:16px;color:var(--accent)}
.insight-box ul{padding-left:18px;margin:0;display:grid;gap:5px}
.insight-box li{font-size:12px;line-height:1.55;color:#475569}
.table-wrap{overflow:auto;max-height:460px}
table{width:100%;border-collapse:collapse;font-size:12px}
th,td{padding:11px 13px;border-bottom:1px solid var(--line);white-space:nowrap;text-align:left}
th{position:sticky;top:0;background:#f8fafc;z-index:1;color:#64748b;font-size:10px;text-transform:uppercase;letter-spacing:.05em}
td.num,th.num{text-align:right}
tr:hover td{background:#fbfcfe}
.rank{width:27px;height:27px;border-radius:9px;background:#f1f5f9;display:grid;place-items:center;font-weight:800}
.badge{display:inline-flex;align-items:center;padding:5px 8px;border-radius:999px;font-size:10px;font-weight:850}
.badge.green{background:var(--green-soft);color:var(--green)}
.badge.red{background:var(--red-soft);color:var(--red)}
.badge.amber{background:var(--amber-soft);color:var(--amber)}
.badge.blue{background:var(--blue-soft);color:var(--blue)}
.badge.gray{background:#f1f5f9;color:#64748b}
.target-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;padding:0 18px 18px}
.target-mini{background:#f8fafc;border:1px solid var(--line);border-radius:14px;padding:12px}
.target-mini .t-label{font-size:10px;color:var(--muted);font-weight:800;text-transform:uppercase}
.target-mini .t-value{font-size:17px;font-weight:900;margin-top:4px}
.progress-track{height:8px;background:#eef2f6;border-radius:999px;overflow:hidden}
.progress-bar{height:100%;border-radius:999px;background:linear-gradient(90deg,var(--accent),#ff927e)}
.empty-state{padding:44px 20px;text-align:center;color:var(--muted)}
.empty-icon{width:52px;height:52px;border-radius:16px;background:#f1f5f9;margin:0 auto 12px;display:grid;place-items:center;color:#64748b}
.empty-icon svg{width:24px;height:24px}
.filter-drawer{position:fixed;top:0;right:0;width:min(480px,94vw);height:100vh;background:#fff;z-index:100;box-shadow:var(--shadow-lg);transform:translateX(105%);transition:.22s ease;display:flex;flex-direction:column}
.filter-drawer.open{transform:translateX(0)}
.drawer-backdrop,.modal-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.40);backdrop-filter:blur(2px);z-index:90;display:none}
.drawer-backdrop.show,.modal-backdrop.show{display:block}
.drawer-header{padding:22px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between}
.drawer-header h2{margin-bottom:0}
.drawer-body{padding:20px 22px;overflow:auto;display:grid;gap:18px}
.drawer-footer{padding:16px 22px;border-top:1px solid var(--line);display:flex;gap:10px}
.grow{flex:1}
.filter-group{display:grid;gap:8px}
.filter-group-title{font-size:11px;font-weight:850;text-transform:uppercase;letter-spacing:.06em;color:#64748b}
.filter-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.field-label{font-size:11px;font-weight:800;color:#475569;margin-bottom:6px;display:block}
.input,.select{width:100%;border:1px solid #dbe2ea;border-radius:11px;background:#fff;padding:10px 11px;color:var(--text);outline:none}
.input:focus,.select:focus{border-color:#f0a08f;box-shadow:0 0 0 3px rgba(238,91,66,.09)}
.multi-select{min-height:42px}
.slider-box{background:#f8fafc;border:1px solid var(--line);padding:12px;border-radius:13px}
.range-row{display:grid;grid-template-columns:1fr auto;align-items:center;gap:10px;margin-top:8px}
input[type=range]{width:100%;accent-color:var(--accent)}
.range-label{font-size:11px;font-weight:800;color:#475569;min-width:90px;text-align:right}
.modal{position:fixed;inset:0;z-index:120;display:none;place-items:center;padding:20px}
.modal.show{display:grid}
.modal-card{width:min(460px,96vw);background:#fff;border-radius:20px;box-shadow:var(--shadow-lg);padding:22px}
.modal-head{display:flex;align-items:flex-start;justify-content:space-between}
.modal-head h2{margin-bottom:0}
.modal-copy{font-size:13px;line-height:1.6;margin:14px 0 18px}
.modal-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:18px}
.loading-overlay{position:fixed;inset:0;background:rgba(244,247,251,.76);backdrop-filter:blur(2px);z-index:200;display:none;place-items:center}
.loading-overlay.show{display:grid}
.loader-card{background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:var(--shadow-lg);padding:18px 22px;display:flex;align-items:center;gap:14px;min-width:320px}
.spinner{width:28px;height:28px;border-radius:50%;border:3px solid #eceff4;border-top-color:var(--accent);animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.loader-title{font-weight:850;margin-bottom:3px}
.toast-stack{position:fixed;right:22px;bottom:22px;z-index:300;display:grid;gap:10px}
.toast{width:min(390px,90vw);background:#111827;color:#fff;border-radius:14px;padding:13px 15px;box-shadow:var(--shadow-lg);display:flex;gap:10px;align-items:flex-start}
.toast.good{background:#065f46}
.toast.bad{background:#991b1b}
.toast svg{width:18px;height:18px;flex:0 0 auto}
.toast-title{font-weight:850;font-size:13px}
.toast-msg{font-size:12px;opacity:.88;margin-top:2px;line-height:1.45}
@media (max-width:1180px){
  .kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .grid-3{grid-template-columns:1fr 1fr}
}
@media (max-width:900px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{position:fixed;left:0;top:0;transform:translateX(-105%);transition:.2s ease;width:260px;box-shadow:var(--shadow-lg)}
  .sidebar.open{transform:translateX(0)}
  .mobile-only{display:grid}
  .topbar{padding:20px}
  .filter-bar{padding:12px 20px}
  .content{padding:20px}
  .sync-meta{display:none}
}
@media (max-width:680px){
  .topbar{align-items:flex-start}
  .topbar-actions .btn-light{display:none}
  .topbar-actions .btn{padding:10px}
  .topbar-actions .btn span:not([data-icon]){display:none}
  h1{font-size:25px}
  .kpi-grid,.grid-2,.grid-3{grid-template-columns:1fr}
  .filter-grid{grid-template-columns:1fr}
  .hero-strip{align-items:flex-start;flex-direction:column}
  .target-summary{grid-template-columns:1fr 1fr}
  .chart-wrap{height:270px}
}

.pie-summary{display:grid;gap:8px;padding:0 16px 14px}.pie-summary-item{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 10px;border:1px solid var(--line);border-radius:12px;background:#f8fafc}.pie-summary-name{font-size:12px;font-weight:800;color:#334155}.pie-summary-value{font-size:12px;font-weight:800;color:#0f172a;text-align:right}
