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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Shell ───────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: 220px; flex-shrink: 0;
  background: #13161f;
  display: flex; flex-direction: column;
  border-right: 1px solid #1a2235;
}
.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid #1a2235;
}
.brand-text { font-size: 20px; font-weight: 800; color: #4A90D9; }
.sidebar-store-switch { padding: 12px 16px; border-bottom: 1px solid #1a2235; }
.sidebar-store-switch select { width: 100%; }
.sidebar-nav { flex: 1; list-style: none; padding: 12px 12px; }
.sidebar-nav li { margin-bottom: 2px; }
.nav-link {
  display: block; padding: 10px 12px; border-radius: 8px;
  color: #8892a4; text-decoration: none; font-weight: 400;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: #1e2736; color: #e2e8f0; }
.nav-link.active { background: #2d3748; color: #fff; font-weight: 600; }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #1a2235;
}
.user-email { display: block; font-size: 12px; color: #8892a4; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-logout {
  display: block; width: 100%; text-align: center;
  background: none; border: 1px solid #2d3748; border-radius: 6px;
  color: #8892a4; padding: 6px 12px; font-size: 12px;
  cursor: pointer; text-decoration: none;
}
.btn-logout:hover { border-color: #4A90D9; color: #4A90D9; }

/* ── Main content ────────────────────────────────────────── */
.content { flex: 1; padding: 32px; overflow-y: auto; max-width: 1200px; }

/* ── Page header ─────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Stat grid ───────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #1a1f2e; border-radius: 12px; padding: 20px; }
.stat-label { font-size: 12px; color: #8892a4; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.stat-value { font-size: 24px; font-weight: 700; }

/* ── Card ────────────────────────────────────────────────── */
.card { background: #1a1f2e; border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: #8892a4; text-transform: uppercase; letter-spacing: 0.05em; }
.empty-state { color: #8892a4; text-align: center; padding: 40px; }

/* ── Table ───────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #2d3748; }
.data-table th { color: #8892a4; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #222840; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: #8892a4; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=url],
input[type=date], input[type=number], select, textarea {
  background: #0f1117; border: 1px solid #2d3748; border-radius: 8px;
  color: #e2e8f0; padding: 8px 12px; font-size: 14px; width: 100%;
  outline: none; transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: #4A90D9; }
.btn-primary {
  background: #4A90D9; border: none; border-radius: 8px;
  color: #fff; padding: 10px 20px; cursor: pointer;
  font-weight: 600; font-size: 14px; transition: background 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { background: #3a7bc8; }
.btn-primary:disabled { background: #2d3748; cursor: not-allowed; }
.btn-sm {
  background: #2d3748; border: none; border-radius: 6px;
  color: #e2e8f0; padding: 4px 10px; cursor: pointer; font-size: 12px;
}
.btn-sm:hover { background: #4A90D9; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  background: #2d3748; border-radius: 4px; padding: 2px 8px;
  font-size: 12px; color: #8892a4;
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert-error { background: #2d1515; border: 1px solid #e74c3c; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; color: #e74c3c; }
.alert-info  { background: #152d1f; border: 1px solid #50C878; border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; color: #50C878; }

/* ── Info rows ───────────────────────────────────────────── */
.info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #2d3748; }
.info-row:last-child { border-bottom: none; }
.info-row code { font-family: monospace; font-size: 12px; color: #8892a4; }

/* ── Code block ──────────────────────────────────────────── */
.code-block { background: #0f1117; border-radius: 8px; padding: 16px; font-family: monospace; font-size: 13px; line-height: 2; }

/* ── Journey ─────────────────────────────────────────────── */
.journey-steps { display: flex; flex-direction: column; gap: 12px; }
.journey-step { display: flex; gap: 12px; align-items: flex-start; }
.step-num { width: 28px; height: 28px; background: #4A90D9; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.step-info { flex: 1; }

/* ── Chat ────────────────────────────────────────────────── */
.chat-msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; max-width: 90%; white-space: pre-wrap; }
.chat-user { background: #2d3748; align-self: flex-end; margin-left: auto; }
.chat-assistant { background: #1e2736; border: 1px solid #2d3748; }
#chat-history { display: flex; flex-direction: column; gap: 4px; }

/* ── Insights ────────────────────────────────────────────── */
.insight-item { border-bottom: 1px solid #2d3748; padding: 16px 0; }
.insight-item:last-child { border-bottom: none; }
.insight-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; font-size: 12px; }
.insight-body { color: #c4cdd8; font-size: 13px; line-height: 1.7; white-space: pre-wrap; }

/* ── Login page ──────────────────────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: #1a1f2e; border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; }
