/* ===== VARIABLES CSS ===== */
:root {
    /* Primary Colors - Professional Investment Theme */
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;

    /* Accent Colors */
    --success-color: #10b981;
    --success-light: #d1fae5;
    --danger-color: #ef4444;
    --danger-light: #fee2e2;
    --warning-color: #f59e0b;
    --warning-light: #fef3c7;
    --info-color: #06b6d4;
    --info-light: #cffafe;

    /* Neutrals */
    --bg-color: #f8fafc;
    --bg-secondary: #f1f5f9;
    --surface-color: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.18);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Spacing */
    --sidebar-width: 280px;
    --header-height: 70px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

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

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== TYPOGRAPHY ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.75rem;
}

h3 {
    font-size: 1.375rem;
}

h4 {
    font-size: 1.125rem;
}

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

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

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

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

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

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-xl);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.3;
}

.sidebar-subtitle {
    font-size: 0.75rem;
    opacity: 0.8;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-section {
    padding: 0.5rem 1.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.6;
    margin-top: 1rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    font-size: 0.9375rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: white;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Hide menu toggle on desktop */
#menu-toggle {
    display: none;
}

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

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
}

.user-menu:hover {
    background: var(--border-color);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-name {
    font-weight: 500;
    font-size: 0.9375rem;
}

/* Page Content */
.page-content {
    padding: 2rem;
    max-width: 1400px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

/* ===== CARDS ===== */
.card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--transition-normal);
}

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

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

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
}

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

.stat-card.danger::before {
    background: var(--danger-color);
}

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

.stat-card.info::before {
    background: var(--info-color);
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.stat-icon.success {
    background: var(--success-light);
    color: var(--success-color);
}

.stat-icon.danger {
    background: var(--danger-light);
    color: var(--danger-color);
}

.stat-icon.warning {
    background: var(--warning-light);
    color: var(--warning-color);
}

.stat-icon.info {
    background: var(--info-light);
    color: var(--info-color);
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-content {
    flex: 1;
}

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

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
}

.stat-change.positive {
    color: var(--success-color);
    background: var(--success-light);
}

.stat-change.negative {
    color: var(--danger-color);
    background: var(--danger-light);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
    color: white;
}

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

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

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #059669);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.0625rem;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface-color);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

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

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

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
    padding-right: 2.5rem;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    background: var(--surface-color);
    box-shadow: var(--shadow-md);
}

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

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

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

.table tbody tr {
    transition: background var(--transition-fast);
}

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

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

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-xl);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

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

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

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

.badge-info {
    background: var(--info-light);
    color: var(--info-color);
}

/* ===== STAR RATING ===== */
.star-rating {
    display: inline-flex;
    gap: 0.25rem;
}

.star-rating .star {
    cursor: pointer;
    color: var(--border-color);
    transition: all var(--transition-fast);
    font-size: 1.5rem;
}

.star-rating .star:hover,
.star-rating .star.active {
    color: var(--warning-color);
    transform: scale(1.1);
}

