/* Estilos Base y Variables del Sistema */
:root {
    --primary: #2563eb;          /* Trustworthy tech blue */
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --accent: #f59e0b;           /* Warm gold */
    --accent-dark: #d97706;
    
    --bg-main: #f8fafc;          /* Soft slate */
    --bg-secondary: #f1f5f9;     /* Slate secondary */
    --bg-card: #ffffff;          /* Pure white card */
    
    --text-main: #0f172a;        /* Deep slate 900 */
    --text-muted: #475569;       /* Slate 600 */
    --text-light: #64748b;       /* Slate 500 */
    
    --border: #e2e8f0;           /* Soft border */
    --border-dark: #cbd5e1;
    
    --radius-sm: 8px;
    --radius: 16px;
    --radius-lg: 24px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.02);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
    --shadow-3d: 0 4px 0 var(--border-dark);

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'Fira Code', monospace;
    
    /* Document-specific colors (forced light-paper style for realism) */
    --doc-bg-invoice: #ffffff;
    --doc-text-invoice: #1e293b;
    --doc-border-invoice: #94a3b8;
    
    --doc-bg-ticket: #fcfbf7;
    --doc-text-ticket: #111111;
    
    --doc-bg-remito: #ecfeff;
    --doc-text-remito: #083344;
    --doc-border-remito: #0891b2;
}

[data-theme='dark'] {
    --primary: #6366f1;          /* Modern Indigo */
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --accent: #fbbf24;           /* Warm gold */
    
    --bg-main: #090d16;          /* Deep dark slate */
    --bg-secondary: #111827;     /* Darker slate secondary */
    --bg-card: #1f2937;          /* Rich slate card */
    
    --text-main: #f9fafb;        /* Off-white */
    --text-muted: #cbd5e1;       /* Light gray text */
    --text-light: #94a3b8;       /* Slate 400 */
    
    --border: #374151;           /* Dark slate border */
    --border-dark: #4b5563;
    --shadow-3d: 0 4px 0 var(--border-dark);
}

