﻿@import url('base.css');

:root {
    /* Pricing-inspired color scheme */
    --dash-bg: #050a18;
    --dash-bg-2: #0c1425;
    --dash-panel: rgba(15, 25, 50, 0.65);
    --dash-panel-solid: #0f1932;
    --dash-panel-2: #0c1425;
    --dash-border: rgba(255, 255, 255, 0.06);
    --dash-border-strong: rgba(255, 255, 255, 0.12);
    --dash-text: #f1f5f9;
    --dash-text-dim: #8896b0;
    --dash-text-muted: #64748b;
    --dash-accent: #2563eb;
    --dash-accent-2: #3b82f6;
    --dash-accent-soft: rgba(37, 99, 235, 0.15);
    --dash-accent-glow: rgba(37, 99, 235, 0.3);
    --dash-green: #10b981;
    --dash-green-soft: rgba(16, 185, 129, 0.15);
    --dash-amber: #f59e0b;
    --dash-red: #ef4444;
    --dash-red-soft: rgba(239, 68, 68, 0.15);
    --dash-purple-soft: rgba(139, 92, 246, 0.15);
    --dash-radius: 24px;
    --dash-radius-sm: 14px;
    --dash-gap: 20px;
    --dash-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04);
    --dash-shadow-glow: 0 0 0 1px rgba(37, 99, 235, 0.3), 0 8px 32px rgba(37, 99, 235, 0.15);
}

/* =============================
   LIGHT THEME OVERRIDES (dash vars)
   ============================= */
html[data-theme="light"] {
    /* Estilo limpio — blanco puro, acentos azul */
    --dash-bg: #ffffff;
    --dash-bg-2: #fafafa;
    --dash-panel: rgba(255, 255, 255, 0.95);
    --dash-panel-solid: #ffffff;
    --dash-panel-2: #f8f8f8;
    --dash-border: rgba(0, 0, 0, 0.06);
    --dash-border-strong: rgba(0, 0, 0, 0.1);
    --dash-text: #1a1a1a;
    --dash-text-dim: #4b5563;
    --dash-text-muted: #6b7280;
    --dash-accent: #3b82f6;
    --dash-accent-2: #60a5fa;
    --dash-accent-soft: rgba(59, 130, 246, 0.08);
    --dash-accent-glow: rgba(59, 130, 246, 0.15);
    --dash-green: #16a34a;
    --dash-green-soft: rgba(22, 163, 74, 0.08);
    --dash-amber: #d97706;
    --dash-red: #e53e3e;
    --dash-red-soft: rgba(229, 62, 62, 0.08);
    --dash-purple-soft: rgba(109, 40, 217, 0.07);
    --dash-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.03);
    --dash-shadow-glow: 0 0 0 1px rgba(59, 130, 246, 0.15), 0 4px 20px rgba(59, 130, 246, 0.08);
}

html[data-theme="light"] body {
    background: var(--dash-bg);
    color: var(--dash-text);
}

/* Header */
.dash-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

html[data-theme="light"] .dash-header {
    background: rgba(255,255,255,0.95);
    border-bottom-color: rgba(0,0,0,0.06);
}
html[data-theme="light"] .dash-logo {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
}
html[data-theme="light"] .dash-logo svg {
    color: #3b82f6 !important;
}
html[data-theme="light"] .dash-header-title {
    color: #4b5563;
}
html[data-theme="light"] .dash-header-link {
    color: #374151;
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] .dash-header-link:hover {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--dash-accent);
}
html[data-theme="light"] .dash-header-link--primary {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
    color: #ffffff !important;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}
html[data-theme="light"] .dash-header-link--primary:hover {
    background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 50%, #3b82f6 100%);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
    color: #ffffff !important;
    border-color: transparent;
}
html[data-theme="light"] .dash-header-link--templates {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(37, 99, 235, 0.05) 100%);
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.08);
}
html[data-theme="light"] .dash-header-link--templates:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.1) 100%);
    border-color: rgba(59, 130, 246, 0.35);
    color: #2563eb;
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.12);
    text-shadow: none;
}
html[data-theme="light"] .dash-header-link--pricing {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, rgba(217, 70, 239, 0.05) 100%);
    color: #d97706;
    border-color: rgba(245, 158, 11, 0.25);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.08);
}
html[data-theme="light"] .dash-header-link--pricing:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 70, 239, 0.1) 100%);
    border-color: rgba(245, 158, 11, 0.4);
    color: #b45309;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
    text-shadow: none;
}
html[data-theme="light"] .dash-header-link--crm {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.08) 0%, rgba(22, 163, 74, 0.05) 100%);
    color: #16a34a;
    border-color: rgba(34, 197, 94, 0.2);
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.08);
}
html[data-theme="light"] .dash-header-link--crm:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(22, 163, 74, 0.1) 100%);
    border-color: rgba(34, 197, 94, 0.35);
    color: #15803d;
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.12);
    text-shadow: none;
}
html[data-theme="light"] .theme-toggle {
    border-color: rgba(0, 0, 0, 0.1);
    color: #4b5563;
}
html[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

/* Background decoration — sutil en claro, acentos azul */
html[data-theme="light"] .bg-mesh {
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.02) 1px, transparent 1px);
}
html[data-theme="light"] .bg-orb--1 {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
}
html[data-theme="light"] .bg-orb--2 {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.03) 0%, transparent 70%);
}
html[data-theme="light"] .bg-orb--3 {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.02) 0%, transparent 70%);
}

/* Cards y paneles — estilo Banco Plata */
html[data-theme="light"] .dash-kpi,
html[data-theme="light"] .dash-kpi-secondary {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.03);
}
html[data-theme="light"] .dash-kpi::before,
html[data-theme="light"] .dash-kpi-secondary::before {
    background: linear-gradient(135deg, rgba(255,255,255,0.9) 0%, transparent 60%);
}
html[data-theme="light"] .dash-kpi:hover,
html[data-theme="light"] .dash-kpi-secondary:hover {
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05), 0 0 0 1px rgba(59, 130, 246, 0.1);
}

/* Spinner */
html[data-theme="light"] .dash-spinner {
    border-color: rgba(0, 0, 0, 0.08);
    border-top-color: var(--dash-accent);
}

/* Dropdown usuario */
html[data-theme="light"] .dash-user-dropdown {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 24px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.04);
}
html[data-theme="light"] .dash-user-dropdown-item:hover {
    background: rgba(59, 130, 246, 0.06);
    color: var(--dash-text);
}
html[data-theme="light"] .dash-user-trigger:hover {
    background: rgba(59, 130, 246, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}
html[data-theme="light"] .dash-user-trigger {
    border-color: rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] .dash-user-name {
    color: #374151;
}
html[data-theme="light"] .dash-user-chevron {
    color: #9ca3af;
}
html[data-theme="light"] .dash-user-avatar {
    border-color: rgba(0, 0, 0, 0.1);
}
html[data-theme="light"] .dash-user-avatar--initials {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
}

/* Input cuenta */
html[data-theme="light"] .dash-cuenta-input {
    background: #fafafa;
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--dash-text);
}
html[data-theme="light"] .dash-cuenta-input:focus {
    background: #ffffff;
    border-color: var(--dash-accent);
}
html[data-theme="light"] .dash-cuenta-modal-close:hover {
    background: rgba(59, 130, 246, 0.06);
    color: var(--dash-text);
}

/* Welcome banner */
html[data-theme="light"] .dash-welcome {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.04) 0%, transparent 60%);
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

/* KPI badge */
html[data-theme="light"] .dash-kpi-currency-badge {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

/* Ocultar botón de tema del header (está en el menú de usuario) */
.dash-header #theme-toggle-btn {
    display: none !important;
}

/* Botones generales */
html[data-theme="light"] .dash-btn {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    color: var(--dash-text);
}
html[data-theme="light"] .dash-btn:hover {
    background: #fafafa;
    border-color: rgba(59, 130, 246, 0.3);
}
html[data-theme="light"] .app-project-icon {
    background: rgba(0, 0, 0, 0.04);
    color: #4b5563;
}
html[data-theme="light"] .modal-input-nombre,
html[data-theme="light"] .app-project-input,
html[data-theme="light"] .app-project-edit-card input,
html[data-theme="light"] .app-project-edit-card textarea,
html[data-theme="light"] .app-project-edit-card select {
    background: #fafafa !important;
    color: #1a1a1a !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}
html[data-theme="light"] .app-project-edit-close {
    background: rgba(0, 0, 0, 0.04);
    color: #4b5563;
}
html[data-theme="light"] .app-project-edit-close:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
}
html[data-theme="light"] .app-project-select-trigger {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
}
html[data-theme="light"] .app-project-dropdown {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] .app-project-option {
    color: #1a1a1a;
}
html[data-theme="light"] .app-project-option:hover {
    background: rgba(59, 130, 246, 0.06);
}
html[data-theme="light"] .app-file-upload-area {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.02);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
    overflow-x: hidden;
    overflow-y: auto;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--dash-bg);
    color: var(--dash-text);
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: 14px;
    min-height: 100vh;
    overflow-x: hidden;
}

body {
    display: block;
    overflow: visible;
}

/* --- BACKGROUND DECORATION (from pricing) --- */
.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.03) 1px, transparent 1px);
    background-size: 64px 64px;
}

