:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1a1d21;
  --muted: #5b636b;
  --border: #d9dde2;
  --accent: #2f6f4f;
  --accent-text: #ffffff;
  --note-bg: #eaf4ee;
  --note-border: #bcdcc8;
  --error: #b3261e;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --card: #1e2226;
    --text: #e6e9ec;
    --muted: #9aa2ab;
    --border: #333a41;
    --accent: #4caf7d;
    --accent-text: #0d1411;
    --note-bg: #16281f;
    --note-border: #2c4a39;
    --error: #f2726a;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

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

.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.8rem;
}

.tagline {
  margin: 0;
  color: var(--muted);
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(127, 127, 127, 0.15);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.privacy {
  margin: 1.5rem 0;
  padding: 0.85rem 1rem;
  background: var(--note-bg);
  border: 1px solid var(--note-border);
  border-radius: 8px;
  font-size: 0.95rem;
}

.drop {
  position: relative;
  margin: 1.5rem 0;
}

.drop input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 2.5rem 1rem;
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: 12px;
  text-align: center;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.drop.dragover .drop-label {
  border-color: var(--accent);
  background: var(--note-bg);
}

.drop-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.drop-hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.status {
  min-height: 1.5rem;
  margin: 1rem 0;
  color: var(--muted);
}

.status.error {
  color: var(--error);
  font-weight: 600;
}

.status.busy::after {
  content: "";
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-left: 0.5em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.results {
  margin-top: 1.5rem;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat {
  flex: 1 1 8rem;
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.csv-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.button {
  font: inherit;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.button:hover {
  border-color: var(--accent);
}

.button.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}

.button.small {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

.preview h2 {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}

.filter-button {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.filter-button:hover {
  border-color: var(--accent);
}

.filter-button.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}

.preview-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0;
}

.check-col {
  width: 1.5rem;
  text-align: center;
  padding-right: 0.25rem;
}

.check-col input {
  cursor: pointer;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

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

th,
td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  background: var(--note-bg);
  position: sticky;
  top: 0;
}

tbody tr:last-child td {
  border-bottom: none;
}

.footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.footer a {
  color: var(--accent);
}
