:root {
  --bg: #0f1216;
  --surface: #181d24;
  --surface-2: #1f2630;
  --border: #2a323d;
  --text: #e7ecf2;
  --muted: #9aa7b6;
  --accent: #5db0a8;
  --accent-ink: #07110f;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  background: var(--surface-2);
  padding: 0.05em 0.4em;
  border-radius: 6px;
  font-size: 0.9em;
}

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.hero h1 {
  font-size: 2.2rem;
  letter-spacing: -0.03em;
  margin: 0 0 0.25rem;
}
.hero p { color: var(--muted); margin: 0 0 1.5rem; }

.tool-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card a { display: block; padding: 1.1rem 1.2rem; color: inherit; }
.tool-card a:hover { text-decoration: none; }
.tool-card h2 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.tool-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.tool-card--soon { opacity: 0.6; }

.badge {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  vertical-align: middle;
}

.crumbs { margin-bottom: 1rem; font-size: 0.9rem; }
.tool h1 { font-size: 1.7rem; letter-spacing: -0.02em; margin: 0 0 0.5rem; }
.lead { color: var(--muted); margin: 0 0 1.5rem; }

.upload {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: grid;
  gap: 1.1rem;
}
.field { display: grid; gap: 0.5rem; }
.field > span { font-weight: 600; font-size: 0.95rem; }
.field input[type="file"] {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.9rem;
  color: var(--text);
  width: 100%;
}

.btn {
  justify-self: start;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 1.3rem;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.07); }

/* ---- CSV upload tool (Phase 3) ---- */
.dropzone {
  position: relative;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1.25rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.is-dragover { border-color: var(--accent); background: #1b2730; }
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.dropzone input[type="file"]:focus-visible {
  opacity: 1;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.dropzone__inner { display: grid; gap: 0.35rem; pointer-events: none; }
.dropzone__inner strong { font-size: 1.05rem; }
.dropzone__inner span { color: var(--muted); font-size: 0.9rem; }

.file-list { margin: 0; color: var(--text); font-size: 0.9rem; word-break: break-word; }
.file-list:empty { display: none; }
.field-error { margin: 0; color: #ff9b9b; font-size: 0.9rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn--ghost:hover { filter: none; border-color: var(--accent); }
a.btn { text-decoration: none; }
a.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: progress; }

.working { display: none; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.9rem; }
#csv-working.htmx-request { display: inline-flex; }
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.banner {
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
}
.banner--error { background: #2a1a1d; border-color: #5a2b30; color: #ffb4b4; }
.banner--ok { background: #16271f; border-color: #2f5a45; color: #9fe6c4; }

.result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: grid;
  gap: 1.1rem;
}
.stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}
.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
  text-align: center;
  display: grid;
  gap: 0.2rem;
}
.stat__num { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.stat__label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.stat--flag { border-color: #6a5a2b; }
.stat--flag .stat__num { color: #f2d479; }

.result__note { margin: 0; color: var(--muted); font-size: 0.9rem; }
.result__detail summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
.sheet-table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; font-size: 0.88rem; }
.sheet-table th, .sheet-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  text-align: left;
}
.sheet-table th:not(:first-child), .sheet-table td:not(:first-child) { text-align: right; }
.result__review h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.result__review ul { margin: 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.9rem; }

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1.25rem;
  text-align: center;
}
