/* =========================================================
   ContaERP SV — Design System & Stylesheet
   ========================================================= */

:root {
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --border-color: #e2e8f0;
    --border-focus: #6366f1;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-white: #ffffff;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;

    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ================= Layout ================= */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid #1e293b;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.4);
}

.brand-text h2 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-text span {
    font-size: 11px;
    color: #64748b;
    display: block;
}

.nav-menu {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
}

.nav-item:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: #ffffff;
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.nav-item svg {
    flex-shrink: 0;
}

.badge-count {
    margin-left: auto;
    background-color: var(--danger);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 9999px;
}

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

.period-status-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #1e293b;
    padding: 10px 14px;
    border-radius: var(--radius-md);
}

.period-dot {
    width: 10px;
    height: 10px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
}

.period-label {
    display: block;
    font-size: 11px;
    color: #64748b;
}

.period-status-box strong {
    color: #ffffff;
    font-size: 12px;
}

/* ================= Main Content ================= */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.topbar-left p {
    font-size: 12px;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    gap: 12px;
}

.content-body {
    padding: 28px 32px;
    flex: 1;
}

.tab-pane {
    display: none !important;
}

.tab-pane.active {
    display: block !important;
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================= Buttons ================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
}

.btn-secondary {
    background-color: #ffffff;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #f1f5f9;
}

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

.btn-outline:hover {
    background-color: #f8fafc;
    color: var(--text-main);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    font-size: 12.5px;
}

.btn-text:hover {
    text-decoration: underline;
}

.btn-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border: none;
}

.btn-danger:hover {
    background-color: var(--danger);
    color: #ffffff;
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
}

/* ================= Dashboard Stats ================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-indigo::before {
    background-color: var(--primary);
}

.stat-emerald::before {
    background-color: var(--success);
}

.stat-blue::before {
    background-color: #0284c7;
}

.stat-amber::before {
    background-color: var(--warning);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stat-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 9999px;
    background-color: #f1f5f9;
    color: var(--text-muted);
    font-weight: 600;
}

.badge-success {
    background-color: var(--success-light);
    color: #065f46;
}

.badge-danger {
    background-color: var(--danger-light);
    color: #991b1b;
}

.badge-warning {
    background-color: var(--warning-light);
    color: #92400e;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.stat-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.dashboard-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .dashboard-columns {
        grid-template-columns: 1fr;
    }
}

/* ================= Panel Cards ================= */
.panel-card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.badge-hint {
    font-size: 12px;
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 9999px;
    font-weight: 600;
}

/* ================= Tables ================= */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-emerald {
    color: var(--success);
}

/* ================= Filters Bar ================= */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ================= Forms ================= */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.col-md-3 {
    flex: 1 1 calc(25% - 16px);
    min-width: 150px;
}

.col-md-5 {
    flex: 1 1 calc(41.6% - 16px);
    min-width: 150px;
}

.col-md-6 {
    flex: 1 1 calc(50% - 16px);
    min-width: 200px;
}

.col-12 {
    flex: 1 1 100%;
}

.form-input,
.form-select {
    height: 38px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    font-size: 13.5px;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-help {
    font-size: 11.5px;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ================= Tab Subnav ================= */
.tab-subnav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.subnav-btn {
    padding: 8px 18px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    font-size: 13.5px;
    transition: all 0.2s;
}

.subnav-btn:hover {
    color: var(--text-main);
    background-color: #f1f5f9;
}

.subnav-btn.active {
    color: var(--primary);
    background-color: var(--primary-light);
}

.subtab-pane {
    display: none;
}

.subtab-pane.active {
    display: block;
}

/* ================= Lines Editor & Balance Box ================= */
.lines-editor-container {
    margin: 20px 0;
}

.lines-editor-container h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-main);
}

.lines-actions {
    margin-top: 10px;
}

.balance-box {
    display: flex;
    align-items: center;
    gap: 28px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    margin-top: 16px;
}

.balance-item {
    display: flex;
    flex-direction: column;
}

.balance-item span {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.balance-item strong {
    font-size: 18px;
    font-weight: 700;
}

.balance-status {
    margin-left: auto;
}

.badge-status {
    padding: 6px 14px;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 12.5px;
}

/* ================= Journal Viewer ================= */
.asiento-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    background: #ffffff;
    overflow: hidden;
}

