/* =========================================================
   UX IMPROVEMENTS (v2.1)
   ========================================================= */

/* 1. Panel Central (Glass Cards & Layout) */
.glass-card {
    background: rgba(11, 17, 32, 0.65) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3) !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s ease !important;
}

.kpi-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 40px rgba(56, 189, 248, 0.15), 0 4px 12px rgba(0, 0, 0, 0.5) !important;
    border-color: rgba(56, 189, 248, 0.25) !important;
}

.kpi-value {
    color: var(--accent-primary) !important;
    text-shadow: 0 0 12px rgba(56, 189, 248, 0.2) !important;
}

/* 2. Panel de Empresas (Sidebar Focus & Hover) */
.company-item {
    transition: all 0.3s ease !important;
}

.company-item:hover {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.1) 0%, transparent 100%) !important;
    border-color: rgba(56, 189, 248, 0.3) !important;
    padding-left: 16px !important;
}

.company-item:hover .company-ticker {
    color: var(--accent-primary) !important;
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.4) !important;
}

.company-item.active {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.15) 0%, rgba(11, 17, 32, 0) 100%) !important;
    border-left: 3px solid var(--accent-primary) !important;
}

.companies-list::-webkit-scrollbar {
    width: 6px;
}
.companies-list::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.2);
    border-radius: 10px;
}
.companies-list::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.5);
}

/* 3. Panel de Rebalanceo (Gráfico Destacado) */
.analytics-bar-card {
    position: relative;
    overflow: hidden;
}

.analytics-bar-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    opacity: 0.5;
}

.analytics-bar-card:hover {
    box-shadow: 0 0 30px rgba(56, 189, 248, 0.1) inset, 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

/* 4. Panel de Notificaciones (Animación y Feedback) */
.notif-dropdown {
    transform-origin: top right;
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes scaleIn {
    0% { transform: scale(0.95) translateY(-10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.notif-item {
    transition: background 0.2s ease, border-left-color 0.2s ease !important;
    border-left: 3px solid transparent;
}
.notif-item.unread {
    background: rgba(56, 189, 248, 0.05) !important;
    border-left-color: var(--accent-primary) !important;
}
.notif-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* 5. Panel de Configuración (Configuración Masiva Modal) */
.modal-overlay:not(.hidden) {
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    animation: fadeIn 0.3s ease !important;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.modal-content.modal-bulk {
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6) !important;
}

@keyframes slideUp {
    0% { transform: translateY(30px) scale(0.98); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.bulk-table thead th {
    background: rgba(11, 17, 32, 0.85) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.bulk-table tbody tr {
    transition: background 0.2s ease, transform 0.2s ease !important;
}

.bulk-table tbody tr:hover {
    background: rgba(56, 189, 248, 0.05) !important;
}

#bulk-conviccion-total {
    transition: color 0.3s ease, text-shadow 0.3s ease !important;
}

.conviccion-perfect #bulk-conviccion-total {
    color: var(--color-success) !important;
    text-shadow: 0 0 15px rgba(52, 211, 153, 0.5) !important;
}

.conviccion-over #bulk-conviccion-total {
    animation: textPulseRed 1.5s infinite !important;
}

@keyframes textPulseRed {
    0%, 100% { color: var(--color-danger); text-shadow: 0 0 10px rgba(248, 113, 113, 0.4); }
    50% { color: #ff9999; text-shadow: 0 0 20px rgba(248, 113, 113, 0.8); }
}

.bulk-table select, .bulk-table input {
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
}
.bulk-table select:focus, .bulk-table input:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2) !important;
}

/* =========================================================
   6. MULTI-LEVEL SORT SYSTEM
   ========================================================= */

/* Sortable Table Headers */
.sortable-th {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}
.sortable-th:hover {
    background: rgba(56, 189, 248, 0.12) !important;
    color: #38bdf8;
}
.sortable-th.sorted {
    color: #38bdf8 !important;
    background: rgba(56, 189, 248, 0.08) !important;
}
.sort-indicator {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 4px;
    font-size: 10px;
    color: #38bdf8;
    vertical-align: middle;
}
.sort-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: 9px;
    font-weight: 700;
    border-radius: 50%;
    background: rgba(56, 189, 248, 0.25);
    color: #38bdf8;
    line-height: 1;
}

/* Sort Bar (under filter bar) */
.sort-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(11, 17, 32, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    margin-bottom: 8px;
    min-height: 36px;
}
.sort-bar-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}
.sort-bar-label i {
    color: #a78bfa;
}
.sort-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

/* Sort Pill */
.sort-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 4px;
    border-radius: 6px;
    background: rgba(167, 139, 250, 0.15);
    border: 1px solid rgba(167, 139, 250, 0.3);
    color: #c4b5fd;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.sort-pill:hover {
    border-color: rgba(167, 139, 250, 0.6);
    background: rgba(167, 139, 250, 0.22);
}
.sort-pill-level {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 9px;
    font-weight: 800;
    border-radius: 4px;
    background: rgba(167, 139, 250, 0.35);
    color: #e0d5ff;
}
.sort-pill-toggle,
.sort-pill-remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    font-size: 12px;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s ease;
}
.sort-pill-toggle:hover {
    color: #38bdf8;
}
.sort-pill-remove:hover {
    color: #f87171;
}

