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

:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --yellow: #d97706;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-600: #4b5563;
  --gray-800: #1f2937;
  --radius: 6px;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
}

/* ── Login ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.login-card h1 { font-size: 1.5rem; color: var(--blue); }
.login-card .subtitle { color: var(--gray-600); margin-bottom: 1.5rem; }

/* ── Nav ── */
.navbar {
  background: var(--blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.5rem;
  gap: 1rem;
}

.navbar-brand { font-weight: 600; font-size: 1rem; }

.navbar-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.navbar-links a { color: rgba(255,255,255,.85); text-decoration: none; font-size: .875rem; }
.navbar-links a:hover { color: white; }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

h2 { font-size: 1.25rem; margin-bottom: 1rem; }
h3 { font-size: 1rem; margin-bottom: .75rem; }

/* ── Stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat-number { font-size: 2rem; font-weight: 700; color: var(--blue); }
.stat-label { color: var(--gray-600); font-size: .875rem; margin: .25rem 0; }
.stat-link { font-size: .8rem; color: var(--blue); text-decoration: none; }

/* ── Upload ── */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.upload-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.upload-card h3 { margin-bottom: .25rem; }
.upload-card p { color: var(--gray-600); margin-bottom: .75rem; font-size: .875rem; }
.upload-card input[type="file"] { display: block; margin-bottom: .75rem; font-size: .875rem; width: 100%; }

.preview-section { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.25rem; }
.preview-actions { display: flex; gap: .75rem; margin-top: 1rem; align-items: center; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: .25rem; }
.form-group input {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .875rem;
}
.form-group input:focus { outline: 2px solid var(--blue); border-color: transparent; }

.search-form { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-form input {
  flex: 1;
  min-width: 200px;
  padding: .4rem .75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .875rem;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: .4rem .9rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
}

.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-success { background: var(--green); color: white; }
.btn-secondary { background: var(--gray-100); color: var(--gray-800); border: 1px solid var(--gray-200); }

/* ── Table ── */
.table-wrapper { overflow-x: auto; margin-bottom: 1rem; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: .875rem;
}

.table th {
  background: var(--gray-100);
  padding: .5rem .75rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: .45rem .75rem;
  border-bottom: 1px solid var(--gray-100);
}

.table tr:hover td { background: var(--gray-50); }

.article-id { font-family: monospace; font-size: .8rem; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; }
.count { color: var(--gray-600); font-weight: 400; font-size: 1rem; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 9999px;
  font-size: .75rem;
  font-weight: 500;
}

.badge-shop { background: #dbeafe; color: #1e40af; }
.badge-wawi { background: #d1fae5; color: #065f46; }
.badge-valenta { background: #ede9fe; color: #5b21b6; }
.badge-auto-high { background: #d1fae5; color: #065f46; }
.badge-auto-low { background: #fef3c7; color: #92400e; }
.badge-unmatched { background: #fee2e2; color: #991b1b; }
.badge-manual { background: #e0e7ff; color: #3730a3; }

/* ── Alerts ── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .875rem;
}

.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

/* ── Empty state ── */
.empty-state { color: var(--gray-600); padding: 2rem 0; text-align: center; }
.empty-state a { color: var(--blue); }
