:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 88px;
    --app-bg: #f4f6f9;
    --sidebar-bg: #111827;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #2563eb;
    --business-table-bg: #08295a;
    --sidebar-motion: .75s cubic-bezier(.22, 1, .36, 1);
}

body {
    min-height: 100vh;
    background: var(--app-bg);
    color: #111827;
    font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 12px;
}

.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .14), transparent 34rem),
        linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
}

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1.5rem;
}

.auth-card {
    width: min(100%, 430px);
    padding: 2rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .12);
    backdrop-filter: blur(12px);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-bottom: 1.6rem;
}

.auth-brand-mark {
    display: inline-grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: var(--business-table-bg);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 800;
}

.auth-brand h1 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
}

.auth-brand p {
    margin: .1rem 0 0;
    color: #64748b;
    font-weight: 600;
}

.auth-form .form-label {
    color: #334155;
    font-weight: 700;
}

.auth-input-group {
    position: relative;
}

.auth-input-group .bi {
    position: absolute;
    top: 50%;
    left: .9rem;
    color: #64748b;
    transform: translateY(-50%);
}

.auth-input-group .form-control {
    min-height: 42px;
    padding-left: 2.55rem;
    border-color: #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 12px;
}

.auth-input-group .form-control:focus {
    border-color: var(--business-table-bg);
    box-shadow: 0 0 0 .18rem rgba(13, 110, 253, .13);
}

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    width: 100%;
    min-height: 42px;
    border-radius: 8px;
    background: var(--business-table-bg);
    border-color: var(--business-table-bg);
    font-weight: 800;
}

.auth-submit:hover,
.auth-submit:focus {
    background: #061f45;
    border-color: #061f45;
}

.swal2-popup {
    border-radius: 8px;
    font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 1rem;
}

.swal2-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.swal2-html-container {
    font-size: 1rem;
}

.app-shell {
    min-height: 100vh;
    overflow-x: hidden;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg) !important;
    z-index: 1030;
    transition: width var(--sidebar-motion);
    overflow-x: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 42px;
}

.brand-link {
    min-width: 0;
    max-width: 205px;
    flex: 1 1 auto;
    overflow: hidden;
    opacity: 1;
    transform: translateX(0);
    transition: max-width var(--sidebar-motion), opacity .45s ease, transform var(--sidebar-motion);
}

.brand-mark {
    flex: 0 0 auto;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--sidebar-active);
    transition: margin-right var(--sidebar-motion), opacity .45s ease, transform var(--sidebar-motion);
}

.brand-title,
.nav-label,
.user-name {
    display: inline-block;
    max-width: 180px;
    opacity: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transform: translateX(0);
    transition: max-width var(--sidebar-motion), opacity .45s ease, transform var(--sidebar-motion);
}

.sidebar-toggle {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    padding: 0;
    border-color: rgba(255, 255, 255, .35);
    transition: transform var(--sidebar-motion), border-color .2s ease, background-color .2s ease;
}

.sidebar .nav-link,
.mobile-sidebar .nav-link {
    display: flex;
    align-items: center;
    width: 100%;
    border-radius: 8px;
    border: 0;
    background: transparent;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow: hidden;
    transition: background-color .2s ease, color .2s ease;
}

.sidebar > .nav {
    width: calc(var(--sidebar-width) - 2rem);
}

.sidebar .nav-link .bi,
.sidebar-avatar {
    transition: margin-right var(--sidebar-motion), transform var(--sidebar-motion);
}

.sidebar .nav-link:not(.active):hover,
.mobile-sidebar .nav-link:not(.active):hover {
    background: rgba(255, 255, 255, .12);
}

.sidebar .nav-link.active,
.mobile-sidebar .nav-link.active {
    background: var(--sidebar-active);
}

.sidebar-dropdown-toggle {
    padding: var(--bs-nav-link-padding-y) var(--bs-nav-link-padding-x);
    text-align: left;
}

.sidebar-dropdown-arrow {
    flex: 0 0 auto;
    font-size: .8rem;
    transition: transform .22s ease;
}

