/*
 * Meki | Produção médica — formulário responsivo iPhone / Android.
 * Somente Novo/Editar lançamento até 760px. Sem mudar inputs, lógica ou desktop.
 */
@media screen and (max-width:760px){
  /* A janela deve ficar acima da navegação fixa inferior, não atrás dela. */
  body .modal.show:has(> .modalbox.production-modal){
    z-index:1000!important;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:max(10px,env(safe-area-inset-top,0px)) 10px
      max(10px,env(safe-area-inset-bottom,0px))!important;
    overflow:hidden;
    background:rgba(2,10,23,.84)!important;
  }
  body .modal.show > .modalbox.production-modal{
    display:block;
    box-sizing:border-box;
    flex:0 1 auto;
    width:100%!important;
    min-width:0!important;
    max-width:560px!important;
    max-height:calc(100dvh - 24px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px))!important;
    margin:0!important;
    padding:0 14px 14px!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior-y:contain;
    -webkit-overflow-scrolling:touch;
    border:1px solid #2c627f!important;
    border-radius:18px!important;
    background:linear-gradient(155deg,#122f49,#0c2036)!important;
    box-shadow:0 18px 55px rgba(0,0,0,.6)!important;
    color:#edf8ff!important;
    scrollbar-width:thin;
  }
  body .modalbox.production-modal,
  body .modalbox.production-modal *{
    box-sizing:border-box;
    min-width:0;
  }
  body .modalbox.production-modal .modalhead{
    display:flex;
    position:sticky;
    top:0;
    z-index:2;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    margin:0 -14px 13px;
    padding:17px 14px 12px;
    background:#122f49;
    border-bottom:1px solid #2a5371;
    border-radius:17px 17px 0 0;
  }
  body .modalbox.production-modal .modalhead > div{
    flex:1;
    min-width:0;
  }
  body .modalbox.production-modal .modalhead h2{
    font-size:clamp(21px,6.2vw,25px)!important;
    font-weight:850;
    line-height:1.17;
    margin:0 0 6px;
    color:#f7fcff;
    overflow-wrap:anywhere;
  }
  body .modalbox.production-modal .modalhead .sub{
    font-size:12px!important;
    line-height:1.45;
    color:#acc9dc!important;
    margin:0;
  }
  body .modalbox.production-modal .modalhead .close{
    display:grid;
    place-items:center;
    flex:0 0 40px;
    min-width:40px;
    width:40px;
    height:40px;
    padding:0;
    border:1px solid #396884;
    background:#1a4059;
    color:#e9f6ff;
    font-size:21px;
    border-radius:50%;
  }
  body .modalbox.production-modal .production-layout{
    display:flex;
    flex-direction:column;
    gap:12px!important;
    width:100%;
    max-width:100%;
    min-width:0;
  }
  body .modalbox.production-modal .production-section{
    display:block;
    width:100%;
    max-width:100%;
    min-width:0;
    padding:13px!important;
    border:1px solid #2b5674!important;
    border-radius:14px!important;
    background:linear-gradient(140deg,#15334d,#10283f)!important;
  }
  body .modalbox.production-modal .production-section h3{
    font-size:16px!important;
    line-height:1.25;
    margin:0 0 5px;
    color:#f5faff!important;
    overflow-wrap:anywhere;
  }
  body .modalbox.production-modal .production-section .sub{
    font-size:11px!important;
    line-height:1.42;
    margin:0 0 12px!important;
    color:#b1cbdd!important;
  }
  body .modalbox.production-modal .production-grid{
    display:grid;
    grid-template-columns:minmax(0,1fr)!important;
    gap:12px!important;
    width:100%;
    max-width:100%;
    min-width:0;
  }
  body .modalbox.production-modal .production-field,
  body .modalbox.production-modal .production-field.full{
    display:flex;
    flex-direction:column;
    grid-column:1/-1!important;
    width:100%;
    max-width:100%;
    min-width:0!important;
    gap:6px;
  }
  body .modalbox.production-modal .production-field label{
    display:block;
    margin:0;
    font-size:12px!important;
    line-height:1.3;
    font-weight:760;
    color:#d6eaf8!important;
  }
  body .modalbox.production-modal .production-field :is(input,select){
    display:block;
    flex:none;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:44px!important;
    min-height:44px!important;
    padding:8px 12px!important;
    margin:0;
    border:1px solid #3c6786!important;
    border-radius:11px!important;
    background:#0a1e31!important;
    color:#f5faff!important;
    color-scheme:dark;
    box-shadow:none!important;
    font-size:16px!important; /* impede zoom involuntário do Safari */
    line-height:1.3;
  }
  body .modalbox.production-modal .production-field select{
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis;
    padding-right:23px!important;
    -webkit-appearance:menulist;
    appearance:auto;
  }
  body .modalbox.production-modal .production-field select option{
    max-width:100%;
    color:#f5faff;
    background:#0a1e31;
  }
  body .modalbox.production-modal .production-field input[type="date"]{
    min-width:0!important;
    text-align:left!important;
    -webkit-appearance:none;
    appearance:none;
  }
  body .modalbox.production-modal .production-field input[type="date"]::-webkit-date-and-time-value{
    text-align:left;
    min-width:0;
  }
  body .modalbox.production-modal .production-field :is(input,select):focus-visible{
    outline:2px solid #38f0dc;
    outline-offset:1px;
  }
  body .modalbox.production-modal .production-result-card{
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
    min-width:0;
    width:100%;
    padding:13px!important;
    border:1px solid #207e86;
    border-radius:14px;
    background:linear-gradient(130deg,#124449,#102e43);
  }
  body .modalbox.production-modal .production-result-card span{
    font-size:11px!important;
    line-height:1.45;
    color:#b7dce4;
  }
  body .modalbox.production-modal .production-result-card b{
    font-size:clamp(22px,6vw,28px)!important;
    line-height:1.2;
    font-variant-numeric:tabular-nums;
    overflow-wrap:anywhere;
  }
  body .modalbox.production-modal .production-actions{
    position:sticky;
    bottom:0;
    z-index:1;
    display:flex;
    width:100%;
    align-items:center;
    justify-content:stretch;
    padding:11px 0 5px;
    margin-top:-3px;
    background:linear-gradient(180deg,rgba(12,32,54,.90),#0c2036 36%);
  }
  body .modalbox.production-modal .production-actions .btn{
    display:flex;
    flex:1 1 auto;
    justify-content:center;
    align-items:center;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    height:45px!important;
    min-height:45px!important;
    padding:10px 14px!important;
    border:1px solid #53f2e3!important;
    border-radius:12px!important;
    background:linear-gradient(110deg,#35edd8,#25c7d7)!important;
    color:#062e3b!important;
    font-size:13px!important;
    font-weight:850;
    white-space:normal;
  }
}
@media screen and (max-width:350px){
  body .modal.show > .modalbox.production-modal{padding:0 10px 10px!important}
  body .modalbox.production-modal .modalhead{margin:0 -10px 12px;padding:14px 10px 11px}
  body .modalbox.production-modal .production-section{padding:11px!important}
  body .modalbox.production-modal .modalhead h2{font-size:20px!important}
}
