/* "Primeros pasos" onboarding panel — public/onboarding.js. Page-private to index.html. */
.onboarding-panel {
  background: #fff;
  border: 1px solid var(--gray-200, #e2e8f0);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 16px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  /* Own text colour: .dashboard-empty sets a muted slate for its hero, which washed out
     every title on this white card. */
  color: #0f172a;
}
.onboarding-panel.hidden { display: none; }
.onboarding-welcome { margin: 0 0 14px; padding: 0 0 14px; border-bottom: 1px solid var(--gray-100, #f1f5f9); }
.onboarding-welcome h2 { margin: 0 0 6px; font-size: 18px; font-weight: 700; color: #0f172a; }
.onboarding-welcome p { margin: 0; font-size: 14px; color: var(--gray-600, #475569); line-height: 1.5; }
.onboarding-guide { margin: 10px 0 0; font-size: 12px; color: var(--gray-600, #475569); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.onboarding-guide a { color: #1f6feb; font-weight: 600; }
.onboarding-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.onboarding-head h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.onboarding-progress { font-size: 12px; color: var(--gray-600, #475569); }
.onboarding-bar { height: 4px; background: var(--gray-200, #e2e8f0); border-radius: 2px; margin: 10px 0 6px; overflow: hidden; }
.onboarding-bar span { display: block; height: 100%; background: #1f6feb; transition: width .3s ease; }
.onboarding-steps { list-style: none; margin: 0; padding: 0; }
.onboarding-step { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--gray-100, #f1f5f9); }
.onboarding-step:last-child { border-bottom: 0; }
.onboarding-step-icon { font-size: 20px; color: var(--gray-400, #94a3b8); margin-top: 1px; }
.onboarding-step.is-done .onboarding-step-icon { color: #0f9d58; }
.onboarding-step.is-done .onboarding-step-title,
.onboarding-step.is-skipped .onboarding-step-title { color: var(--gray-500, #64748b); }
.onboarding-state { font-weight: 400; font-size: 12px; }
.onboarding-step.is-done .onboarding-state { color: #0f7a45; }
/* Link shared, no patient yet: in progress, not done (amber, not the green check). */
.onboarding-step.is-waiting .onboarding-step-icon,
.onboarding-step.is-waiting .onboarding-state { color: #b45309; }
.onboarding-seeding { margin: 0 0 10px; display: flex; align-items: center; gap: 6px; }
.onboarding-hint-warn { color: #9a3412; }
.onboarding-step-body { flex: 1; min-width: 0; }
.onboarding-step-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.onboarding-step-actions { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.onboarding-url { font-size: 12px; background: var(--gray-50, #f8fafc); border: 1px solid var(--gray-200, #e2e8f0); border-radius: 6px; padding: 4px 8px; word-break: break-all; }
.onboarding-linkbtn { background: none; border: 0; padding: 0; font-size: 12px; color: var(--gray-600, #475569); text-decoration: underline; cursor: pointer; }
.onboarding-slug-edit { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.onboarding-slug-edit.hidden { display: none; }
.onboarding-slug-edit input { padding: 4px 8px; border: 1px solid var(--gray-200, #e2e8f0); border-radius: 6px; font-size: 13px; min-width: 0; flex: 1 1 140px; }
.onboarding-slug-prefix { font-size: 12px; color: var(--gray-600, #475569); }
.onboarding-hint { flex-basis: 100%; margin: 2px 0 0; font-size: 12px; color: var(--gray-600, #475569); }
.onboarding-ask { margin-top: 10px; width: 100%; text-align: left; background: var(--gray-50, #f8fafc); border: 1px dashed var(--gray-200, #e2e8f0); border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--gray-600, #475569); cursor: pointer; }
.onboarding-ask:hover { border-color: #1f6feb; color: #1f6feb; }
@media (max-width: 640px) { .onboarding-panel { margin: 10px; padding: 12px; } }
/* Finger-sized targets on phones: Omitir sat 10 px from ¿Cómo? at 14 px tall. */
@media (max-width: 768px) {
  .onboarding-linkbtn { min-height: 32px; padding: 6px 4px; font-size: 13px; }
  .onboarding-btn { min-height: 36px; padding: 6px 12px; }
  .onboarding-step-actions { gap: 8px 16px; }
}
/* The dashboard empty-state is a flex ROW (overview hero + KPI cards); with the panel in it
   the cards were squeezed to ~270px. Stack the panel above the overview while it shows. */
.dashboard-empty:has(> .onboarding-panel:not(.hidden)) { flex-direction: column; align-items: stretch; }
.dashboard-empty > .onboarding-panel { flex: 0 0 auto; }
/* Own button style: .btn-secondary is restyled for the dark hero inside .dashboard-empty
   and rendered near-invisible on this white card. */
.onboarding-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; font-size: 12px; font-weight: 600;
  color: #334155; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; cursor: pointer; }
.onboarding-btn:hover { border-color: #1f6feb; color: #1f6feb; }
/* Phone-only entry into the checklist, atop the patient list (index.html #sidebar). */
.onboarding-mobile-entry { display: none; }
@media (max-width: 768px) {
  .onboarding-mobile-entry:not(.hidden) {
    display: flex; align-items: center; gap: 8px; width: calc(100% - 24px); margin: 12px;
    padding: 12px 14px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px;
    color: #0f172a; font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  }
  .onboarding-mobile-entry span { flex: 1; min-width: 0; }
  .onboarding-mobile-entry .ti-rocket { color: #1f6feb; font-size: 18px; }
}

/* "Su logo y color" dialog — public/branding-setup.js. Controls left, live preview right;
   stacked on phones. The previews are iframes (scaled real documents), never live DOM. */
.branding-dialog {
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  color: #0f172a;
  background: #fff;
}
.branding-dialog[open] { display: flex; flex-direction: column; }
.branding-dialog::backdrop { background: rgba(15, 23, 42, 0.5); }
/* .btn-secondary is styled for the navy app chrome (white-on-dark); on this white dialog
   it read as disabled. Same override as the PDF-export dialog. */
.branding-dialog .btn-secondary { color: var(--gray-700, #334155); background: var(--white, #fff); border-color: var(--gray-300, #cbd5e1); }
.branding-dialog .btn-secondary:hover { color: var(--gray-800, #1e293b); background: var(--gray-100, #f1f5f9); border-color: var(--gray-400, #94a3b8); }
.branding-head { display: flex; justify-content: space-between; gap: 12px; padding: 18px 22px 12px; border-bottom: 1px solid var(--gray-100, #f1f5f9); }
.branding-head h2 { margin: 0 0 4px; font-size: 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.branding-optional { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #0f7a45; background: #e7f6ee; border-radius: 999px; padding: 2px 8px; }
.branding-intro { margin: 0; font-size: 13px; color: var(--gray-600, #475569); line-height: 1.5; }
.branding-close { background: none; border: 0; font-size: 20px; color: var(--gray-500, #64748b); cursor: pointer; align-self: flex-start; min-width: 36px; min-height: 36px; }
.branding-body { display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: 20px; padding: 16px 22px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.branding-controls h3 { margin: 0 0 8px; font-size: 14px; }
.branding-controls h3:not(:first-child) { margin-top: 18px; }
.branding-logo-row { display: flex; align-items: center; gap: 12px; }
.branding-logo-box { width: 96px; height: 64px; flex: 0 0 auto; border: 1px dashed var(--gray-200, #e2e8f0); border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--gray-50, #f8fafc); overflow: hidden; }
.branding-logo-box img { max-width: 88px; max-height: 56px; width: auto; height: auto; }
.branding-logo-empty { font-size: 12px; color: var(--gray-500, #64748b); }
.branding-logo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.branding-file { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.branding-help { margin: 6px 0 0; font-size: 12px; color: var(--gray-600, #475569); line-height: 1.45; }
.branding-help.error { color: #b91c1c; }
.branding-check { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: 13px; line-height: 1.4; cursor: pointer; }
.branding-check input { margin-top: 2px; }
.branding-accent-row { display: flex; align-items: center; gap: 10px; }
.branding-accent-row input[type="color"] { width: 44px; height: 32px; padding: 0; border: 1px solid var(--gray-200, #e2e8f0); border-radius: 6px; background: none; cursor: pointer; }
.branding-accent-row .branding-help { margin: 0; }
.branding-preview { min-width: 0; }
.branding-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gray-200, #e2e8f0); }
.branding-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--gray-600, #475569); cursor: pointer; margin-bottom: -1px; }
.branding-tabs button.active { color: #1f6feb; border-bottom-color: #1f6feb; }
.branding-frame-wrap { position: relative; margin-top: 8px; border: 1px solid var(--gray-200, #e2e8f0); border-radius: 8px; background: var(--gray-100, #f1f5f9); padding: 8px; min-height: 220px; }
.branding-frame-wrap iframe { display: block; width: 100%; height: 240px; border: 0; background: #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12); }
.branding-frame-wrap iframe[hidden] { display: none; }
.branding-frame-status { position: absolute; inset: 8px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; font-size: 13px; color: var(--gray-600, #475569); background: rgba(241, 245, 249, 0.85); }
.branding-frame-status[hidden] { display: none; }
.branding-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 22px 16px; border-top: 1px solid var(--gray-100, #f1f5f9); }
.branding-later { margin: 0; flex: 1 1 260px; font-size: 12px; color: var(--gray-600, #475569); display: flex; gap: 6px; align-items: flex-start; }
.branding-error { margin: 0; flex-basis: 100%; font-size: 13px; color: #b91c1c; }
.branding-error.hidden { display: none; }
.branding-foot-actions { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 760px) {
  .branding-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .branding-head, .branding-body, .branding-foot { padding-left: 14px; padding-right: 14px; }
  .branding-body { grid-template-columns: 1fr; }
  .branding-foot-actions { width: 100%; }
  .branding-foot-actions .btn { flex: 1; min-height: 40px; }
}

/* Welcome: text beside an illustration (public/onboarding-welcome.webp); stacked on phones. */
.onboarding-welcome { display: flex; align-items: center; gap: 20px; }
.onboarding-welcome-text { flex: 1 1 auto; min-width: 0; }
.onboarding-welcome-art { flex: 0 0 auto; width: 240px; height: auto; border-radius: 10px; }
.onboarding-welcome p.onboarding-welcome-easy { margin-top: 8px; display: flex; align-items: center; gap: 6px; font-weight: 600; color: #0f7a45; }
@media (max-width: 640px) {
  .onboarding-welcome { flex-direction: column-reverse; align-items: stretch; gap: 10px; }
  .onboarding-welcome-art { width: 100%; max-width: 150px; align-self: center; }
}
.onboarding-step-sub { font-weight: 400; font-size: 12px; color: var(--gray-500, #64748b); }
.onboarding-btn[disabled] { opacity: .75; cursor: progress; }
.onboarding-btn-primary { background: #1f6feb; border-color: #1f6feb; color: #fff; font-size: 14px; padding: 8px 14px; }
.onboarding-btn-primary:hover { background: #1a5fd0; color: #fff; }

/* How-To popup for the example report / practice receta: the tutorial page in embed mode
   (/howto/<slug>?embed=1, public/howto.js) inside an iframe. */
.onboarding-guide-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); margin: auto; padding: 0; border: 0;
  border-radius: 14px; box-shadow: 0 20px 60px rgba(15, 23, 42, .3); color: #0f172a; display: none; flex-direction: column; }
.onboarding-guide-dialog[open] { display: flex; }
.onboarding-guide-dialog::backdrop { background: rgba(15, 23, 42, .5); }
.onboarding-guide-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #e2e8f0; }
.onboarding-guide-head h2 { margin: 0; font-size: 17px; }
.onboarding-guide-close { background: none; border: 0; font-size: 20px; color: #475569; cursor: pointer; padding: 4px; }
.onboarding-guide-frame-wrap { position: relative; flex: 1 1 auto; min-height: 0; }
.onboarding-guide-frame { display: block; width: 100%; height: min(62vh, 560px); border: 0; background: #f8fafc; }
.onboarding-guide-loading { position: absolute; top: 40%; left: 50%; font-size: 28px; color: #94a3b8; }
.onboarding-guide-back { margin: 0; padding: 10px 18px; background: #eff6ff; border-top: 1px solid #bfdbfe; font-size: 13px; color: #1e3a8a;
  display: flex; align-items: flex-start; gap: 6px; }
.onboarding-guide-foot { display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding: 12px 18px; }
@media (max-width: 640px) { .onboarding-guide-frame { height: 55vh; } .onboarding-guide-foot { justify-content: space-between; } }
/* Welcome: what the bottom assistant answers, with one example it can ask for real. */
.onboarding-welcome p.onboarding-welcome-chat { margin-top: 8px; display: flex; gap: 6px; align-items: flex-start; font-size: 13px; }
.onboarding-welcome-chat .ti-sparkles { color: #1f6feb; margin-top: 3px; }
.onboarding-chip { display: inline; font: inherit; font-size: 13px; color: #1f6feb; background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 999px; padding: 1px 10px; cursor: pointer; margin: 2px 0; }
.onboarding-chip:hover { background: #dbeafe; }
