﻿/* --- VARIABLES DINÁMICAS --- */
:root {
    --primary: #2563eb;
    /* Alias usado en SweetAlert y enlaces; sin esto el botón puede quedar sin fondo y el texto blanco no se ve */
    --primary-color: var(--primary);
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-bg: #1e293b;
    --sidebar-width: 260px;
    --sidebar-collapsed: 80px;
    
    /* Variables que cambiarán en modo oscuro */
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --table-header: #f8fafc;
    --card-shadow: rgba(0, 0, 0, 0.05);
}

/* --- MODO OSCURO --- */
body.dark-mode {
    --bg-app: #0f172a;      /* Fondo general azul muy oscuro */
    --bg-card: #1e293b;     /* Fondo de tarjetas (minimalistas y subida) */
    --text-main: #f1f5f9;   /* Texto principal claro */
    --text-muted: #94a3b8;  /* Texto secundario gris claro */
    --border-color: #334155;/* Bordes oscuros sutiles */
    --table-header: #1e293b;/* Cabeceras de tabla oscuras */
    --card-shadow: rgba(0, 0, 0, 0.3); /* Sombra más densa para oscuridad */
}

/* --- ESTILOS BASE --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, sans-serif;
}

body {
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease; /* Transición suave */
}

/* --- LOGIN OVERLAY --- */
#loginOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;   /* Ancho total de la ventana */
    height: 100vh;  /* Alto total de la ventana */
    background-color: white; /* O el color que prefieras */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999; /* Un número muy alto para estar al frente */
}

.login-box {
    background: var(--bg-card); 
    color: var(--text-main);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-logo {
    max-width: 100%;
    width: 90%;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 24px;
}

.login-box h2 { margin: 20px 0; font-weight: 700; }
.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.login-forgot-link {
    display: block;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--primary-color, #4f46e5);
    text-decoration: none;
}

.login-forgot-link:hover {
    text-decoration: underline;
}

.login-loading-indicator {
    margin-top: 10px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* --- ESTRUCTURA APP --- */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-app);
}

/* --- SIDEBAR DINÁMICA --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

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

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #334155;
    height: 80px;
}
.sidebar.collapsed .sidebar-header {
    padding: 12px;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
    height: auto;
}

/* Logo DOKYIA: expandido (logo completo) vs comprimido (iso) */
.sidebar-logo-wrap {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.sidebar.collapsed .sidebar-logo-wrap {
    flex: none;
    justify-content: center;
}
.sidebar-logo-expanded,
.sidebar-logo-collapsed {
    max-height: 34px;
    padding: 5px;
    width: auto;
    object-fit: contain;
}
.sidebar.collapsed .sidebar-logo-expanded,
.sidebar.collapsed .sidebar-logo-collapsed {
    max-height: 30px;
}
.sidebar-logo-expanded { display: block; }
.sidebar-logo-collapsed { display: none; }
.sidebar.collapsed .sidebar-logo-expanded { display: none; }
.sidebar.collapsed .sidebar-logo-collapsed { display: block; }

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 15px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 14px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 8px;
    gap: 15px;
    transition: all 0.2s;
}

.sidebar-nav a i { font-size: 1.4rem; min-width: 24px; text-align: center; }

.sidebar-nav a:hover, 
.sidebar-nav a.active {
    background: #334155;
    color: white;
}

.sidebar-nav a.active {
    background: var(--primary);
    color: white;
}

.sidebar-nav a.nav-has-unread i {
    color: #fbbf24;
}

.toggle-btn {
    background: #334155;
    border: none;
    color: white;
    padding: 6px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #334155;
}

.news-list {
    display: grid;
    gap: 10px;
}

.help-faq-list {
    display: grid;
    gap: 10px;
}

.news-item {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    padding: 12px 14px;
}

.news-item.news-item-unread {
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2) inset;
}

.news-item-header {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: #64748b;
}

.news-item-badge {
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: 600;
}

.news-item-badge.unread {
    background: #fef3c7;
    color: #92400e;
}

.news-item-badge.read {
    background: #e2e8f0;
    color: #334155;
}

