/* AlertaTrading - Dark Fintech Design System */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --at-bg: #0b0f19;
    --at-bg-elevated: #0f1524;
    --at-surface: #131a27;
    --at-surface-hover: #1a2332;
    --at-border: #1e293b;
    --at-border-light: #334155;
    --at-text: #e2e8f0;
    --at-text-muted: #94a3b8;
    --at-text-dim: #64748b;
    --at-primary: #3b82f6;
    --at-primary-hover: #2563eb;
    --at-success: #10b981;
    --at-danger: #ef4444;
    --at-warning: #f59e0b;
    --at-info: #06b6d4;
    --at-sidebar-width: 260px;
    --at-radius: 10px;
    --at-radius-sm: 6px;
    --at-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --at-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--at-font);
    background: var(--at-bg);
    color: var(--at-text);
    min-height: 100vh;
    font-variant-numeric: tabular-nums;
}

body.at-public { background: linear-gradient(160deg, #0b0f19 0%, #111827 50%, #0f172a 100%); }

a { color: var(--at-primary); text-decoration: none; }
a:hover { color: #60a5fa; }

/* Layout */
.at-app { display: flex; min-height: 100vh; }
.at-main {
    flex: 1;
    margin-left: var(--at-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.at-content { flex: 1; padding: 1.5rem 2rem 2rem; max-width: 1400px; width: 100%; }
.at-public-wrap { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }

/* Sidebar */
.at-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--at-sidebar-width);
    height: 100vh;
    background: var(--at-bg-elevated);
    border-right: 1px solid var(--at-border);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.25s ease;
}
.at-sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--at-border);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--at-text);
}
.at-sidebar-brand i { color: var(--at-primary); font-size: 1.4rem; }
.at-sidebar-nav { flex: 1; overflow-y: auto; padding: 0.75rem 0.65rem; }
.at-nav-section { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--at-text-dim); padding: 0.75rem 0.75rem 0.35rem; font-weight: 600; }
.at-nav-link {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--at-radius-sm);
    color: var(--at-text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.15s ease;
}
.at-nav-link:hover { background: var(--at-surface-hover); color: var(--at-text); }
.at-nav-link.active { background: rgba(59, 130, 246, 0.15); color: var(--at-primary); }
.at-nav-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; }
.at-sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--at-border);
}
.at-user-chip {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem;
    border-radius: var(--at-radius-sm);
    color: var(--at-text-muted);
    font-size: 0.8rem;
}
.at-user-chip i { font-size: 1.5rem; color: var(--at-primary); }
.at-sidebar-toggle {
    display: none;
    position: fixed; top: 0.75rem; left: 0.75rem; z-index: 1050;
    background: var(--at-surface);
    border: 1px solid var(--at-border);
    color: var(--at-text);
    border-radius: var(--at-radius-sm);
    padding: 0.4rem 0.6rem;
}

/* Page header */
.at-page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.at-page-header h1, .at-page-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.at-page-header .at-subtitle { color: var(--at-text-muted); font-size: 0.875rem; margin-top: 0.25rem; }

/* Cards */
.card {
    background: var(--at-surface);
    border: 1px solid var(--at-border);
    border-radius: var(--at-radius);
    color: var(--at-text);
    box-shadow: none;
}
.card:hover { box-shadow: var(--at-shadow); }
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--at-border);
    color: var(--at-text);
    font-weight: 600;
    padding: 0.85rem 1.15rem;
}
.card-body { padding: 1.15rem; }
.card-footer { background: transparent; border-top: 1px solid var(--at-border); }

/* KPI cards */
.at-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.at-kpi-card {
    background: var(--at-surface);
    border: 1px solid var(--at-border);
    border-radius: var(--at-radius);
    padding: 1.15rem;
    position: relative;
    overflow: hidden;
}
.at-kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--at-kpi-accent, var(--at-primary));
}
.at-kpi-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--at-text-muted); margin-bottom: 0.35rem; }
.at-kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--at-text); }
.at-kpi-icon { position: absolute; top: 1rem; right: 1rem; font-size: 1.5rem; opacity: 0.25; color: var(--at-kpi-accent, var(--at-primary)); }
.at-kpi-card.accent-primary { --at-kpi-accent: var(--at-primary); }
.at-kpi-card.accent-success { --at-kpi-accent: var(--at-success); }
.at-kpi-card.accent-danger { --at-kpi-accent: var(--at-danger); }
.at-kpi-card.accent-warning { --at-kpi-accent: var(--at-warning); }

