:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --border: #2a3648;
  --text: #e8eef7;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.brand { font-size: 20px; font-weight: 700; letter-spacing: 0.02em; }

.nav { display: flex; gap: 8px; flex-wrap: wrap; }

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
}

.nav a.active, .nav a:hover {
  color: var(--text);
  background: rgba(59, 130, 246, 0.15);
}

.main {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 { margin: 0 0 12px; font-size: 18px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.metric {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.metric-label { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.metric-value { font-size: 22px; font-weight: 700; }

label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }

input, button, select {
  font: inherit;
}

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 12px;
}

button, .btn {
  display: inline-block;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
}

button:hover, .btn:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}

.alert-error { background: rgba(239,68,68,0.15); border: 1px solid var(--danger); color: #fecaca; }
.alert-info { background: rgba(59,130,246,0.12); border: 1px solid var(--accent); color: #bfdbfe; }
.alert-success { background: rgba(34,197,94,0.12); border: 1px solid var(--success); color: #bbf7d0; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 600; }

.product-cell { display: flex; align-items: center; gap: 10px; }
.product-cell img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; background: var(--bg); }

.muted { color: var(--muted); font-size: 13px; }

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  margin-top: 12px;
}

.chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart-bar {
  width: 100%;
  max-width: 24px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}
.chart-bar-label { font-size: 10px; color: var(--muted); }

.loading { color: var(--muted); padding: 40px; text-align: center; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal {
  width: 100%;
  max-width: 520px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

@media (max-width: 640px) {
  .main { padding: 16px; }
}