.sidebar-dropdown-toggle[aria-expanded="true"] .sidebar-dropdown-arrow {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: .25rem;
    margin-left: 1rem;
    gap: .2rem;
    width: calc(var(--sidebar-width) - 3rem);
    min-width: calc(var(--sidebar-width) - 3rem);
}

.sidebar-submenu.collapse:not(.show) {
    display: none;
}

.sidebar-submenu.collapse.show,
.sidebar-submenu.collapsing {
    display: grid !important;
    grid-template-columns: 1fr;
}

.sidebar-submenu .nav-item {
    display: block;
    width: 100%;
}

.sidebar-submenu .nav-link {
    padding-left: 1rem;
    font-size: .95em;
    background: rgba(255, 255, 255, .06);
    min-width: 100%;
}

.sidebar-submenu .nav-link.active {
    background: rgba(255, 255, 255, .18);
}

.sidebar-avatar {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0ecff;
    color: #1d4ed8;
    font-size: .75rem;
    font-weight: 700;
}

.user-theme-menu {
    width: 285px;
    padding: .5rem 0;
}

.theme-menu-title {
    display: block;
    color: #fff;
    font-size: .9rem;
    font-weight: 700;
}

.user-theme-menu .form-label {
    color: #dbe4f0;
}

.theme-option-label {
    display: block;
    margin-bottom: .45rem;
    color: #dbe4f0;
    font-size: .78rem;
    font-weight: 600;
}

.theme-color-options {
    display: flex;
    gap: .5rem;
}

.theme-color-btn {
    width: 34px;
    height: 34px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-radius: 8px;
}

.theme-color-btn.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .22);
}

.theme-pink {
    background: #d63384;
}

.dropdown-toggle {
    outline: 0;
}

.bi {
    vertical-align: -.125em;
    pointer-events: none;
}

.main-panel {
    min-height: 100vh;
    min-width: 0;
    transition: margin-left var(--sidebar-motion);
}

.topbar {
    position: sticky;
    top: 0;
    min-height: 72px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid #e5e7eb;
    backdrop-filter: blur(12px);
    z-index: 1020;
}

.notification-btn {
    border: 1px solid #e5e7eb;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .65rem .35rem .35rem;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    font-weight: 600;
}

.user-avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e0ecff;
    color: #1d4ed8;
    font-size: .8rem;
}

.content-area {
    min-height: calc(100vh - 72px);
    min-width: 0;
    overflow-x: hidden;
}

.app-breadcrumb {
    align-items: center;
    min-height: 32px;
    padding: .45rem .75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
    font-size: 12px;
}

.app-breadcrumb a {
    color: var(--business-table-bg);
    font-weight: 600;
    text-decoration: none;
}

.app-breadcrumb a:hover {
    text-decoration: underline;
}

.app-breadcrumb .breadcrumb-item.active {
    color: #64748b;
    font-weight: 600;
}

.welcome-panel,
.metric-card,
.content-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
}

.welcome-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
}

.metric-card {
    display: grid;
    gap: .35rem;
    padding: 1.1rem;
}

.metric-card strong {
    font-size: 1.8rem;
    line-height: 1;
}

.metric-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    margin-bottom: .5rem;
    font-size: 1.25rem;
}

.content-card {
    padding: 1.25rem;
    min-width: 0;
}

.config-entry-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 100%;
    min-height: 132px;
    padding: 1.15rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.config-entry-card:hover,
.config-entry-card:focus {
    border-color: var(--business-table-bg);
    color: #111827;
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, .08);
}

.config-entry-icon {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: rgba(13, 110, 253, .1);
    color: var(--business-table-bg);
    font-size: 1.3rem;
}

.config-entry-content {
    display: grid;
    gap: .25rem;
    min-width: 0;
}

.config-entry-content strong {
    font-size: .95rem;
    font-weight: 800;
}

.config-entry-content small {
    color: #64748b;
    font-weight: 600;
    line-height: 1.45;
}

.config-entry-arrow {
    margin-left: auto;
    color: #94a3b8;
    font-size: 1.45rem;
}

.config-placeholder {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 680px;
}

.permission-inline-box {
    min-height: 38px;
    max-height: 92px;
    overflow: auto;
    padding: .5rem .65rem;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    background: #fff;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .85rem;
}