.bg-orb {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(100px);
}
.bg-orb--1 {
    width: 700px; height: 700px;
    top: -15%; left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(37,99,235,0.18) 0%, transparent 70%);
}
.bg-orb--2 {
    width: 500px; height: 500px;
    top: 55%; right: -10%;
    background: radial-gradient(circle, rgba(139,92,246,0.10) 0%, transparent 70%);
}
.bg-orb--3 {
    width: 400px; height: 400px;
    top: 80%; left: -5%;
    background: radial-gradient(circle, rgba(16,185,129,0.08) 0%, transparent 70%);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ===== HEADER ===== */

.dash-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 28px;
    background: rgba(11,13,16,.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(148,163,184,.08);
    position: sticky;
    top: 0;
    z-index: 50;
}

.dash-logo {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, #63a4ff 0%, #93c5fd 60%, #7dd3fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    letter-spacing: -0.4px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.1s ease;
    flex-shrink: 0;
}
.dash-logo:hover {
    -webkit-text-fill-color: #7db8ff;
    background: none;
}
.dash-logo svg { color: #3b82f6; }

.dash-header-divider {
    width: 1px;
    height: 20px;
    background: var(--dash-border-strong);
    flex-shrink: 0;
}

.dash-header-title {
    font-weight: 500;
    color: var(--dash-text-muted);
    font-size: 0.88rem;
    letter-spacing: 0.01em;
}

.dash-header-spacer { flex: 1; }

.dash-header-nav {
    display: flex;
    gap: 6px;
    align-items: center;
}

.dash-header-link {
    padding: 7px 14px;
    border-radius: var(--dash-radius-sm);
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--dash-text-dim);
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.dash-header-link:hover {
    background: rgba(148, 163, 184, 0.07);
    border-color: var(--dash-border);
    color: var(--dash-text);
}

.dash-header-link--primary {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
    color: #ffffff !important;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(59,130,246,0.4);
}

.dash-header-link--primary:hover {
    background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 50%, #3b82f6 100%);
    box-shadow: 0 6px 20px rgba(59,130,246,0.5);
    color: #ffffff !important;
}

.dash-header-link--pricing {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 70, 239, 0.1) 100%);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.35);
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.15);
}

.dash-header-link--pricing:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25) 0%, rgba(217, 70, 239, 0.18) 100%);
    border-color: rgba(245, 158, 11, 0.55);
    color: #fbbf24;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.dash-header-link--templates {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(59, 130, 246, 0.08) 100%);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.12);
}

.dash-header-link--templates:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22) 0%, rgba(59, 130, 246, 0.15) 100%);
    border-color: rgba(99, 102, 241, 0.5);
    color: #a5b4fc;
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.22);
    text-shadow: 0 0 8px rgba(165, 180, 252, 0.35);
}

/* CRM - estilo similar a templates pero en verde */
.dash-header-link--crm {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12) 0%, rgba(22, 163, 74, 0.08) 100%);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
    text-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.12);
}

.dash-header-link--crm:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.22) 0%, rgba(22, 163, 74, 0.15) 100%);
    border-color: rgba(34, 197, 94, 0.5);
    color: #86efac;
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.22);
    text-shadow: 0 0 8px rgba(134, 239, 172, 0.35);
}

.dash-header-link--equipo {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(79, 70, 229, 0.08) 100%);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
    text-shadow: 0 0 8px rgba(165, 180, 252, 0.35);
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.12);
}
.dash-header-link--equipo:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22) 0%, rgba(79, 70, 229, 0.15) 100%);
    border-color: rgba(99, 102, 241, 0.5);
    color: #c7d2fe;
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.22);
}

/* Tipo de cambio badge */
.dash-tipo-cambio {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.12);
    white-space: nowrap;
    transition: opacity 0.3s, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.dash-tipo-cambio svg { opacity: 0.6; }
.dash-tipo-cambio .dash-tipo-cambio-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--dash-amber);
}
.dash-tipo-cambio .dash-tipo-cambio-values {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.dash-tipo-cambio .dash-tipo-cambio-values span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.dash-tipo-cambio:hover,
.dash-tipo-cambio:focus-visible {
    color: var(--dash-text);
    border-color: rgba(250, 204, 21, 0.32);
    background: rgba(250, 204, 21, 0.08);
    outline: none;
}
.dash-tipo-cambio[hidden] { display: none; }

.dash-kpi-tooltip--compact {
    width: 320px;
}

html[data-theme="light"] .dash-tipo-cambio {
    color: #64748b;
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .dash-tipo-cambio:hover,
html[data-theme="light"] .dash-tipo-cambio:focus-visible {
    color: #0f172a;
    border-color: rgba(202, 138, 4, 0.25);
    background: rgba(250, 204, 21, 0.12);
}

.dash-user-bar {
    display: flex;
    align-items: center;
    gap: 0;
    padding-left: 12px;
    border-left: 1px solid var(--dash-border);
    position: relative;
}

/* ---- Trigger button ---- */
.dash-user-trigger {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 4px 8px 4px 4px;
    cursor: pointer;
    color: var(--dash-text);
    transition: background 0.08s, border-color 0.08s;
}
.dash-user-pending-dot {
    position: absolute;
    top: 2px;
    left: 24px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--dash-amber, #f59e0b);
    border: 2px solid var(--dash-panel-solid, #0b0d10);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}
.dash-user-pending-dot[hidden] { display: none; }
.dash-user-trigger:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--dash-border);
}

/* ---- Switch de cuenta (junto al nombre) ---- */
.dash-user-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-left: 8px;
    background: transparent;
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: 10px;
    cursor: pointer;
    color: var(--dash-text-dim);
    transition: background 0.08s, border-color 0.08s, color 0.08s, transform 0.06s;
}
.dash-user-switch:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(148,163,184,0.32);
    color: var(--dash-text);
}
.dash-user-switch:active { transform: scale(0.96); }
.dash-user-switch-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--dash-amber, #f59e0b);
    border: 2px solid var(--dash-panel-solid, #0b0d10);
    color: #0b0d10;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 11px;
    text-align: center;
}
.dash-user-switch-badge[hidden] { display: none; }

/* Lente de valuación de inventario (Financiado / Contado / Comparar) */
.proj-valuacion-label { font-size: 0.74rem; font-weight: 600; color: #94a3b8; white-space: nowrap; }
html[data-theme="light"] .proj-valuacion-label { color: #64748b; }
.proj-valuacion-badge {
    display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; cursor: pointer;
    user-select: none; white-space: nowrap; transition: background .15s, color .15s, border-color .15s;
    background: rgba(168,85,247,0.15); border: 1px solid rgba(168,85,247,0.4); color: #c084fc;
}
.proj-valuacion-badge:hover { background: rgba(168,85,247,0.28); border-color: rgba(168,85,247,0.6); color: #d8b4fe; }
.proj-valuacion-badge:active { transform: scale(.95); }
.proj-valuacion-badge[data-modo="contado"] { background: rgba(34,197,94,0.15); border-color: rgba(34,197,94,0.45); color: #4ade80; }
.proj-valuacion-badge[data-modo="contado"]:hover { background: rgba(34,197,94,0.28); border-color: rgba(34,197,94,0.65); color: #86efac; }
.proj-valuacion-badge[data-modo="comparar"] { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.45); color: #60a5fa; }
.proj-valuacion-badge[data-modo="comparar"]:hover { background: rgba(59,130,246,0.28); border-color: rgba(59,130,246,0.65); color: #93c5fd; }
html[data-theme="light"] .proj-valuacion-badge { background: rgba(168,85,247,0.08); }
html[data-theme="light"] .proj-valuacion-badge[data-modo="contado"] { background: rgba(34,197,94,0.08); }
html[data-theme="light"] .proj-valuacion-badge[data-modo="comparar"] { background: rgba(59,130,246,0.08); }

html[data-theme="light"] .dash-user-switch { color: #64748b; }
html[data-theme="light"] .dash-user-switch:hover { color: #0f172a; }

.dash-user-name {
    font-size: 0.84rem;
    color: var(--dash-text-dim);
    max-width: 120px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
}

.dash-user-chevron {
    color: var(--dash-text-muted);
    flex-shrink: 0;
    transition: transform 0.1s;
}
.dash-user-trigger[aria-expanded="true"] .dash-user-chevron {
    transform: rotate(180deg);
}

/* ---- Avatar ---- */
.dash-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--dash-border-strong);
    flex-shrink: 0;
}
.dash-user-avatar--initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dash-accent-soft);
    color: var(--dash-accent-2);
    font-size: 0.75rem;
    font-weight: 600;
    border: 1.5px solid var(--dash-accent-glow);
}

/* ---- Dropdown ---- */
.dash-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--dash-panel-solid);
    border: 1px solid var(--dash-border-strong);
    border-radius: 14px;
    padding: 6px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
    z-index: 999;
    opacity: 0;
    transform: translateY(-6px) scale(.98);
    transition: opacity .16s ease, transform .16s ease;
}
.dash-user-dropdown.dash-fade-in { opacity: 1; transform: translateY(0) scale(1); }
.dash-user-dropdown[hidden] { display: none; }

.dash-user-dropdown-header {
    padding: 10px 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dash-user-dropdown-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dash-text);
}
.dash-user-dropdown-email {
    font-size: 0.75rem;
    color: var(--dash-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-user-dropdown-divider {
    height: 1px;
    background: var(--dash-border);
    margin: 4px 0;
}

.dash-user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 9px;
    border: none;
    background: none;
    color: var(--dash-text-dim);
    font-size: 0.84rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.06s, color 0.06s;
}
.dash-user-dropdown-item:hover {
    background: rgba(255,255,255,0.06);
    color: var(--dash-text);
}
.dash-user-dropdown-item--danger { color: var(--dash-red); }
.dash-user-dropdown-item--danger:hover { background: var(--dash-red-soft); color: var(--dash-red); }

.dash-user-dropdown-item-icon { font-size: 1em; }

.dash-user-dropdown-sec {
    margin: 2px 0 2px;
    padding: 4px 12px 2px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dash-text-muted);
}

.dash-user-dropdown-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    border-radius: 9px;
    color: #fff;
    background: var(--dash-amber, #f59e0b);
}
.dash-user-dropdown-badge[hidden] { display: none; }

/* ---- Mi cuenta modal ---- */
.dash-cuenta-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dash-cuenta-modal-panel {
    background: var(--dash-panel-solid);
    border: 1px solid var(--dash-border-strong);
    border-radius: var(--dash-radius-sm);
    width: 100%;
    max-width: 420px;
    box-shadow: var(--dash-shadow);
    display: flex;
    flex-direction: column;
}

.dash-cuenta-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--dash-border);
}
.dash-cuenta-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--dash-text);
}
.dash-cuenta-modal-close {
    background: none;
    border: none;
    color: var(--dash-text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.06s, background 0.06s;
}
.dash-cuenta-modal-close:hover { color: var(--dash-text); background: rgba(255,255,255,0.06); }

.dash-cuenta-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dash-cuenta-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--dash-text-muted);
    margin-top: 8px;
}
.dash-cuenta-label:first-child { margin-top: 0; }

.dash-cuenta-input {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--dash-border-strong);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--dash-text);
    font-size: 0.88rem;
    font-family: inherit;
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}
.dash-cuenta-input:focus { border-color: var(--dash-accent-2); }
.dash-cuenta-input:disabled { color: var(--dash-text-muted); cursor: not-allowed; }

