
.cpr-wrap{font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial; padding:18px; background:#f6f7fb; min-height:100vh;}
.cpr-top{display:flex; align-items:center; justify-content:space-between; margin-bottom:14px;}
.cpr-back{text-decoration:none; font-weight:700; color:#111827;}
.cpr-title{font-size:20px; font-weight:800; color:#111827;}
.cpr-grid{display:grid; grid-template-columns: 1.4fr 1fr; gap:14px;}
.cpr-card{background:#fff; border:1px solid #e7e8ef; border-radius:16px; padding:16px;}
.cpr-card h3{margin:0 0 10px;}
.cpr-card label{display:block; margin-top:10px; font-weight:700; font-size:13px;}
.cpr-card input, .cpr-card textarea{width:100%; padding:12px 14px; border:1px solid #d1d5db; border-radius:12px; margin-top:6px;}
.cpr-card textarea{min-height:90px;}
.cpr-btn{margin-top:14px; width:100%; padding:12px 14px; border:0; border-radius:14px; font-weight:800; background:#111827; color:#fff;}
.cpr-btn-secondary{margin-top:8px; padding:10px 12px; border-radius:12px; border:1px solid #d1d5db; background:#fff;}
.cpr-muted{color:#6b7280; font-size:13px;}
.cpr-err{margin-top:10px; background:#fee2e2; color:#991b1b; padding:10px 12px; border-radius:12px; font-size:13px;}
.cpr-pac-box{margin-top:10px; background:#f9fafb; border:1px dashed #d1d5db; padding:12px; border-radius:12px;}

/* ----------- Historial (debajo del formulario) ----------- */
.cpr-hist-card{margin-top:12px;background:#fff;border:1px solid #e7e8ef;border-radius:16px;padding:14px;}
.cpr-hist-head{display:flex;align-items:center;justify-content:space-between;gap:10px;}
.cpr-hist-title{font-weight:800;color:#134e4a;}
.cpr-hist-table-wrap{margin-top:10px;overflow:auto;border-radius:14px;border:1px solid #e7e8ef;}
.cpr-hist-table{width:100%;min-width:860px;border-collapse:separate;border-spacing:0;}
.cpr-hist-table thead th{position:sticky;top:0;background:#afcec4;color:#134e4a;font-weight:800;font-size:13px;text-align:left;padding:12px 12px;border-bottom:1px solid #e7e8ef;}
.cpr-hist-table tbody td{padding:12px 12px;border-bottom:1px solid #f3f4f6;font-size:13px;color:#111827;vertical-align:top;}
.cpr-hist-table tbody tr:hover td{background:#fafafa;}
.cpr-hist-actions{width:120px;text-align:right;white-space:nowrap;}
.cpr-icon-btn{border:0;background:transparent;cursor:pointer;font-size:18px;line-height:1;display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:10px;}
.cpr-icon-btn:hover{background:#eef2ff;}

/* Botón tipo link para "Reutilizar" */
.cpr-link-btn{border:0;background:transparent;cursor:pointer;font-size:13px;font-weight:700;line-height:1;display:inline-flex;align-items:center;justify-content:center;padding:0 4px;margin-left:8px;text-decoration:underline;color:#111827;}
.cpr-link-btn:hover{opacity:.85;}
.cpr-link-btn.is-loading{opacity:.55;cursor:wait;}
@media(max-width:900px){.cpr-grid{grid-template-columns:1fr;}}

/* ----------- Acciones post-emisión (Receta generada) ----------- */
.cpr-actions-card{margin-top:12px;background:#fff;border:1px solid #e7e8ef;border-radius:16px;padding:14px;}
.cpr-actions-title{font-weight:800;color:#111827;}
.cpr-actions-btns{display:flex;flex-wrap:wrap;gap:10px;margin-top:10px;}
/* En el bloque de acciones los botones NO van full width */
.cpr-actions-btns .cpr-btn,
.cpr-actions-btns .cpr-btn-secondary{width:auto;margin-top:0;display:inline-flex;align-items:center;justify-content:center;}
.cpr-actions-btns .cpr-btn{padding:12px 16px;}
.cpr-actions-btns .cpr-btn-secondary{padding:10px 14px;}


.cpr-suggest{border:1px solid #e5e7eb;border-radius:10px;background:#fff;max-height:220px;overflow:auto;margin-top:6px;box-shadow:0 10px 20px rgba(0,0,0,.06);}
.cpr-suggest-item{display:block;width:100%;text-align:left;padding:10px 12px;border:0;background:transparent;cursor:pointer;}
.cpr-suggest-item:hover{background:#f3f4f6;}

/* Profesional box */
.cpr-prof-box{padding-top:4px;}
.cpr-prof-grid{display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px;}
.cpr-prof-grid strong{display:block; font-size:13px; color:#374151; margin-bottom:2px;}
.cpr-prof-kv{background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:10px;}
.cpr-prof-kv div{color:#111827; font-size:14px;}
.cpr-ul{margin:6px 0 0 18px; padding:0;}
.cpr-ul li{margin:2px 0;}
.cpr-prof-img{max-width:100%; height:auto; border:1px solid #e5e7eb; border-radius:12px;}
@media(max-width:900px){.cpr-prof-grid{grid-template-columns:1fr;}}

/* Vista previa tipo "PDF" */
.cpr-preview-shell{background:#f3f4f6;padding:14px;border-radius:16px;border:1px solid #e5e7eb;}
.cpr-preview-page{background:#fff;border:1px solid #e5e7eb;border-radius:14px;padding:18px;}
.cpr-preview-header{border-bottom:1px solid #e5e7eb;padding-bottom:10px;margin-bottom:12px;}
.cpr-preview-body{min-height:220px;}
.cpr-preview-footer{border-top:1px solid #e5e7eb;padding-top:10px;margin-top:12px;font-size:12px;color:#6b7280;}

/* ----------- Modal + buscador medicamentos ----------- */
.cpr-modal{position:fixed;inset:0;z-index:999999;display:block;}
.cpr-modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,.45);} 
.cpr-modal-card{position:relative;max-width:780px;width:92%;margin:6vh auto;background:#fff;border-radius:16px;border:1px solid #e5e7eb;box-shadow:0 20px 40px rgba(0,0,0,.18);}
.cpr-modal-head{display:flex;align-items:flex-start;justify-content:space-between;padding:14px 16px;border-bottom:1px solid #e5e7eb;}
.cpr-modal-title{font-weight:800;font-size:15px;color:#111827;}
.cpr-modal-close{border:0;background:transparent;font-size:26px;line-height:1;color:#111827;cursor:pointer;padding:0 6px;}
.cpr-modal-body{padding:14px 16px;}
.cpr-modal-body input{width:100%;padding:12px 14px;border:1px solid #d1d5db;border-radius:12px;}
.cpr-med-results{margin-top:12px;max-height:52vh;overflow:auto;border:1px solid #e5e7eb;border-radius:12px;}
.cpr-med-item{padding:12px 14px;border-bottom:1px solid #f3f4f6;cursor:pointer;}
.cpr-med-item:hover{background:#f9fafb;}
.cpr-med-title{font-weight:800;color:#111827;}
.cpr-med-sub{font-size:13px;color:#374151;margin-top:2px;}

.cpr-med-card{margin-top:10px;border:1px solid #e5e7eb;border-radius:14px;padding:12px;background:#fff;}
.cpr-med-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;}
.cpr-med-card-title{font-weight:800;color:#111827;}
.cpr-med-del{border:1px solid #e5e7eb;background:#fff;border-radius:10px;padding:6px 10px;cursor:pointer;}
.cpr-med-flags{margin-top:10px;display:flex !important;flex-direction:column !important;align-items:flex-start !important;gap:10px;font-size:13px;color:#111827;}
.cpr-med-flags label{width:100%;font-weight:600;margin-top:0;display:flex !important;gap:10px;align-items:center;}
.cpr-med-flags input[type="checkbox"]{margin:0; width:16px; height:16px;}
.cpr-stepper{display:inline-flex;align-items:center;border:1px solid #e5e7eb;border-radius:999px;overflow:hidden;}
.cpr-step{border:0;background:#111827;color:#fff;font-weight:800;width:34px;height:32px;cursor:pointer;}
.cpr-qty{min-width:40px;text-align:center;font-weight:800;}
.cpr-med-bottom{margin-top:10px;display:flex;justify-content:center;}
@media(max-width:600px){.cpr-med-flags{gap:10px;}}
