:root {
    /* Color Palette - Core (High Comfort Pastel) */
    --primary-color: #e09b7d;
    /* Pastel Peach */
    --primary-dark: #cc8b6f;
    --accent-color: #a8c1c9;
    /* Soft Slate/Blue */
    --success-color: #a8c9a7;
    /* Sage Green */
    --danger-color: #d9a0a0;
    /* Dusty Rose */

    /* Light Theme (Default) */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --bg-sidebar: #111827;
    --border-color: #e5e7eb;
    --input-bg: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);

    /* Spacing / Density (Default: Comfortable) */
    --padding-card: 1.5rem;
    --padding-item: 0.7rem 1rem;
    --gap-grid: 1.5rem;
    --font-base: 1rem;
    --font-h1: 1.8rem;
    --font-h2: 1.5rem;
    --font-h3: 1.2rem;
    --sidebar-width: 280px;

    /* Shared */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: 0.2s ease-in-out;
    --border-radius: 12px;
}

/* Dark Theme (Minimalist & Pastel - High Comfort) */
body.theme-dark {
    color-scheme: dark;
    --text-primary: #dcdcdc;
    --text-secondary: #a0a09b;
    --bg-body: #242222;
    /* Warm dark brown-gray */
    --bg-card: #2d2d2d;
    --bg-sidebar: #1c1b1b;
    --border-color: #3d3d3d;
    --input-bg: #2d2d2d;
    --glass-bg: rgba(45, 45, 45, 0.8);
    --glass-border: rgba(255, 255, 255, 0.05);

    /* Muted Pastel Palette (3 Colors Max) */
    --primary-color: #e09b7d;
    /* Pastel/Dusty Orange */
    --primary-dark: #cc8b6f;
    --accent-color: #a8c1c9;
    /* Soft Slate/Blue */
    --success-color: #a8c9a7;
    /* Sage Green */
    --danger-color: #d9a0a0;
    /* Dusty Rose */
}

/* Component overrides for Dark Mode - Softening Everything */
body.theme-dark .kpi-icon.income {
    background: rgba(168, 201, 167, 0.1);
    color: #a8c9a7;
}

body.theme-dark .kpi-icon.expense {
    background: rgba(217, 160, 160, 0.1);
    color: #d9a0a0;
}

body.theme-dark .kpi-icon.balance {
    background: rgba(168, 193, 201, 0.1);
    color: #a8c1c9;
}

body.theme-dark .nav-item.active {
    background: rgba(168, 193, 201, 0.1);
    color: var(--accent-color);
    border-left: 4px solid var(--accent-color);
    border-radius: 0 8px 8px 0;
}

body.theme-dark .badge.completed,
body.theme-dark .mobile-badge.success {
    background: rgba(168, 201, 167, 0.15) !important;
    color: #a8c9a7 !important;
    border: 1px solid rgba(168, 201, 167, 0.2);
}

body.theme-dark .badge.planned,
body.theme-dark .mobile-badge.warning {
    background: rgba(224, 155, 125, 0.15) !important;
    color: #e09b7d !important;
}

body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3 {
    color: #e09b7d !important;
}

body.theme-dark .btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%) !important;
    color: #0D1220 !important;
    font-weight: 700;
}

body.theme-dark .btn-primary:hover {
    background: linear-gradient(135deg, #E0B870 0%, var(--primary-color) 100%) !important;
    box-shadow: 0 4px 16px rgba(201, 160, 93, 0.35) !important;
}

body.theme-dark #cloud-status-badge {
    background: rgba(224, 155, 125, 0.05) !important;
    border-color: rgba(224, 155, 125, 0.1) !important;
}

body.theme-dark #cloud-icon {
    color: #e09b7d !important;
    opacity: 0.6;
}

body.theme-dark #main-logo,
body.theme-dark #lock-logo {
    filter: brightness(0) invert(1) opacity(0.8);
}

body.theme-dark .nav-item:not(.active) {
    color: #8b949e;
}

/* Density: Compact */
body.density-compact {
    --padding-card: 1rem;
    --padding-item: 0.5rem 0.8rem;
    --gap-grid: 1rem;
    --font-base: 0.9rem;
    --font-h1: 1.5rem;
    --font-h2: 1.3rem;
    --font-h3: 1.1rem;
    --border-radius: 8px;
}