.dash-cuenta-email-note {
    margin: 0;
    font-size: 0.73rem;
    color: var(--dash-text-muted);
}

.dash-cuenta-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--dash-border);
}
.dash-cuenta-status {
    font-size: 0.8rem;
    color: var(--dash-text-muted);
    flex: 1;
}

/* ===== WELCOME BANNER ===== */

.dash-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 28px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--dash-border);
    background: linear-gradient(90deg, rgba(59,130,246,0.06) 0%, transparent 60%);
}

.dash-welcome-text h2 {
    margin: 0 0 2px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dash-text);
    letter-spacing: -0.02em;
}

.dash-welcome-text p {
    margin: 0;
    font-size: 0.84rem;
    color: var(--dash-text-muted);
}

/* ===== MAIN ===== */

.dash-main {
    position: relative;
    z-index: 1;
    max-width: 1480px;
    margin: 0 auto;
    padding: 28px;
    width: 100%;
}

.dash-loading, .dash-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    gap: 14px;
    color: var(--dash-text-dim);
}

.dash-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(148, 163, 184, 0.15);
    border-top-color: var(--dash-accent);
    border-radius: 50%;
    animation: dash-spin 0.5s linear infinite;
}

@keyframes dash-spin { to { transform: rotate(360deg); } }

.dash-btn {
    appearance: none;
    border: 1px solid var(--dash-border-strong);
    background: var(--dash-panel-solid);
    color: var(--dash-text);
    padding: 8px 16px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.08s, border-color 0.08s, box-shadow 0.08s;
}
.dash-btn:hover { background: var(--dash-panel-2); border-color: var(--dash-accent); box-shadow: var(--dash-shadow-glow); }
.dash-btn--primary {
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 12px rgba(99,102,241,0.3);
}
.dash-btn--primary:hover { background: linear-gradient(135deg, #2563eb, #4f46e5); box-shadow: 0 4px 20px rgba(99,102,241,0.5); }

/* ===== SECTION TITLE ===== */

.dash-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--dash-text-muted);
    margin: 0 0 14px;
}

/* ===== KPIs ===== */

.dash-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--dash-gap);
    margin-bottom: 30px;
}

.dash-kpi {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 20px;
    background: var(--dash-panel);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    box-shadow: var(--dash-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.09s ease, border-color 0.09s ease, box-shadow 0.09s ease;
    position: relative;
    overflow: hidden;
}

.dash-kpi::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 60%);
    pointer-events: none;
}

.dash-kpi:hover {
    transform: translateY(-2px);
    border-color: rgba(59,130,246,0.35);
    box-shadow: var(--dash-shadow-glow);
}

.dash-kpi--warn { border-color: rgba(239, 68, 68, 0.3); }
.dash-kpi--warn:hover { border-color: rgba(239, 68, 68, 0.5); box-shadow: 0 0 0 1px rgba(239,68,68,0.25), 0 8px 32px rgba(239,68,68,0.1); }
.dash-kpi--warn .dash-kpi-value { color: var(--dash-red); }

.dash-kpi-icon {
    font-size: 1.7rem;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dash-accent-soft);
    border-radius: var(--dash-radius-sm);
    flex: 0 0 46px;
    border: 1px solid rgba(59, 130, 246, 0.18);
}

.dash-kpi--warn .dash-kpi-icon { background: var(--dash-red-soft); border-color: rgba(239,68,68,0.2); }

.dash-kpi-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }

.dash-kpi-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dash-text-muted);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dash-text);
}

.dash-kpi-sub {
    font-size: 0.78rem;
    color: var(--dash-text-dim);
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: 3px;
    line-height: 1.3;
}

/* ===== KPIs SECUNDARIOS (Proyecciones y Rendimiento) ===== */

.dash-section-title--secondary {
    color: var(--dash-text-dim);
}

.dash-section-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.dash-section-title-row[hidden] { display: none !important; }

.dash-section-title-row .dash-section-title {
    margin-bottom: 0;
}

.dash-kpi-currency-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #60a5fa;
    cursor: default;
    transition: background 0.1s, color 0.1s;
}

.dash-kpi-currency-badge--disabled {
    opacity: 0.62;
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.18);
    color: #94a3b8;
    cursor: not-allowed;
}

/* Actions container for section title */
.dash-section-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Report button */
.dash-report-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    cursor: pointer;
    transition: all 0.1s ease;
}

.dash-report-btn:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
}

.dash-report-btn:active {
    transform: translateY(0);
}

/* Report Modal */
.dash-report-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    padding: 0;
}

.dash-report-modal[hidden] {
    display: none;
}

.dash-report-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.dash-report-container {
    position: relative;
    width: 50%;
    max-width: 50%;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    background: var(--dash-surface, #0f172a);
    border-left: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 0;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.12s ease-out;
}

.dash-report-modal:not([hidden]) .dash-report-container {
    transform: translateX(0);
}

.dash-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(148, 163, 184, 0.05);
}

.dash-report-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-report-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #e2e8f0;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dash-report-print-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

.dash-report-print-btn:active {
    transform: translateY(0);
}

.dash-report-ejecutivo-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.dash-report-ejecutivo-btn:hover {
    background: rgba(251, 191, 36, 0.25);
    border-color: rgba(251, 191, 36, 0.5);
    transform: translateY(-1px);
}

.dash-report-ejecutivo-btn:active {
    transform: translateY(0);
}

.dash-report-titulo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dash-text, #f1f5f9);
    margin: 0;
}

.dash-report-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.1s;
}

.dash-report-close:hover {
    background: rgba(239, 68, 68, 0.25);
}

.dash-report-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Contenedor para Alertas y Resumen en 2 columnas */
.dash-report-top-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.dash-report-top-panels .dash-report-seccion {
    margin-bottom: 0;
}

.dash-report-seccion {
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(148, 163, 184, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.dash-report-seccion:last-child {
    margin-bottom: 0;
}

.dash-report-seccion--resumen {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.2);
}

.dash-report-seccion--alertas {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.25);
}

