/* Import Modern Fonts */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400..700;1,400..700&family=Inter:wght@300;400;500;600;700&display=swap');

/* Color Variables and Theme System */
:root {
    /* Fonts */
    --font-primary: 'Inter', sans-serif;
    --font-heading: 'Instrument Sans', sans-serif;

    /* Theme: Dark (Default) */
    --bg-primary: #050505;
    --bg-secondary: #0d0d0d;
    --bg-card: #141414;
    --bg-card-hover: #1c1c1c;
    --bg-glass: rgba(20, 20, 20, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.15);
    
    /* Brand Colors */
    --color-primary: #b7ed4f; /* Neon green-lime */
    --color-primary-rgb: 183, 237, 79;
    --color-telegram: #24a1de; /* Telegram Blue */
    --color-telegram-rgb: 36, 161, 222;
    
    /* Feedback Colors */
    --color-success: #10b981;
    --color-danger: #f43f5e;
    --color-warning: #f59e0b;
    --color-info: #0ea5e9;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a3a3a3;
    --text-muted: #525252;
    --text-on-primary: #050505;
    
    /* Layout */
    --sidebar-width: 260px;
    --border-radius-lg: 18px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-glow: 0 0 15px rgba(183, 237, 79, 0.2);
}

/* Light Theme overrides */
[data-theme="light"] {
    --bg-primary: #f5f7fa;
    --bg-secondary: #eef1f6;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f3f5;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.06);
    --border-color-hover: rgba(0, 0, 0, 0.12);
    
    --text-primary: #121212;
    --text-secondary: #4a5568;
    --text-muted: #a0aec0;
    --text-on-primary: #ffffff;
    
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 15px rgba(183, 237, 79, 0.1);
    
    --color-primary: #8ac926; /* Slightly darker green for contrast in light mode */
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color-hover);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Layout Architecture */
.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    z-index: 10;
    transition: all 0.3s ease;
    overflow-y: auto;
    max-height: 100vh;
}

/* Custom thin scrollbar for the sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

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

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

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Scrollbar adjustment for light mode on sidebar */
[data-theme="light"] .sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
}

.logo-image-badge {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    object-fit: cover;
    box-shadow: 0 4px 14px rgba(183, 237, 79, 0.25), 0 2px 6px rgba(0, 168, 255, 0.2);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    flex-shrink: 0;
}

