:root{--pev2-ink:#14233d;--pev2-muted:#64748b;--pev2-line:#d9e5f2;--pev2-blue:#1478d4;--pev2-cyan:#16b8d4;--pev2-soft:#f2f8fd;--pev2-white:#fff}
.paciente-editor-v2{position:fixed;inset:0;z-index:1000001;background:rgba(18,38,67,.56);padding:22px;align-items:center;justify-content:center;pointer-events:auto;font-family:"Avenir Next","Nunito Sans","Segoe UI",sans-serif}
.paciente-editor-v2,.paciente-editor-v2 *{box-sizing:border-box}
.pev2-panel{width:min(1400px,calc(100vw - 44px));height:min(920px,calc(100vh - 44px));display:flex;flex-direction:column;background:linear-gradient(145deg,#f9fcff 0%,#edf6fd 100%);border:1px solid rgba(255,255,255,.78);border-radius:26px;box-shadow:0 32px 90px rgba(8,31,59,.35),0 0 0 1px rgba(29,117,193,.08);overflow:hidden;color:var(--pev2-ink);position:relative;pointer-events:auto}
.pev2-header{position:relative;min-height:112px;padding:24px 30px;background:linear-gradient(112deg,#075eae 0%,#198bda 56%,#43bdd8 100%);color:#fff;display:flex;align-items:center;gap:18px;overflow:hidden}
.pev2-header:after{content:"";position:absolute;width:440px;height:180px;border:1px solid rgba(255,255,255,.2);border-radius:50%;right:100px;top:-105px;transform:rotate(-12deg);pointer-events:none;box-shadow:0 0 55px rgba(255,255,255,.08)}
.pev2-header-mark{width:62px;height:62px;flex:0 0 62px;border-radius:19px;background:rgba(255,255,255,.14);border:1px solid rgba(255,255,255,.36);display:grid;place-items:center;box-shadow:inset 0 1px 0 rgba(255,255,255,.28)}
.pev2-header-mark span{width:34px;height:20px;border:3px solid #fff;border-radius:50%;position:relative}.pev2-header-mark span:after{content:"";position:absolute;width:8px;height:8px;border:2px solid #fff;border-radius:50%;left:50%;top:50%;transform:translate(-50%,-50%)}
.pev2-heading{position:relative;z-index:1}.pev2-header h2{font-size:clamp(1.45rem,2vw,1.85rem);line-height:1.05;letter-spacing:-.035em;margin:4px 0 5px}.pev2-header p{margin:0;color:rgba(255,255,255,.82);font-size:.9rem}.pev2-kicker{color:#d8f7ff;font-size:.68rem;font-weight:850;text-transform:uppercase;letter-spacing:.13em}
.pev2-close{position:relative;z-index:2;margin-left:auto;width:46px;height:46px;border:1px solid rgba(255,255,255,.34);border-radius:15px;background:rgba(255,255,255,.13);color:#fff;font-size:28px;line-height:1;cursor:pointer;transition:.18s ease}.pev2-close:hover{background:#fff;color:#126ebc;transform:translateY(-1px)}
.pev2-status{min-height:48px;padding:10px 30px;background:rgba(232,247,255,.92);border-bottom:1px solid #cce6f4;color:#075985;display:flex;gap:10px;align-items:center;font-size:.82rem;font-weight:650}.pev2-status>span:first-child{width:26px;height:26px;border-radius:9px;display:grid;place-items:center;background:#d7f1fb}.pev2-status #pf-rips-count{margin-left:auto;font-weight:850}.pev2-status #pf-rips-missing,.pev2-status #pf-rips-progress-fill{display:none}
.pev2-body{padding:20px 24px 24px;overflow:auto;overscroll-behavior:contain;display:grid;grid-template-columns:minmax(0,1.18fr) minmax(0,.82fr);gap:16px;align-content:start;scrollbar-color:#9ec7e2 transparent;scrollbar-width:thin}.pev2-cita{display:none;grid-column:1/-1;background:#e9fbf4;color:#057457;padding:11px 14px;border:1px solid #bcebd9;border-radius:12px}.pev2-cita.is-visible{display:block}
.pev2-section{background:rgba(255,255,255,.94);border:1px solid var(--pev2-line);border-radius:18px;padding:18px 19px 20px;margin:0;box-shadow:0 8px 24px rgba(25,75,116,.055);min-width:0}.pev2-identity,.pev2-fiscal,.pev2-additional{grid-column:1/-1}.pev2-section-title{display:flex;align-items:center;gap:11px;padding-bottom:13px;margin-bottom:15px;border-bottom:1px solid #e6eef6}.pev2-section-title>.material-symbols-outlined{width:35px;height:35px;border-radius:11px;display:grid;place-items:center;background:linear-gradient(145deg,#e4f4ff,#d9f8fa);color:#097cb7;font-size:19px}.pev2-section-title h3{font-size:.88rem;line-height:1.1;margin:0 0 3px;color:#263a56}.pev2-section-title p{font-size:.69rem;margin:0;color:#8190a5}
.pev2-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px 14px}.pev2-grid-identity{grid-template-columns:repeat(4,minmax(0,1fr))}.pev2-grid label{display:flex;flex-direction:column;gap:6px;font-size:.68rem;font-weight:800;letter-spacing:.025em;text-transform:uppercase;color:#50617a;min-width:0}.pev2-grid label small{font-size:.66rem;text-transform:none;color:#1780b7}.pev2-grid input,.pev2-grid select,.pev2-grid textarea{width:100%;min-height:45px;border:1px solid #c6d6e8;border-radius:11px;background:#fbfdff;color:#15243c;padding:10px 12px;font-family:inherit;font-size:.9rem;font-weight:550;text-transform:none;letter-spacing:normal;pointer-events:auto;transition:border-color .16s,box-shadow .16s,background .16s}.pev2-grid textarea{resize:vertical}.pev2-grid input:hover,.pev2-grid select:hover,.pev2-grid textarea:hover{border-color:#91b9d8;background:#fff}.pev2-grid input:focus,.pev2-grid select:focus,.pev2-grid textarea:focus{outline:0;background:#fff;border-color:#1688cf;box-shadow:0 0 0 4px rgba(22,136,207,.12)}.pev2-span-2{grid-column:span 2}.pev2-grid-identity .pev2-span-2{grid-column:span 2}.pev2-subgrid{grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:14px;border-radius:13px;background:#f3f9fd;border:1px dashed #b9d8ea}.pev2-check{flex-direction:row!important;align-items:center!important;text-transform:none!important;font-size:.79rem!important}.pev2-check input{width:20px!important;min-height:20px!important;accent-color:var(--pev2-blue)}.pf-invalid{border-color:#dc2626!important;box-shadow:0 0 0 3px rgba(220,38,38,.1)!important}
.pev2-footer{min-height:76px;padding:14px 26px;background:#fff;border-top:1px solid var(--pev2-line);display:flex;align-items:center;justify-content:space-between;gap:16px}.pev2-footer-note{display:flex;align-items:center;gap:8px;color:#718198;font-size:.74rem}.pev2-footer-note .material-symbols-outlined{font-size:18px;color:#249d84}.pev2-actions{display:flex;gap:10px}.pev2-footer button{min-height:46px;border-radius:12px;padding:0 24px;font-family:inherit;font-weight:800;cursor:pointer;transition:.18s ease}.pev2-cancel{background:#fff;border:1px solid #c5d2e1;color:#40516a}.pev2-cancel:hover{background:#f2f6fa}.pev2-save{display:flex;align-items:center;gap:8px;background:linear-gradient(135deg,#086ec7,#159cd5);border:1px solid #0874c7;color:#fff;box-shadow:0 8px 20px rgba(8,116,199,.22)}.pev2-save:hover{transform:translateY(-1px);box-shadow:0 11px 25px rgba(8,116,199,.28)}.pev2-save .material-symbols-outlined{font-size:19px}.pev2-save:disabled{opacity:.65;cursor:wait;transform:none}
@media(max-width:1100px){.pev2-panel{width:min(1000px,calc(100vw - 30px))}.pev2-grid-identity{grid-template-columns:repeat(3,minmax(0,1fr))}.pev2-body{grid-template-columns:1fr}.pev2-section{grid-column:1}.pev2-identity,.pev2-fiscal,.pev2-additional{grid-column:1}}
@media(max-width:700px){.paciente-editor-v2{padding:0}.pev2-panel{width:100vw;height:100vh;border-radius:0}.pev2-header{min-height:96px;padding:18px 16px}.pev2-header-mark{width:48px;height:48px;flex-basis:48px;border-radius:15px}.pev2-header p{display:none}.pev2-status{padding:9px 16px}.pev2-body{padding:14px;display:block}.pev2-section{margin-bottom:12px;padding:16px}.pev2-grid,.pev2-grid-identity{grid-template-columns:1fr}.pev2-span-2,.pev2-grid-identity .pev2-span-2{grid-column:span 1}.pev2-subgrid{grid-template-columns:1fr}.pev2-footer{padding:12px 14px}.pev2-footer-note{display:none}.pev2-actions{width:100%}.pev2-actions button{flex:1;padding:0 12px}}
@media(prefers-reduced-motion:reduce){.paciente-editor-v2 *{transition:none!important}}

/* Liquid Glass: misma familia material del formulario de Citas, aislada bajo V2. */
.paciente-editor-v2{
  --pev2-spring:cubic-bezier(.22,1,.36,1);
  background:
    radial-gradient(circle at 18% 15%,color-mix(in srgb,var(--glass-primary,#6366f1) 30%,transparent),transparent 43%),
    radial-gradient(circle at 84% 80%,color-mix(in srgb,var(--glass-secondary,#38bdf8) 27%,transparent),transparent 44%),
    rgba(15,23,42,.40);
  backdrop-filter:blur(26px) saturate(1.5);
  -webkit-backdrop-filter:blur(26px) saturate(1.5);
  animation:pev2BackdropIn .25s var(--pev2-spring)
}
@keyframes pev2BackdropIn{from{opacity:0}to{opacity:1}}
@keyframes pev2SheetIn{from{opacity:0;transform:translateY(20px) scale(.965)}to{opacity:1;transform:none}}
.pev2-panel{
  background:linear-gradient(145deg,rgba(255,255,255,.76),rgba(239,246,255,.60) 55%,rgba(235,245,255,.70));
  border-color:rgba(255,255,255,.82);
  backdrop-filter:blur(40px) saturate(1.8);
  -webkit-backdrop-filter:blur(40px) saturate(1.8);
  box-shadow:0 42px 100px -24px rgba(15,23,42,.52),0 8px 26px -12px rgba(30,64,175,.28),inset 0 1px 0 rgba(255,255,255,.96),inset 0 -1px 0 rgba(255,255,255,.45);
  animation:pev2SheetIn .4s var(--pev2-spring)
}
.pev2-panel:before{content:"";position:absolute;inset:0;border-radius:inherit;z-index:0;pointer-events:none;background:linear-gradient(106deg,transparent 31%,rgba(255,255,255,.34) 48%,transparent 65%)}
.pev2-panel>*{position:relative;z-index:1}
.pev2-header{
  min-height:100px;
  margin:0;
  color:#17233d;
  background:linear-gradient(180deg,rgba(255,255,255,.83),rgba(255,255,255,.52));
  border-bottom:1px solid rgba(255,255,255,.9);
  backdrop-filter:blur(18px) saturate(1.4);
  -webkit-backdrop-filter:blur(18px) saturate(1.4)
}
.pev2-header:after{border-color:rgba(99,102,241,.12);box-shadow:none}
.pev2-header-mark{background:linear-gradient(150deg,rgba(255,255,255,.96),rgba(224,231,255,.78));border-color:rgba(255,255,255,.98);box-shadow:0 10px 25px -12px rgba(79,70,229,.65),inset 0 1px 0 #fff}
.pev2-header-mark span{border-color:#5146e5}.pev2-header-mark span:after{border-color:#5146e5}
.pev2-header h2{color:#16233d}.pev2-header p{color:#6b7c9b}.pev2-kicker{color:#4f46e5}
.pev2-close,.pev2-minimize,.pev2-header #btn-paciente-smart-voice{width:44px;height:44px;display:grid;place-items:center;border-radius:50%;background:rgba(255,255,255,.72);border:1px solid rgba(255,255,255,.96);color:#64748b;box-shadow:0 8px 20px -10px rgba(15,23,42,.45),inset 0 1px 0 #fff;cursor:pointer;transition:transform .18s var(--pev2-spring),background .25s,color .25s}
.pev2-header #btn-paciente-smart-voice{margin-left:auto}.pev2-header #btn-paciente-smart-voice+.pev2-close{margin-left:0}.pev2-header #btn-paciente-smart-voice:hover{color:#4f46e5;background:rgba(238,242,255,.92)}
.pev2-close:hover{color:#dc2626;background:rgba(254,226,226,.94);transform:none}.pev2-minimize:hover{color:#4338ca;background:rgba(238,242,255,.94)}.pev2-close:active,.pev2-minimize:active,.pev2-header #btn-paciente-smart-voice:active{transform:scale(.9)}
.pev2-status{background:rgba(231,246,255,.63);border-bottom-color:rgba(255,255,255,.78);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
.pev2-body{background:transparent}
.pev2-section{background:linear-gradient(145deg,rgba(255,255,255,.55),rgba(255,255,255,.34));border-color:rgba(255,255,255,.84);box-shadow:0 12px 30px -18px rgba(15,23,42,.32),inset 0 1px 0 rgba(255,255,255,.85)}
.pev2-section-title{border-bottom-color:rgba(255,255,255,.88)}
.pev2-section-title>.material-symbols-outlined{background:linear-gradient(145deg,rgba(255,255,255,.92),rgba(219,242,255,.68));border:1px solid rgba(255,255,255,.9);box-shadow:0 7px 16px -10px rgba(37,99,235,.6)}
.pev2-grid input,.pev2-grid select,.pev2-grid textarea{background-color:rgba(255,255,255,.58);border-color:rgba(255,255,255,.92);box-shadow:0 2px 9px -5px rgba(15,23,42,.22),inset 0 1px 0 rgba(255,255,255,.92);transition:border-color .25s var(--pev2-spring),box-shadow .25s var(--pev2-spring),background .25s,transform .25s var(--pev2-spring)}
.pev2-grid input:hover,.pev2-grid select:hover,.pev2-grid textarea:hover{background-color:rgba(255,255,255,.78);border-color:#fff}
.pev2-grid input:focus,.pev2-grid select:focus,.pev2-grid textarea:focus{background-color:rgba(255,255,255,.9);border-color:rgba(99,102,241,.38);box-shadow:0 0 0 4px rgba(99,102,241,.11),0 8px 20px -14px rgba(79,70,229,.48)}
.pev2-input-actions{display:grid;grid-template-columns:minmax(0,1fr) 45px 45px;gap:6px}.pev2-input-actions button{width:45px;height:45px;border-radius:13px;border:1px solid rgba(255,255,255,.94);background:rgba(255,255,255,.7);color:#4f46e5;box-shadow:0 5px 14px -9px rgba(15,23,42,.5),inset 0 1px 0 #fff;cursor:pointer}.pev2-input-actions button:active{transform:scale(.93)}
.pev2-subgrid{background:rgba(239,246,255,.42);border-color:rgba(255,255,255,.9)}
.pev2-footer{background:linear-gradient(0deg,rgba(255,255,255,.86),rgba(255,255,255,.58));border-top-color:rgba(255,255,255,.9);backdrop-filter:blur(18px) saturate(1.35);-webkit-backdrop-filter:blur(18px) saturate(1.35)}
.pev2-cancel{background:rgba(255,255,255,.68);border-color:rgba(255,255,255,.95);box-shadow:0 6px 16px -10px rgba(15,23,42,.38),inset 0 1px 0 #fff}.pev2-save{background:linear-gradient(135deg,var(--glass-primary,#4f46e5),var(--glass-secondary,#2563eb));border-color:rgba(255,255,255,.48);box-shadow:0 12px 28px -12px color-mix(in srgb,var(--glass-primary,#4f46e5) 65%,transparent),inset 0 1px 0 rgba(255,255,255,.35)}
@supports not (backdrop-filter:blur(1px)){.paciente-editor-v2{background:rgba(30,41,59,.78)}.pev2-panel{background:#eef5fb}.pev2-header,.pev2-footer,.pev2-section{background:#fff}}

/* Densidad de expediente: recupera la lectura inmediata del formulario original. */
.pev2-panel{width:min(1480px,calc(100vw - 30px));height:min(940px,calc(100vh - 30px))}
.pev2-header{min-height:78px;padding:14px 24px}.pev2-header-mark{width:50px;height:50px;flex-basis:50px;border-radius:15px}.pev2-header-mark span{transform:scale(.82)}.pev2-header h2{font-size:1.45rem}.pev2-header p{font-size:.78rem}.pev2-close,.pev2-minimize,.pev2-header #btn-paciente-smart-voice{width:40px;height:40px}
.pev2-status{min-height:42px;padding:7px 24px}.pev2-status #pf-rips-icon{font-size:19px}.pev2-rips-progress{display:block;width:112px;height:6px;margin-left:auto;border-radius:99px;background:rgba(100,116,139,.17);overflow:hidden}.pev2-status .pev2-rips-progress #pf-rips-progress-fill{display:block;height:100%;width:0;border-radius:inherit;background:linear-gradient(90deg,#4f46e5,#22c5d6);transition:width .3s var(--pev2-spring)}.pev2-status #pf-rips-count{margin-left:5px;min-width:34px;text-align:right}.pev2-status #pf-rips-missing{display:none}
.pev2-body{padding:12px 16px 15px;gap:10px;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-areas:"identity identity identity" "fiscal fiscal fiscal" "contact insurance additional" "clinical clinical clinical"}
.pev2-identity{grid-area:identity}.pev2-fiscal{grid-area:fiscal}.pev2-contact{grid-area:contact}.pev2-insurance{grid-area:insurance}.pev2-additional{grid-area:additional}.pev2-clinical{grid-area:clinical}
.pev2-section{padding:10px 13px 13px;border-radius:16px}.pev2-section-title{min-height:34px;padding-bottom:8px;margin-bottom:9px;gap:8px}.pev2-section-title>.material-symbols-outlined{width:29px;height:29px;border-radius:9px;font-size:17px}.pev2-section-title h3{font-size:.8rem;margin:0}.pev2-section-title p{font-size:.62rem}.pev2-grid{gap:8px 9px}.pev2-grid label{gap:4px;font-size:.63rem}.pev2-grid input,.pev2-grid select,.pev2-grid textarea{min-height:40px;padding:7px 10px;border-radius:10px;font-size:.82rem}.pev2-grid textarea{min-height:58px}.pev2-input-actions{grid-template-columns:minmax(0,1fr) 40px 40px;gap:5px}.pev2-input-actions button{width:40px;height:40px;border-radius:10px}.pev2-input-actions button .material-symbols-outlined{font-size:18px}
.pev2-grid-identity{grid-template-columns:repeat(12,minmax(0,1fr));grid-template-areas:"doctype doctype doctype docnum docnum docnum docnum sex sex birth birth birth" "names names names names lastname lastname lastname lastname secondlast secondlast secondlast secondlast" "civil civil civil civil job job job job job job job job"}.pev2-id-doc{grid-area:doctype}.pev2-id-number{grid-area:docnum}.pev2-id-sex{grid-area:sex}.pev2-id-birth{grid-area:birth}.pev2-id-names{grid-area:names}.pev2-id-lastname{grid-area:lastname}.pev2-id-second-lastname{grid-area:secondlast}.pev2-id-civil{grid-area:civil}.pev2-id-job{grid-area:job}
.pev2-rips,.pev2-optional{display:inline-flex;align-items:center;margin-left:4px;padding:2px 6px;border-radius:999px;font-size:.54rem;font-style:normal;line-height:1.1;letter-spacing:.035em;vertical-align:1px}.pev2-rips{color:#3730a3;background:rgba(224,231,255,.92);border:1px solid rgba(199,210,254,.9)}.pev2-optional{color:#53647d;background:rgba(226,232,240,.8)}#pac-eps-rips-tag{display:inline-flex;margin-left:4px;padding:2px 6px;border-radius:999px;color:#3730a3;background:rgba(224,231,255,.92);font-size:.54rem;font-style:normal}
.pev2-footer{min-height:62px;padding:9px 18px}.pev2-footer button{min-height:42px}.pev2-footer-note b:first-of-type{color:#dc2626}.pev2-footer-note b:last-of-type{color:#4338ca;background:#e0e7ff;padding:1px 5px;border-radius:6px}
@media(max-width:1100px){.pev2-body{grid-template-columns:1fr 1fr;grid-template-areas:"identity identity" "fiscal fiscal" "contact insurance" "additional clinical"}.pev2-grid-identity{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-areas:none}.pev2-grid-identity>*{grid-area:auto!important}}
@media(max-width:700px){.pev2-body{display:block}.pev2-status .pev2-rips-progress{display:none}.pev2-grid-identity{grid-template-columns:1fr}.pev2-section-title p{display:none}.pev2-panel{width:100vw;height:100vh}.pev2-header{min-height:82px}}

/* Acciones del encabezado: dictado legible y cierre secundario. */
.pev2-header #btn-paciente-smart-voice{width:auto;min-width:164px;height:40px;padding:0 15px;display:inline-flex;align-items:center;justify-content:center;gap:7px;border-radius:999px;color:#4338ca;background:linear-gradient(135deg,rgba(255,255,255,.92),rgba(231,232,255,.76));font-size:.75rem;line-height:1;font-weight:800;white-space:nowrap}
.pev2-header #btn-paciente-smart-voice .material-symbols-outlined{font-size:19px}.pev2-header #btn-paciente-smart-voice.is-listening{color:#fff;background:linear-gradient(135deg,#ef4444,#dc2626);border-color:rgba(255,255,255,.7);animation:patient-voice-pulse 1.2s ease infinite}
.pev2-header .pev2-minimize,.pev2-header .pev2-close{width:38px;height:38px;flex:0 0 38px;margin-left:7px;color:#586980}.pev2-header .pev2-minimize .material-symbols-outlined,.pev2-header .pev2-close .material-symbols-outlined{font-size:21px;font-weight:650}.pev2-header .pev2-close{border-color:rgba(255,255,255,.98);background:rgba(255,255,255,.82)}
@media(max-width:700px){.pev2-header #btn-paciente-smart-voice{min-width:40px;width:40px;padding:0}.pev2-header #btn-paciente-smart-voice .pev2-voice-label{display:none}.pev2-header .pev2-minimize,.pev2-header .pev2-close{margin-left:3px}}