.dash-report-alertas {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dash-report-alerta {
    padding: 8px 10px;
    border-radius: 6px;
    border-left: 3px solid;
    font-size: 0.7rem;
    line-height: 1.4;
}

.dash-report-alerta--critica {
    background: rgba(239, 68, 68, 0.15);
    border-color: #f87171;
    color: #fca5a5;
}

.dash-report-alerta--advertencia {
    background: rgba(251, 191, 36, 0.15);
    border-color: #fbbf24;
    color: #fcd34d;
}

.dash-report-alerta--info {
    background: rgba(59, 130, 246, 0.15);
    border-color: #60a5fa;
    color: #93c5fd;
}

.dash-report-alerta--exito {
    background: rgba(16, 185, 129, 0.15);
    border-color: #34d399;
    color: #6ee7b7;
}

.dash-report-seccion-titulo {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--dash-text, #f1f5f9);
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.dash-report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.dash-report-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
    background: rgba(148, 163, 184, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.08);
}

.dash-report-label {
    font-size: 0.65rem;
    color: var(--dash-text-dim, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dash-report-valor {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dash-text, #f1f5f9);
}

/* Colores semánticos para valores */
.dash-report-valor--success { color: #34d399; }
.dash-report-valor--warning { color: #fbbf24; }
.dash-report-valor--danger { color: #f87171; }
.dash-report-valor--info { color: #60a5fa; }
.dash-report-valor--money { color: #34d399; }
.dash-report-valor--highlight { color: #a78bfa; }

.dash-report-desc {
    font-size: 0.7rem;
    color: var(--dash-text-dim, #64748b);
    line-height: 1.3;
}

/* Colores para textos descriptivos */
.dash-report-desc--success { color: #6ee7b7; }
.dash-report-desc--warning { color: #fcd34d; }
.dash-report-desc--danger { color: #fca5a5; }
.dash-report-desc--info { color: #93c5fd; }

.dash-report-resumen {
    padding: 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    border-left: 3px solid #60a5fa;
}

.dash-report-resumen-texto {
    font-size: 0.8rem;
    color: var(--dash-text, #e2e8f0);
    line-height: 1.6;
    margin: 0;
}

.dash-report-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    background: rgba(148, 163, 184, 0.05);
    display: flex;
    justify-content: flex-end;
}

.dash-report-btn-cerrar {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--dash-text, #f1f5f9);
    cursor: pointer;
    transition: all 0.1s;
}

.dash-report-btn-cerrar:hover {
    background: rgba(148, 163, 184, 0.25);
}

/* ====== Estilos para impresión del reporte ====== */
@media print {
    /* Ocultar todo excepto el modal del reporte */
    body.printing-report > *:not(.dash-report-modal) {
        display: none !important;
    }
    
    /* Forzar que el modal sea visible y ocupe toda la página */
    body.printing-report .dash-report-modal,
    body.printing-report .dash-report-modal[hidden] {
        display: block !important;
        position: static !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 100% !important;
        overflow: visible !important;
        background: white !important;
        z-index: 999999 !important;
    }
    
    body.printing-report .dash-report-overlay {
        display: none !important;
    }
    
    body.printing-report .dash-report-container {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        min-height: auto !important;
        transform: none !important;
        background: white !important;
        color: #1e293b !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 15mm !important;
    }
    
    body.printing-report .dash-report-header {
        display: flex !important;
        background: white !important;
        border-bottom: 2px solid #3b82f6 !important;
        padding: 10px 0 !important;
        border-radius: 0 !important;
    }
    
    body.printing-report .dash-report-titulo {
        color: #1e293b !important;
        font-size: 20px !important;
        display: block !important;
    }
    
    body.printing-report .dash-report-header-actions,
    body.printing-report .dash-report-footer {
        display: none !important;
    }
    
    body.printing-report .dash-report-content {
        display: block !important;
        padding: 0 !important;
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }
    
    body.printing-report .dash-report-seccion {
        display: block !important;
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        page-break-inside: avoid;
        margin-bottom: 12px !important;
    }
    
    body.printing-report .dash-report-seccion--resumen {
        background: #eff6ff !important;
        border-color: #bfdbfe !important;
    }
    
    body.printing-report .dash-report-seccion--alertas {
        background: #fef2f2 !important;
        border-color: #fecaca !important;
    }
    
    body.printing-report .dash-report-seccion-titulo {
        color: #1e293b !important;
        border-bottom-color: #e2e8f0 !important;
        display: block !important;
    }
    
    body.printing-report .dash-report-top-panels {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }
    
    body.printing-report .dash-report-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    
    body.printing-report .dash-report-item {
        display: flex !important;
        background: white !important;
        border: 1px solid #e2e8f0 !important;
        padding: 8px !important;
    }
    
    body.printing-report .dash-report-label {
        color: #64748b !important;
        display: block !important;
    }
    
    body.printing-report .dash-report-valor {
        color: #1e293b !important;
        display: block !important;
    }
    
    body.printing-report .dash-report-valor--success { color: #16a34a !important; }
    body.printing-report .dash-report-valor--warning { color: #ca8a04 !important; }
    body.printing-report .dash-report-valor--danger { color: #dc2626 !important; }
    body.printing-report .dash-report-valor--info { color: #2563eb !important; }
    body.printing-report .dash-report-valor--money { color: #16a34a !important; }
    
    body.printing-report .dash-report-desc {
        color: #64748b !important;
        display: block !important;
    }
    
    body.printing-report .dash-report-alerta {
        display: block !important;
        padding: 8px 10px !important;
        border-left: 3px solid !important;
        margin-bottom: 6px !important;
    }
    
    body.printing-report .dash-report-alerta--critica {
        background: #fef2f2 !important;
        border-color: #ef4444 !important;
        color: #991b1b !important;
    }
    
    body.printing-report .dash-report-alerta--advertencia {
        background: #fffbeb !important;
        border-color: #f59e0b !important;
        color: #92400e !important;
    }
    
    body.printing-report .dash-report-alerta--info {
        background: #eff6ff !important;
        border-color: #3b82f6 !important;
        color: #1e40af !important;
    }
    
    body.printing-report .dash-report-alerta--exito {
        background: #f0fdf4 !important;
        border-color: #22c55e !important;
        color: #166534 !important;
    }
    
    body.printing-report .dash-report-resumen {
        background: #eff6ff !important;
        border-left-color: #3b82f6 !important;
        display: block !important;
    }
    
    body.printing-report .dash-report-resumen-texto {
        color: #1e293b !important;
        display: block !important;
    }
    
    /* Ocultar header y footer del navegador */
    @page {
        margin: 15mm;
        size: auto;
    }
}

.dash-kpis-secondary {
    grid-template-columns: repeat(3, 1fr) 1px repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.dash-kpis-divider {
    background: var(--dash-border);
    width: 1px;
    align-self: stretch;
    margin: 4px 2px;
    border-radius: 1px;
}

.dash-kpi-secondary {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 16px 18px;
    background: var(--dash-panel);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius-sm);
    box-shadow: var(--dash-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    transition: transform .06s ease, border-color .06s, box-shadow .06s;
}

.dash-kpi-secondary--monetary {
    cursor: pointer;
    user-select: none;
}

.dash-kpi-secondary--monetary:hover {
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: var(--dash-shadow-glow);
}

.dash-kpi-secondary--monetary:active {
    transform: translateY(0) scale(0.98);
}

.dash-kpi-secondary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, transparent 60%);
    pointer-events: none;
}

.dash-kpi-secondary:hover {
    transform: translateY(-2px);
    border-color: rgba(59,130,246,0.35);
    box-shadow: var(--dash-shadow-glow);
}

.dash-kpi-secondary-icon-col {
    position: relative;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
}

.dash-kpi-secondary-icon {
    font-size: 1.3rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dash-accent-soft);
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.18);
}

.dash-kpi-secondary-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dash-kpi-secondary-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dash-text-muted);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-kpi-secondary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dash-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-kpi-secondary-sub {
    font-size: 0.7rem;
    color: var(--dash-text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 0;
    opacity: 0;
    transform: translateY(-2px);
    transition: max-height 0.08s ease-out, opacity 0.05s ease, transform 0.05s ease;
}

/* Mostrar descripciones cuando el panel está expandido (clase is-expanded) */
.dash-kpi-secondary.is-expanded .dash-kpi-secondary-sub {
    max-height: 24px;
    opacity: 1;
    transform: translateY(0);
}

/* Transición rápida para contenedores de desglose */
.dash-kpi-cartera-desglose,
.dash-kpi-bloqueado-desglose,
.dash-kpi-inventario-desglose,
.dash-kpi-morosidad-subs,
.dash-kpi-caidas-subs,
.dash-kpi-absorcion-subs {
    transition: margin-top 0.06s ease-out;
}

.dash-kpi-secondary.is-expanded .dash-kpi-cartera-desglose,
.dash-kpi-secondary.is-expanded .dash-kpi-bloqueado-desglose,
.dash-kpi-secondary.is-expanded .dash-kpi-inventario-desglose,
.dash-kpi-secondary.is-expanded .dash-kpi-morosidad-subs,
.dash-kpi-secondary.is-expanded .dash-kpi-caidas-subs,
.dash-kpi-secondary.is-expanded .dash-kpi-absorcion-subs {
    margin-top: 4px;
}

/* Mostrar TODAS las descripciones cuando el contenedor tiene show-all-descriptions */
.dash-kpis-secondary.show-all-descriptions .dash-kpi-secondary-sub {
    max-height: 24px;
    opacity: 1;
    transform: translateY(0);
}

.dash-kpis-secondary.show-all-descriptions .dash-kpi-cartera-desglose,
.dash-kpis-secondary.show-all-descriptions .dash-kpi-bloqueado-desglose,
.dash-kpis-secondary.show-all-descriptions .dash-kpi-inventario-desglose,
.dash-kpis-secondary.show-all-descriptions .dash-kpi-morosidad-subs,
.dash-kpis-secondary.show-all-descriptions .dash-kpi-caidas-subs,
.dash-kpis-secondary.show-all-descriptions .dash-kpi-absorcion-subs {
    margin-top: 4px;
}

.dash-kpis-secondary.show-all-descriptions .dash-kpi-info-icon {
    opacity: 0.75;
    visibility: visible;
}

/* Desglose de Inventario Bloqueado */
.dash-kpi-bloqueado-desglose {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 2px;
}

.dash-kpi-bloqueado-desglose .dash-kpi-secondary-sub {
    font-size: 0.65rem;
    line-height: 1.3;
}

/* Desglose de Cartera por Cobrar */
.dash-kpi-cartera-desglose {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 2px;
}

.dash-kpi-cartera-desglose .dash-kpi-secondary-sub {
    font-size: 0.65rem;
    line-height: 1.3;
}

/* Tooltip para KPIs */
.dash-kpi-secondary.dash-kpi-tooltip-trigger {
    position: relative;
    cursor: help;
    overflow: visible;
    z-index: 100;
    transform: translateZ(0);
}

/* Paneles de proyecciones: cursor manita (pointer) en lugar de help */
.dash-kpis-secondary .dash-kpi-secondary.dash-kpi-tooltip-trigger {
    cursor: pointer;
}

.dash-kpi-tooltip-trigger {
    position: relative;
    cursor: help;
}

.dash-kpi-tooltip-trigger .dash-kpi-info-icon {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-style: italic;
    font-weight: 800;
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1;
    color: #fff;
    background: var(--dash-accent-2);
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(2, 6, 23, 0.55), 0 1px 3px rgba(0,0,0,0.35);
    opacity: 0;
    visibility: hidden;
    cursor: help;
    transition: opacity 0.05s ease, visibility 0.05s ease, transform 0.1s ease;
}

.dash-kpi-tooltip-trigger .dash-kpi-info-icon:hover {
    transform: scale(1.2);
}

html[data-theme="light"] .dash-kpi-tooltip-trigger .dash-kpi-info-icon {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 1px 3px rgba(0,0,0,0.2);
}

/* Spinner de carga independiente del botón de ayuda */
.dash-kpi-secondary::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 18px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: var(--dash-accent-2);
    border-radius: 50%;
    opacity: 0;
    animation: spin 0.3s linear infinite;
    pointer-events: none;
    z-index: 10;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mostrar spinner durante la carga/expansión */
.dash-kpi-secondary.is-loading::after {
    opacity: 1;
}

.dash-kpi-secondary.is-loading .dash-kpi-info-icon {
    opacity: 0;
    visibility: hidden;
}

/* Mostrar botón de ayuda solo cuando el panel está expandido */
.dash-kpi-secondary.is-expanded .dash-kpi-info-icon {
    opacity: 0.75;
    visibility: visible;
}

.dash-kpi-secondary.is-expanded .dash-kpi-info-icon:hover {
    opacity: 1;
}

.dash-kpi-tooltip-trigger .dash-kpi-info-icon:hover {
    opacity: 1;
}

.dash-kpi-tooltip {
    position: fixed;
    left: 50%;
    top: 0;
    --tooltip-arrow-left: 50%;
    transform: translateY(-4px);
    width: 280px;
    max-width: 90vw;
    background: var(--dash-panel-solid);
    border: 1px solid var(--dash-border-strong);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--dash-text);
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease, visibility 0.12s ease, transform 0.12s ease;
    z-index: 2147483647;
    pointer-events: none;
}

.dash-kpi-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dash-kpi-tooltip.is-visible::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: var(--tooltip-arrow-left, 50%);
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-bottom-color: var(--dash-border-strong);
}

.dash-kpi-tooltip.is-visible::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: var(--tooltip-arrow-left, 50%);
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-bottom-color: var(--dash-panel-solid);
    margin-bottom: -1px;
}

/* Light theme tooltip overrides */
html[data-theme="light"] .dash-kpi-tooltip {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .dash-kpi-tooltip.is-visible::after {
    border-bottom-color: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .dash-kpi-tooltip.is-visible::before {
    border-bottom-color: #ffffff;
}

/* Tarjeta con foco activo: filtrando Análisis y Tendencias por esta métrica */
.dash-kpi-secondary--focused {
    border-color: rgba(129, 140, 248, 0.85);
    background:
        linear-gradient(135deg, rgba(99, 102, 241, 0.16) 0%, transparent 60%),
        var(--dash-panel);
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.45), 0 10px 36px rgba(99, 102, 241, 0.3);
}
.dash-kpi-secondary--focused:not(:active) {
    transform: translateY(-2px);
}
.dash-kpi-secondary--focused .dash-kpi-secondary-icon {
    background: rgba(129, 140, 248, 0.28);
    border-color: rgba(129, 140, 248, 0.5);
}
.dash-kpi-secondary--focused .dash-kpi-secondary-value {
    color: #a5b4fc;
}

/* Botón "cerrar" de la tarjeta enfocada: solo visible mientras está expandida */
.dash-kpi-close {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.12);
    color: var(--dash-text-dim);
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.dash-kpi-close:hover {
    background: rgba(148, 163, 184, 0.22);
    color: var(--dash-text);
}
.dash-kpi-secondary--focused .dash-kpi-close {
    display: inline-flex;
}

/* Foco por tarjeta: transición de entrada/salida de secciones, títulos y gráficas */
section[aria-label="Proyectos"],
#dash-section-cobranza,
#dash-section-actividad,
#dash-kpi-detail,
#dash-section-cobranza > .dash-section-title-row,
#dash-section-actividad > .dash-section-title-row,
#dash-section-actividad [data-chart-key] {
    transition: opacity 200ms ease, transform 200ms ease, margin-top 200ms ease;
    opacity: 1;
    transform: none;
}
section[aria-label="Proyectos"].dash-kpi-focus-fade,
#dash-section-cobranza.dash-kpi-focus-fade,
#dash-kpi-detail.dash-kpi-focus-fade,
#dash-section-cobranza > .dash-section-title-row.dash-kpi-focus-fade,
#dash-section-actividad > .dash-section-title-row.dash-kpi-focus-fade,
#dash-section-actividad [data-chart-key].dash-kpi-focus-fade {
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
}

/* Panel de detalle de la tarjeta enfocada */
.dash-kpi-detail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-top: 14px;
    padding: 18px 20px;
    background: var(--dash-panel);
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: var(--dash-radius-sm);
    box-shadow: var(--dash-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.dash-kpi-detail[hidden] { display: none !important; }
.dash-kpi-detail-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dash-kpi-detail-lbl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dash-text-muted);
    font-weight: 700;
}
.dash-kpi-detail-info {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(129, 140, 248, 0.45);
    background: rgba(129, 140, 248, 0.12);
    color: var(--dash-accent-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 16px;
    padding: 0;
    font-size: 0.66rem;
    line-height: 1;
    font-weight: 800;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.dash-kpi-detail-info:hover,
.dash-kpi-detail-info:focus-visible,
.dash-kpi-detail-info[aria-expanded="true"] {
    background: rgba(129, 140, 248, 0.22);
    border-color: rgba(129, 140, 248, 0.85);
    color: var(--dash-text);
    transform: translateY(-1px);
    outline: none;
}
.dash-kpi-detail-tooltip {
    position: fixed;
    left: 50%;
    top: 0;
    --tooltip-arrow-left: 50%;
    width: min(340px, calc(100vw - 24px));
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.97);
    border: 1px solid rgba(129, 140, 248, 0.38);
    border-radius: var(--dash-radius-sm);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
    color: var(--dash-text-dim);
    font-size: 0.78rem;
    line-height: 1.45;
    z-index: 2147483647;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
.dash-kpi-detail-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}
.dash-kpi-detail-tooltip.is-visible::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: var(--tooltip-arrow-left, 50%);
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-bottom-color: rgba(129, 140, 248, 0.38);
}
.dash-kpi-detail-tooltip.is-visible::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: var(--tooltip-arrow-left, 50%);
    transform: translateX(-50%) translateY(1px);
    border: 7px solid transparent;
    border-bottom-color: rgba(15, 23, 42, 0.97);
    z-index: 1;
}
html[data-theme="light"] .dash-kpi-detail-info {
    background: rgba(79, 70, 229, 0.08);
    color: #4f46e5;
}
html[data-theme="light"] .dash-kpi-detail-info:hover,
html[data-theme="light"] .dash-kpi-detail-info:focus-visible,
html[data-theme="light"] .dash-kpi-detail-info[aria-expanded="true"] {
    background: rgba(79, 70, 229, 0.15);
    color: #1e293b;
}
html[data-theme="light"] .dash-kpi-detail-tooltip {
    background: #ffffff;
    border-color: rgba(79, 70, 229, 0.26);
    color: #475569;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}
html[data-theme="light"] .dash-kpi-detail-tooltip.is-visible::after {
    border-bottom-color: rgba(79, 70, 229, 0.26);
}
html[data-theme="light"] .dash-kpi-detail-tooltip.is-visible::before {
    border-bottom-color: #ffffff;
}
.dash-kpi-detail-val {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dash-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dash-kpi-detail-val.ok { color: var(--dash-green); }
.dash-kpi-detail-val.warn { color: var(--dash-amber); }
.dash-kpi-detail-val.danger { color: var(--dash-red); }
.dash-kpi-detail-val.dim { color: var(--dash-text-dim); }
.dash-kpi-detail-months { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.dash-kpi-detail-year {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--dash-accent-2);
    margin-top: 8px;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--dash-border);
}
.dash-kpi-detail-mes {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--dash-text-dim);
    padding: 3px 0;
}
.dash-kpi-detail-mes strong { color: var(--dash-text); font-weight: 600; }

/* Sin título arriba, el margen entre secciones (fijo inline) se reduce para
   que no quede un hueco donde "debería" haber estado el título. */
#dash-section-cobranza.dash-section--tight,
#dash-section-actividad.dash-section--tight {
    margin-top: 10px !important;
}

@media (prefers-reduced-motion: reduce) {
    section[aria-label="Proyectos"],
    #dash-section-cobranza,
    #dash-section-actividad,
    #dash-kpi-detail,
    #dash-section-cobranza > .dash-section-title-row,
    #dash-section-actividad > .dash-section-title-row,
    #dash-section-actividad [data-chart-key] {
        transition: none;
    }
}

/* Variantes de color para KPIs secundarios */
.dash-kpi-secondary--success { border-color: rgba(34, 197, 94, 0.3); }
.dash-kpi-secondary--success:hover { border-color: rgba(34, 197, 94, 0.5); box-shadow: 0 0 0 1px rgba(34,197,94,0.25), 0 8px 32px rgba(34,197,94,0.1); }
.dash-kpi-secondary--success .dash-kpi-secondary-icon { background: var(--dash-green-soft); border-color: rgba(34,197,94,0.2); }
.dash-kpi-secondary--success .dash-kpi-secondary-value { color: var(--dash-green); }

.dash-kpi-secondary--warn { border-color: rgba(245, 158, 11, 0.3); }
.dash-kpi-secondary--warn:hover { border-color: rgba(245, 158, 11, 0.5); box-shadow: 0 0 0 1px rgba(245,158,11,0.25), 0 8px 32px rgba(245,158,11,0.1); }
.dash-kpi-secondary--warn .dash-kpi-secondary-icon { background: rgba(245, 158, 11, 0.14); border-color: rgba(245,158,11,0.2); }
.dash-kpi-secondary--warn .dash-kpi-secondary-value { color: var(--dash-amber); }

.dash-kpi-secondary--danger { border-color: rgba(239, 68, 68, 0.3); }
.dash-kpi-secondary--danger:hover { border-color: rgba(239, 68, 68, 0.5); box-shadow: 0 0 0 1px rgba(239,68,68,0.25), 0 8px 32px rgba(239,68,68,0.1); }
.dash-kpi-secondary--danger .dash-kpi-secondary-icon { background: var(--dash-red-soft); border-color: rgba(239,68,68,0.2); }
.dash-kpi-secondary--danger .dash-kpi-secondary-value { color: var(--dash-red); }

/* Responsive: KPIs secundarios */
@media (max-width: 1200px) {
    .dash-kpis-secondary {
        grid-template-columns: repeat(3, 1fr);
    }
    .dash-kpis-divider {
        display: none;
    }
}

@media (max-width: 768px) {
    .dash-kpis-secondary {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .dash-kpis-divider {
        display: none;
    }
    .dash-kpi-secondary {
        padding: 10px 8px;
    }
    .dash-kpi-secondary-icon-col {
        width: 32px;
        height: 32px;
        flex: 0 0 32px;
    }
    .dash-kpi-secondary-icon {
        width: 32px;
        height: 32px;
        flex: 0 0 32px;
        font-size: 1.1rem;
    }
    .dash-kpi-secondary-value {
        font-size: 0.95rem;
    }
    .dash-kpi-secondary-label {
        font-size: 0.6rem;
    }
    .dash-kpi-secondary-sub {
        font-size: 0.65rem;
    }
}

/* ===== TABLA INVENTARIO ===== */

.dash-table-wrap {
    background: var(--dash-panel);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    overflow: hidden;
    box-shadow: var(--dash-shadow);
    backdrop-filter: blur(10px);
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.dash-table thead {
    background: rgba(6, 13, 26, 0.6);
}

.dash-table th {
    text-align: left;
    padding: 13px 16px;
    font-weight: 700;
    color: var(--dash-text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--dash-border);
    white-space: nowrap;
}

.dash-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(148,163,184,0.07);
    vertical-align: middle;
}

.dash-table tbody tr:last-child td { border-bottom: none; }
.dash-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.018); }
.dash-table tbody tr:hover { background: rgba(59, 130, 246, 0.07); }

.dash-proj-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.dash-proj-thumb {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--dash-panel-2);
    flex: 0 0 40px;
    border: 1px solid var(--dash-border);
}

.dash-proj-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-proj-name { font-weight: 600; color: var(--dash-text); }
.dash-proj-loc { font-size: 0.75rem; color: var(--dash-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

.dash-lotes-bar {
    display: flex;
    gap: 4px;
    font-size: 0.78rem;
    align-items: center;
    flex-wrap: wrap;
}

.dash-lot-pill {
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.7rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.dash-lot-pill--disp { background: rgba(59, 130, 246, 0.16); color: #93c5fd; border: 1px solid rgba(59,130,246,0.2); }
.dash-lot-pill--res { background: rgba(245, 158, 11, 0.16); color: #fbbf24; border: 1px solid rgba(245,158,11,0.2); }
.dash-lot-pill--apart { background: rgba(234, 179, 8, 0.16); color: #fde047; border: 1px solid rgba(234,179,8,0.2); }
.dash-lot-pill--vend { background: rgba(34, 197, 94, 0.16); color: #86efac; border: 1px solid rgba(34,197,94,0.2); }
.dash-lot-pill--nodisp { background: rgba(100, 116, 139, 0.16); color: #cbd5e1; border: 1px solid rgba(100,116,139,0.25); }

/* Light theme overrides for lot pills */
html[data-theme="light"] .dash-lot-pill--disp { background: rgba(59, 130, 246, 0.12); color: #2563eb; border: 1px solid rgba(59,130,246,0.25); }
html[data-theme="light"] .dash-lot-pill--res { background: rgba(245, 158, 11, 0.12); color: #b45309; border: 1px solid rgba(245,158,11,0.25); }
html[data-theme="light"] .dash-lot-pill--apart { background: rgba(234, 179, 8, 0.12); color: #a16207; border: 1px solid rgba(234,179,8,0.25); }
html[data-theme="light"] .dash-lot-pill--vend { background: rgba(34, 197, 94, 0.12); color: #15803d; border: 1px solid rgba(34,197,94,0.25); }
html[data-theme="light"] .dash-lot-pill--nodisp { background: rgba(100, 116, 139, 0.12); color: #475569; border: 1px solid rgba(100,116,139,0.3); }

.dash-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 110px;
}

.dash-progress-bar {
    flex: 1;
    height: 5px;
    background: rgba(148,163,184,0.12);
    border-radius: 3px;
    overflow: hidden;
}

.dash-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--dash-accent), var(--dash-green));
    border-radius: 3px;
    transition: width 0.25s ease;
}

.dash-progress-label { font-size: 0.77rem; color: var(--dash-text-dim); min-width: 36px; text-align: right; font-weight: 600; }

.dash-num { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.dash-num--warn { color: var(--dash-red); font-weight: 700; }
.dash-num--ok { color: var(--dash-text-dim); }

.dash-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.dash-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--dash-border);
    color: var(--dash-text-dim);
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.08s, border-color 0.08s, transform 0.05s;
    cursor: pointer;
}

.dash-action:hover {
    background: var(--dash-accent-soft);
    border-color: rgba(59,130,246,0.4);
    color: var(--dash-text);
    transform: translateY(-1px);
}

/* ===== COBRANZA ===== */

.dash-cobranza-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--dash-gap);
}

.dash-cobranza-grid .dash-card:first-child { grid-column: 1 / -1; }

.dash-card {
    background: var(--dash-panel);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    padding: 24px;
    box-shadow: var(--dash-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--dash-border);
}

.dash-card-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--dash-text);
    letter-spacing: -0.01em;
}

.dash-chart {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    width: 100%;
    min-width: 0;
}

.dash-chart .apexcharts-canvas { width: 100% !important; }
.dash-chart svg { width: 100%; height: 100%; display: block; overflow: hidden; }

.dash-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 380px;
    overflow-y: auto;
}

.dash-list::-webkit-scrollbar { width: 4px; }
.dash-list::-webkit-scrollbar-track { background: transparent; }
.dash-list::-webkit-scrollbar-thumb { background: var(--dash-border-strong); border-radius: 2px; }

.dash-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(6,13,26,0.45);
    border: 1px solid var(--dash-border);
    border-radius: 10px;
    font-size: 0.85rem;
    transition: border-color 0.08s;
}

.dash-list-item:hover { border-color: var(--dash-border-strong); }

.dash-list-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dash-list-item-title { font-weight: 600; color: var(--dash-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-list-item-meta { font-size: 0.75rem; color: var(--dash-text-muted); }

.dash-list-item-right { text-align: right; display: flex; flex-direction: column; gap: 2px; align-items: flex-end; flex-shrink: 0; }

.dash-empty-mini {
    padding: 24px;
    text-align: center;
    color: var(--dash-text-muted);
    font-size: 0.84rem;
}

/* ===== ACTIVIDAD (GRÁFICAS EJECUTIVAS) ===== */

.dash-executive-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--dash-gap);
}

.dash-executive-grid .dash-card--2-3 {
    grid-column: span 2;
}

.dash-executive-grid .dash-card--1-3,
.dash-executive-grid .dash-card--1-2 {
    grid-column: span 1;
}

.dash-executive-grid .dash-card--full {
    grid-column: 1 / -1;
}

.dash-card-sub {
    display: block;
    font-size: 0.75rem;
    color: var(--dash-text-muted);
    font-weight: 400;
    margin-top: 2px;
}

.dash-activity-feed-wrapper {
    margin-top: var(--dash-gap);
}

.dash-card--2-3 .dash-feed--compact {
    max-height: 340px;
    min-height: 240px;
    overflow-y: auto;
}

.dash-feed {
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 840px;
}

.dash-feed--compact {
    max-height: calc(100vh - 260px);
    min-height: 420px;
    overflow-y: auto;
    padding-right: 6px;
}

.dash-feed--compact::-webkit-scrollbar { width: 4px; }
.dash-feed--compact::-webkit-scrollbar-track { background: transparent; }
.dash-feed--compact::-webkit-scrollbar-thumb { background: var(--dash-border-strong); border-radius: 2px; }

.dash-chart--compact {
    height: 140px;
}

.dash-feed-day {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.dash-feed-day-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--dash-text-muted);
    padding-left: 4px;
    margin-bottom: 2px;
}

.dash-feed-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 16px;
    background: var(--dash-panel);
    border: 1px solid var(--dash-border);
    border-radius: 12px;
    transition: border-color 0.08s, transform 0.08s;
    backdrop-filter: blur(8px);
}

.dash-feed-item:hover { border-color: var(--dash-border-strong); transform: translateX(2px); }

.dash-feed-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--dash-accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex: 0 0 36px;
}

.dash-feed-item[data-tipo="abono"] .dash-feed-icon { background: var(--dash-green-soft); }
.dash-feed-item[data-tipo="contrato_creado"] .dash-feed-icon { background: var(--dash-purple-soft); }
.dash-feed-item[data-tipo="proyecto_creado"] .dash-feed-icon { background: var(--dash-accent-soft); }
.dash-feed-item[data-tipo="cliente_creado"] .dash-feed-icon { background: rgba(245, 158, 11, 0.14); }

.dash-feed-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-feed-desc { font-size: 0.88rem; color: var(--dash-text); }
.dash-feed-meta { font-size: 0.75rem; color: var(--dash-text-muted); }

.dash-feed-right { text-align: right; font-size: 0.85rem; color: var(--dash-text-dim); font-weight: 700; }

/* ===== INVENTARIO CARDS ===== */

.inv-grid,
.dash-inventory-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.inv-card {
    background: var(--dash-panel);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    padding: 18px 20px;
    box-shadow: var(--dash-shadow);
    backdrop-filter: blur(10px);
    display: grid;
    grid-template-columns: 340px 1fr auto;
    grid-template-rows: auto auto auto;
    column-gap: 36px;
    row-gap: 10px;
    align-items: center;
    transition: transform 0.09s ease, border-color 0.09s ease, box-shadow 0.09s ease;
    position: relative;
}

.inv-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.025) 0%, transparent 55%);
    pointer-events: none;
    border-radius: var(--dash-radius);
}

.inv-card:hover {
    transform: translateY(-2px);
    border-color: rgba(59,130,246,0.35);
    box-shadow: var(--dash-shadow-glow);
}

.inv-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    grid-column: 1;
    grid-row: 1 / 4;
    align-self: center;
}

.inv-card-thumb {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
    flex: 0 0 52px;
    border: 1px solid var(--dash-border);
    background: var(--dash-panel-2);
}

.inv-card-thumb--empty {
    background: linear-gradient(135deg, rgba(59,130,246,0.12), rgba(99,102,241,0.08));
}

.inv-card-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.inv-card-edit-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 6px;
    border-radius: 6px;
    opacity: 0.5;
    transition: opacity 0.08s, background 0.08s;
    align-self: flex-start;
    line-height: 1;
}