.logo-container:hover .logo-image-badge {
    transform: scale(1.08) rotate(-2deg);
    box-shadow: 0 6px 20px rgba(183, 237, 79, 0.4), 0 3px 10px rgba(0, 168, 255, 0.35);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-telegram));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 800;
    font-size: 1.2rem;
    font-family: var(--font-heading);
    box-shadow: 0 4px 12px rgba(183, 237, 79, 0.3);
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    list-style: none;
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item a i,
.nav-item a svg {
    width: 20px;
    height: 20px;
    min-width: 20px;
    flex-shrink: 0;
    stroke-width: 2;
    font-size: 1.1rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

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

.nav-item a:hover i,
.nav-item a:hover svg {
    color: var(--color-primary);
}

.nav-item.active a {
    background-color: rgba(183, 237, 79, 0.1);
    color: var(--color-primary);
    font-weight: 600;
}

.nav-item.active a i,
.nav-item.active a svg {
    color: var(--color-primary);
}

/* Telegram Bot Badge inside Sidebar */
.telegram-status-card {
    background-color: rgba(36, 161, 222, 0.08);
    border: 1px solid rgba(36, 161, 222, 0.2);
    border-radius: var(--border-radius-md);
    padding: 16px;
    margin-top: 24px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.telegram-status-card::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(36, 161, 222, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.tg-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-telegram);
}

.tg-card-body {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

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

.theme-toggle-container {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    flex-shrink: 0;
    padding-bottom: 8px;
}

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

.theme-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(120, 120, 120, 0.25);
    border: 1px solid var(--border-color);
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--slider-active-color, #66bb6a);
    border-color: var(--slider-active-color, #66bb6a);
}

input:checked + .slider:before {
    transform: translateX(20px);
    background-color: #ffffff;
}

/* Small Switch style for chart filters */
.small-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.small-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.small-switch .slider:before {
    height: 12px !important;
    width: 12px !important;
    left: 3px !important;
    bottom: 3px !important;
}

.small-switch input:checked + .slider:before {
    transform: translateX(18px) !important;
}

/* Custom colors for chart legend toggle switches */
input:checked + .slider.slider-ingresos {
    background-color: #10b981;
    border-color: #10b981;
}

input:checked + .slider.slider-gastos {
    background-color: #f43f5e;
    border-color: #f43f5e;
}

/* Main Dashboard Area */
.main-content {
    flex-grow: 1;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    position: relative;
}

/* Tab Panels */
.tab-panel {
    display: none;
    flex-direction: column;
    gap: 32px;
    animation: slideIn 0.3s ease-out;
}

.tab-panel.active {
    display: flex;
}

.header-dashboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.welcome-section h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.welcome-section p {
    color: var(--text-secondary);
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--border-radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn svg, .btn i {
    width: 16px;
    height: 16px;
    stroke-width: 2.5;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--text-on-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(183, 237, 79, 0.3);
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-telegram {
    background-color: var(--color-telegram);
    color: #fff;
}

.btn-telegram:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(36, 161, 222, 0.3);
}

/* Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-color-hover);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--border-radius-md);
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    margin-bottom: 16px;
}

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

.stat-card.expenses .stat-icon {
    color: var(--color-danger);
}

.stat-card.savings .stat-icon {
    color: #10b981;
}

.stat-card.investments .stat-icon {
    color: var(--color-primary);
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 8px;
    letter-spacing: -0.5px;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    margin-top: 8px;
}

.stat-change.up {
    color: var(--color-success);
}

.stat-change.down {
    color: var(--color-danger);
}

.stat-change.neutral {
    color: var(--text-secondary);
}

/* Visualization Grid */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.chart-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 380px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
}

.chart-container {
    flex-grow: 1;
    position: relative;
    width: 100%;
    min-height: 0;
}

/* Data Table Panel */
.content-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
}

/* Table Design */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.custom-table th {
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.custom-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: background-color 0.2s ease;
}

.custom-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .custom-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.01);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-income {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.badge-expense {
    background-color: rgba(244, 63, 94, 0.15);
    color: var(--color-danger);
}

.badge-category {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.acc-pill {
    background-color: rgba(36, 161, 222, 0.1);
    color: var(--color-telegram);
    border: 1px solid rgba(36, 161, 222, 0.2);
    font-weight: 500;
    padding: 2px 6px;
    font-size: 0.75rem;
    border-radius: 4px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    width: 480px;
    padding: 32px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-main);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
}

.modal-close {
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    background: none;
    border: none;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Telegram Simulator Dock */
.telegram-sim-dock {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 380px;
    height: 520px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-main);
    z-index: 50;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    transform: translateY(100%) scale(0.9);
    opacity: 0;
    pointer-events: none;
}

.telegram-sim-dock.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

.tg-header {
    background-color: var(--color-telegram);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tg-header-info {
    flex-grow: 1;
}

.tg-header-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.tg-header-status {
    font-size: 0.75rem;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 4px;
}

.tg-close-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.tg-close-btn:hover {
    opacity: 1;
}

.tg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.tg-body {
    flex-grow: 1;
    background-color: var(--bg-secondary);
    background-image: radial-gradient(rgba(36, 161, 222, 0.05) 1px, transparent 0);
    background-size: 16px 16px;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tg-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: var(--border-radius-md);
    font-size: 0.88rem;
    line-height: 1.4;
    word-break: break-word;
    position: relative;
    animation: slideIn 0.2s ease-out;
}

.tg-msg-bot {
    align-self: flex-start;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.tg-msg-user {
    align-self: flex-end;
    background-color: var(--color-telegram);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.tg-msg-time {
    font-size: 0.65rem;
    display: block;
    text-align: right;
    margin-top: 4px;
    opacity: 0.6;
}

.tg-msg-user .tg-msg-time {
    color: rgba(255, 255, 255, 0.8);
}

.tg-footer {
    padding: 12px 16px;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tg-input {
    flex-grow: 1;
    border: none;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 20px;
    padding: 10px 16px;
    font-family: var(--font-primary);
    font-size: 0.88rem;
}

.tg-input:focus {
    outline: none;
}

.tg-btn-send {
    background-color: var(--color-telegram);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.tg-btn-send:hover {
    transform: scale(1.05);
}

/* Floating Trigger Button */
.tg-floating-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--color-telegram);
    color: #fff;
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(36, 161, 222, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 49;
    font-size: 1.5rem;
    transition: transform 0.2s ease, opacity 0.3s ease;
}

.tg-floating-trigger:hover {
    transform: scale(1.08);
}

.tg-floating-trigger.hidden {
    transform: scale(0.5);
    opacity: 0;
    pointer-events: none;
}

/* Notifications (Toasts) */
.toast-container {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: var(--bg-card);
    border-left: 4px solid var(--color-primary);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 16px 24px;
    box-shadow: var(--shadow-main);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.telegram-style {
    border-left-color: var(--color-telegram);
}

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

.toast-icon {
    font-size: 1.2rem;
}

.toast-content {
    font-size: 0.88rem;
    font-weight: 500;
}

/* Budgets page styles */
.budget-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.budget-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.budget-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.budget-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.budget-cat-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
}

.budget-limits {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.progress-bar-container {
    height: 8px;
    background-color: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
}

.progress-bar {
    height: 100%;
    background-color: var(--color-primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-bar.danger {
    background-color: var(--color-danger);
}

.progress-bar.warning {
    background-color: var(--color-warning);
}

.budget-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Accounts page styles */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.account-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.account-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.account-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.account-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
}

.account-number {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: monospace;
}

.account-balance {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
}

.account-type {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Telegram integration guide page styles */
.integration-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 800px;
}

.integration-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.integration-step {
    display: flex;
    gap: 16px;
}

.step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(36, 161, 222, 0.1);
    color: var(--color-telegram);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.step-desc h4 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.step-desc p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.telegram-code-box {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: var(--border-radius-md);
    margin-top: 12px;
    font-family: monospace;
    font-size: 1rem;
    color: var(--color-telegram);
}

.telegram-code-box i {
    cursor: pointer;
    color: var(--text-secondary);
}

.telegram-code-box i:hover {
    color: var(--text-primary);
}

/* Empty State */
.empty-state {
    padding: 48px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: block;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .budget-grid, .accounts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 16px;
    }
    .logo-container {
        padding-bottom: 12px;
    }
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        margin-top: 16px;
        padding-bottom: 8px;
        gap: 12px;
    }
    .nav-item a {
        padding: 8px 12px;
        font-size: 0.85rem;
        white-space: nowrap;
    }
    .telegram-status-card, .theme-toggle-container {
        display: none;
    }
    .main-content {
        padding: 16px;
        height: calc(100vh - 100px);
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .budget-grid, .accounts-grid {
        grid-template-columns: 1fr;
    }
    .telegram-sim-dock {
        width: calc(100vw - 40px);
        right: 20px;
        bottom: 20px;
    }
    .tg-floating-trigger {
        right: 20px;
        bottom: 20px;
    }
}

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

/* Bottom Resumen Grid Layout (Movimientos y Saldos por Banco) */
.resumen-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
}

.section-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: normal;
    text-transform: none;
}

/* Recent Movements List */
.movements-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.movement-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--border-color);
    transition: all 0.2s ease;
}

.movement-item:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-color-hover);
}