.star-rating-display {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.star-rating-display .stars {
    color: var(--warning-color);
}

.star-rating-display .count {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ===== MESSAGES ===== */
.message-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.message-item:hover {
    background: var(--border-color);
}

.message-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.message-author {
    font-weight: 600;
    font-size: 0.875rem;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease;
}

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

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

.alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.alert-success {
    background: var(--success-light);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: var(--info-light);
    color: var(--info-color);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

/* ===== LOGIN PAGE ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-color) 0%, var(--bg-secondary) 100%);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.auth-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 2.5rem 2rem;
    text-align: center;
    color: white;
}

.auth-logo {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 2rem;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    opacity: 0.85;
    font-size: 0.9375rem;
}

.auth-body {
    padding: 2rem;
}

.auth-footer {
    text-align: center;
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ===== GRID LAYOUTS ===== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* ===== BROKER CARD ===== */
.broker-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.broker-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.broker-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.broker-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.broker-info h3 {
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

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

/* ===== INVESTMENT CARD ===== */
.investment-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.investment-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.investment-type-bar {
    height: 4px;
    background: var(--primary-color);
}

.investment-type-bar.plazo_fijo {
    background: var(--success-color);
}

.investment-type-bar.bono {
    background: var(--warning-color);
}

.investment-type-bar.accion {
    background: var(--info-color);
}

.investment-body {
    padding: 1.5rem;
}

.investment-amount {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.investment-currency {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
}

/* ===== UTILITIES ===== */
.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.p-2 {
    padding: 1rem;
}

.p-3 {
    padding: 1.5rem;
}

.p-4 {
    padding: 2rem;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

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

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

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

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

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

.font-medium {
    font-weight: 500;
}

/* ===== RESPONSIVE ===== */

/* Overlay para sidebar móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Large Tablets and Small Desktops */
@media (max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    h1 {
        font-size: 1.875rem;
    }

    h2 {
        font-size: 1.5rem;
    }

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

/* Tablets */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 260px;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }

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

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

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Mostrar botón de menú */
    #menu-toggle {
        display: flex !important;
    }

    .header-title {
        font-size: 1.25rem;
    }

    .page-content {
        padding: 1.5rem;
    }
}

/* Small Tablets and Large Phones */
@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    body {
        font-size: 0.9375rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    h4 {
        font-size: 1rem;
    }

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

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .page-content {
        padding: 1rem;
    }

    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

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

    .header {
        padding: 0 1rem;
    }

    .header-title {
        font-size: 1.125rem;
        flex: 1;
        text-align: center;
    }

    /* User menu responsive */
    .user-menu {
        padding: 0.375rem 0.75rem;
    }

    .user-name {
        display: none;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    /* Cards responsive */
    .card {
        border-radius: var(--radius-md);
    }

    .card-header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .card-body {
        padding: 1rem;
    }

    .card-footer {
        padding: 0.875rem 1rem;
    }

    /* Stat cards responsive */
    .stat-card {
        padding: 1.25rem;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
    }

    .stat-icon svg {
        width: 24px;
        height: 24px;
    }

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

    .stat-label {
        font-size: 0.8125rem;
    }

    /* Tables responsive */
    .table-container {
        border-radius: var(--radius-md);
        margin: 0 -1rem;
        width: calc(100% + 2rem);
    }

    .table th,
    .table td {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }

    /* Ocultar columnas menos importantes en móvil */
    .table .hide-mobile {
        display: none;
    }

    /* Buttons responsive */
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }

    .btn-sm {
        padding: 0.5rem 0.875rem;
        font-size: 0.75rem;
    }

    .btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    /* Forms responsive */
    .form-control {
        padding: 0.75rem;
        font-size: 1rem;
        /* Previene zoom en iOS */
    }

    .form-label {
        font-size: 0.8125rem;
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    /* Badges responsive */
    .badge {
        font-size: 0.6875rem;
        padding: 0.1875rem 0.5rem;
    }

    /* Broker cards responsive */
    .broker-card {
        padding: 1rem;
    }

    .broker-logo {
        width: 48px;
        height: 48px;
        font-size: 1.125rem;
    }

    /* Investment cards responsive */
    .investment-body {
        padding: 1rem;
    }

    .investment-amount {
        font-size: 1.25rem;
    }

    /* Messages responsive */
    .message-item {
        padding: 0.875rem;
        gap: 0.75rem;
    }

    .message-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.75rem;
    }

    .message-author {
        font-size: 0.8125rem;
    }

    .message-time {
        font-size: 0.6875rem;
    }

    .message-text {
        font-size: 0.875rem;
    }

    /* Empty state responsive */
    .empty-state {
        padding: 2.5rem 1.5rem;
    }

    .empty-state svg {
        width: 60px;
        height: 60px;
        margin-bottom: 1rem;
    }

    .empty-state h3 {
        font-size: 1.125rem;
    }

    .empty-state p {
        font-size: 0.875rem;
    }

    /* Auth pages responsive */
    .auth-container {
        padding: 1rem;
    }

    .auth-card {
        border-radius: var(--radius-lg);
    }

    .auth-header {
        padding: 2rem 1.5rem;
    }

    .auth-logo {
        width: 64px;
        height: 64px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .auth-title {
        font-size: 1.25rem;
    }

    .auth-body {
        padding: 1.5rem;
    }

    .auth-footer {
        padding: 1.25rem 1.5rem;
    }

    /* Alerts responsive */
    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }

    .alert svg {
        width: 18px;
        height: 18px;
    }
}

/* Mobile Phones */
@media (max-width: 480px) {
    :root {
        --sidebar-width: 100%;
    }

    .sidebar {
        width: 100%;
    }

    h1 {
        font-size: 1.375rem;
    }

    h2 {
        font-size: 1.125rem;
    }

    .header-title {
        font-size: 1rem;
    }

    .stats-grid {
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
        gap: 0.75rem;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
    }

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

    .page-content {
        padding: 0.75rem;
    }

    .card-header {
        padding: 0.875rem;
    }

    .card-body {
        padding: 0.875rem;
    }

    /* Table scroll hint */
    .table-container {
        position: relative;
    }

    .table-container::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 20px;
        background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.8));
        pointer-events: none;
        opacity: 0.5;
    }

    /* Button full width on mobile */
    .btn-mobile-full {
        width: 100%;
    }

    /* Stack button groups vertically */
    .btn-group-mobile {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-group-mobile .btn {
        width: 100%;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .btn-sm {
        min-height: 36px;
    }

    .nav-link {
        padding: 1rem 1.5rem;
    }

    .form-control {
        min-height: 44px;
    }

    .table td,
    .table th {
        padding: 1rem;
    }

    /* Remove hover effects on touch devices */
    .card:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }

    .stat-card:hover {
        transform: none;
    }

    .broker-card:hover {
        transform: none;
    }

    .investment-card:hover {
        transform: none;
    }
}

/* Landscape phones */
@media (max-width: 768px) and (orientation: landscape) {
    .auth-container {
        padding: 0.5rem;
    }

    .auth-header {
        padding: 1.5rem;
    }

    .auth-logo {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
}

/* Print styles */
@media print {

    .sidebar,
    .header,
    #menu-toggle,
    .btn {
        display: none !important;
    }

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

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

    .card {
        box-shadow: none !important;
        break-inside: avoid;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-up {
    animation: slideUp 0.4s ease;
}

/* Stagger animation for cards */
.stats-grid>* {
    animation: slideUp 0.4s ease backwards;
}

.stats-grid>*:nth-child(1) {
    animation-delay: 0.1s;
}

.stats-grid>*:nth-child(2) {
    animation-delay: 0.2s;
}

.stats-grid>*:nth-child(3) {
    animation-delay: 0.3s;
}

.stats-grid>*:nth-child(4) {
    animation-delay: 0.4s;
}