/* --- Resets e Imagen de Fondo --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    font-family: var(--font-body);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Grid background */
    background-image: 
        linear-gradient(rgba(15, 23, 42, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
}

[data-theme='dark'] body {
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
}

/* --- Navigation Header --- */
.app-header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

[data-theme='dark'] .app-header {
    background: rgba(9, 13, 22, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-main);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: var(--border);
    transform: translateX(-2px);
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-edu {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    background: rgba(37, 99, 235, 0.1);
    padding: 2px 8px;
    border-radius: 99px;
    border: 1px solid rgba(37, 99, 235, 0.2);
    display: inline-block;
}

[data-theme='dark'] .badge-edu {
    color: #818cf8;
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.user-control {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-greeting {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.user-greeting i {
    color: var(--primary);
}

.theme-btn, .btn-reset {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-main);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-btn {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
}

.theme-btn:hover, .btn-reset:hover {
    background: var(--border);
    transform: scale(1.05);
}

.btn-reset {
    padding: 8px 14px;
    font-weight: 700;
    gap: 8px;
    font-size: 0.85rem;
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.05);
}

.btn-reset:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
}

/* --- Layout Principal --- */
.app-workspace {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.workspace-grid {
    display: grid;
    grid-template-columns: 1.1fr 1.9fr;
    gap: 24px;
    align-items: start;
}

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

.panel-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h2 i {
    color: var(--primary);
}

.panel-subtitle {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* --- Selector de Comprobante --- */
.doc-selector-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.doc-tab {
    padding: 10px 8px;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.doc-tab:hover {
    background: var(--bg-secondary);
    color: var(--text-main);
}

.doc-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

/* --- Comprobantes Físicos CSS --- */
.physical-doc-container {
    padding: 24px;
    background: var(--bg-secondary);
    min-height: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.physical-doc {
    display: none;
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius-sm);
    padding: 20px;
    position: relative;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    color: #1e293b;
    border: 1px solid #94a3b8;
    transition: all 0.25s ease;
}

.physical-doc.active {
    display: block;
    animation: slideIn 0.3s ease-out;
}

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

.doc-watermark, .doc-watermark-danger {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-25deg);
    font-size: 3.5rem;
    font-weight: 950;
    opacity: 0.06;
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
}

.doc-watermark-danger {
    color: #ef4444;
    opacity: 0.08;
    font-size: 2.2rem;
    border: 4px solid #ef4444;
    padding: 4px 10px;
    border-radius: 8px;
}

/* Facturas Compras y Ventas */
.doc-factura {
    background: var(--doc-bg-invoice);
    color: var(--doc-text-invoice);
    border-color: var(--doc-border-invoice);
}

.doc-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.emitter-info h3 {
    font-size: 1.1rem;
    font-weight: 900;
    color: #0f172a;
}

.emitter-info p, .doc-meta p, .recipient-info p {
    font-size: 0.75rem;
    margin-top: 2px;
}

.doc-letter-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 2px solid #0f172a;
    padding: 4px 10px;
    background: #f8fafc;
}

.doc-letter-box .letter {
    font-size: 1.8rem;
    font-weight: 950;
    line-height: 1;
}

.doc-letter-box .legend {
    font-size: 0.5rem;
    font-weight: 700;
}

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

.doc-meta h3 {
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 1px;
}

.doc-separator {
    height: 1px;
    background: #cbd5e1;
    margin: 12px 0;
    border: none;
}

.recipient-info {
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.doc-input-text {
    border: none;
    border-bottom: 1px dashed var(--primary);
    background: transparent;
    font-weight: 700;
    font-family: inherit;
    color: inherit;
    outline: none;
    width: 60%;
}

/* Formularios de Factura */
.doc-form {
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-row label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
}

.form-row select, .form-row input[type="number"], .form-row input[type="text"] {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 600;
    outline: none;
    background: #ffffff;
    color: #0f172a;
}

.form-row select:focus, .form-row input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.input-row {
    flex-direction: row;
    gap: 12px;
}

.input-row .col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.check-col {
    justify-content: flex-end;
    padding-bottom: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.input-tip {
    font-size: 0.68rem;
    color: var(--text-light);
    font-style: italic;
    margin-top: 1px;
}

.disabled-input {
    background: #f1f5f9 !important;
    color: #64748b !important;
    border-style: dashed !important;
    cursor: not-allowed;
}

/* Totales Factura */
.doc-totals {
    border-top: 2px solid #0f172a;
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.total-row {
    font-size: 0.82rem;
    display: flex;
    width: 60%;
    justify-content: space-between;
}

.total-row span:last-child {
    font-weight: 700;
}

.grand-total {
    font-size: 0.95rem;
    font-weight: 900;
    border-top: 1px solid #94a3b8;
    padding-top: 4px;
    margin-top: 4px;
    color: #000;
}

/* TICKET */
.doc-ticket {
    background: var(--doc-bg-ticket);
    color: var(--doc-text-ticket);
    font-family: var(--font-mono);
    border: 1px dashed #64748b;
    border-radius: 4px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}

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

.ticket-header h3 {
    font-size: 0.95rem;
    font-weight: 900;
}

.ticket-header p, .ticket-meta p {
    font-size: 0.7rem;
    margin-top: 2px;
}

.ticket-meta {
    margin-top: 12px;
}

.ticket-separator {
    text-align: center;
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: #64748b;
    margin: 8px 0;
}

.ticket-totals {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.ticket-totals .total-row {
    font-size: 0.75rem;
    width: 80%;
}

.ticket-totals .grand-total {
    font-size: 0.88rem;
    border-top: 1px dashed #111111;
}

.ticket-footer {
    text-align: center;
    font-size: 0.68rem;
    margin-top: 20px;
    color: #64748b;
}

/* REMITO */
.doc-remito {
    background: var(--doc-bg-remito);
    color: var(--doc-text-remito);
    border-color: var(--doc-border-remito);
}

.remito-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.remito-header h3 {
    font-size: 1.1rem;
    font-weight: 900;
}

.remito-header p {
    font-size: 0.75rem;
}

.remito-box {
    border-color: var(--doc-border-remito);
    background: #ecfeff;
}

.remito-warning-card {
    display: flex;
    gap: 12px;
    background: rgba(8, 145, 178, 0.08);
    border: 1px solid rgba(8, 145, 178, 0.2);
    border-radius: 8px;
    padding: 12px;
    color: #083344;
}

.remito-warning-card i {
    font-size: 1.4rem;
    color: #0891b2;
}

.remito-warning-card h4 {
    font-size: 0.8rem;
    font-weight: 800;
}

.remito-warning-card p {
    font-size: 0.7rem;
    line-height: 1.3;
    margin-top: 2px;
}

.remito-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}

.sig-line {
    border-top: 1px dashed var(--doc-border-remito);
    text-align: center;
    padding-top: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}

/* Botón de Procesar */
.action-container {
    padding: 16px 24px 24px 24px;
    border-top: 1px solid var(--border);
}

.btn-primary-action {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.btn-primary-action:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-primary-action:active {
    transform: translateY(2px);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.2);
}

/* --- Reportes - Pestañas --- */
.report-tabs-header {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.report-tab {
    flex: 1;
    padding: 16px 8px;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 750;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.report-tab:hover {
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.02);
}

[data-theme='dark'] .report-tab:hover {
    background: rgba(255, 255, 255, 0.02);
}

.report-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--bg-card);
}

.report-tabs-content {
    padding: 24px;
    flex-grow: 1;
    min-height: 480px;
    display: flex;
    flex-direction: column;
}

.report-view {
    display: none;
    flex-direction: column;
    flex-grow: 1;
}

.report-view.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.report-view-header {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.report-view-header h3 {
    font-size: 1.2rem;
    font-weight: 800;
}

.helper-text {
    font-size: 0.8rem;
    color: var(--text-light);
}

.helper-text i {
    color: var(--primary);
}

/* Tablas Contables */
.journal-wrapper, .balance-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.accounting-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.accounting-table th, .accounting-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.accounting-table th {
    background: var(--bg-secondary);
    color: var(--text-main);
    font-weight: 750;
    font-family: var(--font-heading);
}

.col-nro { width: 15%; text-align: center; }
.col-detalle { width: 55%; }
.col-debe, .col-haber { width: 15%; text-align: right; }

.empty-row td {
    text-align: center;
    color: var(--text-light);
    padding: 40px;
    font-style: italic;
}

/* Filas del Diario */
.journal-entry-group {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.journal-entry-group:hover {
    background: rgba(37, 99, 235, 0.04);
}

.journal-entry-group.selected {
    background: rgba(37, 99, 235, 0.08) !important;
    border-left: 4px solid var(--primary);
}

/* Estilo de Sangría y Tradición Contable */
.acc-row-debit {
    font-weight: 600;
}

.acc-row-credit {
    padding-left: 32px !important;
    font-weight: 600;
    color: var(--text-muted);
}

.acc-row-credit-prefix {
    font-style: italic;
    color: var(--text-light);
    margin-right: 4px;
}

.acc-row-legend {
    font-size: 0.78rem;
    color: var(--text-light);
    font-style: italic;
    padding-left: 16px !important;
}

.val-col {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.journal-totals-row td, .balance-totals-row td {
    background: var(--bg-secondary);
    font-weight: 800;
    border-top: 2px double var(--border-dark);
    border-bottom: 2px solid var(--border-dark);
}

.total-val {
    text-align: right;
    font-family: var(--font-mono);
    color: var(--primary);
}

/* Panel de Detalle del Asiento Activo */
.detail-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: slideUp 0.2s ease-out;
}

.detail-panel.hidden {
    display: none;
}

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

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--border-dark);
    padding-bottom: 8px;
}

.detail-header h4 {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-close-detail {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-light);
}

.btn-close-detail:hover {
    color: var(--text-main);
}

.detail-body {
    font-size: 0.85rem;
    line-height: 1.5;
}

.detail-body .explanation-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-body .item {
    margin-bottom: 4px;
}

.detail-body strong {
    color: var(--text-main);
}

.badge-acc-type {
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: bold;
    color: white;
    margin-left: 6px;
    display: inline-block;
}

.badge-a { background-color: #10b981; }  /* Activo - Verde */
.badge-p { background-color: #ef4444; }  /* Pasivo - Rojo */
.badge-pn { background-color: #8b5cf6; } /* PN - Violeta */
.badge-rn { background-color: #f97316; } /* Reg- Negativo - Naranja */
.badge-rp { background-color: #3b82f6; } /* Reg- Positivo - Azul */

/* --- MAYORES (Cuentas "T") --- */
.ledgers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    color: var(--text-light);
}

/* Cuenta T Estilo */
.t-account {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.t-account:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.t-header {
    background: var(--primary);
    color: white;
    padding: 8px;
    text-align: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.t-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 80px;
    position: relative;
}

.t-body::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background-color: var(--border-dark);
}

.t-column {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.t-col-header {
    font-size: 0.68rem;
    font-weight: bold;
    color: var(--text-light);
    text-align: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 4px;
    margin-bottom: 4px;
}

.t-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}

.t-row .row-ref {
    color: var(--text-light);
    font-size: 0.68rem;
}

.t-row .row-val {
    font-weight: bold;
}

.t-totals-line {
    border-top: 1px solid var(--border-dark);
    display: grid;
    grid-template-columns: 1fr 1fr;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 800;
}

.t-total-val {
    padding: 6px;
    text-align: right;
}

.t-footer {
    background: var(--bg-secondary);
    border-top: 2px solid var(--border-dark);
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 800;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.t-footer .saldo-label {
    color: var(--text-muted);
}

.t-footer .saldo-val {
    font-family: var(--font-mono);
    color: var(--primary);
}

/* --- BALANCE GENERAL TABLA --- */
.col-acc { width: 40%; }
.col-group { text-align: center; border-bottom: 1px solid var(--border) !important; }
.col-sub { width: 15%; text-align: right; font-size: 0.75rem !important; }

/* Validación del Balance */
.validation-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-top: 20px;
    font-size: 0.88rem;
    font-weight: 700;
}

.val-neutral {
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.val-success {
    background: rgba(16, 185, 129, 0.1);
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.val-error {
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- Fila Inferior (Archivador + Educativo) --- */
.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

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

.archive-container {
    padding: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--bg-secondary);
    min-height: 120px;
    align-content: flex-start;
}

.empty-archive {
    color: var(--text-light);
    font-style: italic;
    font-size: 0.85rem;
    width: 100%;
    text-align: center;
    padding: 30px;
}

/* Botón del Comprobante Guardado */
.archived-doc-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 5px solid var(--primary);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.archived-doc-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.archived-doc-card.doc-type-compra { border-left-color: #10b981; }
.archived-doc-card.doc-type-venta { border-left-color: #3b82f6; }
.archived-doc-card.doc-type-ticket { border-left-color: #f97316; }
.archived-doc-card.doc-type-remito { border-left-color: #0891b2; }

.archived-doc-card .doc-icon {
    font-size: 1.1rem;
    color: var(--text-light);
}

.archived-doc-card:hover .doc-icon {
    color: var(--primary);
}

/* Panel Educativo */
.education-section {
    flex-grow: 1;
}

.edu-carousel {
    padding: 16px;
}

.edu-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.edu-card h4 {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.edu-card p {
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.edu-card ul {
    margin-top: 8px;
    margin-left: 16px;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: var(--text-muted);
}

/* --- Modales --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close-modal {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    line-height: 1;
}

.btn-close-modal:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.modal-body strong {
    color: var(--text-main);
}

.modal-body ul {
    margin-left: 20px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    background: var(--bg-secondary);
}

.btn-modal-ok {
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    font-weight: 750;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-modal-ok:hover {
    background: var(--primary-dark);
}

.modal-warning-box {
    display: flex;
    gap: 12px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    padding: 14px;
    color: #991b1b;
    margin-bottom: 12px;
}

[data-theme='dark'] .modal-warning-box {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

.modal-warning-box i {
    font-size: 1.5rem;
}

.modal-warning-box h4 {
    font-weight: 800;
}

/* --- Dropdown Menú de Actividades Contables --- */
.nav-activities {
    position: relative;
    display: inline-block;
}

.dropdown-activities {
    position: relative;
}

.btn-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    font-family: var(--font-heading);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-dropdown:hover {
    background: var(--border);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-dropdown i.fa-chevron-down {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

/* Rotación del icono en hover */
.dropdown-activities:hover .btn-dropdown i.fa-chevron-down {
    transform: rotate(180deg);
}

.dropdown-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: var(--bg-card);
    min-width: 240px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
    pointer-events: none;
}

[data-theme='dark'] .dropdown-content {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    background: var(--bg-card);
    border-color: var(--border);
}

/* Mostrar dropdown al pasar el ratón */
.dropdown-activities:hover .dropdown-content {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.dropdown-content a {
    color: var(--text-main);
    padding: 12px 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-bottom: 1px solid var(--border);
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a i {
    color: var(--primary);
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

.dropdown-content a:hover {
    background-color: var(--bg-secondary);
    color: var(--primary);
}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }
    
    .nav-activities {
        width: 100%;
        display: flex;
        justify-content: center;
    }
}