/* Novedades en tema oscuro: mejorar contraste de tarjetas y texto */
body.dark-mode #section-news .news-item,
body.dark-mode #section-help .news-item {
    background: #111827;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode #section-news .news-item-header,
body.dark-mode #section-help .news-item-header {
    color: #94a3b8;
}

body.dark-mode #section-news .news-item.news-item-unread,
body.dark-mode #section-help .news-item.news-item-unread {
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35) inset;
}

body.dark-mode #section-news .news-item-badge.unread,
body.dark-mode #section-help .news-item-badge.unread {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

body.dark-mode #section-news .news-item-badge.read,
body.dark-mode #section-help .news-item-badge.read {
    background: #334155;
    color: #e2e8f0;
}

body.dark-mode #section-news #newsTextInput,
body.dark-mode #section-news #newsLanguageInput,
body.dark-mode #section-news #newsCountryInput {
    background-color: #0f172a;
    color: #e2e8f0;
    border: 1px solid #334155;
}

body.dark-mode #section-news #newsTextInput::placeholder,
body.dark-mode #section-news #newsLanguageInput::placeholder,
body.dark-mode #section-news #newsCountryInput::placeholder {
    color: #94a3b8;
}

/* --- CONTENIDO PRINCIPAL --- */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0; /* Permite que flex children hagan shrink */
    overflow-x: hidden;
}

.sidebar.collapsed + .content {
    margin-left: var(--sidebar-collapsed);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 16px;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1;
}

.top-bar-left #sectionTitle {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-brand-logo {
    max-height: 36px;
    max-width: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.top-bar.top-bar-branded {
    padding: 10px 16px;
    border-radius: 10px;
    margin-bottom: 24px;
}

.top-bar.top-bar-branded .user-info #displayUserName {
    color: inherit;
}

.top-bar.top-bar-branded .user-info #displayCompanyName {
    color: inherit;
    opacity: 0.85;
}

.top-bar.top-bar-branded #roleBadge {
    background: rgba(255, 255, 255, 0.22);
    color: inherit;
}

body.dark-mode .top-bar.top-bar-branded #roleBadge {
    background: rgba(0, 0, 0, 0.2);
}

.user-info { display: flex; align-items: center; }

#roleBadge {
    background: #e0f2fe;
    color: #0369a1;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* --- DASHBOARD Y TARJETAS --- */
/* Grillas de tarjetas */
.stats-grid, .stats-grid-small {
    display: grid;
    gap: 20px;
    margin-bottom: 25px;
}

.dashboard-summary-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.dashboard-summary-tabs {
    display: inline-flex;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    padding: 6px;
}

