*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0f1117;
  --bg2:         #1a1d2e;
  --bg3:         #242740;
  --accent:      #6366f1;
  --accent2:     #22d3ee;
  --success:     #10b981;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --text:        #e2e8f0;
  --text-muted:  #94a3b8;
  --border:      #2d3258;
  --radius:      10px;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 15px;
}

/* ── Sidebar ─────────────────────────────── */
.sidebar {
  width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  position: fixed;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 0 1.25rem 1.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
}

.nav-links { list-style: none; flex: 1; }

.nav-links a {
  display: block;
  padding: .65rem 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .9rem;
  transition: all .15s;
  border-left: 3px solid transparent;
}

.nav-links a:hover { background: var(--bg3); color: var(--text); }
.nav-links a.active { background: var(--bg3); color: var(--text); border-left-color: var(--accent); }

.sidebar-footer {
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  font-size: .75rem;
}

/* ── Main ────────────────────────────────── */
.main-content { margin-left: 220px; flex: 1; padding: 2rem; max-width: 1400px; }

/* ── Page Header ─────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: .75rem;
}

.page-title { font-size: 1.4rem; font-weight: 700; }

/* ── KPI Grid ────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  border-top: 3px solid var(--accent);
}

.kpi-card.kpi-green  { border-top-color: var(--success); }
.kpi-card.kpi-cyan   { border-top-color: var(--accent2); }
.kpi-card.kpi-orange { border-top-color: var(--warning); }

.kpi-label {
  font-size: .75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .4rem;
}

.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.kpi-sub   { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

/* ── Cards ───────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }

/* ── Tables ──────────────────────────────── */
table  { width: 100%; border-collapse: collapse; font-size: .875rem; }
th     { text-align: left; padding: .55rem .75rem; color: var(--text-muted); border-bottom: 1px solid var(--border); font-weight: 500; font-size: .8rem; }
td     { padding: .55rem .75rem; border-bottom: 1px solid rgba(45,50,88,.4); }
tr:hover td { background: rgba(36,39,64,.6); }

code.sku {
  background: rgba(99,102,241,.15);
  color: var(--accent2);
  padding: .15em .4em;
  border-radius: 4px;
  font-size: .8rem;
}

/* ── Badges ──────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2em .55em;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-success { background: rgba(16,185,129,.2);  color: var(--success); }
.badge-error   { background: rgba(239,68,68,.2);   color: var(--danger);  }
.badge-warning { background: rgba(245,158,11,.2);  color: var(--warning); }
.badge-info    { background: rgba(99,102,241,.2);  color: var(--accent);  }

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .9rem;
  border: none; border-radius: 6px;
  font-size: .875rem; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: opacity .15s, background .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg3); }
.btn-danger  { background: var(--danger); color: #fff; }

/* ── Forms ───────────────────────────────── */
.form-group { margin-bottom: 1rem; }

label { display: block; font-size: .82rem; color: var(--text-muted); margin-bottom: .35rem; }

input[type=text], input[type=date], input[type=number], input[type=email],
input[type=file], select, textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .55rem .75rem;
  border-radius: 6px;
  font-size: .9rem;
  outline: none;
  font-family: inherit;
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

/* ── Score Bar ───────────────────────────── */
.score-bar {
  height: 6px; width: 80px;
  background: var(--bg3); border-radius: 3px; overflow: hidden;
}
.score-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* ── Upload Zone ─────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  user-select: none;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(99,102,241,.05);
}

/* ── Alerts ──────────────────────────────── */
.alert {
  padding: .9rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: .9rem;
}
.alert-success { background: rgba(16,185,129,.12); border-left: 3px solid var(--success); }
.alert-error   { background: rgba(239,68,68,.12);  border-left: 3px solid var(--danger);  }
.alert-warning { background: rgba(245,158,11,.12); border-left: 3px solid var(--warning); }

/* ── Scrollbar ───────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 1rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
