/**
 * Compact desktop density
 *
 * Laptops using OS display scaling often expose a desktop viewport between
 * 1024px and 1600px. Keep the desktop information architecture in that range,
 * but use a denser type and spacing scale. Mobile and large desktop keep their
 * existing rules.
 */
@media (min-width: 1024px) and (max-width: 1600px) {
  :root {
    --olen-compact-sidebar: 224px;
    --olen-compact-space-1: 4px;
    --olen-compact-space-2: 8px;
    --olen-compact-space-3: 12px;
    --olen-compact-space-4: 16px;
    --olen-compact-space-5: 20px;
    --olen-compact-control-height: 40px;
    --olen-compact-table-x: 14px;
    --olen-compact-table-y: 11px;

    --tamano_stat_number: 28px;
    --tamano_h1: 22px;
    --tamano_h2: 17px;
    --tamano_h3: 17px;
    --tamano_h4: 18px;
    --tamano_h5: 16px;
    --tamano_h6: 18px;
    --tamano_texto: 13px;
    --tamano_texto_pequeno: 12px;
    --tamano_texto_badge: 11px;
  }

  html {
    font-size: 13px;
  }

  body,
  button,
  input,
  optgroup,
  select,
  textarea {
    font-size: var(--tamano_texto);
  }

  /* Application shell and common navigation. */
  body:not(.olen-password-change-required) aside.sidenav-main,
  body:not(.olen-password-change-required) #slide-out.sidenav {
    width: var(--olen-compact-sidebar) !important;
  }

  body:not(.olen-password-change-required) #main {
    padding-left: var(--olen-compact-sidebar) !important;
  }

  body:not(.olen-password-change-required) .nav-lock ~ footer {
    padding-left: calc(var(--olen-compact-sidebar) + 7px) !important;
  }

  body.sp-toogle aside.sidenav-main,
  body.sp-toogle #slide-out.sidenav {
    width: 50px !important;
  }

  body.sp-toogle #main {
    padding-left: 50px !important;
  }

  .brand-sidebar-olen {
    box-sizing: border-box;
    height: 56px !important;
    padding: 8px 18px 2px !important;
  }

  .brand-sidebar-olen .avatar-status-olen {
    height: 34px !important;
    margin-right: 10px !important;
    width: 34px !important;
  }

  .brand-sidebar-olen .profile-button-olen span:not(.avatar-status-olen) {
    font-size: 14px !important;
    line-height: 20px !important;
  }

  #slide-out.sidenav,
  ul#slide-out.sidenav {
    box-sizing: border-box;
    height: calc(100vh - 56px) !important;
    padding: 8px 8px 16px !important;
    top: 56px !important;
  }

  .sidenav-active-rounded #slide-out.sidenav li a.collapsible-header,
  .sidenav-active-rounded #slide-out.sidenav li > a {
    font-size: 13px !important;
    height: 34px !important;
    line-height: 20px !important;
    margin-left: 2px !important;
    margin-right: 2px !important;
    min-height: 34px !important;
    padding: 7px 9px !important;
    width: auto !important;
  }

  #slide-out.sidenav li.menu-item-type-custom.menu-item-object-custom > a,
  #slide-out.sidenav li.menu-item-type-custom.menu-item-object-custom > a:hover {
    font-size: 10px !important;
    line-height: 16px !important;
    min-height: 0 !important;
    padding: 10px 10px 4px !important;
  }

  #slide-out.sidenav li.olen-shop-visits-toggle > ul.sub-menu {
    margin-bottom: 4px;
  }

  #slide-out.sidenav li.olen-shop-visits-toggle > ul.sub-menu > li > a {
    font-size: 13px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding-bottom: 5px !important;
    padding-top: 5px !important;
  }

  #slide-out.sidenav .icon-menu {
    flex-basis: 17px !important;
    height: 17px !important;
    margin-right: 10px !important;
    width: 17px !important;
  }

  #slide-out.sidenav .icon-menu svg {
    height: 17px !important;
    min-height: 17px !important;
    min-width: 17px !important;
    width: 17px !important;
  }

  /* Shared content rhythm and type hierarchy. */
  #main .main-content {
    box-sizing: border-box;
    padding: 16px 18px;
  }

  #main .page-header-container {
    margin-bottom: 24px;
  }

  #main .page-title {
    font-size: var(--tamano_h1) !important;
    line-height: 30px;
    padding-left: 8px;
  }

  #main .app-breadcrumb .breadcrumb {
    padding-left: 8px;
  }

  #main .app-breadcrumb .breadcrumb-item,
  #main .app-breadcrumb .breadcrumb-item a.breadcrumb-link,
  #main .app-breadcrumb .breadcrumb-item.active,
  #main .main-content li,
  #main .text-normal,
  #main .text-table-id {
    font-size: var(--tamano_texto) !important;
    line-height: 20px;
  }

  #main .card {
    margin-bottom: var(--olen-compact-space-4);
  }

  #main .card .card-content,
  #main .content-section,
  #main .overview-card,
  #main .operator-card {
    padding: 18px;
  }

  #main .card-title-main {
    margin-left: 18px;
    margin-right: 18px;
  }

  #main .card-title-main.status-overview,
  #main .wrapper.dashboarrd .card-title-main.table-shop-visit {
    margin-bottom: var(--olen-compact-space-4);
  }

  #main .row {
    margin-bottom: var(--olen-compact-space-4);
  }

  #main .row .col {
    padding-left: 8px;
    padding-right: 8px;
  }

  #main .row.container,
  #main .container {
    padding-left: 4px;
    padding-right: 4px;
  }

  /* Shared controls. Keep specialised editors and upload controls intact. */
  #main .search-input,
  #main .filter-button,
  #main .filter-input,
  #main .filter-select,
  #main input.form-control,
  #main select.browser-default:not(.document-status-select),
  #main .select2-container--default .select2-selection--single {
    box-sizing: border-box;
    font-size: var(--tamano_texto) !important;
    height: var(--olen-compact-control-height) !important;
    min-height: var(--olen-compact-control-height);
  }

  #main .search-input {
    padding-bottom: 8px;
    padding-top: 8px;
  }

  #main .filter-button {
    padding-left: 16px;
    padding-right: 16px;
  }

  #main .filter-input,
  #main .filter-select {
    padding: 10px 12px;
  }

  #main .btn-new-visit,
  #main .btn-metrics-print,
  #main button.oscuro,
  #main button.claro,
  #main button.add {
    font-size: var(--tamano_texto);
    min-height: 36px;
  }

  #main .search-filter-container {
    gap: 12px;
    margin: 0 16px 14px;
  }

  #main .results-count {
    margin: 0 16px 12px;
  }

  /* Shared operational tables and pagination. */
  body table.table,
  body table.dataTable,
  body table.ag-table,
  body table.portfolio-template-table,
  body table.role-table,
  body table#organization_list_dashboard,
  body table.responsive-table,
  body table.llp-table {
    font-size: var(--tamano_texto);
  }

  body table.table > thead > tr > th,
  body table.table > thead > tr > td,
  body table.dataTable > thead > tr > th,
  body table.dataTable > thead > tr > td,
  body table.ag-table > thead > tr > th,
  body table.ag-table > thead > tr > td,
  body table.portfolio-template-table > thead > tr > th,
  body table.portfolio-template-table > thead > tr > td,
  body table.role-table > thead > tr > th,
  body table.role-table > thead > tr > td,
  body table#organization_list_dashboard > thead > tr > th,
  body table#organization_list_dashboard > thead > tr > td,
  body table.responsive-table > thead > tr > th,
  body table.responsive-table > thead > tr > td,
  body table.llp-table > thead > tr > th,
  body table.llp-table > thead > tr > td,
  body .dataTables_scrollHead table.dataTable > thead > tr > th,
  body .dataTables_scrollHead table.dataTable > thead > tr > td {
    font-size: var(--tamano_texto) !important;
    line-height: 20px !important;
    padding: var(--olen-compact-table-y) var(--olen-compact-table-x) !important;
  }

  body table.table > tbody > tr > th,
  body table.table > tbody > tr > td,
  body table.dataTable > tbody > tr > th,
  body table.dataTable > tbody > tr > td,
  body table.ag-table > tbody > tr > th,
  body table.ag-table > tbody > tr > td,
  body table.portfolio-template-table > tbody > tr > th,
  body table.portfolio-template-table > tbody > tr > td,
  body table.role-table > tbody > tr > th,
  body table.role-table > tbody > tr > td,
  body table#organization_list_dashboard > tbody > tr > th,
  body table#organization_list_dashboard > tbody > tr > td,
  body table.responsive-table > tbody > tr > th,
  body table.responsive-table > tbody > tr > td,
  body table.llp-table > tbody > tr > th,
  body table.llp-table > tbody > tr > td {
    font-size: var(--tamano_texto) !important;
    line-height: 20px;
    padding: var(--olen-compact-table-y) var(--olen-compact-table-x) !important;
  }

  body #finance .dataTables_scrollHead table.dataTable > thead > tr,
  body #finance .dataTables_scrollHead table.dataTable > thead > tr > th,
  body #finance .dataTables_scrollHead table.dataTable > thead > tr > td,
  body .finance_inner #finance_list > thead > tr > th {
    height: 44px !important;
    padding-bottom: 0 !important;
    padding-top: 0 !important;
  }

  body .dataTables_wrapper > .table-footer,
  body .table-footer,
  body .portfolio-template-pagination {
    font-size: var(--tamano_texto);
    min-height: 48px;
  }

  body .table-footer .pagination-controls button,
  body .portfolio-template-pagination button,
  body .olen-table-overflow {
    height: 32px;
    min-width: 32px;
    width: 32px;
  }

  /* Dashboard and Metrics share the same cards and chart primitives. */
  #main .dashboard-grid {
    gap: var(--olen-compact-space-4);
  }

  #main .stat-card .card-content,
  #main .tat-card .card-content {
    padding: 18px;
  }

  #main .stat-value,
  #main .stat-tat .tat-value,
  #main .wrapper.metrics .number-stat {
    line-height: 38px;
  }

  #main .stat-header {
    margin-bottom: 4px;
    margin-top: 10px;
  }

  #main .wrapper.metrics .stat-card .card-content.stat-averages {
    height: 140px;
  }

  #main .wrapper.metrics .average-info-stat,
  #main .wrapper.metrics .text-muted-small.text-disabled {
    font-size: var(--tamano_texto);
    line-height: 20px;
  }

  #main .wrapper.metrics .flex-container-stat.filter-header-metrics,
  #main .wrapper.metrics .flex-container-stat.filter-header-metrics-sv {
    margin-bottom: var(--olen-compact-space-4);
  }

  #main .wrapper.metrics .flex-container-stat.filter-header-metrics.c-stats-filter {
    margin-top: var(--olen-compact-space-4);
  }

  #main .wrapper.metrics .flex-items-stat-title .stat-title {
    font-size: 16px !important;
    line-height: 24px;
  }

  #main .wrapper.metrics .flex-container-leyend {
    gap: 12px;
    margin: 16px 16px 0;
  }

  #main .wrapper.metrics .card-content.inside-customer,
  #main .wrapper.metrics .card-content.inside-shop-visits,
  #main .wrapper.metrics .card-content.inside-green1,
  #main .wrapper.metrics .card-content.inside-green2,
  #main .wrapper.metrics .card-content.inside-red {
    height: 184px;
  }

  #main .wrapper.metrics .row.container.customer-totals {
    margin-top: 24px;
  }

  #main .wrapper.metrics .row .col.stat-customers-filter {
    height: 400px;
    padding-left: 16px;
    padding-right: 12px;
  }

  #main .wrapper.metrics .shop-visits-overview-row {
    gap: var(--olen-compact-space-4);
    margin-bottom: var(--olen-compact-space-5);
  }

  #main .wrapper.metrics .shop-visits-overview-side {
    flex-basis: calc(33.3333333333% - 11px);
    gap: var(--olen-compact-space-4);
  }

  #main .wrapper.metrics .shop-visits-overview-side .card-content.green_up,
  #main .wrapper.metrics .shop-visits-overview-side .card-content.red_down {
    padding: 16px 20px !important;
  }

  #main .card-content.green_up,
  #main .card-content.red_down {
    gap: 12px;
  }

  #main .card-content.green_up span.principal,
  #main .card-content.red_down span.principal {
    font-size: 21px;
  }

  #main .card-content.green_up span.secundario,
  #main .card-content.red_down span.secundario {
    font-size: var(--tamano_texto);
  }

  /* Shop Visit keeps its desktop composition with narrower local navigation. */
  #main .wrapper.shop-visit .page-header-container.active-list > .flex-container.row {
    gap: 16px;
  }

  #main .wrapper.shop-visit .sv-header-actions {
    gap: 10px;
  }

  #main .wrapper.shop-visit .sv-header-actions > .btn-flat,
  #main .wrapper.shop-visit .sv-header-actions > .btn-new-visit,
  #main .wrapper.shop-visit .sv-header-actions > .olen-layout-notification-slot {
    height: 36px;
  }

  #main .wrapper.shop-visit .sv-header-actions > button.btn-flat.finish-shop-visit-text {
    min-width: 142px;
  }

  #main .custom-tabs {
    margin-bottom: var(--olen-compact-space-4);
    padding: 0 8px;
  }

  #main .custom-tab-list {
    gap: 18px;
  }

  #main .custom-tab {
    font-size: var(--tamano_texto);
    margin: 0 4px;
    padding: 6px 3px;
  }

  #main #main-page-tabs .custom-tab-list {
    /* Keep section labels visually distinct on Windows-scaled laptops. */
    gap: 16px;
  }

  #main .wrapper.shop-visit #main-page-tabs .custom-tab-list {
    /* Give the longer Shop Visit navigation more breathing room on compact screens. */
    gap: clamp(24px, 2vw, 32px);
  }

  #main #main-page-tabs .custom-tab {
    flex: 0 0 auto;
    margin-left: 0;
    margin-right: 0;
    max-width: none;
    min-width: max-content;
    width: auto !important;
  }

  #main .overview-card {
    margin-bottom: var(--olen-compact-space-4);
  }

  #main .overview-card.engine-details,
  #main .row .overview-card.img-overview {
    height: 292px;
  }

  #main .detail-list li {
    font-size: var(--tamano_texto);
    line-height: 20px;
    margin-bottom: 10px;
  }

  #main .operator-card-parties.has-lessor {
    gap: 20px;
  }

  #main .operator-card-parties .operator-party,
  #main .operator-content {
    gap: 12px;
  }

  #main .section-layout {
    column-gap: 24px;
    grid-template-columns: 220px minmax(0, 1fr);
  }

  #main .section-sidebar {
    min-width: 220px;
    width: 220px;
  }

  #main .section-nav {
    gap: 6px;
    padding: 10px;
  }

  #main .section-nav__item {
    font-size: var(--tamano_texto);
    gap: 9px;
    height: 40px;
    min-height: 40px;
    padding: 0 11px;
  }

  #main .section-nav__item img,
  #main .section-nav__item svg,
  #main .section-nav__item .maintenance-nav-icon {
    flex-basis: 20px;
    height: 20px;
    width: 20px;
  }

  #main #finding .findings-actions #new-finding.add {
    font-size: var(--tamano_texto);
    gap: 7px;
    height: 40px;
    min-height: 40px;
    padding: 0 14px;
  }

  /* Documents: preserve the card language while using the available width. */
  body #documentation .documentation-card-shell {
    padding: 0 20px 24px;
  }

  body #documentation .doc-root,
  body #documentation .doc-direction-panel {
    gap: 14px;
  }

  body #documentation .doc-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  body #documentation .doc-tools {
    flex: 1 1 0;
    gap: 8px;
    min-width: 0;
  }

  body #documentation .doc-direction-toggle {
    min-height: 36px;
  }

  body #documentation .doc-direction-button {
    min-width: 104px;
    padding-left: 14px;
    padding-right: 14px;
  }

  body #documentation .doc-status-filters {
    flex: 1 1 auto;
    min-width: 0;
  }

  body #documentation .doc-root .status-tag {
    min-height: 30px;
    padding: 5px 9px;
  }

  body #documentation .doc-root .doc-search {
    flex: 0 1 240px !important;
    height: 36px;
    min-width: 190px !important;
    width: 240px !important;
  }

  body #documentation .doc-root .doc-search input {
    height: 34px !important;
  }

  body #documentation .doc-slot-grid {
    gap: 10px;
  }

  body #documentation .doc-section {
    gap: 9px;
  }

  body #documentation .doc-slot-card-header {
    min-height: 46px;
    padding: 8px 11px;
  }

  body #documentation .doc-root .doc-slot-card h4 {
    font-size: 13px !important;
    line-height: 18px;
  }

  body #documentation .doc-slot-card-body {
    padding: 8px 11px 11px;
  }

  body #documentation .doc-root .doc-file-chip {
    gap: 10px !important;
    min-height: 48px !important;
    padding: 7px 10px !important;
  }

  body #documentation .doc-root .doc-file-actions {
    gap: 3px;
    height: 32px;
    padding-left: 8px;
  }

  body #documentation .doc-root .doc-file-actions a,
  body #documentation .doc-root .doc-file-actions button,
  body #documentation .doc-root .doc-file-delete {
    flex-basis: 28px !important;
    height: 28px;
    min-height: 28px;
    min-width: 28px;
    width: 28px;
  }

  body #documentation .doc-dropzone {
    min-height: 52px;
    padding: 9px;
  }

  /* Modal chrome is denser; scrollable bodies continue to own overflow. */
  body .adpn_modal_header {
    padding: 18px;
  }

  body .adpn_modal_botton {
    padding-left: 18px;
    padding-right: 18px;
  }

  body .adpn_modal_botton button {
    margin-bottom: 12px;
    margin-top: 12px;
  }

  body .adpn_modal_content.modal_responsive {
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
  }

  body .adpn_modal.document-preview-overlay {
    padding: 20px !important;
  }

  body .adpn_modal.document-preview-overlay > .adpn_modal_content.document-preview-modal {
    height: calc(100vh - 80px);
    height: calc(100dvh - 80px);
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
    max-width: calc(100vw - 80px);
    width: min(1320px, calc(100vw - 80px));
  }
}