.movement-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.movement-icon.expense-icon {
    background-color: rgba(244, 63, 94, 0.1);
    color: var(--color-danger);
}

.movement-icon.income-icon {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
}

.movement-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.movement-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.movement-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.movement-pills {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.movement-pill {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.movement-pill.cat-pill {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.movement-pill.acc-pill {
    background-color: rgba(36, 161, 222, 0.1);
    color: var(--color-telegram);
    border: 1px solid rgba(36, 161, 222, 0.2);
}

.movement-amount {
    font-size: 1.05rem;
    font-weight: 700;
    text-align: right;
    margin-left: 12px;
}

.movement-amount.expense-amount {
    color: var(--color-danger);
}

.movement-amount.income-amount {
    color: var(--color-success);
}

/* Bank Balances List */
.bank-balances-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.bank-balance-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.bank-balance-item:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-color-hover);
}

.bank-initial-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background-color: var(--color-primary);
    color: var(--text-on-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    font-family: var(--font-heading);
    margin-right: 14px;
    flex-shrink: 0;
    text-transform: uppercase;
}

.bank-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bank-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.bank-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

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

.bank-amount-wrapper {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: 12px;
}

.bank-amount {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.bank-amount.positive {
    color: var(--color-success);
}

.bank-amount.negative {
    color: var(--color-danger);
}

.bank-amount-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

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

/* Month Selector Layout */
.month-selector-container {
    flex: 1;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.month-selector {
    display: flex;
    gap: 4px;
    padding: 4px;
    background-color: var(--bg-secondary);
    border-radius: 30px;
    border: 1px solid var(--border-color);
    overflow-x: auto;
    max-width: 100%;
}

.month-btn {
    background: none;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.month-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.month-btn.active {
    color: var(--text-on-primary);
    background-color: var(--color-primary);
    font-weight: 700;
}

/* Mes en curso: se marca siempre con el color nativo, aunque el filtro activo sea otro */
.month-btn.is-current {
    color: var(--color-primary);
    box-shadow: inset 0 0 0 1.5px var(--color-primary);
    font-weight: 700;
}

.month-btn.is-current:hover {
    color: var(--color-primary);
    background-color: rgba(183, 237, 79, 0.08);
}

.month-btn.active.is-current {
    color: var(--text-on-primary);
    box-shadow: none;
}

/* Icon-only Button Layout */
.btn-icon-only {
    width: 42px;
    height: 42px;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-md);
}

@media (max-width: 900px) {
    .header-dashboard {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    .month-selector-container {
        justify-content: flex-start;
        width: 100%;
    }
    .month-selector {
        width: 100%;
    }
}

.stat-card.cash-available .stat-icon {
    color: var(--color-success);
}

.stat-card.daily-income .stat-icon {
    color: var(--color-success);
}

.stat-card.daily-expense .stat-icon {
    color: var(--color-danger);
}

.stat-card.pending-expenses .stat-icon {
    color: var(--color-danger);
}

/* Budget Analysis Grid Layout */
.budget-analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
    width: 100%;
}

.table-header-yellow {
    background-color: rgba(251, 191, 36, 0.12);
    border-bottom: 1px solid rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    padding: 12px 20px;
    text-align: center;
}

.table-header-yellow h3 {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 0;
}

.table-header-purple {
    background-color: rgba(168, 85, 247, 0.12);
    border-bottom: 1px solid rgba(168, 85, 247, 0.2);
    color: #c084fc;
    padding: 12px 20px;
    text-align: center;
}

.table-header-purple h3 {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin: 0;
}

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

.analysis-table th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
}

.analysis-table td {
    padding: 11px 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.analysis-table tr:last-child td {
    border-bottom: none;
}

.analysis-table tr.total-row td,
.analysis-table tr.restante-row td {
    color: var(--text-primary);
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

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

.stat-card.pending-collections .stat-icon {
    color: var(--color-warning);
}

.badge-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 12px;
    white-space: nowrap;
}

.badge-status.completado {
    background-color: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.badge-status.pendiente {
    background-color: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
}

/* Projects and Saving Goals Styles */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    width: 100%;
}

.project-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

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

.project-title-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.project-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.project-progress-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0;
}

.project-progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.project-progress-bar {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.project-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-success));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 12px;
    margin-top: 4px;
}

