@font-face { font-family: 'Open Sans'; font-weight: 400; font-display: swap; src: url(/assets/fonts/open-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Open Sans'; font-weight: 600; font-display: swap; src: url(/assets/fonts/open-sans-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Open Sans'; font-weight: 700; font-display: swap; src: url(/assets/fonts/open-sans-latin-700-normal.woff2) format('woff2'); }

:root {
  --page: #eceef1;
  --paper: #ffffff;
  --ink: #1f1f1f;
  --text: #4a4a4a;
  --rule: #dcdcdc;
  --band: #f5f5f5;
  --red: #c8161d;
  --link: #2f6fd6;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--page);
  font-family: 'Open Sans', 'Segoe UI', Arial, sans-serif;
  color: var(--text);
  line-height: 1.5;
}

.card {
  width: 100%;
  max-width: 520px;
  background: var(--paper);
  border: 1px solid var(--rule);
}

.card-narrow { max-width: 420px; }

.userbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px 8px 32px;
  border-bottom: 1px solid var(--rule);
  background: var(--band);
  font-size: 0.85rem;
}
.userbar span { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.field { display: grid; gap: 6px; font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.field input {
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid #b9b9b9;
  background: #fff;
  color: var(--ink);
}
.field input:focus { outline: 2px solid var(--link); outline-offset: 1px; border-color: var(--ink); }

.history { padding: 0 32px 24px; }
.history h2 { margin: 0 0 8px; font-size: 0.95rem; color: var(--ink); }
.history ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.history li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--rule); font-size: 0.85rem;
}
.history .name { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .meta { flex-shrink: 0; text-align: right; }
.history .failed { color: var(--red); }

.card-head {
  padding: 28px 32px 22px;
  border-bottom: 1px solid var(--rule);
  text-align: center;
}
.card-head h1 { margin: 0; font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.card-head p { margin: 8px 0 0; font-size: 0.9rem; font-style: italic; color: #7a7a7a; }

.card-body { padding: 28px 32px; display: grid; gap: 18px; }

.drops { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .drops { grid-template-columns: 1fr; } }

.drop-step {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; margin-bottom: 4px;
  border: 1.5px solid var(--ink); border-radius: 50%;
  font-size: 0.75rem; font-weight: 700; color: var(--ink);
}
.drop.has-file .drop-step { background: var(--ink); color: #fff; }

.card-foot code { font-size: 0.78rem; background: var(--band); padding: 1px 4px; }

.drop {
  position: relative;
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 22px 12px;
  border: 1.5px dashed #b9b9b9;
  background: var(--band);
  cursor: pointer;
  text-align: center;
}
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop:focus-within { outline: 2px solid var(--link); outline-offset: 2px; }
.drop.dragging { border-color: var(--ink); background: #ececec; }
.drop.has-file { border-style: solid; border-color: var(--ink); }
.drop-title { font-weight: 600; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-hint { font-size: 0.85rem; }

button, .download {
  font: inherit;
  font-weight: 600;
  padding: 12px 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
button:disabled { background: #bdbdbd; border-color: #bdbdbd; cursor: not-allowed; }
button:focus-visible, .download:focus-visible, a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* Progress drawn as a barcode that fills in, echoing the admit card header */
.progress p { margin: 10px 0 0; font-weight: 600; color: var(--ink); text-align: center; }
.bars { display: flex; align-items: stretch; gap: 3px; height: 42px; }
.bars span { flex: 1; background: #e3e3e3; transition: background-color 0.2s; }
.bars span.w { flex: 2.4; }
.bars span.on { background: var(--ink); }
.bars.indeterminate span { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { background: #c9c9c9; } }

.result { display: grid; gap: 10px; }
.link-button {
  background: none; border: none; color: var(--link); font-weight: 400; padding: 4px;
}

.error { border-left: 4px solid var(--red); background: #fdf3f3; padding: 12px 16px; }
.error p { margin: 0; font-weight: 700; color: var(--red); }
.error ul { margin: 8px 0 0; padding-left: 18px; font-size: 0.88rem; }
.error li + li { margin-top: 4px; }

.card-foot {
  padding: 16px 32px 20px;
  border-top: 1px solid var(--rule);
  font-size: 0.82rem;
  text-align: center;
}
.card-foot a { color: var(--link); }

@media (max-width: 480px) {
  .card-head, .card-body, .card-foot, .history { padding-left: 20px; padding-right: 20px; }
  .userbar { padding-left: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .bars span { transition: none; }
  .bars.indeterminate span { animation: none; }
}

/* ---------------- Template pages ---------------- */
body.top { place-items: start center; }
.wide { max-width: 1040px; }
.nav { display: flex; gap: 18px; align-items: center; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; }
.nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }
.userbar .right { display: flex; gap: 14px; align-items: center; }
.section { padding: 24px 32px; border-bottom: 1px solid var(--rule); }
.section h2 { margin: 0 0 12px; font-size: 1.05rem; color: var(--ink); }
.section p.hint { margin: -6px 0 14px; font-size: 0.86rem; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row .field { flex: 1 1 200px; }
.btn-secondary { background: #fff; color: var(--ink); }
.btn-small { padding: 7px 12px; font-size: 0.85rem; }
a.btn { display: inline-block; font: inherit; font-weight: 600; padding: 7px 12px; font-size: 0.85rem; border: 1px solid var(--ink); color: var(--ink); background: #fff; text-decoration: none; }
.tpl-list { list-style: none; margin: 0; padding: 0; }
.tpl-list li { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.tpl-list .meta { font-size: 0.83rem; }
.tpl-list .name { font-weight: 700; color: var(--ink); }
.tpl-list .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border: 1px solid currentColor; margin-left: 6px; }
.badge.archived { color: #7a7a7a; }
.badge.failed, .badge.expired { color: var(--red); }
.badge.completed { color: #1f7a3a; }
.empty { font-size: 0.9rem; font-style: italic; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.stat { flex: 1 1 120px; border: 1px solid var(--rule); padding: 10px 14px; background: var(--band); }
.stat b { display: block; font-size: 1.4rem; color: var(--ink); }
.stat.bad b { color: var(--red); }
.stat.good b { color: #1f7a3a; }
.errlist { max-height: 220px; overflow: auto; border: 1px solid var(--rule); font-size: 0.84rem; margin: 0 0 14px; padding: 8px 12px 8px 28px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; margin-bottom: 12px; }
select, textarea { font: inherit; padding: 9px 10px; border: 1px solid #b9b9b9; background: #fff; color: var(--ink); }

.mt-10 { margin-top: 10px; }
.field-narrow { flex: 0 1 180px !important; }
.center { text-align: center; }
