/* Editor de agenda como diálogo: la agenda queda visible y sólo desplaza el formulario. */
body:has(.agenda-editor[role="dialog"]){overflow:hidden}
.view:has(.agenda-editor[role="dialog"]){position:relative;z-index:400;animation:none!important;transform:none!important}
.main-area:has(.agenda-editor[role="dialog"]){overflow:visible}
body:has(.agenda-editor[role="dialog"]) .main-area>.topbar,
.view:has(.agenda-editor[role="dialog"])>.agenda-commandbar,
.view:has(.agenda-editor[role="dialog"])>.agenda-toolbar{visibility:hidden!important;pointer-events:none!important}
.agenda-workspace:has(.agenda-editor[role="dialog"]){grid-template-columns:minmax(0,1fr)}
.agenda-editor-backdrop{position:fixed;inset:0;z-index:300;border:0;background:rgba(24,31,38,.52);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);cursor:default}
/* Nested communication: above the editor (400), below written confirmation (1000).
   Explicitly override the generic mobile sheet layer (170!important). */
#modalBackdrop.agenda-child-modal-backdrop{z-index:800!important}
.agenda-editor[role="dialog"]{position:fixed!important;inset:auto!important;left:50%!important;top:50%!important;z-index:301;display:flex!important;flex-direction:column;width:min(720px,calc(100vw - 32px));height:min(88dvh,820px)!important;max-height:calc(100dvh - 32px)!important;min-height:0;overflow:hidden!important;padding:0!important;border:1px solid var(--nodly-border,var(--line));border-radius:20px!important;background:var(--nodly-surface,var(--white));box-shadow:0 28px 90px rgba(14,22,29,.3)!important;transform:translate(-50%,-50%);outline:0}
.agenda-editor[role="dialog"] .agenda-editor-head{flex:0 0 auto;margin:0!important;padding:20px 22px!important;border:0;border-radius:19px 19px 0 0!important}
.agenda-editor[role="dialog"] .agenda-editor-head h3{margin-bottom:0}
.agenda-editor[role="dialog"]>.editor-switch{flex:0 0 auto;width:auto;margin:14px 20px 0}
.agenda-editor[role="dialog"] .agenda-editor-form{flex:1 1 auto;min-height:0;margin:0;padding:16px 20px 22px;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.agenda-editor[role="dialog"] .agenda-form-actions{position:sticky;bottom:-22px;z-index:4;margin:8px -20px -22px;padding:14px 20px calc(14px + env(safe-area-inset-bottom));border-top:1px solid var(--nodly-border,var(--line));background:color-mix(in srgb,var(--nodly-surface,var(--white)) 94%,transparent);box-shadow:0 -12px 26px rgba(22,34,43,.08);backdrop-filter:blur(12px)}
.agenda-editor[role="dialog"] .agenda-form-actions{grid-template-columns:minmax(120px,.85fr) minmax(0,1.3fr)}
.agenda-editor[role="dialog"] .agenda-form-actions.has-reminder{grid-template-columns:minmax(0,1fr) minmax(110px,.75fr) minmax(0,1fr)}
.agenda-package-notice.neutral{background:#eef4f7;color:#405a68}
.agenda-package-notice.neutral>span{background:#dce9ef}
.agenda-package-picker{display:grid;gap:4px;min-width:min(100%,220px);margin-left:auto;font-size:10px;font-weight:650}
.agenda-package-picker select{min-height:38px;max-width:100%;padding:7px 28px 7px 9px;border:1px solid #cbd8e5;border-radius:8px;background:#fff;color:#263b54;font:inherit}
@media(max-width:600px){.agenda-package-notice{flex-wrap:wrap}.agenda-package-picker{flex:1 1 100%;margin:3px 0 0 33px}}
.pricing-review-banner{display:flex;align-items:flex-start;gap:12px;margin:0 0 14px;padding:13px 15px;border:1px solid #e1c777;border-radius:14px;background:#fff9e9;color:#263650}
.pricing-review-banner>span{display:grid;width:30px;height:30px;flex:0 0 30px;place-items:center;border-radius:10px;background:#f3dda0;color:#6b5219;font-size:17px;font-weight:850}
.pricing-review-banner>div{display:grid;gap:3px;min-width:0}.pricing-review-banner strong{font-size:13px;line-height:1.35}.pricing-review-banner small{color:#68738a;font-size:12px;line-height:1.45}
.pricing-review-banner.is-actionable{width:100%;font-family:inherit;text-align:left;cursor:pointer;transition:border-color .16s,box-shadow .16s,transform .16s}.pricing-review-banner.is-actionable:hover{border-color:#cda83f;box-shadow:0 7px 18px rgba(83,66,25,.1);transform:translateY(-1px)}.pricing-review-banner.is-actionable:focus-visible{outline:3px solid rgba(64,95,143,.22);outline-offset:2px}.pricing-review-banner>em{display:flex;align-items:center;gap:7px;margin-left:auto;align-self:center;color:#405f8f;font-size:12px;font-style:normal;font-weight:800;white-space:nowrap}.pricing-review-banner>em i{font-size:15px;font-style:normal}
.pricing-review-dialog>p{color:#5f6d82;line-height:1.55}.pricing-review-list{display:grid;gap:8px;max-height:min(52vh,430px);margin:18px 0;overflow-y:auto;overscroll-behavior:contain}.pricing-review-list>button{display:flex;align-items:center;justify-content:space-between;gap:14px;width:100%;min-height:64px;padding:12px 14px;border:1px solid #d7dfeb;border-radius:12px;background:#fff;color:#22334d;font-family:inherit;text-align:left;cursor:pointer}.pricing-review-list>button:hover{border-color:#9fb1cb;background:#f5f7fb}.pricing-review-list>button:focus-visible{outline:3px solid rgba(64,95,143,.18);outline-offset:1px}.pricing-review-list span,.pricing-review-list strong,.pricing-review-list small{display:block;min-width:0}.pricing-review-list strong{overflow:hidden;font-size:13px;text-overflow:ellipsis;white-space:nowrap}.pricing-review-list small{margin-top:4px;color:#68758a;font-size:11px}.pricing-review-list em{color:#405f8f;font-size:11px;font-style:normal;font-weight:800;white-space:nowrap}
@media(max-width:620px){.pricing-review-banner.is-actionable{display:grid;grid-template-columns:30px minmax(0,1fr)}.pricing-review-banner>em{grid-column:2;margin:5px 0 0}.pricing-review-list>button{align-items:flex-start;flex-direction:column;gap:8px}.pricing-review-list em{align-self:flex-end}}
.appointment-creation-review{margin:8px 0 2px;padding:14px;border:1px solid #b8d8cc;border-radius:14px;background:#f0f8f5;color:#183e36}
.appointment-creation-review[hidden]{display:none!important}
.appointment-creation-review-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}
.appointment-creation-review-head>span{display:grid;place-items:center;width:28px;height:28px;flex:0 0 auto;border-radius:50%;background:#d5eee4;color:#176b59;font-weight:800}
.appointment-creation-review-head strong,.appointment-creation-review-head small{display:block}
.appointment-creation-review-head small{margin-top:2px;color:#587168}
.appointment-creation-review dl{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:0}
.appointment-creation-review dl>div{min-width:0;padding:9px 10px;border-radius:9px;background:rgba(255,255,255,.78)}
.appointment-creation-review dt{margin-bottom:3px;color:#687d76;font-size:11px}
.appointment-creation-review dd{margin:0;overflow-wrap:anywhere;font-size:13px;font-weight:700}
.appointment-creation-review>p{margin:11px 0 0;color:#405f56;font-size:12px;line-height:1.45}
.agenda-schedule-notice.patient-frequency{margin-top:9px;border-color:#d9c98f;background:#fff9e8;color:#493f22}
.agenda-schedule-notice.patient-frequency>span{background:#f2d579;color:#47370c}
.agenda-schedule-notice.patient-frequency small{color:#665b3c}
.appointment-creation-review .agenda-schedule-notice.patient-frequency{grid-column:1/-1;margin:12px 0 0;text-align:left}

.agenda-conflict-overlay{position:fixed;inset:0;z-index:10040;display:grid;place-items:center;padding:18px;background:rgba(22,31,45,.58);backdrop-filter:blur(5px)}
.agenda-conflict-dialog{width:min(100%,430px);border:1px solid #d9e0eb;border-radius:22px;background:#fffdfa;padding:26px;box-shadow:0 24px 70px rgba(24,35,52,.28);color:#17233a;text-align:center}
.agenda-conflict-icon{display:grid;width:48px;height:48px;margin:0 auto 13px;place-items:center;border:1px solid #dc968f;border-radius:16px;background:#fff0ee;color:#a8322a;font-size:25px;font-weight:800}
.agenda-conflict-dialog .eyebrow{color:#a8322a}.agenda-conflict-dialog h2{margin:7px 0 8px;font:750 23px/1.2 "IBM Plex Sans",Inter,sans-serif;letter-spacing:-.025em}.agenda-conflict-dialog>p{margin:0;color:#566479;font-size:13px;line-height:1.55}
.agenda-conflict-slot{display:grid;grid-template-columns:1fr auto;align-items:center;gap:3px 12px;margin:18px 0;padding:14px 16px;border:1px solid #d9e0eb;border-radius:14px;background:#f4f6fa;text-align:left}.agenda-conflict-slot small{color:#566479;font-size:11px;font-weight:700}.agenda-conflict-slot strong{grid-row:1/3;grid-column:2;color:#263b58;font-size:17px;font-variant-numeric:tabular-nums}.agenda-conflict-slot span{color:#17233a;font-size:13px;font-weight:700}.agenda-conflict-actions{display:grid;grid-template-columns:1fr 1.35fr;gap:10px}.agenda-conflict-actions button{min-height:46px}.agenda-schedule-notice.conflict.confirmed{border-color:#d5ad4e;background:#fff8e4;color:#534216}
@media(max-width:480px){.agenda-conflict-overlay{align-items:end;padding:10px}.agenda-conflict-dialog{border-radius:22px 22px 14px 14px;padding:22px 18px calc(18px + env(safe-area-inset-bottom))}.agenda-conflict-dialog h2{font-size:21px}.agenda-conflict-slot{grid-template-columns:1fr}.agenda-conflict-slot strong{grid-row:auto;grid-column:auto}.agenda-conflict-actions{grid-template-columns:1fr}.agenda-conflict-actions .primary-button{grid-row:1}}

html[data-nodly-theme="dark"] .agenda-editor-backdrop{background:rgba(9,13,17,.7)}
html[data-nodly-theme="dark"] .agenda-editor[role="dialog"]{box-shadow:0 28px 90px rgba(0,0,0,.48)!important}
.agenda-scope-dialog{max-width:520px;text-align:left}
.agenda-scope-dialog h2{margin:0 0 20px}
.agenda-scope-actions{grid-template-columns:1fr 1.25fr}
.agenda-scope-actions button{min-height:48px}

@media(max-width:760px){
  /* El editor ocupa toda la pantalla; no necesita un scrim. Algunos WebView Android
     componen el backdrop sobre el diálogo aunque tenga menor z-index. */
  .agenda-editor-backdrop{display:none!important}
  .agenda-editor[role="dialog"]{inset:0!important;left:0!important;top:0!important;z-index:999;width:100vw;height:100dvh!important;max-height:100dvh!important;border:0;border-radius:0!important;background:#fff!important;color:#17233a!important;opacity:1!important;-webkit-filter:none!important;filter:none!important;transform:none;isolation:isolate}
  .agenda-editor[role="dialog"] .agenda-editor-head{padding:calc(14px + env(safe-area-inset-top)) 16px 14px!important;border-radius:0!important}
  .agenda-editor[role="dialog"]>.editor-switch{margin:12px 14px 0}
  .agenda-editor[role="dialog"] .agenda-editor-form{box-sizing:border-box;width:100%;min-width:0;padding:14px 14px calc(92px + env(safe-area-inset-bottom))!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior-y:contain;scrollbar-gutter:auto;touch-action:pan-y;-webkit-overflow-scrolling:touch;background:#fff!important}
  .agenda-editor[role="dialog"] .agenda-editor-form:has(.agenda-form-actions.has-reminder){padding-bottom:calc(150px + env(safe-area-inset-bottom))!important}
  .agenda-editor[role="dialog"] .agenda-form-actions{position:fixed!important;right:0;bottom:0!important;left:0;z-index:1002;box-sizing:border-box;width:100%;margin:0!important;padding:12px 14px calc(12px + env(safe-area-inset-bottom));background:#fff!important;box-shadow:0 -10px 28px rgba(23,35,58,.14)}
  .agenda-editor[role="dialog"] .agenda-form-actions,.agenda-editor[role="dialog"] .agenda-form-actions.has-reminder{grid-template-columns:1fr 1fr}
  .agenda-editor[role="dialog"] .agenda-form-actions.has-reminder .agenda-reminder-button{grid-column:1/-1}
  body:has(.agenda-editor[role="dialog"]) .mobile-bottom-nav{visibility:hidden!important;pointer-events:none!important}

  /* La apertura desde una franja de Agenda heredaba el antiguo bottom-sheet con
     display:block. Eso anulaba el flex que asigna altura y scroll al formulario. */
  body.mobile-view-agenda{overflow:hidden!important;overscroll-behavior:none!important}
  body.mobile-view-agenda .main-area:has(.agenda-editor[role="dialog"]){overflow:hidden!important;overscroll-behavior:none!important}
  body.mobile-view-agenda .agenda-editor[role="dialog"]:not(.agenda-editor-empty){
    display:grid!important;
    grid-template-rows:auto auto minmax(0,1fr)!important;
    box-sizing:border-box;
    max-width:none!important;
    overflow:hidden!important;
    touch-action:auto
  }
  body.mobile-view-agenda .agenda-editor[role="dialog"]:not(.agenda-editor-empty)::before{display:none!important}
  body.mobile-view-agenda .agenda-editor[role="dialog"] .agenda-editor-form{
    height:auto!important;
    min-height:0!important;
    overflow-x:hidden!important;
    overflow-y:scroll!important;
    touch-action:pan-y!important;
    -webkit-overflow-scrolling:touch!important
  }
  body.mobile-view-agenda .agenda-editor[role="dialog"] .agenda-editor-head [data-agenda-close]{
    width:44px!important;
    height:44px!important;
    min-height:44px!important
  }
  body.mobile-view-agenda .agenda-editor[role="dialog"] .agenda-form-actions [data-agenda-close]{
    width:100%!important;
    height:auto!important;
    min-height:48px!important;
    margin:0!important;
    border:1px solid #cfd8e6!important;
    border-radius:11px!important;
    background:#fffdf9!important;
    color:#34445e!important;
    font-size:13px!important;
    font-weight:750!important
  }
  body.mobile-view-agenda .agenda-editor[role="dialog"] .agenda-form-actions [data-agenda-close]:focus-visible{
    outline:3px solid rgba(217,173,67,.35)!important;
    outline-offset:2px
  }
}

.agenda-editor[role="dialog"] .agenda-form-actions.has-reminder{grid-template-columns:1fr 1fr}
.agenda-communication-actions{display:grid;grid-column:1/-1;grid-template-columns:1fr 1fr;gap:8px}
.agenda-communication-actions .agenda-reminder-button,.agenda-communication-actions .agenda-notice-button{grid-column:auto!important;width:100%;min-height:42px;white-space:nowrap}

/* Recordatorios y avisos comparten una identidad Nodly propia; no heredan el verde legacy. */
.appointment-communication-modal{width:min(610px,calc(100vw - 28px));padding:30px;border:1px solid #d8e0ec;border-radius:22px;background:#fffdf9;color:#17233a}
.appointment-communication-modal .eyebrow{display:flex;align-items:center;gap:0;margin:0 0 8px;padding-left:10px;border-left:3px solid #c39a42;color:#3f6298;font-size:11px;font-weight:800;letter-spacing:.13em}
#modalContent>.eyebrow::before,#modalContent>.eyebrow::after{display:none!important;content:none!important}
.appointment-communication-modal h2{margin:0;font-family:Inter,'DM Sans',sans-serif!important;font-size:27px;line-height:1.15;letter-spacing:-.035em;color:#17233a}
.appointment-communication-modal .appointment-communication-summary{margin:8px 0 20px;color:#60708a;font-size:14px;line-height:1.45}
.appointment-communication-modal .appointment-channel-list{gap:10px;margin:0}
.appointment-communication-modal .appointment-channel-list button{display:grid;grid-template-columns:42px minmax(0,1fr) 18px;align-items:center;gap:12px;min-height:72px;padding:12px 14px;border:1px solid #d8e0ec;border-radius:14px;background:#fff;text-align:left;color:#25344d;box-shadow:0 3px 10px rgba(35,53,80,.035);transform:none}
.appointment-communication-modal .appointment-channel-list button:hover{border-color:#7892ba;background:#f6f8fc;box-shadow:0 7px 18px rgba(35,53,80,.08);transform:translateY(-1px)}
.appointment-communication-modal .appointment-channel-list button:focus-visible{outline:3px solid rgba(217,173,67,.34);outline-offset:2px;border-color:#4b6fa5}
.appointment-communication-modal .appointment-channel-list button>span:nth-child(2){display:flex;min-width:0;flex-direction:column;gap:3px}
.appointment-communication-modal .appointment-channel-list strong{color:#25344d;font-size:14px;line-height:1.35}
.appointment-communication-modal .appointment-channel-list small{color:#64738a;font-size:12px;line-height:1.45}
.appointment-communication-modal .appointment-channel-list button>i{color:#4b6fa5;font-size:22px;font-style:normal}
.appointment-communication-modal .appointment-channel-icon{display:grid;width:42px;height:42px;place-items:center;border-radius:12px;background:#edf2fa;color:#40659b}
.appointment-communication-modal .appointment-channel-icon svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.appointment-communication-modal .appointment-time-note,.appointment-communication-modal .section-note{margin:16px 0 0;border:1px solid #d7e2f2;background:#f1f5fb;color:#253f69}
.appointment-communication-modal .appointment-time-note>span,.appointment-communication-modal .section-note>span{display:grid;width:28px;height:28px;flex:0 0 auto;place-items:center;border-radius:9px;background:#dfe9f7;color:#315b91;font-size:15px}
.appointment-communication-modal .appointment-time-note strong,.appointment-communication-modal .section-note strong{color:#253f69;font-size:12px!important}
.appointment-communication-modal .appointment-time-note p,.appointment-communication-modal .section-note p{color:#60708a;font-size:12px!important;line-height:1.45}
.appointment-communication-modal .form-group textarea{min-height:130px;margin-top:6px;border-color:#cfd9e8!important;background:#fff;color:#25344d;font:500 14px/1.5 Inter,'DM Sans',sans-serif}
.appointment-communication-modal .form-group textarea:focus{border-color:#7892ba!important;outline:0!important;box-shadow:0 0 0 3px rgba(64,95,143,.13)!important}
.appointment-communication-modal .modal-actions{padding-top:16px;border-top:1px solid #e1e6ee}
.appointment-communication-modal .modal-actions button{min-height:44px}

/* La finalización de una serie es una decisión operativa, no microtexto auxiliar. */
.agenda-editor[role="dialog"] .repeat-end{display:flex;flex-direction:column;gap:9px;padding:15px;border:1px solid #d8e0ec;border-radius:14px;background:#f6f8fc;color:#25344d}
.agenda-editor[role="dialog"] .repeat-end-head{gap:4px;padding:0 2px 4px}
.agenda-editor[role="dialog"] .repeat-end-head span{color:#25344d;font-size:14px;font-weight:800;line-height:1.3}
.agenda-editor[role="dialog"] .repeat-end-head small{color:#60708a;font-size:12px;font-weight:500;line-height:1.45}
.agenda-editor[role="dialog"] .repeat-end-option{display:grid!important;grid-template-columns:20px minmax(0,1fr);align-items:center!important;gap:10px!important;min-height:58px;box-sizing:border-box;padding:11px 13px!important;border:1px solid #d8e0ec;border-radius:12px;background:#fff;color:#25344d;cursor:pointer}
.agenda-editor[role="dialog"] .repeat-end-option:hover{border-color:#9eafc7;background:#f8faff}
.agenda-editor[role="dialog"] .repeat-end-option:has(input:checked){border-color:#7892ba;background:#edf2fa;box-shadow:inset 3px 0 0 #405f8f}
.agenda-editor[role="dialog"] .repeat-end-option>input{width:17px!important;height:17px!important;margin:0!important;accent-color:#405f8f}
.agenda-editor[role="dialog"] .repeat-end-option>span{display:grid;gap:3px;min-width:0}
.agenda-editor[role="dialog"] .repeat-end-option strong{color:#25344d;font-size:13px;line-height:1.35}
.agenda-editor[role="dialog"] .repeat-end-option small{color:#60708a;font-size:12px;font-weight:500;line-height:1.4}
.agenda-editor[role="dialog"] .repeat-end-control{padding:2px 0 4px 30px}
.agenda-editor[role="dialog"] .repeat-end-control label{color:#34445e;font-size:12px}
.agenda-editor[role="dialog"] .repeat-end-control input{min-height:44px;border-color:#cfd9e8}

@media(max-width:600px){
  .appointment-communication-modal{width:calc(100vw - 20px);max-height:calc(100dvh - 20px);padding:22px 18px;border-radius:18px}
  .appointment-communication-modal h2{font-size:24px}
  .appointment-communication-modal .appointment-channel-list button{grid-template-columns:38px minmax(0,1fr) 14px;min-height:68px;padding:11px;gap:10px}
  .appointment-communication-modal .appointment-channel-icon{width:38px;height:38px}
  .appointment-communication-modal .appointment-channel-list strong{font-size:13px}
  .appointment-communication-modal .appointment-channel-list small{font-size:12px}
  .appointment-communication-modal .modal-actions{position:sticky;bottom:-22px;margin-right:-18px;margin-left:-18px;padding:12px 18px calc(12px + env(safe-area-inset-bottom));background:#fffdf9}
  .agenda-editor[role="dialog"] .repeat-end{padding:13px 11px}
  .agenda-editor[role="dialog"] .repeat-end-option{min-height:62px;padding:12px!important}
  .agenda-editor[role="dialog"] .repeat-end-head span{font-size:14px}
  .agenda-editor[role="dialog"] .repeat-end-head small,.agenda-editor[role="dialog"] .repeat-end-option small{font-size:12px!important}
  .agenda-editor[role="dialog"] .repeat-end-option strong{font-size:13px!important}
}

@media(max-width:420px){
  .agenda-editor[role="dialog"] .editor-two{grid-template-columns:1fr}
  .agenda-editor[role="dialog"] .agenda-editor-head h3{font-size:20px}
  .agenda-scope-actions{grid-template-columns:1fr}
  .appointment-creation-review dl{grid-template-columns:1fr}
}

@media(prefers-reduced-motion:no-preference){
  .agenda-editor-backdrop{animation:agenda-modal-fade .16s ease-out}
  .agenda-editor[role="dialog"]{animation:agenda-modal-in .18s ease-out}
  @keyframes agenda-modal-fade{from{opacity:0}}
  @keyframes agenda-modal-in{from{opacity:0;transform:translate(-50%,calc(-50% + 10px))}}
}
@media(max-width:760px) and (prefers-reduced-motion:no-preference){
  .agenda-editor[role="dialog"]{animation-name:agenda-modal-mobile-in}
  @keyframes agenda-modal-mobile-in{from{opacity:0;transform:translateY(12px)}}
}
/* Errors stay inside the active editor, above its fixed actions. */
[data-agenda-form-error]:not([hidden]){margin:12px 0;padding:12px 14px;border:1px solid #c96f65;border-radius:12px;background:#fff3f0;color:#8a2921;font-size:14px;line-height:1.45;white-space:normal}
[data-agenda-form-error]:focus{outline:2px solid #c96f65;outline-offset:2px}
