/* Editing follows the same calm surfaces and readable cards as record details. */
@media screen{
  .ov-modal:has(form.ov-edit-form){max-width:900px;border-radius:22px;background:#f8fafc;box-shadow:0 28px 90px #10244138}
  .ov-modal.wide:has(form.ov-edit-form){max-width:1120px}
  /* Quick-create keeps the clinical draft hidden in place; size only the visible editor. */
  .ov-modal:has(:is(.ov-inline-client,.ov-inline-reference)>form.ov-edit-form:not([hidden])),
  .ov-modal:has(#receta-form[hidden]):has(:is(.ov-inline-client,.ov-inline-reference)>form.ov-edit-form:not([hidden])){max-width:900px}
  .ov-modal:has(.ov-inline-reference>form.ov-edit-form:not([hidden]):is([data-product-edit-form],:has([data-product-details]))),
  .ov-modal:has(#receta-form[hidden]):has(.ov-inline-reference>form.ov-edit-form:not([hidden]):is([data-product-edit-form],:has([data-product-details]))){max-width:1120px}
  .ov-modal:has(form.ov-edit-form) .ov-modal-header{padding:22px 28px;background:#fff;border-bottom-color:var(--ov-line);z-index:5}
  .ov-modal:has(form.ov-edit-form) .ov-modal-header h2{font-size:22px;letter-spacing:-.4px;line-height:1.35}
  .ov-modal:has(form.ov-edit-form) .ov-modal-header p{margin-top:7px;max-width:760px;font-size:13px;line-height:1.65}
  .ov-modal:has(form.ov-edit-form) .ov-modal-body{padding:26px 28px 0}
  form.ov-edit-form{min-width:0;color:var(--ov-text)}
  .ov-edit-form>.ov-form-grid,.ov-edit-form>.ov-form-stack,.ov-edit-form>fieldset.ov-form-section,.ov-edit-form>fieldset.ov-company-settings-section{min-width:0;margin:0 0 24px;padding:22px;border:1px solid var(--ov-line);border-radius:14px;background:#fff}
  .ov-edit-form>.ov-form-grid:last-of-type{margin-bottom:0}
  .ov-edit-form .ov-form-grid{gap:22px 24px;align-items:start}
  .ov-edit-form .ov-field{gap:9px;font-size:14px;font-weight:500;line-height:1.5;min-width:0}
  .ov-edit-form .ov-field>small{font-size:12px;line-height:1.6;font-weight:400;margin-top:0}
  .ov-edit-form .ov-field>:is(input:not([type="checkbox"],[type="radio"],[type="hidden"],[type="color"],[type="file"]),select,textarea){min-height:50px;padding:13px 14px;border-radius:10px;font-size:15px;line-height:1.45}
  .ov-edit-form .ov-field>:is(input:not([type="checkbox"],[type="radio"],[type="hidden"],[type="color"],[type="file"]),select,textarea):focus{padding:12.2px 13.2px}
  .ov-edit-form .ov-input-action>input{min-height:50px;padding:13px 14px;font-size:15px;line-height:1.45}
  .ov-edit-form .ov-input-action>input:focus{padding:12.2px 13.2px}
  .ov-edit-form .ov-field>textarea{min-height:106px;line-height:1.65;resize:vertical}
  .ov-edit-form .ov-combobox-control{min-height:50px;border-radius:10px}
  .ov-edit-form .ov-combobox-control>.ov-combobox-input,.ov-edit-form .ov-combobox-control>.ov-combobox-input:focus{min-height:47px;padding:12px 14px;font-size:15px;line-height:1.45}
  .ov-edit-form .ov-combobox-toggle{width:42px;border-radius:0 10px 10px 0}
  .ov-edit-form>.ov-field+.ov-field{margin-top:22px}
  .ov-edit-form>p.ov-muted,.ov-edit-form>p.ov-status{margin:0 0 22px;line-height:1.7}
  .ov-edit-form>.ov-notice,.ov-edit-form>div.ov-notice{margin:0 0 24px;padding:16px 18px;border-radius:12px}
  .ov-edit-form>.ov-form-grid+.ov-notice,.ov-edit-form>.ov-field+.ov-notice{margin-top:22px}
  .ov-edit-form>fieldset>legend{padding:0 9px;font-size:15px;font-weight:700;line-height:1.6;color:var(--ov-text)}
  .ov-edit-form>fieldset.ov-form-section>legend{margin-bottom:8px}
  .ov-edit-form>fieldset.ov-form-section>.ov-field+.ov-field{margin-top:22px}
  .ov-edit-form>fieldset.ov-form-section>.ov-field+.ov-form-grid{margin-top:22px}
  .ov-edit-form>fieldset.ov-company-settings-section>.ov-field{margin-top:7px}
  .ov-edit-form>fieldset.ov-company-settings-section>p{margin-bottom:0;line-height:1.7}
  .ov-edit-form .ov-product-details{margin-top:24px}
  .ov-edit-form :is(.ov-product-detail-group,.ov-client-extra){padding:0;border:1px solid var(--ov-line);border-radius:14px;background:#fff;margin-top:20px;overflow:visible}
  .ov-edit-form :is(.ov-product-detail-group,.ov-client-extra)>summary{padding:17px 20px;min-height:58px;font-size:14px;line-height:1.6;color:var(--ov-text);font-weight:600}
  .ov-edit-form :is(.ov-product-detail-group,.ov-client-extra)[open]>summary{margin-bottom:0;background:var(--ov-soft);border-bottom:1px solid var(--ov-line);border-radius:13px 13px 0 0}
  .ov-edit-form :is(.ov-product-detail-group,.ov-client-extra)>.ov-form-grid{padding:22px}
  .ov-edit-form .ov-product-detail-group>p{padding:0 22px 20px;margin:0}
  .ov-edit-form .ov-product-photo{padding:22px;border-color:var(--ov-line);border-radius:14px;background:#fff;gap:22px}
  .ov-edit-form .ov-product-photo-controls p{line-height:1.65;margin:13px 0}
  .ov-edit-form>.ov-checkbox-label{margin-top:22px;line-height:1.65}
  .ov-edit-form .ov-checkbox-label,.ov-edit-form .ov-checkbox{gap:10px;line-height:1.6}
  .ov-edit-form .ov-checkbox-label>input,.ov-edit-form .ov-checkbox>input{flex-shrink:0}
  .ov-modal form.ov-edit-form>:is(.ov-form-actions,.ov-form-footer){position:sticky;bottom:0;z-index:4;display:flex;align-items:center;justify-content:flex-end;gap:12px;flex-wrap:wrap;margin:26px -28px 0;padding:18px 28px;border-top:1px solid var(--ov-line);background:#fff;border-radius:0 0 22px 22px}
  .ov-modal form.ov-edit-form>:is(.ov-form-actions,.ov-form-footer)>.ov-button{min-height:46px}
  .ov-modal form.ov-edit-form>:is(.ov-form-actions,.ov-form-footer)+p{margin:0 -28px;padding:0 28px 18px;background:#fff;font-size:12px;line-height:1.65;color:var(--ov-muted)}
  .ov-content form.ov-edit-form.ov-panel{background:#f8fafc;border-radius:16px}
  .ov-content form.ov-edit-form>.ov-actions{gap:12px;margin:22px 0}
  .ov-content form.ov-edit-form>.ov-field{margin-bottom:22px}
  .ov-content #facturacion-form.ov-edit-form{padding:24px;background:#f8fafc}
  .ov-content #facturacion-form.ov-edit-form>.ov-form-footer{padding-top:22px;margin-top:26px}
  .ov-edit-form>#accesos-locales>fieldset.ov-panel{margin:22px 0;border-radius:14px;background:#fff}

  /* The clinical worksheet keeps patient, measurements, work and payment in one compact workspace. */
  .ov-modal:has(#receta-form.ov-edit-form:not([hidden])){max-width:1480px;border-radius:18px;background:#fff}
  .ov-modal:has(#receta-form.ov-edit-form:not([hidden])) .ov-modal-header{padding:14px 20px}
  .ov-modal:has(#receta-form.ov-edit-form:not([hidden])) .ov-modal-header h2{font-size:21px}
  .ov-modal:has(#receta-form.ov-edit-form:not([hidden])) .ov-modal-header p{font-size:12px;margin-top:4px;line-height:1.5}
  .ov-modal:has(#receta-form.ov-edit-form:not([hidden])) .ov-modal-body{padding:16px 18px 0}
  .ov-modal .ov-edit-form.ov-prescription .ov-form-grid{gap:12px}
  .ov-modal .ov-edit-form.ov-prescription .ov-field{gap:6px;font-size:12px;line-height:1.4}
  .ov-modal .ov-edit-form.ov-prescription .ov-field>:is(input:not([type="checkbox"],[type="radio"],[type="hidden"],[type="color"],[type="file"]),select,textarea){min-height:38px;padding:8px 10px;border-radius:7px;font-size:14px;line-height:1.35}
  .ov-modal .ov-edit-form.ov-prescription .ov-field>:is(input:not([type="checkbox"],[type="radio"],[type="hidden"],[type="color"],[type="file"]),select,textarea):focus{padding:7.2px 9.2px}
  .ov-modal .ov-edit-form.ov-prescription .ov-combobox-control{min-height:38px;border-radius:7px}
  .ov-modal .ov-edit-form.ov-prescription .ov-combobox-control>.ov-combobox-input,.ov-modal .ov-edit-form.ov-prescription .ov-combobox-control>.ov-combobox-input:focus{min-height:36px;padding:7px 10px;font-size:14px;line-height:1.35}
  .ov-modal .ov-edit-form.ov-prescription .ov-combobox-toggle{width:32px;border-radius:0 7px 7px 0}
  .ov-modal .ov-edit-form.ov-prescription>.ov-prescription-patient-section{margin:0 0 14px;padding:0;border:0;border-radius:0;background:#fff}
  .ov-modal .ov-edit-form.ov-prescription>.ov-prescription-patient-section>legend{margin-bottom:7px;padding:0;font-size:14px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-patient{grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-patient>.ov-field:first-child{grid-column:span 2}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-workspace{grid-template-columns:minmax(410px,1.6fr) minmax(225px,1fr) minmax(235px,1fr);gap:14px;margin-top:0}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-sheet{border-radius:11px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-heading{gap:10px;padding:11px 12px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-heading h3{font-size:15px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-heading p{font-size:11px;margin-top:3px;line-height:1.5}
  .ov-modal .ov-edit-form.ov-prescription .ov-refraction-block{padding:11px 12px}
  .ov-modal .ov-edit-form.ov-prescription .ov-refraction-block-heading{margin-bottom:8px}
  .ov-modal .ov-edit-form.ov-prescription .ov-refraction-block h4{font-size:13px}
  .ov-modal .ov-edit-form.ov-prescription .ov-refraction-table :is(th,td){padding:4px}
  .ov-modal .ov-edit-form.ov-prescription .ov-refraction-table thead th{padding-top:8px;padding-bottom:8px}
  .ov-modal .ov-edit-form.ov-prescription .ov-refraction-table input{min-height:32px;padding:5px 3px;font-size:14px}
  .ov-modal .ov-edit-form.ov-prescription .ov-refraction-table input:focus{padding:4.2px 2.2px}
  .ov-modal .ov-edit-form.ov-prescription .ov-refraction-dip input{min-height:74px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-additions{padding:11px 12px;border-bottom:1px solid var(--ov-line)}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-additions .ov-form-grid{gap:10px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-main-observation{padding:11px 12px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-main-observation textarea{min-height:66px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-card{padding:13px;border-radius:11px;background:#fff}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-card>legend{font-size:14px;padding:0 6px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment{grid-column:auto}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment-fields>.ov-field:nth-child(-n+3){grid-column:1/-1}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment .ov-muted{font-size:11px;margin:8px 0 12px;line-height:1.5}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment .ov-notice{font-size:11px;padding:10px 11px;margin-top:13px;line-height:1.5}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-extras{margin-top:16px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-extras-heading{margin-bottom:10px;gap:12px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-extras-heading h3{font-size:14px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-extras-heading p{font-size:11px;margin-top:4px;line-height:1.5}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-detail-groups{gap:12px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-detail-groups>.ov-form-section{margin:0;border-radius:9px;background:#fff}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-detail-groups summary{padding:12px;font-size:12px;line-height:1.5}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-detail-groups>.ov-form-section>.ov-form-grid{padding:14px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-contact-layout{padding:14px;gap:16px}
  .ov-modal .ov-edit-form.ov-prescription .ov-prescription-clinical-tables{gap:14px}
  .ov-modal form.ov-edit-form.ov-prescription>.ov-form-footer{margin:16px -18px 0;padding:12px 18px;gap:10px;border-radius:0 0 18px 18px}
  .ov-modal form.ov-edit-form.ov-prescription>.ov-form-footer>.ov-button{min-height:40px}
  .ov-modal form.ov-edit-form.ov-prescription>.ov-form-footer+p{margin:0 -18px;padding:0 18px 12px}

  @media(max-width:1200px){
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-patient{grid-template-columns:repeat(3,minmax(0,1fr))}
  }
  @media(max-width:1100px){
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-workspace{grid-template-columns:minmax(380px,1.4fr) minmax(240px,1fr)}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment{grid-column:1/-1}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment-fields{grid-template-columns:repeat(5,minmax(0,1fr))}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment-fields>.ov-field:nth-child(-n+3){grid-column:auto}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-detail-groups{grid-template-columns:repeat(2,minmax(0,1fr))}
  }
  @media(max-width:760px){
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-workspace{grid-template-columns:minmax(0,1fr)}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment{grid-column:auto}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment-fields>.ov-field:first-child{grid-column:1/-1}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-patient{grid-template-columns:repeat(2,minmax(0,1fr))}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-patient>.ov-field:first-child{grid-column:1/-1}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-detail-groups{grid-template-columns:1fr}
    .ov-modal .ov-edit-form.ov-prescription .ov-field>:is(input:not([type="checkbox"],[type="radio"],[type="hidden"],[type="color"],[type="file"]),select,textarea){min-height:42px;font-size:16px}
    .ov-modal .ov-edit-form.ov-prescription .ov-combobox-control{min-height:42px}
    .ov-modal .ov-edit-form.ov-prescription .ov-combobox-control>.ov-combobox-input,.ov-modal .ov-edit-form.ov-prescription .ov-combobox-control>.ov-combobox-input:focus{min-height:40px;font-size:16px}
    .ov-modal .ov-edit-form.ov-prescription .ov-refraction-table input{min-height:38px;font-size:16px}
    .ov-modal .ov-edit-form.ov-prescription .ov-refraction-dip input{min-height:86px}
  }
  @media(max-width:650px){
    .ov-modal:has(form.ov-edit-form){width:calc(100% - 20px);max-height:calc(100dvh - 20px);border-radius:18px}
    .ov-modal:has(form.ov-edit-form) .ov-modal-header{padding:18px 20px}
    .ov-modal:has(form.ov-edit-form) .ov-modal-header h2{font-size:20px}
    .ov-modal:has(form.ov-edit-form) .ov-modal-body{padding:20px 18px 0}
    .ov-edit-form>.ov-form-grid,.ov-edit-form>.ov-form-stack,.ov-edit-form>fieldset.ov-form-section,.ov-edit-form>fieldset.ov-company-settings-section{padding:18px 16px;border-radius:13px;margin-bottom:20px}
    .ov-edit-form .ov-form-grid{gap:20px}
    .ov-edit-form .ov-field{font-size:14px;gap:8px}
    .ov-edit-form .ov-field>:is(input:not([type="checkbox"],[type="radio"],[type="hidden"],[type="color"],[type="file"]),select,textarea){font-size:16px;min-height:50px}
    .ov-edit-form .ov-input-action>input{font-size:16px}
    .ov-edit-form .ov-combobox-control>.ov-combobox-input,.ov-edit-form .ov-combobox-control>.ov-combobox-input:focus{font-size:16px}
    .ov-edit-form :is(.ov-product-detail-group,.ov-client-extra)>summary{padding:15px 16px}
    .ov-edit-form :is(.ov-product-detail-group,.ov-client-extra)>.ov-form-grid{padding:18px 16px}
    .ov-edit-form .ov-product-photo{padding:18px 16px}
    .ov-modal form.ov-edit-form>:is(.ov-form-actions,.ov-form-footer){margin:22px -18px 0;padding:16px 18px;gap:10px;border-radius:0 0 18px 18px}
    .ov-modal form.ov-edit-form>:is(.ov-form-actions,.ov-form-footer)>.ov-button:not(.ov-control-icon){flex:1 1 auto;min-height:46px}
    .ov-modal form.ov-edit-form>:is(.ov-form-actions,.ov-form-footer)+p{margin:0 -18px;padding:0 18px 16px}
    .ov-content #facturacion-form.ov-edit-form{padding:18px}
  }
  @media(max-width:650px){
    .ov-modal:has(#receta-form.ov-edit-form:not([hidden])) .ov-modal-header{padding:15px 16px}
    .ov-modal:has(#receta-form.ov-edit-form:not([hidden])) .ov-modal-body{padding:16px 14px 0}
    .ov-modal .ov-edit-form.ov-prescription>.ov-prescription-patient-section{padding:0}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-card{padding:14px}
    .ov-modal .ov-edit-form.ov-prescription .ov-form-grid{gap:14px}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-patient,.ov-modal .ov-edit-form.ov-prescription .ov-prescription-job .ov-form-grid,.ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment-fields{grid-template-columns:1fr}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-patient>.ov-field:first-child,.ov-modal .ov-edit-form.ov-prescription .ov-prescription-payment-fields>.ov-field:nth-child(-n+3){grid-column:auto}
    .ov-modal .ov-edit-form.ov-prescription .ov-prescription-detail-groups>.ov-form-section>.ov-form-grid,.ov-modal .ov-edit-form.ov-prescription .ov-prescription-contact-layout{padding:14px}
    .ov-modal form.ov-edit-form.ov-prescription>.ov-form-footer{margin:16px -14px 0;padding:12px 14px}
    .ov-modal form.ov-edit-form.ov-prescription>.ov-form-footer+p{margin:0 -14px;padding:0 14px 12px}
  }
}