body.density-compact .nav-item {
    padding-top: 4px;
    /* Even more compact */
    padding-bottom: 4px;
    margin-bottom: 2px;
}

body.density-compact .brand {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

body.density-compact .sidebar-divider {
    margin: 0.5rem 0;
}

/* Density: Comfortable (already default, but explicit) */
body.density-comfortable {
    --padding-card: 1.5rem;
    --padding-item: 0.8rem 1rem;
    --gap-grid: 1.5rem;
}

body.density-comfortable .nav-item {
    padding-top: 16px;
    padding-bottom: 16px;
}

/* Density: Elegant */
body.density-elegant {
    --padding-card: 2.5rem;
    --padding-item: 1.2rem 1.5rem;
    --gap-grid: 2.5rem;
    --font-base: 1.1rem;
    --font-h1: 2.5rem;
    --font-h2: 2rem;
    --font-h3: 1.5rem;
    --border-radius: 30px;
}

body.density-elegant .nav-item {
    padding-top: 20px;
    padding-bottom: 20px;
}

body.density-elegant .glass-panel,
body.density-elegant .kpi-card,
body.density-elegant .chart-container {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-body) 100%);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--glass-border);
}

body.density-elegant .sidebar {
    border-right: none;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.05);
}

/* Sidebar Item Active State (Internal Interface) */
.interface-settings .nav-item.active {
    background: rgba(168, 193, 201, 0.1);
    color: var(--accent-color);
    border-left: 4px solid var(--accent-color);
}

.interface-settings .nav-item.active i {
    color: var(--accent-color);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-body);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* Sidebar - Clean Dark Theme like QuickBooks navigation */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0.8rem;
    transition: var(--transition), width 0.3s;
    z-index: 10;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-resizer {
    width: 6px;
    height: 100vh;
    cursor: ew-resize;
    flex-shrink: 0;
    transition: background 0.3s;
    background: transparent;
    z-index: 100;
}

.sidebar-resizer:hover,
.sidebar-resizer.resizing {
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
}

/* Sidebar Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: white;
    padding: 2px;
}

.brand h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    letter-spacing: 0.5px;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: var(--padding-item);
    margin-bottom: 0.4rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:not(.active):hover {
    background: rgba(255, 255, 255, 0.03);
    color: #e5e7eb;
}

.nav-item.active {
    background: rgba(168, 193, 201, 0.1) !important;
    color: var(--accent-color) !important;
    border-left: 4px solid var(--accent-color) !important;
    border-radius: 0 8px 8px 0;
    font-weight: 600;
}

.nav-item:hover i {
    color: #fff;
    transform: scale(1.1);
}

.nav-item.active i {
    color: var(--accent-color) !important;
}

.nav-item i {
    width: 24px;
    text-align: center;
    font-size: 20px;
    color: #d1d5db;
    /* Brighter than text #9ca3af */
    transition: transform 0.2s ease;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin: 1rem 0;
}

/* Submenu Styles */
.submenu {
    list-style: none;
    padding-left: 1.5rem;
    /* Reduced for cleaner look */
    margin-top: 0.2rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.submenu.open {
    max-height: 500px;
    /* Large enough to fit content */
    opacity: 1;
    margin-bottom: 0.5rem;
}

/* Removed keyframes as we use transition now */

.submenu li {
    padding: 10px 12px;
    margin: 4px 0;
    color: #9ca3af;
    cursor: pointer;
    font-size: 13px;
    /* Slightly smaller for hierarchy */
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 6px;
    display: block;
    border-left: 4px solid transparent;
}

.submenu li:hover {
    background: rgba(255, 255, 255, 0.03);
    color: #e5e7eb;
}

.submenu li.active {
    background: rgba(168, 193, 201, 0.08) !important;
    color: var(--accent-color) !important;
    border-left: 4px solid var(--accent-color) !important;
    border-radius: 0 6px 6px 0;
    font-weight: 600;
}

.arrow {
    transition: transform 0.3s;
    font-size: 0.8rem;
}

.nav-item.active .arrow {
    transform: rotate(180deg);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #374151;
    padding: 4px;
}

.user-info .name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
}

.user-info .role {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: var(--padding-card);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg-body);
    transition: var(--transition);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title h1 {
    font-size: var(--font-h1);
    font-weight: 700;
    color: var(--text-primary);
}

#current-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.actions {
    display: flex;
    gap: 1rem;
}

