/* Densidad compartida: conservar tipografía, controles y ayudas; ganar espacio
   en cabeceras, nunca reduciendo las filas del detalle ni los controles táctiles. */
@media screen {
 #main-sidebar #area-menu {
  display:flex;flex-direction:column;flex-wrap:nowrap;gap:0;
  flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;
 }
 #main-sidebar #area-menu>* { flex-shrink:0; }
 #main-sidebar #area-menu>.menu-area { width:100%; }
 #main-sidebar #area-menu>.menu-area>summary,
 #main-sidebar #area-menu>.menu-area:not([open])>summary {
  font-size:calc(13px + 2pt);line-height:1.35;min-height:32px;
 }
 #main-sidebar .menu-area>summary { gap:8px;white-space:normal;overflow-wrap:anywhere;height:auto; }
 #main-sidebar .area-icon,#main-sidebar .area-chevron { flex-shrink:0; }
 #main-sidebar #area-menu { scrollbar-width:thin; }
 #main-sidebar #area-menu::-webkit-scrollbar { display:block;width:6px; }

 /* Ventas comparte el formulario con pedidos, remitos y devoluciones. */
 .sales-window:not([data-navigation-route="facturas"]) [id="document-form"] { gap:4px; }
 .sales-window:not([data-navigation-route="facturas"]) :is(.customer-priority,.document-primary,.document-secondary,.payment-condition) { padding-block:4px;margin-block:0;row-gap:4px; }
 .sales-window .customer-identity { padding-block:0; }
 .sales-window .customer-identity h3 { margin-block:0 2px; }
 .sales-window .customer-contact { margin-top:1px; }
 .sales-window:not([data-navigation-route="facturas"]) .detail-panel { padding-block:5px; }
 .sales-window .detail-toolbar { margin-bottom:4px; }
 .sales-window .detail-panel h3 { margin-bottom:3px; }
 .sales-window .draft-bottom { gap:6px; }
 .sales-window .draft-bottom>:is(.observations-panel,.general-discount,.totals) { padding-block:4px; }

 /* Bloques de cabecera/filtros existentes de compras, tesorería, reportes y ABM. */
 .sales-window :is(.purchase-supplier,.purchase-header,.purchase-condition,.collection-client,.collection-header,.report-filters,.tr-filters,.pu-filters) { padding-block:4px;row-gap:4px;margin-block:0; }
 .sales-window :is(.purchase-tools,.collection-tools,.report-tools,.tr-tools,.cm-tools,.fm-tools,.customer-toolbar,.products-toolbar,.report-filter-toolbar) { row-gap:4px;margin-block:0 4px;flex-wrap:wrap; }
 .sales-window :is(.purchase-supplier,.collection-client) :is(h2,h3) { margin-block:0 2px; }
 .sales-window :is(.purchases-content,.collections-content,.report-main,.tr-form-body,.products-body) { padding-block:6px;gap:4px; }
 .sales-window .purchases-content form { gap:4px; }
 .sales-window :is(.purchase-detail,.collection-debts) { padding-block:4px; }
 .sales-window :is(.dialog-footer,.report-footer,.collection-actions,.purchase-actions,.tr-footer,.customer-footer) { padding-block:5px;row-gap:4px;flex-shrink:0;flex-wrap:wrap; }
 .sales-window :is(.footer-actions,.purchase-actions>div) { flex-wrap:wrap;min-width:0;max-width:100%; }
 .sales-window :is(.document-primary,.document-secondary,.purchase-header,.collection-header,.report-filters)>* { min-width:0; }
 /* Formularios y modales sin grilla conservan su tamaño y su scroll propio. */
 .sales-window .dialog-body>form { row-gap:4px; }
 dialog .dialog-head { padding-block:6px; }
 dialog .confirmation-content>p { margin-block:6px; }
 @media (min-width:801px) and (pointer:fine) {
  .sales-window :is(.observations-panel,.collection-bottom,.purchase-bottom) textarea { height:36px;min-height:32px; }
 }
}

