:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #eef2ff;
    --accent: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.1);
    --shadow-xl: 0 24px 48px rgba(0,0,0,0.12);
    --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'Inter',-apple-system,sans-serif; background:var(--bg); color:var(--text); line-height:1.6; -webkit-font-smoothing:antialiased; }

/* TOAST */
#toast-container { position:fixed; top:20px; right:20px; z-index:9999; display:flex; flex-direction:column; gap:8px; }
.toast { padding:13px 18px; border-radius:10px; color:white; font-size:14px; font-weight:500; box-shadow:var(--shadow-lg); animation:slideIn 0.3s ease; max-width:360px; }
.toast.success { background:linear-gradient(135deg,#059669,#10b981); }
.toast.error { background:linear-gradient(135deg,#dc2626,#ef4444); }
.toast.info { background:linear-gradient(135deg,#4f46e5,#6366f1); }
@keyframes slideIn { from{transform:translateX(80px);opacity:0} to{transform:translateX(0);opacity:1} }

/* HEADER */
header { background:var(--surface); border-bottom:1px solid var(--border); position:sticky; top:0; z-index:100; }
.header-inner { max-width:1200px; margin:0 auto; padding:0 32px; height:64px; display:flex; align-items:center; justify-content:space-between; }
.logo { display:flex; align-items:center; gap:12px; }
.logo-mark { width:38px; height:38px; background:linear-gradient(135deg,var(--primary),#8b5cf6); border-radius:10px; display:flex; align-items:center; justify-content:center; color:white; font-weight:800; font-size:18px; box-shadow:0 4px 12px rgba(99,102,241,0.3); }
.logo-name { font-weight:800; font-size:18px; letter-spacing:-0.5px; }
.logo-sub { font-size:11px; color:var(--text-muted); font-weight:500; margin-top:-2px; }
.header-actions { display:flex; gap:10px; }

/* BUTTONS */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:11px 22px; border:none; border-radius:var(--radius-sm); font-size:14px; font-weight:600; font-family:inherit; cursor:pointer; transition:var(--transition); text-decoration:none; }
.btn.primary { background:linear-gradient(135deg,var(--primary),var(--primary-dark)); color:white; box-shadow:0 2px 8px rgba(99,102,241,0.3); }
.btn.primary:hover { transform:translateY(-1px); box-shadow:0 4px 16px rgba(99,102,241,0.4); }
.btn.outline { background:none; border:2px solid var(--border); color:var(--text-secondary); }
.btn.outline:hover { border-color:var(--primary); color:var(--primary); background:var(--primary-light); }
.btn.ghost { background:rgba(255,255,255,0.15); color:white; border:2px solid rgba(255,255,255,0.25); }
.btn.ghost:hover { background:rgba(255,255,255,0.25); }
.btn.small { padding:8px 16px; font-size:13px; }
.btn.large { padding:15px 32px; font-size:16px; }
.btn:disabled { opacity:0.5; cursor:not-allowed; transform:none; }

/* HERO */
.hero { background:linear-gradient(135deg,#0f172a 0%,#1e1b4b 50%,#0f172a 100%); color:white; padding:80px 32px; text-align:center; position:relative; overflow:hidden; }
.hero::before { content:''; position:absolute; top:-30%; left:-20%; width:60%; height:160%; background:radial-gradient(ellipse,rgba(99,102,241,0.2) 0%,transparent 60%); }
.hero::after { content:''; position:absolute; top:-30%; right:-20%; width:60%; height:160%; background:radial-gradient(ellipse,rgba(139,92,246,0.15) 0%,transparent 60%); }
.hero-content { max-width:760px; margin:0 auto; position:relative; z-index:1; }
.hero-badge { display:inline-block; padding:6px 16px; background:rgba(99,102,241,0.2); border:1px solid rgba(99,102,241,0.4); border-radius:20px; font-size:12px; font-weight:600; color:#a5b4fc; text-transform:uppercase; letter-spacing:1px; margin-bottom:24px; }
.hero h1 { font-size:56px; font-weight:800; line-height:1.1; letter-spacing:-2px; margin-bottom:20px; }
.gradient-text { background:linear-gradient(135deg,#a5b4fc,#c4b5fd,#f9a8d4); -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text; }
.hero-sub { font-size:18px; color:rgba(255,255,255,0.65); line-height:1.7; margin-bottom:40px; max-width:600px; margin-left:auto; margin-right:auto; }
.hero-actions { display:flex; gap:16px; justify-content:center; margin-bottom:56px; flex-wrap:wrap; }
.hero-stats { display:flex; gap:48px; justify-content:center; padding-top:40px; border-top:1px solid rgba(255,255,255,0.1); flex-wrap:wrap; gap:32px; }
.stat { text-align:center; }
.stat-num { display:block; font-size:32px; font-weight:800; letter-spacing:-1px; color:white; }
.stat-label { font-size:13px; color:rgba(255,255,255,0.5); font-weight:500; }

/* DASHBOARD */
.dashboard { max-width:1200px; margin:0 auto; padding:32px; }
.hidden { display:none !important; }
.dash-header { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:28px; gap:16px; flex-wrap:wrap; }
.dash-header h2 { font-size:26px; font-weight:800; letter-spacing:-0.5px; }
.dash-meta { color:var(--text-muted); font-size:14px; margin-top:4px; }
.dash-actions { display:flex; gap:10px; }

/* KPI GRID */
.kpi-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:18px; margin-bottom:28px; }
.kpi-card { background:var(--surface); padding:22px 24px; border-radius:var(--radius); box-shadow:var(--shadow); border:1px solid var(--border); transition:var(--transition); position:relative; overflow:hidden; }
.kpi-card:hover { transform:translateY(-2px); box-shadow:var(--shadow-md); }
.kpi-card.accent { background:linear-gradient(135deg,#fef3c7,#fde68a); border-color:#fcd34d; }
.kpi-icon { font-size:22px; margin-bottom:10px; }
.kpi-value { font-size:30px; font-weight:800; letter-spacing:-1px; margin-bottom:4px; }
.kpi-label { font-size:12px; color:var(--text-secondary); font-weight:600; text-transform:uppercase; letter-spacing:0.5px; }

/* CHARTS */
.charts-row { display:grid; grid-template-columns:2fr 1fr; gap:18px; margin-bottom:28px; }
.chart-card { background:var(--surface); padding:24px; border-radius:var(--radius); box-shadow:var(--shadow); border:1px solid var(--border); }
.chart-card.wide {}
.chart-card h3 { font-size:15px; font-weight:700; margin-bottom:20px; }
.chart-card canvas { max-height:280px; }

/* INSIGHTS */
.section { margin-bottom:28px; }
.section-title { font-size:17px; font-weight:700; margin-bottom:16px; display:flex; align-items:center; gap:8px; }
.insights-list { display:grid; gap:14px; }
.insight-card { background:var(--surface); border-radius:var(--radius); padding:20px 24px; box-shadow:var(--shadow); border-left:4px solid var(--primary); border:1px solid var(--border); border-left:4px solid var(--primary); transition:var(--transition); }
.insight-card:hover { box-shadow:var(--shadow-md); transform:translateY(-1px); }
.insight-card.top_issue { border-left-color:#ef4444; }
.insight-card.sku_problem { border-left-color:#f59e0b; }
.insight-card.recommendation { border-left-color:#10b981; }
.insight-card.quality_alert { border-left-color:#ef4444; }
.insight-header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:8px; }
.insight-title { font-size:15px; font-weight:700; }
.impact-badge { flex-shrink:0; padding:4px 12px; border-radius:20px; font-size:11px; font-weight:700; background:var(--primary-light); color:var(--primary-dark); white-space:nowrap; }
.impact-badge.high { background:#fee2e2; color:#dc2626; }
.impact-badge.med { background:#fef3c7; color:#d97706; }
.impact-badge.low { background:#d1fae5; color:#059669; }
.insight-desc { font-size:14px; color:var(--text-secondary); line-height:1.6; }
.insight-skus { margin-top:10px; display:flex; flex-wrap:wrap; gap:6px; }
.sku-tag { padding:3px 10px; background:var(--bg); border:1px solid var(--border); border-radius:20px; font-size:11px; font-weight:600; color:var(--text-secondary); font-family:monospace; }

/* TABLE */
.table-wrap { background:var(--surface); border-radius:var(--radius); box-shadow:var(--shadow); border:1px solid var(--border); overflow:hidden; }
table { width:100%; border-collapse:collapse; }
th { padding:13px 18px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.8px; color:var(--text-secondary); background:var(--bg); border-bottom:2px solid var(--border); text-align:left; }
td { padding:13px 18px; font-size:14px; border-bottom:1px solid #f1f5f9; }
tr:last-child td { border-bottom:none; }
tr:hover td { background:#f8fafc; }
.cat-badge { display:inline-block; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:600; background:var(--primary-light); color:var(--primary-dark); }
.cat-badge.neg { background:#fee2e2; color:#dc2626; }
.cat-badge.pos { background:#d1fae5; color:#059669; }
.badge-count { display:inline-block; padding:3px 10px; border-radius:20px; font-size:12px; font-weight:700; background:#f1f5f9; color:var(--text); }

/* MODAL */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:500; display:flex; align-items:center; justify-content:center; backdrop-filter:blur(4px); padding:20px; }
.modal { background:var(--surface); border-radius:20px; box-shadow:var(--shadow-xl); width:100%; max-width:540px; max-height:90vh; overflow:hidden; display:flex; flex-direction:column; }
.modal.wide-modal { max-width:900px; }
.modal-header { padding:24px 28px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.modal-header h3 { font-size:18px; font-weight:700; }
.modal-close { background:none; border:none; font-size:18px; cursor:pointer; color:var(--text-muted); padding:4px 8px; border-radius:6px; transition:var(--transition); }
.modal-close:hover { background:var(--bg); color:var(--text); }
.modal-body { padding:24px 28px; overflow-y:auto; }
.modal-footer { padding:20px 28px; border-top:1px solid var(--border); display:flex; gap:10px; justify-content:flex-end; }

/* FORM */
.field { margin-bottom:18px; }
.field label { display:block; font-size:12px; font-weight:600; color:var(--text); text-transform:uppercase; letter-spacing:0.5px; margin-bottom:7px; }
.field input { width:100%; padding:12px 14px; border:2px solid var(--border); border-radius:var(--radius-sm); font-size:14px; font-family:inherit; color:var(--text); transition:var(--transition); }
.field input:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 4px rgba(99,102,241,0.1); }
.link { color:var(--primary); text-decoration:none; font-weight:600; cursor:pointer; }
.link:hover { text-decoration:underline; }
.link.small { font-size:13px; }

/* UPLOAD ZONE */
.upload-zone { border:2px dashed var(--border); border-radius:var(--radius); padding:40px 24px; text-align:center; cursor:pointer; transition:var(--transition); background:var(--bg); }
.upload-zone:hover { border-color:var(--primary); background:var(--primary-light); }
.upload-zone.dragover { border-color:var(--primary); background:var(--primary-light); transform:scale(1.01); }
.upload-icon { font-size:40px; margin-bottom:12px; }
.upload-text { font-size:15px; font-weight:500; color:var(--text-secondary); margin-bottom:8px; }
.upload-hint { font-size:12px; color:var(--text-muted); font-family:monospace; }
.file-name { margin-top:12px; padding:8px 14px; background:var(--primary-light); border-radius:8px; font-size:13px; font-weight:600; color:var(--primary-dark); display:inline-block; }

/* PROGRESS */
.progress { padding:16px 0 0; }
.progress-bar { height:6px; background:var(--border); border-radius:3px; overflow:hidden; margin-bottom:8px; }
.progress-fill { height:100%; background:linear-gradient(90deg,var(--primary),#8b5cf6); border-radius:3px; transition:width 0.3s ease; width:0%; }
.progress-text { font-size:13px; color:var(--text-secondary); text-align:center; font-weight:500; }

/* HISTORY */
.history-item { display:flex; align-items:center; justify-content:space-between; padding:14px; background:var(--bg); border-radius:var(--radius-sm); margin-bottom:10px; cursor:pointer; border:1px solid transparent; transition:var(--transition); }
.history-item:hover { border-color:var(--primary); background:var(--primary-light); }
.history-name { font-size:14px; font-weight:600; }
.history-meta { font-size:12px; color:var(--text-muted); margin-top:2px; }
.history-count { font-size:13px; font-weight:700; color:var(--primary); }

/* RESPONSIVE */
@media(max-width:900px) { .kpi-grid{grid-template-columns:repeat(2,1fr)} .charts-row{grid-template-columns:1fr} }
@media(max-width:600px) { .hero h1{font-size:36px} .dashboard{padding:16px} .header-inner{padding:0 16px} .kpi-grid{grid-template-columns:1fr 1fr} }
