/* ==========================================================================
   Design System & Variables
   ========================================================================== */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #020617;
    --card-bg: rgba(15, 23, 42, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #020617;
    --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    --primary-glow: rgba(139, 92, 246, 0.25);
    --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --success-glow: rgba(16, 185, 129, 0.25);
    --danger-gradient: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Outfit', sans-serif;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}


/* ==========================================================================
   Base & Layout Reset
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: radial-gradient(circle at top right, #1e1b4b, #0f172a, #020617);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Background Glowing Circles */
.background-decorations {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
}

.circle-1 {
    width: 45vw;
    height: 45vw;
    background: radial-gradient(circle, #4f46e5 0%, rgba(79, 70, 229, 0) 70%);
    top: -10%;
    right: -10%;
}

.circle-2 {
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, #7c3aed 0%, rgba(124, 58, 237, 0) 70%);
    bottom: -10%;
    left: -10%;
}

/* ==========================================================================
   App Container & Typography
   ========================================================================== */
.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 580px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.app-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: fadeInDown 0.8s ease;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    width: 42px;
    height: 42px;
    color: #a78bfa;
    filter: drop-shadow(0 0 12px rgba(167, 139, 250, 0.5));
}

.app-header h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #ffffff;
}

.app-header h1 span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 400;
    max-width: 380px;
    line-height: 1.5;
}

/* ==========================================================================
   Glassmorphic Card
   ========================================================================== */
.glassmorphism {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.7);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

/* Soft accent light line at the top border */
.glassmorphism::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.5px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    z-index: 1;
}

.card-body {
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: fadeInUp 0.8s ease;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card-instruction {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.card-instruction strong {
    color: var(--text-main);
}

/* ==========================================================================
   Drag and Drop Zone
   ========================================================================== */
.drop-zone {
    width: 100%;
    min-height: 200px;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.01);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    padding: 30px;
}

.drop-zone:hover {
    border-color: #a78bfa;
    background: rgba(139, 92, 246, 0.04);
    box-shadow: inset 0 0 12px rgba(139, 92, 246, 0.06);
}

.drop-zone.dragover {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.06);
    box-shadow: inset 0 0 20px rgba(168, 85, 247, 0.1);
    transform: scale(1.01);
}

.file-input-hidden {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.drop-zone-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.icon-wrapper {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
    transition: var(--transition-smooth);
}

.drop-zone:hover .icon-wrapper {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.25);
    transform: translateY(-4px);
}

.upload-icon {
    width: 26px;
    height: 26px;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.drop-zone:hover .upload-icon {
    color: #a78bfa;
}

.main-prompt-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
}

.sub-prompt-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.file-limits {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 3px 8px;
    border-radius: 20px;
    margin-top: 6px;
    letter-spacing: 0.02em;
}

/* File Info Selected View */
.file-info-view {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 8px 12px;
    animation: fadeIn 0.4s ease;
    z-index: 11;
}

.file-icon-wrapper {
    width: 50px;
    height: 50px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
}

.excel-file-icon {
    width: 24px;
    height: 24px;
    color: #10b981;
}

.sidebar-wrapper {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    overflow-y: auto;
    z-index: 2;
}

.file-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

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

.btn-remove-file {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-remove-file:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
    transform: rotate(90deg);
}

.btn-remove-file svg {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Action & Buttons
   ========================================================================== */
.action-wrapper {
    margin-top: 8px;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--primary-glow);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: translateX(-100%);
    transition: 0.6s;
}

