/* =====================================================================
   Bedside Physicians Onboarding — Stylesheet
   Matches the marketing prototype: navy #0F2847, teal #0D9488,
   Fraunces (display) + Geist (body).
   ===================================================================== */

:root {
  --navy-900: #0F2847;
  --navy-800: #163556;
  --teal-700: #0D9488;
  --teal-600: #14B8A6;
  --teal-200: #99F6E4;
  --mint:     #5BE5CA;

  --ink:      #1A2533;
  --ink-soft: #5B6B7A;
  --slate-500:#64748B;
  --slate-300:#CBD5E1;

  --bg:       #FFFFFF;
  --bg-soft:  #F4F7F9;
  --bg-mute:  #EEF2F5;
  --line:     #D6DCE0;
  --line-soft:#E5EAEE;

  --danger:   #DC2626;
  --warn:     #D97706;
  --success:  #059669;

  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(15,40,71,.06), 0 1px 3px rgba(15,40,71,.04);
  --shadow:    0 4px 10px rgba(15,40,71,.06), 0 2px 4px rgba(15,40,71,.04);
  --shadow-lg: 0 12px 32px rgba(15,40,71,.10), 0 4px 12px rgba(15,40,71,.06);

  --font-body:    'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-soft);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--navy-900);
  margin: 0 0 .6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1 { font-size: 2rem; line-height: 1.15; }
h2 { font-size: 1.5rem; line-height: 1.2; }
h3 { font-size: 1.15rem; line-height: 1.3; }

p { margin: 0 0 1rem; color: var(--ink-soft); }
a { color: var(--teal-700); }

/* =====================================================================
   Top bar / brand header
   ===================================================================== */
.topbar {
  background: var(--navy-900);
  color: #fff;
  padding: 1.1rem 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--teal-600), var(--mint));
  display: flex; align-items: center; justify-content: center;
  color: var(--navy-900);
  font-family: var(--font-display);
  font-weight: 700; font-size: 1.2rem;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -.01em;
}
.brand-tagline {
  font-size: .8rem;
  color: rgba(255,255,255,.65);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.save-status {
  font-size: .85rem;
  color: rgba(255,255,255,.7);
  display: flex; align-items: center; gap: .5rem;
}
.save-status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 8px var(--mint);
}
.save-status.is-saving .dot { background: #FBBF24; box-shadow: 0 0 8px #FBBF24; }
.save-status.is-error  .dot { background: #F87171; box-shadow: 0 0 8px #F87171; }

/* =====================================================================
   Progress bar
   ===================================================================== */
.progress-wrap {
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.progress-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex; align-items: center; gap: 1.25rem;
  flex-wrap: wrap;
}
.progress-track {
  flex: 1;
  min-width: 200px;
  height: 8px;
  background: var(--bg-mute);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal-700), var(--mint));
  border-radius: 999px;
  transition: width .35s ease;
  width: 0;
}
.progress-meta {
  font-size: .88rem;
  color: var(--ink-soft);
  font-weight: 500;
  white-space: nowrap;
}
.progress-meta strong { color: var(--navy-900); }

/* =====================================================================
   Main layout: sidebar + content
   ===================================================================== */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding-top: 1rem; }
}

.sidebar {
  position: sticky;
  top: 1rem;
  align-self: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
@media (max-width: 900px) {
  .sidebar { position: static; max-height: none; }
}
.sidebar h4 {
  font-family: var(--font-body);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 .5rem .75rem;
  font-weight: 600;
}
.step-list {
  list-style: none;
  padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.step-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .55rem .75rem;
  border-radius: 8px;
  font-size: .9rem;
  color: var(--ink);
  cursor: pointer;
  background: transparent;
  border: none;
  text-align: left;
  width: 100%;
  font-family: var(--font-body);
}
.step-item:hover { background: var(--bg-soft); }
.step-item.is-active {
  background: var(--navy-900);
  color: #fff;
  font-weight: 500;
}
.step-item.is-active .step-num { background: rgba(255,255,255,.2); color: #fff; }
.step-item.is-complete .step-num { background: var(--teal-700); color: #fff; }
.step-num {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--bg-mute);
  color: var(--ink-soft);
  font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* =====================================================================
   Content card
   ===================================================================== */
.content {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2.5rem 2rem;
  min-height: 60vh;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 600px) { .content { padding: 1.5rem 1.25rem; } }

.section-head {
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .72rem; letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--teal-700);
  font-weight: 600;
  margin-bottom: .6rem;
}
.eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--teal-600);
}
.section-head p { font-size: 1rem; }

/* =====================================================================
   Sub-headings inside a step
   ===================================================================== */