.inv-card:hover .inv-card-edit-btn,
.inv-card-edit-btn:focus {
    opacity: 1;
}

.inv-card-edit-btn:hover {
    background: rgba(255,255,255,0.08);
    opacity: 1;
}

.inv-card-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dash-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.inv-card-loc {
    font-size: 0.75rem;
    color: var(--dash-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badge de moneda del proyecto (informativo, no clickeable) */
.inv-card-moneda-badge {
    flex-shrink: 0;
    align-self: flex-start;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--dash-text-muted);
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.18);
    white-space: nowrap;
    user-select: none;
    margin-top: 2px;
}
html[data-theme="light"] .inv-card-moneda-badge {
    color: #64748b;
    background: rgba(100, 116, 139, 0.08);
    border-color: rgba(100, 116, 139, 0.18);
}

/* Marca de cambios sin guardar en la calculadora (sobrevivientes a cierre anormal) */
.inv-card--pending { border-color: rgba(245, 158, 11, 0.55); }
.inv-card-pending-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    align-self: flex-start;
    margin-top: 3px;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.4);
    white-space: nowrap;
    text-decoration: none;
}
.inv-card-pending-badge:hover { background: rgba(245, 158, 11, 0.24); }
.inv-card-pending-badge svg { width: 12px; height: 12px; flex-shrink: 0; }
html[data-theme="light"] .inv-card-pending-badge { color: #b45309; }

.inv-card-progress {
    display: flex;
    flex-direction: column;
    gap: 5px;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    width: 100%;
    align-self: center;
}

.inv-card-progress-bar {
    width: 100%;
    height: 5px;
    background: rgba(148,163,184,0.12);
    border-radius: 3px;
    overflow: hidden;
    min-width: 50px;
}

.inv-card-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--dash-accent), var(--dash-green));
    border-radius: 3px;
    transition: width 0.25s ease;
    min-width: 2px;
}

