/* Clinical / surgical palette — deep navy, clean ivory, fine accent */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --ink: #0f1d2e;
  --ink-soft: #3a4a5e;
  --muted: #7c8694;
  --line: #dfdcd3;
  --line-strong: #c8c4b8;
  --accent: #0f1d2e;
  --accent-2: #2563eb;
  --gold: #b08842;
  --danger: #b04545;
  --ok: #2e7d4f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 29, 46, 0.04), 0 8px 24px rgba(15, 29, 46, 0.06);
  --font-body: "Satoshi", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "Cabinet Grotesk", "Satoshi", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 14px; color: var(--accent); }
.brand .logo { color: var(--accent); }
.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.brand-sub { color: var(--muted); font-size: 12.5px; }
.badge {
  font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-soft);
  background: #efece4;
  border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 999px;
}

/* Layout */
main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 28px 80px;
}
footer {
  text-align: center;
  padding: 18px;
  color: var(--muted);
  font-size: 12.5px;
  border-top: 1px solid var(--line);
}

/* Steps */
.step { display: none; }
.step.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.step-header {
  display: flex; align-items: flex-start; gap: 16px;
  margin-bottom: 28px;
}
.step-num {
  flex: 0 0 36px; height: 36px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
}
.step-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  margin: 0 0 6px;
  letter-spacing: -0.015em;
}
.muted { color: var(--muted); font-size: 14px; margin: 0; }

/* Start cards — typed vs AI */
.start-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 720px) { .start-grid { grid-template-columns: 1fr; } }

