/* Opt-in legacy fields: no generic div/table/form-control overrides. */
html body :is(span,div).app-field-addon{background-color:#f3f7fa;color:#688094;border-color:#d6dfe9;border-radius:0;box-shadow:none;vertical-align:middle}
html body .app-field-addon>svg{width:16px;height:16px;vertical-align:middle}
html body :is(button,input).app-save-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:34px;padding:6px 12px;background:#fff!important;color:#326781!important;border:1px solid #d6dfe9!important;border-radius:4px!important;box-shadow:none!important;font-family:inherit;font-size:13px;line-height:1.4;text-shadow:none;cursor:pointer;transition:background-color .15s ease,border-color .15s ease}
html body :is(button,input).app-save-button:hover{background:#f0f7fb!important;border-color:#91b5cc!important}
html body :is(button,input).app-save-button:focus-visible{outline:2px solid #2189b8;outline-offset:2px}
html body :is(button,input).app-save-button:disabled{opacity:.55;cursor:not-allowed}
/* Registration status cards keep their conditional content and links. */
html body div.app-summary-card{background:#fff!important;color:#263c50!important;border-left:3px solid #2189b8!important}
html body div.app-summary-card.bg-green{border-left-color:#16864e!important}
html body div.app-summary-card:is(.bg-orange,.bg-yellow){border-left-color:#c17c00!important}
html body div.app-summary-card:is(.bg-red,.bg-danger){border-left-color:#bf3541!important}
html body .app-summary-card>.inner{padding:18px 20px;padding-right:62px;min-height:100px}
html body .app-summary-card>.inner p{margin:0 0 7px;font-size:13px;line-height:1.5;font-weight:400}
html body .app-summary-card>.icon{top:20px;right:16px;color:#7394a4;font-size:30px;opacity:.7}
html body .app-summary-card.bg-green>.icon{color:#16864e}
html body .app-summary-card:is(.bg-orange,.bg-yellow)>.icon{color:#c17c00}
html body .app-summary-card>.small-box-footer{background:#f5f8fa;color:#326781;padding:8px 12px;border-top:1px solid #e4e6ef}
html body .app-summary-card>.small-box-footer:hover{background:#edf5fa;color:#185b7d}
/* Authentication/registration remain independent of the administrative shell. */
.app-auth-shell .app-auth-spacer{height:clamp(24px,6vh,64px)}
.app-auth-shell .panel.panel-default{background:#fff!important;border:1px solid #e4e6ef!important;border-radius:0!important;box-shadow:0 8px 30px rgba(9,28,45,.1)}
.app-auth-shell .panel>.panel-body{padding:28px 24px;color:#263c50}
.app-auth-shell .panel form{color:#263c50}
.app-auth-shell .panel form :is(h1,h2,h3){color:#263c50!important;font-family:inherit!important;font-size:22px;line-height:1.4}
.app-auth-shell .panel form [style*="color: white"],.app-auth-shell .panel form [style*="color:white"]{color:#263c50!important}
.app-auth-shell .panel form a{color:#167db0!important;font-size:13px!important}
.app-auth-shell .panel form .form-control{border:1px solid #d6dfe9!important;border-radius:4px!important;box-shadow:none;font-family:inherit!important;font-size:14px!important}
.app-auth-shell .panel form .form-control:focus{border-color:#64a3ca!important;box-shadow:0 0 0 2px rgba(33,137,184,.12)!important}
.app-auth-shell .panel form :is(.user,.password,.ced){border-radius:4px 0 0 4px!important;border-width:0!important}
.app-auth-shell .panel form :is(button,input)[type=submit]{width:100%!important;min-height:40px;border:1px solid #222d32!important;border-radius:4px!important;background:#222d32!important;color:#fff!important;font-family:inherit!important;font-size:14px!important;box-shadow:none}
.app-auth-shell .panel form :is(button,input)[type=submit]:focus-visible{outline:2px solid #2189b8;outline-offset:3px}
@media(max-width:767px){.app-auth-shell .panel>.panel-body{padding:22px 18px}.app-auth-shell .panel form :is(.col-md-8,.col-md-12){min-width:0}}
@media(prefers-reduced-motion:reduce){html body :is(button,input).app-save-button{transition:none}}

.modal .app-form-surface{padding:0;line-height:1.5}
.modal .app-form-surface .control-label{line-height:1.5;margin-bottom:6px}

#wrapper>.main-header .app-platform-brand{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:48px;color:#fff;font-size:18px;font-weight:600;line-height:1}
#wrapper>.main-header .app-platform-brand>img{width:32px;height:32px;object-fit:contain}

.app-auth-shell .panel form .form-group{margin-left:0;margin-right:0}
.app-auth-shell .panel form .app-auth-field-icon{display:inline-flex;align-items:center;justify-content:center;background-image:none!important;border-width:0!important;border-radius:4px 0 0 4px!important;color:#fff;padding:11px;pointer-events:none}
.app-auth-shell .app-auth-field-icon>svg{width:22px;height:22px;display:block;flex-shrink:0}
.app-auth-shell .panel form .form-control+.required-check{position:absolute;right:10px;top:13px;margin:0}
.app-auth-shell .panel form .form-group:has(>.form-control+.required-check){position:relative}
.app-auth-shell .panel form .form-control:has(+.required-check){padding-right:34px!important}
.app-auth-shell .panel form select.form-control+.required-check{right:30px}
.app-auth-shell .panel form select.form-control:has(+.required-check){padding-right:54px!important}

/* Former topbar rules: same app-only consumers, selected theme via shared variable. */
:where(#wrapper) .file{transition:all .3s ease-in-out}
:where(#wrapper) .file:hover{transform:scale(1.1);cursor:pointer}
:where(#wrapper) .messages-menu{margin-right:10px}
.sidebar-collapse :where(#wrapper) .treeview .bg-company{background-color:var(--app-shell-color,#222D32)!important}
:where(#wrapper) :is(label,span:where(.ef24-form-caption)){cursor:pointer}

/* Keep text legible when existing validation scripts paint an addon red/blue. */
html body .app-field-addon[style*="background"]{color:#fff}

/* Client create/edit/quick create: scoped layout, original controls and values. */
.client-form-layout{container-type:inline-size}
.client-form-layout>.client-form-section{padding:0 0 16px;margin:0 0 16px;border-bottom:1px solid #E4E6EF}
.client-form-layout>.client-form-section:last-child{margin-bottom:0;border-bottom:0;padding-bottom:0}
.client-form-layout .client-form-section__title{margin:0 0 12px;font-size:13px;font-weight:600;line-height:1.4;color:#263c50}
.client-form-layout .client-form-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:14px 20px;align-items:start}
html body .client-form-layout .client-form-grid>.client-form-field{float:none;width:auto;min-width:0;margin:0;padding:0}
.client-form-layout .client-form-span-3{grid-column:span 3}
.client-form-layout .client-form-span-4{grid-column:span 4}
.client-form-layout .client-form-span-5{grid-column:span 5}
.client-form-layout .client-form-span-6{grid-column:span 6}
.client-form-layout .client-form-span-12{grid-column:1/-1}
.client-form-layout .client-form-field>.control-label{display:block;margin-bottom:6px;line-height:1.4}
.client-form-layout .client-form-field>.form-group{margin:0}
.client-form-layout .client-form-field .form-control{max-width:100%;min-width:0}
.client-form-layout .client-form-toggle .app-binary-control{max-width:100%}
.client-form-layout .help-block{margin:5px 0 0}
@container (max-width:760px){
 .client-form-layout .client-form-span-3,.client-form-layout .client-form-span-4,.client-form-layout .client-form-span-5{grid-column:span 6}
 .client-form-layout .client-form-field--name,.client-form-layout .client-form-field--contact{grid-column:1/-1}
 .client-form-layout .client-form-toggle{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:16px}
 .client-form-layout .client-form-toggle>.control-label{margin:0}
 .client-form-layout .client-form-toggle>.form-group{flex:0 0 auto}
}
@container (max-width:460px){
 .client-form-layout .client-form-grid{gap:12px}
 .client-form-layout .client-form-grid>.client-form-field{grid-column:1/-1}
 .client-form-layout .client-form-toggle>.control-label{max-width:50%}
}

/* Product create/edit: layout only; keep tax and stock visibility under existing JS. */
.product-form-layout{container-type:inline-size}
.product-form-layout>.product-form-section{padding:0 0 16px;margin:0 0 16px;border-bottom:1px solid #E4E6EF}
.product-form-layout>.product-form-section:last-child{padding-bottom:0;margin-bottom:0;border-bottom:0}
.product-form-layout .product-form-section__title{margin:0 0 12px;color:#263c50;font-size:13px;font-weight:600;line-height:1.4}
.product-form-layout .product-form-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:14px 20px;align-items:start}
html body .product-form-layout .product-form-grid>.product-form-field{float:none;width:auto;min-width:0;margin:0;padding:0}
.product-form-layout .product-form-span-2{grid-column:span 2}
.product-form-layout .product-form-span-3{grid-column:span 3}
.product-form-layout .product-form-span-4{grid-column:span 4}
.product-form-layout .product-form-span-6{grid-column:span 6}
.product-form-layout .product-form-span-12{grid-column:1/-1}
.product-form-layout .product-form-field>.control-label{display:inline-block;margin-bottom:6px;line-height:1.4}
.product-form-layout .product-form-field>.form-group{margin:0}
.product-form-layout .product-form-field .form-control,.product-form-layout .product-form-field .select2-container{max-width:100%;min-width:0;width:100%!important}
.product-form-layout .product-form-field .app-binary-control{max-width:100%}
.product-form-layout .help-block{margin:5px 0 0}
@container (max-width:1000px){
 .product-form-layout .product-form-span-2{grid-column:span 3}
 .product-form-layout .product-form-field--sucursal{grid-column:span 6}
 .product-form-layout:not(.supplier-product-form) .product-form-field--taxYN,.product-form-layout:not(.supplier-product-form) .product-form-field--tax_id{grid-column:span 6}
}
@container (max-width:650px){
 .product-form-layout .product-form-grid>.product-form-field{grid-column:span 6}
 .product-form-layout .product-form-field--description,.product-form-layout .product-form-field--sucursal{grid-column:1/-1}
}
@container (max-width:400px){.product-form-layout .product-form-grid>.product-form-field{grid-column:1/-1}.product-form-layout .product-form-grid{gap:12px}}

/* Supplier quick creation: grouped fields, no change to other quick-create modals. */
.modal .quick-create-fields.supplier-form-layout{display:block;container-type:inline-size}
.supplier-form-layout>.supplier-form-section{padding:0 0 14px;margin:0 0 14px;border-bottom:1px solid #E4E6EF}
.supplier-form-layout>.supplier-form-section:last-child{padding-bottom:0;margin-bottom:0;border-bottom:0}
.supplier-form-layout .supplier-form-section__title{margin:0 0 10px;color:#263c50;font-size:13px;font-weight:600;line-height:1.4}
.supplier-form-layout .supplier-form-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:12px 20px;align-items:start}
.modal .quick-create-fields.supplier-form-layout .supplier-form-grid>.supplier-form-field{float:none;width:auto;min-width:0;margin:0;padding:0}
.supplier-form-layout .supplier-form-span-3{grid-column:span 3}
.supplier-form-layout .supplier-form-span-4{grid-column:span 4}
.supplier-form-layout .supplier-form-span-5{grid-column:span 5}
.supplier-form-layout .supplier-form-span-6{grid-column:span 6}
.supplier-form-layout .supplier-form-span-12{grid-column:1/-1}
.supplier-form-layout .supplier-form-field>.control-label{display:block;margin-bottom:5px;line-height:1.4}
.supplier-form-layout .supplier-form-field>.form-group{margin:0}
.supplier-form-layout .supplier-form-field .form-control{max-width:100%;min-width:0}
.supplier-form-layout .supplier-form-field .app-binary-control{max-width:100%}
.supplier-form-layout .help-block{margin:5px 0 0}
.supplier-form-layout .help-block:empty{display:none}
@container (max-width:640px){
 .supplier-form-layout .supplier-form-span-3,.supplier-form-layout .supplier-form-span-4,.supplier-form-layout .supplier-form-span-5{grid-column:span 6}
 .supplier-form-layout .supplier-form-field--country{grid-column:1/-1}
 .supplier-form-layout .supplier-form-toggle{grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:14px}
 .supplier-form-layout .supplier-form-toggle>.control-label{margin:0}
 .supplier-form-layout .supplier-form-toggle>.form-group{flex:0 0 auto}
}
@container (max-width:440px){
 .supplier-form-layout .supplier-form-grid>.supplier-form-field{grid-column:1/-1}
 .supplier-form-layout .supplier-form-toggle{display:block}
 .supplier-form-layout .supplier-form-toggle>.control-label{max-width:none;margin:0 0 6px}
 .supplier-form-layout .supplier-form-toggle>.form-group{width:180px;max-width:100%}
}

/* Explicit maintenance rows: preserve DOM hierarchy, visibility and form contracts. */
.maintenance-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:14px 20px;margin:0 0 14px}
.maintenance-row::before,.maintenance-row::after{display:none;content:none}
html body .maintenance-row>.form-group,html body .maintenance-row>.maintenance-field-group{float:none;width:auto;min-width:0;margin:0;padding:0}
.maintenance-cols-1{grid-template-columns:minmax(0,min(100%,620px))}
.maintenance-cols-1.maintenance-row-wide{grid-template-columns:minmax(0,1fr)}
.maintenance-row>.form-group>.control-label{line-height:1.4;margin-bottom:6px}
.maintenance-row>.form-group>.form-group{margin:0}
.maintenance-row .input-group{max-width:100%}
.maintenance-row .form-control{max-width:100%;min-width:0}
.maintenance-row input[type=file]{max-width:100%;min-width:0}
.maintenance-row .help-block:empty{display:none}
/* Semantically grouped patient maintenance screens and their quick-create modal. */
.maintenance-form-layout{container-type:inline-size}
.maintenance-form-section{padding:0 0 16px;margin:0 0 16px;border-bottom:1px solid #E4E6EF}
.maintenance-form-section:last-child{padding-bottom:0;margin-bottom:0;border-bottom:0}
.maintenance-form-title{margin:0 0 12px;color:#263c50;font-size:13px;font-weight:600;line-height:1.4}
.maintenance-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:14px 20px;align-items:start}
html body .maintenance-grid>.maintenance-field{float:none;width:auto;min-width:0;margin:0;padding:0}
.maintenance-span-3{grid-column:span 3}.maintenance-span-4{grid-column:span 4}.maintenance-span-5{grid-column:span 5}.maintenance-span-6{grid-column:span 6}.maintenance-span-12{grid-column:1/-1}
.maintenance-field>.control-label{display:block;line-height:1.4;margin-bottom:6px}
.maintenance-field>.form-group{margin:0}
.maintenance-field .form-control,.maintenance-field .select2-container{max-width:100%;min-width:0;width:100%!important}
.maintenance-field .help-block:empty{display:none}
@container(max-width:650px){.maintenance-grid>.maintenance-field{grid-column:span 6}.maintenance-grid>.maintenance-span-12{grid-column:1/-1}}
@container(max-width:420px){.maintenance-grid>.maintenance-field{grid-column:1/-1}}

/* Full supplier maintenance reuses the quick-create sections without changing other forms. */
.supplier-maintenance-form{display:block;container-type:inline-size}
html body .supplier-maintenance-form .supplier-form-grid>.supplier-form-field{float:none;width:auto;min-width:0;margin:0;padding:0}
.supplier-maintenance-form .supplier-form-grid+.supplier-form-grid{margin-top:14px}

.supplier-maintenance-form .supplier-form-span-8{grid-column:span 8}
@container(max-width:640px){.supplier-maintenance-form .supplier-form-span-8{grid-column:1/-1}}

/* Supplier-product maintenance: fixed numeric-field limits, flexible descriptive controls. */
.product-form-layout.supplier-product-form .supplier-product-details{display:flex;flex-wrap:wrap;margin-top:14px}
html body .supplier-product-form .supplier-product-details>.product-form-field{grid-column:auto;flex:1 1 200px}
html body .supplier-product-form .supplier-product-details>.product-form-field--price{flex:0 1 180px}
html body .supplier-product-form .supplier-product-details>.product-form-field--discount{flex:0 1 160px}
.supplier-product-form :is(.product-form-field--price,.product-form-field--discount) .form-control{text-align:right;font-variant-numeric:tabular-nums}
@container (max-width:760px){.product-form-layout.supplier-product-form .supplier-product-details{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}}
@container (max-width:420px){.product-form-layout.supplier-product-form .supplier-product-details{grid-template-columns:minmax(0,1fr)}}

/* Measured maintenance layouts: short values stay compact, descriptive fields flex. */
.maintenance-row.maintenance-ratio-code{grid-template-columns:minmax(140px,220px) minmax(0,1fr)}
.maintenance-row.maintenance-ratio-name-price{grid-template-columns:minmax(0,1fr) minmax(140px,180px)}
.maintenance-row.maintenance-pair-compact{grid-template-columns:repeat(2,minmax(0,220px))}
.maintenance-row.maintenance-ratio-name-amounts{grid-template-columns:minmax(0,1fr) repeat(2,minmax(140px,180px))}
@media(max-width:767px){.maintenance-row.maintenance-ratio-name-amounts{grid-template-columns:repeat(2,minmax(0,1fr))}.maintenance-ratio-name-amounts>:first-child{grid-column:1/-1}}
@media(max-width:540px){.maintenance-row.maintenance-ratio-code,.maintenance-row.maintenance-ratio-name-price{grid-template-columns:minmax(0,1fr)}}
@media(max-width:380px){.maintenance-row.maintenance-ratio-name-amounts,.maintenance-row.maintenance-pair-compact{grid-template-columns:minmax(0,1fr)}}

.conversion-form-layout{container-type:inline-size}
.conversion-form-intro{margin:0 0 16px;color:#64788b;line-height:1.5}
.conversion-direction-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
.conversion-direction{min-width:0;padding:16px;border:1px solid #E4E6EF;background:#fff}
.conversion-direction__title{margin:0 0 14px;color:#263c50;font-size:15px;font-weight:600;line-height:1.4}
.conversion-direction__fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(140px,180px);gap:16px;align-items:start}
.conversion-field{min-width:0;margin:0}
.conversion-field>:is(label,span:where(.ef24-form-caption)){display:block;margin:0 0 6px;line-height:1.4;font-weight:400}
.conversion-field .form-control,.conversion-field .select2-container{max-width:100%;width:100%!important;min-width:0}
.conversion-field input{min-height:34px}
.conversion-field .select2-selection--single{height:34px;min-height:34px;border-color:#d2d6de;border-radius:0}
.conversion-field .select2-selection--single .select2-selection__rendered{line-height:32px}
.conversion-field .select2-selection--single .select2-selection__arrow{height:32px}
.conversion-field input[type=number],.conversion-field input[readonly]{font-variant-numeric:tabular-nums;text-align:right}
.conversion-form-footer{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;padding-top:16px;margin-top:16px;border-top:1px solid #E4E6EF}
.conversion-result{display:flex;align-items:flex-end;gap:14px;min-width:0}
.conversion-result>.conversion-field{flex:0 1 180px;width:180px}
.conversion-result>p{margin:0 0 8px;color:#64788b;line-height:1.4}
.conversion-form-actions{flex:0 0 auto}
@container(max-width:780px){.conversion-direction-grid{grid-template-columns:minmax(0,1fr);gap:14px}}
@container(max-width:430px){.conversion-direction__fields{grid-template-columns:minmax(0,1fr)}.conversion-direction{padding:12px}.conversion-form-footer{align-items:stretch;flex-direction:column;gap:14px}.conversion-result{align-items:flex-start;flex-direction:column;gap:6px}.conversion-result>.conversion-field{width:100%;flex:auto}.conversion-result>p{margin:0}.conversion-form-actions{align-self:flex-end}}

/* Account/payment pickers in payroll and utilities: opt-in layout, original controls. */
html body .account-payment-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;margin:0}
html body .account-payment-fields::before,html body .account-payment-fields::after{display:none}
html body .account-payment-fields>.account-payment-field{float:none;width:auto;min-width:0;margin:0;padding:0}
html body .account-payment-field>:is(label,span:where(.ef24-form-caption)){margin-bottom:7px;line-height:1.4}
html body .account-payment-fields .account-payment-field .account-payment-lookup{display:flex;align-items:center;gap:10px;width:100%;min-width:0}
html body .account-payment-lookup>.form-control:not([type=hidden]){float:none;flex:1 1 0;min-width:0;width:0!important;max-width:100%;margin:0}
html body .account-payment-lookup>.input-group-btn{display:flex;align-items:center;flex:0 0 36px;width:36px;padding:0}
html body .account-payment-lookup>.input-group-btn>.app-search-icon-button{margin:0!important;float:none}
html body .account-payment-footer{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:10px;margin-top:20px;padding:16px 0 0}
html body .account-payment-footer::before,html body .account-payment-footer::after{display:none}
html body .account-payment-footer>.btn+.btn{margin:0}
@media(max-width:600px){html body .account-payment-fields{grid-template-columns:minmax(0,1fr);gap:16px}}
