/* ===================================
   AIOSA ERP - ESTILOS DE APLICACIÓN
   =================================== */

:root {
    --color-primary: #B22234;
    --color-primary-dark: #8B1A2B;
    --color-secondary: #346CB0;
    --color-secondary-dark: #1460BD;
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ff8b07;
    --color-info: #17a2b8;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --sidebar-bg: #B22234;
    --sidebar-text: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active: rgba(255, 255, 255, 0.2);
    --header-bg: #B22234;
    --header-text: #ffffff;
    --transition-speed: 0.3s;
}

body.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3d3d3d;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --border-color: #495057;
    --sidebar-bg: #1a1a1a;
    --sidebar-text: #f8f9fa;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --sidebar-active: rgba(178, 34, 52, 0.3);
    --header-bg: #2d2d2d;
}

/* Forzar carga de fuente Font Awesome Brands */
body::after {
    font-family: "Font Awesome 6 Brands";
    content: "";
    display: none;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    overflow: hidden;
}

.bank-statement-summary-status {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.bank-statement-summary-status.is-success {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.08);
    color: #166534;
}

body.dark-mode .bank-statement-summary-status.is-success {
    border-color: rgba(74, 222, 128, 0.45);
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

.bank-statement-summary-status.is-warning {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.08);
    color: #92400e;
}

body.dark-mode .bank-statement-summary-status.is-warning {
    border-color: rgba(251, 191, 36, 0.45);
    background: rgba(245, 158, 11, 0.18);
    color: #fcd34d;
}

.bank-statement-summary-status.is-error {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
    color: #991b1b;
}

body.dark-mode .bank-statement-summary-status.is-error {
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
}

.bank-statement-table-cell-text {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--form-disabled);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#bankTransactionsPreviewTable {
    table-layout: fixed;
}

#bankTransactionsPreviewTable th:nth-child(1),
#bankTransactionsPreviewTable td:nth-child(1) {
    width: 8%;
}

#bankTransactionsPreviewTable th:nth-child(2),
#bankTransactionsPreviewTable td:nth-child(2) {
    width: 32%;
}

#bankTransactionsPreviewTable th:nth-child(3),
#bankTransactionsPreviewTable td:nth-child(3),
#bankTransactionsPreviewTable th:nth-child(4),
#bankTransactionsPreviewTable td:nth-child(4),
#bankTransactionsPreviewTable th:nth-child(5),
#bankTransactionsPreviewTable td:nth-child(5) {
    width: 9%;
}

#bankTransactionsPreviewTable th:nth-child(6),
#bankTransactionsPreviewTable td:nth-child(6) {
    width: 33%;
}

#bankTransactionsPreviewTable td:nth-child(2) .bank-statement-table-cell-text {
    white-space: normal;
    min-height: 68px;
}

.bank-statement-table-cell-text.is-date,
.bank-statement-table-cell-text.is-amount {
    text-align: center;
}

.bank-statement-table-cell-text.is-deposit {
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: var(--text-primary);
    font-weight: 700;
}

.bank-statement-table-cell-text.is-withdrawal {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--text-primary);
    font-weight: 700;
}

body.dark-mode .bank-statement-table-cell-text.is-deposit {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(74, 222, 128, 0.35);
    color: var(--text-primary);
}

body.dark-mode .bank-statement-table-cell-text.is-withdrawal {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(248, 113, 113, 0.35);
    color: var(--text-primary);
}

.bank-statement-table-cell-text.is-reference {
    text-align: left;
}

.bank-statement-display-field {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding-right: 12px;
    color: var(--text-primary);
    background-color: var(--form-disabled);
    cursor: default;
}

.bank-statement-display-field:empty::before {
    content: attr(data-placeholder);
    color: var(--text-secondary);
    opacity: 0.7;
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background-color: var(--header-bg);
    color: var(--header-text);
    display: flex;
    align-items: center;
    padding: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 18px;
    font-weight: bold;
    color: var(--header-text);
    text-decoration: none;
    width: 200px;
    padding: 0 20px;
    height: 50px;
    flex-shrink: 0;
}

.app-logo i {
    font-size: 24px;
}

.app-logo img {
    height: 50px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

.menu-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--header-text);
    background: none;
    border: none;
    font-size: 18px;
    margin-left: 8px;
    margin-right: 8px;
    flex-shrink: 0;
}

.menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.header-search {
    position: relative;
    width: 350px;
    flex-shrink: 1;
    min-width: 150px;
}

.header-search input {
    width: 100%;
    padding: 8px 15px 8px 40px;
    border: none;
    border-radius: 7px;
    background-color: white;
    color: #333;
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
    font-size: 13px;
}

.header-search input::placeholder {
    color: #999;
}

.header-search > i.fa-search {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    padding-right: 20px;
}

.header-dropdown {
    position: relative;
}

.header-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--header-text);
    background-color: rgba(255, 255, 255, 0.15);
    border: none;
    position: relative;
    font-size: large;
}

.header-icon:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--color-danger);
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
    transition: transform 0.3s ease;
}

/* Animación de pulse para nuevas notificaciones */
.notification-badge.pulse {
    animation: badge-pulse 1.5s ease-in-out 4;
}

@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background-color: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 320px;
    max-width: 400px;
    z-index: 2001;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--bg-primary);
}

.dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-menu-wide {
    min-width: 380px;
}

.dropdown-menu-right::before {
    right: 30px;
    border-bottom-color: var(--color-primary);
}

/* Triángulo que apunta al header rojo del usuario - con gradiente */
#userMenu::before {
    border: none;
    width: 16px;
    height: 8px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    top: -8px;
    right: 28px;
}

.dropdown-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 600;
}

.dropdown-body {
    max-height: 400px;
    overflow-y: auto;
}

.dropdown-body::-webkit-scrollbar {
    width: 6px;
}

.dropdown-body::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.dropdown-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
}

.dropdown-item:hover {
    background-color: var(--bg-secondary);
}

.dropdown-item.unread {
    background-color: rgba(178, 34, 52, 0.05);
    border-left-color: var(--color-primary);
}

.dropdown-item.unread:hover {
    background-color: rgba(178, 34, 52, 0.12);
    border-left-color: var(--color-primary);
}

.dropdown-item.logout-item:hover {
    background-color: rgba(220, 53, 69, 0.1);
}

.dropdown-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-primary);
    font-size: 16px;
}

.dropdown-icon.avatar-icon {
    overflow: hidden;
    background-color: var(--bg-tertiary);
}

.dropdown-icon.avatar-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropdown-icon.avatar-icon i {
    font-size: 24px;
    color: var(--text-secondary);
}

.dropdown-content {
    flex: 1;
    min-width: 0;
}

.dropdown-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.dropdown-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-time {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.8;
}

.dropdown-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.dropdown-footer a {
    color: var(--color-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.2s;
}

.dropdown-footer a:hover {
    color: var(--color-secondary-dark);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 8px 0;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 15px;
}

.settings-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 10px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.settings-item:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--color-primary);
    transform: translateY(-3px);
}

