﻿/* ========================================
   FECRAM - Transport Management System
   Design System & Styles
======================================== */

/* CSS Variables - Design Tokens */
:root {
    /* Colors */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;

    /* Background Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-hover: #334155;

    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Border Colors */
    --border-color: #334155;
    --border-light: #475569;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.3);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Transitions */
    --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Sidebar Width */
    --sidebar-width: 260px;
    --sidebar-collapsed: 80px;
}

/* Reset & Base Styles */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

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

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

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

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

/* ========================================
   LOGIN SCREEN
======================================== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1a2e 50%, var(--bg-secondary) 100%);
    position: relative;
    overflow: hidden;
}

.login-screen::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    animation: pulse 4s ease-in-out infinite;
}

.login-screen::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    animation: pulse 4s ease-in-out infinite reverse;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.login-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    position: relative;
    z-index: 1;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

.login-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.login-logo .logo-icon {
    font-size: 2.5rem;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--success) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.login-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    text-align: center;
}

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.login-footer {
    margin-top: var(--spacing-xl);
    text-align: center;
}

.login-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
   MAIN APPLICATION LAYOUT
======================================== */
.main-app {
    display: flex;
    min-height: 100vh;
}

/* ========================================
   SIDEBAR
======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    z-index: 100;
    transition: var(--transition-normal);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(30, 41, 59, 0.95);
}

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

.btn-toggle-sidebar {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-toggle-sidebar:hover {
    background: var(--primary);
    border-color: var(--primary);
}

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

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

.sidebar.collapsed .sidebar-header {
    flex-direction: column;
    gap: var(--spacing-md);
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: var(--spacing-md) 0;
}

.sidebar.collapsed .nav-icon {
    margin: 0;
    font-size: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo .logo-icon {
    font-size: 1.75rem;
}

.logo .logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--success) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    overflow-y: auto;
    /* Habilitar scroll */
    scrollbar-width: thin;
    /* Para Firefox */
    scrollbar-color: var(--primary) transparent;
}

/* Scrollbar personalizada para sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2) 0%, rgba(37, 99, 235, 0.1) 100%);
    color: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    width: 100%;
    padding: var(--spacing-md);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 500;
}

.btn-logout:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* ========================================
   MAIN CONTENT
======================================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: var(--transition-normal);
}

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

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(30, 41, 59, 0.8);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.header-left h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.header-date {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.btn-ai-toggle {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-fast);
}

.btn-ai-toggle:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.content-area {
    flex: 1;
    padding: var(--spacing-xl);
    overflow-y: auto;
}

/* ========================================
   SECTIONS
======================================== */
.section {
    display: none;
    opacity: 0;
    /* Ensure no layout shift when hidden, though display:none handles it */
}

