/* ── Variables ── */
:root {
  --bg: #1a1a1a;
  --bg-surface: #242424;
  --bg-hover: #2e2e2e;
  --border: #383838;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #6aa6ff;
  --accent-hover: #5594f0;
  --success: #4caf6e;
  --warning: #e8a83e;
  --error: #e05252;
  --info: #6aa6ff;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Layout ── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.5rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
}
.nav-brand:hover { text-decoration: none; color: var(--accent-hover); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }

.nav-logout { display: flex; }
.nav-link-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}

/* ── Flash messages ── */
.flash-container {
  max-width: 900px;
  margin: 1rem auto 0;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.flash-error   { background: rgba(224,82,82,.12);  border-color: var(--error);   color: #f08080; }
.flash-success { background: rgba(76,175,110,.12); border-color: var(--success); color: #7dca99; }
.flash-warning { background: rgba(232,168,62,.12); border-color: var(--warning); color: #e8c97a; }
.flash-info    { background: rgba(106,166,255,.12);border-color: var(--info);    color: var(--accent); }

/* ── Forms ── */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
input::placeholder { color: var(--text-muted); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); }

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

.btn-full { width: 100%; }

/* ── Auth page ── */
.auth-box {
  max-width: 360px;
  margin: 4rem auto 0;
  background: var(--bg-surface);
  padding: 2.5rem 2rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

/* ── Page headings ── */
h1 { font-size: 1.4rem; font-weight: 600; margin-bottom: 1.5rem; }
h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-muted); }

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

/* ── Tables ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

thead th {
  text-align: left;
  padding: 0.6rem 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }
tbody tr:hover { background: var(--bg-hover); cursor: default; }
tbody tr.clickable:hover { cursor: pointer; }

td { padding: 0.65rem 0.875rem; vertical-align: middle; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-success { background: rgba(76,175,110,.18);  color: #7dca99; }
.badge-partial { background: rgba(232,168,62,.18);  color: #e8c97a; }
.badge-failed  { background: rgba(224,82,82,.18);   color: #f08080; }
.badge-running {
  background: rgba(106,166,255,.18);
  color: var(--accent);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* ── Utility ── */
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }

/* ── Alerts ── */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border: 1px solid transparent;
  margin-bottom: 1.25rem;
}
.alert-warning { background: rgba(232,168,62,.1); border-color: var(--warning); color: #e8c97a; }
.alert a { color: inherit; text-decoration: underline; }

/* ── Progress (running import) ── */
.running-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.progress-wrap {
  background: var(--bg);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 4px;
}

.progress-stats {
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.progress-stats strong { color: var(--text); }

/* ── Import table ── */
.import-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.import-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.import-table td { padding: 0.55rem 0.75rem; vertical-align: middle; border-bottom: 1px solid var(--border); }
.import-table tbody tr:hover { background: var(--bg-hover); }
.error-row td { padding: 0 0.75rem 0.6rem; border-bottom: 1px solid var(--border); }
.error-row small { word-break: break-word; }

/* ── Disabled inputs ── */
input:disabled, button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .container { padding: 1.25rem 1rem; }
  .navbar { padding: 0.75rem 1rem; }
  .auth-box { margin: 2rem auto 0; padding: 1.75rem 1.25rem; }
  h1 { font-size: 1.2rem; }
}
