/* ==========================================
   Portal Fundaciones Rompoda — CSS v2.0
   Idéntico al módulo Rompoda Picking
   ========================================== */

/* --- VARIABLES --- */
:root {
    --rp-primary: #2563EB;
    --rp-primary-dark: #1D4ED8;
    --rp-primary-light: #60A5FA;
    --rp-primary-soft: #DBEAFE;
    --rp-primary-bg: #EFF6FF;
    --rp-secondary: #06B6D4;
    --rp-accent: #f8982e;
    --rp-accent-dark: #e07d10;
    --rp-dark: #0F172A;
    --rp-g700: #334155;
    --rp-g500: #64748B;
    --rp-g400: #94A3B8;
    --rp-g300: #CBD5E1;
    --rp-g200: #E2E8F0;
    --rp-g100: #F1F5F9;
    --rp-g50: #F8FAFC;
    --rp-white: #FFFFFF;
    --rp-success: #10B981;
    --rp-error: #EF4444;
    --rp-warning: #F59E0B;
    --rp-shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
    --rp-shadow-md: 0 4px 6px rgba(15,23,42,.07), 0 2px 4px rgba(15,23,42,.04);
    --rp-shadow-lg: 0 10px 15px rgba(15,23,42,.08), 0 4px 6px rgba(15,23,42,.04);
    --fund-vedruna: #ec0744;
    --fund-fedac: #60b000;
    --fund-fefc: #ab3d56;
    --fund-rompoda: #2563EB;
    --sidebar-width: 260px;
}

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

/* --- BASE --- */
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: 'DM Sans', sans-serif; font-weight: 400; color: var(--rp-g700); background: var(--rp-g50); line-height: 1.6; }
h1, h2, h3, h4, h5 { font-family: 'Montserrat', sans-serif; color: var(--rp-dark); line-height: 1.3; }
h1 { font-size: 36px; font-weight: 800; }
h2 { font-size: 30px; font-weight: 700; }
h3 { font-size: 24px; font-weight: 700; }
h4 { font-size: 20px; font-weight: 600; }
.text-muted { color: var(--rp-g500); font-size: 14px; }
.text-sm { font-size: 14px; }
.text-caption { font-size: 12px; font-weight: 500; }
a { color: var(--rp-primary); text-decoration: none; }
a:hover { color: var(--rp-primary-dark); }

/* ============================================================
   BUTTONS — Idénticos al picking
   ============================================================ */
.rp-btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 0 24px; height: 38px; border: none; border-radius: 8px;
    background: var(--rp-primary); color: #fff;
    font-family: 'Montserrat', sans-serif; font-size: 13px; font-weight: 700;
    cursor: pointer; transition: all .15s; white-space: nowrap; text-decoration: none;
}
.rp-btn-primary:hover {
    background: var(--rp-primary-dark); transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(37,99,235,.25); color: #fff;
}
.rp-btn-primary svg { width: 16px; height: 16px; }

.rp-btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 0 20px; height: 38px; border: 1.5px solid #BFDBFE; border-radius: 8px;
    background: var(--rp-primary-bg); color: var(--rp-primary);
    font-family: 'Montserrat', sans-serif; font-size: 13px; font-weight: 700;
    cursor: pointer; transition: all .15s; white-space: nowrap; text-decoration: none;
}
.rp-btn-secondary:hover {
    background: var(--rp-primary); border-color: var(--rp-primary); color: #fff;
    transform: translateY(-1px); box-shadow: 0 6px 14px rgba(37,99,235,.18);
}
.rp-btn-secondary svg { width: 16px; height: 16px; }

