:root {
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --text: #1a1d23;
  --muted: #6b7280;
  --border: #e2e4e9;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --error: #dc2626;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --card-bg: #1d2025;
    --text: #e9eaec;
    --muted: #9aa0ab;
    --border: #2c2f36;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --error: #f87171;
  }
}

* { box-sizing: border-box; }

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

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

header h1 {
  font-size: 1.6rem;
  margin: 0 0 0.4rem;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 2rem;
  line-height: 1.5;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card h2 {
  font-size: 1rem;
  margin: 0 0 0.9rem;
}

.card h2:not(:first-child) {
  margin-top: 1.5rem;
}

.hidden { display: none !important; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 140px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  padding: 1rem;
  color: var(--muted);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.filename {
  font-weight: 600;
  color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.82rem;
  color: var(--muted);
}

select, input[type="text"] {
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.92rem;
}

select:focus, input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button.primary {
  margin-top: 1.25rem;
  padding: 0.65rem 1.2rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

button.primary:hover { background: var(--accent-hover); }

button.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error {
  color: var(--error);
  font-size: 0.88rem;
  margin-top: 0.75rem;
}

.stats {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.stats strong { color: var(--text); }

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

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.82rem;
  white-space: nowrap;
}

th, td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  background: var(--bg);
  font-weight: 600;
}

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

footer {
  margin-top: 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
}