.start-card {
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 22px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s, background .15s;
}
.start-card:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.start-card.drag { border-color: var(--accent-2); background: #f0f4ff; }
.sc-icon {
  flex: 0 0 52px; height: 52px;
  border-radius: 12px;
  display: grid; place-items: center;
}
.sc-icon.free { background: #e7f1ec; color: var(--ok); }
.sc-icon.ai   { background: #eef3ff; color: var(--accent-2); }
.sc-body { flex: 1; min-width: 0; }
.sc-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.sc-sub { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.sc-tag {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-body);
}
.sc-tag.ok { background: #e7f1ec; color: var(--ok); }
.sc-tag.ai { background: #fdf2e2; color: var(--gold); }
.dz-file {
  margin-top: 8px; font-size: 13px; color: var(--ok);
  font-weight: 500;
}

/* Buttons */
.actions {
  display: flex; gap: 12px; justify-content: flex-end;
  margin-top: 24px;
  flex-wrap: wrap;
}
.btn {
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 500;
  padding: 11px 22px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent); color: white;
}
.btn.primary:hover:not(:disabled) { background: #1c3454; }
.btn.primary:disabled { background: #cbd2d9; color: #fff; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink-soft); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface); border-color: var(--ink-soft); }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.5);
  border-top-color: white;
  border-radius: 999px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Form / cards */
.grid { display: grid; gap: 18px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px 22px;
  box-shadow: var(--shadow);
}
.card legend {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  padding: 0 8px;
  margin-left: -8px;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.field label {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.field input, .field textarea, .field select {
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: #fafaf6;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--accent-2);
  background: white;
}
.field textarea { resize: vertical; min-height: 56px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  main { padding: 20px 16px 60px; }
  .topbar { padding: 14px 18px; }
  .step-header h1 { font-size: 20px; }
}

/* Errors */
.error {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #fdecec;
  color: var(--danger);
  font-size: 14px;
  border: 1px solid #f3c0c0;
}

/* Downloads */
.downloads {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 8px;
}
@media (max-width: 640px) { .downloads { grid-template-columns: 1fr; } }
.download-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.download-card:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.dl-icon {
  width: 52px; height: 52px;
  border-radius: 10px;
  background: #eef3ff;
  color: var(--accent-2);
  display: grid; place-items: center;
  flex: 0 0 52px;
}
.dl-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.dl-sub { color: var(--muted); font-size: 13px; }

/* ---- Patient list view (new for VPS edition) ---- */
.list-toolbar { display:flex; gap:.75rem; align-items:center; margin-bottom:1rem; }
.list-toolbar input[type="search"] {
  flex:1; padding:.75rem 1rem; border:1px solid var(--line, #d8d4cc);
  border-radius:.5rem; background:#fff; font:inherit;
}
.patient-list { list-style:none; padding:0; margin:0; border-top:1px solid var(--line, #d8d4cc); }
.patient-row {
  display:flex; gap:1rem; padding:.85rem 1rem; border-bottom:1px solid var(--line, #d8d4cc);
  cursor:pointer; align-items:center; transition:background .12s ease;
}
.patient-row:hover, .patient-row:focus { background:#f4efe6; outline:none; }
.row-main { flex:1; min-width:0; }
.row-name { font-weight:700; color:var(--ink, #14213a); }
.row-sub { font-size:.85rem; color:var(--muted, #6b6557); margin-top:.15rem; }
.row-meta { text-align:right; font-size:.85rem; color:var(--muted, #6b6557); }
.row-date { font-size:.75rem; margin-top:.15rem; opacity:.8; }

.source-note {
  background:#eef3ec; border:1px solid #cfdcc9; padding:.6rem .8rem;
  border-radius:.5rem; margin-bottom:1rem; font-size:.9rem;
}

.pill { display:inline-block; padding:.1rem .5rem; border-radius:999px;
        font-size:.7rem; font-weight:700; letter-spacing:.04em; text-transform:uppercase; vertical-align:middle; }
.pill-good { background:#dceadb; color:#3c5a3a; }

.hidden { display:none !important; }

/* ---- Class aliases for VPS-edition HTML ---- */
.step-head {
  display:flex; gap:1rem; align-items:flex-start;
  margin-bottom:1.5rem;
}
.step-head .step-num {
  width:32px; height:32px; border-radius:50%; background:var(--ink, #14213a);
  color:#fff; display:grid; place-items:center; font-weight:700;
  flex-shrink:0;
}
.step-head h2 { margin:0 0 .25rem 0; font-family:'Cabinet Grotesk', system-ui; font-weight:800; font-size:1.5rem; color:var(--ink, #14213a); }
.step-head p { margin:0; }

.two-up { grid-template-columns: 1fr 1fr; }
.three-up { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 720px) {
  .two-up, .three-up { grid-template-columns: 1fr; }
}

.start-card .start-icon {
  width:48px; height:48px; border-radius:.5rem; background:#e7f1ec; color:#3c5a3a;
  display:grid; place-items:center; flex-shrink:0;
}
.start-card:nth-child(2) .start-icon { background:#eef3ff; color:var(--accent-2, #4a6fa5); }
.start-card { display:flex; gap:1rem; align-items:flex-start; }
.start-title { font-weight:700; font-size:1.05rem; color:var(--ink, #14213a); margin-bottom:.25rem; }
.start-desc { color:var(--muted, #6b6557); font-size:.9rem; line-height:1.45; }

.dl-card {
  display:flex; gap:1rem; align-items:center;
  background:#fff; border:1px solid var(--line, #d8d4cc); border-radius:.65rem;
  padding:1rem 1.25rem; text-decoration:none; color:inherit;
  transition:border-color .12s ease, transform .12s ease;
}
.dl-card:hover { border-color:var(--accent, #14213a); transform:translateY(-2px); }
.dl-icon {
  width:40px; height:40px; border-radius:.4rem; background:#f4efe6;
  display:grid; place-items:center; color:var(--accent, #14213a);
  flex-shrink:0;
}
.dl-title { font-weight:700; }
.dl-sub { color:var(--muted, #6b6557); font-size:.85rem; margin-top:.15rem; }

fieldset { border:1px solid var(--line, #d8d4cc); border-radius:.65rem; padding:1rem 1.25rem; margin-bottom:1.25rem; background:#fff; }
fieldset legend { padding:0 .5rem; font-weight:700; text-transform:uppercase; font-size:.75rem; letter-spacing:.08em; color:var(--muted, #6b6557); }

.error { background:#fdecec; border:1px solid #f0bdbd; padding:.6rem .8rem; border-radius:.5rem; color:#7a2222; font-size:.9rem; margin-bottom:1rem; }