.inv-card-pct {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--dash-text-dim);
    text-align: right;
}

.inv-card-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    grid-column: 2;
    grid-row: 3;
    align-self: center;
}

.inv-card-stats {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 20px;
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    width: 100%;
}

.inv-card-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.inv-card-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--dash-text-muted);
    white-space: nowrap;
}

.inv-card-stat-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--dash-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.inv-card-actions {
    display: flex;
    gap: 6px;
    border-top: none;
    padding-top: 0;
    flex-wrap: nowrap;
    align-items: stretch;
    grid-column: 3;
    grid-row: 1 / 4;
    align-self: center;
    width: 340px;
}

.inv-action-subgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 6px;
    flex: 1;
}

.inv-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 6px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--dash-border);
    color: var(--dash-text-dim);
    text-decoration: none;
    transition: background 0.08s, border-color 0.08s, color 0.08s, transform 0.05s;
    white-space: nowrap;
    min-width: 0;
}

.inv-action:hover {
    background: var(--dash-accent-soft);
    border-color: rgba(59,130,246,0.4);
    color: var(--dash-text);
    transform: translateY(-1px);
}

.inv-action--mapa {
    flex-direction: column;
    gap: 4px;
    flex: 0 0 72px;
    align-items: center;
    justify-content: center;
}