.permission-module {
    min-height: 100%;
    padding: .85rem;
    border: 1px solid #e5e7eb;
    border-radius: .5rem;
    background: #f8fafc;
}

.content-card .dt-container {
    width: 100%;
    min-width: 0;
}

.content-card .dt-scroll,
.content-card .dt-scroll-head,
.content-card .dt-scroll-body,
.content-card .dt-scroll-foot {
    width: 100% !important;
}

.content-card .dt-scroll-headInner {
    min-width: 100%;
}

.content-card .dt-layout-row {
    align-items: center;
    gap: .75rem;
    margin: 0 0 .8rem;
}

.content-card .dt-layout-row:last-child {
    margin: .9rem 0 0;
}

.content-card .dt-layout-cell {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.content-card .dt-layout-cell.dt-layout-end {
    justify-content: flex-end;
}

.content-card .dt-length label,
.content-card .dt-search label,
.content-card .dt-info {
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.content-card .dt-search input,
.content-card .dt-length select {
    min-height: 34px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background-color: #f8fafc;
    color: #111827;
    font-size: 12px;
    box-shadow: none;
}

.content-card .dt-search input:focus,
.content-card .dt-length select:focus {
    border-color: var(--business-table-bg);
    box-shadow: 0 0 0 .16rem rgba(13, 110, 253, .12);
}

.content-card .dt-search input {
    min-width: 240px;
}

.content-card table.dataTable {
    width: 100% !important;
    margin-top: .5rem !important;
    margin-bottom: 0 !important;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.content-card table.dataTable th,
.content-card table.dataTable td {
    text-align: center !important;
    vertical-align: middle;
    border-color: #e5e7eb;
    font-size: 12px;
    white-space: nowrap;
}

.content-card table.dataTable thead th {
    background: var(--business-table-bg);
    color: #fff;
    border-color: rgba(255, 255, 255, .18);
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.content-card table.dataTable tbody td {
    padding: .62rem .75rem;
}

.content-card table.dataTable tbody tr:nth-child(even) td {
    background-color: #f8fafc;
}

.content-card table.dataTable tbody tr:hover td {
    background-color: rgba(13, 110, 253, .08);
}

#prefacturasTable th.prefactura-factura-start,
#prefacturasTable td.prefactura-factura-start,
#provisionTable th.prefactura-factura-start,
#provisionTable td.prefactura-factura-start,
#cobranzaTable th.prefactura-factura-start,
#cobranzaTable td.prefactura-factura-start {
    border-left: 4px solid var(--business-table-bg) !important;
}

#prefacturasTable td.prefactura-factura-start,
#prefacturasTable td.prefactura-factura-start ~ td,
#provisionTable td.prefactura-factura-start,
#provisionTable td.prefactura-factura-start ~ td,
#cobranzaTable td.prefactura-factura-start,
#cobranzaTable td.prefactura-factura-start ~ td {
    background-color: #f8fbff;
}

#prefacturasTable tbody tr:nth-child(even) td.prefactura-factura-start,
#prefacturasTable tbody tr:nth-child(even) td.prefactura-factura-start ~ td,
#provisionTable tbody tr:nth-child(even) td.prefactura-factura-start,
#provisionTable tbody tr:nth-child(even) td.prefactura-factura-start ~ td,
#cobranzaTable tbody tr:nth-child(even) td.prefactura-factura-start,
#cobranzaTable tbody tr:nth-child(even) td.prefactura-factura-start ~ td {
    background-color: #eef6ff;
}

#prefacturasTable tbody tr:hover td.prefactura-factura-start,
#prefacturasTable tbody tr:hover td.prefactura-factura-start ~ td,
#provisionTable tbody tr:hover td.prefactura-factura-start,
#provisionTable tbody tr:hover td.prefactura-factura-start ~ td,
#cobranzaTable tbody tr:hover td.prefactura-factura-start,
#cobranzaTable tbody tr:hover td.prefactura-factura-start ~ td {
    background-color: rgba(13, 110, 253, .12);
}

.content-card table.dataTable .badge {
    min-width: 74px;
    border-radius: 999px;
    padding: .38rem .55rem;
    font-weight: 700;
}