.project-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

/* Category header titles for Projects lists */
.project-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 24px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-left: 4px solid var(--color-primary);
    padding-left: 10px;
}

.project-section-title i {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
}

/* Investments Styles */
.investment-item {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.investment-item:hover {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color-hover);
}

.investment-info-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.investment-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.investment-item-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.investment-item-institution {
    font-size: 0.72rem;
    color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

.investment-item-type {
    font-size: 0.72rem;
    color: var(--color-primary);
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 1px 6px;
    border-radius: 4px;
    width: fit-content;
}

.investment-values-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 120px;
}

.investment-current-val {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.investment-gain-val {
    font-size: 0.8rem;
    font-weight: 600;
}

.investment-gain-val.positive {
    color: var(--color-success);
}

.investment-gain-val.negative {
    color: var(--color-danger);
}

.investment-gain-val.neutral {
    color: var(--text-secondary);
}

.investment-item-actions {
    display: flex;
    gap: 6px;
}

.investments-list-container::-webkit-scrollbar {
    width: 6px;
}

.investments-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.investments-list-container::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

/* Habits and Goals Custom Styles */
.habit-streak-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    font-size: 0.85rem;
}

.streak-badge {
    background-color: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.best-streak-badge {
    background-color: rgba(168, 85, 247, 0.1);
    color: #a855f7;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.goal-status-text {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
}

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

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

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

/* Habits Monthly Table Styles */
.habits-table {
    border-collapse: separate;
    border-spacing: 0;
}

.habits-table th, 
.habits-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    text-align: center;
    font-size: 0.85rem;
    white-space: nowrap;
}

