/* QPM Dashboard — Dark Premium Theme
   Inspired by Wealthfront/Revolut fintech aesthetic
   Fully responsive: mobile-first with breakpoints at 768px and 1024px
*/

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

:root {
    /* Backgrounds */
    --bg-primary: #13151a;
    --bg-secondary: #1a1d28;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-sidebar: #111318;
    --bg-input: rgba(255, 255, 255, 0.06);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(108, 140, 255, 0.4);

    /* Text */
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-inverse: #13151a;

    /* Accents */
    --accent-blue: #6c8cff;
    --accent-blue-dim: rgba(108, 140, 255, 0.15);
    --accent-green: #4ade80;
    --accent-green-dim: rgba(74, 222, 128, 0.12);
    --accent-red: #ff4444;
    --accent-red-dim: rgba(255, 68, 68, 0.12);
    --accent-yellow: #facc15;
    --accent-yellow-dim: rgba(250, 204, 21, 0.12);

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --bottom-nav-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-elevated: 0 4px 12px rgba(0, 0, 0, 0.4);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-base);
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== SIDEBAR ===== */
.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.sidebar-logo span {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-item.active {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

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

.nav-separator {
    height: 1px;
    background: var(--border-subtle);
    margin: 12px 0;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-subtle);
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-height);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(19, 21, 26, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 32px;
    flex: 1;
}

/* ===== GRID SYSTEM ===== */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-fast);
}

.card:hover {
    background: var(--bg-card-hover);
}

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

.card-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== KPI CARD ===== */
.kpi-card { text-align: left; }

.kpi-card .card-value.positive { color: var(--accent-green); }
.kpi-card .card-value.negative { color: var(--accent-red); }
.kpi-card .card-value.neutral { color: var(--accent-blue); }

/* ===== REGIME BADGE ===== */
.regime-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.regime-badge.bull {
    background: var(--accent-green-dim);
    color: var(--accent-green);
}

.regime-badge.neutral {
    background: var(--accent-yellow-dim);
    color: var(--accent-yellow);
}

.regime-badge.bear {
    background: var(--accent-red-dim);
    color: var(--accent-red);
}

.regime-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===== REGIME SEMAPHORE (Home) ===== */
.semaphore {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 auto 16px;
}

.semaphore.bull {
    background: radial-gradient(circle, var(--accent-green) 0%, rgba(74, 222, 128, 0.2) 70%);
    color: var(--text-inverse);
    box-shadow: 0 0 40px rgba(74, 222, 128, 0.3);
}

.semaphore.neutral {
    background: radial-gradient(circle, var(--accent-yellow) 0%, rgba(250, 204, 21, 0.2) 70%);
    color: var(--text-inverse);
    box-shadow: 0 0 40px rgba(250, 204, 21, 0.3);
}

.semaphore.bear {
    background: radial-gradient(circle, var(--accent-red) 0%, rgba(255, 68, 68, 0.2) 70%);
    color: #fff;
    box-shadow: 0 0 40px rgba(255, 68, 68, 0.3);
}

/* ===== QRS BAR ===== */
.qrs-bar-container {
    width: 100%;
    margin: 16px 0;
}

.qrs-bar {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(to right,
        var(--accent-green) 0%, var(--accent-green) 33%,
        var(--accent-yellow) 33%, var(--accent-yellow) 66%,
        var(--accent-red) 66%, var(--accent-red) 100%
    );
    position: relative;
    opacity: 0.3;
}

.qrs-bar-marker {
    position: absolute;
    top: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--bg-primary);
    box-shadow: var(--shadow-elevated);
    transform: translateX(-50%);
    transition: left var(--transition-base);
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

tbody tr:hover {
    background: var(--bg-card);
}

tbody tr.refuge td {
    background: var(--accent-blue-dim);
}