.content-card .dt-scroll-body {
    border: 1px solid #e5e7eb !important;
    border-top: 0 !important;
    border-radius: 0 0 8px 8px;
}

.content-card .dt-scroll-head {
    border-radius: 8px 8px 0 0;
}

.content-card .dt-paging .pagination {
    gap: .25rem;
    margin-bottom: 0;
}

.content-card .dt-paging .page-link {
    min-width: 32px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    box-shadow: none;
}

.content-card .dt-paging .page-item.active .page-link {
    background: var(--business-table-bg);
    border-color: var(--business-table-bg);
    color: #fff;
}

.content-card .dt-paging .page-item.disabled .page-link {
    color: #94a3b8;
    background: #f8fafc;
}

.app-stat-card,
.prefactura-summary-card,
.dashboard-amount-card,
.client-summary-box {
    height: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
    overflow: hidden;
}

.app-stat-card .card-header,
.prefactura-summary-card .card-header,
.dashboard-amount-card .card-header,
.client-summary-box .card-header {
    min-height: 46px;
    background: #fff;
    color: #64748b;
    border-bottom: 1px solid #e5e7eb;
    font-size: .78rem;
    font-weight: 700;
}

.app-stat-card .card-body,
.prefactura-summary-card .card-body,
.dashboard-amount-card .card-body,
.client-summary-box .card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .9rem 1rem;
}

.app-stat-icon,
.prefactura-summary-icon,
.dashboard-amount-icon {
    color: var(--business-table-bg);
    font-size: 1.45rem;
}

.app-stat-card strong,
.prefactura-summary-card strong,
.dashboard-amount-card strong,
.client-summary-box strong {
    color: #111827;
    font-size: 1.35rem;
    line-height: 1;
}

.app-accordion {
    display: grid;
    gap: .85rem;
}

.app-accordion .accordion-item {
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .04);
}

.app-accordion .accordion-button {
    min-height: 46px;
    background: #fff;
    color: #111827;
    font-size: 12px;
    font-weight: 700;
    box-shadow: none;
}

.app-accordion .accordion-button:not(.collapsed) {
    background: var(--business-table-bg);
    color: #fff;
}

.app-accordion .accordion-button:focus {
    box-shadow: none;
}

.app-accordion .accordion-button:not(.collapsed)::after {
    filter: brightness(0) invert(1);
}

.app-accordion .accordion-body {
    padding: 1rem;
    min-width: 0;
}

.app-accordion .content-card {
    border: 0;
    box-shadow: none;
    padding: 0;
}

.dashboard-amount-card strong {
    display: block;
    font-size: 1.55rem;
    margin-bottom: .35rem;
}

.dashboard-amount-card span,
.client-summary-box span {
    display: block;
    color: #64748b;
    font-size: .78rem;
    font-weight: 500;
    margin-top: .35rem;
}

.prefactura-lines-popover {
    --bs-popover-max-width: 380px;
    --bs-popover-border-color: #d8dee8;
    --bs-popover-header-bg: var(--business-table-bg);
    --bs-popover-header-color: #fff;
}

.prefactura-lines-popover .popover-body {
    max-height: 320px;
    overflow-y: auto;
    min-width: 320px;
}

.prefactura-actions-popover {
    --bs-popover-max-width: 260px;
    --bs-popover-border-color: #d8dee8;
    --bs-popover-header-bg: var(--business-table-bg);
    --bs-popover-header-color: #fff;
}

.prefactura-actions-popover .popover-body {
    min-width: 220px;
}

.prefactura-actions-popover-body {
    display: grid;
    gap: .5rem;
}

.prefactura-lines-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    white-space: nowrap;
    padding: .2rem 0;
}

.prefactura-lines-item strong {
    font-weight: 700;
}

.dashboard-chart-header {
    margin-bottom: 1rem;
}

.dashboard-chart-header h2 {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
}

.dashboard-chart-box {
    position: relative;
    min-height: 320px;
}

.dashboard-chart-box-wide {
    min-height: 380px;
}

.dashboard-chart-box-pie {
    max-width: 420px;
    margin: 0 auto;
}