.dashboard-summary-tab {
    border: none;
    background: transparent;
    color: var(--text-muted, #64748b);
    border-radius: 8px;
    padding: 8px 14px;
    font-weight: 600;
    cursor: pointer;
}

.dashboard-summary-tab.active {
    background: var(--primary, #2563eb);
    color: #fff;
}

.dashboard-summary-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.dashboard-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.dashboard-due-panel {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.dashboard-due-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.dashboard-due-range-buttons {
    display: inline-flex;
    gap: 8px;
}

.dashboard-due-range-btn {
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-app, #f8fafc);
    color: var(--text-main, #1e293b);
    border-radius: 8px;
    font-weight: 700;
    min-width: 52px;
    padding: 7px 10px;
    cursor: pointer;
}

.dashboard-due-range-btn.active {
    background: var(--primary, #2563eb);
    color: #fff;
    border-color: var(--primary, #2563eb);
}

.dashboard-due-calendar-grid {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.dashboard-due-chunk {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    padding: 8px;
    flex: 1 1 320px;
    min-width: 300px;
}

.dashboard-due-chunk-title {
    font-size: 0.86rem;
    color: var(--text-muted, #64748b);
    font-weight: 700;
    margin-bottom: 6px;
}

.dashboard-due-chunk-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.dashboard-due-weekday {
    text-align: center;
    color: var(--text-muted, #64748b);
    font-size: 0.78rem;
    font-weight: 700;
}

.dashboard-due-day-cell {
    min-height: 74px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    padding: 5px;
    background: var(--bg-app, #f8fafc);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}

.dashboard-due-day-cell.is-empty {
    background: transparent;
    border-style: dashed;
    cursor: default;
}

.dashboard-due-day-cell.is-selected {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18) inset;
}

.dashboard-due-day-cell .day-num {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-main, #1e293b);
}

.dashboard-due-day-cell .day-total {
    font-size: 0.7rem;
    color: var(--primary, #2563eb);
    font-weight: 700;
    line-height: 1.2;
    word-break: break-word;
}

.dashboard-due-day-cell .day-count {
    font-size: 0.68rem;
    color: var(--text-muted, #64748b);
}

.dashboard-due-details {
    border-top: 1px solid var(--border-color, #e2e8f0);
    padding-top: 12px;
}

.dashboard-due-docs-list {
    display: grid;
    gap: 8px;
}

.dashboard-due-doc-item {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    padding: 10px;
    background: var(--bg-app, #f8fafc);
}

.dashboard-due-doc-main {
    font-weight: 700;
    color: var(--text-main, #1e293b);
    margin-bottom: 3px;
}

.dashboard-due-doc-sub {
    font-size: 0.82rem;
    color: var(--text-muted, #64748b);
}

.stats-grid { grid-template-columns: repeat(3, 1fr); } /* 3 columnas para proveedor (quedan 2 filas) */
.stats-grid-small { grid-template-columns: repeat(3, 1fr); } /* 3 columnas para cliente */

/* Estilo Base para Tarjetas y Módulo de Subida */
.balance-card-minimal, .upload-card-minimal {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 6px -1px var(--card-shadow);
    transition: all 0.3s ease;
}

.balance-card-minimal:hover {
    transform: translateY(-2px); /* Pequeño efecto al pasar el mouse */
}

/* Títulos dentro de las tarjetas */
.balance-card-minimal p, .upload-card-minimal h3 {
    margin: 0 0 8px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Valores y textos principales */
.balance-card-minimal h2, .upload-card-minimal h3 {
    color: var(--text-main);
    margin: 0;
}

.upload-card-minimal h3 {
    font-size: 1.1rem;
    text-transform: none; /* El título de subida lo dejamos normal */
}

/* Ajuste para el input de archivo en Dark Mode */
.custom-file-input {
    color: var(--text-main);
    font-size: 0.9rem;
}

/* Colores sutiles para los números si quieres diferenciar */
#valCard2 { color: #e11d48; } /* Rojo suave para vencido */
#valCard3 { color: #059669; } /* Verde suave para a vencer */

.balance-card {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 5px solid var(--primary);
    transition: transform 0.2s;
}

.balance-card:hover { transform: translateY(-4px); }

.balance-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.balance-card h2 {
    font-size: 1.75rem;
    font-weight: 800;
}

.charts-container {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
    margin-top: 30px;
}

.charts-container .chart-card {
    border-left: none;
}

/* Gráficos del inicio: clic → pantalla completa (Fullscreen API) */
.chart-card-expandable {
    cursor: zoom-in;
    position: relative;
    transition: box-shadow 0.2s ease;
}

.chart-card-expandable:hover {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.chart-card-expandable .chart-canvas-host {
    height: calc(100% - 42px);
    min-height: 200px;
    position: relative;
    width: 100%;
    max-width: 100%;
}

/* Botón cerrar: oculto en vista normal; en pantalla completa = barra fija visible al instante */
.chart-card-expandable .chart-fullscreen-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: none;
    font: inherit;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
}

.chart-card-expandable .chart-fullscreen-close span {
    display: inline-block;
}

.chart-card-expandable.is-chart-fullscreen .chart-fullscreen-close,
.chart-card-expandable:fullscreen .chart-fullscreen-close,
.chart-card-expandable:-webkit-fullscreen .chart-fullscreen-close {
    position: fixed;
    top: max(16px, env(safe-area-inset-top, 0px));
    right: max(20px, env(safe-area-inset-right, 0px));
    z-index: 2147483646;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    background: var(--primary, #2563eb);
    box-shadow: 0 4px 18px rgba(37, 99, 235, 0.45);
}

.chart-card-expandable:fullscreen .chart-fullscreen-close:hover,
.chart-card-expandable.is-chart-fullscreen .chart-fullscreen-close:hover,
.chart-card-expandable:-webkit-fullscreen .chart-fullscreen-close:hover {
    filter: brightness(1.08);
}

.chart-card-expandable:fullscreen .chart-fullscreen-close:focus-visible,
.chart-card-expandable.is-chart-fullscreen .chart-fullscreen-close:focus-visible,
.chart-card-expandable:-webkit-fullscreen .chart-fullscreen-close:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.9);
    outline-offset: 2px;
}

.chart-card-expandable:fullscreen,
.chart-card-expandable:-webkit-fullscreen {
    cursor: default;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-height: 100vh;
    padding: 20px 24px 28px;
    box-sizing: border-box;
    background: var(--bg-app);
}

.chart-card-expandable:fullscreen .chart-canvas-host,
.chart-card-expandable:-webkit-fullscreen .chart-canvas-host {
    flex: 1;
    height: auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
}

.chart-card-expandable:fullscreen h3,
.chart-card-expandable:-webkit-fullscreen h3 {
    flex-shrink: 0;
    margin-bottom: 16px !important;
    padding-right: 0;
    padding-top: 52px;
}

@media (max-width: 1200px) {
    .charts-container {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

/* --- TABLAS --- */
.app-section {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

th {
    background: var(--table-header); /* Antes decía #f8fafc */
    color: var(--text-muted);
    padding: 16px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;    
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #f8fafc; }

/* Encabezados de grilla en 2 filas, letra más chica */
#historyTable .th-compact,
#historyTable thead th {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 8px 6px;
    line-height: 1.2;
    text-align: left;
    white-space: pre-line;
    vertical-align: middle;
}
#historyTable thead th:last-child { text-align: center; }

.status-badge {
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #fee2e2;
    color: #ef4444;
}
.status-badge-clickable {
    cursor: pointer;
    transition: opacity 0.2s;
}
.status-badge-clickable:hover {
    opacity: 0.85;
}

/* PENDIENTE: rojo */
.status-badge.status-pendiente {
    background: #fee2e2;
    color: #dc2626;
}

/* APROBADO: verde */
.status-badge.status-aprobado {
    background: #dcfce7;
    color: #16a34a;
}

/* PAGADO/PAGADA/COBRADO: azul */
.status-badge.status-pagado,
.status-badge.status-pagada,
.status-badge.status-cobrado {
    background: #dbeafe;
    color: #2563eb;
}

.status-badge.status-paid {
    background: #dbeafe;
    color: #2563eb;
}

.status-badge.status-eliminada {
    background: #e2e8f0;
    color: #64748b;
}

/* Badge vencimiento: rojo = vencido, verde = no vencido */
.badge.status-red {
    background: #fee2e2;
    color: #dc2626;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge.status-green {
    background: #dcfce7;
    color: #16a34a;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* --- FORMULARIOS --- */
.user-form {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    background: var(--bg-card);
    color: var(--text-main);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.user-form input, 
.user-form select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.user-form input:focus { border-color: var(--primary); }

.upload-card {
    background: #eff6ff;
    border: 2px dashed #bfdbfe;
    padding: 30px;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 25px;
}

/* --- BOTONES --- */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }

.btn-mini {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-success { background: var(--success); color: white; }

.btn-icon-edit {
    border: none; 
    background: #f1f5f9; 
    color: #2563eb; 
    padding: 8px; 
    border-radius: 6px; 
    cursor: pointer;
}

.btn-icon-delete {
    border: none; 
    background: #fef2f2; 
    color: #ef4444; 
    padding: 8px; 
    border-radius: 6px; 
    cursor: pointer;
}

/* Ajuste para evitar que la tabla rompa el layout */
#section-facturas {
    max-width: 100%;
    overflow-x: hidden;
}

/* Grilla al 100% del ancho, sin scroll horizontal */
#section-facturas .table-responsive.table-fullwidth,
#section-pagos .table-responsive.table-fullwidth,
#section-usuarios .table-responsive.table-fullwidth,
#section-cuenta .form-container-custom,
#section-plataforma .table-responsive.table-fullwidth {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

#historyTable.history-table-resizable,
.table-responsive .history-table-resizable {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

#historyTable.history-table-resizable th,
#historyTable.history-table-resizable td,
.table-responsive .history-table-resizable th,
.table-responsive .history-table-resizable td {
    padding: 12px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Razón Social y columnas largas: permitir wrap para aprovechar espacio */
#historyTable.history-table-resizable td:nth-child(4),
#historyTable.history-table-resizable th:nth-child(4) {
    white-space: normal;
    word-break: break-word;
}

/* Celdas clicables en grilla de documentos (número e impuestos) */
.td-clickable:hover {
    background-color: rgba(37, 99, 235, 0.08);
    text-decoration: underline;
}

/* Columnas redimensionables: handle visual */
.th-resizable {
    position: relative;
}
.th-resizable::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
}
.th-resizable:hover::before {
    background: linear-gradient(90deg, transparent 0%, rgba(37, 99, 235, 0.2) 100%);
}
.th-resizable.resizing::before {
    background: rgba(37, 99, 235, 0.3);
}

/* Columnas ordenables */
.th-sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}
.th-sortable:hover {
    background-color: rgba(0, 0, 0, 0.04);
}
.th-sortable::after {
    content: ' ↕';
    opacity: 0.4;
    font-size: 0.75em;
}
.th-sortable.sort-asc::after {
    content: ' ↑';
    opacity: 0.8;
}
.th-sortable.sort-desc::after {
    content: ' ↓';
    opacity: 0.8;
}

/* Filtros de documentos - compactos para caber en una línea con sidebar desplegado */
.filters-row {
    flex-wrap: nowrap;
    min-width: 0;
}
.filters-row .filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 0;
    min-width: 0;
}
.filters-row .filter-group select,
.filters-row .filter-group input {
    width: 100%;
    min-width: 0;
}

/* Botones de exportación - no se encogen */
.export-buttons-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}
.filters-row .filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
}
.filters-row .custom-select {
    min-width: 0;
}
#filterArea.filters-row {
    gap: 8px;
}
#filterArea.filters-row .filter-group {
    flex: 1 1 0;
    min-width: 85px;
}
#filterArea.filters-row .filter-group:first-child {
    flex: 1.3 1 0;
    min-width: 130px;
}
#filterArea.filters-row .custom-select {
    min-width: 0;
}
#filterArea.filters-row input[type="date"] {
    min-width: 0 !important;
}

/* Estilo base para todos los badges */
.audit-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* Colores dinámicos por atributo */
.audit-badge[data-action="LOGIN"] { background-color: #dcfce7; color: #15803d; }
.audit-badge[data-action="LOGOUT"] { background-color: #ffedd5; color: #c2410c; }
.audit-badge[data-action="CREATE"] { background-color: #dbeafe; color: #1d4ed8; }
.audit-badge[data-action="UPDATE"] { background-color: #f3e8ff; color: #7e22ce; }
.audit-badge[data-action="DELETE"] { background-color: #fee2e2; color: #b91c1c; }

/* --- COMPONENTES ADICIONALES --- */
.custom-select {
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: white;
    min-width: 250px;
    font-size: 0.9rem;
    cursor: pointer;
}

.tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.tabs .btn {
    background: transparent;
    color: var(--text-muted);
}

.tabs .btn.active {
    color: var(--primary);
    position: relative;
}

.tabs .btn.active::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
}

.modal {
    display: none; 
    position: fixed; 
    z-index: 9999; /* Muy importante para que no quede abajo */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5); /* Fondo oscuro */
}

.modal-overlay {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.role-modal-content,
.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 { margin: 0; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 8px;
}
.modal-close:hover { color: var(--text-main); }
.modal-body { margin-bottom: 1.5rem; }
.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.payment-step { margin-bottom: 12px; }
/* Modal Realizar Pago: más ancho para que cada documento entre en una fila sin scroll */
.modal-payment-content {
    width: 96vw;
    max-width: 1100px;
    min-width: 760px;
}
.payment-docs-list {
    min-width: 0;
}
.payment-docs-list label,
.payment-docs-list .payment-doc-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    white-space: normal;
}
.payment-docs-list .payment-doc-item span {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
    min-width: 0;
}
#paymentsTable.history-table-resizable {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}
#paymentsTable.history-table-resizable th,
#paymentsTable.history-table-resizable td {
    padding: 12px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-box {
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

/* Contenedor que empuja el contenido o cae suavemente */
.form-dropdown-container {
    display: none; /* Se activa con .classList.add('active') */
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    animation: slideDown 0.4s ease-out;
}

.matrix-container-scroll {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    margin-top: 10px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.matrix-wrapper {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #edf2f7;
    border-radius: 6px;
    background: white;
}

.matrix-title {
    margin: 20px 0 10px 0;
    font-size: 0.95rem;
    color: #475569;
    font-weight: 600;
}

.role-form-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: slideInDown 0.4s ease-out; /* Efecto dropdown */
    padding: 20px;
}

/* Contenedor del formulario como dropdown */
.form-dropdown-wrapper {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease-in-out, opacity 0.3s ease, margin-bottom 0.4s ease;
    background: #f8fafc; /* Un fondo ligeramente distinto para resaltar el área de trabajo */
    border-radius: 12px;
}

/* Estado activo del dropdown */
.form-dropdown-wrapper.active {
    max-height: 800px; /* Suficiente para que no se corte el contenido */
    opacity: 1;
    margin-bottom: 25px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

/* Estilo para la Matriz de Permisos */
.permissions-matrix {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.permissions-matrix th, .permissions-matrix td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-align: center;
}

.permissions-matrix th:first-child, .permissions-matrix td:first-child {
    text-align: left;
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
    .stats-grid, .user-form {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-summary-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    .sidebar { width: 0; overflow: hidden; }
    .sidebar.active { width: var(--sidebar-width); }
    .content { margin-left: 0; padding: 20px; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* Contenedor principal de los inputs */
.form-grid-custom {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

/* Ajuste para que los inputs no se vean pegados */
.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

/* Estilo para el contenedor blanco del formulario */
.form-container-custom {
    background: var(--bg-card);
    color: var(--text-main);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}

/* Grilla para los 4 campos (2 por fila o 4 según el ancho) */
.api-edit-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}
.api-edit-form-grid label {
    display: block;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
    font-size: 0.9rem;
}
.api-edit-form-grid .api-edit-field {
    display: flex;
    flex-direction: column;
}
.api-edit-form-grid input,
.api-edit-form-grid select,
.api-edit-form-grid textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
}
.api-edit-form-grid textarea {
    min-height: 100px;
    font-family: monospace;
    resize: vertical;
}
.api-edit-form-grid input:read-only,
.api-edit-form-grid textarea:read-only,
.api-edit-form-grid select:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
}

.form-grid-users {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.form-control-custom {
    width: 100%;
    height: 42px;
    padding: 8px 12px;
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control-custom:focus {
    border-color: #409eff;
    outline: none;
}

/* Botón principal azul */
.btn-submit-custom {
    width: 100%;
    background-color: #2563eb;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-submit-custom:hover {
    background-color: #1d4ed8;
}

/* Animación del Spinner */
.spinner-border {
    display: inline-block;
    width: 2.5rem;
    height: 2.5rem;
    vertical-align: text-bottom;
    border: 0.25em solid #2563eb; /* Color azul */
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

/* Ejemplo básico de variables para modo oscuro */
body.dark-mode {
    --bg-app: #0f172a;      /* Fondo azul muy oscuro */
    --bg-card: #1e293b;     /* Fondo de tarjetas grisáceo */
    --text-main: #f1f5f9;   /* Texto casi blanco */
    --text-muted: #94a3b8;  /* Texto secundario claro */
    --border-color: #334155;/* Bordes más sutiles */
    --table-header: #334155;
    --card-bg: #1e293b;
    --card-border: #334155;
    --card-shadow: rgba(0, 0, 0, 0.3);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
}

body.dark-mode .card, 
body.dark-mode .sidebar, 
body.dark-mode table {
    background-color: #2d2d2d;
    color: #eeeeee;
    border-color: #444;
}

/* Ajusta los colores de los inputs en modo oscuro */
body.dark-mode input, 
body.dark-mode select {
    background-color: #3d3d3d;
    color: white;
    border: 1px solid #555;
}

body.dark-mode #loginOverlay {
    background-color: #1a1a1a;
}

/* Icono Black mode */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    color: var(--text-main);
}

.btn-icon:hover {
    background: rgba(100, 116, 139, 0.1);
}

.btn-icon i {
    font-size: 1.4rem;
}

/* Estilo específico para el botón de cerrar sesión */
.btn-danger {
    background-color: #fee2e2; /* Fondo rojo muy clarito */
    color: #ef4444;            /* Texto rojo intenso */
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background-color: #ef4444; /* Fondo rojo al pasar el mouse */
    color: white;              /* Texto blanco al pasar el mouse */
}

/* Si prefieres el estilo sólido que tenías antes: */
.sidebar-footer .btn-danger {
    width: 100%;
    justify-content: center;
    margin-top: auto;
}


/* Contador de Usuarios de cliente */
.user-badge {
    background-color: #e0f2fe;
    color: #0369a1;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #bae6fd;
}

.user-badge.clickable {
    cursor: pointer;
    text-decoration: underline; /* Opcional: para que parezca un link */
}
.user-badge.clickable:hover {
    background-color: #0369a1;
    color: white;
}

/* Modal de ítems del documento: columnas numéricas más anchas */
.doc-items-table .doc-items-col-qty {
    min-width: 56px;
    text-align: right;
    white-space: nowrap;
}
.doc-items-table .doc-items-col-price {
    min-width: 95px;
    text-align: right;
    white-space: nowrap;
}
.doc-items-table .doc-items-col-pct {
    min-width: 60px;
    text-align: right;
    white-space: nowrap;
}

/* Estilo para los botones del formulario de gestión */
.form-actions {
    grid-column: span 3;
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.btn-danger-custom {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-danger-custom:hover {
    background-color: #dc2626;
}

/* El botón de guardar debería tener flex: 2 o 1 según prefieras */
#mgmt-entidades .btn-primary {
    flex: 2;
}

.btn-cancel {
    background-color: #ef4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 10px;
}

.badge-role {
    background-color: #e2e8f0;
    color: #475569;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Estilo para el estado eliminado */
.status-deleted {
    background-color: #f3f4f6; /* Gris claro */
    color: #6b7280; /* Gris oscuro */
    border: 1px solid #d1d5db;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
}

/* Filas de documentos eliminados: gris claro */
tr.eliminada,
tr.doc-row-eliminada {
    opacity: 0.75;
    background-color: #f1f5f9 !important;
}
tr.doc-row-eliminada:hover td {
    background-color: #e2e8f0 !important;
}

/* --- Estilo de la celda de Proveedor --- */
.history-table td div:last-child {
    opacity: 0.7;
    letter-spacing: 0.5px;
}

/* --- Indicadores de Prioridad de Vto (Semáforo) --- */
.text-danger {
    color: #ef4444 !important; /* Rojo: Vencido */
    font-weight: 600;
}

.text-warning {
    color: #f59e0b !important; /* Ámbar: Próximo a vencer (5 días o menos) */
    font-weight: 600;
}

.text-success {
    color: #10b981 !important; /* Verde: Con tiempo suficiente */
}

/* Evita que los textos de traducción pendientes deformen la tabla */
#historyTable th[data-i18n],
#historyTable td[data-i18n] {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Grilla gestión entidades: tipo de fila y encabezado acciones */
#tableEntidades .th-actions-header {
    text-align: right;
}
#tableEntidades tbody tr.row-entidad-tenant td {
    background-color: #eff6ff;
}
#tableEntidades tbody tr.row-entidad-tenant:hover td {
    background-color: #dbeafe;
}
#tableEntidades tbody tr.row-entidad-sin-vinculo td {
    background-color: #f3f4f6;
}
#tableEntidades tbody tr.row-entidad-sin-vinculo:hover td {
    background-color: #e5e7eb;
}
.entidad-subtipo-proveedor {
    display: inline-block;
    margin-top: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.entidad-estado-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}
.entidad-estado-pill.activo {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.entidad-estado-pill.inactivo {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}
.entidad-estado-pill.otro {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}
.entidad-estado-pill.entidad-estado-clickable {
    cursor: pointer;
}
.entidad-estado-pill.entidad-estado-clickable:hover {
    filter: brightness(0.94);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}
.entidad-estado-pill.entidad-estado-no-perm-feedback {
    opacity: 0.88;
}
.entidad-estado-pill.entidad-estado-no-perm-feedback:hover {
    filter: brightness(0.92);
}

/* --- Dropzone Global (arrastrar y soltar) --- */
.dropzone-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(37, 99, 235, 0.15);
    backdrop-filter: blur(6px);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.dropzone-overlay.dropzone-visible {
    display: flex;
}

.dropzone-content {
    background: var(--bg-card);
    border: 3px dashed var(--primary);
    border-radius: 16px;
    padding: 48px 64px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.dropzone-icon {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 16px;
}

.dropzone-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Modal acuerdo: checkbox + leyenda centrados; texto en una línea si el ancho alcanza */
.agreement-checkbox-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 16px;
    cursor: pointer;
    user-select: none;
}

.agreement-checkbox-row .agreement-check-inner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
}

.agreement-checkbox-row input[type="checkbox"] {
    flex-shrink: 0;
    margin: 0;
    width: 1.05rem;
    height: 1.05rem;
}

.agreement-checkbox-row .agreement-accept-text {
    white-space: nowrap;
    text-align: left;
    line-height: 1.35;
    color: var(--text-main, #1e293b);
}

@media (max-width: 560px) {
    .agreement-checkbox-row .agreement-accept-text {
        white-space: normal;
    }
}

/* Modal ítems del comprobante: ~20% más ancho que 900px; en pantallas chicas no desborda */
.swal2-popup.swal2-doc-items-modal {
    max-width: min(1080px, 96vw) !important;
    width: 1080px !important;
    max-height: 90vh !important;
    margin: 0.75em auto !important;
    display: flex !important;
    flex-direction: column !important;
}
.swal2-popup.swal2-doc-items-modal .swal2-html-container {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    max-height: calc(90vh - 7rem) !important;
    margin-top: 0.35em !important;
}
.doc-items-modal-table-wrap {
    max-height: min(320px, 40vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Modal de resultados OCR: tipografía un poco mayor para aprovechar ancho ampliado */
.swal2-popup.swal2-upload-results-modal {
    font-size: 1.05rem !important;
}

.swal2-popup.swal2-upload-results-modal .upload-result-table {
    font-size: 1rem !important;
}

.swal2-popup.swal2-upload-results-modal .upload-result-table th,
.swal2-popup.swal2-upload-results-modal .upload-result-table td {
    padding: 8px 10px;
}

.swal2-popup.swal2-upload-results-modal .swal2-title {
    font-size: 2rem !important;
}
@media (max-width: 1100px) {
    .swal2-popup.swal2-doc-items-modal {
        width: 96vw !important;
    }
}

#help-category-tabs .btn.active {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

body.dark-mode #help-category-tabs .btn.active {
    border-color: #3b82f6;
    background: #1d4ed8;
    color: #ffffff;
}

/* Casos de soporte (Ayuda): hover legible en modo oscuro */
#helpIncidentsTable tbody tr {
    transition: background-color 0.15s ease, color 0.15s ease;
}

body.dark-mode #helpIncidentsTable tbody tr:hover td {
    background-color: #243244;
    color: #f8fafc;
}

body.dark-mode #helpIncidentsTable tbody tr:hover {
    outline: 1px solid #3b82f6;
    outline-offset: -1px;
}