.inv-action--mapa .inv-action-icon { font-size: 1.3rem; }
.inv-action--mapa .inv-action-label { font-size: 0.74rem; }

.inv-action--dashboard {
    flex-direction: column;
    gap: 4px;
    flex: 0 0 72px;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(22, 163, 74, 0.1) 100%);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #22c55e;
    font-weight: 600;
}
.inv-action--dashboard:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.25) 0%, rgba(22, 163, 74, 0.2) 100%);
    border-color: rgba(34, 197, 94, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
}
.inv-action--dashboard .inv-action-icon { font-size: 1.3rem; }
.inv-action--dashboard .inv-action-label { font-size: 0.74rem; }

.inv-action-icon { font-size: 0.8rem; line-height: 1; flex-shrink: 0; }

.inv-action--disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.inv-action-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

/* ===== ABONOS TABLE ===== */

.dash-card--full { grid-column: 1 / -1; }

.dash-list--abonos { max-height: none; overflow: visible; padding-bottom: 0; }
.dash-card--full:has(#cob-abonos) { padding-bottom: 20px; overflow: visible; }

.abono-row {
    display: grid;
    grid-template-columns: 160px 1fr 1fr 80px 90px 90px 110px 110px 120px;
    gap: 0 12px;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.83rem;
    color: var(--dash-text);
}

.abono-row--header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--dash-text-muted);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--dash-border);
    margin-bottom: 4px;
    border-radius: 0;
}

.abono-row:not(.abono-row--header):nth-child(even) {
    background: rgba(255,255,255,0.025);
}

.abono-row:not(.abono-row--header):hover {
    background: var(--dash-accent-soft);
}