/* Sort Clear Button */
.sort-clear-btn {
    background: none;
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: rgba(248, 113, 113, 0.6);
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    transition: all 0.2s ease;
}
.sort-clear-btn:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.4);
}

/* =========================================================
   FUNDAMENTAL INTELLIGENCE PANELS (Task 12)
   ========================================================= */

.fund-intel-panel { padding: 20px 24px; }
.fund-intel-panel .panel-header-flex { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.toggle-section-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    width: 28px; height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.toggle-section-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

#fund-intel-body {
    display: flex;
    flex-direction: column;
}
#fund-intel-body > div:not(:empty) {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
#fund-intel-body > div:last-child,
#fund-intel-body > div:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}
#fund-intel-body > div:first-child:not(:empty) {
    padding-top: 0;
}
#fund-intel-body.collapsed { display: none; }

.intel-subsection {
    margin-bottom: 0;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.intel-subsection:first-child { padding-top: 0; }
.intel-subsection:last-child { border-bottom: none; padding-bottom: 0; }
.intel-subtitle {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.intel-subtitle i { color: var(--accent-primary, #38bdf8); font-size: 11px; }

/* --- Benchmark Bars --- */
.benchmark-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }

.bench-row {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 10px 12px;
    transition: border-color 0.2s;
}
.bench-row:hover { border-color: rgba(255,255,255,0.12); }
.bench-positive { border-left: 3px solid #34d399; }
.bench-negative { border-left: 3px solid #f87171; }
.bench-neutral  { border-left: 3px solid rgba(255,255,255,0.15); }

.bench-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.bench-bar-pair { display: flex; flex-direction: column; gap: 3px; }
.bench-bar-line { display: flex; align-items: center; gap: 6px; }
.bench-tag {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    width: 24px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.bench-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}
.bench-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}
.company-fill { background: #38bdf8; }
.industry-fill { background: rgba(255,255,255,0.2); }

.bench-val {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    width: 50px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* --- Forward Multiples --- */
.forward-multiples-grid { display: flex; gap: 8px; flex-wrap: wrap; }

.fwd-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 8px;
    padding: 10px 14px;
    min-width: 110px;
    flex: 1;
    text-align: center;
}
.fwd-label {
    font-size: 10px;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}
.fwd-value {
    font-size: 17px;
    font-weight: 700;
    color: #e2e8f0;
    font-variant-numeric: tabular-nums;
}
.fwd-delta {
    font-size: 10px;
    font-weight: 600;
    margin-top: 3px;
}
.delta-positive { color: #34d399; }
.delta-negative { color: #f87171; }
.fwd-trailing {
    font-size: 10px;
    color: rgba(255,255,255,0.3);
    margin-top: 1px;
}

/* --- Returns Grid --- */
.returns-grid { display: flex; gap: 6px; flex-wrap: wrap; }

.ret-card {
    padding: 7px 10px;
    border-radius: 7px;
    text-align: center;
    min-width: 52px;
    flex: 1;
}
.ret-positive { background: rgba(52,211,153,0.08); border: 1px solid rgba(52,211,153,0.18); }
.ret-negative { background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.18); }
.ret-neutral  { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); }

.ret-period {
    font-size: 9px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}
.ret-value {
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.ret-positive .ret-value { color: #34d399; }
.ret-negative .ret-value { color: #f87171; }
.ret-neutral .ret-value  { color: rgba(255,255,255,0.55); }

/* --- Analyst Range --- */
.analyst-count-badge {
    font-size: 10px;
    background: rgba(56,189,248,0.12);
    color: #38bdf8;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 500;
}

.analyst-range-container { max-width: 100%; }
.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 6px;
    font-variant-numeric: tabular-nums;
}
.range-track {
    position: relative;
    height: 32px;
    margin-bottom: 8px;
}
.range-bar {
    position: absolute;
    top: 12px;
    left: 0; right: 0;
    height: 8px;
    background: linear-gradient(90deg, rgba(248,113,113,0.3), rgba(251,191,36,0.3), rgba(52,211,153,0.3));
    border-radius: 4px;
}
.range-marker {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
}
.marker-line {
    width: 2px;
    height: 32px;
    margin: 0 auto;
}
.price-marker .marker-line { background: #fff; }
.median-marker .marker-line { background: #38bdf8; border-style: dashed; }

.marker-label {
    font-size: 10px;
    text-align: center;
    white-space: nowrap;
    margin-top: 2px;
}
.price-label { color: rgba(255,255,255,0.7); }
.median-label { color: #38bdf8; font-weight: 600; }

.range-context {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

/* --- Ownership Bar --- */
.ownership-container { max-width: 500px; }
.ownership-bar {
    display: flex;
    height: 14px;
    border-radius: 7px;
    overflow: hidden;
    margin-bottom: 10px;
}
.ownership-segment { transition: width 0.6s ease; }
.ownership-segment:first-child { border-radius: 7px 0 0 7px; }
.ownership-segment:last-child  { border-radius: 0 7px 7px 0; }

.ownership-legend { display: flex; flex-wrap: wrap; gap: 12px; }
.legend-item {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    display: flex; align-items: center; gap: 5px;
}
.legend-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* --- Ownership --- */
.ownership-container { max-width: 100%; }

/* --- DCF Panel --- */
.dcf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 768px) { .dcf-grid { grid-template-columns: 1fr; } }

.dcf-assumptions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dcf-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
}
.dcf-label {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}
.dcf-val {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.dcf-model-type {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    max-width: 150px;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dcf-waterfall { text-align: center; }
.dcf-wf-title {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dcf-wf-bar {
    display: flex;
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}
.dcf-wf-seg { transition: width 0.6s ease; }
.pv5y-seg { background: #38bdf8; }
.pvterm-seg { background: #a78bfa; }

.dcf-wf-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 10px;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}
.dcf-wf-legend span { display: flex; align-items: center; gap: 5px; }

.dcf-npv {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
}
.dcf-npv strong {
    color: #38bdf8;
    font-size: 18px;
}

/* --- Data Source Badge (Fase 4) --- */
.data-source-badge {
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
    display: inline-block;
    margin-left: 6px;
}
.source-live { background: rgba(52,211,153,0.15); color: #34d399; }
.source-csv  { background: rgba(251,191,36,0.15); color: #fbbf24; }
.source-fallback { background: rgba(248,113,113,0.15); color: #f87171; }


/* --- Billing History Panel (Profile View) --- */
.billing-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 48px;
}
.billing-event-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-subtle);
    font-size: 13px;
}
.billing-event-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}
.billing-event-icon.paid   { background: rgba(34,197,94,0.12); color: #22c55e; }
.billing-event-icon.refund { background: rgba(248,113,113,0.12); color: #f87171; }
.billing-event-icon.cancel { background: rgba(251,191,36,0.12); color: #fbbf24; }
.billing-event-desc {
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.3;
}
.billing-event-date {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}
.billing-event-amount {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.billing-empty {
    color: var(--text-muted);
    font-size: 13px;
    padding: 8px 0;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════
   GRANDES INVERSORES PANEL (V02)
   ═══════════════════════════════════════════════════════════ */

.gi-panel {
    background: rgba(11,17,32,0.60);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    backdrop-filter: blur(12px);
}

.gi-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.gi-panel-header > i {
    font-size: 16px;
    color: var(--accent-primary);
}

.gi-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.gi-panel-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}

/* Grid: 2 columns on wide, 1 on narrow */
.gi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

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

/* Individual investor card */
.gi-card {
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    transition: border-color 0.2s;
    border-left: 3px solid transparent;
}

.gi-card.gi-favorable  { border-left-color: #22c55e; }
.gi-card.gi-caution    { border-left-color: #fbbf24; }
.gi-card.gi-avoid      { border-left-color: #f87171; }
.gi-card.gi-neutral    { border-left-color: #64748b; }
.gi-card.gi-inaplicable { border-left-color: #475569; opacity: 0.6; }

.gi-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.gi-investor-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(56,189,248,0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-size: 12px;
    flex-shrink: 0;
}

.gi-favorable  .gi-investor-icon { background: rgba(34,197,94,0.10);  color: #22c55e; }
.gi-caution    .gi-investor-icon { background: rgba(251,191,36,0.10);  color: #fbbf24; }
.gi-avoid      .gi-investor-icon { background: rgba(248,113,113,0.10); color: #f87171; }
.gi-neutral    .gi-investor-icon { background: rgba(100,116,139,0.10); color: #64748b; }
.gi-inaplicable .gi-investor-icon { background: rgba(71,85,105,0.10); color: #475569; }

.gi-investor-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.gi-investor-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gi-investor-style {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Verdict chip */
.gi-verdict-chip {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.gi-favorable-chip  { background: rgba(34,197,94,0.12);  color: #22c55e; border: 1px solid rgba(34,197,94,0.25);  }
.gi-caution-chip    { background: rgba(251,191,36,0.12);  color: #fbbf24; border: 1px solid rgba(251,191,36,0.25);  }
.gi-avoid-chip      { background: rgba(248,113,113,0.12); color: #f87171; border: 1px solid rgba(248,113,113,0.25); }
.gi-neutral-chip    { background: rgba(100,116,139,0.12); color: #94a3b8; border: 1px solid rgba(100,116,139,0.25); }
.gi-inaplicable-chip { background: rgba(71,85,105,0.10); color: #64748b; border: 1px solid rgba(71,85,105,0.20); }

/* Opinion text */
.gi-opinion { padding-top: 2px; }

.gi-line1 {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 4px 0;
}

.gi-line2 {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    font-style: italic;
    margin: 0;
}

/* Disclaimer */
.gi-disclaimer {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 12px;
    margin-bottom: 0;
    text-align: center;
    line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════
   CAPITAL ALLOCATION PANEL (V04)
   ═══════════════════════════════════════════════════════════ */

.ca-panel {
    background: rgba(11,17,32,0.60);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    backdrop-filter: blur(12px);
}

.ca-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.ca-panel-header > i {
    font-size: 15px;
    color: var(--accent-primary);
}

.ca-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.ca-dominant-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    background: rgba(251,191,36,0.12);
    color: #fbbf24;
    border: 1px solid rgba(251,191,36,0.25);
    display: flex;
    align-items: center;
    gap: 4px;
}

.ca-panel-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
}

/* Stacked bar */
.ca-bar-track {
    display: flex;
    height: 10px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255,255,255,0.05);
    margin-bottom: 14px;
    gap: 2px;
}

.ca-bar-seg {
    height: 100%;
    border-radius: 3px;
    min-width: 2px;
    transition: opacity 0.2s;
}
.ca-bar-seg:hover { opacity: 0.8; }

/* Stat chips grid */
.ca-chips-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

@media (max-width: 700px) {
    .ca-chips-grid { grid-template-columns: 1fr 1fr; }
}

.ca-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-subtle);
    transition: border-color 0.15s;
}

.ca-chip-dominant {
    border-color: rgba(251,191,36,0.30);
    background: rgba(251,191,36,0.05);
}

.ca-chip > i {
    font-size: 14px;
    flex-shrink: 0;
}

.ca-chip-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.ca-chip-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.ca-chip-sub {
    font-size: 10px;
    color: var(--text-muted);
}

.ca-chip-pct {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Footer */
.ca-footer {
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ca-source {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* ═══════════════════════════════════════════════════════════
   VALORACIÓN CONTEXTUAL PANEL (V03)
   ═══════════════════════════════════════════════════════════ */

.vc-panel {
    background: rgba(11,17,32,0.60);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    backdrop-filter: blur(12px);
}

.vc-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.vc-panel-header > i { font-size: 14px; color: var(--accent-primary); }

.vc-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.vc-type-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(56,189,248,0.10);
    color: var(--accent-primary);
    border: 1px solid rgba(56,189,248,0.20);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.vc-verdict {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}

.vc-verdict-cheap     { background: rgba(34,197,94,0.12);  color: #22c55e; border: 1px solid rgba(34,197,94,0.25);  }
.vc-verdict-fair      { background: rgba(251,191,36,0.12);  color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.vc-verdict-expensive { background: rgba(248,113,113,0.12); color: #f87171; border: 1px solid rgba(248,113,113,0.25);}
.vc-verdict-unknown   { background: rgba(100,116,139,0.12); color: #94a3b8; border: 1px solid rgba(100,116,139,0.25);}

.vc-methods-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.vc-method-card {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid transparent;
}

.vc-cheap     { border-left-color: #22c55e; }
.vc-fair      { border-left-color: #fbbf24; }
.vc-expensive { border-left-color: #f87171; }
.vc-unknown   { border-left-color: #475569; }

.vc-method-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.vc-method-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
}

.vc-method-threshold {
    font-size: 10px;
    color: var(--text-muted);
}

.vc-method-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.vc-method-value {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.vc-signal-pill {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.vc-cheap-pill     { background: rgba(34,197,94,0.12);  color: #22c55e; }
.vc-fair-pill      { background: rgba(251,191,36,0.12);  color: #fbbf24; }
.vc-expensive-pill { background: rgba(248,113,113,0.12); color: #f87171; }
.vc-unknown-pill   { background: rgba(100,116,139,0.10); color: #94a3b8; }

/* ═══════════════════════════════════════════════════════════
   CAPITAL ALLOCATION — ROIC badge + chip vacío
   ═══════════════════════════════════════════════════════════ */

.ca-roic-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.ca-roic-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid;
    flex-shrink: 0;
}

.ca-roic-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.ca-roic-val {
    font-size: 18px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.ca-roic-desc {
    font-size: 10px;
    font-weight: 600;
}

.roic-elite { background: rgba(34,197,94,0.12);  color: #22c55e; border-color: rgba(34,197,94,0.30);  }
.roic-great { background: rgba(56,189,248,0.12);  color: #38bdf8; border-color: rgba(56,189,248,0.30);  }
.roic-ok    { background: rgba(251,191,36,0.12);  color: #fbbf24; border-color: rgba(251,191,36,0.30);  }
.roic-low   { background: rgba(251,146,60,0.12);  color: #fb923c; border-color: rgba(251,146,60,0.30);  }
.roic-bad   { background: rgba(248,113,113,0.12); color: #f87171; border-color: rgba(248,113,113,0.30); }

.ca-roic-tip {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
    font-style: italic;
}

/* Chip vacío (M&A / Caja sin datos) */
.ca-chip-empty {
    opacity: 0.45;
}

/* ═══════════════════════════════════════════════════════════
   EARNINGS BEATS / MISSES PANEL
   ═══════════════════════════════════════════════════════════ */

.es-panel {
    background: rgba(11,17,32,0.60);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    backdrop-filter: blur(12px);
}

.es-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.es-panel-header > i { font-size: 14px; color: var(--accent-primary); }

.es-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.es-trend-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.es-trend-green { background: rgba(34,197,94,0.12);  color: #22c55e; border: 1px solid rgba(34,197,94,0.25);  }
.es-trend-amber { background: rgba(251,191,36,0.12);  color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }
.es-trend-red   { background: rgba(248,113,113,0.12); color: #f87171; border: 1px solid rgba(248,113,113,0.25);}

/* Grid: 4 columnas en desktop, 2 en mobile */
.es-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

@media (max-width: 900px) { .es-cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .es-cards-grid { grid-template-columns: 1fr; } }

.es-card {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-subtle);
    border-top: 3px solid transparent;
}

.es-beat { border-top-color: #22c55e; }
.es-miss { border-top-color: #f87171; }

.es-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.es-quarter {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

.es-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.es-badge-beat { background: rgba(34,197,94,0.15);  color: #22c55e; }
.es-badge-miss { background: rgba(248,113,113,0.15); color: #f87171; }

.es-eps-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.es-eps-item {
    display: flex;
    flex-direction: column;
}

.es-eps-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 1px;
}

.es-eps-val {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.es-green  { color: #22c55e; }
.es-red    { color: #f87171; }
.es-muted  { color: var(--text-secondary); }

.es-eps-divider {
    width: 1px;
    height: 28px;
    background: var(--border-subtle);
    flex-shrink: 0;
}

.es-surp-wrap {
    margin-left: auto;
    text-align: right;
}

.es-surp-val {
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Barra de surprise */
.es-bar-track {
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}

.es-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.es-bar-beat { background: #22c55e; }
.es-bar-miss { background: #f87171; }

/* ═══════════════════════════════════════════════════════════
   FILTRO GRAHAM PANEL (V02)
   ═══════════════════════════════════════════════════════════ */

.gf-panel {
    background: rgba(11,17,32,0.60);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    backdrop-filter: blur(12px);
}

.gf-panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.gf-panel-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.gf-verdict-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid;
}

.gf-favorable {
    background: var(--color-success-bg);
    color: var(--color-success);
    border-color: var(--color-success-border);
}

.gf-caution {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border-color: var(--color-warning-border);
}

.gf-avoid {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: var(--color-danger-border);
}

.gf-unknown {
    background: rgba(100,116,139,0.10);
    color: var(--text-muted);
    border-color: rgba(100,116,139,0.22);
}

.gf-score-badge {
    margin-left: auto;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 2px 7px;
}

.gf-summary {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0 0 10px;
    line-height: 1.5;
}

.gf-signals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 4px;
}

.gf-signal-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
}

.gf-sig-pass { background: var(--color-success-bg); }
.gf-sig-fail { background: var(--color-danger-bg); }
.gf-sig-null { background: rgba(100,116,139,0.08); }

.gf-sig-icon {
    font-size: 10px;
    flex-shrink: 0;
}
.gf-sig-pass .gf-sig-icon { color: var(--color-success); }
.gf-sig-fail .gf-sig-icon { color: var(--color-danger); }
.gf-sig-null .gf-sig-icon { color: var(--text-muted); }

.gf-signal-name {
    flex: 1;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gf-signal-val {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-size: 10px;
    color: var(--text-primary);
    flex-shrink: 0;
}

/* Disclaimer */
.es-disclaimer {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
    margin: 0;
    text-align: center;
}