.btn-primary:hover:not(:disabled)::before {
    transform: translateX(100%);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-primary:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.25);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-loader {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Spinner */
.spinner {
    animation: rotate 2s linear infinite;
    width: 20px;
    height: 20px;
}

.spinner .path {
    stroke: #fff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* ==========================================================================
   Alerts & Notifications
   ========================================================================== */
.alert-container {
    animation: fadeInUp 0.4s ease;
}

.alert {
    padding: 16px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    line-height: 1.5;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

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

.alert-message {
    font-weight: 500;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 8px;
    animation: fadeIn 1s ease;
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Dashboard View layout & overrides
   ========================================================================== */
.app-container.dashboard-active {
    max-width: 1200px;
    align-self: flex-start;
    padding: 40px 20px;
}

.view-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    animation: fadeInDown 0.6s ease;
}

.logo-side {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-logo {
    width: 32px;
    height: 32px;
    color: #a78bfa;
}

.logo-side h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: #ffffff;
}

.action-side {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Button overrides */
.btn-secondary,
.btn-success {
    height: 40px;
    padding: 0 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    transition: var(--transition-smooth);
    letter-spacing: 0.01em;
}

.btn-secondary {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
}

.btn-success {
    border: none;
    background: var(--success-gradient);
    color: #030712;
    font-weight: 600;
    box-shadow: 0 4px 14px var(--success-glow);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px var(--success-glow);
    filter: brightness(1.08);
}

.btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 2;
}

.action-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}



/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    animation: fadeInUp 0.6s ease;
    margin-bottom: 24px; /* separation from lower sections */
}

.stat-card {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-title {
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
}

.status-alert-bg {
    border-color: rgba(245, 158, 11, 0.15);
    background: rgba(245, 158, 11, 0.02);
}

.alert-color {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   Análisis de Morosidad por Antigüedad
   ========================================================================== */
.morosity-section {
    display: flex;
    flex-direction: column;
    margin-top: 8px;
    animation: fadeInUp 0.6s ease;
}

.morosity-section-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

.morosity-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.morosity-card {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    transition: var(--transition-smooth);
}

.morosity-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Subtle left border accents for risk identification */
.morosity-card.level-0-30 { border-left: 3px solid #10b981; }
.morosity-card.level-31-60 { border-left: 3px solid #06b6d4; }
.morosity-card.level-61-90 { border-left: 3px solid #f59e0b; }
.morosity-card.level-91-180 { border-left: 3px solid #f97316; }
.morosity-card.level-181-365 { border-left: 3px solid #ef4444; }
.morosity-card.level-366 { border-left: 3px solid #f87171; }

.morosity-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
}

.morosity-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.risk-badge {
    font-size: 0.58rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.badge-low {
    background: rgba(16, 185, 129, 0.08);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-medium-low {
    background: rgba(6, 182, 212, 0.08);
    color: #06b6d4;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.badge-medium {
    background: rgba(245, 158, 11, 0.08);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-medium-high {
    background: rgba(249, 115, 22, 0.08);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.badge-high {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-critical {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.1);
}

.morosity-card-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.morosity-value {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.morosity-percent {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.morosity-progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.morosity-progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.pb-low {
    background: linear-gradient(90deg, #10b981, #059669);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.3);
}

.pb-medium-low {
    background: linear-gradient(90deg, #06b6d4, #0891b2);
    box-shadow: 0 0 6px rgba(6, 182, 212, 0.3);
}

.pb-medium {
    background: linear-gradient(90deg, #f59e0b, #d97706);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.3);
}

.pb-medium-high {
    background: linear-gradient(90deg, #f97316, #ea580c);
    box-shadow: 0 0 6px rgba(249, 115, 22, 0.3);
}

.pb-high {
    background: linear-gradient(90deg, #ef4444, #dc2626);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.3);
}

.pb-critical {
    background: linear-gradient(90deg, #dc2626, #991b1b);
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

/* Responsiveness for morosity grid */
@media (max-width: 1100px) {
    .morosity-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}

@media (max-width: 680px) {
    .morosity-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* Dashboard Split Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    margin-top: 24px; /* space between stats and dashboard */
    animation: fadeInUp 0.7s ease;
}

/* LEFT SIDEBAR: CLIENT LIST */


.search-bar-container {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 5;
}

.search-icon {
    position: absolute;
    left: 28px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.search-input:focus {
    outline: none;
    border-color: #a78bfa;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.client-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Custom Scrollbars */
.client-list::-webkit-scrollbar,
.table-scroll-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.client-list::-webkit-scrollbar-thumb,
.table-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}
.client-list::-webkit-scrollbar-track,
.table-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.client-item {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition-smooth);
}

/* Status-based background colors */
.client-item.status-overdue {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
}
.client-item.status-warning {
    background: rgba(245, 158, 11, 0.10);
    border-color: rgba(245, 158, 11, 0.22);
}
.client-item.status-normal {
    background: rgba(16, 185, 129, 0.07);
    border-color: rgba(16, 185, 129, 0.18);
}

.client-item:hover {
    filter: brightness(1.25);
    transform: translateX(2px);
}

.client-item.active {
    background: rgba(139, 92, 246, 0.15) !important;
    border-color: rgba(139, 92, 246, 0.38) !important;
    box-shadow: 0 2px 12px rgba(139, 92, 246, 0.15);
}

.client-name-text {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: normal;
    word-break: break-word;
    line-height: 1.35;
}

.client-item.status-overdue .client-name-text {
    color: #fca5a5;
}
.client-item.status-warning .client-name-text {
    color: #fcd34d;
}
.client-item.status-normal .client-name-text {
    color: #6ee7b7;
}

.client-item.active .client-name-text {
    color: #ddd6fe;
    font-weight: 600;
}

/* RIGHT DETAIL CONTENT AREA */
.detail-wrapper {
    min-height: 600px;
    display: flex;
    flex-direction: column;
    padding: 32px;
    gap: 24px;
}

.detail-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 16px;
}

.client-meta h3 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Client Summary Widget Grid */
.client-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.summary-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.glow-card {
    background: rgba(139, 92, 246, 0.05);
    border-color: rgba(139, 92, 246, 0.2);
    box-shadow: 0 0 24px rgba(139, 92, 246, 0.06);
}

.card-label {
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.card-value {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
}

.card-value.highlight {
    background: linear-gradient(135deg, #c4b5fd, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    font-size: 1.5rem;
}

.action-card {
    justify-content: center;
    padding: 8px;
    background: transparent;
    border: none;
}

.btn-whatsapp-action {
    width: 100%;
    height: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    background: #25d366;
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-whatsapp-action:hover:not(:disabled) {
    background: #22c05b;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}

.btn-whatsapp-action:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.15);
    box-shadow: none;
    cursor: not-allowed;
}

.wa-icon {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Table Styling
   ========================================================================== */
.table-scroll-container {
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.15);
    max-height: 380px;
}

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

.invoice-table th {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.invoice-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    vertical-align: middle;
}

.invoice-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

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

/* Custom Checkboxes */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
}

.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 18px;
    width: 18px;
    z-index: 2;
}

.checkbox-container label {
    position: relative;
    cursor: pointer;
    padding: 0;
    display: inline-block;
    height: 18px;
    width: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    transition: var(--transition-smooth);
}

.checkbox-container input[type="checkbox"]:hover + label {
    border-color: #a78bfa;
    background: rgba(139, 92, 246, 0.08);
}

.checkbox-container input[type="checkbox"]:checked + label {
    background: var(--primary-gradient);
    border-color: transparent;
}

.checkbox-container input[type="checkbox"]:checked + label::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Status Badges in Table */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-badge.overdue {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.08);
    animation: warningPulse 2s infinite alternate;
}

@keyframes warningPulse {
    0% { border-color: rgba(245, 158, 11, 0.2); }
    100% { border-color: rgba(245, 158, 11, 0.4); }
}

.status-badge.normal {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.15);
}

/* Row Action Buttons */
.btn-whatsapp-row {
    background: rgba(37, 211, 102, 0.08);
    border: 1px solid rgba(37, 211, 102, 0.22);
    color: #25d366;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 0;
    margin: 0;
}

.btn-whatsapp-row:hover {
    background: #25d366;
    color: #fff;
    border-color: #25d366;
    transform: translateY(-1px) scale(1.05);
}

.btn-whatsapp-row svg {
    width: 16px;
    height: 16px;
}

.btn-delete-row {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.22);
    color: #f87171;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 0;
    margin: 0;
}

.btn-delete-row:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
    transform: translateY(-1px) scale(1.05);
}

.btn-delete-row svg {
    width: 16px;
    height: 16px;
}
/* Responsive adjustments */

/* Stats Grid Layout */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
  text-align: center;
}

.stat-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-card .card-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-card .card-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Responsive adjustments */
/* ==========================================================================
   Responsive & Mobile Optimization
   ========================================================================== */

/* Medium Screens (Tablets / Laptops) */
@media (max-width: 960px) {
    .app-container.dashboard-active {
        padding: 24px 16px;
        gap: 20px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sidebar-wrapper {
        height: 280px;
    }
    
    .detail-wrapper {
        min-height: auto;
        padding: 24px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

/* Small Screens (Mobile Phones) */
@media (max-width: 640px) {
    .app-container {
        padding: 16px 12px;
        gap: 20px;
    }
    
    .app-container.dashboard-active {
        padding: 16px 12px;
        gap: 16px;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        text-align: center;
    }
    
    .logo-side {
        justify-content: center;
    }
    
    .logo-side h2 {
        font-size: 1.35rem;
    }
    
    .action-side {
        width: 100%;
        justify-content: center;
        gap: 8px;
    }
    
    .action-side button {
        flex: 1;
        font-size: 0.8rem;
        height: 38px;
    }
    
    /* Stats Layout for Mobile */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stats-grid .stat-card:last-child {
        grid-column: span 2;
    }
    
    .stat-card {
        padding: 14px;
    }
    
    .stat-value {
        font-size: 1.45rem;
    }
    
    /* Delinquency cards in 2 columns for compact layout */
    .morosity-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .morosity-card {
        padding: 10px 12px;
        gap: 6px;
        border-radius: var(--radius-md);
    }
    
    .morosity-value {
        font-size: 1.05rem;
    }
    
    .morosity-label {
        font-size: 0.68rem;
    }
    
    .risk-badge {
        font-size: 0.52rem;
        padding: 1px 4px;
    }
    
    /* Client Details Headers */
    .detail-wrapper {
        padding: 16px;
        gap: 16px;
    }
    
    .client-meta h3 {
        font-size: 1.25rem;
        text-align: center;
    }
    
    /* Client Summary Grid (Deuda vs Autosuma vs WhatsApp) */
    .client-summary-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .client-summary-grid .action-card {
        grid-column: span 2;
        padding: 0;
        margin-top: 4px;
    }
    
    .summary-card {
        padding: 12px 14px;
    }
    
    .card-value {
        font-size: 1.15rem;
    }
    
    .card-value.highlight {
        font-size: 1.25rem;
    }
    
    /* Uploader view padding */
    .card-body {
        padding: 24px 20px;
        gap: 20px;
    }
    
    .card-title {
        font-size: 1.3rem;
        text-align: center;
    }
    
    .card-instruction {
        text-align: center;
        font-size: 0.85rem;
    }
    
    /* Table transformation to touch cards */
    .table-scroll-container {
        border: none;
        background: transparent;
        max-height: none;
        overflow: visible;
    }
    
    .invoice-table, 
    .invoice-table tbody, 
    .invoice-table tr, 
    .invoice-table td {
        display: block;
        width: 100%;
    }
    
    .invoice-table thead {
        display: none;
    }
    
    .invoice-table tr {
        margin-bottom: 12px;
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-md);
        padding: 12px 14px;
        position: relative;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .invoice-table td {
        border-bottom: none;
        padding: 8px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 0.8rem;
    }
    
    /* Checkbox layout styling */
    .invoice-table td:first-child {
        justify-content: flex-start;
        padding-bottom: 10px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        margin-bottom: 6px;
    }
    
    .invoice-table td:first-child::after {
        content: "Seleccionar para reclamo";
        color: var(--text-muted);
        font-size: 0.75rem;
        font-weight: 500;
        margin-left: 10px;
    }
    
    /* Pseudo-element labels for columns */
    .invoice-table td:nth-child(2)::before { content: 'Tipo:'; color: var(--text-muted); font-size: 0.72rem; }
    .invoice-table td:nth-child(3)::before { content: 'Número:'; color: var(--text-muted); font-size: 0.72rem; }
    .invoice-table td:nth-child(4)::before { content: 'Vencimiento:'; color: var(--text-muted); font-size: 0.72rem; }
    .invoice-table td:nth-child(5)::before { content: 'Estado:'; color: var(--text-muted); font-size: 0.72rem; }
    .invoice-table td:nth-child(6)::before { content: 'Monto:'; color: var(--text-muted); font-size: 0.72rem; }
    
    .invoice-table td:nth-child(6) {
        font-size: 0.95rem;
        font-weight: 700;
        color: #ffffff;
    }
    
    /* Action row at card bottom */
    .invoice-table td:last-child {
        justify-content: center;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        margin-top: 6px;
        gap: 12px;
    }
    
    /* Hide details for empty state */
    .invoice-table td[colspan="7"] {
        display: block;
        text-align: center;
        justify-content: center;
        padding: 30px 16px !important;
        color: var(--text-muted);
        border: none !important;
    }
    
    .invoice-table td[colspan="7"]::before,
    .invoice-table td[colspan="7"]::after {
        display: none !important;
    }
}