.sub-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-soft);
}
.sub-section:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.sub-section > h3 {
  font-family: var(--font-display);
  color: var(--navy-800);
  margin-bottom: .25rem;
}
.sub-section > p.sub-help {
  font-size: .92rem;
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
}

/* =====================================================================
   Fields
   ===================================================================== */
.field {
  margin-bottom: 1.25rem;
}
.field-label {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem;
  font-weight: 500;
  color: var(--navy-900);
  font-size: .95rem;
  margin-bottom: .35rem;
}
.field-label .req { color: var(--danger); font-weight: 600; }
.field-hint {
  font-size: .82rem;
  color: var(--ink-soft);
  margin: 0 0 .5rem;
  font-style: italic;
}

.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
  padding: .65rem .85rem;
  font: inherit;
  color: var(--ink);
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
  font-family: var(--font-body);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--teal-700);
  box-shadow: 0 0 0 3px rgba(13,148,136,.15);
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235B6B7A' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position: right 1rem center; padding-right: 2.25rem; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

/* Checkbox / radio groups */
.check-group, .radio-group {
  display: flex; flex-direction: column; gap: .5rem;
  margin-top: .25rem;
}
.check-group.horizontal { flex-direction: row; flex-wrap: wrap; gap: .75rem 1.25rem; }
.check, .radio-pill {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-size: .92rem;
  transition: all .15s;
  user-select: none;
}
.check:hover, .radio-pill:hover { border-color: var(--teal-600); background: var(--bg-soft); }
.check input, .radio-pill input { accent-color: var(--teal-700); width: 16px; height: 16px; margin: 0; }
.check.is-on, .radio-pill.is-on {
  border-color: var(--teal-700);
  background: rgba(13,148,136,.06);
}

/* =====================================================================
   Tables (repeating rows)
   ===================================================================== */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  background: #fff;
}
.data-table thead th {
  background: var(--navy-900);
  color: #fff;
  text-align: left;
  padding: .65rem .85rem;
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .02em;
}
.data-table td {
  border-top: 1px solid var(--line-soft);
  padding: .35rem .45rem;
  vertical-align: top;
}
.data-table input, .data-table textarea {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: .45rem .55rem;
  border-radius: 6px;
  font: inherit;
  font-size: .9rem;
}
.data-table input:focus, .data-table textarea:focus {
  outline: none;
  border-color: var(--teal-600);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(13,148,136,.12);
}
.row-actions {
  display: flex; gap: .5rem; padding: .65rem .85rem;
  background: var(--bg-soft);
  border-top: 1px solid var(--line-soft);
}

/* =====================================================================
   File upload
   ===================================================================== */
.file-drop {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.file-drop:hover, .file-drop.is-drag {
  border-color: var(--teal-600);
  background: rgba(13,148,136,.04);
}
.file-drop input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.file-drop .icon { font-size: 1.5rem; margin-bottom: .4rem; color: var(--teal-700); }
.file-drop .label { font-weight: 500; color: var(--navy-900); }
.file-drop .hint  { font-size: .8rem; color: var(--ink-soft); margin-top: .25rem; }

.file-list { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
.file-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .75rem;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  font-size: .87rem;
}
.file-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--navy-900); }
.file-item .name a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--ink-soft); }
.file-item .size { color: var(--ink-soft); font-size: .8rem; }
.file-item .remove {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
  padding: .2rem .4rem;
}
.file-item .remove:hover { background: rgba(220,38,38,.08); border-radius: 4px; }

/* =====================================================================
   Audio recorder
   ===================================================================== */
.audio-block {
  margin-top: .55rem;
  padding: .75rem .9rem;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  display: flex; flex-direction: column; gap: .5rem;
}
.audio-row {
  display: flex; align-items: center; gap: .6rem;
  flex-wrap: wrap;
}
.mic-btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  color: var(--navy-900);
  transition: all .15s;
}
.mic-btn:hover { border-color: var(--teal-700); color: var(--teal-700); }
.mic-btn.is-recording {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  animation: pulse-rec 1.2s infinite;
}
@keyframes pulse-rec {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); }
  50%      { box-shadow: 0 0 0 8px rgba(220,38,38,0); }
}
.mic-btn svg { width: 14px; height: 14px; }
.audio-time {
  font-variant-numeric: tabular-nums;
  font-size: .85rem;
  color: var(--ink-soft);
}
.audio-upload-btn {
  font-size: .82rem;
  color: var(--teal-700);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 999px;
  padding: .4rem .8rem;
  cursor: pointer;
}
.audio-upload-btn:hover { border-color: var(--teal-700); background: rgba(13,148,136,.05); }
.audio-upload-btn input { display: none; }