/* Buttons - Premium Styled */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #0D1220;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(201, 160, 93, 0.2);
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #E0B870 0%, var(--primary-color) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(201, 160, 93, 0.35);
}

.btn-primary:active {
    transform: translateY(0px);
    box-shadow: 0 1px 4px rgba(201, 160, 93, 0.2);
}

/* Danger variant */
.btn-danger {
    background: linear-gradient(135deg, #CD5C5C 0%, #A84040 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(205, 92, 92, 0.25);
    text-transform: uppercase;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #E06666 0%, #CD5C5C 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(205, 92, 92, 0.35);
}

/* Success variant */
.btn-success {
    background: linear-gradient(135deg, #5DA67C 0%, #3D8A5D 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(93, 166, 124, 0.25);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(93, 166, 124, 0.35);
}

/* Cards (formerly glass-panel) */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    border-radius: var(--border-radius);
    padding: var(--padding-card);
    color: var(--text-primary);
    transition: var(--transition);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    gap: var(--gap-grid);
    margin-bottom: 2rem;
}

/* KPI Cards */
.kpi-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--padding-card);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.kpi-icon.income {
    background: #d1fae5;
    color: #10b981;
}

.kpi-icon.expense {
    background: #fee2e2;
    color: #ef4444;
}

.kpi-icon.balance {
    background: #e0f2fe;
    color: #0284c7;
}

.kpi-info h3 {
    font-size: calc(var(--font-base) * 0.85);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.kpi-info p {
    font-size: var(--font-h2);
    font-weight: 700;
    color: var(--text-primary);
}

/* Chart Container */
.chart-container {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--padding-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    min-height: 350px;
}

.chart-container.full-width {
    grid-column: span 3;
}

.chart-container.half-width {
    grid-column: span 1;
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

th {
    background: var(--bg-body);
    color: var(--text-primary);
    font-weight: 700;
    text-transform: uppercase;
    font-size: calc(var(--font-base) * 0.75);
    letter-spacing: 0.5px;
    padding: var(--padding-item);
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: var(--padding-item);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: var(--font-base);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: var(--bg-body);
}

/* Zebra Striping */
tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.015);
}

body.theme-dark tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.01);
}

/* Enhanced Contrast for Almn columns */
td[data-label="Almn. Iniciales"] .badge,
td[data-label="Almn. Actuales"] .badge {
    filter: brightness(1.15) contrast(1.1);
    font-weight: 700;
}

body.theme-dark td[data-label="Almn. Iniciales"] .badge {
    color: #c9e0e8 !important;
    /* Brighter accent */
}

body.theme-dark td[data-label="Almn. Actuales"] .badge {
    color: #c9e8c9 !important;
    /* Brighter success */
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-card);
    width: 500px;
    max-width: 90%;
    padding: var(--padding-card);
    border-radius: var(--border-radius);
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.modal-content h2,
.modal-content h3,
.modal-content strong,
.modal-content p,
.modal-content div {
    color: var(--text-primary);
}

.modal-content .close {
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.modal-content .close:hover {
    color: var(--danger-color);
}

.modal-content h2 {
    color: var(--text-primary);
    font-size: var(--font-h2);
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.2s;
}

.close:hover {
    color: var(--text-primary);
}

/* Forms */
.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

input,
select,
textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--input-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-base);
    transition: var(--transition);
    margin-bottom: 0.5rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 95, 85, 0.1);
}

select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

/* Force dark option background in dark mode */
body.theme-dark select option {
    background-color: #1f2937;
    color: #f9fafb;
}

input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.btn-submit {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
}