.text-green { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-yellow { color: var(--accent-yellow); }
.text-blue { color: var(--accent-blue); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-green, .badge-ok { background: var(--accent-green-dim); color: var(--accent-green); }
.badge-red, .badge-error { background: var(--accent-red-dim); color: var(--accent-red); }
.badge-yellow, .badge-warn { background: var(--accent-yellow-dim); color: var(--accent-yellow); }
.badge-blue { background: var(--accent-blue-dim); color: var(--accent-blue); }

/* ===== ALERTS ===== */
.alert { padding: 16px 20px; border-radius: var(--radius-md); margin-bottom: 16px; }
.alert-error { background: var(--accent-red-dim); color: var(--accent-red); border: 1px solid rgba(239,68,68,0.2); }

/* ===== ROW STATES ===== */
.row-warning { background: rgba(245,158,11,0.05); }

/* ===== BUTTONS ===== */
.btn { padding: 8px 16px; border-radius: var(--radius-md); font-size: 0.8rem; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: var(--card-bg); color: var(--text-primary); transition: all 0.15s; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 5px 12px; font-size: 0.75rem; }

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--border-focus);
}

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

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
}

.btn-primary:hover {
    background: #5a7af0;
    box-shadow: 0 2px 8px rgba(108, 140, 255, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

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

.btn-block {
    width: 100%;
}

/* ===== PERIOD TABS ===== */
.period-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.period-tab {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: transparent;
    font-family: inherit;
}

.period-tab:hover {
    color: var(--text-primary);
}

.period-tab.active {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
}

/* ===== CHART CONTAINER ===== */
.chart-container {
    width: 100%;
    min-height: 300px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.chart-container-sm {
    min-height: 180px;
}

/* ===== TIMELINE ===== */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-subtle);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-dot {
    position: absolute;
    left: -20px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 2px solid var(--bg-primary);
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== COMPONENT CARD (QRS) ===== */
.component-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.component-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.component-indicator.ok { background: var(--accent-green); }
.component-indicator.active { background: var(--accent-red); }

.component-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

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

/* ===== LOGIN PAGE ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-elevated);
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 32px;
}

.login-error {
    background: var(--accent-red-dim);
    color: var(--accent-red);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

/* ===== LOADING SKELETON ===== */
.skeleton {
    background: linear-gradient(90deg,
        var(--bg-card) 25%,
        var(--bg-card-hover) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text { height: 16px; margin-bottom: 8px; }
.skeleton-title { height: 32px; width: 60%; margin-bottom: 16px; }
.skeleton-chart { height: 200px; }

/* ===== BOTTOM NAV (MOBILE) ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-subtle);
    z-index: 100;
    padding: 0 8px;
}

.bottom-nav-items {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: space-around;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.bottom-nav-item svg {
    width: 22px;
    height: 22px;
}

.bottom-nav-item.active {
    color: var(--accent-blue);
}

.bottom-nav-item:hover {
    color: var(--text-primary);
    text-decoration: none;
}

/* ===== HAMBURGER (MOBILE) ===== */
.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

.hamburger svg {
    width: 24px;
    height: 24px;
}

/* ===== OVERLAY (MOBILE SIDEBAR) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* ===== FILTER BAR ===== */
.filter-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.filter-bar .form-input {
    width: auto;
    min-width: 160px;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.pagination button.active {
    background: var(--accent-blue-dim);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

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

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   Mobile-first: default is mobile
   768px+ = tablet
   1024px+ = desktop
   ============================================ */

/* --- MOBILE (default, <768px) --- */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding-bottom: var(--bottom-nav-height);
    }

    .bottom-nav {
        display: block;
    }

    .hamburger {
        display: block;
    }

    .topbar {
        padding: 0 16px;
    }

    .page-content {
        padding: 20px 16px;
    }

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

    .card {
        padding: 16px;
    }

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

    .semaphore {
        width: 90px;
        height: 90px;
        font-size: 0.8rem;
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-bar .form-input {
        width: 100%;
    }
}

/* --- TABLET (768px - 1023px) --- */
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-overlay.open {
        display: block;
    }

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

    .hamburger {
        display: block;
    }

    .bottom-nav {
        display: none;
    }

    .page-content {
        padding: 24px;
    }

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

/* --- DESKTOP (1024px+) --- */
@media (min-width: 1024px) {
    .sidebar {
        transform: translateX(0);
    }

    .hamburger {
        display: none;
    }

    .bottom-nav {
        display: none;
    }
}

/* ===== UTILITIES ===== */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none; }

/* === F1: hide TradingView attribution mark on all Lightweight Charts === */
#tv-attr-logo,
.tv-lightweight-charts a[href*="tradingview.com"],
.tv-lightweight-charts__attribution {
  display: none !important;
  visibility: hidden !important;
}

/* ===== F1: Resumen mosaic ===== */
.resumen-mosaic { padding: 16px 0; }
.grid-mosaic {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.grid-mosaic .card { background: var(--bg-card); border-radius: 8px; padding: 16px; transition: var(--transition-fast); }
.grid-mosaic a.card { text-decoration: none; color: inherit; display: block; }
.grid-mosaic a.card:hover { background: var(--bg-card-hover); cursor: pointer; }
.grid-mosaic .card-large { grid-column: span 2; }
.grid-mosaic .card-full { grid-column: span 4; }

.grid-mosaic .card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.grid-mosaic .card-title { font-weight: 600; }
.grid-mosaic .card-value { font-size: 22px; font-weight: 600; color: var(--text-primary); margin-top: 4px; }
.grid-mosaic .card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.light { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.light-green { background: var(--accent-green, #4ade80); box-shadow: 0 0 8px rgba(74,222,128,0.4); }
.light-amber { background: var(--accent-yellow, #facc15); box-shadow: 0 0 8px rgba(250,204,21,0.4); }
.light-red { background: var(--accent-red, #ff4444); box-shadow: 0 0 8px rgba(255,68,68,0.4); }

.exposure-bar { display: flex; height: 24px; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,0.05); margin: 12px 0 8px; }
.exp-cash { background: #71717a; }
.exp-equity { background: #6c8cff; }
.exp-refuge { background: #4ade80; }
.exposure-legend { display: flex; gap: 16px; font-size: 11px; color: var(--text-muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.dot-cash { background: #71717a; }
.dot-equity { background: #6c8cff; }
.dot-refuge { background: #4ade80; }

.metrics-mini { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.metrics-mini > div { display: flex; flex-direction: column; }
.metrics-mini .label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }
.metrics-mini .value { font-size: 16px; font-weight: 600; color: var(--text-primary); }

.refuge-list { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; }
.refuge-list li { display: flex; justify-content: space-between; padding: 4px 0; border-top: 1px solid rgba(255,255,255,0.04); }
.refuge-list li:first-child { border-top: 0; }
.refuge-list .ticker { font-weight: 600; color: var(--text-primary); }
.refuge-list .momentum { color: var(--text-secondary); font-variant-numeric: tabular-nums; }

.border-red { border: 1px solid rgba(255,68,68,0.3); }

.text-green { color: #4ade80; }
.text-red { color: #ff4444; }

.placeholder { padding: 24px; text-align: center; color: var(--text-muted); background: var(--bg-card); border-radius: 8px; margin: 16px 0; }

/* === F2: Tab Régimen === */
.regime-tab { display: flex; flex-direction: column; gap: 24px; }
.regime-tab section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 20px;
}
.regime-tab section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    font-weight: 500;
}
.regime-tab .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.regime-tab .section-header h3 { margin-bottom: 0; }

.regime-hero { display: flex; align-items: center; gap: 24px; }
.regime-hero .light-large {
    width: 64px; height: 64px; border-radius: 50%; display: inline-block;
    flex-shrink: 0;
}
.regime-hero .light-large.light-green { background: var(--accent-green, #4ade80); box-shadow: 0 0 32px rgba(74,222,128,0.5); }
.regime-hero .light-large.light-amber { background: var(--accent-yellow, #facc15); box-shadow: 0 0 32px rgba(250,204,21,0.5); }
.regime-hero .light-large.light-red   { background: var(--accent-red, #ff4444); box-shadow: 0 0 32px rgba(255,68,68,0.5); }
.regime-hero .hero-text { display: flex; flex-direction: column; gap: 4px; }
.regime-hero .hero-label { font-size: 1.6rem; margin: 0; color: var(--text-primary); font-weight: 600; }
.regime-hero .hero-system { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.regime-hero .hero-system .badge { padding: 2px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; }
.regime-hero .hero-score { margin: 4px 0 0 0; font-size: 1rem; color: var(--text-secondary); }
.regime-hero .hero-score strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }

.light.light-inline { width: 10px; height: 10px; margin-right: 6px; vertical-align: middle; }

.exposure-bar-large {
    display: flex; height: 40px; border-radius: 6px; overflow: hidden;
    background: rgba(255,255,255,0.05); margin: 8px 0 12px;
    color: white; font-size: 0.85rem; font-weight: 600;
}
.exposure-bar-large > div {
    display: flex; align-items: center; justify-content: center;
    transition: width var(--transition-fast);
}
.exposure-bar-large .exp-cash { background: #71717a; }
.exposure-bar-large .exp-equity { background: #6c8cff; }
.exposure-bar-large .exp-refuge { background: #4ade80; color: #1a1a1a; }
.exposure-bar-large > div:empty { display: none; }

.regime-narrative {
    margin: 12px 0 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 12px;
    background: rgba(255,255,255,0.02);
    border-left: 3px solid var(--accent-blue, #6c8cff);
    border-radius: 4px;
}

.small { font-size: 0.75rem; }
/* === /F2 === */

/* === F2.2: Hero meter (barra semáforo) + chart legend === */
.regime-meter {
    margin-top: 16px;
    width: 100%;
    max-width: 460px;
}
.meter-track {
    position: relative;
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(
        to right,
        rgba(239, 68, 68, 0.20) 0%,
        rgba(239, 68, 68, 0.20) 50%,
        rgba(250, 204, 21, 0.18) 70%,
        rgba(74, 222, 128, 0.20) 100%
    );
    border: 1px solid var(--border-subtle, #2a2a2a);
}
.meter-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 4px;
    transition: width 0.4s ease, left 0.4s ease;
}
.meter-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 24px;
    background: #fff;
    border-radius: 3px;
    box-shadow: 0 0 0 2px var(--bg-card, #14171a), 0 0 8px rgba(0, 0, 0, 0.5);
    transition: left 0.4s ease;
    z-index: 2;
}
.meter-marker-value {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-card, #14171a);
    padding: 1px 6px;
    border-radius: 3px;
    border: 1px solid var(--border-subtle, #2a2a2a);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.meter-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--text-muted, #888);
    font-variant-numeric: tabular-nums;
}
.meter-scale .meter-tick-mid { color: var(--text-secondary); }
.meter-scale .meter-tick-bull { color: var(--accent-green, #4ade80); font-weight: 600; }

/* Chart legend (Histograma + SPX) */
.regime-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 8px 0 12px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.regime-chart-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.regime-chart-legend .dot {
    width: 10px; height: 10px; border-radius: 50%;
}
.regime-chart-legend .dot-growth    { background: rgba(74, 222, 128, 0.85); }
.regime-chart-legend .dot-neutral   { background: rgba(250, 204, 21, 0.80); }
.regime-chart-legend .dot-defensive { background: rgba(239, 68, 68, 0.85); }
.regime-chart-legend .legend-line {
    display: inline-block;
    width: 16px;
    height: 2px;
    background: rgba(108, 140, 255, 0.7);
    border-radius: 1px;
}
/* === /F2.2 === */

/* === F2.1: Detalle por indicador TRS === */
.regime-indicators-detail .lookback-selector {
    display: inline-flex;
    gap: 4px;
}
.regime-indicators-detail .lookback-selector .btn-sm {
    padding: 4px 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}
.regime-indicators-detail .lookback-selector .btn-active {
    background: var(--accent-blue, #6c8cff);
    color: #fff;
    border-color: var(--accent-blue, #6c8cff);
}

.indicators-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.indicator-card {
    padding: 16px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.indicator-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}
.indicator-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.indicator-title h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}
.indicator-vote-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.indicator-vote-badge.vote-positive {
    background: rgba(74,222,128,0.18);
    color: var(--accent-green, #4ade80);
    border: 1px solid rgba(74,222,128,0.4);
}
.indicator-vote-badge.vote-negative {
    background: rgba(239,68,68,0.18);
    color: var(--accent-red, #ef4444);
    border: 1px solid rgba(239,68,68,0.4);
}
.indicator-vote-badge.vote-neutral {
    background: rgba(161,161,170,0.12);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.indicator-current-value {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: right;
}
.indicator-current-value .kv strong {
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.indicator-description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.45;
}

.indicator-thresholds {
    font-size: 0.78rem;
    color: var(--text-muted, #888);
    padding: 6px 10px;
    background: rgba(0,0,0,0.18);
    border-radius: 4px;
}
.indicator-thresholds .th-low { color: var(--accent-green, #4ade80); font-weight: 500; }
.indicator-thresholds .th-high { color: var(--accent-red, #ef4444); font-weight: 500; }

.indicator-chart-wrap {
    background: rgba(0,0,0,0.15);
    border-radius: 4px;
    padding: 4px;
}
/* === /F2.1 === */

/* === F3: Tab Sub-carteras === */
.sub-carteras-tab { display: flex; flex-direction: column; gap: 24px; }
.sub-carteras-tab section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 20px;
}
.sub-carteras-tab section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    font-weight: 500;
}
.sub-carteras-tab section h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 16px 0 8px 0;
    font-weight: 500;
}

.sub-carteras-context p { margin: 8px 0; color: var(--text-secondary); line-height: 1.5; }
.sub-carteras-context p:first-of-type { margin-top: 0; }

/* F2.3 — banner ficha técnica sub-carteras */
.sub-carteras-context .context-headline {
    color: var(--text-primary);
    font-size: 0.95rem;
}
.sub-carteras-context .context-steps {
    margin: 8px 0 0 0;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}
.sub-carteras-context .context-steps li { margin-bottom: 6px; }
.sub-carteras-context .context-steps li:last-child { margin-bottom: 0; }
.sub-carteras-context code {
    background: rgba(0,0,0,0.25);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.78rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.sub-carteras-context .ctx-growth { color: var(--accent-green, #4ade80); font-weight: 600; }
.sub-carteras-context .ctx-defensive { color: var(--accent-red, #ef4444); font-weight: 600; }

/* F2.3 — Histórico sub-carteras */
.sub-carteras-history {
    margin-top: 24px;
}
.sub-carteras-history .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}
.sub-carteras-history .lookback-selector { display: inline-flex; gap: 4px; }
.sub-carteras-history .lookback-selector .btn-sm {
    padding: 4px 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}
.sub-carteras-history .lookback-selector .btn-active {
    background: var(--accent-blue, #6c8cff);
    color: #fff;
    border-color: var(--accent-blue, #6c8cff);
}
.sub-history-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 8px 0 12px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.sub-history-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sub-history-legend .legend-line {
    display: inline-block;
    width: 18px;
    height: 2px;
    border-radius: 1px;
}
.sub-history-legend .legend-marker {
    color: var(--text-primary);
    font-size: 0.85rem;
}

.sub-carteras-history .history-controls {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.sub-carteras-history .metric-toggle { display: inline-flex; gap: 4px; }
.sub-carteras-history .metric-toggle .btn-sm {
    padding: 4px 12px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
}
.sub-carteras-history .metric-toggle .btn-active {
    background: var(--accent-green, #4ade80);
    color: #0b0f12;
    border-color: var(--accent-green, #4ade80);
}

.sub-carteras-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}
.sub-pata-column {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.sub-pata-column h3 { margin-bottom: 4px; }

.sub-card {
    background: var(--bg-card-hover, rgba(255,255,255,0.02));
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}
.sub-card:hover { background: rgba(255,255,255,0.05); border-color: var(--accent-blue, #6c8cff); }
.sub-card.sub-card-active {
    border-color: var(--accent-green, #4ade80);
    background: rgba(74,222,128,0.06);
}
.sub-card.sub-card-expanded { background: rgba(255,255,255,0.04); }

.sub-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sub-card-name { font-weight: 600; color: var(--text-primary); }
.sub-card-header .badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sub-card-metric { display: flex; justify-content: space-between; align-items: baseline; }
.sub-card-metric .metric-label { color: var(--text-muted); font-size: 0.75rem; }
.sub-card-metric .metric-value { font-size: 1.2rem; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

.sub-card-detail {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
    cursor: default;
}
.sub-card-detail .data-table { font-size: 0.8rem; }
.sub-sharpe-chart { width: 100%; height: 200px; margin-top: 8px; }
.sub-card-name { cursor: help; }

.sub-carteras-summary p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 12px;
    background: rgba(255,255,255,0.02);
    border-left: 3px solid var(--accent-blue, #6c8cff);
    border-radius: 4px;
}
.sub-carteras-summary p strong { color: var(--text-primary); }

@media (max-width: 768px) {
    .sub-carteras-grid { grid-template-columns: 1fr; }
}
/* === /F3 === */

/* === F4: Tab Refugio === */
.refugio-tab { display: flex; flex-direction: column; gap: 24px; }
.refugio-tab section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 20px;
}
.refugio-tab section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    font-weight: 500;
}

.refugio-context p { margin: 0; color: var(--text-secondary); line-height: 1.6; }
.refugio-context code {
    background: rgba(255,255,255,0.06);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.85em;
    color: var(--text-primary);
}

/* F2.4 — banner ficha refugio + chart histórico */
.refugio-context .context-headline {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 8px !important;
}
.refugio-context .context-steps {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}
.refugio-context .context-steps li { margin-bottom: 6px; }
.refugio-context .context-steps li:last-child { margin-bottom: 0; }

.refugio-history { margin-top: 24px; }
.refugio-history .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}
.refugio-history .history-controls {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.refugio-history .metric-toggle { display: inline-flex; gap: 4px; }
.refugio-history .metric-toggle .btn-sm {
    padding: 4px 12px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
}
.refugio-history .metric-toggle .btn-active {
    background: var(--accent-green, #4ade80);
    color: #0b0f12;
    border-color: var(--accent-green, #4ade80);
}
.refugio-history .lookback-selector { display: inline-flex; gap: 4px; }
.refugio-history .lookback-selector .btn-sm {
    padding: 4px 10px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
}
.refugio-history .lookback-selector .btn-active {
    background: var(--accent-blue, #6c8cff);
    color: #fff;
    border-color: var(--accent-blue, #6c8cff);
}

.refugio-table th.sortable { cursor: pointer; user-select: none; }
.refugio-table th.sortable:hover { color: var(--text-primary); }
.refugio-table th.sort-active { color: var(--accent-blue, #6c8cff); }
.refugio-table th.sort-active::after { content: ' ↕'; opacity: 0.6; }

.refugio-table tbody tr.refugio-top3-row { background: rgba(74,222,128,0.04); }
.refugio-table tbody tr.refugio-top3-row td:first-child { border-left: 3px solid var(--accent-green, #4ade80); }

.refugio-table td .text-muted.small { display: block; font-size: 0.7rem; margin-top: 2px; }

.refugio-helds-note {
    margin: 12px 0 0 0;
    padding: 10px 12px;
    background: rgba(255,255,255,0.02);
    border-left: 3px solid var(--text-muted);
    border-radius: 4px;
    line-height: 1.5;
}
/* === /F4 === */

/* === F5: Widget noticias últimos 7d === */
.news-widget .card-header { padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); }
.news-by-ticker { padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 14px; }

.news-group { display: flex; flex-direction: column; gap: 4px; }
.news-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle);
}
.news-group-header strong { font-size: 0.95rem; color: var(--text-primary); }
.news-counts { display: flex; gap: 4px; }
.news-counts .badge { font-size: 0.65rem; padding: 1px 6px; }

.news-list { list-style: none; padding: 0; margin: 4px 0 0; display: flex; flex-direction: column; gap: 2px; }
.news-item {
    display: grid;
    grid-template-columns: 10px 1fr auto;
    gap: 8px;
    align-items: baseline;
    padding: 4px 0;
    font-size: 0.85rem;
}
.news-dot {
    width: 8px; height: 8px; border-radius: 50%;
    display: inline-block;
    margin-top: 6px;
}
.news-dot.dot-negative { background: var(--accent-red, #ff4444); }
.news-dot.dot-neutral  { background: #71717a; }
.news-dot.dot-positive { background: var(--accent-green, #4ade80); }

.news-title {
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.35;
}
.news-title:hover { color: var(--accent-blue, #6c8cff); text-decoration: underline; }
.news-date { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }

.news-item.news-negative .news-title { color: #ffb4b4; }
/* === /F5 === */

/* === F6: Tab Ficha técnica === */
.ficha-tab { display: flex; flex-direction: column; gap: 24px; }
.ficha-tab section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 20px;
}
.ficha-tab section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    font-weight: 500;
}

.ficha-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.ficha-header-left { display: flex; flex-direction: column; gap: 6px; }
.ficha-title { font-size: 1.5rem; margin: 0; color: var(--text-primary); font-weight: 600; }
.ficha-subtitle { margin: 0; display: flex; align-items: center; gap: 10px; }
.ficha-header-right {
    display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
}
.ficha-dd-threshold { font-size: 1.4rem; color: var(--accent-yellow, #facc15); font-variant-numeric: tabular-nums; }

.ficha-description-text {
    margin: 0;
    color: var(--text-secondary);
    font-family: inherit;
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 0.9rem;
}

.ficha-params .data-table { font-size: 0.85rem; }
.ficha-params .data-table td:first-child { font-family: ui-monospace, monospace; }

.ficha-audits .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.ficha-audits .section-header h3 { margin-bottom: 0; }
/* === /F6 === */

/* === F2.5 — Ficha técnica visual / infografía === */
.ficha-hero {
    background: linear-gradient(135deg, rgba(108,140,255,0.06), rgba(74,222,128,0.04));
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 20px 22px;
}
.ficha-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.ficha-hero .ficha-title { margin: 0; font-size: 1.6rem; font-weight: 700; color: var(--text-primary); }
.ficha-hero .ficha-subtitle { margin: 4px 0 0 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 0.85rem; }
.ficha-hero .ficha-subtitle code {
    background: rgba(255,255,255,0.06);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.85em;
}
.ficha-hero .ficha-headline {
    margin: 4px 0 16px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.ficha-hero .ficha-dd-pill {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding: 8px 14px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 8px;
}
.ficha-hero .ficha-dd-pill strong { color: var(--accent-red, #ef4444); font-size: 1.15rem; }

.ficha-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.metric-card {
    background: rgba(0,0,0,0.18);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}
.metric-card .metric-label {
    font-size: 0.72rem;
    color: var(--text-muted, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.metric-card .metric-value {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 4px 0;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}
.metric-card .metric-foot {
    font-size: 0.72rem;
    color: var(--text-muted, #888);
}
.metric-cagr .metric-value   { color: var(--accent-green, #4ade80); }
.metric-sharpe .metric-value { color: #60a5fa; }
.metric-calmar .metric-value { color: #a78bfa; }
.metric-dd .metric-value     { color: var(--accent-red, #ef4444); }

/* Pipeline timeline */
.ficha-pipeline { background: rgba(255,255,255,0.02); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 16px 20px; }
.pipeline-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pipeline-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 10px 12px;
    background: rgba(0,0,0,0.15);
    border-left: 3px solid var(--accent-blue, #6c8cff);
    border-radius: 4px;
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.pipeline-step:hover { transform: translateX(2px); border-left-color: var(--accent-green, #4ade80); }
.pipeline-num {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent-blue, #6c8cff);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.pipeline-body { flex: 1; }
.pipeline-title { font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.pipeline-detail { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.45; }

/* Universo + Setup (2 cols) */
.ficha-univ-setup {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}
.ficha-card-block {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 16px 20px;
}
.ficha-card-block h3 { margin-top: 0 !important; }
.ficha-card-block p { color: var(--text-secondary); line-height: 1.55; margin: 0; }
.ficha-card-block .data-table.compact td {
    padding: 6px 0;
    font-size: 0.85rem;
}
@media (max-width: 768px) {
    .ficha-univ-setup { grid-template-columns: 1fr; }
}

/* Capital mínimo cards */
.capital-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.capital-card {
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: rgba(0,0,0,0.18);
}
.capital-card .capital-amount {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.capital-card .capital-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 2px 0 8px;
    font-weight: 600;
}
.capital-card .capital-comment {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}
.capital-card.band-no       { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.08); }
.capital-card.band-no .capital-label       { color: var(--accent-red, #ef4444); }
.capital-card.band-marginal { border-color: rgba(250,204,21,0.4); background: rgba(250,204,21,0.07); }
.capital-card.band-marginal .capital-label { color: var(--accent-yellow, #facc15); }
.capital-card.band-ok       { border-color: rgba(74,222,128,0.4); background: rgba(74,222,128,0.07); }
.capital-card.band-ok .capital-label       { color: var(--accent-green, #4ade80); }
.capital-card.band-great    { border-color: rgba(108,140,255,0.4); background: rgba(108,140,255,0.08); }
.capital-card.band-great .capital-label    { color: var(--accent-blue, #6c8cff); }

/* Parámetros agrupados */
.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.params-group {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 14px 16px;
}
.params-group h4 {
    margin: 0 0 10px;
    font-size: 0.92rem;
    color: var(--accent-blue, #6c8cff);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 6px;
}
.params-group .data-table.compact td { padding: 5px 0; font-size: 0.83rem; }
.params-group .data-table.compact td:first-child { color: var(--text-secondary); }
/* === /F2.5 === */

/* === F2.6 — Mini-fichas de las 6 sub-carteras === */
.ficha-sub-systems {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 16px 20px;
}
.ficha-sub-systems .section-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 14px;
}
.ficha-sub-systems .section-header h3 { margin-bottom: 0 !important; }

.sub-systems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 14px;
}
.sub-system-card {
    background: rgba(0,0,0,0.18);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.15s ease;
}
.sub-system-card:hover { border-color: var(--text-muted, #888); }
.sub-system-card.sub-defensiva { border-left: 3px solid var(--accent-green, #4ade80); }
.sub-system-card.sub-growth    { border-left: 3px solid var(--accent-yellow, #f59e0b); }

.sub-system-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.sub-system-name {
    font-family: ui-monospace, monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 600;
    word-break: break-word;
}
.sub-system-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sub-system-selector {
    background: rgba(255,255,255,0.03);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.sub-system-selector .selector-label {
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.5px;
    color: var(--text-muted, #888);
    margin-right: 6px;
    font-weight: 600;
}
.sub-system-selector strong { color: var(--text-primary); }

.sub-system-rationale {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    min-height: 2.4em;
}

.sub-system-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}
.sub-system-stats .stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.sub-system-stats .stat-label {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted, #888);
    font-weight: 600;
}
.sub-system-stats .stat-value {
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

.sub-system-chart-wrap {
    margin-top: 4px;
    background: rgba(0,0,0,0.15);
    padding: 4px;
    border-radius: 4px;
}
.sub-system-chart-foot {
    text-align: center;
    margin-top: 4px;
    font-size: 0.7rem;
}
/* === /F2.6 === */

@media (max-width: 1024px) {
  .grid-mosaic { grid-template-columns: repeat(2, 1fr); }
  .grid-mosaic .card-large { grid-column: span 2; }
  .grid-mosaic .card-full { grid-column: span 2; }
}
@media (max-width: 640px) {
  .grid-mosaic { grid-template-columns: 1fr; }
  .grid-mosaic .card-large, .grid-mosaic .card-full { grid-column: span 1; }
}

/* F1 Task 6: home card pins */
.card-pins {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 1;
}
.pin {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.pin-rbal { background: rgba(250,204,21,0.15); color: #facc15; border: 1px solid rgba(250,204,21,0.3); }
.pin-dd { background: rgba(255,68,68,0.15); color: #ff4444; border: 1px solid rgba(255,68,68,0.3); }
.pin-news { background: rgba(255,68,68,0.15); color: #ff4444; border: 1px solid rgba(255,68,68,0.3); }
.pin-regime { background: rgba(250,204,21,0.15); color: #facc15; border: 1px solid rgba(250,204,21,0.3); }

.strategy-card { position: relative; }

/* F1 Task 7: system pill + modal */
.system-pill-row {
  display: flex;
  justify-content: flex-end;
  position: relative;
  margin-bottom: 12px;
}
.system-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
  user-select: none;
}
.system-pill:hover { transform: translateY(-1px); }
.pill-green { background: rgba(74,222,128,0.1); color: #4ade80; border-color: rgba(74,222,128,0.3); }
.pill-amber { background: rgba(250,204,21,0.1); color: #facc15; border-color: rgba(250,204,21,0.3); }
.pill-red { background: rgba(255,68,68,0.1); color: #ff4444; border-color: rgba(255,68,68,0.3); }

.system-modal {
  position: absolute;
  top: 36px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--bg-secondary, #18181b);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
  z-index: 100;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-weight: 600;
}
.modal-header button { background: transparent; border: 0; color: var(--text-muted); font-size: 18px; cursor: pointer; }
.modal-body { padding: 12px 16px; }
.modal-body ul { list-style: none; padding: 0; margin: 0; }
.modal-body li { padding: 6px 0; font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.alert-level { font-size: 9px; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; flex-shrink: 0; font-weight: 700; }
.alert-error .alert-level { background: rgba(255,68,68,0.2); color: #ff4444; }
.alert-warn .alert-level { background: rgba(250,204,21,0.2); color: #facc15; }
.alert-info .alert-level { background: rgba(108,140,255,0.2); color: #6c8cff; }

[x-cloak] { display: none !important; }

/* F1 Task 8: NYSE market banner */
.market-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(108,140,255,0.06);
  border: 1px solid rgba(108,140,255,0.15);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.banner-icon { font-size: 14px; }

/* === F1.1: Sub-cartera por pata (defensiva + growth side-by-side) === */
.sub-pata-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.sub-pata {
  border-left: 2px solid var(--border-subtle);
  padding-left: 10px;
}
.sub-pata-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.sub-pata-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.sub-pata-sharpe {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