.asiento-header {
    background: #f8fafc;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.asiento-number {
    font-weight: 700;
    color: var(--primary);
}

.asiento-card.asiento-anulado {
    border-color: rgba(239, 68, 68, 0.45);
    background: #fffafa;
    opacity: 0.92;
}

.asiento-card.asiento-anulado .asiento-header {
    background: #fef2f2;
}

.asiento-card.asiento-anulado .asiento-number {
    color: #ef4444;
    text-decoration: line-through;
}

/* ================= Modal ================= */
.modal-backdrop {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 100000 !important;
    justify-content: center !important;
    align-items: center !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
}

.modal-backdrop:not(.active) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.modal-backdrop.active {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.modal-card {
    background-color: #ffffff;
    border-radius: 18px;
    width: 90%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(226, 232, 240, 0.85);
    transform: scale(0.96) translateY(-8px);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-card {
    transform: scale(1) translateY(0);
    position: relative !important;
    z-index: 100001 !important;
}

.modal-card.modal-confirm {
    max-width: 460px;
    border-radius: 20px;
    padding: 0;
    overflow: hidden;
    text-align: center;
}

.confirm-content {
    padding: 32px 28px 20px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.confirm-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    transition: all 0.25s ease;
}

.confirm-icon-wrapper.danger {
    background: #fee2e2;
    color: #ef4444;
    border: 5px solid #fef2f2;
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.12);
}

.confirm-icon-wrapper.warning {
    background: #fef3c7;
    color: #d97706;
    border: 5px solid #fffbeb;
    box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.12);
}

.confirm-icon-wrapper.primary {
    background: #e0e7ff;
    color: #4f46e5;
    border: 5px solid #eef2ff;
    box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.12);
}

.confirm-title {
    font-size: 1.28rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
    letter-spacing: -0.015em;
}

.confirm-message {
    font-size: 0.92rem;
    color: #64748b;
    margin-bottom: 14px;
    line-height: 1.45;
}

.confirm-item-box {
    width: 100%;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.92rem;
    color: #1e293b;
    font-weight: 600;
    margin-bottom: 12px;
    word-break: break-word;
}

.confirm-nota-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: rgba(241, 245, 249, 0.7);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: #64748b;
    text-align: left;
    line-height: 1.4;
}

.confirm-nota-box svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: #94a3b8;
}

.confirm-footer {
    background: #f8fafc;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.confirm-btn-cancelar {
    flex: 1;
    border-radius: 10px;
    font-weight: 600;
    padding: 10px;
    font-size: 0.9rem;
}

.confirm-btn-accion {
    flex: 1.3;
    border-radius: 10px;
    font-weight: 600;
    padding: 10px;
    font-size: 0.9rem;
}

.confirm-btn-accion.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.confirm-btn-accion.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    color: white;
    border-color: #d97706;
}

.modal-header .btn-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-header .btn-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.modal-lg {
    max-width: 800px;
}

.modal-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.dte-summary-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preview-asiento-box {
    background: #f1f5f9;
    padding: 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
}

.preview-asiento-box h4 {
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.json-box {
    background: #0f172a;
    color: #38bdf8;
    padding: 16px;
    border-radius: var(--radius-md);
    font-family: monospace;
    font-size: 12px;
    max-height: 480px;
    overflow: auto;
}

/* ================= Toast Notifications ================= */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 200;
}

.toast {
    background-color: #0f172a;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.2s ease-out;
}

.toast-success {
    background-color: #065f46;
    border-left: 4px solid var(--success);
}