.audio-preview {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .65rem;
  background: #fff;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.audio-preview audio { flex: 1; max-width: 100%; height: 36px; }
.audio-preview .remove {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.1rem;
}

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .5rem;
  padding: .65rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-size: .92rem;
  font-family: var(--font-body);
}
.btn-primary { background: var(--navy-900); color: #fff; }
.btn-primary:hover { background: var(--navy-800); }
.btn-accent  { background: var(--teal-700);  color: #fff; }
.btn-accent:hover  { background: var(--teal-600); }
.btn-ghost   { background: transparent; color: var(--navy-900); border-color: var(--line); }
.btn-ghost:hover   { border-color: var(--navy-900); background: var(--bg-soft); }
.btn-sm  { padding: .4rem .85rem; font-size: .85rem; }
.btn-lg  { padding: .85rem 1.5rem; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* =====================================================================
   Footer nav
   ===================================================================== */
.step-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-soft);
}
.step-nav .right { display: flex; gap: .75rem; }

/* =====================================================================
   Callout / info box
   ===================================================================== */
.callout {
  background: rgba(13,148,136,.06);
  border-left: 3px solid var(--teal-700);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  margin: 1rem 0 1.5rem;
  font-size: .92rem;
}
.callout strong { color: var(--navy-900); }
.callout.warn { background: rgba(217,119,6,.06); border-color: var(--warn); }

/* =====================================================================
   Gate (access code) screen
   ===================================================================== */
.gate-screen {
  max-width: 480px;
  margin: 6vh auto 0;
  padding: 0 1.5rem;
}
.gate-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.gate-card .brand-mark { margin: 0 auto 1rem; width: 56px; height: 56px; font-size: 1.6rem; }
.gate-card h1 { font-size: 1.6rem; margin-bottom: .25rem; }
.gate-card .form-row { margin-top: 1.5rem; }
.gate-card .input { font-size: 1rem; text-align: center; letter-spacing: .15em; text-transform: uppercase; }
.gate-error { color: var(--danger); font-size: .88rem; margin-top: .5rem; min-height: 1.3em; }

/* =====================================================================
   Toast
   ===================================================================== */
.toast-stack {
  position: fixed; bottom: 1.25rem; right: 1.25rem;
  display: flex; flex-direction: column; gap: .5rem;
  z-index: 999;
  max-width: 340px;
}
.toast {
  background: var(--navy-900);
  color: #fff;
  border-radius: 10px;
  padding: .75rem 1rem;
  font-size: .9rem;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: .6rem;
  animation: toast-in .25s ease-out;
}
.toast.success { background: var(--success); }
.toast.warn    { background: var(--warn); }
.toast.error   { background: var(--danger); }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* =====================================================================
   Loading spinner
   ===================================================================== */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   Final / success screen
   ===================================================================== */
.success-screen {
  text-align: center;
  padding: 3rem 2rem;
}
.success-screen .big-check {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--teal-700);
  color: #fff;
  font-size: 2rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.25rem;
}

/* =====================================================================
   Utility
   ===================================================================== */
.muted { color: var(--ink-soft); }
.text-sm { font-size: .85rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.text-center { text-align: center; }

/* =====================================================================
   Repeater (cards of sub-fields)
   ===================================================================== */
.repeater {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.repeater-empty {
  padding: 1.25rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  text-align: center;
  color: var(--ink-soft);
  font-size: .9rem;
  background: rgba(0,0,0,.015);
}
.repeater-items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.repeater-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,40,71,.04);
}
.repeater-item-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: linear-gradient(180deg, rgba(13,148,136,.06), rgba(13,148,136,.02));
  border-bottom: 1px solid var(--line);
}
.repeater-item-num {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .85rem;
  flex-shrink: 0;
}
.repeater-item-title {
  flex: 1;
  font-weight: 600;
  color: var(--ink);
  font-size: .95rem;
}
.repeater-remove {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.repeater-remove:hover {
  background: var(--danger, #dc2626);
  color: #fff;
  border-color: var(--danger, #dc2626);
}
.repeater-item-body {
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.repeater-item-body .sub-field {
  /* Sub-fields a bit tighter than top-level fields */
}
.repeater-item-body .field-label {
  font-size: .85rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: .25rem;
}
.repeater-item-body .field-hint {
  font-size: .8rem;
  color: var(--ink-soft);
  margin-bottom: .35rem;
}
.repeater-add {
  align-self: flex-start;
  border: 1px dashed var(--accent);
  color: var(--accent);
  background: transparent;
}
.repeater-add:hover {
  background: var(--accent);
  color: #fff;
}

/* Gate enhancements for name + code */
.gate-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.gate-hint {
  font-size: .78rem;
  color: var(--ink-soft);
  margin-top: .35rem;
  line-height: 1.4;
}
.contrib-display {
  font-size: .8rem;
  color: var(--ink-soft);
  margin-right: .5rem;
  font-weight: 500;
}