.section.active {
    display: block;
    animation: fadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeSlideUp {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
        filter: blur(4px);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ========================================
   CARDS & STATS
======================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: var(--spacing-lg);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
}

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

.stat-icon {
    font-size: 2rem;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
}

.stat-income .stat-icon {
    background: rgba(16, 185, 129, 0.2);
}

.stat-expense .stat-icon {
    background: rgba(239, 68, 68, 0.2);
}

.stat-net .stat-icon {
    background: rgba(37, 99, 235, 0.2);
}

.stat-units .stat-icon {
    background: rgba(245, 158, 11, 0.2);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-income .stat-value {
    color: var(--success);
}

.stat-expense .stat-value {
    color: var(--danger);
}

.stat-net .stat-value {
    color: var(--primary-light);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.chart-card {
    min-height: 350px;
}

.chart-card .card-body {
    height: 280px;
}

/* ========================================
   TABLES
======================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.data-table tbody tr {
    transition: var(--transition-fast);
    animation: fadeInRow 0.3s ease-out forwards;
}

@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table .status-badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.activo {
    background: var(--success-light);
    color: var(--success);
}

.status-badge.inactivo {
    background: var(--danger-light);
    color: var(--danger);
}

.status-badge.mantenimiento {
    background: var(--warning-light);
    color: var(--warning);
}

/* ========================================
   BUTTONS
======================================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-icon {
    padding: var(--spacing-sm);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

/* ========================================
   FORMS & INPUTS
======================================== */
.search-bar {
    margin-bottom: var(--spacing-lg);
}

.search-bar input {
    width: 100%;
    max-width: 400px;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
}

select {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--primary);
}

.report-filters {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

/* ========================================
   UPLOAD AREA
======================================== */
.upload-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl) * 2;
    background: var(--bg-card);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
    min-height: 250px;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
}

.upload-area h4 {
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.upload-info {
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.upload-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* File Preview */
.file-preview {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.preview-content {
    max-height: 600px;
    /* Aumentado de 400px a 600px para ver mÃ¡s filas */
    overflow: auto;
    padding: var(--spacing-md);
    /* Mejorar el scroll horizontal */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling en mÃ³viles */
}

.preview-table {
    width: max-content;
    /* Permitir que la tabla se expanda segÃºn el contenido */
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    /* Aumentado de 0.8rem para mejor legibilidad */
    table-layout: auto;
    /* Permitir que las celdas se ajusten automÃ¡ticamente */
}

.preview-table th,
.preview-table td {
    padding: 0.75rem;
    /* Aumentado para mÃ¡s espacio */
    border: 1px solid var(--border-color);
    text-align: left;
    min-width: 120px;
    /* Ancho mÃ­nimo para celdas */
    max-width: 250px;
    white-space: normal;
    /* Permitir salto de lÃ­nea */
    word-wrap: break-word;
    vertical-align: middle;
}

.preview-table th {
    background: var(--primary);
    font-weight: 600;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: center;
}

.preview-table tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}

.preview-table tbody tr:hover {
    background: var(--bg-hover);
    cursor: default;
}

/* Estilos para nÃºmeros */
.preview-table td[style*="text-align: right"] {
    font-weight: 500;
}


/* ========================================
   REPORTS
======================================== */
.report-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.empty-report {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl) * 2;
    text-align: center;
    min-height: 300px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.empty-report p {
    color: var(--text-secondary);
}

/* Report Content */
.report-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: var(--spacing-lg);
    text-align: center;
}

.report-header h2 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-xs);
}

.report-header p {
    font-size: 0.875rem;
    opacity: 0.9;
}

.report-body {
    padding: var(--spacing-lg);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--spacing-lg);
    font-size: 0.8rem;
}

.report-table th,
.report-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    text-align: left;
}

.report-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
}

.report-table .total-row {
    background: var(--bg-tertiary);
    font-weight: 700;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm);
}

.summary-item .label {
    font-weight: 500;
    color: var(--text-secondary);
}

.summary-item .value {
    font-weight: 700;
    font-size: 1.1rem;
}

.summary-item.income .value {
    color: var(--success);
}

.summary-item.expense .value {
    color: var(--danger);
}

.summary-item.net .value {
    color: var(--primary-light);
}

/* Expenses Section */
.expenses-section {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.expenses-section h4 {
    margin-bottom: var(--spacing-md);
    color: var(--warning);
}

/* ========================================
   AGREGADOS
======================================== */
.agregados-info {
    margin-bottom: var(--spacing-lg);
}

.info-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid var(--info);
    border-radius: var(--radius-md);
}

.info-icon {
    font-size: 1.5rem;
}

.info-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.agregados-summary {
    margin-top: var(--spacing-lg);
    display: flex;
    justify-content: flex-end;
}

.summary-card {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    padding: var(--spacing-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    text-align: right;
}

.summary-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.summary-value.income {
    color: var(--success);
}

/* ========================================
   AI ASSISTANT PANEL
======================================== */
.ai-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 400px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transform: translateX(100%);
    transition: var(--transition-normal);
}

.ai-panel.active {
    transform: translateX(0);
}

.ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
}

.ai-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: white;
}

.ai-title span {
    font-size: 1.5rem;
}

.ai-title h3 {
    font-size: 1rem;
}

.ai-header .btn-close {
    color: white;
}

