@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,500;8..60,600&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --ink: #14211f;
  --paper: #f7f5f0;
  --paper-raised: #fffdf8;
  --line: #d8d2c4;
  --teal: #1b4d47;
  --teal-dim: #e4ece9;
  --amber: #b5792a;
  --amber-dim: #f6e9d8;
  --green: #2f6b4f;
  --green-dim: #e4efe8;
  --red: #9b2c2c;
  --red-dim: #f6e3e3;
  --muted: #6b6a62;
  --radius: 3px;
  --shadow: 0 1px 2px rgba(20, 33, 31, 0.06), 0 8px 24px -12px rgba(20, 33, 31, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

body {
  min-height: 100vh;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% 42px;
  background-position: 0 86px;
  background-repeat: repeat-y;
}

.serif { font-family: 'Source Serif 4', Georgia, serif; }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

a { color: var(--teal); }

header.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-raised);
}

header.topbar .wordmark {
  font-family: 'Source Serif 4', serif;
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.01em;
}
header.topbar .wordmark small {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

header.topbar button.link {
  background: none;
  border: none;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
header.topbar button.link:hover { color: var(--ink); }

main {
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.steps {
  display: flex;
  gap: 28px;
  margin-bottom: 40px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.step {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.step .n { display: inline-block; width: 1.4em; }
.step.active { color: var(--ink); font-weight: 600; }
.step.done { color: var(--teal); }

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

.card h1 {
  font-family: 'Source Serif 4', serif;
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 6px;
}
.card p.lede {
  color: var(--muted);
  margin: 0 0 28px;
}

.dropzones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}
@media (max-width: 560px) {
  .dropzones { grid-template-columns: 1fr; }
}

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--paper);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--teal); background: var(--teal-dim); }
.dropzone.has-file { border-style: solid; border-color: var(--teal); background: var(--teal-dim); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.dropzone .filename {
  font-weight: 500;
  word-break: break-word;
  font-size: 13.5px;
}
.dropzone .hint { color: var(--muted); font-size: 13px; }

button.primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 13px 22px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  font-size: 14.5px;
  border-radius: var(--radius);
  cursor: pointer;
  width: 100%;
  justify-content: center;
}
button.primary:hover { background: #163f3a; }
button.primary:disabled { background: #a9b5b2; cursor: not-allowed; }

button.secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 13px 22px;
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 500;
  font-size: 14.5px;
  border-radius: var(--radius);
  cursor: pointer;
}
button.secondary:hover { border-color: var(--ink); }

.actions { display: flex; gap: 12px; margin-top: 28px; }
.actions button.secondary { flex: 0 0 auto; }
.actions button.primary { flex: 1; }

/* ---- stamp (signature element) ---- */
.stamp-wrap { display: flex; justify-content: center; margin-bottom: 30px; }
.stamp {
  width: 128px;
  height: 128px;
  border: 3px solid var(--teal);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: rotate(-6deg);
  color: var(--teal);
}
.stamp .num {
  font-family: 'Source Serif 4', serif;
  font-size: 40px;
  font-weight: 600;
  line-height: 1;
}
.stamp .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  margin-top: 4px;
  padding: 0 10px;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 26px;
}
.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--paper);
}
.metric .value { font-family: 'IBM Plex Mono', monospace; font-size: 20px; font-weight: 600; }
.metric .label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.metric.ok { background: var(--green-dim); border-color: #b9d6c4; }
.metric.ok .value { color: var(--green); }
.metric.warn { background: var(--amber-dim); border-color: #e4c69a; }
.metric.warn .value { color: var(--amber); }

table.preview {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
  font-size: 13.5px;
}
table.preview th, table.preview td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
table.preview th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 500;
}
table.preview td.num { font-family: 'IBM Plex Mono', monospace; }
.preview-caption { color: var(--muted); font-size: 12.5px; margin: 0 0 20px; }

.alert {
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13.5px;
  margin-bottom: 20px;
}
.alert.error { background: var(--red-dim); color: var(--red); border: 1px solid #e3b7b7; }
.alert.warn { background: var(--amber-dim); color: #7a4e1b; border: 1px solid #e4c69a; }

.column-pick {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  background: var(--paper);
}
.column-pick label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.column-pick select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  background: #fff;
}

footer.note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 28px;
}

.hidden { display: none !important; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 340px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}
.login-card h1 { font-family: 'Source Serif 4', serif; font-size: 22px; margin: 0 0 4px; }
.login-card p { color: var(--muted); font-size: 13.5px; margin: 0 0 24px; }
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14.5px;
  font-family: 'IBM Plex Sans', sans-serif;
}
.field input:focus, select:focus, .dropzone:focus-within, button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .card, .stamp-wrap { animation: rise 0.28s ease-out; }
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
