:root {
  --bg: #f3f1ec;
  --ink: #1c1917;
  --muted: #57534e;
  --line: #d6d3d1;
  --card: #fffcf7;
  --accent: #0f766e;
  --accent-ink: #042f2e;
  --warn: #9a3412;
  --ok: #166534;
  --shadow: 0 10px 30px rgba(28, 25, 23, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  background:
    radial-gradient(1200px 400px at 10% -10%, #ddf3ef, transparent 60%),
    var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.page {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 40px 20px 72px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: var(--accent);
  font-weight: 700;
}

.lede {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.lede strong { color: var(--ink); }

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 0;
  margin: 32px 0;
}

.steps li {
  display: flex;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.steps p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.step-num {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: #ecfdf5;
  display: grid;
  place-items: center;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
}

.layout {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}

h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

h3 {
  margin: 24px 0 8px;
  font-size: 1rem;
}

.hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.92rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: #f4eee6;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.dropzone {
  display: block;
  border: 2px dashed #a8a29e;
  border-radius: 14px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  background: #faf7f2;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: #ecfdf5;
}

.dropzone:focus-visible {
  outline: 3px solid #5eead4;
  outline-offset: 2px;
}

.dropzone input { display: none; }

.dropzone-body .icon {
  width: 36px;
  height: 36px;
  color: var(--accent);
}

.drop-title {
  margin: 8px 0 4px;
  font-weight: 600;
}

.drop-sub {
  margin: 0;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.88rem;
}

[hidden] { display: none !important; }

.file-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.file-name {
  font-weight: 700;
  word-break: break-all;
}

.file-meta {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

button,
.btn-download {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  border: 0;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button#run,
.btn-download.primary {
  background: var(--accent);
  color: #ecfdf5;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.secondary,
.btn-download {
  background: transparent;
  color: var(--accent-ink);
  border: 1px solid var(--line);
}

.linkish {
  background: none;
  border: 0;
  color: var(--accent);
  padding: 4px;
  font-size: 0.85rem;
}

.status {
  margin: 16px 0 0;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
}

.status.error { color: var(--warn); }
.status.ok { color: var(--ok); }
.status.busy { color: var(--accent); }

.pii-list {
  margin: 0 0 20px;
  padding-left: 18px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.95rem;
}

.help-card h2:not(:first-child) { margin-top: 20px; }

.results { margin-top: 20px; }

.results-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.count-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.count-grid li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.count-grid .n {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
}

.empty-counts {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 8px;
}

.metrics {
  margin-top: 24px;
  background: #f4eee6;
  border-radius: 12px;
  padding: 12px 16px;
}

.metrics summary {
  cursor: pointer;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
}

.metrics .hint { margin-top: 10px; }

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 0;
}

.metric-row div {
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.metric-row dt {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-row dd {
  margin: 4px 0 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  word-break: break-word;
}

th { color: var(--muted); font-weight: 600; }

td.arrow {
  width: 36px;
  color: var(--accent);
  font-weight: 700;
}

@media (max-width: 800px) {
  .steps,
  .layout,
  .metric-row {
    grid-template-columns: 1fr;
  }
}