.toast-error {
    background-color: #991b1b;
    border-left: 4px solid var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.new-period-box {
    background: #f8fafc;
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
}

.new-period-box h4 {
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ================= Alert Banner ================= */
.alert-banner {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 5px solid var(--danger);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease;
}

.alert-icon {
    font-size: 24px;
    line-height: 1;
}

.alert-content strong {
    display: block;
    color: #991b1b;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.alert-content p {
    color: #7f1d1d;
    font-size: 13px;
    margin: 0;
}

/* =========================================================
   SISTEMA DE LOGIN & AUTENTICACIÓN
   ========================================================= */
.login-view-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    background-color: #090d16;
    background-image:
        radial-gradient(at 15% 15%, rgba(79, 70, 229, 0.2) 0px, transparent 50%),
        radial-gradient(at 85% 85%, rgba(6, 182, 212, 0.15) 0px, transparent 50%);
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    padding: 24px;
    overflow-y: auto;
}

.login-container {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    max-width: 1060px;
    width: 100%;
    min-height: 640px;
    background: #0f172a;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    position: relative;
    animation: zoomInLogin 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomInLogin {
    from {
        opacity: 0;
        transform: scale(0.97) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Panel Izquierdo: Branding & Presentación */
.login-brand-panel {
    background: linear-gradient(145deg, #181c3a 0%, #0d1222 55%, #080b14 100%);
    padding: 48px 44px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-panel-decorations .decor-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: 0;
}

.decor-1 {
    width: 320px;
    height: 320px;
    background: rgba(79, 70, 229, 0.25);
    top: -80px;
    left: -80px;
}

.decor-2 {
    width: 260px;
    height: 260px;
    background: rgba(6, 182, 212, 0.18);
    bottom: -60px;
    right: -60px;
}

.brand-panel-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.login-system-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 600;
    color: #e2e8f0;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    width: fit-content;
    margin-bottom: 24px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.login-brand-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.login-brand-icon {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(79, 70, 229, 0.5);
    flex-shrink: 0;
}

.login-brand-title h1 {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.brand-tagline {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 3px;
    font-weight: 500;
}

.brand-description {
    font-size: 13.5px;
    line-height: 1.6;
    color: #cbd5e1;
    margin-bottom: 28px;
}

.feature-bullets {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 28px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 14px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateX(4px);
}

.feature-icon {
    font-size: 18px;
    line-height: 1.2;
    flex-shrink: 0;
}

.feature-text strong {
    display: block;
    color: #f8fafc;
    font-size: 13px;
    font-weight: 600;
}

.feature-text span {
    display: block;
    font-size: 11.5px;
    color: #94a3b8;
    line-height: 1.4;
    margin-top: 2px;
}

.login-brand-footer {
    padding-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.compliance-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: #6ee7b7;
}

.compliance-tag svg {
    flex-shrink: 0;
    color: #10b981;
}

/* Panel Derecho: Formulario */
.login-form-panel {
    background: #0f172a;
    padding: 48px 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 380px;
}

.login-card-header {
    margin-bottom: 24px;
}

.login-card-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.login-card-header p {
    font-size: 13px;
    color: #94a3b8;
}

/* Demo Access Chips */
.demo-access-box {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 20px;
}

.demo-access-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #a5b4fc;
    margin-bottom: 8px;
}

.demo-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.demo-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11.5px;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.demo-chip:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: #6366f1;
    color: #ffffff;
    transform: translateY(-1px);
}

.chip-role {
    font-size: 9.5px;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    text-transform: uppercase;
}

/* Alert Box */
.login-alert {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 10px;
    padding: 10px 14px;
    color: #fca5a5;
    font-size: 12.5px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.2s ease;
}

/* Form Fields */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group-login {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group-login label {
    font-size: 12px;
    font-weight: 600;
    color: #cbd5e1;
    letter-spacing: 0.02em;
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper .input-icon {
    position: absolute;
    left: 14px;
    color: #64748b;
    pointer-events: none;
    transition: color 0.2s ease;
}

.form-input-login {
    width: 100%;
    height: 44px;
    background: rgba(15, 23, 42, 0.8);
    border: 1.5px solid #334155;
    border-radius: 10px;
    padding: 0 42px 0 42px;
    font-size: 13.5px;
    color: #ffffff;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-input-login:focus {
    outline: none;
    border-color: #6366f1;
    background: rgba(15, 23, 42, 1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-input-login:focus+.input-icon,
.input-icon-wrapper:focus-within .input-icon {
    color: #818cf8;
}

.btn-toggle-pwd {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}

.btn-toggle-pwd:hover {
    color: #cbd5e1;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12.5px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #94a3b8;
    user-select: none;
}

.remember-me input[type="checkbox"] {
    accent-color: #4f46e5;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.btn-login-submit {
    height: 46px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
    transition: all 0.2s ease;
    margin-top: 6px;
}

.btn-login-submit .btn-text {
    color: #ffffff !important;
    font-size: 14px;
    font-weight: 600;
    background: transparent;
    border: none;
    text-decoration: none !important;
    letter-spacing: 0.01em;
}

.btn-login-submit .btn-arrow {
    color: #ffffff;
    stroke: #ffffff;
}

.btn-login-submit:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.6);
    transform: translateY(-1px);
    color: #ffffff;
}

.btn-login-submit:hover .btn-text {
    color: #ffffff !important;
    text-decoration: none !important;
}

.btn-login-submit:active {
    transform: translateY(0);
}

.btn-login-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.login-card-footer {
    margin-top: 28px;
    text-align: center;
    font-size: 11.5px;
    color: #64748b;
}

/* =========================================================
   WIDGETS DE USUARIO (SIDEBAR & TOPBAR)
   ========================================================= */
.user-profile-widget {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    display: inline-block;
    font-size: 9.5px;
    font-weight: 700;
    color: #818cf8;
    background: rgba(99, 102, 241, 0.15);
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-top: 2px;
}

.btn-logout {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Topbar User Pill */
.topbar-user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
}

.topbar-avatar {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}

.topbar-username {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout-topbar {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    border-radius: 4px;
    transition: color 0.2s;
}

.btn-logout-topbar:hover {
    color: var(--danger);
}

/* Responsive Login */
@media (max-width: 900px) {
    .login-container {
        grid-template-columns: 1fr;
        max-width: 480px;
    }

    .login-brand-panel {
        display: none;
    }

    .login-form-panel {
        padding: 36px 24px;
    }
}

/* =========================================================
   MÓDULO: CLIENTES DECLARANTES & EXTRACCIÓN MASIVA (DESPACHO)
   ========================================================= */

/* Selector de Cliente en Topbar */
.topbar-client-selector-box {
    display: flex;
    align-items: center;
    gap: 9px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 9px;
    padding: 5px 12px;
    transition: all 0.2s ease;
}

.topbar-client-selector-box:hover,
.topbar-client-selector-box:focus-within {
    border-color: #6366f1;
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.client-selector-icon {
    color: #818cf8;
    display: flex;
    align-items: center;
}

.client-selector-info {
    display: flex;
    flex-direction: column;
}

.client-selector-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #94a3b8;
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 2px;
}

.client-selector-dropdown {
    background: transparent;
    border: none;
    color: #f1f5f9;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.client-selector-dropdown option {
    background: #0f172a;
    color: #f1f5f9;
}

/* Tarjeta Stat Morada */
.stat-purple {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.12) 0%, rgba(30, 41, 59, 0.7) 100%);
    border-left: 4px solid #a855f7;
}

/* Toolbar de Clientes */
.clientes-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.search-input-wrapper svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
}

.search-input-wrapper input {
    padding-left: 42px;
}

.toolbar-actions-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Botón Gradiente Extracción Masiva */
.btn-gradient-bulk {
    background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 50%, #2563eb 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
    transition: all 0.25s ease;
}

.btn-gradient-bulk:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
    filter: brightness(1.08);
}

.btn-gradient-bulk:active {
    transform: translateY(0);
}

.btn-pulse-action {
    animation: subtle-pulse 3s infinite;
}

@keyframes subtle-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(99, 102, 241, 0); }
}

/* Grilla de Tarjetas de Clientes */
.clientes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.cliente-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.cliente-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    background: rgba(30, 41, 59, 0.85);
}