.btn-icon {
    border: none;
    background: rgba(255,255,255,0.04);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-icon:hover {
    background: rgba(201, 160, 93, 0.12);
    color: var(--primary-color);
    transform: translateY(-1px);
}

.btn-icon.delete:hover {
    color: #CD5C5C;
    background: rgba(205, 92, 92, 0.12);
}

.btn-icon.edit:hover {
    color: var(--primary-color);
    background: rgba(201, 160, 93, 0.12);
}

/* Attachment Buttons and Badges */
.btn-attach {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-attach:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.badge-counter {
    background: var(--danger-color);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
}

/* Module Cards and Grids */
.module-card:hover {
    transform: translateX(5px);
    border-color: var(--accent-color);
}

.attachment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

/* Transaction Styles */
.income-row {
    border-left: 4px solid var(--success-color);
}

.expense-row {
    border-left: 4px solid var(--danger-color);
}

/* Animation for counter */
@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.badge-counter {
    animation: bounce 0.3s ease-out;
}

/* Config Add Forms */
.add-form input,
.add-form select,
.add-form textarea {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.add-form {
    background: var(--bg-body);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

/* Charts Text Color Fix */
/* This will be handled in JS, but defaults are black here */

/* 3D Flip System */
body {
    perspective: 2000px;
}

.app-container {
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flipping-active {
    transform: rotateY(180deg);
}

/* Correct mirrored content mid-animation */
.flipping-mid {
    transform: rotateY(90deg) scale(0.9);
    filter: blur(4px);
    opacity: 0.5;
}

/* Sesiones Theme Overrides */
body.mode-sesiones {
    --primary-color: #6366f1;
    /* Indigo */
    --primary-dark: #4338ca;
    --accent-color: #f43f5e;
    /* Rose */
}

body.mode-sesiones .logo-img {
    filter: hue-rotate(240deg);
    /* Transform logo color */
}

/* Print Styling for Landscape Calendar */
@media print {
    @page {
        size: landscape;
        margin: 0.5cm;
    }

    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        background: white !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Hide Navigation, Sidebar, and Global UI Elements */
    .sidebar,
    .top-bar,
    #newTransBtn,
    .interface-settings,
    .user-profile,
    .app-container>nav {
        display: none !important;
    }

    /* Reset Layout Containers */
    .app-container {
        display: block !important;
        height: auto !important;
        width: 100% !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }

    /* Clean up Content Area */
    #content-area {
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        background: white !important;
        border: none !important;
        width: 100% !important;
    }

    /* Hide ALL Buttons */
    button,
    .btn-primary,
    .btn-icon,
    .actions,
    a.btn {
        display: none !important;
    }

    /* Calendar Specific Print Styles */
    .glass-panel {
        background: white !important;
        box-shadow: none !important;
        border: none !important;
        backdrop-filter: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Calendar Header */
    .glass-panel>div:first-child {
        display: block !important;
        text-align: center !important;
        margin-bottom: 20px !important;
        justify-content: center !important;
    }

    /* Ensure Month Title is visible and centered */
    .glass-panel>div:first-child h3 {
        color: black !important;
        font-size: 24pt !important;
        margin: 0 !important;
        padding: 0 !important;
        text-align: center !important;
        width: 100% !important;
        display: block !important;
    }

    /* Hide the button containers in the header explicitly if generic button hiding fails */
    .glass-panel>div:first-child>div {
        display: none !important;
    }

    /* EXCEPT the wrapper containing H3 */
    .glass-panel>div:first-child>div:first-child {
        display: block !important;
        text-align: center !important;
        width: 100%;
    }

    /* Calendar Grid */
    .calendar-grid {
        display: grid !important;
        grid-template-columns: repeat(7, 1fr) !important;
        width: 100% !important;
        border: 1px solid #000 !important;
        border-radius: 0 !important;
        gap: 0 !important;
        background: white !important;
    }

    .calendar-grid>div {
        border: 1px solid #ccc !important;
        color: black !important;
        background: white !important;
        page-break-inside: avoid;
    }

    /* Day Headers (Lun, Mar...) */
    .calendar-grid>div:nth-child(-n+7) {
        background-color: #f0f0f0 !important;
        font-weight: bold !important;
        border-bottom: 2px solid #000 !important;
    }

    /* Event items in calendar */
    .calendar-grid .calendar-event,
    .calendar-grid>div>div>div {
        border: 1px solid #999 !important;
        color: black !important;
        background: #f9f9f9 !important;
        print-color-adjust: exact !important;
    }
}

/* Lock Screen Styles */
.lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(36, 34, 34, 0.98);
    /* Git-SCM Warm Dark Style */
    backdrop-filter: blur(15px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.lock-content {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    border: 1px solid var(--border-color);
    width: 320px;
}

.lock-brand h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.lock-brand p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.pin-display {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.pin-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    transition: all 0.2s;
}

.pin-dot.filled {
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.2rem;
}

.pin-keypad button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin-keypad button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.pin-keypad button:active {
    transform: scale(0.95);
}

.pin-keypad .action-btn {
    font-size: 1.2rem;
    background: transparent;
    border-color: transparent;
}

.pin-keypad .go-btn {
    color: var(--success-color);
}

.pin-box {
    width: 40px;
    height: 50px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-body);
    color: var(--text-primary);
    font-weight: 700;
    transition: all 0.2s;
    outline: none;
}

.pin-box:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(212, 163, 115, 0.2);
    transform: translateY(-2px);
}

.pin-box.error {
    border-color: var(--danger-color);
    background: #fef2f2;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 250px;
        padding: 1rem !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
    }

    table {
        min-width: 600px;
    }

    /* PWA Mobile Optimization */
    .kpi-card {
        padding: 0.8rem;
        gap: 0.8rem;
    }

    .kpi-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .kpi-info p {
        font-size: 1.2rem;
    }

    .kpi-info h3 {
        font-size: 0.7rem;
    }

    /* Safe Area for modern phones */
    body {
        padding-bottom: env(safe-area-inset-bottom);
        overscroll-behavior-y: contain;
    }

    .sidebar {
        padding-top: env(safe-area-inset-top);
    }
}

/* Responsive Grid Utilities (Global) */
.grid-2-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.grid-3-cols {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}

.grid-4-cols {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {

    .grid-2-cols,
    .grid-3-cols,
    .grid-4-cols {
        grid-template-columns: 1fr !important;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: #ffffff;
    color: #1f2937;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 280px;
    border-left: 4px solid var(--accent-color);
    animation: toast-in 0.3s ease-out forwards;
}

.toast.info {
    border-left-color: #3b82f6;
}

.toast.success {
    border-left-color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}

@keyframes toast-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toast-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* PWA Smart Banner */
.pwa-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5000;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.8rem 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    animation: slide-down 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.pwa-app-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.pwa-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pwa-banner-text strong {
    font-size: 0.95rem;
    color: var(--text-primary);
}

.pwa-banner-text span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.btn-install-pwa {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

.pwa-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* iOS Specific Modal */
.ios-modal {
    text-align: center;
}

.ios-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.ios-app-icon {
    width: 70px;
    height: 70px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.ios-steps {
    text-align: left;
    margin: 1.5rem 0;
    padding-left: 1.2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.ios-steps li {
    margin-bottom: 1rem;
    line-height: 1.4;
}

@keyframes slide-down {
    from {
        transform: translateY(-100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes animate-up {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1000;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 990;
        backdrop-filter: blur(4px);
    }

    .sidebar.open+.sidebar-overlay {
        display: block;
    }

    .main-content {
        padding: 1rem;
        padding-top: 5rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .chart-container.full-width,
    .chart-container.half-width {
        grid-column: span 1;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .actions {
        width: 100%;
        justify-content: space-between;
    }

    .grid-2-cols {
        grid-template-columns: 1fr;
    }

    /* PWA Mobile Adjustments */
    .mobile-header {
        display: flex !important;
        /* Force display on mobile */
        padding: 0.8rem 1rem;
        background: var(--bg-sidebar);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 900;
        align-items: center;
        justify-content: space-between;
        color: white;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .mobile-menu-btn {
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.5rem;
    }

    /* Transaction Form Grid Fix on Mobile */
    #transactionForm>div[style*="grid-template-columns: 1fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }

    .mobile-full-width {
        width: 100% !important;
    }
}

/* --- FAB: ACCESO RÁPIDO SESIONES --- */
.fab-container {
    position: fixed;
    bottom: 30px;
    right: 25px;
    z-index: 990;
    /* Just below some tooltips but above content */
}

.fab-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    border: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab-btn:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.fab-btn:active {
    transform: scale(0.95);
}

.fab-label {
    position: absolute;
    right: 75px;
    background: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #128C7E;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    pointer-events: none;
    transition: all 0.3s ease;
}

.fab-container:hover .fab-label {
    opacity: 1;
    transform: translateX(0);
}

/* Super Sync Buttons in Sidebar */
.btn-super-sidebar {
    width: 100%;
    margin-bottom: 0.6rem;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: #e5e7eb;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-align: left;
    font-family: 'Outfit', sans-serif;
}

.btn-super-sidebar:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-super-sidebar i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.btn-super-sidebar.sync {
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.05);
}

.btn-super-sidebar.publish {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.2);
    background: rgba(245, 158, 11, 0.05);
}

.btn-super-sidebar.publish:hover {
    background: rgba(245, 158, 11, 0.1);
}

.btn-super-sidebar.sync:hover {
    background: rgba(16, 185, 129, 0.1);
}