/* ============================================================
   PatientQ — Shared Styles
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&family=DM+Serif+Display&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal:      #0b8a7e;
  --teal-dark: #065f5a;
  --teal-light:#e0f4f2;
  --teal-mid:  #b2e4df;
  --navy:      #0f3d4a;
  --white:     #ffffff;
  --g50:       #f8fafc;
  --g100:      #f1f5f4;
  --g200:      #e2e8e7;
  --g300:      #c8d4d2;
  --g400:      #94a3a1;
  --g600:      #4a6360;
  --g700:      #2e4845;
  --text:      #0f2d2b;
  --radius:    14px;
  --rsm:       8px;
  --amb-bg:    #faeeda;
  --amb:       #854f0b;
  --amb-b:     #fac775;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--g50);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── NAV ── */
.nav {
  background: var(--navy);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo  { height: 28px; width: auto; }
.nav-divider { width: 1px; height: 20px; background: rgba(255,255,255,0.15); }
.nav-label { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: rgba(255,255,255,0.45); }
.nav-tabs  { display: flex; gap: 4px; }
.ntab {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid rgba(255,255,255,0.2);
  background: transparent;
  color: rgba(255,255,255,0.55);
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.ntab:hover { border-color: rgba(255,255,255,0.4); color: rgba(255,255,255,0.8); }
.ntab.on { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--g200);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
  animation: fadeUp 0.3s ease;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ── FORM ELEMENTS ── */
.field { margin-bottom: 13px; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--g600);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.req { color: #e24b4a; margin-left: 2px; }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 13px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  border: 1px solid var(--g200);
  border-radius: var(--rsm);
  background: var(--g50);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(11,138,126,0.12);
  background: var(--white);
}
.field input.err,
.field select.err { border-color: #e24b4a; box-shadow: 0 0 0 3px rgba(226,75,74,0.1); }
.field textarea { resize: vertical; min-height: 80px; }

/* ── GRID ── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid1 { display: grid; grid-template-columns: 1fr; gap: 14px; }

/* ── BUTTONS ── */
.btn {
  padding: 10px 22px;
  border-radius: var(--rsm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-primary:disabled { background: var(--g200); color: var(--g400); cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--g600); border: 1px solid var(--g200); }
.btn-ghost:hover { border-color: var(--g400); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.btn-danger:hover { background: #fca5a5; }

/* ── SPINNER ── */
.spin {
  width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: none; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.loading .spin { display: inline-block; }
.btn.loading .btn-text { opacity: 0.6; }

/* ── TOGGLE SWITCH ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border: 1px solid var(--g200);
  border-radius: var(--rsm);
  background: var(--g50);
  margin-bottom: 8px;
  transition: all 0.2s;
}
.toggle-row.on { border-color: var(--teal-mid); background: var(--teal-light); }
.toggle-info { flex: 1; }
.toggle-title { font-size: 13px; font-weight: 500; color: var(--navy); }
.toggle-sub   { font-size: 11px; color: var(--g400); margin-top: 2px; }
.tswitch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.tswitch input { opacity: 0; width: 0; height: 0; position: absolute; }
.ttrack {
  position: absolute; inset: 0;
  border-radius: 11px; background: var(--g200);
  cursor: pointer; transition: background 0.2s;
}
.ttrack::after {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.tswitch input:checked + .ttrack { background: var(--teal); }
.tswitch input:checked + .ttrack::after { transform: translateX(18px); }

/* ── STATUS PILLS ── */
.pill {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 500;
  white-space: nowrap;
}
.pill.sent      { background: var(--g100);   color: var(--g600); }
.pill.opened    { background: #dbeafe;        color: #1e40af; }
.pill.progress  { background: var(--amb-bg);  color: var(--amb); }
.pill.complete  { background: #dcfce7;        color: #166534; }
.pill.pending   { background: #fef9c3;        color: #854d0e; }

/* ── BANNERS ── */
.banner {
  border-radius: var(--rsm);
  padding: 11px 14px;
  font-size: 13px;
  display: flex; gap: 8px; align-items: flex-start;
  margin-bottom: 1rem;
}
.banner svg { flex-shrink: 0; margin-top: 1px; }
.banner-info    { background: var(--teal-light); border: 1px solid var(--teal-mid);  color: var(--teal-dark); }
.banner-warn    { background: var(--amb-bg);     border: 1px solid var(--amb-b);     color: var(--amb); }
.banner-success { background: #dcfce7;           border: 1px solid #b7dfbf;          color: #166534; }
.banner-error   { background: #fee2e2;           border: 1px solid #fca5a5;          color: #991b1b; }

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 2px dashed var(--g200);
  border-radius: var(--rsm);
  padding: 1.75rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--g50);
  position: relative;
}
.upload-zone:hover,
.upload-zone.drag-over { border-color: var(--teal); background: var(--teal-light); }
.upload-zone.err       { border-color: #e24b4a; }
.upload-zone input[type=file] {
  position: absolute; inset: 0; opacity: 0;
  cursor: pointer; width: 100%; height: 100%;
}
.upload-icon {
  width: 44px; height: 44px; border-radius: 11px;
  background: var(--teal-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 10px;
}
.upload-icon svg { width: 20px; height: 20px; }
.upload-title { font-size: 14px; font-weight: 500; color: var(--navy); margin-bottom: 4px; }
.upload-sub   { font-size: 12px; color: var(--g400); line-height: 1.5; }
.upload-sub strong { color: var(--teal-dark); }
.upload-preview {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--teal-light);
  border-radius: var(--rsm);
  border: 1px solid var(--teal-mid);
  margin-top: 10px;
}
.upload-preview-icon {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--teal);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.upload-preview-icon svg { width: 14px; height: 14px; }
.upload-preview-name {
  font-size: 13px; font-weight: 500; color: var(--teal-dark);
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upload-preview-size { font-size: 11px; color: var(--g400); }
.upload-remove {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(11,138,126,0.15); border: none;
  cursor: pointer; font-size: 13px; color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; line-height: 1;
}
.err-msg { font-size: 12px; color: #a32d2d; margin-top: 5px; display: none; }

/* ── EXTERNAL LINK CARDS ── */
.ext-link {
  border: 1px solid var(--g200); border-radius: var(--rsm);
  padding: 11px 15px;
  display: flex; align-items: center; gap: 13px;
  margin-bottom: 10px;
  background: var(--g50);
  text-decoration: none;
  transition: all 0.2s;
}
.ext-link:hover { border-color: var(--teal); background: var(--teal-light); }
.ext-link.done  { border-color: var(--teal-mid); }
.ext-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--g200); flex-shrink: 0;
  transition: background 0.3s;
}
.ext-link.done .ext-dot { background: var(--teal); }
.ext-title { font-size: 13px; font-weight: 500; color: var(--navy); }
.ext-url   { font-size: 11px; color: var(--g400); margin-top: 2px; }
.ext-cta   { font-size: 12px; font-weight: 500; color: var(--teal-dark); white-space: nowrap; }

/* ── CHECKBOXES ── */
.check-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--g100);
}
.check-row:last-child { border-bottom: none; }
.cbox {
  width: 18px; height: 18px; border-radius: 5px;
  border: 2px solid var(--g200); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s; background: var(--white);
}
.cbox.on { background: var(--teal); border-color: var(--teal); }
.cbox.on::after {
  content: ''; width: 5px; height: 9px;
  border: 2px solid #fff; border-top: none; border-left: none;
  transform: rotate(45deg) translateY(-1px); display: block;
}
.check-label { font-size: 14px; color: var(--g700); line-height: 1.4; }

/* ── SUMMARY ── */
.sum-section { margin-bottom: 1.5rem; }
.sum-head {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--g400);
  font-weight: 500; margin-bottom: 10px;
}
.sum-row {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--g100); font-size: 14px;
}
.sum-row:last-child { border-bottom: none; }
.sum-k { color: var(--g600); }
.sum-v { color: var(--text); font-weight: 500; text-align: right; max-width: 60%; word-break: break-word; }

/* ── STEPPER ── */
.stepper { display: flex; align-items: center; margin-bottom: 2rem; }
.step-node {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  flex: 1; position: relative;
}
.step-node:not(:last-child)::after {
  content: ''; position: absolute;
  top: 18px; left: 55%; width: 90%; height: 2px;
  background: var(--g200); z-index: 0; transition: background 0.4s;
}
.step-node.done::after { background: var(--teal); }
.step-circle {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--g200); background: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--g400);
  z-index: 1; transition: all 0.3s;
}
.step-node.active .step-circle { border-color: var(--teal); background: var(--teal); color: #fff; }
.step-node.done   .step-circle { border-color: var(--teal); background: var(--teal-light); color: var(--teal-dark); }
.step-label { font-size: 11px; color: var(--g400); text-align: center; line-height: 1.3; }
.step-node.active .step-label { color: var(--teal-dark); font-weight: 500; }
.step-node.done   .step-label { color: var(--g600); }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 13px 18px; border-radius: var(--rsm);
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 9px;
  z-index: 9999; opacity: 0; transform: translateY(10px);
  transition: all 0.3s; pointer-events: none;
  max-width: 380px; line-height: 1.4;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.toast.show   { opacity: 1; transform: translateY(0); }
.toast.success{ background: #dcfce7; border: 1px solid #b7dfbf; color: #166534; }
.toast.error  { background: #fee2e2; border: 1px solid #fca5a5; color: #991b1b; }
.toast.info   { background: var(--teal-light); border: 1px solid var(--teal-mid); color: var(--teal-dark); }

/* ── PROGRESS BAR ── */
.pbar-wrap { width: 80px; height: 6px; background: var(--g200); border-radius: 3px; overflow: hidden; }
.pbar-fill  { height: 100%; background: var(--teal); border-radius: 3px; transition: width 0.5s; }

/* ── SECTION HEADER ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title { font-family: 'DM Serif Display', serif; font-size: 20px; color: var(--navy); }

/* ── SUCCESS STATE ── */
.success-wrap { text-align: center; padding: 3rem 1.5rem; }
.success-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--teal-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.25rem;
}
.success-icon svg { width: 34px; height: 34px; }
.success-title { font-family: 'DM Serif Display', serif; font-size: 26px; color: var(--navy); margin-bottom: 8px; }
.success-sub   { font-size: 14px; color: var(--g600); line-height: 1.6; max-width: 400px; margin: 0 auto 1.5rem; }

/* ── UTILITIES ── */
.hidden { display: none !important; }
.mt-sm  { margin-top: 0.75rem; }
.mt-md  { margin-top: 1.25rem; }
.mt-lg  { margin-top: 2rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.text-muted { color: var(--g400); font-size: 13px; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .grid2  { grid-template-columns: 1fr; }
  .nav    { padding: 0 1rem; }
  .card   { padding: 1.25rem; }
}
