@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap");

:root {
  color-scheme: dark;
  --font-sans: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;

  --bg-base: #09090b;
  --bg-elevated: #111113;
  --bg-surface: #18181b;
  --bg-muted: #27272a;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;

  --accent: #8b5cf6;
  --accent-hover: #a78bfa;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --accent-glow: rgba(139, 92, 246, 0.35);

  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 40px var(--accent-glow);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 92, 246, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(59, 130, 246, 0.08), transparent),
    var(--bg-base);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.app-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #ddd6fe;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
}

h2 {
  font-size: 1.05rem;
  font-weight: 600;
}

.lead {
  margin: 8px 0 0;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 56ch;
}

.muted {
  color: var(--text-muted);
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.card {
  background: linear-gradient(180deg, rgba(24, 24, 27, 0.95), rgba(17, 17, 19, 0.92));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.card + .card,
.stats + .card,
.card + .stats {
  margin-top: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
  color: #fff;
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.btn-secondary {
  background: var(--bg-muted);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: #3f3f46;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.stat-card {
  padding: 16px 18px;
}

.stat-card label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.download-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-top: 16px;
  padding: 20px 22px;
  border-color: rgba(139, 92, 246, 0.28);
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(24, 24, 27, 0.95)),
    var(--bg-surface);
  box-shadow: var(--shadow-glow);
}

.download-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-text {
  font-size: 13px;
  color: var(--text-muted);
}

.status-text.is-error {
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

th {
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #d4d4d8;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: #ddd6fe;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.link-btn:hover {
  background: rgba(139, 92, 246, 0.22);
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  padding: 28px;
}

.field {
  margin-top: 16px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-card .btn-primary {
  width: 100%;
  margin-top: 18px;
}

.form-status {
  min-height: 22px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--danger);
}

@media (max-width: 720px) {
  .download-card {
    grid-template-columns: 1fr;
  }

  .page-header {
    align-items: stretch;
  }
}
