/* Presentation only: keep fiscal columns, native inputs and DataTables contracts. */
.row.app-detail-section{box-sizing:border-box;width:auto!important;max-width:100%;margin:0 0 20px!important;padding:20px 10px;border:1px solid #e7edf4;border-radius:18px;background:#fff;box-shadow:0 7px 24px rgba(42,69,96,.06);color:#354d6b;min-width:0}
.app-detail-section hr{margin:16px 0 22px;border-color:#e8eef5}
.app-detail-section :is(label,span:where(.ef24-form-caption)).control-label{font-size:14px;font-weight:600;color:#354d6b}
/* Product-code input groups: avoid the legacy form-control class sizing icon buttons. */
.app-detail-search.input-group{display:flex!important;align-items:center;gap:8px;width:100%}
.app-detail-search.input-group>input.form-control{flex:1 1 auto;float:none;width:0!important;min-width:0;height:42px!important;border:1px solid #cfdaea;border-radius:8px!important;box-shadow:none;font-size:14px}
.app-detail-search.input-group>.input-group-btn{display:flex;align-items:center;flex:0 0 36px;width:36px!important;min-width:36px;max-width:36px;padding:0;vertical-align:middle}
.app-detail-search.input-group>.input-group-btn>.btn{display:inline-flex!important;align-items:center;justify-content:center;box-sizing:border-box;float:none;width:36px!important;min-width:36px!important;max-width:36px!important;height:36px!important;min-height:36px!important;max-height:36px!important;margin:0!important;padding:0!important;border:1px solid #00b5df!important;border-radius:50%!important;background:#00b5df!important;color:#fff!important;box-shadow:none}
.app-detail-search.input-group>.input-group-btn>.btn:focus-visible{outline:2px solid #126b91;outline-offset:2px}
.app-detail-search.input-group>.input-group-btn>.btn .fa{margin:0;line-height:1}
.app-detail-scroll{max-width:100%;overflow-x:auto;border:0!important;border-radius:12px;scrollbar-width:thin;scrollbar-color:#bacbdb #f3f7fb}
table.app-detail-table{display:table;width:100%!important;max-width:none;border-collapse:separate!important;border-spacing:0!important;border:1px solid #e3ebf3!important;border-radius:12px;overflow:hidden;background:#fff;font-size:14px;color:#354d6b}
table.app-detail-products{min-width:1050px}
table.app-detail-table>thead{font-size:12px!important}
table.app-detail-table>thead>tr>th{padding:15px 12px!important;border:0!important;border-bottom:1px solid #e2eaf2!important;font-size:13px!important;font-weight:600!important;line-height:1.4;text-transform:uppercase;vertical-align:middle;white-space:normal}
table.app-detail-table>tbody>tr>td{padding:10px 12px!important;border:0!important;border-bottom:1px solid #edf1f6!important;border-right:1px solid #edf1f6!important;vertical-align:middle!important;font-size:14px!important;line-height:1.5;overflow-wrap:anywhere}
table.app-detail-table>tbody>tr:nth-of-type(odd){background:#fff}
table.app-detail-table>tbody>tr:nth-of-type(even){background:#fafcfe}
table.app-detail-table>tbody>tr:hover{background:#f5f9fd}
table.app-detail-table>tbody>tr:last-child>td{border-bottom:0!important}
table.app-detail-table>tbody>tr>td:last-child{border-right:0!important}
table.app-detail-table :where(input:not([type=hidden]):not([type=checkbox]):not([type=radio]),textarea,select){box-sizing:border-box;min-height:40px;height:auto;border:1px solid #cfdbea!important;border-radius:7px!important;background:#fbfcfe;color:#354d6b!important;padding:8px 10px!important;font-size:14px!important;font-weight:400;line-height:1.4;box-shadow:none;max-width:100%;transition:border-color .15s,box-shadow .15s}
.app-detail-table :is(input,textarea,select):focus{outline:none;border-color:#69a8f3!important;box-shadow:0 0 0 3px #dceaff!important;background:#fff}
.app-detail-table :is(input,textarea,select):disabled,.app-detail-table input[readonly]{background:#f1f4f8;color:#697b92!important;cursor:default}
.app-detail-table [data-detail-column=action]{width:64px!important;min-width:64px;text-align:center}
.app-detail-table [data-detail-column=code]{min-width:105px;width:115px!important;overflow-wrap:normal;word-break:normal}
.app-detail-products [data-detail-column=description]{min-width:280px;width:38%!important}
.app-detail-table [data-detail-column=description] :is(input,textarea){width:100%!important;min-width:0}
.app-detail-table [data-detail-column=money]{min-width:98px;width:110px!important;font-variant-numeric:tabular-nums}
.app-detail-table [data-detail-column=percent]{min-width:100px;width:115px!important;white-space:nowrap}
.app-detail-table [data-detail-column=percent] input{width:70%!important;min-width:50px}
/* Discount percent: present one field with an integrated suffix. Legacy text
   markers remain in the DOM/export; values, input parent and handlers do not change. */
table.app-detail-table > tbody > tr > td[data-detail-column=percent]:has(> input[name=descuento]) {
    font-size:0!important;
    white-space:nowrap;
    overflow-wrap:normal;
}
table.app-detail-table > tbody > tr > td[data-detail-column=percent] > input[name=descuento] {
    display:inline-block;
    width:calc(100% - 30px)!important;
    min-width:52px;
    height:40px;
    margin:0;
    border-radius:7px 0 0 7px!important;
    vertical-align:middle;
    font-size:14px!important;
    font-variant-numeric:tabular-nums;
    text-align:right;
}
table.app-detail-table > tbody > tr > td[data-detail-column=percent]:has(> input[name=descuento])::after {
    content:"%";
    display:inline-flex;
    align-items:center;
    justify-content:center;
    box-sizing:border-box;
    width:30px;
    height:40px;
    border:1px solid #cfdbea;
    border-left:0;
    border-radius:0 7px 7px 0;
    background:#f0f5fa;
    color:#52677f;
    font:600 13px/1 'Titillium Web',sans-serif;
    vertical-align:middle;
    pointer-events:none;
}
.app-detail-table [data-detail-column=quantity]{min-width:140px;width:140px!important;white-space:nowrap;text-align:center}
.app-detail-table [data-detail-column=subtotal]{min-width:100px;width:115px!important;font-variant-numeric:tabular-nums}
.app-detail-table tbody [data-detail-column=subtotal]{color:#007fb7;font-size:16px!important;font-weight:600;text-align:right}
.app-detail-table .app-detail-quantity input[name=cantidades]{width:52px!important;min-width:52px;max-width:80px;border-radius:0!important;text-align:center;vertical-align:middle}
.app-detail-step{box-sizing:border-box;display:inline-block;width:32px;min-width:32px;height:40px;padding:0;border:1px solid #cfdbea;border-radius:7px 0 0 7px;background:#f4f7fb;color:#587293;vertical-align:middle;font:600 18px/1 system-ui;cursor:pointer}
.app-detail-step[data-detail-step="-1"]{border-right:0}.app-detail-step[data-detail-step="1"]{border-left:0;border-radius:0 7px 7px 0}
.app-detail-step:hover:not(:disabled){background:#e5f5fc;color:#007fb7}.app-detail-step:focus-visible{outline:2px solid #69a8f3;outline-offset:2px}.app-detail-step:disabled{opacity:.4;cursor:default}
.app-detail-table [data-detail-column=action] :is(button.btn-danger,a.btn-danger),button.app-detail-remove.btn-danger{display:inline-flex;align-items:center;justify-content:center;width:36px!important;min-width:36px;min-height:36px;margin:0;padding:7px!important;border:1px solid #ff5263!important;border-radius:8px!important;background:#fff!important;color:#ec344a!important;box-shadow:none}
.app-detail-table [data-detail-column=action] .btn-danger:hover,button.app-detail-remove.btn-danger:hover{background:#fff0f2!important}
.app-detail-table [data-detail-column=action] .btn-danger .fa-times-circle:before{content:"\f1f8"}
.app-detail-section .dataTables_info{padding:8px 0 14px;color:#617695;font-size:13px}
.app-detail-totals{padding:14px 18px;border:1px solid #e2ecf5;border-radius:12px;background:#fbfdff}
.app-detail-adjustments{padding:22px 24px;border:1px solid #e2ecf5;border-radius:12px;background:#fbfdff;min-height:160px}
.app-detail-discount-field{width:100%!important;max-width:400px;padding:0!important}
.app-detail-has-adjustment .app-detail-totals{min-height:160px}
.row.app-detail-has-adjustment{display:flex;flex-wrap:wrap}
@media(min-width:992px){.app-detail-adjustments{border-radius:12px 0 0 12px}.app-detail-has-adjustment .app-detail-totals{border-radius:0 12px 12px 0;border-left:0}}
.app-detail-totals table{width:100%!important;margin:0!important;float:none!important;color:#354d6b;font-size:15px!important}
.app-detail-totals td{padding:8px 10px!important;border-color:#e9eff5!important;font-variant-numeric:tabular-nums}
.app-detail-totals .app-detail-grand-total td{background:#e5f5ff!important;color:#007bb7!important;font-weight:700!important;border:0!important;font-size:17px}
.app-detail-totals .app-detail-grand-total td:first-child{border-radius:9px 0 0 9px}.app-detail-totals .app-detail-grand-total td:last-child{border-radius:0 9px 9px 0;font-size:23px}
.app-detail-section #descuentoAdicional{height:42px;border:1px solid #cfdbea;border-radius:7px;background:#fbfcfe;font-size:14px;box-shadow:none}
@media(max-width:767px){.row.app-detail-section{padding:14px 0;border-radius:12px}.app-detail-totals{margin-top:14px}.app-detail-table>thead>tr>th{padding:12px 10px!important}.app-detail-products{min-width:1000px}}
@media(prefers-reduced-motion:reduce){.app-detail-table :is(input,textarea,select){transition:none}}
@media print{.app-detail-step{display:none}.app-detail-section{box-shadow:none}.app-detail-scroll{overflow:visible}}

/* Editable detail rows become labeled cards on phones. The original TD/input
   nodes stay in place, and DataTables still owns hidden fiscal metadata. */
@media screen and (max-width:767px){
    table:is(#tablaproductos,#tablainfoadicional,#_inv_tablaproductos,#_inv_tablainfoadicional,#tabladjunto,#tablaporcentaje,#tblmedicinas,#tablaAllergies):is(.app-detail-table,.app-mobile-detail-table){display:block;width:100%!important;min-width:0!important;max-width:100%;border:0!important;border-radius:0;overflow:visible}
    table:is(.app-detail-table,.app-mobile-detail-table)>thead{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
    table:is(.app-detail-table,.app-mobile-detail-table)>tbody{display:block;width:100%}
    table:is(.app-detail-table,.app-mobile-detail-table)>tbody>tr:has(>td[data-detail-column]){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px 12px;margin:0 0 12px;padding:12px;background:#fff!important;border:1px solid #e4e6ef}
    table:is(#tablaproductos,#tablainfoadicional,#_inv_tablaproductos,#_inv_tablainfoadicional,#tabladjunto,#tablaporcentaje,#tblmedicinas,#tablaAllergies):is(.app-detail-table,.app-mobile-detail-table)>tbody>tr>td[data-detail-column]{display:block;box-sizing:border-box;order:2;width:auto!important;min-width:0!important;max-width:100%;padding:0!important;border:0!important;text-align:left;white-space:normal;overflow-wrap:anywhere}
    table:is(.app-detail-table,.app-mobile-detail-table)>tbody>tr>td[data-detail-column]::before{content:attr(data-detail-label);display:block;margin:0 0 6px;color:#62778e;font-size:12px;line-height:1.4;font-weight:600}
    table:is(#tablaproductos,#tablainfoadicional,#_inv_tablaproductos,#_inv_tablainfoadicional,#tabladjunto,#tablaporcentaje,#tblmedicinas,#tablaAllergies):is(.app-detail-table,.app-mobile-detail-table)>tbody>tr>td[data-detail-column=code]{order:0;grid-row:1;grid-column:1;align-self:center;font-weight:600}
    table:is(#tablaproductos,#tablainfoadicional,#_inv_tablaproductos,#_inv_tablainfoadicional,#tabladjunto,#tablaporcentaje,#tblmedicinas,#tablaAllergies):is(.app-detail-table,.app-mobile-detail-table)>tbody>tr>td[data-detail-column=action]{order:0;grid-row:1;grid-column:2;text-align:right;align-self:center}
    table:is(.app-detail-table,.app-mobile-detail-table)>tbody>tr>td[data-detail-column=action]::before{display:none}
    table:is(#tablaproductos,#tablainfoadicional,#_inv_tablaproductos,#_inv_tablainfoadicional,#tabladjunto,#tablaporcentaje,#tblmedicinas,#tablaAllergies):is(.app-detail-table,.app-mobile-detail-table)>tbody>tr>td:is([data-detail-column=description],[data-detail-column=text]){order:1;grid-column:1/-1}
    table:is(#tablaproductos,#tablainfoadicional,#_inv_tablaproductos,#_inv_tablainfoadicional,#tabladjunto,#tablaporcentaje,#tblmedicinas,#tablaAllergies):is(.app-detail-table,.app-mobile-detail-table)>tbody>tr>td[data-detail-column=subtotal]{order:3;grid-column:1/-1;display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:10px!important;border-top:1px solid #e4e6ef!important;font-size:18px!important}
    table:is(.app-detail-table,.app-mobile-detail-table)>tbody>tr>td[data-detail-column=subtotal]::before{margin:0;font-size:13px}
    table:is(#tablaproductos,#tablainfoadicional,#_inv_tablaproductos,#_inv_tablainfoadicional,#tabladjunto,#tablaporcentaje,#tblmedicinas,#tablaAllergies):is(.app-detail-table,.app-mobile-detail-table) :is(input:not([type=hidden]),textarea,select){max-width:100%!important;min-width:0!important;width:100%!important;min-height:44px;font-size:16px!important}
    table:is(#tablaproductos,#tablainfoadicional,#_inv_tablaproductos,#_inv_tablainfoadicional,#tabladjunto,#tablaporcentaje,#tblmedicinas,#tablaAllergies):is(.app-detail-table,.app-mobile-detail-table) [data-detail-column=description] textarea{min-height:76px;resize:vertical}
    table:is(#tablaproductos,#tablainfoadicional,#_inv_tablaproductos,#_inv_tablainfoadicional,#tabladjunto,#tablaporcentaje,#tblmedicinas,#tablaAllergies):is(.app-detail-table,.app-mobile-detail-table)>tbody>tr>td.app-detail-quantity{display:grid;grid-template-columns:44px minmax(44px,1fr) 44px;align-content:start;gap:0;white-space:nowrap}
    table:is(.app-detail-table,.app-mobile-detail-table) .app-detail-quantity::before{grid-column:1/-1}
    table:is(#tablaproductos,#tablainfoadicional,#_inv_tablaproductos,#_inv_tablainfoadicional,#tabladjunto,#tablaporcentaje,#tblmedicinas,#tablaAllergies):is(.app-detail-table,.app-mobile-detail-table) .app-detail-quantity input[name=cantidades]{width:100%!important;min-width:0!important;max-width:100%;height:44px;padding:8px 2px!important}
    table:is(.app-detail-table,.app-mobile-detail-table) .app-detail-quantity .app-detail-step{width:32px;min-width:32px;height:44px}
    .app-detail-section .app-detail-scroll{overflow-x:visible;border-radius:0}
    .app-detail-section .app-detail-adjustments,.app-detail-has-adjustment .app-detail-totals{min-height:0;padding:14px}
    table:is(#tablaproductos,#tablainfoadicional,#_inv_tablaproductos,#_inv_tablainfoadicional,#tabladjunto,#tablaporcentaje,#tblmedicinas,#tablaAllergies):is(.app-detail-table,.app-mobile-detail-table)>tbody>tr>td[data-detail-column=percent]>input[name=descuento]{width:calc(100% - 30px)!important;font-size:16px!important;height:44px}
    table:is(#tablaproductos,#tablainfoadicional,#_inv_tablaproductos,#_inv_tablainfoadicional,#tabladjunto,#tablaporcentaje,#tblmedicinas,#tablaAllergies):is(.app-detail-table,.app-mobile-detail-table)>tbody>tr>td[data-detail-column=percent]:has(>input[name=descuento])::after{height:44px}

    /* Legacy panel/tab wrappers otherwise consume almost half of a phone width. */
    .panel-body:has(.app-detail-section){padding:10px 8px!important}
    .panel-body:has(.app-detail-section)>.col-md-12{padding-right:0!important;padding-left:0!important}
    .nav-tabs-custom>.tab-content:has(.app-detail-section){padding:8px 4px!important}
    .tab-pane:has(.app-detail-section)>.box-body{padding:0!important}
    .app-detail-section>.col-xs-12{padding-right:6px!important;padding-left:6px!important}

}

/* Give the three quantity controls enough touch space on narrow cards. */
@media screen and (max-width:480px){table:is(.app-detail-table,.app-mobile-detail-table)>tbody>tr>td.app-detail-quantity{grid-column:1/-1}}