.client-status-panel {
    height: 100%;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

.client-status-panel h2 {
    margin-bottom: .85rem;
    font-size: .95rem;
    font-weight: 700;
}

.comercial-detail-panel,
.comercial-chart-panel {
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.client-status-list {
    display: grid;
    gap: .6rem;
}

.client-status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem .75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.client-status-item span {
    color: #334155;
    font-weight: 600;
}

.client-status-item strong {
    color: #111827;
}

.content-card table.dataTable thead > tr > th {
    position: relative !important;
    padding-left: 2rem !important;
    padding-right: 2rem !important;
    text-align: center !important;
    white-space: nowrap;
}

.content-card table.dataTable thead > tr > th .dt-column-title {
    display: block;
    width: 100%;
    padding: 0;
    text-align: center;
}

.content-card table.dataTable thead > tr > th .dt-column-order {
    position: absolute !important;
    top: 50% !important;
    right: .65rem !important;
    left: auto !important;
    width: 14px !important;
    height: 18px !important;
    margin: 0 !important;
    transform: translateY(-50%) !important;
}

.select2-container--default .select2-selection--single {
    min-height: 38px;
    border: 1px solid #dee2e6;
    border-radius: .375rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 36px;
    padding-left: .75rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
}

.prefactura-modal-dialog {
    max-width: min(1500px, calc(100vw - 1.5rem));
}

.prefactura-modal-dialog .modal-content {
    max-height: calc(100vh - 1rem);
}

.factura-modal-dialog {
    max-width: min(1250px, calc(100vw - 1.5rem));
}

.prefactura-modal-dialog .modal-body {
    max-height: calc(100vh - 10.5rem);
    overflow-y: auto;
    padding: 1rem;
}

.prefactura-modal-dialog .modal-footer {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: #fff;
    gap: .75rem;
}

.prefactura-footer-total {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.prefactura-footer-total .form-control {
    width: 180px;
}

.prefactura-form-footer {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

#prefacturaFormContainer,
#prefacturaFormContainer .form-control,
#prefacturaFormContainer .form-select,
#prefacturaFormContainer .btn,
#prefacturaFormContainer .select2-container,
#prefacturaFormContainer .select2-selection__rendered,
#prefacturaFormContainer .business-lines-table,
#prefacturaFormContainer .business-week-input {
    font-size: 12px;
}

.prefactura-form-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
    gap: .75rem;
    flex-wrap: wrap;
}

.prefactura-status-field {
    display: flex;
    align-items: center;
    gap: .65rem;
    width: min(380px, 100%);
}

.prefactura-status-field .form-label {
    margin-bottom: 0;
    white-space: nowrap;
}

.prefactura-status-field .form-select {
    min-width: 220px;
}

#observacionesPrefactura {
    min-height: 120px;
    resize: vertical;
}

.business-lines-table-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

.business-lines-table-wrapper {
    margin-top: .5rem;
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid #d8dee8;
    border-radius: 8px;
}

.business-lines-table {
    width: max-content;
    min-width: 0;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    font-size: 1rem;
}

.business-lines-table th,
.business-lines-table td {
    border-right: 1px solid #d8dee8;
    border-bottom: 1px solid #d8dee8;
    padding: .4rem .5rem;
    vertical-align: middle;
}

.business-lines-table th:last-child,
.business-lines-table td:last-child {
    border-right: 0;
}

.business-lines-table tbody tr:last-child th,
.business-lines-table tbody tr:last-child td {
    border-bottom: 0;
}

.business-lines-table thead th {
    background: var(--business-table-bg);
    color: #fff;
    font-weight: 700;
    text-align: center;
}

.business-lines-table thead th:first-child {
    text-align: center;
}

.business-lines-table tbody th {
    width: 320px;
    color: #111827;
    font-weight: 500;
}

.business-lines-table tbody td {
    width: 220px;
}

.business-division-row th {
    background: #f1f5f9;
    color: var(--business-table-bg) !important;
    font-weight: 700 !important;
    letter-spacing: .01em;
    text-align: center;
}

.business-lines-table .business-week-input {
    width: 195px;
    min-height: 38px;
    padding: .375rem .75rem;
    border-radius: .375rem;
    font-size: 1rem;
}

.business-total-row th {
    font-weight: 700 !important;
}

.invoice-section {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    background: #fff;
}

.invoice-section-title {
    margin-bottom: 1rem;
    font-weight: 700;
}

.cobranza-info-card span {
    display: block;
    color: #64748b;
    font-size: .78rem;
    font-weight: 600;
    margin-bottom: .2rem;
}

.cobranza-info-card strong {
    display: block;
    color: #111827;
    font-size: .9rem;
    font-weight: 700;
    word-break: break-word;
}

.cobranza-lines-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .5rem;
}