.settings-item i {
    font-size: 28px;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.settings-item span {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.user-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-radius: 8px 8px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.user-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid white;
    overflow: hidden;
    background-color: white;
}

.user-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-details {
    text-align: center;
}

.user-name-large {
    font-size: 16px;
    font-weight: bold;
    color: white;
    margin-bottom: 3px;
}

.user-email {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

.dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: transparent;
    z-index: 1999;
    display: none;
}

.dropdown-overlay.show {
    display: block;
}

/* Asegurar que el overlay solo aparezca en móvil */
@media (min-width: 769px) {
    .dropdown-overlay {
        display: none !important;
    }
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 10px;
    transition: background-color 0.2s;
    background-color: rgba(255, 255, 255, 0.15);
}

.user-profile:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar i {
    font-size: 16px;
    color: var(--header-text);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: bold;
    line-height: 1.2;
}

.user-role {
    font-size: 10px;
    opacity: 0.9;
    line-height: 1.2;
}

.app-sidebar {
    position: fixed;
    top: 50px;
    left: 0;
    width: 200px;
    height: calc(100vh - 50px);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    overflow-y: hidden;
    overflow-x: hidden;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 900;
    display: flex;
    flex-direction: column;
}

.app-sidebar.collapsed {
    width: 60px;
}

.app-sidebar::-webkit-scrollbar {
    width: 6px;
}

.app-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar-section {
    padding: 15px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Cuando sidebar está colapsado: eliminar padding y border de las secciones */
.app-sidebar.collapsed .sidebar-section {
    padding: 0;
    border-bottom: none;
}

.sidebar-section-title {
    padding: 8px 20px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    opacity: 0.7;
    letter-spacing: 0.5px;
    transition: opacity var(--transition-speed);
    white-space: nowrap;
}

.app-sidebar.collapsed .sidebar-section-title {
    opacity: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-item {
    position: relative;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background-color 0.2s;
    cursor: pointer;
    white-space: nowrap;
}


.sidebar-link:hover {
    background-color: var(--sidebar-hover);
}

.sidebar-link.active {
    background-color: var(--sidebar-active);
    border-left: 3px solid var(--sidebar-text);
    padding-left: 17px;
}

.sidebar-link i {
    width: 20px;
    font-size: 16px;
    margin-right: 12px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link span {
    flex: 1;
    font-size: 13px;
    transition: opacity var(--transition-speed);
}

.app-sidebar.collapsed .sidebar-link span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-link .fas.fa-chevron-right {
    font-size: 10px;
    margin-left: auto;
    margin-right: 0;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.app-sidebar.collapsed .sidebar-link .fas.fa-chevron-right {
    display: none;
}

.sidebar-item.expanded .sidebar-link .fas.fa-chevron-right {
    transform: rotate(90deg);
}

.sidebar-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background-color: rgba(0, 0, 0, 0.1);
}

.sidebar-item.expanded .sidebar-submenu {
    max-height: 500px;
}

.sidebar-submenu .sidebar-link {
    padding-left: 52px;
    font-size: 12px;
}

/* Cuando sidebar está colapsado: mostrar todos los iconos de submenú */
.app-sidebar.collapsed .sidebar-submenu {
    max-height: none;
    overflow: visible;
    background-color: transparent;
}

.app-sidebar.collapsed .sidebar-submenu .sidebar-link {
    padding-left: 20px;
    padding-right: 20px;
    justify-content: center;
}

.app-sidebar.collapsed .sidebar-submenu .sidebar-link span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.app-sidebar.collapsed .sidebar-submenu .sidebar-link i {
    margin-right: 0;
}

.app-sidebar.collapsed .sidebar-item.has-submenu > .sidebar-link {
    display: none;
}

.sidebar-tooltip {
    position: absolute;
    left: 65px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.sidebar-tooltip::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 4px 4px 4px 0;
    border-style: solid;
    border-color: transparent #333 transparent transparent;
}

.app-sidebar.collapsed .sidebar-item:hover .sidebar-tooltip {
    opacity: 1;
}

.sidebar-footer {
    flex-shrink: 0;
    padding: 15px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--sidebar-bg);
}


.theme-toggle {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}


.theme-toggle:hover {
    background-color: var(--sidebar-hover);
}

.theme-toggle i {
    width: 20px;
    font-size: 16px;
    margin-right: 12px;
    text-align: center;
    flex-shrink: 0;
}

.theme-toggle span {
    flex: 1;
    font-size: 13px;
    transition: opacity var(--transition-speed);
}

.app-sidebar.collapsed .theme-toggle span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.app-content {
    margin-left: 200px;
    margin-top: 50px;
    padding: 20px;
    min-height: calc(100vh - 50px);
    transition: margin-left var(--transition-speed);
    overflow-x: hidden;
}

.app-sidebar.collapsed + .app-content {
    margin-left: 60px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    padding: 0 0;
    margin-bottom: 10px;
    font-size: 13px;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.breadcrumb-item a {
    color: var(--color-secondary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--text-primary);
    gap: 10px;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    margin: 0 8px;
    color: var(--text-secondary);
}

.card {
    background-color: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 15px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    border-radius: 0 0 8px 8px;
}

.dashboard-card {
    background-color: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.dashboard-card-icon {
    font-size: 32px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.dashboard-card-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.dashboard-card-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.btn-icon.btn-view {
    background-color: var(--color-info);
    color: white;
}

.btn-icon.btn-view:hover {
    background-color: #138496;
}

.btn-icon.btn-edit {
    background-color: var(--color-secondary);
    color: white;
}

.btn-icon.btn-edit:hover {
    background-color: var(--color-secondary-dark);
}

.btn-icon.btn-delete {
    background-color: var(--color-danger);
    color: white;
}

.btn-icon.btn-delete:hover {
    background-color: #c82333;
}

.btn-icon.btn-enable {
    background-color: var(--color-warning);
    color: white;
}

.btn-icon.btn-enable:hover {
    background-color: #e07906;
}

.btn-icon.btn-reset {
    background-color: var(--color-success);
    color: white;
}

.btn-icon.btn-reset:hover {
    background-color: #218838;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 12px;
    text-transform: uppercase;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.badge-primary {
    background-color: #f5d6d9;
    color: #5a1219;
}

/* ========================================================================
   Toast Notifications para Auto-Refresh
   ======================================================================== */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 10px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: all;
    transform: translateX(calc(100% + 20px));
    opacity: 0;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(calc(100% + 20px));
    opacity: 0;
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-icon.task {
    color: var(--color-info);
}

.toast-icon.reminder {
    color: var(--color-warning);
}

.toast.success {
    border-left-color: #1f8f58;
}

.toast.error {
    border-left-color: #c93c37;
}

.toast.warning {
    border-left-color: #d79a1e;
}

.toast.info,
.toast.task {
    border-left-color: var(--color-info);
}

.toast.reminder {
    border-left-color: var(--color-warning);
}

.toast-icon.success {
    color: #1f8f58;
}

.toast-icon.error {
    color: #c93c37;
}

.toast-icon.warning {
    color: #d79a1e;
}

.toast-icon.info {
    color: var(--color-info);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .toast-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .toast {
        min-width: auto;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    body {
        overflow: auto;
    }
    /*
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.mobile-open {
        transform: translateX(0);
    }*/

    .app-content {
        margin-left: 0;
        overflow: visible;
        max-height: none;
    }

    /* Header responsive */
    .app-logo {
        width: auto;
        padding: 0 10px;
    }

    .app-logo img {
        height: 40px;
        max-width: 120px;
    }

    .menu-toggle {
        margin-left: 4px;
        margin-right: 4px;
    }

    .header-search {
        flex: 1;
        max-width: none;
        min-width: 0;
        margin: 0 8px;
    }

    .header-search input {
        padding: 6px 35px 6px 35px;
        font-size: 12px;
    }

    .header-search > i.fa-search {
        left: 10px;
        font-size: 12px;
    }

    .header-actions {
        gap: 4px;
        padding-right: 10px;
    }

    .header-icon {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .user-profile {
        padding: 5px 8px;
    }

    .user-info {
        display: none;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
    }

    /* Dropdowns responsive en móvil */
    .dropdown-menu {
        position: fixed;
        left: 10px;
        right: 10px;
        top: 60px !important;
        bottom: auto;
        max-width: none;
        min-width: 0;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        transform: none !important;
    }

    .dropdown-menu::before {
        display: none;
    }

    .dropdown-menu.show {
        transform: none !important;
    }

    .dropdown-menu-wide {
        min-width: 0;
    }

    .dropdown-header {
        padding: 12px 15px;
    }

    .dropdown-header h4 {
        font-size: 14px;
    }

    .dropdown-item {
        padding: 10px 15px;
    }

    .dropdown-icon {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .dropdown-title {
        font-size: 13px;
    }

    .dropdown-text {
        font-size: 12px;
    }

    .settings-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 12px;
    }

    .settings-item {
        padding: 15px 8px;
    }

    .settings-item i {
        font-size: 24px;
    }

    .settings-item span {
        font-size: 11px;
    }

    .user-header {
        padding: 15px;
    }

    .user-avatar-large {
        width: 50px;
        height: 50px;
    }

    .user-name-large {
        font-size: 14px;
    }

    .user-email {
        font-size: 12px;
    }

    .notification-badge {
        font-size: 9px;
        padding: 1px 4px;
        min-width: 16px;
    }
}

/* Tablet responsivo */
@media (max-width: 1200px) and (min-width: 769px) {
    .app-logo {
        width: 150px;
        padding: 0 15px;
    }

    .app-logo img {
        height: 45px;
    }

    .header-search {
        width: 250px;
    }

    .header-actions {
        gap: 8px;
        padding-right: 15px;
    }

    .header-icon {
        width: 38px;
        height: 38px;
    }

    /* Dropdowns en tablet */
    .dropdown-menu {
        min-width: 300px;
    }

    .dropdown-menu-wide {
        min-width: 350px;
    }

    .settings-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .settings-item {
        padding: 18px 10px;
    }

    .settings-item i {
        font-size: 26px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 480px) {
    .app-header {
        padding: 0;
    }

    .app-logo {
        padding: 0 8px;
    }

    .app-logo img {
        height: 35px;
        max-width: 100px;
    }

    .menu-toggle {
        width: 32px;
        height: 32px;
        margin-left: 2px;
        margin-right: 2px;
        font-size: 16px;
    }

    .header-search {
        margin: 0 4px;
    }

    .header-search input {
        padding: 5px 35px 5px 30px;
        font-size: 11px;
    }

    .header-search > i.fa-search {
        left: 8px;
        font-size: 11px;
    }

    .header-actions {
        gap: 2px;
        padding-right: 8px;
    }

    .header-icon {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    /* Ocultar botones menos importantes en móviles pequeños */
    .header-icon:not(:last-of-type) {
        display: none;
    }

    .user-avatar {
        width: 26px;
        height: 26px;
    }

    /* Dropdowns en móviles muy pequeños */
    .dropdown-menu {
        left: 5px;
        right: 5px;
        top: 55px !important;
        max-height: calc(100vh - 70px);
    }

    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        padding: 10px;
    }

    .settings-item {
        padding: 12px 6px;
    }

    .settings-item i {
        font-size: 20px;
        margin-bottom: 6px;
    }

    .settings-item span {
        font-size: 10px;
    }

    .dropdown-header {
        padding: 10px 12px;
    }

    .dropdown-item {
        padding: 8px 12px;
        gap: 10px;
    }

    .dropdown-footer {
        padding: 10px 12px;
    }
}

/* ===================================
   RESPONSIVE - PÁGINA DE LOGIN
   =================================== */

/* Tablet (768px - 991px) */
@media (max-width: 991px) and (min-width: 769px) {
    .login-container {
        padding: 35px;
        max-width: 380px;
    }

    .login-logo img {
        max-width: 180px;
    }

    .login-title {
        font-size: 22px;
    }
}

/* Móvil (hasta 768px) */
@media (max-width: 768px) {
    body.login-page {
        padding: 15px;
    }

    .login-container {
        padding: 30px 20px;
        max-width: 100%;
    }

    .login-logo img {
        max-width: 150px;
    }

    .login-title {
        font-size: 20px;
    }

    .login-subtitle {
        font-size: 13px;
        margin-bottom: 25px;
    }

    .btn-login {
        padding: 14px;
        font-size: 15px;
    }

    .form-group {
        margin-bottom: 18px;
    }
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -10px;
    margin-right: -10px;
}

[class*="col-"] {
    position: relative;
    width: 100%;
    padding: 0 5px;
    box-sizing: border-box;
}

.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

@media (min-width: 768px) {
    .col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-9 { flex: 0 0 75%; max-width: 75%; }
}

@media (min-width: 992px) {
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
    .col-lg-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
    .col-lg-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
}

.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1.5rem; }

/* ===================================
   PÁGINA DE LOGIN
   =================================== */

/* Estilos específicos para la página de login */
body.login-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
}

/* Contenedor principal del formulario de login */
.login-container {
    background-color: var(--bg-primary);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
    transition: box-shadow 0.3s ease;
}

.login-container:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Área del logo de la empresa */
.login-logo {
    margin-bottom: 30px;
}

.login-logo img {
    max-width: 200px;
    height: auto;
    transition: transform 0.3s ease;
}

.login-logo img:hover {
    transform: scale(1.05);
}

/* Título principal de bienvenida */
.login-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
}

/* Subtítulo descriptivo */
.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.4;
}

/* Contenedor del formulario de login */
.login-form {
    text-align: left;
}

/* Área de acciones del formulario (botones) */
.form-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

/* Botón principal de inicio de sesión */
.btn-login {
    width: 100%;
    padding: 12px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-login:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(178, 34, 52, 0.3);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(178, 34, 52, 0.2);
}

.btn-login:disabled {
    background-color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Mensajes de error y éxito del login */
.login-error-message,
.login-success-message {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-error-message {
    background-color: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

.login-error-message i {
    font-size: 18px;
}

.login-success-message {
    background-color: #efe;
    color: #0a0;
    border: 1px solid #cfc;
}

.login-success-message i {
    font-size: 18px;
}

/* Errores de campo */
.control-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.field-error {
    position: absolute;
    bottom: -18px;
    left: 2px;
    color: #c00;
    font-size: 12px;
    display: none;
}

.form-control.error {
    border-color: #c00 !important;
}

.form-control.error:focus {
    border-color: #c00 !important;
    box-shadow: 0 0 0 3px rgba(204, 0, 0, 0.1) !important;
}

/* Modal de recuperación de contraseña */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-container {
    background-color: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex: 0 0 auto;
    background-color: var(--bg-primary);
    position: relative;
    z-index: 1;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 20px;
    padding: 4px 8px;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--color-primary);
}

.modal-body {
    padding: 24px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-description {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 0;
    padding: 20px 24px 24px;
    border-top: 1px solid var(--border-color);
    flex: 0 0 auto;
    background-color: var(--bg-primary);
    position: relative;
    z-index: 1;
}

.modal-container-default {
    max-width: 560px;
}

.modal-container-wide {
    max-width: 900px;
}

.modal-header-copy {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.modal-form {
    display: block;
}

.modal-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}

.modal-field-span-2 {
    grid-column: 1 / -1;
}

.modal-helper-text {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.5;
}

.modal-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-left: 12px;
    padding-right: 45px;
}

.modal-field .control-wrapper {
    position: relative;
}

.modal-field .form-control {
    background-color: var(--bg-primary);
}

.modal-container-readonly .modal-field .form-control,
.modal-container-readonly .modal-field .select-display {
    border-color: transparent !important;
    box-shadow: none !important;
    background-color: transparent !important;
}

.modal-container-readonly .modal-field .form-control[readonly] {
    padding-right: 32px;
}

.modal-container-readonly .modal-field .select-arrow,
.modal-container-readonly .modal-field .icon-container {
    display: none !important;
}

.modal-icon-container {
    gap: 1px;
}

.modal-icon-container .form-icon {
    color: var(--icon-color);
    font-size: 16px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-clear-btn {
    background: none;
    border: none;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--icon-color);
    cursor: pointer;
}

.modal-clear-btn i {
    pointer-events: none;
}

.modal-clear-btn:hover {
    color: var(--icon-color);
    opacity: 0.8;
}

.modal-select-wrapper .icon-container {
    right: 10px;
}

.modal-custom-select .select-value:not(.has-value) {
    color: var(--text-secondary);
    opacity: 0.6;
}

.modal-select-chevron {
    pointer-events: none;
    font-size: 12px;
}

.modal-info-list {
    display: grid;
    gap: 12px;
}

.modal-info-row {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.modal-info-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.modal-info-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.modal-info-value {
    color: var(--text-primary);
    font-size: 14px;
    word-break: break-word;
}

body.modal-open {
    overflow: hidden;
}

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(178, 34, 52, 0.3);
}

.btn-primary:disabled {
    background-color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
    opacity: 0.6;
}

.forgot-password-error,
.forgot-password-success {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

.forgot-password-error {
    background-color: #fee;
    color: #c00;
    border: 1px solid #fcc;
}

.forgot-password-error i {
    font-size: 18px;
}

.forgot-password-success {
    background-color: #efe;
    color: #0a0;
    border: 1px solid #cfc;
}

.forgot-password-success i {
    font-size: 18px;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-container {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-actions {
        flex-direction: column-reverse;
        padding: 16px 20px 20px;
    }

}

/* Sección de "¿Olvidaste tu contraseña?" */
.forgot-password {
    text-align: center;
    margin-top: 20px;
}

.forgot-password a {
    color: var(--color-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
    font-weight: 500;
}

.forgot-password a:hover {
    color: var(--color-secondary-dark);
    text-decoration: underline;
}

/* Footer del formulario de login */
.login-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.login-footer p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

/* ===================================
   ESTILOS GENÉRICOS PARA ENTIDADES (CLIENTES, PROVEEDORES, ETC.)
   =================================== */

.entity-layout {
    display: flex;
    height: calc(100vh - 50px);
    background-color: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.entity-sidebar {
    width: 350px;
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    max-height: calc(100vh - 50px);
    transition: width 0.3s ease, margin-left 0.3s ease;
    position: relative;
}

/* En móvil: sidebar se oculta completamente */
.entity-sidebar.collapsed {
    width: 0;
    margin-left: -350px;
    overflow: hidden;
}

/* Ocultar el botón toggle cuando está colapsado - se mostrará el botón flotante */
.entity-sidebar.collapsed .btn-toggle-sidebar {
    display: none;
}

/* En tablet/escritorio: sidebar se oculta completamente mostrando solo el espacio para el botón */
@media (min-width: 769px) {
    .entity-sidebar.collapsed {
        width: 0;
        margin-left: 0;
        overflow: visible;
    }

    /* Ocultar todo el contenido del sidebar cuando está colapsado */
    .entity-sidebar.collapsed .entity-sidebar-header,
    .entity-sidebar.collapsed .entity-list,
    .entity-sidebar.collapsed .btn-add-entity-floating {
        display: none;
    }
}

.entity-sidebar-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-search-input {
    position: relative;
    flex: 1;
}

.header-search-input input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
    font-size: 14px;
    transition: all 0.3s ease;
}

.header-search-input input:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: var(--bg-primary);
}

.header-search-input i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 1;
}

.header-search-input .search-clear {
    left: auto;
    right: 15px;
    pointer-events: auto;
    font-size: 14px;
}

.entity-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0 120px;
    scroll-padding-bottom: 120px;
}

.entity-list::-webkit-scrollbar {
    width: 6px;
}

.entity-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.entity-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.entity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
}

.entity-item:hover {
    background-color: var(--bg-secondary);
}

.entity-item.active {
    background-color: rgba(178, 34, 52, 0.05);
    border-left-color: var(--color-primary);
}

.entity-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.entity-info {
    flex: 1;
    min-width: 0;
}

.entity-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entity-status-deleted {
    font-size: 10px;
    font-weight: 700;
    color: #B22234;
}

.entity-location {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.entity-secondary-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.entity-main {
    flex: 1;
    background-color: var(--bg-primary);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 50px);
    overflow: hidden;
}

.entity-main::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.entity-main::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.entity-main::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.entity-main::-webkit-scrollbar-corner {
    background: var(--bg-secondary);
}

.entity-header {
    background-color: var(--bg-primary);
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.entity-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.entity-title-section {
    flex: 1;
}

.entity-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.entity-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.entity-actions {
    display: flex;
    gap: 10px;
}

.btn-primary,
.btn-secondary {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(178, 34, 52, 0.2);
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: white;
    border: none;
}

.btn-secondary:hover {
    background-color: var(--color-secondary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 108, 176, 0.2);
}

.entity-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    flex-shrink: 0;
    background-color: var(--bg-primary);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.entity-tabs.tabs-fit-desktop {
    overflow-x: visible;
}

.entity-tabs.tabs-fit-desktop::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.entity-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.entity-tabs.tabs-fit-desktop .entity-tab {
    flex: 0 0 auto;
    text-align: center;
    white-space: nowrap;
}

.entity-tab:hover {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.entity-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.entity-content {
    padding: 25px;
    background-color: var(--bg-secondary);
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.entity-content::-webkit-scrollbar {
    width: 8px;
}

.entity-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.entity-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.hide-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.hide-scrollbar::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

@media (min-width: 1400px) {
    .entity-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.entity-card {
    background-color: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.entity-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.entity-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.entity-card-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.entity-card-title i {
    color: var(--color-primary);
}

.entity-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-info-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.card-info-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card-info-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: bold;
}

/* Sección de tabla genérica (contacts, invoices, quotes, etc.) */
.table-section {
    background-color: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 40px;
}

/* Header de tabla genérica */
.table-section-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Título de tabla genérica */
.table-section-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-section-title i {
    color: var(--color-primary);
}

/* Acciones de tabla genérica */
.table-section-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Búsqueda en tabla genérica */
.table-section-search {
    position: relative;
    width: 250px;
}

.table-section-search input {
    width: 100%;
    padding: 8px 15px 8px 35px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
    font-size: 13px;
}

.table-section-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 12px;
}

/* Wrapper de tabla genérica */
.table-section-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px;
    position: relative;
}

/* Tabla genérica */
.table-section-table {
    width: 100%;
    border-collapse: collapse;
}

.table-section-table thead {
    background-color: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-section-table th {
    padding: 12px 25px;
    text-align: left;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    background-color: var(--bg-secondary);
    position: sticky;
    top: 0;
}

.table-sort-button {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: inherit;
    text-align: left;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.table-sort-button i {
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 12px;
}

.table-sort-button.active i {
    color: var(--primary-color);
}

.table-section-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.table-section-table tbody tr:hover {
    background-color: var(--bg-secondary);
}

.table-section-table td {
    padding: 10px 25px;
    font-size: 14px;
    color: var(--text-primary);
    text-align: left;
    vertical-align: middle;
}

.table-section-cell-name {
    font-weight: 600;
}

.table-section-cell-actions {
    display: flex;
    gap: 8px;
}

/* Escritorio grande - 1201px en adelante */
@media (min-width: 1201px) {
    .table-section-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .table-section-title {
        width: auto;
    }

    .table-section-actions {
        width: auto;
        flex-direction: row;
        gap: 10px;
    }

    .table-section-search {
        width: 250px;
    }

    .table-section-actions .btn-primary,
    .table-section-actions .btn-secondary {
        width: auto;
    }
}

@media (max-width: 1200px) {
    .entity-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Tablet y pantallas medianas - hasta 1200px */
@media (max-width: 1200px) {
    .entity-sidebar {
        width: 280px;
    }

    .entity-header {
        padding: 15px 20px;
    }

    .entity-title {
        font-size: 20px;
    }

    .entity-content {
        padding: 20px;
    }

    .entity-grid {
        grid-template-columns: 1fr;
    }

    /* Tabs con scroll horizontal en tablet */
    .entity-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .entity-tabs.tabs-fit-desktop {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .entity-tabs.tabs-fit-desktop .entity-tab {
        flex: 0 0 auto;
        text-align: left;
    }

    .entity-tab {
        white-space: nowrap;
    }

    /* Ajustes para tablas en tablet */
    .table-section-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .table-section-title {
        width: 100%;
        order: 1;
    }

    .table-section-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
        order: 2;
    }

    .table-section-search {
        width: 100%;
        order: 1;
    }

    .table-section-actions .btn-primary,
    .table-section-actions .btn-secondary {
        width: 100%;
        justify-content: center;
        order: 2;
    }
}

@media (max-width: 768px) {
    .entity-layout {
        flex-direction: column;
        border-radius: 8px;
        height: auto;
        min-height: calc(100vh - 50px);
        position: relative;
    }

    .entity-sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
        position: fixed;
        top: 50px;
        left: 0;
        right: 0;
        z-index: 1000;
        max-height: 50vh;
        transition: transform 0.3s ease;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .entity-sidebar.collapsed {
        transform: translateY(-100%);
        display: flex;
    }

    .entity-list {
        flex: 1;
        max-height: 300px;
        overflow-y: auto;
    }

    .entity-main {
        max-height: none;
        min-height: calc(100vh - 50px);
        flex: 1;
        overflow-y: visible;
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    /* Asegurar que entity-main mantenga estructura cuando sidebar está colapsado */
    .entity-sidebar.collapsed ~ .entity-main {
        max-height: none;
        min-height: calc(100vh - 50px);
        flex: 1;
        overflow-y: visible;
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .entity-content {
        padding: 15px;
        overflow-y: visible;
        overflow-x: hidden;
        max-height: none;
        flex: 1;
    }

    .entity-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .entity-card {
        padding: 15px;
    }

    /* Botón toggle flotante cuando sidebar está colapsado en móvil */
    .entity-sidebar.collapsed .btn-toggle-sidebar {
        position: fixed;
        left: 15px;
        top: 70px;
        z-index: 1001;
    }

    /* Ocultar el botón flotante de agregar cuando el sidebar está visible en móvil */
    .entity-sidebar:not(.collapsed) .btn-add-entity-floating {
        display: flex;
    }

    /* Botón flotante más pequeño en móvil */
    .btn-add-entity-floating {
        width: 48px;
        height: 48px;
        bottom: 70px;
        right: 15px;
        font-size: 18px;
    }

    /* Botón de mostrar sidebar en móvil - barra horizontal arriba solo con flecha */
    .entity-sidebar.collapsed ~ .entity-main .btn-show-sidebar-floating {
        display: flex;
        position: static;
        margin: 0 0 10px 0;
        width: 100%;
        height: 44px;
        border-radius: 0;
        border: none;
        border-right: none;
        background-color: var(--bg-tertiary);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        justify-content: center;
        z-index: 10;
        writing-mode: horizontal-tb;
        padding: 0;
    }

    .entity-sidebar.collapsed ~ .entity-main .btn-show-sidebar-floating span {
        display: none !important;
    }

    .entity-sidebar.collapsed ~ .entity-main .btn-show-sidebar-floating i {
        transform: rotate(90deg);
        font-size: 18px;
        color: var(--text-primary);
    }

    .entity-sidebar.collapsed ~ .entity-main .btn-show-sidebar-floating:hover {
        background-color: var(--bg-secondary);
        width: 100%;
    }

    /* NO aplicar padding-left en móvil */
    .entity-sidebar.collapsed ~ .entity-main {
        padding-left: 0;
    }

    .entity-header-top {
        flex-direction: column;
        gap: 15px;
    }

    .entity-actions {
        width: 100%;
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .entity-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .entity-tabs.tabs-fit-desktop {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .entity-tabs.tabs-fit-desktop .entity-tab {
        flex: 0 0 auto;
        text-align: left;
    }

    .entity-tab {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
    }


    .table-section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .table-section-actions {
        width: 100%;
        flex-direction: column;
    }

    .table-section-search {
        width: 100%;
    }

    .table-section-table {
        font-size: 12px;
    }

    .table-section-table th,
    .table-section-table td {
        padding: 10px 15px;
    }
}

/* Estilos adicionales para mejoras */
.entity-title i {
    color: var(--color-primary);
    font-size: 22px;
}

.entity-subtitle i {
    font-size: 13px;
}

.btn-card-edit {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.btn-card-edit:hover {
    background-color: var(--color-secondary);
    color: white;
    border-color: var(--color-secondary);
    transform: scale(1.08);
}

.card-info-link {
    font-size: 14px;
    color: var(--color-secondary);
    text-decoration: none;
    transition: color 0.2s;
    word-break: break-all;
}

.card-info-link:hover {
    color: var(--color-secondary-dark);
    text-decoration: underline;
}

/* Metadatos de tabla genérica */
.table-section-meta {
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.table-section-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pagination-select {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.pagination-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Footer de paginación genérico */
.table-section-footer {
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.table-section-footer-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.table-section-footer-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.table-section-footer-pagination {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pagination-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled):not(.active) {
    background-color: var(--bg-secondary);
    border-color: var(--color-secondary);
}

.pagination-btn.active {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    font-weight: 600;
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-btn i {
    font-size: 12px;
}

@media (max-width: 768px) {
    .modal-form-grid {
        grid-template-columns: 1fr;
    }

    .modal-info-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .table-section-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 15px;
    }

    .table-section-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 12px 15px;
    }

    .table-section-footer-pagination {
        width: 100%;
        justify-content: center;
    }

    .pagination-btn {
        min-width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .btn-card-edit {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .entity-layout {
        border-radius: 8px;
    }
}

/* Ajuste para área de contenido */
.content-area {
    height: calc(100vh - 90px);
    overflow: hidden;
}

.catalogs-layout {
    display: block;
}

.catalogs-main {
    height: 100%;
    max-height: none;
}

.catalogs-header-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.catalogs-header-copy p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.catalogs-content {
    flex: 1;
    overflow: auto;
    padding: 25px;
    background-color: var(--bg-secondary);
}

.entity-tab-content,
.catalogs-tab-content {
    min-height: 420px;
}

.catalogs-content .table-section-wrapper {
    overflow-y: visible;
    max-height: none;
}

@media (max-width: 768px) {
    .catalogs-content {
        padding: 15px;
    }
}

/* Permitir scroll en móvil */
@media (max-width: 768px) {
    .content-area {
        height: auto;
        min-height: calc(100vh - 90px);
        overflow: visible;
    }
}

/* Botón de agregar entidad (genérico) */
.btn-add-entity {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--color-secondary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(52, 108, 176, 0.3);
}

.btn-add-entity:hover {
    background-color: var(--color-secondary-dark);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(52, 108, 176, 0.5);
}

.btn-add-entity:active {
    transform: scale(0.98);
}

/* Botón toggle sidebar - en el header del sidebar */
.btn-toggle-sidebar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-toggle-sidebar:hover {
    background-color: var(--bg-secondary);
    transform: scale(1.08);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-toggle-sidebar:active {
    transform: scale(0.98);
    background-color: var(--border-color);
}

.btn-toggle-sidebar i {
    transition: transform 0.3s ease;
}

/* Rotar el ícono cuando el sidebar está colapsado */
.entity-sidebar.collapsed .btn-toggle-sidebar i {
    transform: rotate(180deg);
}

/* Botón flotante para agregar entidad */
.btn-add-entity-floating {
    position: absolute;
    bottom: 60px;
    right: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--color-secondary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(52, 108, 176, 0.4);
    z-index: 100;
}

.btn-add-entity-floating:hover {
    background-color: var(--color-secondary-dark);
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 108, 176, 0.6);
}

.btn-add-entity-floating:active {
    transform: scale(1.05) translateY(0);
}

/* Botón para mostrar sidebar cuando está colapsado (escritorio/tablet) */
.btn-show-sidebar-floating {
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 100%;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
    border-right: 1px solid var(--border-color);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    z-index: 5;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 20px 0;
}

.btn-show-sidebar-floating:hover {
    background-color: var(--bg-secondary);
    width: 35px;
}

.btn-show-sidebar-floating:active {
    background-color: var(--border-color);
}

.btn-show-sidebar-floating span {
    display: none;
}

/* Escritorio/Tablet: sidebar con botón vertical solo cuando está colapsado */
@media (min-width: 769px) {
    /* Posicionar entity-main como relativo para el botón absoluto */
    .entity-main {
        position: relative;
        padding-left: 0;
    }

    /* Ocultar botón vertical cuando sidebar está expandido */
    .btn-show-sidebar-floating {
        display: none;
    }

    /* Cuando el sidebar está colapsado, mostrar botón vertical y ajustar padding */
    .entity-sidebar.collapsed ~ .entity-main {
        padding-left: 30px;
    }

    .entity-sidebar.collapsed ~ .entity-main .btn-show-sidebar-floating {
        display: flex !important;
    }
}

/* ===================================
   LOADING MODAL - SISTEMA DE CARGA
   =================================== */

/* Overlay oscuro que cubre toda la pantalla */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
}

/* Estado activo del loading */
.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal blanco del loading */
.loading-modal {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 30px 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 300px;
    max-width: 90%;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Contenedor de la animación del GIF */
.loading-animation {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Imagen GIF del loading */
.loading-gif {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

/* Texto del loading (dinámico) */
.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary);
    text-align: center;
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
    line-height: 1.4;
    max-width: 400px;
}

/* Responsive del loading modal */
@media (max-width: 768px) {
    .loading-modal {
        padding: 25px 30px;
        min-width: 280px;
    }

    .loading-gif {
        width: 100px;
        height: 100px;
    }

    .loading-text {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .loading-modal {
        padding: 20px 25px;
        min-width: 250px;
    }

    .loading-gif {
        width: 80px;
        height: 80px;
    }

    .loading-text {
        font-size: 13px;
    }
}

/* ======================================
   BÚSQUEDA GLOBAL
   ====================================== */

.search-filter-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.search-filter-btn:hover {
    background: var(--bg-secondary);
    color: var(--color-primary);
}

.search-filters-dropdown,
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-filters-dropdown.show,
.search-results-dropdown.show {
    display: block;
}

.search-filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.search-filters-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-link:hover {
    text-decoration: underline;
}

.search-filters-body {
    padding: 8px;
}

.search-filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.search-filter-item:hover {
    background: var(--bg-secondary);
}

.search-filter-item input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.search-filter-item i {
    color: var(--text-secondary);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 14px;
}

.search-filter-item span {
    font-size: 14px;
    color: var(--text-primary);
    flex: 1;
}

.search-results-body {
    padding: 8px;
}

.search-result-group {
    margin-bottom: 16px;
}

.search-result-group:last-child {
    margin-bottom: 0;
}

.search-result-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    margin-bottom: 4px;
}

.search-result-group-header i {
    color: var(--color-primary);
    font-size: 14px;
}

.search-result-group-header span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.search-result-count {
    margin-left: auto;
    background: var(--color-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.search-result-item:hover {
    background: var(--bg-secondary);
    border-left-color: var(--color-primary);
}

.search-result-link {
    flex: 1;
    min-width: 0;
    text-decoration: none;
}

.search-result-copy {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.search-result-copy:hover {
    background: var(--bg-secondary);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.search-result-copy.copied {
    color: var(--color-success);
    border-color: var(--color-success);
}

.search-result-copy.copy-error {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.search-result-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}

.search-result-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.search-result-entity {
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.search-no-results,
.search-error {
    text-align: center;
    padding: 40px 20px;
}

.search-no-results i,
.search-error i {
    font-size: 48px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: block;
}

.search-no-results p,
.search-error p {
    color: var(--text-secondary);
    margin: 0;
}

.search-error i {
    color: var(--color-danger);
}

/* Ajuste del input cuando hay botón de filtro */
.header-search input {
    padding-right: 40px;
}

/* ===================================
   BANK STATEMENT PAGE
   =================================== */

.bank-statement-page {
    overflow-y: auto;
    overflow-x: hidden;
}

.bank-statement-page .app-content {
    min-height: calc(100vh - 50px);
    overflow: visible;
}

.bank-statement-page .content-area {
    height: auto;
    min-height: calc(100vh - 90px);
    overflow: visible;
}

.bank-statement-page .entity-layout {
    height: auto;
    min-height: calc(100vh - 50px);
    overflow: visible;
}

.bank-statement-page .entity-main {
    height: auto;
    max-height: none;
    overflow: visible;
}

.bank-statement-page .catalogs-main {
    height: auto;
    max-height: none;
    overflow: visible;
}

.bank-statement-page .table-section {
    overflow: visible;
    margin-bottom: 0;
}

.bank-statement-page .table-section-wrapper {
    max-height: none;
    overflow: visible;
}

.bank-statement-page .bank-statement-separator {
    margin: 16px 0;
}

.documents-page .content-area,
.documents-page .entity-layout,
.documents-page .entity-main,
.documents-page .catalogs-main {
    height: auto;
    max-height: none;
    overflow: visible;
}

.documents-page .table-section {
    overflow: visible;
}

.documents-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.documents-summary-card {
    background: linear-gradient(180deg, rgba(17, 93, 95, 0.08) 0%, rgba(17, 93, 95, 0.02) 100%), var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.documents-summary-label {
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
}

.documents-summary-value {
    font-size: 28px;
    line-height: 1.1;
    color: var(--text-primary);
}

.documents-summary-helper {
    font-size: 13px;
    color: var(--text-secondary);
}

.documents-filters-section {
    margin-bottom: 20px;
}

.documents-filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.documents-multi-select {
    min-height: 140px;
}

.documents-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.documents-status-badge.active {
    background-color: rgba(22, 163, 74, 0.12);
    color: #166534;
}

.documents-status-badge.inactive {
    background-color: rgba(239, 68, 68, 0.12);
    color: #991b1b;
}

.documents-access-text {
    display: block;
    max-width: 280px;
    white-space: normal;
    line-height: 1.35;
}

.documents-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.documents-modal-wide #documentVersionsTable td:last-child,
.documents-modal-wide #clientDocumentVersionsTable td:last-child,
.documents-modal-wide #providerDocumentVersionsTable td:last-child {
    min-width: 92px;
    white-space: nowrap;
}

.documents-modal-wide #documentVersionsTable .documents-row-actions,
.documents-modal-wide #clientDocumentVersionsTable .documents-row-actions,
.documents-modal-wide #providerDocumentVersionsTable .documents-row-actions {
    flex-wrap: nowrap;
}

.documents-row-actions .btn-icon[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.documents-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    z-index: 1200;
    overflow-y: auto;
}

.documents-modal-backdrop[hidden] {
    display: none !important;
}

.documents-modal {
    width: min(920px, 100%);
    max-height: min(90vh, 960px);
    overflow: hidden;
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
    background: var(--bg-primary);
    border-radius: 18px;
    border: 1px solid var(--border-color);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
    display: flex;
    flex-direction: column;
    margin: auto;
}

.documents-modal input,
.documents-modal select,
.documents-modal textarea,
.documents-modal button,
.documents-modal label,
.documents-modal small,
.documents-modal p,
.documents-modal h3,
.documents-modal table {
    font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
}

.documents-modal.documents-modal-wide {
    width: min(1280px, 100%);
}

.documents-modal-header,
.documents-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    flex: 0 0 auto;
    background: var(--bg-primary);
    position: relative;
    z-index: 1;
}

.documents-modal-footer {
    border-bottom: 0;
    border-top: 1px solid var(--border-color);
    justify-content: flex-end;
}

.documents-modal-header h3 {
    margin: 0;
}

.documents-modal.documents-modal-wide .table-section-table th {
    white-space: normal;
}

.documents-modal-header p {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.documents-modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.documents-modal-close:hover,
.documents-modal-close:focus-visible {
    background: rgba(15, 23, 42, 0.08);
    color: var(--text-primary);
    outline: none;
}

body.dark-mode .documents-modal-close:hover,
body.dark-mode .documents-modal-close:focus-visible {
    background: rgba(255, 255, 255, 0.08);
}

.documents-modal-body {
    padding: 22px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.documents-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    overflow: visible;
}

.documents-modal .form-group,
.documents-modal .documents-form-span-2,
.documents-modal .control-wrapper {
    overflow: visible;
}

.documents-modal .control-wrapper {
    position: relative;
}

.documents-modal .form-control {
    min-height: 42px;
}

.documents-modal .custom-select {
    overflow: visible;
}

.documents-modal .custom-select.open {
    z-index: 10020;
}

.documents-modal .select-dropdown {
    z-index: 10030;
}

.documents-modal .documents-upload-area {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 132px;
    border-radius: 16px;
    border: 1px dashed rgba(148, 163, 184, 0.9);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(241, 245, 249, 0.92));
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.documents-modal .documents-upload-text {
    text-align: center;
    padding: 18px 20px;
    color: var(--text-secondary);
}

.documents-modal .documents-upload-text i {
    display: block;
    margin-bottom: 10px;
    font-size: 26px;
    color: var(--primary-color);
}

.documents-modal .documents-upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(74, 144, 226, 0.08);
}

.documents-modal .documents-upload-area.is-valid {
    border-color: var(--form-valid);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.documents-modal .documents-upload-area.is-invalid,
.documents-modal .documents-upload-area[data-validation-state="required-empty"] {
    border-color: var(--form-error);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.documents-selected-file {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.documents-selected-file.is-invalid {
    color: var(--form-error);
}

.documents-modal .modal-custom-select .select-display,
.documents-modal .documents-custom-select .select-display {
    min-height: 46px;
}

.documents-modal .modal-custom-select .select-arrow,
.documents-modal .documents-custom-select .select-arrow,
.documents-modal .custom-select .select-arrow {
    font-size: 15px;
    font-weight: 700;
    right: 46px;
    color: var(--text-secondary);
}

.documents-modal .custom-select.disabled .select-arrow,
.documents-modal .custom-select.disabled .icon-container .clear,
.documents-modal .custom-select .select-display.disabled + .select-arrow,
.documents-modal .custom-select .select-display.disabled ~ .icon-container .clear {
    display: none !important;
}

.documents-modal .select-options {
    max-height: 255px;
    overscroll-behavior: contain;
}

.documents-page .custom-select .select-dropdown {
    max-height: 320px;
}

.documents-page .custom-select .select-options {
    max-height: 285px;
    overscroll-behavior: contain;
}

.documents-modal .documents-upload-icon-container {
    top: 14px;
    right: 14px;
    transform: none;
    z-index: 2;
}

.documents-modal .documents-upload-icon-container .form-icon {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--bg-primary);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.documents-modal .control-wrapper .icon-container .form-icon,
.documents-modal .custom-select .icon-container .form-icon {
    display: flex;
}

.documents-modal .multi-select .select-display {
    min-height: 46px;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.documents-modal textarea.form-control {
    min-height: 112px;
}

.documents-form-span-2 {
    grid-column: 1 / -1;
}

.documents-field-help {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

@media (max-width: 900px) {
    .documents-modal-grid {
        grid-template-columns: 1fr;
    }

    .documents-form-span-2 {
        grid-column: auto;
    }
}

@media (max-width: 768px) {
    .documents-modal-backdrop {
        padding: 12px;
    }

    .documents-modal-header,
    .documents-modal-body,
    .documents-modal-footer {
        padding: 16px;
    }

    .documents-summary-value {
        font-size: 24px;
    }
}

.calendar-page .calendar-workspace {
    overflow: visible;
}

.calendar-page {
    overflow-y: auto;
    overflow-x: hidden;
}

.calendar-page .app-content {
    min-height: calc(100vh - 50px);
    overflow: visible;
}

.calendar-page .content-area,
.calendar-page .entity-layout,
.calendar-page .entity-main,
.calendar-page .catalogs-main,
.calendar-page .catalogs-content {
    height: auto;
    max-height: none;
    overflow: visible;
}

.calendar-toolbar {
    gap: 16px;
    align-items: center;
}

.calendar-nav-block,
.calendar-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.calendar-period-title {
    margin: 0;
}

.calendar-filter-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

.calendar-view-tabs {
    margin-left: 4px;
}

.calendar-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 0.95fr);
    gap: 20px;
    align-items: start;
}

.calendar-board-panel,
.calendar-sidebar {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}

.calendar-board-panel {
    padding: 18px;
}

.calendar-sidebar {
    padding: 18px;
    position: sticky;
    top: 66px;
    align-self: start;
}

.calendar-sidebar-header {
    margin-bottom: 16px;
}

.calendar-sidebar-header p {
    margin: 8px 0 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.calendar-sidebar-list {
    display: grid;
    gap: 14px;
}

.calendar-month-view {
    display: grid;
    gap: 12px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.calendar-weekdays div {
    border-radius: 10px;
    background: rgba(17, 93, 95, 0.08);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    padding: 10px 8px;
}

.calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.calendar-month-cell {
    min-height: 146px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 10px;
    background: linear-gradient(180deg, rgba(17, 93, 95, 0.04) 0%, rgba(255, 255, 255, 0) 100%), var(--bg-primary);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.calendar-month-cell.is-selected {
    border-color: #115d5f;
    box-shadow: 0 12px 26px rgba(17, 93, 95, 0.12);
}

.calendar-month-cell.is-today {
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.10) 0%, rgba(255, 255, 255, 0) 100%), var(--bg-primary);
}

.calendar-month-cell.is-outside {
    opacity: 0.58;
}

.calendar-month-cell-empty {
    min-height: 146px;
    border-style: dashed;
    background: transparent;
    box-shadow: none;
}

.calendar-day-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: rgba(17, 93, 95, 0.08);
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
}

.calendar-day-events {
    display: grid;
    gap: 6px;
    align-content: start;
}

.calendar-event-chip {
    width: 100%;
    border: 0;
    border-radius: 4px;
    padding: 2px 4px;
    display: block;
    text-align: left;
    cursor: pointer;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.2;
}

.calendar-event-chip-order {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-more-indicator,
.calendar-day-empty,
.calendar-range-empty {
    color: var(--text-secondary);
    font-size: 12px;
}

.calendar-range-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
}

.calendar-range-column {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-primary);
    overflow: hidden;
}

.calendar-range-column.is-selected {
    border-color: #115d5f;
    box-shadow: 0 12px 24px rgba(17, 93, 95, 0.12);
}

.calendar-range-column-header {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    background: rgba(17, 93, 95, 0.05);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    cursor: pointer;
}

.calendar-range-column-header span {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.calendar-range-column-header strong {
    font-size: 20px;
    color: var(--text-primary);
}

.calendar-range-column-body,
.calendar-day-view-list {
    padding: 12px;
    display: grid;
    gap: 10px;
}

.calendar-day-view {
    display: grid;
    gap: 14px;
}

.calendar-day-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.calendar-day-view-header h4 {
    margin: 0;
    font-size: 18px;
}

.calendar-day-view-header span {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
}

.calendar-range-entry-main,
.calendar-sidebar-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
}

.calendar-range-entry-main {
    width: 100%;
    padding: 1px;
    display: grid;
    gap: 6px;
    text-align: left;
    cursor: pointer;
}

.calendar-range-entry-main strong {
    font-size: 9px;
    color: var(--text-primary);
}

.calendar-range-entry-main span,
.calendar-range-entry-main small {
    color: var(--text-secondary);
}

.calendar-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-width: 94px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.calendar-sidebar-card {
    padding: 14px;
    display: grid;
    gap: 12px;
}

.calendar-sidebar-card-top,
.calendar-sidebar-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.calendar-sidebar-date,
.calendar-sidebar-meta {
    color: var(--text-secondary);
    font-size: 12px;
}

.calendar-sidebar-fields {
    display: grid;
    gap: 10px;
    margin: 0;
}

.calendar-sidebar-fields div {
    display: grid;
    gap: 4px;
}

.calendar-sidebar-fields dt {
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.calendar-sidebar-fields dd {
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
}

.calendar-sidebar-comments {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.calendar-empty-state {
    min-height: 240px;
    display: grid;
    place-items: center;
    gap: 10px;
    text-align: center;
    color: var(--text-secondary);
}

.calendar-empty-state.compact {
    min-height: 160px;
}

.calendar-empty-state i {
    font-size: 28px;
}

.tone-info {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

.tone-success {
    background: rgba(34, 197, 94, 0.14);
    color: #15803d;
}

.tone-warning {
    background: rgba(245, 158, 11, 0.16);
    color: #b45309;
}

.tone-danger {
    background: rgba(239, 68, 68, 0.14);
    color: #b91c1c;
}

.tone-neutral {
    background: rgba(100, 116, 139, 0.14);
    color: #475569;
}

@media (max-width: 1280px) {
    .calendar-layout {
        grid-template-columns: 1fr;
    }

    .calendar-sidebar {
        position: static;
    }
}

@media (min-width: 769px) and (max-width: 1180px) {
    .calendar-toolbar {
        display: grid;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        justify-items: center;
    }

    .calendar-nav-block {
        width: max-content;
        justify-content: center;
        margin: 0 auto 8px;
        position: relative;
        left: -32px;
    }

    .calendar-toolbar-actions {
        width: max-content;
        justify-content: center;
        margin: 0 auto;
    }

    .calendar-period-title {
        text-align: center;
        justify-content: center;
    }

    .calendar-event-chip {
        max-width: 100%;
        padding: 2px 2px;
        font-size: 8px;
        line-height: 1.1;
        box-sizing: border-box;
    }

    .calendar-event-chip-order {
        max-width: 100%;
    }
}

@media (max-width: 960px) {
    .calendar-month-grid,
    .calendar-weekdays,
    .calendar-range-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .calendar-month-grid,
    .calendar-weekdays,
    .calendar-range-grid {
        grid-template-columns: 1fr;
    }

    .calendar-toolbar {
        align-items: flex-start;
    }

    .calendar-nav-block {
        width: 100%;
        justify-content: space-between;
        transform: none;
    }

    .calendar-toolbar-actions {
        width: 100%;
    }

    .calendar-view-tabs {
        width: 100%;
    }

    .calendar-view-tabs .entity-tab {
        flex: 1 1 0;
    }
}