.habits-table th {
    background-color: rgba(255, 255, 255, 0.02);
    font-weight: 700;
    color: var(--text-secondary);
}

/* Sticky Column Styles */
.habits-table th.sticky-col,
.habits-table td.sticky-col {
    position: sticky;
    left: 0;
    z-index: 5;
    background-color: #1a1a1a; /* Dark solid background */
    min-width: 40px;
    border-right: 1px solid var(--border-color);
}

.habits-table th.sticky-col-2,
.habits-table td.sticky-col-2 {
    position: sticky;
    left: 40px;
    z-index: 5;
    background-color: #1a1a1a; /* Dark solid background */
    text-align: left;
    min-width: 180px;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    border-right: 2px solid var(--border-color);
    font-weight: 700;
}

/* Make sure the header rows align properly in sticky */
.habits-table thead tr th {
    position: sticky;
    top: 0;
    z-index: 6;
}

.habits-table thead tr th.sticky-col,
.habits-table thead tr th.sticky-col-2 {
    z-index: 7;
}

/* Custom Checkbox styles */
.habit-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.02);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    vertical-align: middle;
}

.habit-checkbox:hover {
    border-color: var(--color-primary);
    background-color: rgba(183, 237, 79, 0.05);
}

.habit-checkbox:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.habit-checkbox:checked::after {
    content: "✓";
    font-size: 13px;
    font-weight: 900;
    color: #141414;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.active-pill {
    background-color: var(--color-primary) !important;
    color: #141414 !important;
    border-color: var(--color-primary) !important;
}

.category-pills-container button {
    transition: all 0.2s ease;
}

.category-pills-container button:hover:not(.active-pill) {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--color-primary) !important;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: var(--color-success) !important;
}

.badge-danger {
    background-color: rgba(244, 63, 94, 0.15) !important;
    color: var(--color-danger) !important;
}

/* CRM Client Cards Styles */
.client-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow-main);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.client-card:hover {
    border-color: rgba(183, 237, 79, 0.2);
}

.client-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.client-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.client-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.client-company {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.client-contact-info {
    display: flex;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.client-contact-info span {
    display: flex;
    align-items: center;
    gap: 4px;
}

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

/* Projects Table & List inside Client Card */
.client-projects-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.client-projects-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.client-project-row {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.client-project-row:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    background-color: var(--bg-card);
}

.project-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.project-row-title-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.project-row-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.project-dates-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    background: rgba(0, 0, 0, 0.1);
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.project-dates-grid div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.project-dates-grid strong {
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* Payment Progress Bar */
.payment-progress-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.payment-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.payment-progress-bar-bg {
    height: 8px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.payment-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-telegram));
    border-radius: 4px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Project Actions & Badges */
.project-row-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
    margin-top: 4px;
}

.project-badges {
    display: flex;
    gap: 8px;
    align-items: center;
}

.badge-interactive {
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.badge-interactive:hover {
    opacity: 0.85;
    transform: scale(1.03);
}

.project-control-btns {
    display: flex;
    gap: 8px;
}

.btn-icon-sm {
    padding: 6px 10px;
    height: 30px;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Timeline Notes CRM styles */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
    margin-left: 8px;
}

.timeline-item {
    position: relative;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -27px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--color-primary);
    border: 2px solid var(--bg-card);
}

.timeline-item-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 2px;
}