.cobranza-lines-list > div {
    padding: .5rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.task-list {
    display: grid;
    gap: .75rem;
}

.task-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .8rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
}

.mobile-sidebar {
    background: var(--sidebar-bg);
    color: #fff;
    width: var(--sidebar-width);
}

.mobile-sidebar .btn-close {
    filter: invert(1);
}

@media (min-width: 992px) {
    .main-panel {
        margin-left: var(--sidebar-width);
    }

    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    body.sidebar-collapsed .main-panel {
        margin-left: var(--sidebar-collapsed-width);
    }

    body.sidebar-collapsed .sidebar > .nav {
        width: calc(var(--sidebar-collapsed-width) - 2rem);
    }

    body.sidebar-collapsed .sidebar .nav-link {
        position: relative;
        justify-content: center;
        width: 40px;
        min-height: 40px;
        margin-right: auto;
        margin-left: auto;
        padding-left: 0;
        padding-right: 0;
    }

    body.sidebar-collapsed .brand-title {
        max-width: 0;
        opacity: 0;
        transform: translateX(-14px);
    }

    body.sidebar-collapsed .nav-label,
    body.sidebar-collapsed .user-name {
        max-width: 0;
        opacity: 0;
        transform: translateX(-14px);
    }

    body.sidebar-collapsed .sidebar .nav-label {
        display: none;
    }

    body.sidebar-collapsed .sidebar .user-name {
        display: none;
    }

    body.sidebar-collapsed .sidebar .brand-mark,
    body.sidebar-collapsed .sidebar .sidebar-avatar,
    body.sidebar-collapsed .sidebar .nav-link .bi {
        margin: 0 !important;
    }

    body.sidebar-collapsed .sidebar .nav-link .bi {
        position: absolute;
        top: 50%;
        left: 50%;
        display: block;
        width: 16px;
        height: 16px;
        line-height: 16px;
        text-align: center;
        transform: translate(-50%, -50%);
    }

    body.sidebar-collapsed .sidebar > .dropdown {
        width: calc(var(--sidebar-collapsed-width) - 2rem);
        display: flex;
        justify-content: center;
    }

    body.sidebar-collapsed .sidebar #dropdownUserDesktop {
        justify-content: center;
        width: 40px;
        min-height: 40px;
        margin-right: auto;
        margin-left: auto;
    }

    body.sidebar-collapsed .brand-link {
        max-width: 0;
        opacity: 0;
        pointer-events: none;
        transform: translateX(-16px);
    }

    body.sidebar-collapsed .sidebar-toggle {
        transform: translateX(-1px);
    }

    body.sidebar-collapsed .sidebar .dropdown-toggle::after {
        display: none;
    }

    body.sidebar-collapsed .sidebar-dropdown-arrow {
        display: none;
        opacity: 0;
    }

    body.sidebar-collapsed .sidebar-submenu {
        display: none !important;
        width: 0;
        min-width: 0;
        height: 0;
        margin: 0;
        overflow: hidden;
    }
}

@media (max-width: 575.98px) {
    .welcome-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .welcome-panel .btn {
        width: 100%;
    }

    .content-card {
        padding: 1rem;
    }

    .content-card .dt-layout-row {
        align-items: stretch;
        flex-direction: column;
    }

    .content-card .dt-layout-cell,
    .content-card .dt-layout-cell.dt-layout-end {
        justify-content: flex-start;
        width: 100%;
    }

    .content-card .dt-search input,
    .content-card .dt-length select {
        width: 100%;
        min-width: 0;
    }

    .table:not(.dataTable) {
        min-width: 620px;
    }
}
