:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --red: #fca5a5;
  --amber-bg: #431407;
  --amber-text: #fcd34d;
  --amber-border: #92400e;
  --green: #4ade80;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 2rem 1rem;
  line-height: 1.5;
}

main { max-width: 980px; margin: 0 auto; }

h1 { font-size: 1.75rem; margin: 0 0 0.25rem; }
.tagline { color: var(--muted); margin: 0 0 2rem; }

/* ── Form ─────────────────────────────────────────────────────────────────── */
.input-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: stretch;
}

#url-input {
  flex: 1;
  min-width: 280px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
}

#url-input::placeholder { color: var(--muted); }

#url-input:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

#submit-btn {
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

#submit-btn:hover:not(:disabled) { background: var(--accent-hover); }
#submit-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.token-note {
  font-size: 0.82rem;
  color: var(--green);
  margin: 1rem 0 0;
}

.storage-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.25rem 0 0 1.4rem;
}

.token-row { margin-top: 0.5rem; }
.token-row input {
  flex: 1;
  min-width: 280px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
}
.token-row input::placeholder { color: var(--muted); }
.token-row input:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.option-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.option-row input[type="checkbox"] { cursor: pointer; width: 1em; height: 1em; accent-color: var(--accent); }
.option-row label { cursor: pointer; }

.note {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.75rem 0 0;
}

.legend {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.4rem 0 0;
}

.legend-swatch { font-style: normal; }

/* ── Error banner ─────────────────────────────────────────────────────────── */
#error {
  margin-top: 1.5rem;
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: var(--amber-text);
  font-size: 0.95rem;
}

/* ── Progress log ─────────────────────────────────────────────────────────── */
#progress {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.82rem;
  color: var(--muted);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── Results ──────────────────────────────────────────────────────────────── */
#results { margin-top: 1.5rem; }

.summary {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

thead tr { border-bottom: 2px solid var(--border); }

th {
  text-align: left;
  padding: 0.55rem 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--muted);
}

td { padding: 0.45rem 0.85rem; border-bottom: 1px solid var(--border); }

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #273548; }

/* New package — first release within the last 30 days */
.age-new { color: var(--red); font-weight: 500; }

/* Fresh version — released within the last 7 days */
.age-fresh { color: #fcd34d; font-weight: 500; }

/* Package that failed to resolve */
.row-error td { color: var(--muted); font-style: italic; }

/* PyPI links in the results table */
table a { color: var(--accent); text-decoration: none; }
table a:hover { text-decoration: underline; }
