
    :root{
      --navy:#0b5271; --blue:#12698a; --cyan:#36b7df; --bg:#f3f8fb;
      --white:#fff; --text:#173747; --muted:#718791; --line:#d8e5eb;
      --ok:#18864b; --bad:#c84350; --shadow:0 8px 24px rgba(8,63,92,.08);
    }
    *{box-sizing:border-box}
    body{margin:0;background:var(--bg);color:var(--text);font-family:Arial,Helvetica,sans-serif;font-size:14px}
    button,input,select,textarea{font:inherit}
    .header{background:linear-gradient(110deg,#084763,#126b8c);color:#fff;padding:24px 32px 20px}
    .header h1{margin:0;font-size:27px;letter-spacing:.4px}.header p{margin:7px 0 0;opacity:.9}
    .nav{display:flex;gap:10px;padding:12px 18px;background:#fff;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:20}
    .nav button{border:0;background:transparent;color:#315666;padding:10px 16px;border-radius:8px;font-weight:700;cursor:pointer}
    .nav button.active{background:#084763;color:#fff}
    .content{max-width:1120px;margin:0 auto;padding:24px 22px 45px}
    .page{display:none}.page.active{display:block}
    .page-title{margin-bottom:14px}.page-title h2{margin:0;color:#083f5c;font-size:22px}.page-title p{margin:5px 0 0;color:var(--muted)}
    .wizard-progress{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:18px}
    .w-step{background:#fff;border:1px solid var(--line);border-radius:10px;padding:11px 13px;color:#71838c;font-weight:700;font-size:12px;display:flex;align-items:center;gap:9px}
    .w-step .num{width:25px;height:25px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:#edf4f7;color:#55717e}
    .w-step.active{border-color:#80d2ea;background:#f0fbfe;color:#083f5c}.w-step.active .num{background:#083f5c;color:#fff}
    .w-step.done{border-color:#b8dfca;background:#f4fbf7;color:#25744b}.w-step.done .num{background:#18864b;color:#fff}
    .wizard-screen{display:none}.wizard-screen.active{display:block}
    .panel{background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow);padding:20px;margin-bottom:18px}
    .panel-celeste{background:#ffffff;border:1px solid #8fd8f3;box-shadow:0 8px 24px rgba(8,63,92,.06)}
    .panel.dynamic{border-left:4px solid var(--cyan)}
    .panel-title{margin:0 0 16px;color:#083f5c;font-size:16px}.step{display:inline-block;background:#eef9fc;border:1px solid #cce8f1;color:#12698a;border-radius:999px;padding:3px 9px;font-size:11px;margin-right:7px}
    .step-note,.hint{color:var(--muted);font-size:11px}.step-note{display:block;clear:both;margin:16px 0 15px;font-size:12px;line-height:1.45}.agenda-modal .step-note{margin-top:18px;padding-top:4px}
    .info-box{background:#eff9fc;border:1px solid #cbe8f1;color:#315968;border-radius:9px;padding:11px 13px;margin-bottom:14px;font-size:12px;line-height:1.5}
    .grid{display:grid;grid-template-columns:repeat(12,1fr);gap:14px}.col-12{grid-column:span 12}.col-8{grid-column:span 8}.col-6{grid-column:span 6}.col-5{grid-column:span 5}.col-4{grid-column:span 4}.col-3{grid-column:span 3}.col-2{grid-column:span 2}
    label{display:block;font-size:12px;font-weight:700;color:#4d6672;margin-bottom:6px}.required:after{content:' *';color:var(--bad)}
    input,select,textarea{width:100%;border:1px solid #cddce3;border-radius:8px;padding:10px 11px;background:#fff;color:var(--text);outline:none}
    input[type=text],textarea,select{text-transform:uppercase}
    #loginUsuario,
    #nuevoUsuarioLogin,
    #editarUsuarioLogin{
      text-transform:lowercase!important
    }

    #loginPassword,
    #passwordActual,
    #passwordNueva,
    #passwordConfirmar,
    #nuevoUsuarioPassword,
    #nuevoUsuarioPassword2{
      text-transform:none!important
    }input:focus,select:focus,textarea:focus{border-color:#36b7df;box-shadow:0 0 0 3px rgba(54,183,223,.12)}textarea{min-height:80px;resize:vertical}
    .cie10-search-input{
      background:#fff!important;
      padding-right:38px!important;
      background-image:
        linear-gradient(45deg,transparent 50%,#1689b0 50%),
        linear-gradient(135deg,#1689b0 50%,transparent 50%)!important;
      background-position:
        calc(100% - 18px) 50%,
        calc(100% - 12px) 50%!important;
      background-size:6px 6px,6px 6px!important;
      background-repeat:no-repeat!important
    }
    .cie10-search-input::placeholder{color:#7b8e97;font-weight:700}
    .cie10-dropdown{
      display:none;
      position:fixed;
      z-index:5000;
      max-height:330px;
      overflow-y:auto;
      overflow-x:hidden;
      background:#ffffff;
      border:2px solid #65bee8;
      border-radius:10px;
      box-shadow:0 16px 36px rgba(8,63,92,.22);
      color:#173747;
      scrollbar-width:thin;
      scrollbar-color:#1689b0 #e8f7fd
    }
    .cie10-dropdown.show{display:block}
    .cie10-dropdown::-webkit-scrollbar{width:10px}
    .cie10-dropdown::-webkit-scrollbar-track{
      background:#e8f7fd;
      border-radius:10px
    }
    .cie10-dropdown::-webkit-scrollbar-thumb{
      background:#1689b0;
      border-radius:10px;
      border:2px solid #e8f7fd
    }
    .cie10-dropdown::-webkit-scrollbar-thumb:hover{background:#0b6e90}
    .cie10-option{
      padding:10px 13px;
      border-bottom:1px solid #e4f0f5;
      background:#ffffff;
      color:#173747;
      font-size:13px;
      font-weight:700;
      line-height:1.35;
      cursor:pointer
    }
    .cie10-option:last-child{border-bottom:0}
    .cie10-option:hover,.cie10-option.active{
      background:#e8f7fd;
      color:#0b5271
    }
    .cie10-empty{
      padding:14px;
      background:#ffffff;
      color:#6c8089;
      font-size:12px;
      font-weight:800;
      text-align:center
    }

    .inline-search{display:flex;gap:7px}.inline-search input{flex:1}.dynamic-section{display:none}.dynamic-section.show{display:block}
    .actions{display:flex;justify-content:flex-end;gap:9px;margin-top:18px;padding-top:16px;border-top:1px solid #edf2f4}
    .btn{border:0;border-radius:8px;padding:10px 15px;font-weight:700;cursor:pointer}.btn-primary{background:#0b5f7f;color:#fff}.btn-primary:hover{background:#084b67}.btn-secondary{background:#edf4f7;color:#315665;border:1px solid #d7e4e9}.btn-light{background:#fff;color:#12698a;border:1px solid #bcd8e3}.btn-sm{padding:8px 10px;font-size:12px}
    .close-summary{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:16px}.summary-item{background:#f7fbfc;border:1px solid #e0edf1;border-radius:9px;padding:11px}.summary-item .k{font-size:10px;color:var(--muted);font-weight:800;text-transform:uppercase}.summary-item .v{margin-top:5px;color:#083f5c;font-weight:800}
    .searchbar{display:flex;gap:9px;align-items:end}.searchbar .grow{flex:1}.patient-results{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:15px}.patient-card{border:1px solid var(--line);border-radius:10px;padding:14px;background:#fbfdfe}.patient-card h4{margin:0 0 6px;color:#083f5c}.meta{font-size:12px;color:var(--muted);line-height:1.6}.card-actions{display:flex;gap:7px;margin-top:11px;flex-wrap:wrap}
    .profile{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.profile-item{background:#f7fbfc;border:1px solid #e0edf1;border-radius:9px;padding:11px}.profile-item .k{font-size:10px;text-transform:uppercase;color:var(--muted);font-weight:700}.profile-item .v{font-size:14px;font-weight:700;color:#083f5c;margin-top:4px}
    .table-wrap{overflow:auto;border:1px solid var(--line);border-radius:9px}
    #tablaConsolidadoFecha{
      width:100%;
      max-height:520px;
      overflow:auto;
      position:relative;
      scrollbar-gutter:stable both-edges;
      -webkit-overflow-scrolling:touch;
    }
    #tablaConsolidadoFecha table{
      min-width:2550px;
      width:100%;
      border-collapse:collapse;
      table-layout:auto;
    }
    #tablaConsolidadoFecha thead th{
      position:sticky;
      top:0;
      z-index:4;
      background:#edf6f9;
      white-space:nowrap;
      box-shadow:0 1px 0 var(--line);
    }
    #tablaConsolidadoFecha td{
      min-width:105px;
      max-width:260px;
      white-space:normal;
      word-break:break-word;
    }
    #tablaConsolidadoFecha th:nth-child(3),
    #tablaConsolidadoFecha td:nth-child(3),
    #tablaConsolidadoFecha th:nth-child(7),
    #tablaConsolidadoFecha td:nth-child(7),
    #tablaConsolidadoFecha th:nth-child(8),
    #tablaConsolidadoFecha td:nth-child(8),
    #tablaConsolidadoFecha th:nth-child(18),
    #tablaConsolidadoFecha td:nth-child(18){
      min-width:180px;
    }
table{width:100%;border-collapse:collapse;min-width:760px;background:#fff}th{background:#edf6f9;color:#355b69;text-align:left;font-size:11px;text-transform:uppercase;padding:10px;border-bottom:1px solid var(--line)}td{padding:10px;border-bottom:1px solid #edf2f4;vertical-align:top}.empty-state{padding:24px;text-align:center;color:var(--muted)}
    .cards{display:grid;grid-template-columns:repeat(5,1fr);gap:12px;margin-bottom:16px}
    .dashboard-cards{grid-template-columns:repeat(4,minmax(0,1fr))}
    .dashboard-cards .card{min-height:104px}
    .dashboard-cards .poa-top-clickable{
      border:2px solid #65bee8;
      background:#eef9fd
    }
    .dashboard-cards .poa-top-clickable .label{
      color:#0b5f7f;
      font-weight:900
    }
    @media(max-width:1100px){.dashboard-cards{grid-template-columns:repeat(2,minmax(0,1fr))}}
    @media(max-width:620px){.dashboard-cards{grid-template-columns:1fr}}.card{background:#ffffff;border:1px solid #8fd8f3;border-radius:11px;padding:15px;box-shadow:0 8px 24px rgba(8,63,92,.06)}.card .label{font-size:11px;color:var(--muted);font-weight:700;text-transform:uppercase}.card .value{font-size:27px;color:#083f5c;font-weight:800;margin-top:5px}.filters{display:flex;gap:11px;align-items:end;flex-wrap:wrap}.filters .field{min-width:180px}.indicator-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.diag-frequency-section{display:grid;grid-template-columns:245px minmax(0,1fr);gap:16px;margin:16px 0 20px;align-items:stretch}
.diag-summary-card,.diag-ranking-card{background:#fff;border:2px solid #b7e5f6;border-radius:16px;box-shadow:0 6px 18px rgba(0,91,130,.05)}
.diag-summary-card{padding:20px 18px}
.diag-summary-title{color:#005f82;font-size:13px;font-weight:900;line-height:1.3;margin-bottom:14px}
.diag-summary-main span{display:block;color:#08a3cf;font-size:38px;line-height:1;font-weight:900;margin-bottom:7px}
.diag-summary-main small,.diag-summary-sub small{display:block;color:#6a748a;font-size:9px;font-weight:900;line-height:1.35}
.diag-summary-divider{height:1px;background:#cbe8f3;margin:16px 0}
.diag-summary-sub strong{display:block;color:#005f82;font-size:24px;font-weight:900;margin-top:6px}
.diag-top-name{color:#005f82;font-size:11px;font-weight:900;line-height:1.35;margin-top:5px}
.diag-ranking-card{padding:18px 16px 14px;min-width:0}
.diag-ranking-head h3{margin:0;color:#005f82;font-size:18px;font-weight:900}
.diag-ranking-head p{margin:5px 0 10px;color:#66758b;font-size:9px;font-weight:800}
.diag-ranking-list{max-height:310px;overflow-y:auto;padding-right:7px;scrollbar-color:#9aa4aa transparent;scrollbar-width:thin}
.diag-ranking-item{padding:10px 2px 14px;border-bottom:1px solid #d7edf5;cursor:pointer}
.diag-ranking-item:last-child{border-bottom:none}
.diag-ranking-row{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:7px}
.diag-ranking-name{color:#005f82;font-size:11px;font-weight:900;line-height:1.35;min-width:0}
.diag-ranking-count{color:#08a3cf;font-size:18px;font-weight:900;flex:0 0 auto}
.diag-ranking-track{width:100%;height:8px;background:#eaf7fb;border-radius:999px;overflow:hidden}
.diag-ranking-bar{height:100%;min-width:4px;border-radius:999px;background:#16acd2}
.diag-ranking-item:nth-child(5n+1) .diag-ranking-bar{background:#075f82}
.diag-ranking-item:nth-child(5n+2) .diag-ranking-bar{background:#19aed1}
.diag-ranking-item:nth-child(5n+3) .diag-ranking-bar{background:#55bfd8}
.diag-ranking-item:nth-child(5n+4) .diag-ranking-bar{background:#7fd2e3}
.diag-ranking-item:nth-child(5n+5) .diag-ranking-bar{background:#a9e0ea}
.diag-ranking-item:hover{background:#f5fbfd}
@media(max-width:900px){.diag-frequency-section{grid-template-columns:1fr}}.indicator{background:#ffffff;border:1px solid #8fd8f3;border-radius:12px;padding:17px;box-shadow:0 8px 24px rgba(8,63,92,.06)}.indicator .code{font-size:10px;color:#12698a;font-weight:800}.indicator h3{font-size:13px;line-height:1.35;min-height:54px;color:#335260}.indicator .result-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:8px 0 4px}.indicator .result{font-size:30px;font-weight:800;color:#083f5c}.indicator .detail{font-size:11px;color:var(--muted);margin-top:4px}.poa-breakdown{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:14px 0 10px}.poa-breakdown>div{background:#eef9fd;border:1px solid #8fd8f3;border-radius:9px;padding:10px}
    .poa-breakdown .poa-clickable{
      cursor:pointer;
      transition:transform .15s ease,background .15s ease,border-color .15s ease,box-shadow .15s ease
    }
    .poa-breakdown .poa-clickable:hover{
      background:#dff4fb;
      border-color:#52b8df;
      box-shadow:0 5px 14px rgba(8,63,92,.10);
      transform:translateY(-1px)
    }
    .poa-click-hint{
      display:block;
      margin-top:5px;
      font-size:8px;
      font-weight:900;
      color:#14799b;
      letter-spacing:.15px
    }
    .poa-top-clickable{
      cursor:pointer;
      transition:transform .15s ease,background .15s ease,border-color .15s ease,box-shadow .15s ease
    }
    .poa-top-clickable:hover{
      background:#eef9fd;
      border-color:#52b8df;
      box-shadow:0 8px 20px rgba(8,63,92,.11);
      transform:translateY(-1px)
    }
    .poa-monthly-section{
      margin-top:18px;
      background:#fff;
      border:2px solid #8fd8f3;
      border-radius:14px;
      padding:18px;
      box-shadow:0 8px 24px rgba(8,63,92,.07)
    }
    .poa-monthly-head{
      display:flex;
      align-items:flex-start;
      justify-content:space-between;
      gap:14px;
      flex-wrap:wrap;
      margin-bottom:14px
    }
    .poa-monthly-head h3{margin:0;color:#083f5c;font-size:16px}
    .poa-monthly-head p{margin:5px 0 0;color:#617b87;font-size:11px;line-height:1.45}
    .poa-report-state{
      min-height:38px;
      margin-top:10px;
      padding:10px 12px;
      border-radius:9px;
      background:#eef9fd;
      border:1px solid #bfe5f3;
      color:#315968;
      font-size:11px;
      font-weight:800;
      line-height:1.45
    }
    .poa-report-actions{display:flex;justify-content:flex-end;gap:9px;flex-wrap:wrap;margin-top:12px}
    .poa-report-actions-center{
      justify-content:center;
      margin:8px 0 4px
    }
    .poa-report-main-btn{
      min-width:300px;
      min-height:46px;
      font-size:12px;
      font-weight:900;
      letter-spacing:.2px
    }
    .poa-report-simple .poa-monthly-head{
      margin-bottom:5px
    }

    .poa-reported-results{
      display:none;
      margin-top:18px;
      padding-top:16px;
      border-top:1px solid #d6edf5
    }
    .poa-reported-results.show{display:block}
    .poa-reported-results-title{
      text-align:center;
      color:#083f5c;
      font-size:12px;
      font-weight:900;
      margin-bottom:14px;
      text-transform:uppercase
    }
    .poa-circle-grid{
      display:grid;
      grid-template-columns:repeat(3,minmax(0,1fr));
      gap:22px;
      max-width:1200px;
      margin:0 auto;
      align-items:start
    }
    .poa-circle-card{
      display:flex;
      align-items:center;
      justify-content:center;
      text-align:center
    }
    .poa-circle{
      width:220px;
      height:220px;
      border-radius:50%;
      border:10px solid #83d2ef;
      background:#f7fcfe;
      box-shadow:0 7px 18px rgba(8,63,92,.08);
      display:flex;
      flex-direction:column;
      align-items:center;
      justify-content:center;
      text-align:center;
      padding:18px;
      gap:8px;
      margin:0 auto
    }
    .poa-circle.no-data{
      border-color:#d6e5eb;
      color:#718792
    }
    .poa-circle-code{
      color:#12698a;
      font-size:14px;
      font-weight:900;
      line-height:1.2
    }
    .poa-circle-name{
      color:#0e5a78;
      font-size:13px;
      font-weight:900;
      line-height:1.25;
      max-width:150px;
      min-height:48px;
      display:flex;
      align-items:center;
      justify-content:center
    }
    .poa-circle-value{
      color:#083f5c;
      font-size:42px;
      font-weight:900;
      line-height:1
    }
    .poa-circle.no-data .poa-circle-code,
    .poa-circle.no-data .poa-circle-name,
    .poa-circle.no-data .poa-circle-value{
      color:#718792
    }

    .reporteria-indicadores-section{margin-top:18px;background:#fff;border:1px solid #8fd8f3;border-radius:14px;padding:18px;box-shadow:0 8px 24px rgba(8,63,92,.06)}
    .reporteria-indicadores-head{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-bottom:16px}
    .reporteria-indicadores-head h3{margin:0;color:#0a5274;font-size:16px;font-weight:900;text-transform:uppercase}
    .reporteria-indicadores-head p{margin:4px 0 0;color:#68808c;font-size:10px;font-weight:800}
    .poa-history-charts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin:16px 0 0}
    .poa-chart-card{background:#fff;border:1px solid #c7e0ea;border-radius:18px;padding:17px 18px 18px;overflow:hidden;box-shadow:0 8px 22px rgba(10,70,100,.06)}
    .poa-chart-card.general-chart{grid-column:1/-1}
    .poa-chart-card h4{margin:0;color:#075474;font-size:14px;line-height:1.25;min-height:34px;font-weight:900;text-transform:uppercase}
    .poa-chart-meta{font-size:10px;color:#667a8e;font-weight:800;margin:5px 0 10px;text-transform:uppercase}
    .poa-chart-scroll{overflow-x:auto;padding-bottom:5px;scrollbar-width:thin}
    .poa-bars{position:relative;height:250px;display:flex;align-items:flex-end;gap:14px;padding:18px 10px 38px;border-bottom:2px solid #c7dce5;min-width:100%}
    .poa-meta-line{position:absolute;left:0;right:0;border-top:1px dashed #d9a14e;pointer-events:none}
    .poa-meta-line span{position:absolute;right:4px;top:-17px;font-size:9px;font-weight:900;color:#8f6516;background:#fff6df;padding:2px 5px;border-radius:5px}
    .poa-bar-col{width:64px;flex:0 0 64px;height:198px;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;position:relative}
    .poa-bar-value{font-size:13px;font-weight:900;color:#27a9d0;margin-bottom:7px;white-space:nowrap}
    .poa-bar{width:52px;min-height:3px;border-radius:13px 13px 4px 4px;background:#5ec4df;box-shadow:0 5px 14px rgba(19,121,157,.13)}
    .poa-bar.no-data{height:3px!important;background:#dbe6ea!important;box-shadow:none}
    .poa-bar-col:nth-child(5n+1) .poa-bar{background:#a9dce9}.poa-bar-col:nth-child(5n+1) .poa-bar-value{color:#a9dce9}
    .poa-bar-col:nth-child(5n+2) .poa-bar{background:#82d3e4}.poa-bar-col:nth-child(5n+2) .poa-bar-value{color:#82d3e4}
    .poa-bar-col:nth-child(5n+3) .poa-bar{background:#58c0da}.poa-bar-col:nth-child(5n+3) .poa-bar-value{color:#58c0da}
    .poa-bar-col:nth-child(5n+4) .poa-bar{background:#2fa9ce}.poa-bar-col:nth-child(5n+4) .poa-bar-value{color:#2fa9ce}
    .poa-bar-col:nth-child(5n+5) .poa-bar{background:#086e95}.poa-bar-col:nth-child(5n+5) .poa-bar-value{color:#086e95}
    .poa-bar-label{position:absolute;top:204px;width:68px;text-align:center;font-size:9px;line-height:1.15;font-weight:900;color:#536b78;text-transform:uppercase}
    @media(max-width:1250px){.poa-history-charts{grid-template-columns:1fr 1fr}.poa-chart-card.general-chart{grid-column:1/-1}}
    @media(max-width:820px){.poa-history-charts{grid-template-columns:1fr}.poa-chart-card.general-chart{grid-column:auto}}

    @media(max-width:1100px){.poa-circle-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
    @media(max-width:760px){.poa-circle-grid{grid-template-columns:1fr}.poa-circle{width:210px;height:210px}}
    @media(max-width:620px){.poa-monthly-section{padding:13px}}

    .fuera24-resumen{
      margin-bottom:12px;
      padding:11px 13px;
      border:1px solid #8fd8f3;
      background:#eef9fd;
      border-radius:10px;
      color:#174c60;
      font-size:12px;
      font-weight:800
    }
    .fuera24-table{min-width:980px}
    .fuera24-vacio{
      padding:28px 16px;
      text-align:center;
      color:#35718a;
      font-weight:800;
      background:#f3fbfe;
      border:1px solid #bfe5f3;
      border-radius:10px
    }.poa-breakdown small{display:block;color:#6b7e87;font-size:9px;font-weight:800;text-transform:uppercase;line-height:1.3}.poa-breakdown strong{display:block;margin-top:5px;color:#0b536f;font-size:18px}.poa-formula{margin-top:10px;padding:9px 10px;border-radius:8px;background:#eef9fd;border:1px solid #c9ebf7;color:#315c6d;font-size:10px;font-weight:700;line-height:1.4}.status,.badge{display:inline-block;border-radius:999px;font-size:10px;font-weight:800}.status{margin-top:0;padding:5px 9px;white-space:nowrap}.badge{padding:4px 8px}.ok{background:#e6f7ee;color:var(--ok)}.no{background:#fdebed;color:var(--bad)}.info{background:#e8f5fa;color:#12698a}.empty{background:#eef3f5;color:#71828a}
    .loading{opacity:.55;pointer-events:none}
    .system-toast-overlay{position:fixed;inset:0;background:rgba(3,35,50,.46);display:flex;align-items:center;justify-content:center;padding:20px;opacity:0;visibility:hidden;transition:opacity .18s ease,visibility .18s ease;z-index:950}
    .system-toast-overlay.show{opacity:1;visibility:visible}
    .toast{position:relative;width:min(500px,calc(100vw - 32px));max-width:none;background:#fff;color:#123b4d;border:1px solid #d7e6ed;border-radius:16px;padding:0;box-shadow:0 20px 55px rgba(3,35,50,.28);transform:translateY(12px) scale(.985);opacity:0;transition:transform .18s ease,opacity .18s ease;overflow:hidden;z-index:951}
    .toast.show{transform:translateY(0) scale(1);opacity:1}
    .toast-message-head{background:#0b5775;color:#fff;padding:14px 16px;display:flex;align-items:center;gap:10px}
    .toast-message-icon{width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border-radius:50%;background:rgba(255,255,255,.16);font-size:20px;font-weight:900;flex:0 0 auto}
    .toast-message-title{font-size:15px;font-weight:900;letter-spacing:.2px;flex:1}
    .toast-message-close{border:0;background:rgba(255,255,255,.14);color:#fff;width:34px;height:34px;border-radius:8px;cursor:pointer;font-size:20px;line-height:1;font-weight:700}
    .toast-message-body{padding:18px 18px 20px;font-size:14px;line-height:1.55;font-weight:700;text-align:center;color:#294b5a;background:#fff}
    /* EMERGENTES DEL SISTEMA:
       CELESTE = información / proceso completado / agenda
       ROJO    = error / advertencia que bloquea el proceso */
    .toast.success,
    .toast.info,
    .toast.registro-success,
    .toast.agenda-success{
      border:2px solid #65bee8
    }
    .toast.success .toast-message-head,
    .toast.info .toast-message-head,
    .toast.registro-success .toast-message-head,
    .toast.agenda-success .toast-message-head{
      background:#8fd8f3;
      color:#083f5c
    }
    .toast.success .toast-message-icon,
    .toast.info .toast-message-icon,
    .toast.registro-success .toast-message-icon,
    .toast.agenda-success .toast-message-icon{
      background:rgba(255,255,255,.72);
      color:#0b5f7f
    }
    .toast.success .toast-message-close,
    .toast.info .toast-message-close,
    .toast.registro-success .toast-message-close,
    .toast.agenda-success .toast-message-close{
      background:rgba(255,255,255,.72);
      color:#0b5f7f
    }

    .toast.error{
      border:2px solid #d85b67
    }
    .toast.error .toast-message-head{
      background:#c84350;
      color:#fff
    }
    .toast.error .toast-message-icon{
      background:rgba(255,255,255,.18);
      color:#fff
    }
    .toast.error .toast-message-close{
      background:rgba(255,255,255,.18);
      color:#fff
    }
    .save-status{display:none;margin:-7px 0 16px;padding:10px 13px;border-radius:9px;border:1px solid var(--line);font-size:12px;font-weight:700;background:#fff;color:#526b77}.save-status.show{display:block}.save-status.saving{border-color:#9ed8eb;background:#f1fbfe;color:#0b5d7d}.save-status.ok{border-color:#b9dfc9;background:#f3fbf6;color:#177a48}.save-status.error{border-color:#efc1c7;background:#fff5f6;color:#a93443}
    .topic-list{display:flex;flex-direction:column;gap:9px;margin-bottom:10px}
    .topic-entry{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.topic-entry input{flex:1}.topic-entry .btn{white-space:nowrap}
    .otro-campo{display:none;margin-top:8px}.otro-campo.show{display:block}
    .topic-entry .alfTemaOtro.show{display:block !important;flex:1 1 100%;width:100%;min-height:44px;margin-top:2px}
    .pdf-header-live{display:grid;grid-template-columns:120px 1fr 190px;border:1px solid #111;margin:0 0 20px;background:#fff}
    .pdf-header-live>div{min-width:0;padding:8px;border-right:1px solid #111;display:flex;flex-direction:column;justify-content:center}
    .pdf-header-live>div:last-child{border-right:0}.pdf-header-live-logo img{max-width:105px;max-height:72px;object-fit:contain;margin:auto}
    .pdf-header-live-title{text-align:center;font-size:12px;font-weight:800;line-height:1.35}.pdf-header-live-title span{display:block;margin-top:5px;font-size:11px}
    .pdf-header-live-meta{font-size:10px;font-weight:700;line-height:1.75}
    .pdf-action-box{display:none;margin-top:16px;background:#f2fbfe;border:1px solid #c7e8f2;border-radius:10px;padding:14px 15px}.pdf-action-box.show{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.pdf-action-box .pdf-copy{font-size:12px;color:#315968;line-height:1.5}.pdf-action-box .pdf-copy b{color:#083f5c}
    .post-save-panel{display:none;margin-top:18px;background:#f4fbf7;border:1px solid #b9dfc9;border-radius:11px;padding:16px}
    .post-save-panel.show{display:block}
    .post-save-title{font-weight:800;color:#177a48;font-size:14px;margin-bottom:5px}
    .post-save-text{font-size:12px;color:#4f6c5d;line-height:1.5}

    .modal-overlay{display:none;position:fixed;inset:0;background:rgba(3,35,50,.55);z-index:500;align-items:center;justify-content:center;padding:20px}
    .modal-overlay.show{display:flex}
    #agendaConfirmOverlay{z-index:1850!important}
    .record-modal{width:min(980px,96vw);max-height:90vh;overflow:auto;background:#fff;border-radius:14px;box-shadow:0 18px 55px rgba(0,0,0,.25);border:2px solid #65bee8}
    .record-modal-head{position:sticky;top:0;background:#083f5c;color:#fff;padding:15px 18px;display:flex;align-items:center;justify-content:space-between;gap:12px;z-index:2}
    .record-modal-head h3{margin:0;font-size:16px}
    .record-modal-close{border:0;background:rgba(255,255,255,.14);color:#fff;border-radius:8px;padding:8px 11px;font-weight:800;cursor:pointer}
    .record-modal-body{padding:18px}
    .detail-section{margin-bottom:18px}
    .detail-section:last-child{margin-bottom:0}
    .detail-section h4{margin:0 0 10px;color:#083f5c;font-size:13px;border-bottom:1px solid #e4eef2;padding-bottom:7px}
    .detail-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
    .detail-item{background:#f7fbfc;border:1px solid #e0edf1;border-radius:9px;padding:10px;min-height:62px}
    .detail-item .k{font-size:10px;color:#718791;font-weight:800;text-transform:uppercase}
    .detail-item .v{margin-top:5px;color:#173747;font-weight:700;white-space:pre-wrap;word-break:break-word}
    .detail-item.wide{grid-column:span 2}
    .detail-item.full{grid-column:1/-1}
    .btn-view{background:#eef9fc;color:#0b5f7f;border:1px solid #c7e8f2}
    .record-pdf-box{background:#f2fbfe;border:1px solid #c7e8f2;border-radius:10px;padding:12px}
    .record-pdf-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
    .record-pdf-preview{display:none;margin-top:12px;background:#dfe5e8;border:1px solid #cfdde3;border-radius:8px;padding:18px;overflow:auto;-webkit-overflow-scrolling:touch}
    .record-pdf-preview.show{display:block}
    .pdf-preview-note{width:min(900px,100%);margin:0 auto 8px;color:#647a85;font-size:10px;font-weight:800;text-align:right}
    .pdf-paper{width:min(900px,100%);margin:0 auto;background:#fff;box-shadow:0 3px 14px rgba(0,0,0,.16);padding:20px 22px 30px;color:#111;font-family:Arial,Helvetica,sans-serif}
    .pdf-header-image{display:block;width:100%;height:auto;margin:0 0 20px}
    .pdf-title-section{margin:18px 0 8px;font-size:12px;font-weight:800;color:#0b5271}
    .pdf-table{width:100%;border-collapse:collapse;margin:0;font-size:11px;table-layout:fixed}
    .pdf-table td,.pdf-table th{border:1px solid #777;padding:8px 9px;vertical-align:middle;line-height:1.25;word-wrap:break-word}
    .pdf-data-table td:first-child{width:35%;font-weight:700;background:#f1f5f7}
    .pdf-data-table td:last-child{width:65%;background:#fff}
    .pdf-topic-table th{background:#0d5374;color:#fff;text-align:left;font-weight:800}
    .pdf-topic-table th:first-child,.pdf-topic-table td:first-child{width:48px;text-align:center}
    .pdf-topic-table td:first-child{font-weight:700;background:#fff}
    .pdf-signatures{display:grid;grid-template-columns:1fr 1fr;gap:54px;margin-top:78px}
    .pdf-signature{text-align:center;font-size:10px;line-height:1.35;color:#000000}
    .pdf-signature-line{border-top:1px solid #000000;padding-top:7px;font-weight:700;min-height:22px;color:#000000}
    .pdf-signature-role{font-size:9px;margin-top:2px;color:#000000}

    /* TABLET: mantiene el sistema cómodo y evita que todo quede en una sola columna */
    @media (min-width:621px) and (max-width:1100px){
      body{font-size:14px}
      .header{padding:20px 22px 18px}
      .header h1{font-size:24px}
      .nav{padding:10px 12px;overflow-x:auto;-webkit-overflow-scrolling:touch}
      .nav button{flex:0 0 auto;min-height:44px;padding:10px 14px}
      .content{max-width:none;width:100%;padding:18px 16px 34px}
      .panel{padding:16px}
      .grid{gap:12px}
      .col-8,.col-6{grid-column:span 12}
      .col-5,.col-4,.col-3,.col-2{grid-column:span 6}
      .cards{grid-template-columns:repeat(2,minmax(0,1fr))}
      .indicator-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
      .patient-results{grid-template-columns:1fr}
      .profile,.close-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
      .searchbar{flex-wrap:wrap}
      .searchbar .grow{flex:1 1 100%}
      .filters .field{flex:1 1 220px;min-width:0}
      .table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
      .btn{min-height:44px}
      .record-modal{width:calc(100vw - 24px);max-height:94vh}
      .record-modal-body{padding:14px}
      .detail-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
      .detail-item.wide{grid-column:span 2}
      .record-pdf-preview{padding:10px}
      .pdf-paper{padding:14px 16px 24px}
    }

    /* CELULAR: una columna y botones fáciles de tocar */
    @media (max-width:620px){
      .header{padding:18px 14px 16px}
      .header h1{font-size:21px}
      .nav{padding:8px 8px;gap:6px;overflow-x:auto;-webkit-overflow-scrolling:touch}
      .nav button{flex:0 0 auto;min-height:42px;padding:9px 11px;font-size:11px}
      .content{padding:14px 10px 28px}
      .panel{padding:14px;border-radius:10px}
      .wizard-progress{grid-template-columns:1fr;gap:6px}
      .col-8,.col-6,.col-5,.col-4,.col-3,.col-2{grid-column:span 12}
      .cards,.indicator-grid,.patient-results,.profile,.close-summary{grid-template-columns:1fr}
      .searchbar,.actions,.filters{align-items:stretch}
      .searchbar{flex-direction:column}
      .searchbar .grow{width:100%}
      .searchbar .btn,.actions .btn{width:100%}
      .actions{flex-direction:column-reverse}
      .filters .field{width:100%;min-width:0}
      .inline-search{flex-wrap:wrap}
      .inline-search .btn{width:100%}
      .topic-entry{align-items:stretch;flex-direction:column}
      .topic-entry .btn{width:100%}
      .table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}
      table{min-width:700px}
      .modal-overlay{padding:6px}
      .record-modal{width:100%;max-height:96vh;border-radius:10px}
      .record-modal-head{padding:12px}
      .record-modal-body{padding:10px}
      .detail-grid{grid-template-columns:1fr}
      .detail-item.wide,.detail-item.full{grid-column:span 1}
      .record-pdf-actions .btn{width:100%}
      .record-pdf-preview{padding:5px}
      .pdf-paper{padding:8px 8px 18px;min-width:560px}
      .pdf-header-live{grid-template-columns:105px 1fr 170px}
      .pdf-signatures{gap:30px;margin-top:60px}
      .system-toast-overlay{padding:12px}.toast{width:100%}
    }

    .consolidado-selector{width:100%;margin-top:14px;padding:14px;background:#f4fafc;border:1px solid #cfe3eb;border-radius:10px}
    .consolidado-selector-label{font-size:12px;font-weight:800;color:#083f5c;margin-bottom:9px}
    .consolidado-options{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
    .tipo-consolidado{border:1px solid #b8d5df;background:#fff;color:#315665;border-radius:8px;padding:11px 10px;font-weight:800;cursor:pointer;min-height:42px}
    .tipo-consolidado.active{background:#0b5f7f;color:#fff;border-color:#0b5f7f;box-shadow:0 3px 10px rgba(11,95,127,.18)}
    .tipo-consolidado:hover{border-color:#36b7df}
    .consolidado-actions{display:flex;gap:9px;flex-wrap:wrap;margin-top:12px}
    @media(max-width:620px){.consolidado-options{grid-template-columns:1fr}.consolidado-actions{flex-direction:column}.consolidado-actions .btn{width:100%}}
    .system-status{margin-top:10px;display:inline-flex;align-items:center;gap:8px;padding:6px 10px;border-radius:999px;font-size:11px;font-weight:800;letter-spacing:.3px;background:rgba(255,255,255,.12);color:#fff}
    .system-status.ok{background:rgba(38,183,108,.18)}
    .system-status.busy{background:rgba(255,255,255,.16)}
    .system-status.error{background:rgba(220,64,80,.22)}

    /* =========================================================
       NUEVO INICIO - FORMATO INSTITUCIONAL
       ========================================================= */
    body{background:#f5f9fc}

    .app-topbar{
      background:#ffffff;
      border:1px solid #8fd1ef;
      min-height:76px;
      padding:10px 34px;
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:24px;
      position:sticky;
      top:0;
      z-index:100;
      box-shadow:0 4px 14px rgba(8,63,92,.08);
      transition:min-height .2s ease,padding .2s ease
    }

    .brand-area{display:flex;align-items:center;gap:0;min-width:0}
    .inner-header-logo-wrap{display:none!important}
    .inner-header-logo{display:none!important}
    .app-topbar.inner-page{min-height:76px;padding-top:10px;padding-bottom:10px}
    .app-topbar.inner-page .inner-header-logo-wrap{display:none!important}
    .brand-copy{min-width:0}
    .brand-title{color:#12698a;font-size:22px;font-weight:900;letter-spacing:.25px;line-height:1.15;white-space:nowrap}
    .brand-subtitle{display:none!important}
    .app-topbar .system-status{margin-top:6px;padding:0;background:transparent!important;color:#12698a!important;font-size:10px;letter-spacing:.5px}
    .app-topbar .system-status.ok{color:#12698a!important}
    .app-topbar .system-status.busy{color:#12698a!important}
    .app-topbar .system-status.error{color:#12698a!important}
    .app-topbar .nav{padding:0;border:0;background:transparent;position:static;display:flex;align-items:center;justify-content:flex-end;gap:5px;box-shadow:none}
    .app-topbar .nav button{border:0;background:transparent;color:rgba(255,255,255,.9);padding:11px 14px;border-radius:10px;font-size:12px;font-weight:700;cursor:pointer;white-space:nowrap}
    .app-topbar .nav button:hover{color:#fff;background:rgba(255,255,255,.13)}
    .app-topbar .nav button.active{background:#fff;color:#166886;box-shadow:0 4px 12px rgba(4,58,83,.10)}

    .content.home-layout{
      max-width:1260px;
      padding-top:18px
    }

    .home-hero{
      min-height:385px;
      border-radius:22px;
      overflow:hidden;
      position:relative;
      padding:58px 60px;
      color:#fff;
      display:grid;
      grid-template-columns:minmax(0,1.55fr) minmax(280px,.75fr);
      gap:50px;
      align-items:center;
      background:
        radial-gradient(circle at 96% 5%,rgba(255,255,255,.14) 0 14%,transparent 14.2%),
        radial-gradient(circle at 91% 10%,rgba(255,255,255,.08) 0 23%,transparent 23.2%),
        linear-gradient(115deg,#12627f 0%,#2483aa 50%,#52a9d8 100%);
      box-shadow:0 15px 40px rgba(16,87,120,.15)
    }

    .home-hero:after{
      content:'';
      position:absolute;
      right:-65px;
      bottom:-105px;
      width:310px;
      height:310px;
      border:2px solid rgba(255,255,255,.09);
      border-radius:50%;
      pointer-events:none
    }

    .hero-copy,.hero-logo-card{position:relative;z-index:1}

    .hero-eyebrow{
      display:inline-block;
      font-size:11px;
      font-weight:800;
      letter-spacing:1.8px;
      text-transform:uppercase;
      margin-bottom:14px;
      opacity:.94
    }

    .home-hero h1{
      margin:0;
      max-width:720px;
      font-size:44px;
      line-height:1.08;
      letter-spacing:-1px;
      color:#fff
    }

    .home-hero p{
      max-width:690px;
      margin:18px 0 0;
      font-size:15px;
      line-height:1.65;
      color:rgba(255,255,255,.92)
    }

    .hero-buttons{
      display:flex;
      gap:10px;
      flex-wrap:wrap;
      margin-top:23px
    }

    .hero-btn{
      border:0;
      border-radius:9px;
      padding:12px 18px;
      min-height:44px;
      font-weight:800;
      font-size:12px;
      cursor:pointer
    }

    .hero-btn.primary{
      background:#65bee8;
      color:#fff;
      box-shadow:0 6px 15px rgba(1,52,78,.13)
    }

    .hero-btn.secondary{
      background:#fff;
      color:#145a78
    }

    .hero-logo-card{
      min-height:165px;
      border-radius:18px;
      background:rgba(255,255,255,.96);
      display:flex;
      align-items:center;
      justify-content:center;
      padding:26px;
      box-shadow:0 12px 28px rgba(4,58,83,.13)
    }

    .hero-logo-card img{
      width:min(260px,92%);
      max-height:125px;
      object-fit:contain
    }

    .home-stats{
      display:grid;
      grid-template-columns:repeat(5,minmax(0,1fr));
      gap:14px;
      margin:20px 0 22px
    }

    .home-stat{
      min-height:108px;
      background:#fff;
      border:1px solid #8fd8f3;
      border-radius:14px;
      padding:17px 18px;
      box-shadow:0 5px 16px rgba(8,63,92,.045)
    }

    .home-stat-clickable{cursor:pointer;transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease}
    .home-stat-clickable:hover{transform:translateY(-2px);border-color:#65bee8;box-shadow:0 9px 22px rgba(8,63,92,.10)}
    .home-stat-clickable:focus{outline:none;border-color:#36b7df;box-shadow:0 0 0 3px rgba(54,183,223,.16)}
    .home-stat-clickable .home-stat-detail{color:#43819a;font-weight:700}
    .pending-citas-list{display:flex;flex-direction:column;gap:10px}
    .pending-cita-row{display:grid;grid-template-columns:90px minmax(0,1fr) minmax(170px,.8fr) auto;gap:12px;align-items:center;background:#f8fbfd;border:1px solid #dce8ed;border-radius:11px;padding:12px}
    .pending-cita-hora{font-size:17px;font-weight:900;color:#0b5271;text-align:center}
    .pending-cita-paciente{font-weight:800;color:#173747;line-height:1.3}
    .pending-cita-meta{font-size:11px;color:#718791;margin-top:3px;line-height:1.4}
    .pending-cita-doctor{font-size:12px;font-weight:700;color:#3d5e6c;line-height:1.35}
    .pending-citas-empty{padding:30px 16px;text-align:center;color:#718791;font-weight:700}
    @media(max-width:620px){.pending-cita-row{grid-template-columns:72px minmax(0,1fr);}.pending-cita-doctor{grid-column:1/-1}.pending-cita-row .btn{grid-column:1/-1;width:100%}}

    .home-stat-label{
      font-size:10px;
      font-weight:800;
      letter-spacing:.8px;
      color:#667e89;
      text-transform:uppercase
    }

    .home-stat-value{
      margin-top:8px;
      color:#0b5271;
      font-size:29px;
      font-weight:800
    }

    .home-stat-detail{
      margin-top:2px;
      color:#8a9ba3;
      font-size:10px
    }

    .home-module-grid{
      display:grid;
      grid-template-columns:repeat(5,minmax(0,1fr));
      gap:14px
    }

    .home-module{
      min-height:190px;
      background:#fff;
      border:1px solid #8fd8f3;
      border-radius:14px;
      padding:19px;
      box-shadow:0 5px 16px rgba(8,63,92,.045);
      cursor:pointer;
      transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease
    }

    .home-module:hover{
      transform:translateY(-2px);
      border-color:#65bee8;
      box-shadow:0 10px 25px rgba(8,63,92,.08)
    }

    .home-module-icon{
      width:39px;
      height:39px;
      display:flex;
      align-items:center;
      justify-content:center;
      border-radius:10px;
      background:#eaf6fb;
      color:#0b5f7f;
      font-size:20px;
      font-weight:800;
      margin-bottom:17px
    }

    .home-module h3{
      margin:0;
      color:#173747;
      font-size:15px
    }

    .home-module p{
      margin:10px 0 0;
      color:#738892;
      line-height:1.55;
      font-size:12px
    }

    @media (min-width:621px) and (max-width:1100px){
      .app-topbar{padding:10px 18px;align-items:center}
      .app-topbar.inner-page{min-height:98px}
      .inner-header-logo-wrap{width:155px;min-width:155px;height:70px;margin-right:14px}
      .brand-title{font-size:16px}
      .app-topbar .nav{max-width:55%;overflow-x:auto}
      .home-hero{padding:42px 38px;grid-template-columns:1.35fr .75fr;min-height:330px}
      .home-hero h1{font-size:34px}
      .home-stats,.home-module-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    }

    @media (max-width:620px){
      .app-topbar{
        position:static;
        padding:11px 12px 9px;
        display:block
      }
      .app-topbar.inner-page{min-height:0;padding-top:12px}
      .app-topbar.inner-page .brand-area{align-items:center}
      .inner-header-logo-wrap{width:150px;min-width:150px;height:68px;margin:0 12px 8px 0}
      .brand-title{font-size:14px;white-space:normal}
      .brand-subtitle{font-size:8px}
      .app-topbar .nav{
        margin-top:9px;
        width:100%;
        overflow-x:auto;
        justify-content:flex-start
      }
      .app-topbar .nav button{
        flex:0 0 auto;
        min-height:40px;
        font-size:10px;
        padding:9px 10px
      }
      .content.home-layout{padding-top:12px}
      .home-hero{
        min-height:0;
        padding:34px 24px;
        grid-template-columns:1fr;
        gap:28px;
        border-radius:16px
      }
      .home-hero h1{font-size:31px}
      .home-hero p{font-size:13px}
      .hero-logo-card{min-height:130px}
      .home-stats,.home-module-grid{grid-template-columns:1fr}
    }


    .registro-paciente-resultados{
      display:none;
      margin-top:7px;
      border:1px solid #cfe0e7;
      border-radius:9px;
      background:#fff;
      overflow:hidden;
      max-height:220px;
      overflow-y:auto;
      box-shadow:0 7px 18px rgba(8,63,92,.08)
    }
    .registro-paciente-resultados.show{display:block}
    .registro-paciente-opcion{
      padding:10px 12px;
      border-bottom:1px solid #edf2f4;
      cursor:pointer;
      background:#fff
    }
    .registro-paciente-opcion:last-child{border-bottom:0}
    .registro-paciente-opcion:hover{background:#f1f9fc}
    .registro-paciente-opcion .rp-nombre{font-weight:800;color:#083f5c;font-size:12px}
    .registro-paciente-opcion .rp-meta{margin-top:3px;color:#718791;font-size:10px}


    .expediente-alert-overlay{
      display:none;
      position:fixed;
      inset:0;
      background:rgba(6,36,50,.58);
      z-index:1200;
      align-items:center;
      justify-content:center;
      padding:18px
    }

    .expediente-alert-overlay.show{
      display:flex
    }

    .expediente-alert-box{
      width:min(520px,94vw);
      background:#fff;
      border:2px solid #d85b67;
      border-radius:16px;
      box-shadow:0 22px 60px rgba(0,0,0,.28);
      overflow:hidden;
      animation:expedienteAlertIn .18s ease-out
    }

    .expediente-alert-head{
      background:#c84350;
      color:#fff;
      padding:16px 20px;
      font-weight:800;
      font-size:15px;
      letter-spacing:.2px
    }

    .expediente-alert-body{
      padding:22px 22px 12px;
      color:#294954;
      font-size:13px;
      line-height:1.6
    }

    .expediente-alert-icon{
      width:52px;
      height:52px;
      border-radius:50%;
      display:flex;
      align-items:center;
      justify-content:center;
      margin:0 auto 15px;
      background:#fff2f3;
      color:#c84350;
      font-size:26px;
      font-weight:900;
      border:1px solid #f0c8cd
    }

    .expediente-alert-message{
      text-align:center;
      font-weight:700;
      white-space:pre-line
    }

    .expediente-alert-actions{
      display:flex;
      justify-content:center;
      padding:14px 22px 22px
    }

    .expediente-alert-actions .btn{
      min-width:130px
    }

    @keyframes expedienteAlertIn{
      from{opacity:0;transform:translateY(12px) scale(.98)}
      to{opacity:1;transform:translateY(0) scale(1)}
    }


    /* =========================================================
       MENÚ LATERAL IZQUIERDO - mantiene el banner de Inicio
       ========================================================= */
    .app-topbar{position:sticky;top:0;z-index:120}
    .app-shell{display:flex;align-items:flex-start;min-height:calc(100vh - 76px)}
    .tipo-atencion-fija{
      min-height:39px;display:flex;align-items:center;padding:10px 12px;
      border:1px solid #cddce3;border-radius:8px;background:#f1f6f8;
      color:#083f5c;font-weight:800;letter-spacing:.2px;
    }

    .sidebar{
      width:270px;min-width:270px;background:#0b5271;border-right:1px solid #0a4661;
      min-height:calc(100vh - 76px);position:sticky;top:76px;padding:18px 12px 28px;
      box-shadow:4px 0 18px rgba(8,63,92,.07);z-index:70
    }
    .sidebar-caption{padding:3px 13px 11px;color:#eefbff;font-size:11px;font-weight:800;letter-spacing:1.3px}
    .side-nav{display:block!important;padding:0!important;background:transparent!important;border:0!important;position:static!important;overflow:visible!important}
    .side-nav button{width:100%;text-align:left;border:0;cursor:pointer}
    .side-link,.side-group-toggle{
      display:flex;align-items:center;gap:10px;border-radius:9px!important;padding:11px 12px!important;
      background:transparent!important;color:#ffffff!important;font-size:13px!important;font-weight:800!important;margin:2px 0
    }
    .side-link:hover,.side-group-toggle:hover{background:#176b8d!important;color:#fff!important}
    .side-link.active{background:#176b8d!important;color:#fff!important;box-shadow:none!important;border-left:3px solid #65bee8!important}
    .side-icon{width:22px;min-width:22px;text-align:center;font-size:17px}
    .side-chevron{margin-left:auto;font-size:14px;transition:transform .2s ease;color:#ffffff}
    .side-group-toggle:not(.open) .side-chevron{transform:rotate(-90deg)}
    .side-submenu{display:none;margin:3px 0 8px 31px;padding-left:10px;border-left:1px solid rgba(255,255,255,.45)}
    .side-submenu.show{display:block}
    .side-sublink{
      display:block!important;border-radius:8px!important;padding:9px 10px!important;margin:2px 0!important;
      background:transparent!important;color:#f5fdff!important;font-size:12px!important;font-weight:700!important;line-height:1.4
    }
    .side-sublink:hover{background:#176b8d!important;color:#fff!important}
    .side-sublink.active{background:#176b8d!important;color:#fff!important;box-shadow:none!important;border-left:3px solid #65bee8!important}
    .side-logout{
      margin-top:14px!important;
      border-top:1px solid rgba(255,255,255,.28)!important;
      border-radius:0 0 9px 9px!important;
      padding-top:14px!important
    }
    .side-logout:hover{
      background:#176b8d!important;
      color:#fff!important
    }
    body.registro-en-curso .side-sublink[data-page="registro"],
    body.registro-en-curso .side-link,
    body.registro-en-curso .side-sublink[data-page="agenda"],
    body.registro-en-curso .side-sublink[data-page="pacientes"],
    body.registro-en-curso .side-sublink[data-page="consolidado"],
    body.registro-en-curso .side-sublink[data-page="dashboard"],
    body.registro-en-curso .side-sublink[data-page="cuentas"]{
      transition:opacity .15s ease
    }

    .logout-confirm-modal{
      width:min(430px,92vw);
      border:2px solid #65bee8
    }
    .logout-confirm-modal .record-modal-head{
      background:#8fd8f3;
      color:#083f5c;
      justify-content:center
    }
    .logout-confirm-body{
      text-align:center;
      padding:26px 24px 24px
    }
    .logout-confirm-icon{
      width:48px;
      height:48px;
      margin:0 auto 14px;
      border-radius:50%;
      display:flex;
      align-items:center;
      justify-content:center;
      background:#e8f7fd;
      border:2px solid #65bee8;
      color:#0b5f7f;
      font-size:25px;
      font-weight:900
    }
    .logout-confirm-text{
      color:#234e60;
      font-size:16px;
      font-weight:900;
      margin-bottom:22px
    }
    .logout-confirm-actions{
      display:flex;
      justify-content:center;
      gap:10px
    }
    .logout-confirm-actions .btn{
      min-width:105px
    }
    .app-shell > .content{flex:1;min-width:0;width:calc(100% - 270px);max-width:none;margin:0;padding-left:26px;padding-right:26px}
    .app-shell > .content.home-layout{max-width:none;padding-top:18px}
    .home-hero{max-width:1260px;margin-left:auto;margin-right:auto}
    .home-stats,.home-module-grid{max-width:1260px;margin-left:auto;margin-right:auto}

    @media (max-width:900px){
      .sidebar{width:225px;min-width:225px}
      .app-shell > .content{width:calc(100% - 225px);padding-left:14px;padding-right:14px}
      .side-link,.side-group-toggle{font-size:12px!important;padding:10px!important}
      .side-sublink{font-size:11px!important}
      .home-hero{padding:38px 30px;grid-template-columns:1fr}
    }
    @media (max-width:680px){
      .app-shell{display:block}
      .sidebar{position:static;width:100%;min-width:0;min-height:0;padding:9px 10px;border-right:0;border-bottom:1px solid #0a4661}
      .sidebar-caption{display:none}
      .side-nav{display:grid!important;grid-template-columns:1fr!important;gap:2px!important}
      .side-group-toggle,.side-link{min-height:40px!important}
      .side-submenu{margin-left:28px}
      .app-shell > .content{width:100%;padding:12px 10px 28px}
      .home-hero{padding:30px 20px;min-height:0}
    }

  

    /* Selector de tipo de atención desde Inicio */
    .nuevo-registro-overlay{
      display:none;position:fixed;inset:0;background:rgba(6,36,50,.55);z-index:1300;
      align-items:center;justify-content:center;padding:18px
    }
    .nuevo-registro-overlay.show{display:flex}
    .nuevo-registro-box{
      width:min(620px,95vw);background:#fff;border-radius:18px;overflow:hidden;
      box-shadow:0 24px 70px rgba(0,0,0,.28);animation:expedienteAlertIn .18s ease-out
    }
    .nuevo-registro-head{
      padding:18px 22px;background:linear-gradient(110deg,#197596,#4aa6d2);color:#fff
    }
    .nuevo-registro-head h3{margin:0;font-size:18px}
    .nuevo-registro-head p{margin:5px 0 0;font-size:12px;opacity:.9}
    .nuevo-registro-body{padding:20px;display:grid;gap:12px}
    .nuevo-registro-opcion{
      width:100%;border:1px solid #d6e4ea;background:#fff;border-radius:13px;padding:16px 17px;
      display:flex;align-items:center;gap:14px;text-align:left;cursor:pointer;color:#123f53;
      transition:.15s ease;font-family:inherit
    }
    .nuevo-registro-opcion:hover{border-color:#45a9cf;background:#f2fbff;transform:translateY(-1px)}
    .nuevo-registro-opcion .nr-icon{
      width:42px;height:42px;border-radius:11px;background:#e9f6fb;display:flex;align-items:center;
      justify-content:center;font-size:20px;font-weight:900;color:#08799e;flex:0 0 42px
    }
    .nuevo-registro-opcion strong{display:block;font-size:14px;margin-bottom:3px}
    .nuevo-registro-opcion small{display:block;color:#67818d;font-size:11px;line-height:1.35}
    .nuevo-registro-actions{padding:0 20px 20px;display:flex;justify-content:flex-end}
    @media(max-width:620px){.nuevo-registro-body{padding:14px}.nuevo-registro-opcion{padding:14px}}



    /* ================= AGENDA DE CONSULTAS ================= */
    .agenda-toolbar{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;margin-top:24px}
    .agenda-toolbar-left{display:flex;align-items:flex-end;gap:9px;flex-wrap:wrap;min-width:0}
    .agenda-month-field{min-width:210px}
    .agenda-nav-btn{min-width:46px;font-size:24px;line-height:1;padding:9px 12px}
    .agenda-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin:14px 0}
    .agenda-stat{background:#fff;border:1px solid #dbe7ec;border-radius:14px;padding:13px 16px;display:flex;align-items:center;justify-content:space-between;gap:12px}
    .agenda-stat span{font-size:11px;font-weight:800;color:#607681;letter-spacing:.35px}
    .agenda-stat strong{font-size:24px;color:#0b536c}
    .agenda-stat-clickable{cursor:pointer;transition:border-color .15s ease,background .15s ease,transform .15s ease}
    .agenda-stat.programada{border:2px solid #1d92ba}
    .agenda-stat.reprogramada{border:2px solid #d49a34}
    .agenda-stat.atendida{border:2px solid #4b9d7a}
    .agenda-stat.no-asistio{border:2px solid #c94f4f}
    .agenda-stat.cancelada{border:2px solid #a9b1b6}
    .agenda-stat-clickable:focus{outline:3px solid rgba(39,138,177,.20);outline-offset:2px;border-color:#86c6dc}
    @media(hover:hover) and (pointer:fine){.agenda-stat-clickable:hover{background:#f5fbfd;border-color:#9fcfdf;transform:translateY(-1px)}}
    .agenda-calendar-panel{padding:18px 16px 14px;overflow:hidden;background:#fff;border-radius:18px}
    .agenda-week-head{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));background:transparent;border:0;gap:8px;margin-bottom:8px}
    .agenda-week-head>div{text-align:center;padding:8px 5px;font-size:11px;font-weight:900;color:#607681;letter-spacing:.7px}
    .agenda-calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));background:transparent;gap:8px}
    .agenda-day{
      background:#fff;min-height:145px;padding:10px;border:1px solid #dbe5ea;border-radius:14px;
      cursor:pointer;min-width:0;transition:border-color .15s ease,background .15s ease,transform .15s ease;
      display:flex;flex-direction:column
    }
    @media(hover:hover) and (pointer:fine){
      .agenda-day:hover{background:#fbfdfe;border-color:#9ed4e8;transform:translateY(-1px)}
    }
    .agenda-day.outside{background:#f8fafb;color:#a0adb3;border-color:#dbe5ea}
    .agenda-day.bookable{border:2px solid #65bee8}
    .agenda-day.full{border:1px solid #cfd9de;background:#f5f7f8;cursor:not-allowed}
    .agenda-day.today{border:2px solid #1598c5}
    .agenda-day.past{background:#f8fafb;cursor:not-allowed;border-color:#dbe5ea}
    .agenda-day.past .agenda-day-number{color:#9aa8af}
    .agenda-day-number{
      display:flex;align-items:center;justify-content:center;position:relative;
      font-weight:900;color:#173f50;margin:0 0 10px;min-height:28px;font-size:14px
    }
    .agenda-day.today .agenda-day-number>span:first-child{
      display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;
      background:#0b6e90;color:#fff
    }
    .agenda-day.outside .agenda-day-number{color:#9ba9b0}
    .agenda-day-count{
      position:absolute;right:0;top:50%;transform:translateY(-50%);
      font-size:9px;background:#edf5f8;color:#17637e;padding:2px 6px;border-radius:999px
    }
    .agenda-events{display:flex;flex-direction:column;gap:5px;flex:1;min-height:0}
    .agenda-empty-pill{
      margin-top:auto;background:#eef3f6;color:#6f8089;border-radius:8px;padding:8px 6px;
      text-align:center;font-size:9px;font-weight:900;letter-spacing:.2px
    }
    .agenda-event{
      width:100%;border:1px solid #84cce6;background:#eef8fb;border-radius:8px;padding:6px 7px;
      text-align:left;cursor:pointer;color:#163c4b;min-width:0
    }
    .agenda-event.atendida{border-color:#72b996;background:#eef8f3}
    .agenda-event.reprogramada{border-color:#e3b75f;background:#fff8e8}
    .agenda-event.no-asistio{border-color:#dc7777;background:#fff0f0}
    .agenda-event.cancelada{border-color:#b8bec2;background:#f1f3f4;opacity:.82;text-decoration:none}
    .agenda-event.ocupado{border-color:#65bee8;background:#eef9fd;cursor:default}
    .agenda-event.ocupado .agenda-event-patient{color:#17637e}
    .agenda-event-time{font-size:10px;font-weight:900}
    .agenda-event-patient{font-size:10px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
    .agenda-event-doctor{font-size:9px;color:#6c7f88;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:1px}
    .agenda-event-status{
      display:inline-block;margin-top:4px;padding:2px 6px;border-radius:999px;background:#d7eef7;color:#17637e;
      font-size:8px;font-weight:900;letter-spacing:.25px
    }
    .agenda-event.atendida .agenda-event-status{background:#dcefe4;color:#267353}
    .agenda-event.reprogramada .agenda-event-status{background:#f7e8bf;color:#8c6418}
    .agenda-event.no-asistio .agenda-event-status{background:#f6dddd;color:#934b4b}
    .agenda-event.cancelada .agenda-event-status{background:#e1e4e6;color:#737c81}
    .agenda-loading{grid-column:1/-1;background:#fff;padding:28px;text-align:center;color:#6b7d85;font-weight:700}
    .agenda-legend{display:flex;gap:16px;align-items:center;flex-wrap:wrap;padding:14px 2px 0;border-top:0;font-size:10px;font-weight:800;color:#667982}
    .agenda-dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:5px;background:#1d92ba}
    .agenda-dot.atendida{background:#4b9d7a}.agenda-dot.cancelada{background:#a9b1b6}.agenda-help{margin-left:auto;font-weight:600}
    .agenda-form-modal{width:min(1080px,96vw)}
    .agenda-cupo-field select{width:100%;min-width:0;font-size:15px;font-weight:800;color:#234e60;padding-right:38px}
    .agenda-detail-modal{width:min(650px,94vw)}
    .agenda-detail-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
    .agenda-detail-item{border:1px solid #dfe8ec;background:#f8fbfc;border-radius:10px;padding:10px 12px;min-width:0}
    .agenda-detail-item.wide{grid-column:1/-1}
    .agenda-detail-item .k{font-size:10px;color:#71838b;font-weight:800;margin-bottom:4px}
    .agenda-detail-item .v{font-size:13px;color:#183e4d;font-weight:800;word-break:break-word}
    .agenda-status{display:inline-flex;padding:4px 9px;border-radius:999px;font-size:10px;font-weight:900;background:#e7f5fa;color:#126785}
    .agenda-status.atendida{background:#eaf6ef;color:#37785e}.agenda-status.reprogramada{background:#fff3d8;color:#8a651f}.agenda-status.no-asistio{background:#fdecec;color:#8a4c4c}.agenda-status.cancelada{background:#eef0f1;color:#69757b}
    .agenda-reprogram-panel{display:none;margin-top:14px;padding:14px;border:1px solid #dbe7ec;border-radius:12px;background:#f8fbfc}.agenda-reprogram-panel.show{display:block}.agenda-reprogram-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.agenda-reprogram-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin-top:10px}.agenda-cancel-panel{display:none;margin-top:14px;padding:14px;border:1px solid #ecd7d7;border-radius:12px;background:#fffafa}.agenda-cancel-panel.show{display:block}.agenda-cancel-panel textarea{width:100%;min-height:86px;resize:vertical}.agenda-cancel-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin-top:10px}.alfTemaOtroWrap{display:none;flex:1 1 100%;width:100%;margin-top:3px}.alfTemaOtroWrap.show{display:block}.alfTemaOtroWrap label{display:block;margin-bottom:5px}.alfTemaOtroWrap input{display:block !important;width:100%;min-height:44px}#alfMotivoNoTextarea,#alfMotivoNoTexto{width:100%;min-height:120px;resize:vertical}
    @media(max-width:900px){.agenda-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.agenda-calendar-panel{overflow-x:auto}.agenda-week-head,.agenda-calendar{min-width:760px}.agenda-day{min-height:125px}}
    @media(max-width:620px){.agenda-toolbar{align-items:stretch;flex-direction:column}.agenda-toolbar-left{align-items:stretch}.agenda-month-field{min-width:0;flex:1}.agenda-stats{grid-template-columns:1fr 1fr}.agenda-detail-grid{grid-template-columns:1fr}.agenda-detail-item.wide{grid-column:auto}.agenda-reprogram-grid{grid-template-columns:1fr}}



    /* ================= FONDO PEDIÁTRICO EN TODO EL SISTEMA ================= */
    body{
      background:linear-gradient(135deg,#116b8e 0%,#28a9cf 100%);
    }
    body::before{
      content:'';
      position:fixed;
      inset:0;
      pointer-events:none;
      z-index:0;
      opacity:.11;
      background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M25 35h22M36 24v22'/%3E%3Cpath d='M117 29l4 9 10 1-8 7 2 10-8-5-9 5 2-10-8-7 11-1z'/%3E%3Cpath d='M35 116c0-12 15-17 23-7 8-10 23-5 23 7 0 13-23 28-23 28s-23-15-23-28z'/%3E%3Ccircle cx='131' cy='122' r='17'/%3E%3Cpath d='M131 105v-13M124 92h14M114 132c-9 13-4 26 8 26 9 0 12-7 12-14'/%3E%3Cpath d='M73 65c8-8 20-8 28 0M78 72c5-5 13-5 18 0'/%3E%3C/g%3E%3C/svg%3E");
      background-size:180px 180px;
      background-repeat:repeat;
    }
    #appTopbar,.app-shell{position:relative;z-index:1}
    .app-shell{
      background:transparent;
    }
    .app-shell > .content{
      position:relative;
      background:rgba(255,255,255,.10);
      border-left:1px solid rgba(255,255,255,.12);
      backdrop-filter:saturate(110%);
    }
    .sidebar{
      background:linear-gradient(180deg,rgba(17,107,142,.96) 0%,rgba(40,169,207,.94) 100%);
      border-right:1px solid rgba(255,255,255,.18);
      position:sticky;
      overflow:hidden;
    }
    .sidebar::before{
      content:'';
      position:absolute;
      inset:0;
      pointer-events:none;
      opacity:.12;
      background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M25 35h22M36 24v22'/%3E%3Cpath d='M117 29l4 9 10 1-8 7 2 10-8-5-9 5 2-10-8-7 11-1z'/%3E%3Cpath d='M35 116c0-12 15-17 23-7 8-10 23-5 23 7 0 13-23 28-23 28s-23-15-23-28z'/%3E%3Ccircle cx='131' cy='122' r='17'/%3E%3Cpath d='M131 105v-13M124 92h14M114 132c-9 13-4 26 8 26 9 0 12-7 12-14'/%3E%3Cpath d='M73 65c8-8 20-8 28 0M78 72c5-5 13-5 18 0'/%3E%3C/g%3E%3C/svg%3E");
      background-size:180px 180px;
      background-repeat:repeat;
    }
    .sidebar > *{
      position:relative;
      z-index:1;
    }
    #page-inicio{
      position:relative;
    }
    #page-inicio::before{
      content:'';
      position:absolute;
      inset:0;
      pointer-events:none;
      opacity:.05;
      background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%230d6d90' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M25 35h22M36 24v22'/%3E%3Cpath d='M117 29l4 9 10 1-8 7 2 10-8-5-9 5 2-10-8-7 11-1z'/%3E%3Cpath d='M35 116c0-12 15-17 23-7 8-10 23-5 23 7 0 13-23 28-23 28s-23-15-23-28z'/%3E%3Ccircle cx='131' cy='122' r='17'/%3E%3Cpath d='M131 105v-13M124 92h14M114 132c-9 13-4 26 8 26 9 0 12-7 12-14'/%3E%3Cpath d='M73 65c8-8 20-8 28 0M78 72c5-5 13-5 18 0'/%3E%3C/g%3E%3C/svg%3E");
      background-size:180px 180px;
      background-repeat:repeat;
    }
    #page-inicio > *{
      position:relative;
      z-index:1;
    }

    /* ================= TEXTOS SOBRE FONDO PEDIÁTRICO ================= */
    .page-title h2,
    .page-title p,
    .page > .hint,
    .page > .step-note,
    #page-pacientes .page-title h2,
    #page-pacientes .page-title p,
    #page-consolidado .page-title h2,
    #page-consolidado .page-title p,
    #page-dashboard .page-title h2,
    #page-dashboard .page-title p,
    #page-registro .page-title h2,
    #page-registro .page-title p,
    #page-agenda .page-title h2,
    #page-agenda .page-title p{
      color:#ffffff !important;
      text-shadow:0 1px 2px rgba(0,0,0,.10);
    }
    #page-registro .steps .step,
    #page-pacientes .steps .step,
    #page-consolidado .steps .step,
    #page-dashboard .steps .step,
    #page-agenda .steps .step{
      color:#0b5271;
    }


    /* ================= ACCESO / SESIÓN ================= */
    body.auth-locked #appTopbar,body.auth-locked .app-shell{display:none!important}
    #loginView{
      display:none;
      min-height:100vh;
      padding:34px 20px 56px;
      position:relative;
      overflow:hidden;
      background:linear-gradient(135deg,#116b8e 0%,#28a9cf 100%)
    }
    #loginView::before{
      content:'';
      position:absolute;
      inset:0;
      pointer-events:none;
      opacity:.16;
      background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M25 35h22M36 24v22'/%3E%3Cpath d='M117 29l4 9 10 1-8 7 2 10-8-5-9 5 2-10-8-7 11-1z'/%3E%3Cpath d='M35 116c0-12 15-17 23-7 8-10 23-5 23 7 0 13-23 28-23 28s-23-15-23-28z'/%3E%3Ccircle cx='131' cy='122' r='17'/%3E%3Cpath d='M131 105v-13M124 92h14M114 132c-9 13-4 26 8 26 9 0 12-7 12-14'/%3E%3Cpath d='M73 65c8-8 20-8 28 0M78 72c5-5 13-5 18 0'/%3E%3C/g%3E%3C/svg%3E");
      background-size:180px 180px;
      background-repeat:repeat
    }
    body.auth-locked #loginView{display:block}
    .login-wrap{width:min(1180px,100%);margin:0 auto;position:relative;z-index:1}
    .login-banner{
      display:grid;
      grid-template-columns:minmax(0,1fr) 300px;
      gap:40px;
      align-items:center;
      min-height:300px;
      padding:48px 54px;
      border-radius:26px;
      background:linear-gradient(135deg,rgba(17,107,142,.94),rgba(40,169,207,.94));
      color:#fff;
      border:1px solid rgba(255,255,255,.12);
      box-shadow:0 18px 40px rgba(5,53,75,.22)
    }
    .login-eyebrow{font-size:12px;font-weight:900;letter-spacing:1.8px;opacity:.95;margin-bottom:10px}
    .login-banner h1{margin:0;font-size:clamp(32px,4.5vw,54px);line-height:1.06;letter-spacing:-.6px;max-width:760px}
    .login-banner p{margin:18px 0 0;max-width:720px;font-size:15px;line-height:1.65;opacity:.96}
    .login-logo{background:#fff;border-radius:22px;min-height:220px;display:flex;align-items:center;justify-content:center;padding:24px;box-shadow:0 12px 28px rgba(4,58,83,.14)}
    .login-logo img{width:min(315px,100%);max-height:180px;object-fit:contain}
    .login-card{width:min(500px,100%);margin:28px auto 0;background:#fff;border:1px solid #dce8ed;border-radius:18px;padding:28px;box-shadow:0 10px 28px rgba(20,68,87,.08)}
    .login-card h2{margin:0 0 5px;color:#17485b;font-size:20px}.login-card>p{margin:0 0 22px;color:#6c8089;font-size:12px}
    .login-field{margin-bottom:14px}.login-field label{display:block;margin-bottom:6px;font-size:11px;font-weight:900;color:#385765;letter-spacing:.4px}
    .login-field input{width:100%;min-height:48px;border:1px solid #cedee5;border-radius:10px;padding:10px 12px;font-size:16px;background:#fff}
    .login-field input:focus{outline:3px solid rgba(38,165,205,.15);border-color:#48a9c7}
    .login-button{width:100%;min-height:48px;border:0;border-radius:10px;background:#1689b0;color:#fff;font-weight:900;cursor:pointer;font-size:13px;letter-spacing:.3px}.login-button:disabled{opacity:.6;cursor:wait}
    .login-error{display:none;margin-top:13px;padding:10px 12px;border-radius:9px;background:#fff0f0;border:1px solid #efcccc;color:#9b4444;font-size:12px;font-weight:800}.login-error.show{display:block}
    .session-box{margin-left:auto;display:flex;align-items:center;gap:10px;color:#12698a}.session-copy{text-align:right;line-height:1.15}.session-user{font-size:12px;font-weight:900;color:#12698a}.session-role{font-size:9px;color:#4f8298;margin-top:3px;font-weight:800}.logout-btn{border:1px solid #8fd1ef;background:#fff;color:#12698a;border-radius:8px;padding:8px 11px;font-size:10px;font-weight:900;cursor:pointer}.logout-btn:hover{background:#eaf7fc}
    .restricted-hidden{display:none!important}
    .password-modal{width:min(480px,94vw)}
    .password-help{
      margin:0 0 15px;
      padding:10px 12px;
      border:1px solid #bfe5f3;
      border-radius:9px;
      background:#eef9fd;
      color:#315968;
      font-size:11px;
      font-weight:700;
      line-height:1.45
    }
    .password-field{margin-bottom:13px}
    .password-field label{
      display:block;
      margin-bottom:6px;
      font-size:11px;
      font-weight:900;
      color:#385765
    }
    .password-field input{
      width:100%;
      min-height:44px;
      border:1px solid #cddce3;
      border-radius:8px;
      padding:10px 11px;
      background:#fff;
      color:#173747;
      text-transform:none!important
    }

    input[type="password"]{
      text-transform:none!important
    }

    #nuevoUsuarioPassword,
    #nuevoUsuarioPassword2,
    #passwordActual,
    #passwordNueva,
    #passwordConfirmar,
    #loginPassword{
      text-transform:none!important;
      font-variant:normal!important
    }
    .password-actions{
      display:flex;
      justify-content:flex-end;
      gap:9px;
      margin-top:18px
    }
    .cuentas-actions{
      display:flex;
      gap:10px;
      flex-wrap:wrap;
      margin-bottom:6px
    }
    .cuentas-actions .btn{min-width:190px}
    .cuentas-table{min-width:1080px}
    .cuenta-status{
      display:inline-block;
      padding:5px 9px;
      border-radius:999px;
      font-size:10px;
      font-weight:900
    }
    .cuenta-status.libre{background:#e7f6ed;color:#347357}
    .cuenta-status.codigo{background:#fff2d8;color:#8b641d}
    .codigo-cuenta-box{
      display:none;
      margin-top:18px;
      padding:18px;
      border:2px solid #65bee8;
      border-radius:12px;
      background:#eef9fd;
      text-align:center
    }
    .codigo-cuenta-box.show{display:block}
    .codigo-cuenta-valor{
      font-size:36px;
      font-weight:900;
      letter-spacing:7px;
      color:#0b5271;
      margin:8px 0
    }
    .codigo-cuenta-info{
      font-size:11px;
      font-weight:800;
      color:#4a6e7d
    }

    .doctor-session-note{display:none;margin-top:6px;font-size:10px;color:#5d7782;font-weight:800}.doctor-session-note.show{display:block}
    .home-welcome{margin:0 0 10px;font-size:21px;font-weight:900;color:#fff;letter-spacing:.2px}.home-welcome span{color:#fff}
    @media(max-width:700px){
      #loginView{padding:18px 12px 34px}
      .login-banner{grid-template-columns:1fr;padding:30px 24px;gap:24px;min-height:0;border-radius:20px}
      .login-banner h1{font-size:clamp(29px,9vw,40px)}
      .login-logo{min-height:170px;padding:20px}
      .login-logo img{max-height:140px}
      .session-copy{display:none}.logout-btn{padding:8px}.login-card{padding:22px}
    }

  
    .registro-guardando-overlay{
      display:none;
      position:fixed;
      inset:0;
      z-index:1900;
      background:rgba(5,45,62,.48);
      align-items:center;
      justify-content:center;
      padding:20px;
      cursor:wait
    }
    .registro-guardando-overlay.show{display:flex}
    .registro-guardando-box{
      width:min(430px,calc(100vw - 34px));
      background:#fff;
      border:2px solid #65bee8;
      border-radius:16px;
      box-shadow:0 20px 55px rgba(3,35,50,.25);
      overflow:hidden;
      text-align:center
    }
    .registro-guardando-head{
      background:#8fd8f3;
      color:#083f5c;
      padding:15px 18px;
      font-size:16px;
      font-weight:900;
      letter-spacing:.3px
    }
    .registro-guardando-body{
      padding:24px 22px 26px;
      color:#315968;
      font-size:13px;
      font-weight:800;
      line-height:1.5
    }
    .registro-spinner{
      width:38px;
      height:38px;
      margin:0 auto 15px;
      border:4px solid #d9f1fa;
      border-top-color:#1598c5;
      border-radius:50%;
      animation:registroSpin .75s linear infinite
    }
    @keyframes registroSpin{to{transform:rotate(360deg)}}

  

/* ===== ADAPTACIÓN SUPABASE / CLOUDFLARE - CONSERVA PALETA ORIGINAL ===== */
.hidden{display:none!important}.readonly-box{min-height:40px;display:flex;align-items:center;padding:10px 11px;border:1px solid #cddce3;border-radius:8px;background:#f1f6f8;color:#083f5c;font-weight:800}.family-copy{background:#eef9fd;border:1px solid #8fd8f3;border-radius:10px;padding:13px;margin-bottom:12px}.family-copy strong{color:#083f5c}.history-list{display:flex;flex-direction:column;gap:12px}.history-card{background:#fff;border:1px solid #8fd8f3;border-radius:12px;padding:15px;box-shadow:0 8px 24px rgba(8,63,92,.06)}.history-head{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap}.history-title{font-weight:900;color:#083f5c}.history-meta{font-size:11px;color:#718791;margin-top:4px}.history-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.result-list{display:flex;flex-direction:column;gap:10px;margin-top:14px}.result-row{background:#fff;border:1px solid #d8e5eb;border-radius:10px;padding:12px;display:flex;justify-content:space-between;gap:12px;align-items:center}.result-row strong{color:#083f5c}.result-row small{display:block;color:#718791;margin-top:3px}.muted-panel{background:#f7fbfc;border:1px solid #e0edf1;border-radius:10px;padding:13px;color:#617984}.account-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.menu-role-hidden{display:none!important}.pdf-frame{width:100%;height:70vh;border:0;background:#fff}.toast-message-body{white-space:pre-line}.consolidado-cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:14px 0}.consolidado-card{background:#fff;border:1px solid #8fd8f3;border-radius:11px;padding:15px}.consolidado-card span{font-size:10px;font-weight:800;color:#718791}.consolidado-card strong{display:block;margin-top:6px;font-size:26px;color:#083f5c}.cie10-dropdown{z-index:5000}.app-shell>.content{min-height:calc(100vh - 76px)}
@media(max-width:800px){.account-grid,.consolidado-cards{grid-template-columns:1fr 1fr}}@media(max-width:620px){.account-grid,.consolidado-cards{grid-template-columns:1fr}}