.ai-chat {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.ai-message {
    display: flex;
    gap: var(--spacing-sm);
    max-width: 90%;
}

.ai-message.bot {
    align-self: flex-start;
}

.ai-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.message-content {
    background: var(--bg-tertiary);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
}

.ai-message.user .message-content {
    background: var(--primary);
    color: white;
}

.message-content p {
    font-size: 0.875rem;
    margin-bottom: var(--spacing-sm);
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin-left: var(--spacing-lg);
    font-size: 0.875rem;
}

.message-content li {
    margin-bottom: var(--spacing-xs);
}

.ai-input-container {
    padding: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

.ai-quick-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.quick-action {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.quick-action:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.ai-input-wrapper {
    display: flex;
    gap: var(--spacing-sm);
    align-items: flex-end;
}

.ai-input-wrapper textarea {
    flex: 1;
    padding: var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    resize: none;
    max-height: 120px;
}

.ai-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-send {
    padding: var(--spacing-md);
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    transition: var(--transition-fast);
}

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

/* AI Tabs */
.ai-tabs {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-color);
    padding: 0;
}

.ai-tab {
    flex: 1;
    padding: var(--spacing-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    border-bottom: 3px solid transparent;
}

.ai-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

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

.ai-tab span {
    font-size: 1.1rem;
}

/* AI Tab Content */
.ai-tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.ai-tab-content.active {
    display: flex;
}

/* AI Action Bar */
.ai-action-bar {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
    border-top: 1px solid var(--border-color);
    padding-top: var(--spacing-md);
}

.btn-save-chat,
.btn-new-chat {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-save-chat:hover {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-new-chat:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Saved Chats Section */
.saved-chats-header {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.saved-chats-header h4 {
    margin-bottom: var(--spacing-md);
    font-size: 1rem;
    color: var(--text-primary);
}

.saved-chats-search {
    position: relative;
}

.saved-chats-search input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.saved-chats-search input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Saved Chats List */
.saved-chats-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

.empty-saved-chats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl) var(--spacing-lg);
    text-align: center;
    height: 100%;
    min-height: 300px;
}

.empty-saved-chats .empty-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.3;
}

.empty-saved-chats h4 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.empty-saved-chats p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    max-width: 280px;
    line-height: 1.5;
}

/* Saved Chat Card */
.saved-chat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.saved-chat-card:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.saved-chat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

.saved-chat-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.saved-chat-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.saved-chat-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    margin-bottom: var(--spacing-sm);
}

.saved-chat-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

.saved-chat-btn {
    flex: 1;
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.saved-chat-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.saved-chat-btn.delete:hover {
    background: var(--danger);
    border-color: var(--danger);
}

.saved-chat-message-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: 12px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
}


/* ========================================
   MODALS
======================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing-lg);
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

.modal-large {
    max-width: 900px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

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

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-form {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.modal-body {
    padding: var(--spacing-lg);
    max-height: 60vh;
    overflow-y: auto;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
    padding-top: var(--spacing-md);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ========================================
   RECENT LIST
======================================== */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.recent-item:hover {
    background: var(--bg-hover);
}

.recent-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.recent-icon {
    font-size: 1.25rem;
}

.recent-details {
    display: flex;
    flex-direction: column;
}

.recent-title {
    font-weight: 500;
    font-size: 0.875rem;
}

.recent-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.empty-message {
    color: var(--text-muted);
    text-align: center;
    padding: var(--spacing-lg);
}

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

    .ai-panel {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

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

    .report-filters {
        width: 100%;
    }
}

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

    .stat-card {
        padding: var(--spacing-md);
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .content-area {
        padding: var(--spacing-md);
    }
}

/* ========================================
   SCROLLBAR STYLING
======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   LOADING STATES
======================================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {

    .sidebar,
    .main-header,
    .ai-panel,
    .btn-primary,
    .btn-secondary {
        display: none !important;
    }

    .main-content {
        margin: 0;
    }

    .report-container {
        border: none;
        box-shadow: none;
    }
}

/* ========================================
   CALENDAR SECTION
 ======================================== */
.calendar-container {
    margin-bottom: var(--spacing-lg);
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.calendar-quick-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.cal-select,
.cal-input {
    padding: 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.calendar-grid,
.calendar-header-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 1rem;
}

.calendar-header-grid div {
    text-align: center;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 0.5rem;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.calendar-day {
    min-height: 120px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.calendar-day.today {
    border: 2px solid var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.calendar-day.has-accounting {
    border-bottom: 4px solid var(--success);
}

.day-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.day-week-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
    cursor: pointer;
    transition: all 0.2s;
}

.day-week-label:hover {
    background: var(--primary);
    color: white;
}

.day-note-indicator {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1rem;
}

.calendar-day.empty {
    background: transparent;
    border: 1px dashed var(--border-color);
    cursor: default;
}

/* Workbook Manager (Mis Libros View) */
.workbook-manager {
    padding: 2.5rem;
    animation: fadeIn 0.4s ease;
}

.workbook-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 1.5rem;
}

.header-text h1 {
    font-size: 2.25rem;
    color: #0f172a;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.header-text p {
    color: #64748b;
    font-size: 1.1rem;
}

.workbook-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.workbook-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.workbook-card:hover {
    transform: translateY(-2px);
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}

.workbook-info {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.workbook-icon-wrapper {
    width: 48px;
    height: 48px;
    background: #eff6ff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #3b82f6;
}

.workbook-text {
    display: flex;
    flex-direction: column;
}

.workbook-info h3 {
    font-size: 1.05rem;
    color: #1e293b;
    font-weight: 700;
    margin: 0;
}

.workbook-info p {
    font-size: 0.8rem;
    color: #64748b;
    margin: 4px 0 0 0;
}

.workbook-card-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-card-action {
    background: #fff;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-card-action:hover {
    background: #f8fafc;
    border-color: #3b82f6;
    color: #3b82f6;
}

.btn-card-action.delete:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
}

/* Spreadsheet Editor View */
.spreadsheet-editor {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f1f5f9;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2.5rem;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

#currentWorkbookTitle {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
}

.btn-back {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    color: #475569;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-danger-outline:hover {
    background: #fef2f2;
    transform: translateY(-1px);
}

.excel-app-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    margin: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.excel-toolbar {
    padding: 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.excel-formula-bar {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
}

.formula-label {
    padding: 0.4rem 1rem;
    background: #f1f5f9;
    font-style: italic;
    font-weight: 800;
    color: #64748b;
    border-right: 1px solid #cbd5e1;
}

.excel-formula-bar input {
    flex: 1;
    border: none;
    padding: 0.4rem 1rem;
    font-family: inherit;
    outline: none;
}

.excel-container {
    flex: 1;
    overflow: auto;
}

.excel-table {
    border-collapse: collapse;
    width: 100%;
}

.excel-table th,
.excel-table td {
    border: 1px solid #e2e8f0;
    padding: 8px 12px;
    font-size: 13px;
    color: #334155;
}

.col-header,
.row-header {
    background: #f8fafc;
    text-align: center;
    color: #94a3b8;
    font-weight: 600;
    font-size: 11px;
}

.excel-title-row {
    background: #217346;
    color: #ffffff;
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 1rem;
}

.excel-section-header {
    background: #f1f5f9;
    font-weight: 700;
}

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

.excel-bold {
    font-weight: 700;
}

.excel-sheet-nav-wrapper {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 0 1rem;
}

.excel-sheet-nav {
    display: flex;
}

.sheet-tab {
    padding: 0.8rem 1.5rem;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    border-right: 1px solid #e2e8f0;
    transition: all 0.2s;
    font-weight: 500;
}

.sheet-tab.active {
    background: #ffffff;
    color: #217346;
    font-weight: 700;
    box-shadow: inset 0 -3px 0 #217346;
}

.btn-add-sheet {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1.5rem;
    color: #94a3b8;
    transition: color 0.2s;
}

.excel-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: #f8fafc;
    border-bottom: 1px solid #cbd5e1;
}

.excel-toolbar-left {
    flex: 1;
}

.zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    padding: 5px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    margin-left: 15px;
}

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

.btn-zoom {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-zoom:hover {
    background: #e2e8f0;
}

#zoomSlider {
    width: 100px;
}

#zoomValue {
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    min-width: 40px;
    text-align: right;
}

/* ========================================
   EXCEL GRID STYLE (A, B, C... 1, 2, 3...)
   ======================================== */
.excel-spreadsheet-container {
    display: block;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    overflow: auto;
    position: relative;
    height: 100%;
}

.excel-spreadsheet-area {
    display: inline-block;
    background: #fff;
    transform-origin: top left;
    padding: 20px;
}

/* THE TABLE (Pixel-Locked Grid) */
.excel-table {
    border-collapse: collapse;
    table-layout: fixed;
    border: none;
}

.excel-grid-header {
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    border: 1px solid #e2e8f0;
    height: 35px;
    user-select: none;
    position: sticky;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.excel-grid-header.col-label {
    top: 0;
    z-index: 50;
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #f8fafc;
}

.excel-grid-header.row-label {
    left: 0;
    z-index: 60;
    width: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.excel-grid-header.corner {
    top: 0;
    left: 0;
    z-index: 100;
    background: #f1f5f9;
}

.excel-table td {
    height: 30px;
    border: 1px solid #e2e8f0;
    padding: 0 12px;
    font-size: 11px;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    vertical-align: middle;
}

.excel-table tr.main-header td {
    background: #f2f2f2;
    font-weight: bold;
    text-align: center;
    color: #000;
}

.excel-table tr.group-header td {
    font-weight: bold;
    text-align: center;
    color: #000;
}

.excel-editable-cell:focus {
    outline: 2px solid #217346;
    outline-offset: -2px;
    background: #fff !important;
    z-index: 5;
}

.excel-num {
    text-align: right;
    font-family: 'Consolas', 'Monaco', monospace;
}

.bg-excel-ingreso {
    background: #c6efce !important;
    color: #006100 !important;
    font-weight: bold;
}

.bg-excel-egreso {
    background: #ffffcc !important;
    color: #9c6500 !important;
    font-weight: bold;
}

.bg-excel-total {
    background: #ffc7ce !important;
    color: #9c0006 !important;
    font-weight: bold;
}

.excel-box {
    border: 1px solid #000;
    min-width: 130px;
    height: 60px;
    display: flex;
    flex-direction: column;
}

.excel-box-title {
    font-weight: bold;
    font-size: 10px;
    text-align: center;
    border-bottom: 1px solid #000;
    padding: 3px;
    text-transform: uppercase;
}

.excel-box-value {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.excel-table thead tr.group-header th {
    height: 30px;
    vertical-align: middle;
}

.excel-editable-cell:focus {
    background: #fff !important;
    outline: 2px solid #217346 !important;
    z-index: 10;
}

.excel-num {
    text-align: right;
    font-family: 'Courier New', Courier, monospace;
}

/* ========================================
   CONTABILIDAD PREMIUM (V2) 
   - Estilo exacto segÃºn imagen de referencia
======================================== */
.accounting-v2-container {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.table-premium {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.table-premium thead {
    background: #f8fafc;
}

.table-premium th {
    padding: 1.25rem 1rem;
    text-align: left;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    border-bottom: 1.5px solid #e2e8f0;
    border-right: 1.5px solid #e2e8f0;
    background: #f8fafc;
}

.table-premium th:last-child {
    border-right: none;
}

.filter-wrapper {
    margin-top: 10px;
}

.filter-select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.filter-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.table-premium tbody tr {
    transition: background 0.1s;
}

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

.table-premium td {
    padding: 14px 1rem;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

.table-premium td:last-child {
    border-right: none;
}

/* Status Pills */
.badge-type {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 100px;
    font-weight: 800;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
    margin: 0 auto;
}

.badge-expense {
    background: #fee2e2;
    color: #ef4444;
}

.badge-income {
    background: #dcfce7;
    color: #22c55e;
}

/* Checkmark button */
.btn-check-save {
    background: #22c55e;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-check-save:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

/* Fixed alignment for numeric columns */
.col-amount {
    font-size: 1rem;
}

/* ========================================
   CONTABILIDAD MODULE
   ======================================== */

/* Accounting Books Manager */
.accounting-books-manager {
    padding: 2rem;
    animation: fadeIn 0.4s ease;
}

.books-info {
    margin-bottom: 2rem;
}

.accounting-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.accounting-book-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.accounting-book-card:hover {
    transform: translateY(-4px);
    border-color: #3b82f6;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.15);
}

.accounting-book-card h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.accounting-book-card p {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.accounting-book-card .book-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #94a3b8;
    font-size: 0.75rem;
}

.accounting-book-card .book-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.accounting-book-card .btn-book-action {
    flex: 1;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.accounting-book-card .btn-book-action:hover {
    background: #f8fafc;
    border-color: #3b82f6;
    color: #3b82f6;
}

/* Accounting Book Editor */
.accounting-book-editor {
    height: auto;
    /* Permitir crecer con el contenido */
    min-height: calc(100vh - 100px);
    /* MÃ­nimo alto para no verse vacÃ­o */
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.accounting-book-editor.hidden {
    display: none;
}

/* Sheet Tabs */
.sheet-tabs-container {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 12px 12px 0 0;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-bottom: none;
    margin-bottom: -1px;
    position: relative;
    z-index: 10;
}

.sheet-tabs {
    display: flex;
    flex: 1;
}

.sheet-tab {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    color: #64748b;
    cursor: pointer;
    border-right: 1px solid #e2e8f0;
    transition: all 0.2s;
    font-weight: 500;
    background: white;
}

.sheet-tab:first-child {
    border-radius: 12px 0 0 0;
}

.sheet-tab.active {
    background: #eff6ff;
    color: #3b82f6;
    font-weight: 700;
    border-bottom: 3px solid #3b82f6;
}

.sheet-tab:hover:not(.active) {
    background: #f8fafc;
    color: #3b82f6;
}

.btn-add-sheet {
    background: white;
    border: none;
    border-left: 1px solid #e2e8f0;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1.25rem;
    color: #94a3b8;
    transition: all 0.2s;
}

.btn-add-sheet:hover {
    color: #3b82f6;
    background: #f8fafc;
}

/* Editor Header */
.accounting-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background: white;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
}

.btn-back {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

/* Zoom Controls */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.btn-zoom {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-zoom:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
    transform: scale(1.05);
}

.btn-zoom-reset {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #ef4444;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-zoom-reset:hover {
    background: #fee2e2;
    transform: rotate(180deg);
}

.zoom-level {
    min-width: 50px;
    text-align: center;
    font-weight: 700;
    color: #3b82f6;
    font-size: 0.9rem;
}


#currentAccountingBookTitle {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    flex: 1;
    text-align: center;
}

.editor-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-success {
    background: #22c55e;
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-success:hover {
    background: #16a34a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* Accounting Summary Cards */
.accounting-summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.summary-card .summary-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card .summary-value {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
}

.income-card {
    border-left: 4px solid #22c55e;
}

.income-card .summary-value {
    color: #22c55e;
}

.expense-card {
    border-left: 4px solid #ef4444;
}

.expense-card .summary-value {
    color: #ef4444;
}

.balance-card {
    border-left: 4px solid #3b82f6;
}

.balance-card .summary-value {
    color: #3b82f6;
}

/* Accounting Table */
/* Accounting Table Wrapper & Scrollbar personalizado */
.accounting-table-wrapper {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;

    /* ConfiguraciÃ³n crÃ­tica para el scroll */
    width: 100%;
    max-width: calc(100vw - 350px);
    /* Restringir ancho para forzar scroll horizontal (Sidebar + Padding) */

    /* Eliminar restricciones verticales para que la hoja caiga */
    flex: none;

    /* Scroll horizontal si, vertical VISIBLE para usar el de la pÃ¡gina */
    overflow-x: auto;
    overflow-y: visible;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform-origin: top left;
    transition: transform 0.2s ease;
    position: relative;
    padding-bottom: 8px;
    /* Espacio extra para la barra */
    background-color: #0f172a;
    margin-bottom: 20px;
}

/* Estilo de la Barra de Scroll - Alto Contraste */
.accounting-table-wrapper::-webkit-scrollbar {
    height: 18px;
    /* Altura fija visible */
    background: #0f172a;
}

.accounting-table-wrapper::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 4px;
    margin: 2px;
}

.accounting-table-wrapper::-webkit-scrollbar-thumb {
    background-color: #64748b;
    /* Gris medio, buen contraste */
    border-radius: 4px;
    border: 3px solid #1e293b;
    /* Borde oscuro para definir la barra */
}

.accounting-table-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
    /* MÃ¡s claro en hover */
}

/* Flechas de scroll (si el navegador las soporta) */
.accounting-table-wrapper::-webkit-scrollbar-button:single-button {
    background-color: #1e293b;
    display: block;
    background-size: 10px;
    background-repeat: no-repeat;
    background-position: center;
}

.accounting-table-wrapper::-webkit-scrollbar-button:single-button:horizontal:decrement {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='white'><polygon points='70,20 30,50 70,80'/></svg>");
}

.accounting-table-wrapper::-webkit-scrollbar-button:single-button:horizontal:increment {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='white'><polygon points='30,20 70,50 30,80'/></svg>");
}

/* Firefox */
.accounting-table-wrapper {
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #1e293b;
}

.accounting-table {
    width: 100%;
    min-width: 2200px;
    /* FORZAR ANCHO: Asegura que aparezca el scroll */
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    /* Restaurar fondo blanco para la tabla en sÃ­ */
}

.accounting-table thead {
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 10;
}

.accounting-table th {
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    position: relative;
}

.accounting-table th .th-content {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.accounting-table th .th-content.small {
    font-size: 0.65rem;
    color: #94a3b8;
}

.accounting-table tr.sub-header {
    background: #f1f5f9;
}

.accounting-table tr.sub-header th {
    padding: 0.5rem;
    border-bottom: 1px solid #cbd5e1;
}


.accounting-table th .column-filter {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: white;
    color: #334155;
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.accounting-table th .column-filter:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.accounting-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s;
}

.accounting-table tbody tr:hover:not(.input-row) {
    background: #f8fafc;
}

.accounting-table tbody tr.input-row {
    background: #fffbeb;
    border-top: 2px solid #fbbf24;
}

.accounting-table td {
    padding: 0.875rem 1rem;
    color: #334155;
    vertical-align: middle;
}

.accounting-table .table-input {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: white;
    color: #334155;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
}

.accounting-table .table-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.accounting-table .tipo-select {
    font-weight: 700;
    cursor: pointer;
}

.accounting-table .tipo-select option[value="GASTO"] {
    background: #fee2e2;
    color: #ef4444;
}

.accounting-table .tipo-select option[value="INGRESO"] {
    background: #dcfce7;
    color: #22c55e;
}

.btn-add-entry {
    background: #22c55e;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-entry:hover {
    background: #16a34a;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

/* Data rows */
.accounting-table .data-row .tipo-cell {
    text-align: center;
}

.accounting-table .tipo-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.accounting-table .tipo-badge.gasto {
    background: #fee2e2;
    color: #ef4444;
}

.accounting-table .tipo-badge.ingreso {
    background: #dcfce7;
    color: #22c55e;
}

.accounting-table .btn-delete-entry {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.accounting-table .btn-delete-entry:hover {
    background: #fee2e2;
    border-color: #ef4444;
}

/* Responsive */
@media (max-width: 1024px) {
    .accounting-summary-cards {
        grid-template-columns: 1fr;
    }

    .accounting-table-wrapper {
        overflow-x: auto;
    }
}

@media (max-width: 768px) {
    .accounting-editor-header {
        flex-direction: column;
        gap: 1rem;
    }

    .editor-actions {
        width: 100%;
        flex-direction: column;
    }

    .sheet-tabs-container {
        overflow-x: auto;
    }
}

/* AI Assistant Extra Styles */
.message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem;
    border-radius: 4px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.message-content code {
    font-family: monospace;
    font-size: 0.9em;
}

.message-content ul,
.message-content ol {
    margin-left: 1.2rem;
    margin-bottom: 0.5rem;
}

.message-content li {
    margin-bottom: 0.2rem;
}

/* Typing Animation */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    width: fit-content;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
    opacity: 0.7;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Table Actions (Fix for wrapping buttons) */
.table-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    white-space: nowrap;
}

/* Ensure Actions column doesn't wrap */
.data-table td:last-child {
    white-space: nowrap;
}

/* Hide fixed expenses columns in Agregado Mode */
.agregado-mode .col-fixed-expense {
    display: none !important;
}

.agregado-mode .group-fixed-expense {
    display: none !important;
}

/* Switch IGGSS */
.switch-iggss input:checked+.slider-iggss {
    background-color: #22c55e;
}

.switch-iggss input:focus+.slider-iggss {
    box-shadow: 0 0 1px #22c55e;
}

.switch-iggss input:checked+.slider-iggss:before {
    -webkit-transform: translateX(18px);
    -ms-transform: translateX(18px);
    transform: translateX(18px);
}

.slider-iggss:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.modal-xl {
    max-width: 1140px;
    width: 95%;
}

/* ========================================
   FORM INPUT STYLES (DETALLE UNIDAD)
   ======================================== */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    background: var(--bg-secondary);
}

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

/* Specific fix for inputs in detail grid */
.detail-grid .info-group input {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Drag and Drop Navigation */
.nav-item[draggable='true'] {
    cursor: grab;
    transition: background 0.2s, transform 0.2s;
}

.nav-item[draggable='true']:active {
    cursor: grabbing;
}

.nav-item.over {
    border: 2px dashed var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
}/* Document Styles */
.doc-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    transition: var(--transition-fast);
}

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

.doc-icon {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.doc-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden; /* Crucial for truncation */
}

.doc-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.doc-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.doc-actions-item {
    display: flex;
    gap: 0.5rem;
    margin-top: auto; /* Push to bottom if height fixed, though flex col here usually stacks naturally */
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
}


.doc-name { display: block; }