/* Ficha de clientes: conservar campos y tipografia, eliminar aire entre bloques. */
@media screen {
 .customer-window .customer-toolbar { padding:7px 16px;gap:8px; }
 .customer-window .customer-breadcrumb { margin:0 0 3px; }
 .customer-window .customer-toolbar h2 { margin:0 0 3px; }
 .customer-window .customer-main { padding:8px 14px; }
 .customer-window .customer-section-heading h2 { margin:0 0 2px; }
 .customer-window .customer-section-heading p { margin:0 0 7px; }
 .customer-window .customer-card { padding:8px 10px;margin-bottom:7px; }
 .customer-window .customer-card h3 { margin:0 0 6px!important; }
 .customer-window .customer-field-grid { gap:6px 12px; }
 .customer-window .customer-field-grid :is(input,select) { height:32px;margin-top:3px;padding:3px 8px; }
 .customer-window .customer-arca button { margin-top:3px;height:32px; }
 .customer-window .customer-arca span { margin-top:3px; }
 .customer-window .customer-footer { padding:6px 14px;gap:8px; }
 .customer-window .customer-tabs { padding-top:4px;gap:1px; }
 .customer-window .customer-nav-label { padding-top:6px;padding-bottom:3px; }
 .customer-window .customer-nav-label:not(:first-child) { margin-top:5px; }
}

/* Documentacion compartida: tema Nuvile, cuerpo desplazable y acciones ancladas. */
@media screen {
 dialog.attachment-modal { border:1px solid var(--nuvile-border);border-radius:6px;background:var(--nuvile-paper);color:var(--nuvile-ink);font-family:'Segoe UI',Arial,sans-serif;overflow:hidden; }
 dialog.attachment-modal>.dialog-head { background:var(--nuvile-primary);color:var(--nuvile-inverse,#fff);padding:5px 12px;min-height:44px;flex-wrap:nowrap; }
 dialog.attachment-modal>.dialog-head strong { font-size:18px;min-width:0; }
 dialog.attachment-modal>.dialog-head>[data-close] { min-width:32px;min-height:30px;width:32px;height:30px;border:0;border-radius:3px;flex:none; }
 dialog.attachment-modal .confirmation-content { padding:10px 12px; }
 dialog.attachment-modal .confirmation-content>p { margin:0 0 7px; }
 dialog.attachment-modal [data-upload] { padding:8px 10px;border-color:var(--nuvile-border);border-radius:4px;background:var(--nv-document-panel,var(--nuvile-soft)); }
 dialog.attachment-modal label { margin:6px 0;color:var(--nuvile-ink); }
 dialog.attachment-modal :is(input,select) { min-height:32px;padding:4px 8px;border-color:var(--nuvile-border);border-radius:4px;color:var(--nuvile-ink);background:var(--nuvile-surface,#fff); }
 dialog.attachment-modal input[type=file] { height:auto; }
 dialog.attachment-modal input[type=file]::file-selector-button { font:inherit;color:var(--nuvile-primary);background:var(--nuvile-paper);border:1px solid var(--nuvile-border);border-radius:3px;padding:3px 8px;margin-right:8px;cursor:pointer; }
 dialog.attachment-modal :is(button.outline,a.outline) { padding:4px 10px;min-height:32px;border-radius:4px;border-color:var(--nuvile-border);color:var(--nuvile-primary);background:var(--nuvile-surface,#fff); }
 dialog.attachment-modal .attachment-mobile-tools { display:flex;flex-wrap:wrap;gap:6px; }
 dialog.attachment-modal [data-mobile-request] { flex-basis:100%; }
 dialog.attachment-modal [data-mobile-request]:empty,dialog.attachment-modal [data-status]:empty { display:none; }
 dialog.attachment-modal .attachment-footer { padding:7px 12px;background:var(--nuvile-paper);border-color:var(--nuvile-border); }
 dialog.attachment-modal .attachment-footer .primary { padding:5px 12px;min-height:32px;border-radius:4px;background:var(--nuvile-primary);color:var(--nuvile-inverse,#fff); }
 dialog.attachment-modal [data-preview] { margin-top:8px; }
 dialog.attachment-modal .attachment-row { padding:7px 0;border-color:var(--nuvile-border); }
 @media(max-width:700px),(pointer:coarse) {
  dialog.attachment-modal :is(button,a.outline,input,select) { min-height:44px; }
  dialog.attachment-modal>.dialog-head>[data-close] { min-width:44px;min-height:44px; }
 }
}

@layer nuvile-legibility {
 @media(max-width:700px),(pointer:coarse) {
  :is(#workspace,dialog[open]).attachment-modal :is(button,a.outline,input,select) { min-height:44px!important; }
 }
}