.cliente-card.inactivo {
    opacity: 0.65;
    filter: grayscale(0.4);
}

.cliente-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.cliente-title-area {
    flex: 1;
}

.cliente-razon-social {
    font-size: 15px;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 3px 0;
    line-height: 1.3;
}

.cliente-nombre-comercial {
    font-size: 12.5px;
    color: #94a3b8;
    margin: 0;
}

.cliente-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.cliente-status-pill.status-ok {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.cliente-status-pill.status-err {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.cliente-status-pill.status-idle {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.cliente-tax-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.tax-badge {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    color: #cbd5e1;
}

.tax-badge strong {
    color: #818cf8;
    margin-right: 4px;
}

.cliente-email-box {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.provider-badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
}

.provider-gmail {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.provider-outlook {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.provider-other {
    background: rgba(168, 85, 247, 0.2);
    color: #d8b4fe;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.cliente-email-text {
    font-size: 12.5px;
    color: #e2e8f0;
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.cliente-stats-bar {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    padding-top: 12px;
    margin-bottom: 16px;
    font-size: 12px;
}

.cliente-stat-col {
    display: flex;
    flex-direction: column;
}

.cliente-stat-col span {
    color: #64748b;
    font-size: 11px;
}

.cliente-stat-col strong {
    color: #f1f5f9;
    font-size: 13.5px;
}

.cliente-actions {
    display: flex;
    gap: 8px;
}

.cliente-actions .btn {
    flex: 1;
    font-size: 12px;
    padding: 7px 10px;
    justify-content: center;
}

.btn-icon-square {
    width: 34px;
    flex: 0 0 34px !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modales de Clientes */
.modal-title-group h3 {
    margin: 0 0 4px 0;
    font-size: 19px;
    font-weight: 700;
    color: #0f172a;
}

.modal-subtitle {
    margin: 0;
    font-size: 12.5px;
    color: #64748b;
}

.form-nav-pills {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.form-pill {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s;
}

.form-pill:hover {
    color: #f1f5f9;
    background: rgba(148, 163, 184, 0.08);
}

.form-pill.active {
    color: #ffffff;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.pill-number {
    width: 20px;
    height: 20px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.form-pill.active .pill-number {
    background: #6366f1;
    color: #fff;
}

.form-pill-content {
    display: none;
}

.form-pill-content.active {
    display: block;
}

/* Presets de Correo */
.preset-providers-box {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 18px;
}

.preset-label {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.preset-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-preset {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-preset:hover {
    border-color: #6366f1;
    color: #fff;
}

.btn-preset.active {
    background: rgba(99, 102, 241, 0.25);
    border-color: #818cf8;
    color: #fff;
    font-weight: 600;
}

/* Test de Conexión Card */
.test-connection-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 8px;
    padding: 14px;
    margin-top: 14px;
}

.test-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.test-hint {
    font-size: 11.5px;
    color: #64748b;
    flex: 1;
}

.test-result-box {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 12.5px;
    line-height: 1.4;
}

/* =========================================================
   Sección de Correos Declarantes (Hasta 5 correos)
   ========================================================= */
.correos-declarantes-section {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 4px;
    margin-bottom: 8px;
}

.correos-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.badge-correos-counter {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.4);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
}

.correos-inputs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.correo-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 8px;
    padding: 5px 8px;
    transition: all 0.2s ease;
}

.correo-item-row:focus-within {
    border-color: #6366f1;
    background: rgba(30, 41, 59, 0.85);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.correo-tag-index {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 5px;
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    white-space: nowrap;
    min-width: 65px;
    text-align: center;
}

.correo-tag-index.principal {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.correo-input-field {
    flex: 1;
    background: transparent;
    border: none;
    color: #f8fafc;
    font-size: 13px;
    outline: none;
    padding: 4px 6px;
    font-family: inherit;
}

.correo-input-field::placeholder {
    color: #64748b;
}

.btn-remove-correo {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0.7;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.btn-remove-correo:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.15);
}

.btn-add-correo {
    font-size: 11.5px;
    padding: 3px 9px;
    border-radius: 6px;
    color: #818cf8;
    border-color: rgba(99, 102, 241, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-add-correo:hover:not(:disabled) {
    background: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
}

.btn-add-correo:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: rgba(148, 163, 184, 0.2);
    color: #64748b;
}

/* Badges de correos en tarjetas de clientes */
.cliente-correos-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.badge-email-tag {
    font-size: 11px;
    background: rgba(99, 102, 241, 0.12);
    color: #c7d2fe;
    border: 1px solid rgba(99, 102, 241, 0.25);
    padding: 2px 7px;
    border-radius: 6px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-email-count {
    font-size: 10px;
    font-weight: 700;
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    padding: 1px 5px;
    border-radius: 4px;
}

.test-result-box.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.test-result-box.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

/* Barra de Progreso Masivo */
.progress-container-bulk {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.progress-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13.5px;
    color: #1e293b;
    font-weight: 600;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #9333ea, #ec4899);
    border-radius: 6px;
    transition: width 0.4s ease;
}

.bulk-stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.bulk-stat-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.bulk-stat-item span {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.bulk-stat-item strong {
    font-size: 22px;
    color: #0f172a;
    font-weight: 700;
}

.bulk-stat-item.highlight {
    background: linear-gradient(135deg, #f5f3ff, #faf5ff);
    border-color: #ddd6fe;
}

.bulk-stat-item.highlight span {
    color: #7c3aed;
}

.bulk-stat-item.highlight strong {
    color: #6d28d9;
}

.text-purple {
    color: #7c3aed !important;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #cbd5e1;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
}

/* =========================================================
   MÓDULO: BUZONES MÚLTIPLES DE EXTRACCIÓN DTE
   ========================================================= */
.cli-buzones-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.buzon-card-item {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 18px;
    transition: all 0.2s ease;
}

.buzon-card-item:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.btn-preset-bz {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 11.5px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-preset-bz:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #6366f1;
    color: #fff;
}

.btn-preset-bz.active {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    border-color: #4f46e5;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.cliente-buzones-badges-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 8px 10px;
}

.cliente-buzon-mini-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    gap: 8px;
}

.cliente-buzon-mini-item .bz-info {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cliente-buzon-mini-item .bz-badge-dtes {
    font-size: 10px;
    font-weight: 700;
    background: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* =========================================================
   Estilos de Impresión Formal (NIIF para PYMES & Reportes)
   ========================================================= */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 11pt !important;
    }

    .sidebar,
    .topbar,
    .tab-subnav,
    .filters-bar,
    .btn,
    .btn-close,
    .modal-backdrop,
    .toast-container,
    #db-alert-banner {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .content-body {
        padding: 0 !important;
    }

    .tab-pane {
        display: none !important;
    }

    .tab-pane.active {
        display: block !important;
    }

    .subtab-pane {
        display: none !important;
    }

    .subtab-pane.active {
        display: block !important;
    }

    .panel-card {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        padding: 0 !important;
    }

    .data-table {
        border-collapse: collapse !important;
        width: 100% !important;
        color: #000000 !important;
    }

    .data-table th,
    .data-table td {
        border: 1px solid #94a3b8 !important;
        padding: 5px 8px !important;
        color: #000000 !important;
    }

    .signature-block {
        page-break-inside: avoid !important;
        margin-top: 50px !important;
    }
}

/* ==========================================================================
   DASHBOARD FINANCIERO INTELIGENTE — ESTILOS SAAS PREMIUM
   ========================================================================== */

.dashfin-wrapper {
    display: flex;
    flex-direction: column;
    gap: 22px;
    width: 100%;
    margin-bottom: 40px;
    animation: dashfinFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.card-elevated {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-elevated:hover {
    border-color: #cbd5e1;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
}

/* 1. Toolbar superior de filtros globales */
.dashfin-toolbar {
    padding: 16px 22px;
}

.dashfin-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    justify-content: space-between;
}

.dashfin-filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dashfin-filter-group label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dashfin-input {
    height: 38px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 0 12px;
    font-size: 13px;
    color: #1e293b;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.dashfin-input:focus {
    background: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    outline: none;
}

.dashfin-presets-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.dashfin-presets-group label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dashfin-btn-pill-group {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.dashfin-btn-pill-group .btn-pill {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.dashfin-btn-pill-group .btn-pill:hover {
    color: #1e293b;
}

.dashfin-btn-pill-group .btn-pill.active {
    background: #ffffff;
    color: #4f46e5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.dashfin-custom-dates {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.dashfin-actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* 2. Grid de KPIs Financieros */
.dashfin-kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 16px;
}

.dashfin-kpi-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: default;
}

.dashfin-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
    border-color: #cbd5e1;
}

.dashfin-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #94a3b8;
}

.dashfin-kpi-card.kpi-ventas::before { background: linear-gradient(90deg, #10b981, #34d399); }
.dashfin-kpi-card.kpi-ingresos::before { background: linear-gradient(90deg, #059669, #10b981); }
.dashfin-kpi-card.kpi-compras::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.dashfin-kpi-card.kpi-gastos::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.dashfin-kpi-card.kpi-resultado-positivo::before { background: linear-gradient(90deg, #8b5cf6, #a855f7); }
.dashfin-kpi-card.kpi-resultado-negativo::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.dashfin-kpi-card.kpi-margen::before { background: linear-gradient(90deg, #6366f1, #818cf8); }

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.kpi-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.kpi-icon-pill {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    background: #f1f5f9;
}

.kpi-ventas .kpi-icon-pill { background: #d1fae5; color: #059669; }
.kpi-ingresos .kpi-icon-pill { background: #ecfdf5; color: #047857; }
.kpi-compras .kpi-icon-pill { background: #dbeafe; color: #1d4ed8; }
.kpi-gastos .kpi-icon-pill { background: #fef3c7; color: #b45309; }
.kpi-resultado-positivo .kpi-icon-pill { background: #ede9fe; color: #6d28d9; }
.kpi-resultado-negativo .kpi-icon-pill { background: #fee2e2; color: #b91c1c; }
.kpi-margen .kpi-icon-pill { background: #e0e7ff; color: #4338ca; }

.kpi-value-row {
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.kpi-value.val-emerald { color: #059669; }
.kpi-value.val-purple { color: #6d28d9; }
.kpi-value.val-rose { color: #dc2626; }

.kpi-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    color: #64748b;
    border-top: 1px dashed #f1f5f9;
    padding-top: 8px;
    margin-top: 6px;
}

.kpi-delta-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
}

.kpi-delta-badge.delta-up { background: #d1fae5; color: #065f46; }
.kpi-delta-badge.delta-down { background: #fee2e2; color: #991b1b; }
.kpi-delta-badge.delta-flat { background: #f1f5f9; color: #475569; }

.kpi-action-link {
    font-size: 11.5px;
    font-weight: 600;
    color: #4f46e5;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.kpi-action-link:hover {
    color: #3730a3;
}

/* Clases específicas de las tarjetas del Dashboard Financiero */
.kpi-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.kpi-card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}
.kpi-badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-emerald { background: #d1fae5; color: #065f46; }
.badge-teal { background: #ccfbf1; color: #115e59; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-rose { background: #fee2e2; color: #991b1b; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-critico { background: #fee2e2; color: #b91c1c; }
.badge-saludable { background: #d1fae5; color: #047857; }
.badge-atencion { background: #fef3c7; color: #92400e; }

.kpi-card-val {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    line-height: 1.15;
    margin-bottom: 10px;
    font-variant-numeric: tabular-nums;
}
.kpi-card-val.text-emerald { color: #059669; }
.kpi-card-val.text-rose { color: #dc2626; }
.kpi-card-val.text-amber { color: #d97706; }
.kpi-card-val.text-purple { color: #6d28d9; }

.kpi-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.kpi-trend-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
}
.trend-up-good { background: #dcfce7; color: #15803d; }
.trend-down-bad { background: #fee2e2; color: #b91c1c; }
.kpi-subtext {
    font-size: 11.5px;
    color: #64748b;
    font-weight: 500;
}
.kpi-micro-detail {
    margin-top: auto;
    border-top: 1px dashed #e2e8f0;
    padding-top: 10px;
    font-size: 11.5px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* 3. Panel de Gráfico de Tendencias */
.dashfin-chart-panel {
    padding: 24px;
}

.dashfin-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 18px;
}

.dashfin-chart-title-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #eef2ff;
    color: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashfin-chart-title-area h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
}

.chart-subtitle {
    margin: 2px 0 0 0;
    font-size: 12.5px;
    color: #64748b;
}

.dashfin-chart-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-group-toggle {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.btn-toggle {
    border: none;
    background: transparent;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-toggle.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.dashfin-series-toggles {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 18px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #f1f5f9;
    margin-bottom: 18px;
}

.series-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    user-select: none;
}

.series-badge input[type="checkbox"] {
    accent-color: #4f46e5;
    cursor: pointer;
}

.series-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.dot-emerald { background: #10b981; }
.dot-blue { background: #3b82f6; }
.dot-amber { background: #f59e0b; }
.dot-purple { background: #8b5cf6; }
.dot-slate { background: #94a3b8; }

.series-tip {
    margin-left: auto;
    font-size: 11.5px;
    color: #64748b;
    font-style: italic;
}

.dashfin-canvas-container {
    width: 100%;
    position: relative;
    min-height: 340px;
    overflow-x: auto;
}

/* SVG Chart Elements */
.dashfin-svg-chart {
    width: 100%;
    height: auto;
    display: block;
}

.chart-grid-line {
    stroke: #e2e8f0;
    stroke-dasharray: 4, 4;
    stroke-width: 1;
}

.chart-axis-line {
    stroke: #94a3b8;
    stroke-width: 1.5;
}

.chart-axis-text {
    font-family: inherit;
    font-size: 11px;
    fill: #64748b;
}

.chart-bar-rect {
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.chart-bar-rect:hover {
    opacity: 0.85;
}

.chart-bar-group {
    cursor: pointer;
}

.chart-bar-group:hover .chart-bar-rect {
    filter: brightness(1.08);
}

.chart-line-path {
    fill: none;
    stroke-width: 2.8;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.chart-area-path {
    opacity: 0.12;
}

.chart-dot {
    cursor: pointer;
    transition: r 0.2s ease, stroke-width 0.2s ease;
}

.chart-dot:hover {
    r: 6;
    stroke-width: 3;
}

/* Floating Tooltip */
.dashfin-tooltip {
    position: absolute;
    background: #0f172a;
    color: #f8fafc;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 11.5px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    transform: translate(-50%, -100%);
    margin-top: -8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dashfin-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px 5px 0;
    border-style: solid;
    border-color: #0f172a transparent transparent;
}

/* 4. Dos Columnas: Gastos e Ingresos */
.dashfin-two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.dashfin-col {
    padding: 22px;
}

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

.section-title-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title-box .sec-icon {
    font-size: 22px;
}

.section-title-box h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.sec-subtitle {
    font-size: 12px;
    color: #64748b;
    display: block;
}

.badge-total {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    background: #f1f5f9;
    padding: 4px 12px;
    border-radius: 8px;
}

/* Donut & Barras de Gastos */
.dashfin-donut-and-bars {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.donut-chart-box {
    flex: 0 0 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cat-bars-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cat-bar-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.cat-bar-item:hover {
    background: #f8fafc;
}

.cat-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.cat-bar-name {
    font-weight: 600;
    color: #334155;
}

.cat-bar-val {
    font-weight: 700;
    color: #0f172a;
}

.cat-progress-track {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.cat-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* Alertas de Gastos */
.dashfin-alertas-container {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
}

.alerta-item {
    font-size: 12px;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table-mini {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.table-mini th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 700;
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.table-mini td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.table-mini tr:hover td {
    background: #f8fafc;
}

/* Métricas de Facturación DTE */
.dashfin-invoicing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.mini-stat-card {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
}

.m-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    margin-bottom: 4px;
}

.m-val {
    font-size: 19px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.m-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

/* Tipos de DTE */
.dte-types-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dte-type-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    font-size: 12.5px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dte-type-item:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.dte-type-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dte-code-badge {
    background: #e0e7ff;
    color: #4338ca;
    font-weight: 700;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* 5. Comparativo Panel */
.dashfin-comparativo-panel {
    padding: 22px;
}

.comparativo-selectors {
    display: flex;
    align-items: center;
    gap: 8px;
}

.comp-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}

.comp-vs {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
}

/* 6. Panel de Movimientos Paginados */
.dashfin-movimientos-panel {
    padding: 22px;
}

.movimientos-totales-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-tag {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
}

.badge-tag.tag-ventas { background: #d1fae5; color: #065f46; }
.badge-tag.tag-compras { background: #dbeafe; color: #1e40af; }
.badge-tag.tag-neto { background: #ede9fe; color: #5b21b6; }

.dashfin-table-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.filter-search-box {
    position: relative;
    flex: 1;
    min-width: 260px;
    display: flex;
    align-items: center;
}

.filter-search-box svg {
    position: absolute;
    left: 12px;
    color: #94a3b8;
}

.filter-search-box .search-input {
    width: 100%;
    padding-left: 36px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 12.5px;
}

.filter-select-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.data-table-hover tbody tr {
    cursor: default;
    transition: background 0.12s ease;
}

.data-table-hover tbody tr:hover {
    background: #f8fafc;
}

.th-sortable {
    cursor: pointer;
    user-select: none;
}

.th-sortable:hover {
    color: #4f46e5;
}

.dashfin-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

.pagination-info {
    font-size: 12px;
    color: #64748b;
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-current {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    padding: 0 8px;
}

/* ==========================================================================
   RESPONSIVIDAD Y ADAPTACIÓN MÓVIL
   ========================================================================== */
@media (max-width: 1024px) {
    .dashfin-two-cols {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashfin-toolbar-row {
        flex-direction: column;
        align-items: stretch;
    }

    .dashfin-actions-group {
        margin-left: 0;
        justify-content: flex-end;
    }

    .dashfin-invoicing-grid {
        grid-template-columns: 1fr;
    }

    .dashfin-chart-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashfin-donut-and-bars {
        flex-direction: column;
    }

    .dashfin-table-filters {
        flex-direction: column;
        align-items: stretch;
    }
}