/* Tables */
.at-data-table { width: 100%; margin: 0; color: var(--at-text); }
.at-data-table thead th {
    background: var(--at-bg-elevated);
    border-bottom: 1px solid var(--at-border);
    color: var(--at-text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}
.at-data-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--at-border);
    vertical-align: middle;
    font-size: 0.875rem;
}
.at-data-table tbody tr:hover { background: var(--at-surface-hover); }
.table { color: var(--at-text); --bs-table-bg: transparent; --bs-table-color: var(--at-text); }
.table thead th { background: var(--at-bg-elevated); border-color: var(--at-border); color: var(--at-text-muted); }
.table td, .table th { border-color: var(--at-border); }
.table-hover tbody tr:hover { background: var(--at-surface-hover); color: var(--at-text); }

/* Badges */
.at-badge {
    display: inline-flex; align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.at-badge-cfd { background: rgba(59,130,246,0.15); color: #60a5fa; }
.at-badge-accion { background: rgba(16,185,129,0.15); color: #34d399; }
.at-badge-abierta { background: rgba(16,185,129,0.15); color: var(--at-success); }
.at-badge-cerrada { background: rgba(148,163,184,0.15); color: var(--at-text-muted); }
.at-badge-positivo { background: rgba(16,185,129,0.15); color: var(--at-success); }
.at-badge-negativo { background: rgba(239,68,68,0.15); color: var(--at-danger); }
.at-badge-neutral { background: rgba(148,163,184,0.15); color: var(--at-text-muted); }

/* P&L colors */
.ganancia, .text-gain { color: var(--at-success) !important; font-weight: 600; }
.perdida, .text-loss { color: var(--at-danger) !important; font-weight: 600; }

/* Buttons */
.btn { font-weight: 500; border-radius: var(--at-radius-sm); font-size: 0.875rem; }
.btn-primary { background: var(--at-primary); border-color: var(--at-primary); }
.btn-primary:hover { background: var(--at-primary-hover); border-color: var(--at-primary-hover); }
.btn-outline-secondary { color: var(--at-text-muted); border-color: var(--at-border-light); }
.btn-outline-secondary:hover { background: var(--at-surface-hover); color: var(--at-text); border-color: var(--at-border-light); }
.btn-success { background: var(--at-success); border-color: var(--at-success); }
.btn-danger { background: var(--at-danger); border-color: var(--at-danger); }

/* Forms */
.form-control, .form-select {
    background: var(--at-bg-elevated);
    border: 1px solid var(--at-border);
    color: var(--at-text);
    border-radius: var(--at-radius-sm);
}
.form-control:focus, .form-select:focus {
    background: var(--at-bg-elevated);
    border-color: var(--at-primary);
    color: var(--at-text);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.form-control::placeholder { color: var(--at-text-dim); }
.form-label { color: var(--at-text-muted); font-size: 0.875rem; font-weight: 500; }
.input-group-text { background: var(--at-surface); border-color: var(--at-border); color: var(--at-text-muted); }
.form-text { color: var(--at-text-dim); }
.form-check-input { background-color: var(--at-bg-elevated); border-color: var(--at-border-light); }
.form-check-input:checked { background-color: var(--at-primary); border-color: var(--at-primary); }

.form-control[readonly], .form-control.at-calculated {
    background: var(--at-surface);
    color: var(--at-text);
    cursor: default;
    opacity: 1;
}

.at-riesgo-alto { background: rgba(239, 68, 68, 0.15) !important; color: #f87171 !important; }
.at-riesgo-medio { background: rgba(245, 158, 11, 0.15) !important; color: #fbbf24 !important; }
.at-riesgo-bajo { background: rgba(16, 185, 129, 0.15) !important; color: #34d399 !important; }

/* Alerts */
.alert { border: 1px solid var(--at-border); border-radius: var(--at-radius-sm); }
.alert-success { background: rgba(16,185,129,0.1); color: #34d399; border-color: rgba(16,185,129,0.25); }
.alert-danger, .alert-error { background: rgba(239,68,68,0.1); color: #f87171; border-color: rgba(239,68,68,0.25); }
.alert-warning { background: rgba(245,158,11,0.1); color: #fbbf24; border-color: rgba(245,158,11,0.25); }
.alert-info { background: rgba(6,182,212,0.1); color: #22d3ee; border-color: rgba(6,182,212,0.25); }

/* Empty state */
.at-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--at-text-muted);
}
.at-empty-state i { font-size: 2.5rem; opacity: 0.35; margin-bottom: 1rem; display: block; }

/* Hero landing */
.at-hero {
    text-align: center;
    padding: 4rem 1rem 3rem;
    background: radial-gradient(ellipse at 50% 0%, rgba(59,130,246,0.12) 0%, transparent 60%);
}
.at-hero h1 { font-size: 2.75rem; font-weight: 800; margin-bottom: 1rem; }
.at-hero .lead { color: var(--at-text-muted); font-size: 1.15rem; max-width: 600px; margin: 0 auto 2rem; }
.at-feature-card {
    background: var(--at-surface);
    border: 1px solid var(--at-border);
    border-radius: var(--at-radius);
    padding: 1.75rem;
    height: 100%;
    transition: border-color 0.2s, transform 0.2s;
}
.at-feature-card:hover { border-color: var(--at-primary); transform: translateY(-2px); }
.at-feature-card i { font-size: 2rem; color: var(--at-primary); margin-bottom: 1rem; }

/* Auth card */
.at-auth-card {
    background: var(--at-surface);
    border: 1px solid var(--at-border);
    border-radius: var(--at-radius);
    padding: 2.5rem;
    max-width: 420px;
    margin: 2rem auto;
    box-shadow: var(--at-shadow);
}

/* Tabs */
.nav-tabs { border-bottom-color: var(--at-border); }
.nav-tabs .nav-link { color: var(--at-text-muted); border: none; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link:hover { color: var(--at-text); border-color: transparent; }
.nav-tabs .nav-link.active { color: var(--at-primary); background: transparent; border-bottom-color: var(--at-primary); }

/* Dropdown */
.dropdown-menu { background: var(--at-surface); border: 1px solid var(--at-border); box-shadow: var(--at-shadow); }
.dropdown-item { color: var(--at-text-muted); }
.dropdown-item:hover { background: var(--at-surface-hover); color: var(--at-text); }
.dropdown-divider { border-color: var(--at-border); }

/* Pagination */
.pagination .page-link { background: var(--at-surface); border-color: var(--at-border); color: var(--at-text-muted); }
.pagination .page-link:hover { background: var(--at-surface-hover); color: var(--at-text); }
.pagination .page-item.active .page-link { background: var(--at-primary); border-color: var(--at-primary); }

/* Mobile cards for tables */
.at-mobile-cards { display: none; }
.at-position-card {
    background: var(--at-surface);
    border: 1px solid var(--at-border);
    border-radius: var(--at-radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

/* Chart container */
.at-chart-wrap { position: relative; height: 300px; }
canvas { max-height: 400px; }

/* Skeleton */
.at-skeleton {
    background: linear-gradient(90deg, var(--at-surface) 25%, var(--at-surface-hover) 50%, var(--at-surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--at-radius-sm);
    height: 1rem;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* Footer */
.at-footer { padding: 1rem 2rem; border-top: 1px solid var(--at-border); color: var(--at-text-dim); font-size: 0.75rem; text-align: center; }

/* Noticias / alertas items */
.at-news-item { padding: 1rem 0; border-bottom: 1px solid var(--at-border); }
.at-news-item:last-child { border-bottom: none; }
.alerta-critica { border-left: 3px solid var(--at-danger); padding-left: 1rem; }
.alerta-advertencia { border-left: 3px solid var(--at-warning); padding-left: 1rem; }
.alerta-info { border-left: 3px solid var(--at-info); padding-left: 1rem; }

.modal-content { background: var(--at-surface); border: 1px solid var(--at-border); color: var(--at-text); }
.modal-header, .modal-footer { border-color: var(--at-border); background: var(--at-surface); }
.modal-body { background: var(--at-surface); }
.modal-backdrop.show { opacity: 0.75; }
.btn-close { filter: invert(1); }

#modalSugerenciasIA .at-modal-sugerencias,
#modalSugerenciasIA .modal-content {
    background-color: #131a27 !important;
    border: 1px solid var(--at-border);
    box-shadow: var(--at-shadow);
}
#modalSugerenciasIA .modal-header,
#modalSugerenciasIA .modal-body,
#modalSugerenciasIA .modal-footer {
    background-color: #131a27 !important;
}
#modalSugerenciasIA .at-sugerencia-card {
    background: var(--at-bg-elevated);
    border: 1px solid var(--at-border) !important;
}
.at-desglose-score {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--at-border);
}
.at-consenso-tecnico {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--at-border);
}
.at-accion-sugerida {
    background: rgba(0, 0, 0, 0.1);
}
.at-terminal-panel {
    background: #0a0e14;
    border: 1px solid #1e3a2f;
    border-radius: 6px;
    overflow: hidden;
}
.at-terminal-title {
    background: #111820;
    color: #4ade80;
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid #1e3a2f;
    text-transform: uppercase;
}
.at-terminal-body {
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.72rem;
    line-height: 1.45;
    color: #94a3b8;
    padding: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 320px;
    overflow-y: auto;
}
.at-term-line { margin: 0; }
.at-term-header { color: #4ade80; }
.at-term-section { color: #64748b; font-weight: 600; margin-top: 0.25rem; }
.at-term-highlight { color: #e2e8f0; font-weight: 600; }
.at-term-ok { color: #4ade80; }
.at-term-pending { color: #fbbf24; }
.at-term-explain { color: #cbd5e1; }
.at-confirmacion-panel {
    background: rgba(251, 191, 36, 0.06);
    border: 1px solid rgba(251, 191, 36, 0.25);
}
.at-sug-tabs { border-bottom-color: var(--at-border); }
.at-sug-tabs .nav-link { color: var(--at-text-muted); font-size: 0.75rem; border: none; }
.at-sug-tabs .nav-link.active { color: #4ade80; background: transparent; border-bottom: 2px solid #4ade80; }
.at-sug-tab-body { min-height: 120px; max-height: 280px; overflow-y: auto; }

.at-op-dir-row .at-dir-badge,
.at-op-dir-row .at-hor-badge {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35em 0.55em;
}

.at-op-dir-row .at-hor-badge {
    font-weight: 500;
}
.at-metric-block-title { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--at-text-muted); margin-bottom: 0.35rem; font-weight: 600; }
.at-metric-table td { padding: 0.15rem 0; font-size: 0.78rem; }
.at-resumen-ejecutivo { line-height: 1.45; color: #cbd5e1; }
.at-prob-bar { background: rgba(0,0,0,0.3); }

/* Modal análisis IA — dashboard posición */
.at-analisis-section {
    border: 1px solid var(--at-border);
    border-radius: var(--at-radius);
    padding: 1rem;
    background: var(--at-surface);
}
.at-analisis-opinion {
    background: var(--at-bg-elevated, rgba(0,0,0,0.15));
    border-color: rgba(74, 222, 128, 0.25);
}
.at-opinion-block + .at-opinion-block {
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(255,255,255,0.06);
}
.at-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--at-text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}
.at-sl-tp-ladder { line-height: 1.5; }
.at-sl-tp-actual {
    background: rgba(74, 222, 128, 0.12);
    border-left: 3px solid #4ade80;
}
.at-recorrido-track {
    height: 10px;
    background: rgba(239, 68, 68, 0.25);
    border-radius: 5px;
    overflow: visible;
}
.at-recorrido-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
    border-radius: 5px 0 0 5px;
    max-width: 100%;
}
.at-recorrido-marker {
    position: absolute;
    top: -3px;
    width: 4px;
    height: 16px;
    background: #fff;
    border-radius: 2px;
    transform: translateX(-50%);
    box-shadow: 0 0 4px rgba(0,0,0,0.5);
}
.at-confianza-bar { background: rgba(0,0,0,0.25); }

.at-explain-compact { background: rgba(0,0,0,0.15); border: 1px solid var(--at-border); }
.at-footer-datos {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem 0.5rem;
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    font-size: 0.72rem;
}
@media (max-width: 576px) {
    .at-footer-datos { grid-template-columns: repeat(2, 1fr); }
}
.at-footer-cell {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    cursor: default;
}
.at-footer-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--at-text-muted);
}
.at-footer-value {
    color: #e2e8f0;
    font-weight: 500;
}

.text-muted { color: var(--at-text-muted) !important; }

/* Responsive */
@media (max-width: 991px) {
    .at-sidebar { transform: translateX(-100%); }
    .at-sidebar.open { transform: translateX(0); }
    .at-main { margin-left: 0; }
    .at-sidebar-toggle { display: block; }
    .at-content { padding: 1rem; padding-top: 3.5rem; }
    .at-desktop-table { display: none; }
    .at-mobile-cards { display: block; }
}
@media (max-width: 576px) {
    .at-hero h1 { font-size: 2rem; }
    .at-kpi-value { font-size: 1.25rem; }
}

/* ===== Watchlist / Activos para análisis ===== */
.at-asset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.at-asset-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.55rem 0.45rem 0.5rem;
    background: var(--at-surface);
    border: 1px solid var(--at-border);
    border-left: 3px solid var(--at-border-light);
    border-radius: var(--at-radius);
    transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.at-asset-chip:hover {
    transform: translateY(-1px);
    background: var(--at-surface-hover);
}

.at-asset-chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.at-asset-chip-body {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.at-asset-chip-ticker {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--at-text);
    letter-spacing: 0.02em;
}

.at-asset-chip-type {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--at-text-muted);
}

.at-asset-chip-quote {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.15;
    padding-left: 0.4rem;
    margin-left: 0.1rem;
    border-left: 1px solid var(--at-border);
}

.at-asset-chip-price {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--at-text);
    font-variant-numeric: tabular-nums;
}

.at-asset-chip-var {
    font-size: 0.7rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--at-text-dim);
}
.at-asset-chip-var.is-up { color: var(--at-success); }
.at-asset-chip-var.is-down { color: var(--at-danger); }

.at-asset-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--at-text-dim);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.at-asset-chip-remove:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--at-danger);
}

.at-asset-chip-ia {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--at-text-dim);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}
.at-asset-chip-ia:hover {
    background: rgba(59, 130, 246, 0.15);
    color: var(--at-primary);
}
.at-asset-chip-ia:disabled { opacity: 0.6; cursor: default; }

/* Colores por tipo de activo */
.at-asset-chip.tipo-cfd { border-left-color: var(--at-primary); }
.at-asset-chip.tipo-cfd .at-asset-chip-icon { background: rgba(59, 130, 246, 0.15); color: var(--at-primary); }
.at-asset-chip.tipo-accion { border-left-color: var(--at-success); }
.at-asset-chip.tipo-accion .at-asset-chip-icon { background: rgba(16, 185, 129, 0.15); color: var(--at-success); }
.at-asset-chip.tipo-indice { border-left-color: #8b5cf6; }
.at-asset-chip.tipo-indice .at-asset-chip-icon { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.at-asset-chip.tipo-divisa { border-left-color: var(--at-warning); }
.at-asset-chip.tipo-divisa .at-asset-chip-icon { background: rgba(245, 158, 11, 0.15); color: var(--at-warning); }
.at-asset-chip.tipo-commodity { border-left-color: var(--at-info); }
.at-asset-chip.tipo-commodity .at-asset-chip-icon { background: rgba(6, 182, 212, 0.15); color: var(--at-info); }

.at-watchlist-empty {
    padding: 1.75rem 1rem;
    border: 1px dashed var(--at-border-light);
    border-radius: var(--at-radius);
    color: var(--at-text-muted);
    margin-bottom: 1rem;
}
.at-watchlist-empty .bi { font-size: 1.75rem; opacity: 0.5; }

.at-asset-add {
    padding-top: 0.85rem;
    border-top: 1px solid var(--at-border);
}

/* ===== Barra visual SL / entrada / precio / TP ===== */
.at-tpsl {
    margin: 0.5rem 0 2.25rem;
}
.at-tpsl-track {
    position: relative;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(90deg,
        rgba(239, 68, 68, 0.55) 0%,
        rgba(239, 68, 68, 0.18) 35%,
        rgba(148, 163, 184, 0.18) 50%,
        rgba(16, 185, 129, 0.18) 65%,
        rgba(16, 185, 129, 0.55) 100%);
}
.at-tpsl-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 18px;
    border-radius: 2px;
}
.at-tpsl-marker.is-sl { background: var(--at-danger); }
.at-tpsl-marker.is-tp { background: var(--at-success); }
.at-tpsl-marker.is-entry { background: var(--at-text-muted); }
.at-tpsl-marker.is-current {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--at-bg);
    background: var(--at-primary);
    box-shadow: 0 0 0 2px var(--at-primary);
}
.at-agg {
    padding: 0.75rem 1rem 0.9rem;
    border: 1px solid var(--at-border, rgba(148, 163, 184, 0.25));
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.05);
}
.at-agg-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8rem;
    margin-bottom: 0.6rem;
}
.at-agg-track {
    position: relative;
    height: 10px;
    border-radius: 6px;
    background: linear-gradient(90deg,
        rgba(239, 68, 68, 0.55) 0%,
        rgba(239, 68, 68, 0.18) 40%,
        rgba(148, 163, 184, 0.20) 50%,
        rgba(16, 185, 129, 0.18) 60%,
        rgba(16, 185, 129, 0.55) 100%);
}
.at-agg-fill {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 6px;
}
.at-aggfill-pos { background: rgba(16, 185, 129, 0.85); }
.at-aggfill-neg { background: rgba(239, 68, 68, 0.85); }
.at-agg-zero {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 16px;
    background: var(--at-text-muted, #94a3b8);
    transform: translateX(-50%);
}
.at-agg-marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--at-bg, #0f172a);
    background: var(--at-primary, #3b82f6);
    box-shadow: 0 0 0 2px var(--at-primary, #3b82f6);
    z-index: 2;
}
.at-agg-foot {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.55rem;
}
.at-tpsl-label {
    position: absolute;
    top: 16px;
    transform: translateX(-50%);
    font-size: 0.62rem;
    line-height: 1.1;
    white-space: nowrap;
    text-align: center;
    color: var(--at-text-muted);
}
.at-tpsl-label .v { display: block; font-weight: 700; color: var(--at-text); }
.at-tpsl-label.is-sl .v { color: var(--at-danger); }
.at-tpsl-label.is-tp .v { color: var(--at-success); }
.at-tpsl-label.is-current .v { color: var(--at-primary); }

/* ===== Exposición por sector ===== */
.at-sector-row { margin-bottom: 0.85rem; }
.at-sector-row:last-child { margin-bottom: 0; }
.at-sector-track {
    height: 8px;
    border-radius: 5px;
    background: var(--at-bg-elevated);
    overflow: hidden;
}
.at-sector-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}

/* ===== Alertas inteligentes (operativas) ===== */
.at-op-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--at-radius-sm);
    border-left: 3px solid var(--at-border-light);
    background: var(--at-surface);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--at-text);
}
.at-op-alert:last-child { margin-bottom: 0; }
.at-op-alert i { font-size: 1rem; margin-top: 1px; flex-shrink: 0; }
.at-op-alert-peligro { border-left-color: var(--at-danger); }
.at-op-alert-aviso { border-left-color: var(--at-warning); }
.at-op-alert-exito { border-left-color: var(--at-success); }
