:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --danger: #dc2626;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --radius: 10px;
}

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

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

/* ── Navbar ── */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--primary-light); color: var(--primary); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-username {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background .15s, box-shadow .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-amazon { background: #ff9900; color: #111; font-weight: 700; }
.btn-amazon:hover { background: #e68900; }

.btn-pccomp { background: #e31921; color: #fff; font-weight: 700; }
.btn-pccomp:hover { background: #c41218; }

.btn-full { width: 100%; justify-content: center; padding: 11px; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ── Main content ── */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.page-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.back-link { color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.back-link:hover { color: var(--text); }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

/* ── Catalog grid ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.article-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .15s, border-color .15s;
}
.article-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary);
}
.article-icon { font-size: 40px; line-height: 1; }
.article-body { flex: 1; }
.article-name { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.article-desc { color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.article-footer { display: flex; align-items: center; justify-content: space-between; }
.article-arrow { color: var(--primary); font-size: 18px; font-weight: 700; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}
.badge-price { background: var(--primary-light); color: var(--primary); }
.badge-lg { font-size: 14px; padding: 5px 14px; }

/* ── Article detail ── */
.article-detail { display: flex; flex-direction: column; gap: 16px; }
.article-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.article-icon-lg { font-size: 52px; line-height: 1; flex-shrink: 0; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }

.specs-table { width: 100%; border-collapse: collapse; }
.specs-table th, .specs-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.specs-table th { color: var(--text-muted); font-weight: 600; width: 40%; white-space: nowrap; }
.specs-table tr:last-child th, .specs-table tr:last-child td { border-bottom: none; }

.spec-tag {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 13px;
  margin: 2px;
}

.brand-note {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.search-card { }
.search-hint { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }
.search-buttons { display: flex; gap: 12px; flex-wrap: wrap; }

.compare-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--primary-light);
  border-color: #bfdbfe;
}
.compare-cta .card-title { margin-bottom: 4px; color: var(--primary-dark); }
.compare-cta p { font-size: 14px; color: var(--text-muted); }

/* ── Compare page ── */
.compare-layout { display: flex; flex-direction: column; gap: 16px; }
.product-inputs { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.prompt-textarea {
  width: 100%;
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 14px;
}
.prompt-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.form-group-full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

label { font-size: 13px; font-weight: 600; color: var(--text-muted); }

.text-input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.text-input-sm { padding: 6px 10px; font-size: 13px; }

.select-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}
.select-input:focus { outline: none; border-color: var(--primary); }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.form-card { max-width: 720px; margin: 0 auto; }

/* ── Specs builder ── */
.specs-section { margin-bottom: 20px; }
.specs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.specs-header label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.spec-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.spec-row .text-input { flex: 1; }

/* ── Admin table ── */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .actions { display: flex; gap: 6px; }
.text-center { text-align: center; }
.kw { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ── Users ── */
.user-list { display: flex; flex-direction: column; gap: 12px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-admin { background: #fef3c7; color: #92400e; }
.badge-user { background: #e0e7ff; color: #3730a3; }
.password-form { display: flex; gap: 8px; align-items: center; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  font-weight: 500;
}
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-success { background: var(--success-light); border: 1px solid #bbf7d0; color: #15803d; }

/* ── Login ── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}
.login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.login-icon { font-size: 40px; display: block; margin-bottom: 8px; }
.login-brand h1 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.login-brand p { color: var(--text-muted); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 16px; }
