/* 504: proporciones del marco. Los módulos y temas conservan sus colores. */
@media screen {
  :root { --window-heading-height: 48px; --window-control-size: 32px; }
  :root :is(dialog.wm-bounded, .wm-bounded, dialog > .pos-window-surface, .classification-shell):not(#checkoutDialog):not(#checkoutDialog *):not(#paymentSuccessDialog):not(#paymentSuccessDialog *)
    > :is(.head, .dialog-head, .modal-head, .edit-heading, .modal-title, .closed-head, .p66-window-head, .cons-window-head, .db-import-head, header),
  .cot-window > .title,
  #cajaWorkspace504 .caja-window > .caja-window-heading,
  .admin-profits-window > .head {
    box-sizing: border-box !important;
    min-height: var(--window-heading-height) !important;
    height: var(--window-heading-height) !important;
    flex-shrink: 0 !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    padding: 0 10px 0 16px !important;
    gap: 10px;
  }
  :root :is(.wm-bounded, dialog > .pos-window-surface, .classification-shell):not(#checkoutDialog):not(#checkoutDialog *):not(#paymentSuccessDialog):not(#paymentSuccessDialog *)
    > :is(.head, .dialog-head, .modal-head, .edit-heading, .modal-title, .closed-head, .p66-window-head, .cons-window-head, .db-import-head, header) > :is(h2, div),
  .cot-window > .title > div { min-width: 0; }
  :root :is(.wm-bounded, dialog > .pos-window-surface, .classification-shell):not(#checkoutDialog):not(#checkoutDialog *):not(#paymentSuccessDialog):not(#paymentSuccessDialog *)
    > :is(.head, .dialog-head, .modal-head, .edit-heading, .modal-title, .closed-head, .p66-window-head, .cons-window-head, .db-import-head, header) h2 {
    font-size: 18px !important;
    line-height: 22px !important;
    margin: 0 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  :root :is(.wm-bounded, dialog > .pos-window-surface, .classification-shell):not(#checkoutDialog):not(#checkoutDialog *):not(#paymentSuccessDialog):not(#paymentSuccessDialog *)
    > :is(.head, .dialog-head, .modal-head, .edit-heading, header) small {
    font-size: 10px !important; line-height: 12px !important;
  }
  :root :is(.wm-bounded, dialog > .pos-window-surface, .classification-shell):not(#checkoutDialog):not(#checkoutDialog *):not(#paymentSuccessDialog):not(#paymentSuccessDialog *)
    > :is(.head, .dialog-head, .modal-head, .edit-heading, .modal-title, .closed-head, .p66-window-head, .cons-window-head, .db-import-head, header)
    :is(.wm-actions, .window-controls, .window-actions) {
    flex: 0 0 auto; margin-left: auto; gap: 4px !important; flex-wrap: nowrap;
  }
  :root :is(.wm-bounded, dialog > .pos-window-surface, .classification-shell):not(#checkoutDialog):not(#checkoutDialog *):not(#paymentSuccessDialog):not(#paymentSuccessDialog *)
    > :is(.head, .dialog-head, .modal-head, .edit-heading, .modal-title, .closed-head, .p66-window-head, .cons-window-head, .db-import-head, header)
    :is(.wm-expand, .pos-window-control, .stable-close, .stable-maximize, button[data-close], button[id^="close"], button[id*="Close"], .wm-actions > button),
  .cot-window > .title .cot-window-controls > button {
    box-sizing: border-box !important;
    width: var(--window-control-size) !important;
    min-width: var(--window-control-size) !important;
    height: var(--window-control-size) !important;
    min-height: var(--window-control-size) !important;
    padding: 0 !important;
    flex: 0 0 var(--window-control-size);
  }
  .window-frame-context { flex-shrink: 0; padding: 6px 16px; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
  .window-frame-context > :is(p, .product-eyebrow) { margin: 0 !important; color: inherit !important; }
  .window-frame-context:has(> p:only-child:empty) { display: none; }
  /* Tamaños iniciales por función; la expansión conserva su área completa. */
  @media (min-width: 1024px) and (pointer: fine) {
    #startDialog:not(.wm-expanded) { width: min(720px, calc(100vw - 24px)) !important; }
    #quoteCustomerDialog:not(.wm-expanded) { width: min(480px, calc(100vw - 24px)) !important; }
    #emailDialog:not(.wm-expanded) { width: min(690px, calc(100vw - 24px)) !important; }
  }
  @media (max-width: 1023px), (pointer: coarse) {
    :root { --window-heading-height: 56px; --window-control-size: 44px; }
  }
  /* A narrow desktop child iframe is still a desktop window. Cot detail shells copy owner CSS. */
  html.window-frame-desktop, body.cot-desktop { --window-heading-height: 48px; --window-control-size: 32px; }
  /* Existing light choice cards need their original ink even under OLED text inheritance. */
  #startDialog .choice-card, #startDialog .choice-card :is(b, strong) { color: var(--q-ink, var(--ink, #18344c)) !important; }
  #startDialog .choice-card small { color: var(--q-softink, var(--muted, #526b81)) !important; }
  .report-print-context { display: none; }
}
@media print {
  .report-print-context { display: block; font-size: 11px; margin: 6px 0; }
  /* Action buttons have no paper result: remove their whole column, including the heading. */
  #reportTable:has(.detail-button) :is(th, td):last-child { display: none !important; }
}