.rp-btn-danger {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 0 20px; height: 38px; border: 1.5px solid #FECACA; border-radius: 8px;
    background: #FEF2F2; color: #DC2626;
    font-family: 'Montserrat', sans-serif; font-size: 13px; font-weight: 700;
    cursor: pointer; transition: all .15s; white-space: nowrap; text-decoration: none;
}
.rp-btn-danger:hover { background: #DC2626; border-color: #DC2626; color: #fff; box-shadow: 0 6px 14px rgba(220,38,38,.25); }
.rp-btn-danger svg { width: 16px; height: 16px; }

.rp-btn-accent {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 0 24px; height: 38px; border: none; border-radius: 8px;
    background: var(--rp-accent); color: #fff;
    font-family: 'Montserrat', sans-serif; font-size: 13px; font-weight: 700;
    cursor: pointer; transition: all .15s; white-space: nowrap; text-decoration: none;
}
.rp-btn-accent:hover { background: var(--rp-accent-dark); transform: translateY(-1px); box-shadow: 0 6px 14px rgba(248,152,46,.25); }

.rp-btn-sm { height: 32px; padding: 0 14px; font-size: 12px; }

/* Legacy aliases */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 20px; height: 38px; border: none; border-radius: 8px; font-family: 'Montserrat', sans-serif; font-size: 13px; font-weight: 700; cursor: pointer; transition: all .15s; white-space: nowrap; text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--rp-primary); color: #fff; }
.btn-primary:hover { background: var(--rp-primary-dark); transform: translateY(-1px); box-shadow: 0 6px 14px rgba(37,99,235,.25); color: #fff; }
.btn-secondary { background: var(--rp-primary-bg); color: var(--rp-primary); border: 1.5px solid #BFDBFE; }
.btn-secondary:hover { background: var(--rp-primary); border-color: var(--rp-primary); color: #fff; transform: translateY(-1px); }
.btn-accent { background: var(--rp-accent); color: #fff; }
.btn-accent:hover { background: var(--rp-accent-dark); }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 12px; }

/* ============================================================
   INPUTS — Idénticos al picking
   ============================================================ */
.rp-input {
    padding: 8px 12px; border: 1.5px solid var(--rp-g300); border-radius: 8px;
    font-size: 13px; color: var(--rp-dark); height: 38px; font-family: 'DM Sans', sans-serif;
}
.rp-input:focus { outline: none; border-color: var(--rp-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.rp-flabel {
    font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 700;
    color: var(--rp-g700); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; display: block;
}

.form-group { margin-bottom: 16px; }
.form-group label {
    font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 700;
    color: var(--rp-g700); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; display: block;
}

.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper svg { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--rp-g400); pointer-events: none; }
.input-wrapper input {
    width: 100%; padding: 8px 12px 8px 42px; font-family: 'DM Sans', sans-serif; font-size: 13px;
    color: var(--rp-dark); background: var(--rp-white); border: 1.5px solid var(--rp-g300); border-radius: 8px; outline: none; height: 38px;
}
.input-wrapper input:focus { border-color: var(--rp-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.input-wrapper input::placeholder { color: var(--rp-g400); }

.input-select {
    padding: 8px 12px; font-family: 'DM Sans', sans-serif; font-size: 13px;
    border: 1.5px solid var(--rp-g300); border-radius: 8px; color: var(--rp-dark); background: var(--rp-white); outline: none; height: 38px;
}
.input-select:focus { border-color: var(--rp-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.input-sm {
    padding: 6px 8px; font-size: 12px; border: 1.5px solid var(--rp-g300); border-radius: 8px;
    color: var(--rp-dark); font-family: 'DM Sans', sans-serif; outline: none; width: 100px; height: 32px;
}
.input-sm:focus { border-color: var(--rp-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.input-textarea {
    width: 100%; padding: 8px 12px; font-family: 'DM Sans', sans-serif; font-size: 13px;
    border: 1.5px solid var(--rp-g300); border-radius: 8px; color: var(--rp-dark); resize: vertical; outline: none;
}
.input-textarea:focus { border-color: var(--rp-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* ============================================================
   ALERTS — Idénticas al picking
   ============================================================ */
.rp-alert { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px; margin-bottom: 12px; font-size: 12px; font-weight: 500; border: 1px solid; }
.rp-alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.rp-alert-info    { background: #EFF6FF; border-color: #93C5FD; color: #1D4ED8; }
.rp-alert-success { background: #ECFDF5; border-color: #6EE7B7; color: #059669; }
.rp-alert-warning { background: #FFF7ED; border-color: #FDBA74; color: #C2410C; }
.rp-alert-error   { background: #FEF2F2; border-color: #FCA5A5; color: #DC2626; }

/* Legacy */
.alert { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 10px; margin-bottom: 12px; font-size: 12px; font-weight: 500; border: 1px solid; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-error { background: #FEF2F2; border-color: #FCA5A5; color: #DC2626; }

/* ============================================================
   BADGES — Idénticos al picking
   ============================================================ */
.rp-badge {
    display: inline-block; padding: 2px 8px; border-radius: 5px;
    font-size: 9px; font-weight: 800; letter-spacing: .3px;
    text-transform: uppercase; white-space: nowrap; line-height: 16px;
}
.rp-badge-primary  { border: 1.5px solid rgba(37,99,235,.3);  background: rgba(37,99,235,.1);  color: #2563EB; }
.rp-badge-success  { border: 1.5px solid rgba(16,185,129,.3); background: rgba(16,185,129,.1); color: #059669; }
.rp-badge-warning  { border: 1.5px solid rgba(245,158,11,.3); background: rgba(245,158,11,.1); color: #D97706; }
.rp-badge-error    { border: 1.5px solid rgba(239,68,68,.3);  background: rgba(239,68,68,.1);  color: #DC2626; }
.rp-badge-neutral  { border: 1.5px solid var(--rp-g200);      background: var(--rp-g100);      color: var(--rp-g500); }
.rp-badge-cyan     { border: 1.5px solid rgba(14,165,233,.3); background: rgba(14,165,233,.1); color: #0284C7; }

/* Legacy badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: 9px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; white-space: nowrap; line-height: 16px; }
.badge-primary  { border: 1.5px solid rgba(37,99,235,.3);  background: rgba(37,99,235,.1);  color: #2563EB; }
.badge-success  { border: 1.5px solid rgba(16,185,129,.3); background: rgba(16,185,129,.1); color: #059669; }
.badge-error    { border: 1.5px solid rgba(239,68,68,.3);  background: rgba(239,68,68,.1);  color: #DC2626; }

/* ============================================================
   TABLES — Idénticas al picking
   ============================================================ */
.table-wrapper { overflow-x: auto; }

.rp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rp-table thead th {
    background: var(--rp-g50); padding: 9px 7px;
    font-family: 'Montserrat', sans-serif; font-size: 10px; font-weight: 700;
    color: var(--rp-g500); text-transform: uppercase; letter-spacing: .6px;
    border-bottom: 1px solid var(--rp-g200); white-space: nowrap; text-align: left;
}
.rp-table tbody td {
    padding: 8px 7px; color: #1E293B; vertical-align: middle; font-size: 12px;
    max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rp-table tbody tr { border-bottom: 1px solid var(--rp-g100); transition: background .12s; }
.rp-table tbody tr:nth-child(even) { background: #FAFAFA; }
.rp-table tbody tr:hover { background: var(--rp-primary-bg); }
.rp-table tbody tr.sel { background: var(--rp-primary-soft) !important; }
.rp-table .b { font-weight: 700; }
.rp-table .m { color: var(--rp-g400); }
.rp-table tfoot td { font-weight: 700; border-top: 2px solid var(--rp-g300); padding: 10px 7px; }

/* Legacy table styles */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead th {
    background: var(--rp-g50); padding: 9px 7px;
    font-family: 'Montserrat', sans-serif; font-size: 10px; font-weight: 700;
    color: var(--rp-g500); text-transform: uppercase; letter-spacing: .6px;
    border-bottom: 1px solid var(--rp-g200); white-space: nowrap; text-align: left;
}
tbody td { padding: 8px 7px; color: #1E293B; vertical-align: middle; font-size: 12px; }
tbody tr { border-bottom: 1px solid var(--rp-g100); transition: background .12s; }
tbody tr:nth-child(even) { background: #FAFAFA; }
tbody tr:hover { background: var(--rp-primary-bg); }
tfoot td { font-weight: 700; border-top: 2px solid var(--rp-g300); padding: 10px 7px; }

/* Sort arrows */
.rp-sortable { cursor: pointer; user-select: none; }
.rp-sort-icon { width: 13px; height: 13px; vertical-align: -2px; margin-left: 2px; }

/* ============================================================
   PANELS / CARDS — Idénticos al picking
   ============================================================ */
.rp-pn { background: #fff; border: 1px solid var(--rp-g200); border-radius: 12px; overflow: hidden; margin-bottom: 16px; }
.rp-pnh { padding: 12px 16px; border-bottom: 1px solid var(--rp-g200); font-family: 'Montserrat', sans-serif; font-size: 13px; font-weight: 700; color: var(--rp-dark); display: flex; align-items: center; gap: 8px; }
.rp-pnb { padding: 16px; }

.card { background: #fff; border: 1px solid var(--rp-g200); border-radius: 12px; padding: 20px; overflow: hidden; }
.card h4 { margin-bottom: 16px; }

/* ============================================================
   KPI CARDS — Idénticas al picking
   ============================================================ */
.rp-dash-kpi-row { display: grid; gap: 14px; }
.rp-dash-kpi-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.rp-dash-kpi-row.cols-4 { grid-template-columns: repeat(4, 1fr); }
.rp-dash-kpi-row.cols-5 { grid-template-columns: repeat(5, 1fr); }

.rp-dash-kpi {
    background: #fff; border: 1px solid var(--rp-g200); border-radius: 12px;
    padding: 16px 18px; transition: all .15s; display: block; text-decoration: none; color: inherit;
}
.rp-dash-kpi:hover { border-color: var(--rp-primary); box-shadow: 0 4px 12px rgba(15,23,42,.06); transform: translateY(-1px); }

.rp-dash-kpi-icon {
    width: 36px; height: 36px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; margin-bottom: 10px;
}
.rp-dash-kpi-icon svg { width: 18px; height: 18px; }

.rp-dash-kpi-value { font-family: 'Montserrat', sans-serif; font-size: 26px; font-weight: 800; color: var(--rp-dark); line-height: 1.1; }
.rp-dash-kpi-label { font-size: 11px; color: var(--rp-g500); text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; font-weight: 600; }

/* Legacy KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi-card {
    background: #fff; border: 1px solid var(--rp-g200); border-radius: 12px;
    padding: 16px 18px; display: flex; align-items: center; gap: 14px; transition: all .15s;
}
.kpi-card:hover { border-color: var(--rp-primary); box-shadow: 0 4px 12px rgba(15,23,42,.06); transform: translateY(-1px); }
.kpi-icon { width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-content { display: flex; flex-direction: column; }
.kpi-value { font-family: 'Montserrat', sans-serif; font-size: 26px; font-weight: 800; color: var(--rp-dark); line-height: 1.1; }
.kpi-label { font-size: 11px; color: var(--rp-g500); text-transform: uppercase; letter-spacing: .5px; margin-top: 4px; font-weight: 600; }

/* ============================================================
   TABS — Idénticas al picking
   ============================================================ */
.rp-adm-tabs { display: flex; gap: 6px; background: #fff; padding: 6px; border-radius: 14px; border: 1px solid var(--rp-g200); overflow-x: auto; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.rp-adm-tab { padding: 12px 20px; border-radius: 10px; font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 700; color: var(--rp-g500); text-transform: uppercase; letter-spacing: .5px; cursor: pointer; background: transparent; border: none; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; transition: all .15s; white-space: nowrap; }
.rp-adm-tab:hover:not(.active) { background: var(--rp-g100); color: var(--rp-g700); }
.rp-adm-tab.active { background: linear-gradient(135deg, var(--rp-primary), var(--rp-primary-dark)); color: #fff; box-shadow: 0 4px 10px rgba(37,99,235,.25); }
.rp-adm-tab [data-lucide] { width: 14px; height: 14px; }
.rp-adm-tab.active [data-lucide] { color: #fff; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--rp-primary-bg) 0%, var(--rp-g50) 100%); padding: 20px; }
.login-card { width: 100%; max-width: 420px; background: var(--rp-white); border-radius: 16px; box-shadow: 0 20px 60px rgba(15,23,42,.12); padding: 40px; }
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { margin-bottom: 16px; }
.login-logo svg { border-radius: 12px; }
.login-title { font-size: 28px; font-weight: 800; color: var(--rp-primary); margin-bottom: 8px; }
.login-subtitle { color: var(--rp-g500); font-size: 14px; }
.login-footer { text-align: center; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--rp-g200); }
.login-brand { font-family: 'Montserrat', sans-serif; font-weight: 700; color: var(--rp-g400); font-size: 13px; text-transform: uppercase; letter-spacing: 2px; }
.login-form .form-group label { text-transform: none; font-size: 13px; font-weight: 600; letter-spacing: 0; }

/* ============================================================
   APP LAYOUT + SIDEBAR
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width); background: var(--rp-white); border-right: 1px solid var(--rp-g200);
    display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100;
    transition: width .2s ease;
}
/* Estado colapsado */
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .user-info div { display: none; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: 16px 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px 0; }
.sidebar.collapsed .user-info { justify-content: center; }
.sidebar.collapsed .sidebar-footer .nav-item { justify-content: center; }
.sidebar.collapsed + .main-content { margin-left: 64px; }

.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--rp-g200); position: relative; }
.brand-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.brand-icon svg { width: 36px; height: 36px; border-radius: 8px; }
.brand-text { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 14px; color: var(--rp-dark); white-space: nowrap; overflow: hidden; }

/* Botón de colapsar sidebar */
.sidebar-toggle {
    position: absolute; right: -14px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; border-radius: 9999px;
    background: var(--rp-white); border: 1.5px solid var(--rp-g200);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 101; transition: all .15s;
    box-shadow: 0 1px 3px rgba(15,23,42,.08);
}
.sidebar-toggle:hover { border-color: var(--rp-primary); color: var(--rp-primary); background: var(--rp-primary-bg); }
.sidebar-toggle svg { width: 14px; height: 14px; color: var(--rp-g500); transition: transform .2s; }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.sidebar.collapsed .sidebar-toggle { right: -14px; }

.sidebar-nav { flex: 1; padding: 10px 10px; overflow-y: auto; }
.nav-section { font-family: 'Montserrat', sans-serif; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--rp-g400); padding: 14px 12px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--rp-g700); font-size: 13px; font-weight: 500; transition: all .12s; text-decoration: none; }
.nav-item:hover { background: var(--rp-g100); color: var(--rp-primary); }
.nav-item.active { background: var(--rp-primary-soft); color: var(--rp-primary); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; }

.sidebar-footer { padding: 10px; border-top: 1px solid var(--rp-g200); }
.user-info { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 13px; color: var(--rp-g500); }
.user-info svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item.logout { color: var(--rp-error); }
.nav-item.logout:hover { background: #FEF2F2; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content { flex: 1; margin-left: var(--sidebar-width); padding: 28px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-header h1 { font-size: 26px; margin-bottom: 2px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--rp-g500); margin-bottom: 8px; }
.back-link:hover { color: var(--rp-primary); }
.back-link svg { width: 14px; height: 14px; }

/* ============================================================
   DATE FILTER — flatpickr integration
   ============================================================ */
.date-filter { display: flex; align-items: flex-end; gap: 10px; }
.date-filter-group label { font-family: 'Montserrat', sans-serif; font-size: 10px; font-weight: 700; color: var(--rp-g500); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; display: block; }
.date-filter input[type="date"],
.date-filter input[type="month"],
.date-filter input[type="text"] {
    padding: 8px 12px; font-family: 'DM Sans', sans-serif; font-size: 13px;
    border: 1.5px solid var(--rp-g300); border-radius: 8px; color: var(--rp-dark); outline: none; height: 38px; background: #fff;
}
.date-filter input:focus { border-color: var(--rp-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* flatpickr overrides */
.flatpickr-calendar { border-radius: 12px !important; box-shadow: 0 10px 25px rgba(15,23,42,.12) !important; border: 1px solid var(--rp-g200) !important; font-family: 'DM Sans', sans-serif !important; }
.flatpickr-months .flatpickr-month { background: var(--rp-g50) !important; border-radius: 12px 12px 0 0 !important; }
.flatpickr-current-month { font-family: 'Montserrat', sans-serif !important; font-weight: 700 !important; font-size: 14px !important; }
.flatpickr-day { border-radius: 6px !important; font-family: 'DM Sans', sans-serif !important; font-size: 12px !important; }
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange { background: var(--rp-primary) !important; border-color: var(--rp-primary) !important; }
.flatpickr-day.inRange { background: var(--rp-primary-bg) !important; border-color: var(--rp-primary-bg) !important; box-shadow: -5px 0 0 var(--rp-primary-bg), 5px 0 0 var(--rp-primary-bg) !important; }
.flatpickr-day.today:not(.selected) { border-color: var(--rp-primary) !important; }
.flatpickr-day:hover { background: var(--rp-primary-soft) !important; border-color: var(--rp-primary-soft) !important; }
span.flatpickr-weekday { font-family: 'Montserrat', sans-serif !important; font-size: 10px !important; font-weight: 600 !important; color: var(--rp-g400) !important; }
.flatpickr-months .flatpickr-prev-month, .flatpickr-months .flatpickr-next-month { fill: var(--rp-g500) !important; }
.flatpickr-months .flatpickr-prev-month:hover, .flatpickr-months .flatpickr-next-month:hover { fill: var(--rp-primary) !important; }

/* ============================================================
   CHARTS GRID
   ============================================================ */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }

/* ============================================================
   FUND CARDS (admin)
   ============================================================ */
.fund-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.fund-card { display: flex; align-items: center; justify-content: space-between; background: var(--rp-white); border: 1px solid var(--rp-g200); border-radius: 12px; padding: 14px 16px; color: var(--rp-g700); transition: all .15s; text-decoration: none; }
.fund-card:hover { border-color: var(--rp-primary); box-shadow: 0 4px 12px rgba(15,23,42,.06); transform: translateY(-1px); color: var(--rp-primary); }
.fund-name { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 13px; }
.fund-action { font-size: 11px; display: flex; align-items: center; gap: 4px; color: var(--rp-g400); }
.fund-action svg { width: 14px; height: 14px; }

/* ============================================================
   MODALS — Idénticos al picking
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--rp-white); border-radius: 16px; box-shadow: 0 20px 60px rgba(15,23,42,.25); width: 92%; max-width: 620px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--rp-g200); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: 800; margin: 0; }
.modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--rp-g200); background: var(--rp-g50); display: flex; justify-content: flex-end; gap: 10px; border-radius: 0 0 16px 16px; }

.modal input, .modal select, .modal textarea {
    width: 100%; padding: 8px 12px; font-family: 'DM Sans', sans-serif; font-size: 13px;
    border: 1.5px solid var(--rp-g300); border-radius: 8px; color: var(--rp-dark); outline: none; height: 38px;
}
.modal textarea { height: auto; }
.modal input:focus, .modal select:focus, .modal textarea:focus { border-color: var(--rp-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

.btn-icon { background: none; border: none; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--rp-g400); transition: all .12s; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: var(--rp-g100); color: var(--rp-primary); }
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon-danger:hover { background: #FEF2F2; color: var(--rp-error); }
.btn-icon-success:hover { background: rgba(16,185,129,.1); color: var(--rp-success); }
.btn-icon-success.saved { background: rgba(16,185,129,.1); color: var(--rp-success); }

/* ============================================================
   TOGGLE
   ============================================================ */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--rp-g300); border-radius: 9999px; transition: .2s; }
.toggle-slider::before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: var(--rp-white); border-radius: 50%; transition: .2s; }
.toggle input:checked + .toggle-slider { background: var(--rp-success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ============================================================
   CHECKBOX GRID
   ============================================================ */
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-item { display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }
.checkbox-item input[type="checkbox"] { width: auto; height: auto; }
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 9999px; }

/* ============================================================
   FACTOR GRID
   ============================================================ */
.factor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.factor-card { position: relative; }
.factor-range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: var(--rp-g200); border-radius: 3px; outline: none; }
.factor-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--rp-primary); cursor: pointer; }

/* ============================================================
   CALENDAR — Idéntico al picking
   ============================================================ */
.rp-cal { background: #fff; border: 1px solid var(--rp-g200); border-radius: 16px; padding: 20px 24px; box-shadow: 0 1px 3px rgba(15,23,42,.05); user-select: none; }
.cal-header { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.cal-day-name { text-align: center; font-family: 'Montserrat', sans-serif; font-size: 10px; font-weight: 600; color: var(--rp-g400); padding: 8px 0; text-transform: uppercase; }
.cal-body { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-cell { min-height: 80px; background: var(--rp-g50); border-radius: 6px; padding: 4px; display: flex; flex-direction: column; }
.cal-cell:hover { background: var(--rp-primary-bg); box-shadow: inset 0 0 0 1.5px var(--rp-primary); }
.cal-cell.cal-empty { background: transparent; box-shadow: none; pointer-events: none; }
.cal-cell.cal-has-event { background: #FEFCE8; }
.cal-date { font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 600; color: var(--rp-g700); }
.cal-event { margin-top: 3px; padding: 2px 6px; font-size: 9px; font-weight: 700; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================================================
   FILTER CHIPS
   ============================================================ */
.rp-cal-filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; background: #fff; border: 1.5px solid var(--rp-g200); border-radius: 9999px; font-family: 'Montserrat', sans-serif; font-size: 11px; font-weight: 600; color: var(--rp-g700); cursor: pointer; transition: all .12s; opacity: .45; }
.rp-cal-filter-chip:hover { opacity: .75; }
.rp-cal-filter-chip.active { opacity: 1; background: var(--rp-g50); border-color: var(--rp-g300); }
.rp-cal-legend-dot { width: 10px; height: 10px; border-radius: 9999px; }

/* ============================================================
   PRODUCT THUMB + REF CODE
   ============================================================ */
.product-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--rp-g200); }
.product-thumb-empty { width: 36px; height: 36px; border-radius: 6px; background: var(--rp-g100); display: flex; align-items: center; justify-content: center; color: var(--rp-g400); }
.product-thumb-empty svg { width: 16px; height: 16px; }
.ref-code { font-family: 'DM Sans', monospace; font-size: 11px; font-weight: 700; color: var(--rp-g500); background: var(--rp-g100); padding: 2px 8px; border-radius: 5px; }

/* ============================================================
   EXPORT BUTTONS
   ============================================================ */
.export-btns { display: flex; gap: 8px; }

/* ============================================================
   COMPARATIVA / CHANGES
   ============================================================ */
.kpi-comparison { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.kpi-change { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px; }
.kpi-change svg { width: 13px; height: 13px; }
.change-up { border: 1.5px solid rgba(16,185,129,.3); background: rgba(16,185,129,.1); color: #059669; }
.change-down { border: 1.5px solid rgba(239,68,68,.3); background: rgba(239,68,68,.1); color: #DC2626; }

/* ============================================================
   RANKS
   ============================================================ */
.rank { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 11px; }
.rank-1 { background: #FEF3C7; color: #92400E; }
.rank-2 { background: var(--rp-g200); color: var(--rp-g700); }
.rank-3 { background: #FED7AA; color: #9A3412; }

/* ============================================================
   NEW MODAL SYSTEM (rp-modal-*)
   ============================================================ */
.rp-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    opacity: 0; transition: opacity .2s ease;
}
.rp-modal-overlay.rp-modal-visible { opacity: 1; }

.rp-modal {
    background: var(--rp-white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(15,23,42,.25);
    width: 92%; max-width: 620px;
    max-height: 90vh; overflow-y: auto;
    transform: translateY(10px) scale(.98);
    transition: transform .2s ease;
}
.rp-modal-visible .rp-modal { transform: translateY(0) scale(1); }

.rp-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--rp-g200);
    display: flex; align-items: center; justify-content: space-between;
}
.rp-modal-header h3 {
    font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: 800; margin: 0;
    display: flex; align-items: center;
}
.rp-modal-header h3 svg { margin-right: 8px; width: 18px; height: 18px; }

.rp-modal-close {
    width: 32px; height: 32px; border-radius: 8px; border: none; background: none;
    display: flex; align-items: center; justify-content: center;
    color: var(--rp-g400); cursor: pointer; transition: all .12s;
}
.rp-modal-close:hover { background: var(--rp-g100); color: var(--rp-g700); }
.rp-modal-close svg { width: 18px; height: 18px; }

.rp-modal-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.rp-modal-body p { font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--rp-g700); line-height: 1.6; margin: 0; }

.rp-modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--rp-g200);
    background: var(--rp-g50);
    display: flex; justify-content: flex-end; gap: 10px;
    border-radius: 0 0 16px 16px;
}

.rp-modal input, .rp-modal select, .rp-modal textarea {
    width: 100%; padding: 8px 12px; font-family: 'DM Sans', sans-serif; font-size: 13px;
    border: 1.5px solid var(--rp-g300); border-radius: 8px; color: var(--rp-dark); outline: none; height: 38px;
}
.rp-modal textarea { height: auto; }
.rp-modal input:focus, .rp-modal select:focus, .rp-modal textarea:focus { border-color: var(--rp-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* ============================================================
   TABLE SEARCH INPUT
   ============================================================ */
.rp-table-search-wrap {
    position: relative; display: inline-flex; align-items: center; margin-bottom: 12px;
}
.rp-table-search-wrap svg {
    position: absolute; left: 14px; width: 16px; height: 16px; color: var(--rp-g400); pointer-events: none;
}
.rp-table-search {
    padding: 7px 14px 7px 38px; border: 1.5px solid var(--rp-g300); border-radius: 9999px;
    font-family: 'DM Sans', sans-serif; font-size: 13px; color: var(--rp-dark);
    height: 36px; min-width: 260px; background: var(--rp-white); outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.rp-table-search:focus { border-color: var(--rp-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.rp-table-search::placeholder { color: var(--rp-g400); }

/* ============================================================
   BULK ACTION BAR
   ============================================================ */
.rp-bulk-bar {
    display: none; align-items: center; gap: 12px;
    padding: 10px 16px; margin-bottom: 12px;
    background: var(--rp-primary-bg); border: 1.5px solid #BFDBFE; border-radius: 12px;
}
.rp-bulk-bar.visible { display: flex; }
.rp-bulk-bar-count {
    font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 700;
    color: var(--rp-primary); white-space: nowrap;
}

/* ============================================================
   INLINE EDIT CELL
   ============================================================ */
.rp-inline-edit {
    cursor: pointer; padding: 2px 6px; border-radius: 6px; transition: background .12s;
}
.rp-inline-edit:hover { background: var(--rp-primary-bg); }
.rp-inline-edit-active {
    display: inline-flex; align-items: center; gap: 4px;
}
.rp-inline-edit-input {
    width: 80px; height: 28px; padding: 2px 6px; font-size: 12px;
    border: 1.5px solid var(--rp-primary); border-radius: 6px;
    font-family: 'DM Sans', sans-serif; color: var(--rp-dark); outline: none;
}

/* ============================================================
   CHARTS GRID — additional layouts
   ============================================================ */
.charts-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-top: 20px; }
.charts-full { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 20px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 16px; }
    .kpi-grid, .rp-dash-kpi-row { grid-template-columns: 1fr 1fr !important; }
    .charts-grid, .charts-grid-3 { grid-template-columns: 1fr; }
    h1 { font-size: 24px; }
}
@media (max-width: 480px) {
    .kpi-grid, .rp-dash-kpi-row { grid-template-columns: 1fr !important; }
}