.timeline-item-content {
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

/* Abono Payment History CRM style */
.abonos-history-container {
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.abono-pill-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 6px 12px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.abono-pill-row strong {
    color: var(--color-success);
}

input[type="date"] {
    cursor: pointer;
}

/* --- PLANIFICADOR WEEKLY BLOCK STYLES --- */

/* Sub-tabs bar active state */
.sub-tab-btn.active {
    background: rgba(36, 161, 222, 0.15) !important;
    color: var(--color-primary) !important;
}

.sub-tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
}

/* Gradient Classes for Planner Cards */
.bg-grad-lime-cyan {
    background: linear-gradient(135deg, #a3e635, #06b6d4) !important;
    color: #0f172a !important; /* dark text for readability on light gradients */
}
.bg-grad-lime-cyan .block-time, .bg-grad-lime-cyan .block-desc {
    color: rgba(15, 23, 42, 0.8) !important;
}

.bg-grad-cyan-blue {
    background: linear-gradient(135deg, #06b6d4, #3b82f6) !important;
    color: #ffffff !important;
}
.bg-grad-cyan-blue .block-time, .bg-grad-cyan-blue .block-desc {
    color: rgba(255, 255, 255, 0.85) !important;
}

.bg-grad-purple-indigo {
    background: linear-gradient(135deg, #a855f7, #6366f1) !important;
    color: #ffffff !important;
}
.bg-grad-purple-indigo .block-time, .bg-grad-purple-indigo .block-desc {
    color: rgba(255, 255, 255, 0.85) !important;
}

.bg-grad-orange-coral {
    background: linear-gradient(135deg, #f97316, #ef4444) !important;
    color: #ffffff !important;
}
.bg-grad-orange-coral .block-time, .bg-grad-orange-coral .block-desc {
    color: rgba(255, 255, 255, 0.85) !important;
}

.bg-grad-pink-red {
    background: linear-gradient(135deg, #ec4899, #f43f5e) !important;
    color: #ffffff !important;
}
.bg-grad-pink-red .block-time, .bg-grad-pink-red .block-desc {
    color: rgba(255, 255, 255, 0.85) !important;
}

.bg-grad-dark-slate {
    background: linear-gradient(135deg, #475569, #1e293b) !important;
    color: #ffffff !important;
    border: 1px solid var(--border-color) !important;
}
.bg-grad-dark-slate .block-time, .bg-grad-dark-slate .block-desc {
    color: var(--text-muted) !important;
}

.bg-grad-completed-green {
    background: linear-gradient(135deg, #22c55e, #15803d) !important;
    color: #ffffff !important;
}

/* Color adjustment for Hour Column to white */
.time-col-header {
    color: var(--text-primary) !important;
}

.hour-cell {
    color: var(--text-primary) !important;
}

/* Time Block Card container */
.planner-block-card {
    position: absolute;
    left: 4px;
    right: 4px;
    border-radius: var(--border-radius-md);
    padding: 2px 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.1;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 10;
}

.planner-block-card:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.35);
    z-index: 20;
}

.planner-block-card .block-title {
    font-weight: 700;
    white-space: normal;
    word-break: break-word;
    text-overflow: ellipsis;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.planner-block-card .block-time {
    font-size: 0.7rem;
    font-weight: 500;
    margin-top: 2px;
}

.planner-block-card .block-desc {
    font-size: 0.68rem;
    font-weight: 400;
    margin-top: 4px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Custom circular checked checkbox inside planner activities cards (20% larger + bulletproof radial gradient) */
.activity-complete-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    outline: none;
    cursor: pointer;
    background: transparent;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin: 0;
}

.activity-complete-checkbox:hover {
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

.activity-complete-checkbox:checked {
    border-color: #22c55e !important;
    /* Usa un degradado radial para pintar el círculo central verde y el anillo blanco.
       Esto evita fallos de renderizado de pseudo-elementos (::before) en inputs en ciertos navegadores. */
    background: radial-gradient(circle, #22c55e 40%, #ffffff 40%) !important;
}

/* Assignments & Tasks styling */
.assignment-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 14px 20px;
    transition: all 0.2s ease;
}

.assignment-card:hover {
    border-color: var(--color-primary);
}

.assignment-card.completed {
    opacity: 0.65;
}

.assignment-card.completed .assignment-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.assignment-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.assignment-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.assignment-meta {
    display: flex;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    align-items: center;
}

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

/* Grade status badge formatting */
.badge-grade-cursando {
    background-color: rgba(245, 158, 11, 0.15) !important;
    color: #f59e0b !important;
}
.badge-grade-aprobado {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #10b981 !important;
}
.badge-grade-reprobado {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
}


/* ─── Login gate (S9.1 seguridad) ─────────────────────────────────────────── */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-primary);
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-main);
    padding: 32px 28px;
}
.login-brand {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo {
    height: 44px;
    width: auto;
    margin-bottom: 12px;
}
.login-brand h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--text-primary);
    margin: 0;
}
.login-brand p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 4px 0 0;
}
.login-error {
    background: rgba(244, 63, 94, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(244, 63, 94, 0.25);
    border-radius: var(--border-radius-sm);
    padding: 10px 12px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    text-align: center;
}

/* ============================================================= */
/* COTIZACIONES — hoja estilo plantilla CoreTec + impresión PDF   */
/* ============================================================= */
:root { --cz-teal: #10b0ac; --cz-red: #c0222f; --cz-dark: #111111; }

.cotiz-preview-wrap { overflow: auto; padding-bottom: 8px; }

.cotiz-sheet {
    width: 794px;            /* A4 @ 96dpi = 210mm */
    min-height: 1123px;      /* 297mm */
    background: #ffffff;
    color: #111111;
    position: relative;
    margin: 0 auto;
    box-shadow: 0 6px 30px rgba(0,0,0,0.35);
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
    padding: 0 46px 70px 46px;
    box-sizing: border-box;
}
.cotiz-sheet .cz-header-bg {
    position: absolute; top: 0; left: 0; width: 445px; height: auto; pointer-events: none; user-select: none;
}
.cotiz-sheet .cz-corner-br {
    position: absolute; right: 0; bottom: 0; width: 238px; height: auto; pointer-events: none; user-select: none;
}
.cotiz-sheet .cz-topbar { position: relative; height: 250px; }
.cotiz-sheet .cz-title-block {
    position: absolute; right: 0; top: 34px; text-align: left; width: 320px;
}
.cotiz-sheet .cz-title { color: var(--cz-teal); font-size: 52px; font-weight: 800; letter-spacing: 1px; line-height: 1; margin: 0 0 18px 0; }
.cotiz-sheet .cz-meta { font-size: 18px; font-weight: 700; color: #222; display: flex; gap: 18px; margin: 4px 0; }
.cotiz-sheet .cz-meta .cz-meta-label { min-width: 118px; }
.cotiz-sheet .cz-client { font-size: 13px; color: #333; margin: 8px 0 0 0; }

.cotiz-sheet .cz-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.cotiz-sheet .cz-table thead th {
    color: var(--cz-teal); font-size: 15px; font-weight: 700; text-align: left;
    padding: 6px 6px; border: none;
}
.cotiz-sheet .cz-table thead th.cz-num { width: 42px; }
.cotiz-sheet .cz-table thead th.cz-right { text-align: right; width: 92px; }
.cotiz-sheet .cz-table thead th.cz-center { text-align: center; width: 78px; }
.cotiz-sheet .cz-table tbody td {
    font-size: 12.5px; color: #222; padding: 12px 6px; vertical-align: top;
    border-bottom: 1px solid #e2e2e2;
}
.cotiz-sheet .cz-table td.cz-num { font-weight: 700; }
.cotiz-sheet .cz-table td.cz-desc { font-weight: 600; white-space: pre-wrap; line-height: 1.35; }
.cotiz-sheet .cz-table td.cz-right { text-align: right; white-space: nowrap; }
.cotiz-sheet .cz-table td.cz-center { text-align: center; }

.cotiz-sheet .cz-notes { font-size: 12.5px; font-weight: 600; color: #333; margin: 18px 0 0 6px; line-height: 1.6; }
.cotiz-sheet .cz-totals { margin: 22px 0 0 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cotiz-sheet .cz-totals .cz-trow { display: flex; justify-content: space-between; width: 300px; font-size: 17px; font-weight: 700; color: #222; }
.cotiz-sheet .cz-totals .cz-trow .cz-tlabel { color: #333; }
.cotiz-sheet .cz-totals .cz-total-final { color: var(--cz-teal); font-size: 22px; font-weight: 800; margin-top: 6px; }

.cotiz-sheet .cz-terms-title { color: var(--cz-teal); font-size: 16px; font-weight: 700; margin: 40px 0 6px 0; }
.cotiz-sheet .cz-terms { font-size: 10.5px; color: #333; line-height: 1.55; white-space: pre-wrap; max-width: 560px; }
.cotiz-sheet .cz-thanks { font-size: 17px; font-weight: 600; color: #222; margin-top: 34px; }

/* Impresión: solo la hoja, tamaño A4 exacto */
@media print {
    body * { visibility: hidden !important; }
    #cotiz-sheet, #cotiz-sheet * { visibility: visible !important; }
    #cotiz-sheet {
        position: absolute; left: 0; top: 0; margin: 0;
        box-shadow: none; width: 794px; min-height: 1123px;
        transform: none !important;
    }
    .cotiz-preview-wrap { height: auto !important; overflow: visible !important; }
    @page { size: A4; margin: 0; }
}

/* =======================================================================
   GESTIÓN DE PROYECTOS — Tablero Kanban
   ======================================================================= */
.kanban-board {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 420px;
}

.kanban-column {
    /* En PC las columnas se reparten el ancho disponible; nunca bajan de 300px
       (si no caben, el tablero hace scroll horizontal sin aplastar el menú) */
    flex: 1 0 260px;
    min-width: 260px;
    max-width: 420px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md, 12px);
    display: flex;
    flex-direction: column;
    max-height: 72vh;
}

.kanban-column.is-dragging {
    opacity: 0.45;
}

.kanban-column.drop-target {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary) inset;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    cursor: grab;
}

.kanban-column-header .kanban-column-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kanban-column-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 2px 8px;
}

.kanban-col-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    border-radius: 6px;
}

.kanban-col-action:hover { color: var(--text-primary); background-color: rgba(255, 255, 255, 0.06); }
.kanban-col-action.danger:hover { color: var(--color-danger); }

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    overflow-y: auto;
    flex: 1;
    min-height: 60px;
}

.kanban-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--text-muted);
    border-radius: 10px;
    padding: 12px;
    cursor: grab;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.kanban-card:hover { background-color: var(--bg-card-hover); }
.kanban-card.is-dragging { opacity: 0.4; }

.kanban-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    margin-bottom: 6px;
}

.kanban-card-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kanban-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.kanban-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.06);
}

.kanban-chip.prio-alta  { color: #f43f5e; background-color: rgba(244, 63, 94, 0.12); }
.kanban-chip.prio-media { color: #f59e0b; background-color: rgba(245, 158, 11, 0.12); }
.kanban-chip.prio-baja  { color: #22c55e; background-color: rgba(34, 197, 94, 0.12); }
.kanban-chip.vencida    { color: #f43f5e; background-color: rgba(244, 63, 94, 0.12); }

/* Etiquetas de color (mismo criterio visual que Trello) */
.kanban-card[data-label="verde"]     { border-left-color: #22c55e; }
.kanban-card[data-label="azul"]      { border-left-color: #3b82f6; }
.kanban-card[data-label="amarillo"]  { border-left-color: #eab308; }
.kanban-card[data-label="naranja"]   { border-left-color: #f97316; }
.kanban-card[data-label="rojo"]      { border-left-color: #f43f5e; }
.kanban-card[data-label="morado"]    { border-left-color: #a855f7; }

.kanban-progress-bg {
    height: 4px;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.kanban-progress-fill {
    height: 100%;
    background-color: var(--color-primary);
    border-radius: 4px;
}

.kanban-add-card {
    margin: 0 12px 12px;
    padding: 8px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    background: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.kanban-add-card:hover { color: var(--color-primary); border-color: var(--color-primary); }

.kanban-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px 6px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
}

/* Editor de checklist dentro del modal de tarjeta */
.kb-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
}

.kb-check-row input[type="text"] {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}

.kb-check-row.done input[type="text"] { text-decoration: line-through; color: var(--text-muted); }

@media (max-width: 700px) {
    .kanban-column { flex: 0 0 85vw; min-width: 85vw; max-width: 85vw; }
}

/* ── Módulo Contratos ─────────────────────────────────────────────────────── */
.badge-primary {
    background-color: rgba(var(--color-primary-rgb, 79,70,229), 0.12);
    color: var(--color-primary);
}
.badge-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.badge-warning {
    background-color: #fef9c3;
    color: #854d0e;
}
.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}
.badge-purple {
    background-color: #ede9fe;
    color: #5b21b6;
    font-weight: 700;
}

.ct-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 12px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    margin: 0;
}

.ct-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-bottom: 8px;
    background: var(--bg-secondary);
    flex-wrap: wrap;
}

.ct-row:last-child { margin-bottom: 0; }

.ct-row-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.ct-folio {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.ct-meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.ct-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.78rem;
    height: 30px;
}

.btn-sm i { width: 14px; height: 14px; }