.abono-folio { font-weight: 600; color: var(--dash-text-dim); font-size: 0.78rem; }
.abono-cliente { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.abono-proyecto { color: var(--dash-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.abono-lote { color: var(--dash-text-muted); text-align: center; }
.abono-fecha { color: var(--dash-text-dim); font-variant-numeric: tabular-nums; }
.abono-metodo { color: var(--dash-text-dim); }
.abono-monto { text-align: right; font-weight: 700; }
.abono-acciones { display: flex; justify-content: center; align-items: center; }

.abono-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--dash-accent-soft);
    border: 1px solid rgba(59,130,246,0.3);
    color: #93c5fd;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.08s, border-color 0.08s, color 0.08s;
}

.abono-btn:hover {
    background: rgba(59,130,246,0.2);
    border-color: rgba(59,130,246,0.5);
    color: #bfdbfe;
}
.abono-col--right { text-align: right; }

/* ===== EMPTY ===== */

.dash-empty {
    padding: 64px 20px;
    text-align: center;
    color: var(--dash-text-dim);
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

/* ===== RESPONSIVE ===== */

/* Tablet: ajustar columnas para que quepan sin overflow */
@media (max-width: 1100px) and (min-width: 769px) {
    .inv-card {
        grid-template-columns: 280px 1fr 340px;
        column-gap: 24px;
        padding: 16px;
    }
}

@media (max-width: 768px) {
    .dash-header {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 10px;
        position: relative;
    }
    .dash-header-title { display: none; }
    .dash-header-divider { display: none; }
    .dash-header-nav { display: none; }
    .dash-tipo-cambio { display: none; }
    .dash-user-bar { border-left: none; padding-left: 0; }

    .dash-welcome { padding: 16px; }
    .dash-welcome-text h2 { font-size: 1.05rem; }

    .dash-main { padding: 12px 10px; overflow-x: hidden; }

    .dash-kpis {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .dash-kpi { padding: 14px 12px; gap: 10px; }
    .dash-kpi-icon { width: 40px; height: 40px; flex: 0 0 40px; font-size: 1.4rem; }
    .dash-kpi-value { font-size: 1.2rem; }

    /* Móvil: card vertical, máximo espacio */
    .inv-card {
        display: flex !important;
        flex-direction: column;
        grid-template-columns: none;
        grid-template-rows: none;
        gap: 12px;
        padding: 14px;
        width: 100%;
        box-sizing: border-box;
    }
    .inv-card > * { width: 100%; }
    .inv-card-header {
        grid-column: unset;
        grid-row: unset;
        gap: 14px;
    }
    .inv-card-thumb {
        width: 60px !important;
        height: 60px;
        flex: 0 0 60px;
    }
    .inv-card-name { font-size: 1rem; }
    .inv-card-loc { font-size: 0.78rem; white-space: normal; }
    .inv-card-header { order: 1; }
    .inv-card-progress { grid-column: unset; grid-row: unset; min-width: unset; order: 2; }
    .inv-card-pills {
        order: 3;
        grid-column: unset;
        grid-row: unset;
        justify-content: space-between;
    }
    .inv-card-pills .dash-lot-pill { flex: 1; text-align: center; }
    .inv-card-stats { order: 4; }
    .inv-card-actions { order: 5; }
    .inv-card-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-column: unset;
        grid-row: unset;
        padding: 12px;
        background: rgba(6,13,26,0.4);
        border: 1px solid var(--dash-border);
        border-radius: 10px;
        gap: 12px 16px;
    }
    .inv-card-stat-value { font-size: 0.92rem; }
    .inv-card-actions {
        border-top: 1px solid var(--dash-border);
        padding-top: 12px;
        width: 100%;
        grid-column: unset;
        grid-row: unset;
        box-sizing: border-box;
    }
    .inv-card-actions .inv-action--mapa {
        flex: 0 0 80px;
    }
    .inv-card-actions .inv-action--dashboard {
        flex: 0 0 80px;
    }
    .inv-card-actions .inv-action-subgrid {
        flex: 1;
    }

    .dash-cobranza-grid { grid-template-columns: 1fr; }
    .dash-cobranza-grid .dash-card:first-child { grid-column: auto; }

    .dash-executive-grid { grid-template-columns: 1fr; }
    .dash-executive-grid .dash-card--2-3,
    .dash-executive-grid .dash-card--1-3,
    .dash-executive-grid .dash-card--full { grid-column: auto; }
    .dash-feed--compact { max-height: none; }
    .dash-card { min-width: 0; }
    .dash-list--abonos { overflow: visible; }
    .dash-chart { min-height: 160px; }

    /* Abonos móvil: mini-card horizontal */
    .abono-row--header { display: none !important; }
    .abono-row {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
        column-gap: 16px;
        row-gap: 3px;
        padding: 14px 14px;
        background: rgba(255,255,255,0.03);
        border: 1px solid var(--dash-border);
        border-radius: 10px;
        margin-bottom: 8px;
        align-items: start;
    }
    .abono-row:last-child { margin-bottom: 0; }
    /* Col izq fila 1 */
    .abono-cliente {
        grid-column: 1; grid-row: 1;
        font-size: 0.82rem; font-weight: 700;
        white-space: normal;
        overflow: visible;
        color: var(--dash-text);
        line-height: 1.3;
    }
    /* Col der fila 1: monto */
    .abono-monto {
        grid-column: 2; grid-row: 1;
        text-align: right; font-size: 0.92rem; font-weight: 700;
        color: var(--dash-text);
        white-space: nowrap;
    }
    /* Fila 2: proyecto · lote */
    .abono-proyecto {
        grid-column: 1; grid-row: 2;
        font-size: 0.74rem; color: var(--dash-text-dim);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .abono-lote {
        display: none;
    }
    /* Fila 3: folio · fecha · método */
    .abono-folio {
        grid-column: 1; grid-row: 3;
        font-size: 0.72rem; color: var(--dash-text-muted);
    }
    .abono-fecha { display: none; }
    .abono-metodo { display: none; }
    /* Acción: col der fila 2 */
    .abono-acciones {
        grid-column: 2; grid-row: 2 / 4;
        align-items: flex-start; justify-content: flex-end;
        display: flex;
        padding-top: 8px;
    }
    .abono-btn { font-size: 0.72rem; padding: 5px 10px; }

    .dash-header-link { padding: 6px 10px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
    .dash-kpis {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto auto auto auto;
        gap: 10px;
    }
    /* Fila 1: Inventario (ancho completo) */
    .dash-kpi[data-kpi="inventario"] { grid-column: 1 / 3; grid-row: 1; }
    /* Fila 2: Lotes (ancho completo) */
    .dash-kpi[data-kpi="lotes"] { grid-column: 1 / 3; grid-row: 2; }
    /* Cuadrícula 2x2: Proyectos, Ingresos, Vencida, Clientes */
    .dash-kpi[data-kpi="proyectos"] { grid-column: 1; grid-row: 3; }
    .dash-kpi[data-kpi="ingresos"] { grid-column: 2; grid-row: 3; }
    .dash-kpi[data-kpi="vencida"] { grid-column: 1; grid-row: 4; }
    .dash-kpi[data-kpi="clientes"] { grid-column: 2; grid-row: 4; }
    .dash-kpi { padding: 12px 10px; }
    .dash-kpi-value { font-size: 1.1rem; }
}

/* ── Shared App Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.1s;
}

.modal-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 28px 32px;
    min-width: 320px;
    max-width: 90vw;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: slideUp 0.11s cubic-bezier(.22, 1, .36, 1);
    position: relative;
}

.modal-card h3 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.3px;
}

.app-info-modal-card {
    max-width: min(92vw, 420px);
}

.app-modal-message {
    margin: 2px 0 0;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    align-items: stretch;
}

.modal-btn-guardar,
.modal-btn-cancelar,
.modal-btn-eliminar,
.modal-btn-editar,
.modal-btn-dev {
    border: none;
    padding: 11px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    font-family: inherit;
}

.modal-btn-guardar {
    flex: 1;
    background: linear-gradient(135deg, #34d399, #10b981);
    color: #ffffff;
}

.modal-btn-eliminar {
    flex: 1;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
}

.modal-btn-editar {
    flex: 1;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
}

.modal-btn-dev {
    flex: 1;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1a1000;
}

.modal-btn-cancelar {
    flex: 0 0 46px;
    width: 46px;
    min-width: 46px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.08);
    color: #e8e8f0;
}

.modal-btn-guardar:hover,
.modal-btn-cancelar:hover,
.modal-btn-eliminar:hover,
.modal-btn-editar:hover,
.modal-btn-dev:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.app-confirm-modal .modal-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.app-confirm-modal .modal-btn-cancelar {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    padding: 11px 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #f1f2f8;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.app-confirm-modal .modal-btn-guardar {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    background: linear-gradient(135deg, #d5534f, #9f2622);
    color: #fff;
    border: 1px solid rgba(255, 176, 176, 0.28);
}

.app-confirm-modal .app-modal-confirm { order: 1; }
.app-confirm-modal .app-modal-cancel { order: 2; }

/* ── Project Edit Modal ── */
.app-project-edit-card {
    width: 100%;
    max-width: min(92vw, 560px);
    min-width: 0;
    max-height: min(92vh, 640px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 20px;
    border-radius: 12px;
}

@keyframes appProjectEditSlideDown {
    from { opacity: 0; transform: translateY(calc(-100% - 16px)); }
    to { opacity: 1; transform: translateY(0); }
}

.app-project-edit-modal .app-project-edit-card {
    animation: appProjectEditSlideDown 0.16s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (min-width: 769px) {
    .app-project-edit-modal .app-project-edit-card {
        animation: appProjectEditSlideDown 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
    }
}

@keyframes appProjectEditSlideUpExit {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(calc(-100% - 16px)); }
}

@keyframes appProjectEditSlideToRightExit {
    from { opacity: 1; transform: translate3d(0, 0, 0); }
    to { opacity: 0; transform: translate3d(calc(100% + 28px), 0, 0); }
}

.app-project-edit-modal .app-project-edit-card.app-project-edit-exit--mobile {
    animation: appProjectEditSlideUpExit 0.15s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.app-project-edit-modal .app-project-edit-card.app-project-edit-exit--desktop {
    animation: appProjectEditSlideToRightExit 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-project-edit-modal.app-project-edit-modal--closing {
    pointer-events: none;
}

@media (min-width: 769px) {
    .app-project-edit-card {
        width: min(560px, 80vw);
        max-width: none;
        max-height: min(90vh, 640px);
        padding: 24px;
    }
}

.app-project-edit-close {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #f2f2f8;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    z-index: 1;
}

.app-project-edit-close:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.app-project-edit-title {
    padding-right: 36px;
}

.app-project-edit-modal.modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 16px;
}

@media (min-width: 769px) {
    .app-project-edit-modal.modal-overlay {
        align-items: center;
        justify-content: center;
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .app-project-edit-modal.modal-overlay {
        padding: 8px;
        align-items: flex-start;
    }

    .app-project-edit-card {
        max-width: 100%;
        max-height: 95vh;
        padding: 16px;
    }

    .app-project-edit-top {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .app-project-edit-photo-dropzone {
        min-height: 100px;
        max-height: 140px;
    }

    .app-project-edit-fields textarea {
        min-height: 80px;
        max-height: 150px;
    }

    .app-project-edit-fields {
        gap: 6px;
    }
}


.app-project-edit-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.app-project-edit-top {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 16px;
    align-items: stretch;
}
.app-project-edit-col--photo,
.app-project-edit-photo-block {
    height: 100%;
}

@media (max-width: 480px) {
    .app-project-edit-top {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.app-project-edit-col {
    min-width: 0;
}

.app-project-edit-fields {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.app-project-edit-fields label {
    font-size: 12px;
    font-weight: 600;
    color: #a0a0c0;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.app-project-edit-fields input,
.app-project-edit-fields textarea,
.app-project-edit-fields select {
    width: 100%;
    min-width: 0;
    background: #2a2a3e;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e8e8f0;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}

.app-project-edit-fields textarea {
    resize: vertical;
    min-height: 80px;
    max-height: 120px;
    overflow-wrap: break-word;
}

.app-project-edit-fields input:focus,
.app-project-edit-fields textarea:focus,
.app-project-edit-fields select:focus {
    border-color: #c0872a;
}

/* Layout a 2 columnas del modal de edición (owner/desarrollador) */
@media (min-width: 769px) {
    .app-project-edit-card--wide {
        width: min(880px, 92vw) !important;
        max-width: none !important;
    }
    .app-project-edit-body--2col {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr);
        gap: 20px;
        align-items: start;
    }
}
.app-project-edit-main {
    display: grid;
    gap: 12px;
    min-width: 0;
}

/* Comisión de brokers (por proyecto) dentro del modal de edición */
.app-project-edit-comision {
    margin-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
}
/* Como columna lateral: panel con borde propio en vez de separador superior */
.app-project-edit-side {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}
@media (min-width: 769px) {
    .app-project-edit-side {
        border-left: 1px solid rgba(255, 255, 255, 0.08);
        padding-left: 20px;
        height: 100%;
    }
}
/* Comisión + anticipo comparten renglón; selects/inputs largos ocupan el ancho. */
.app-project-edit-comision-full {
    grid-column: 1 / -1;
}
.app-project-edit-comision-head {
    font-size: 12px;
    font-weight: 600;
    color: #a0a0c0;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.app-project-edit-opt {
    text-transform: none;
    letter-spacing: 0;
    color: #6b7280;
    font-weight: 500;
}
.app-project-edit-comision-note {
    font-size: 12px;
    color: #8888a8;
    margin: 2px 0 6px;
}
.app-project-edit-comision-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.app-project-edit-comision-grid > div {
    display: grid;
    gap: 4px;
    min-width: 0;
}
@media (max-width: 560px) {
    .app-project-edit-comision-grid { grid-template-columns: 1fr; }
}

.app-project-edit-geo-wrap {
    position: relative;
    z-index: 2;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.app-project-edit-geo-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    margin: 0;
    padding: 4px 0;
    list-style: none;
    max-height: 220px;
    overflow-y: auto;
    background: #1a2235;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    z-index: 10;
}

.app-project-edit-geo-suggestions.app-project-edit-geo-suggestions--docked {
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
}

.app-project-edit-geo-item {
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.35;
    color: #e8e8f0;
    cursor: pointer;
    transition: background 0.12s ease;
    overflow-wrap: anywhere;
}

.app-project-edit-geo-item:hover,
.app-project-edit-geo-item:focus {
    background: rgba(59, 130, 246, 0.25);
    outline: none;
}

.app-project-edit-photo-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.app-project-edit-photo-dropzone {
    width: 100%;
    min-height: 140px;
    max-height: 180px;
    border-radius: 8px;
}

.app-project-edit-photo-label {
    font-size: 12px;
    font-weight: 600;
    color: #a0a0c0;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.app-project-edit-foto-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-project-edit-photo-dropzone {
    position: relative;
    width: 100%;
    min-height: 190px;
    max-height: 240px;
    height: 100%;
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.28);
    background: rgba(0, 0, 0, 0.22);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.app-project-edit-photo-dropzone:hover {
    border-color: rgba(245, 211, 122, 0.45);
    background: rgba(0, 0, 0, 0.28);
}

.app-project-edit-photo-dropzone:focus-visible {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.55);
    border-color: rgba(96, 165, 250, 0.65);
}

.app-project-edit-photo-dropzone.is-dragover {
    border-color: rgba(59, 130, 246, 0.85);
    background: rgba(59, 130, 246, 0.14);
    border-style: solid;
}

.app-project-edit-photo-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px;
    text-align: center;
    pointer-events: none;
}

.app-project-edit-photo-drop-icon {
    font-size: 1.75rem;
    line-height: 1;
    opacity: 0.75;
}

.app-project-edit-photo-drop-title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #e0e0f0;
}

.app-project-edit-photo-drop-hint {
    margin: 0;
    font-size: 11px;
    color: #8a8aac;
}

.app-project-edit-photo-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.app-project-edit-photo-dropzone:not(.has-image) .app-project-edit-photo-preview { display: none; }
.app-project-edit-photo-dropzone:not(.has-image) .app-project-edit-photo-overlay-hint { display: none; }

.app-project-edit-photo-overlay-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: #f8fafc;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.app-project-edit-photo-dropzone.has-image:hover .app-project-edit-photo-overlay-hint,
.app-project-edit-photo-dropzone.has-image:focus-visible .app-project-edit-photo-overlay-hint {
    opacity: 1;
}

.app-project-edit-msg {
    margin-top: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    font-size: 13px;
    line-height: 1.4;
}

.app-project-edit-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    margin-top: 14px;
}

/* La acción principal (Actualizar KML / Ver lotes) va a la izquierda; guardar/eliminar
   compactos a la derecha. */
.app-project-edit-actions .modal-btn-editar,
.app-project-edit-actions .modal-btn-dev {
    flex: 0 0 auto;
    margin-right: auto;
    min-width: 0;
    padding: 10px 16px;
    font-size: 13px;
    white-space: nowrap;
}

.app-project-edit-actions .modal-btn-guardar,
.app-project-edit-actions .modal-btn-eliminar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .app-project-edit-actions {
        gap: 6px;
    }
    .app-project-edit-actions .modal-btn-editar,
    .app-project-edit-actions .modal-btn-dev {
        padding: 10px 12px;
        font-size: 12px;
    }
}

.app-project-edit-btn-inner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Light theme overrides for project edit modal */
html[data-theme="light"] .app-project-edit-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
html[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.4);
}
html[data-theme="light"] .modal-card {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] .modal-card h3 {
    color: #1a1a1a;
}
html[data-theme="light"] .app-modal-message {
    color: #4b5563;
}
html[data-theme="light"] .modal-btn-cancelar {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
    color: #4b5563;
}
html[data-theme="light"] .modal-btn-cancelar:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
}
html[data-theme="light"] .app-confirm-modal .modal-btn-cancelar {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] .modal-btn-guardar {
    background: linear-gradient(135deg, #34d399, #10b981);
    color: #ffffff;
}
html[data-theme="light"] .modal-btn-eliminar {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
}
html[data-theme="light"] .modal-btn-editar {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
}
html[data-theme="light"] .modal-btn-dev {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1a1a1a;
}
html[data-theme="light"] .app-file-upload-area {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.1);
}
html[data-theme="light"] .app-file-upload-area:hover {
    background: rgba(59, 130, 246, 0.04);
    border-color: rgba(59, 130, 246, 0.3);
}

