@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;800&family=Syne:wght@400;500;600;700&display=swap');

:root {
    --bg-dark: #0a0a0c;
    --sidebar-bg: rgba(18, 18, 23, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-hover: rgba(255, 255, 255, 0.06);
    --accent: #7c4dff;
    --accent-glow: rgba(124, 77, 255, 0.3);
    --accent-soft: rgba(124, 77, 255, 0.12);
    --text-main: #e8e8f0;
    --text-dim: #b8b8cc;
    --text-muted: #9898b4;
    --text-faint: #8080a0;
    --success: #00e676;
    --error: #ff5252;
    --warning: #ffd740;
    --info: #40c4ff;
    --font-main: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }

/* ── Scrollbar global — tema oscuro con accent ── */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: rgba(124, 77, 255, 0.25);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(124, 77, 255, 0.45); border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: rgba(124, 77, 255, 0.25) transparent; }

body {
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    overflow: hidden;
    height: 100vh;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

.app-container { display: flex; height: 100vh; }

/* ── Sidebar (collapsible: 48px → 240px on hover) ── */
.sidebar {
    width: 48px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    z-index: 100;
    transition: width 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}
.sidebar.expanded {
    width: 260px;
    padding: 20px;
}

.logo { display: flex; align-items: center; gap: 0; margin-bottom: 32px; white-space: nowrap; width: 100%; justify-content: center; }
.sidebar.expanded .logo { justify-content: flex-start; gap: 10px; }
.logo-icon { color: var(--accent); filter: drop-shadow(0 0 8px var(--accent-glow)); flex-shrink: 0; width: 24px; height: 24px; }
.logo-text {
    font-size: 1.2rem; font-weight: 800; letter-spacing: -0.5px;
    opacity: 0; transition: opacity 0.15s ease;
    overflow: hidden; width: 0;
}
.sidebar.expanded .logo-text { opacity: 1; width: auto; }
.accent { color: var(--accent); }

.nav-menu { flex: 1; display: flex; flex-direction: column; gap: 4px; width: 100%; }

.nav-item {
    display: flex; align-items: center; gap: 0;
    padding: 10px 0; border-radius: 10px;
    text-decoration: none; color: var(--text-dim);
    transition: all 0.2s ease;
    white-space: nowrap;
    justify-content: center;
    background: transparent;
    box-shadow: none;
    width: 100%;
}
.sidebar.expanded .nav-item { padding: 10px 16px; justify-content: flex-start; gap: 12px; }
.nav-item:hover { color: var(--text-main); }
.sidebar.expanded .nav-item:hover { background: var(--glass-bg); }
.nav-item.active { color: var(--accent); }
.sidebar.expanded .nav-item.active { background: var(--accent-glow); color: var(--text-main); box-shadow: inset 0 0 0 1px var(--accent); }
.nav-item i { width: 20px; height: 20px; flex-shrink: 0; }
.nav-label {
    opacity: 0; transition: opacity 0.15s ease;
    overflow: hidden; width: 0;
}
.sidebar.expanded .nav-label { opacity: 1; width: auto; }

.sidebar-footer { padding-top: 16px; border-top: 1px solid var(--glass-border); }
.sidebar-social {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 8px 0;
}
.sidebar-social-link {
    color: var(--text-dim);
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
    display: flex;
    align-items: center;
}
.sidebar-social-link:hover {
    opacity: 1;
    color: #ff4500;
}
.status-indicator { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: var(--text-dim); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.online { background: var(--success); box-shadow: 0 0 8px rgba(0, 230, 118, 0.5); }

/* ── Main Content ── */
.content-area {
    flex: 1; padding: 32px; padding-bottom: 48px; overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(124, 77, 255, 0.05), transparent 40%);
    transition: margin-right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
body.chat-open .content-area { margin-right: 640px; }
.content-area.feed-active { padding-top: 0; }
#dynamic-content {
    display: flex; flex-direction: column;
    min-height: 100%;
}

.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }

.search-box {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; border-radius: 30px; width: 400px;
}
.search-box input { background: transparent; border: none; outline: none; color: white; width: 100%; font-family: var(--font-main); }

.api-status {
    background: var(--glass-bg); padding: 8px 16px; border-radius: 10px;
    border: 1px solid var(--glass-border); font-family: var(--font-mono); font-size: 0.85rem;
}
.label { color: var(--text-dim); margin-right: 8px; }

.view-header { margin-bottom: 32px; }
.view-header h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.5px; }
.subtitle { color: var(--text-dim); margin-top: 4px; }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 40px; }
.stat-card { padding: 24px; border-radius: 20px; display: flex; align-items: center; gap: 20px; }

/* ── Tabs Navigation ── */
.tabs-nav {
    display: flex;
    gap: 8px;
    padding: 6px;
    margin-bottom: 24px;
    border-radius: 14px;
    max-width: fit-content;
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-item:hover {
    background: var(--glass-hover);
    color: var(--text-main);
}

.tab-item.active {
    background: var(--accent-glow);
    color: white;
    box-shadow: inset 0 0 0 1px var(--accent);
}

.tab-item i {
    width: 18px;
    height: 18px;
}
.tab-count-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px;
    background: rgba(124,77,255,0.25); border: 1px solid rgba(124,77,255,0.4);
    color: #d8b4fe; font-size: 11px; font-weight: 700;
    border-radius: 20px; margin-left: 4px;
}
.tab-item.active .tab-count-badge {
    background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.3); color: white;
}
.stat-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.stat-icon.purple { background: rgba(124, 77, 255, 0.15); color: #7c4dff; }
.stat-icon.blue { background: rgba(64, 196, 255, 0.15); color: #40c4ff; }
.stat-icon.green { background: rgba(0, 230, 118, 0.15); color: #00e676; }
.stat-label { color: var(--text-dim); font-size: 0.9rem; display: block; }
.stat-value { font-size: 1.5rem; font-weight: 600; }

/* ═══════════════════════════════════════════════════════
   JOB GRID — News-style card grid
═══════════════════════════════════════════════════════ */

/* Grid panel — 5 columnas como feed de noticias */
.jobs-grid-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px 16px; /* más espacio vertical entre filas */
}

/* Modo grid: card actúa como celda compacta */
.jobs-grid-mode #jobs-container { overflow: visible; }
.jobs-grid-mode .job-card {
    margin-bottom: 0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.28s cubic-bezier(0.25,0.46,0.45,0.94),
                box-shadow 0.28s ease,
                border-color 0.22s ease;
}
.jobs-grid-mode .job-card:hover {
    transform: translateY(-4px);
    border-color: rgba(124,77,255,0.30);
    box-shadow: 0 16px 44px rgba(0,0,0,0.55), 0 0 0 1px rgba(124,77,255,0.10);
}
/* En modo grid: ocultar todo excepto el thumb */
.jobs-grid-mode .job-card-header  { display: none !important; }
.jobs-grid-mode .job-card-body    { display: none !important; }
.jobs-grid-mode .job-detail-back-btn { display: none !important; }
.jobs-grid-mode .job-grid-thumb   { display: flex !important; }

/* Modo detalle: una sola tarjeta expandida */
.jobs-detail-mode .jobs-grid-panel          { display: block; }
.jobs-detail-mode .job-card:not(.selected)  { display: none !important; }
.jobs-detail-mode .job-card.selected        { margin-bottom: 0; border-radius: 16px; overflow: hidden; }
.jobs-detail-mode .job-card.selected .job-grid-thumb      { display: none !important; }
.jobs-detail-mode .job-card.selected .job-detail-back-btn { display: flex !important; }

/* ── Thumb card — info-rich, no image ── */
.job-grid-thumb {
    display: none;
    flex-direction: column;
    height: 100%;
}

/* Top clickable area */
.job-grid-card-top {
    flex: 1;
    padding: 14px 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
}

.job-grid-source-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.job-grid-favicon-sm {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    opacity: 0.7;
    flex-shrink: 0;
}

.job-grid-source {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.job-grid-schedule {
    font-size: 0.65rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.job-grid-name {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.job-grid-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.job-grid-lastrun {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-grid-comment {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
    border-radius: 5px;
    padding: 5px 7px;
    border: 1px solid rgba(255,255,255,0.06);
}

/* Bottom actions row */
.job-grid-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(0,0,0,0.15);
}

.job-grid-run-btn {
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    font-size: 0.72rem !important;
    padding: 4px 10px 4px 8px !important;
}

.job-grid-expand-btn {
    background: rgba(124,77,255,0.12);
    border: 1px solid rgba(124,77,255,0.25);
    color: var(--accent);
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}
.job-grid-expand-btn:hover { background: rgba(124,77,255,0.25); }

/* ── History bar — pie de tarjeta, ancho completo ── */
.job-grid-history-bar {
    width: 100%;
    padding: 7px 12px;
    background: rgba(124,77,255,0.08);
    border-top: 1px solid rgba(124,77,255,0.18);
    display: flex;
    align-items: center;
}
.job-grid-history-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(167,139,250,0.85);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Back button (visible solo en modo detalle) ── */
.job-detail-back-btn {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 13px 22px;
    cursor: pointer;
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(124,77,255,0.15);
    background: rgba(124,77,255,0.05);
    transition: background 0.18s;
    user-select: none;
}
.job-detail-back-btn:hover { background: rgba(124,77,255,0.12); }
.job-detail-back-hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 4px;
}

/* ═══════════════════════════════════════════════════════
   JOB CARDS — Expandable
═══════════════════════════════════════════════════════ */

/* Base glass override for job cards — more body, stronger border */
.job-card.glass {
    background: rgba(255, 255, 255, 0.042);
    border-color: rgba(255, 255, 255, 0.11);
}

.job-card {
    border-radius: 16px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
    position: relative;
}

/* Hover: lift + accent left-bar + stronger border */
.job-card:hover:not(.job-card--expanded) {
    background: rgba(124, 77, 255, 0.07);
    border-color: rgba(124, 77, 255, 0.38);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(124, 77, 255, 0.18);
    transform: translateY(-1px);
}

/* Accent left-bar on hover — pseudo-element */
.job-card::before {
    content: '';
    position: absolute;
    left: 0; top: 12px; bottom: 12px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
    z-index: 2;
}
.job-card:hover::before { opacity: 0.7; }
.job-card.job-card--expanded::before { opacity: 1; top: 0; bottom: 0; border-radius: 0; }

/* Expanded state */
.job-card.job-card--expanded {
    border-color: rgba(124, 77, 255, 0.48);
    box-shadow: 0 0 0 1px rgba(124, 77, 255, 0.22), 0 0 32px rgba(124, 77, 255, 0.14), 0 12px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(0);
}
.job-card.job-card--expanded .job-card-header {
    background: rgba(124, 77, 255, 0.06);
    border-bottom: 1px solid rgba(124, 77, 255, 0.18);
}
.job-card.job-card--expanded .job-title-name {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent-glow);
}
.job-card.job-card--expanded .chevron-icon {
    color: var(--accent);
    filter: drop-shadow(0 0 4px var(--accent-glow));
}

.job-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 28px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}
.job-card-header:hover { background: rgba(255, 255, 255, 0.05); }

.job-card-title { display: flex; align-items: center; gap: 16px; }

.job-status-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    background: var(--text-faint); transition: all 0.3s ease;
}
.job-status-dot.online {
    background: var(--success); box-shadow: 0 0 8px rgba(0, 230, 118, 0.4);
}
.job-status-dot.offline {
    background: var(--text-faint); box-shadow: none;
}

.job-name { display: block; font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.job-meta { color: var(--text-dim); font-size: 0.8rem; display: block; margin-top: 3px; }

/* Status Badges */
.status-badge {
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-right: 8px;
    display: inline-flex;
    align-items: center;
}
.badge-processing { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(96, 165, 250, 0.2); }
.badge-finished { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.2); }
.badge-error { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.2); }

.job-meta-lastrun {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.job-cred-chip {
    display: inline-flex; align-items: center; gap: 5px;
    margin-left: 10px;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.78rem; font-weight: 600;
    background: rgba(124, 77, 255, 0.2);
    border: none;
    color: #fff;
    white-space: nowrap;
}
.job-cred-chip--empty {
    background: rgba(255,255,255,0.07);
    color: var(--text-faint);
}
.job-meta-comment {
    color: #fff;
    background: rgba(124, 77, 255, 0.2);
    padding: 2px 10px;
    border-radius: 4px;
    margin-left: 12px;
    font-weight: 600;
    font-size: 0.78rem;
    border: 1px solid var(--accent-glow);
}

.chevron-icon { transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s; color: rgba(255,255,255,0.55); flex-shrink: 0; }

.job-card-body {
    padding: 0 28px 28px;
    animation: slideDown 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Config Sections ── */
.config-section {
    padding: 24px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.11);
}

.config-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.95rem; font-weight: 600; color: var(--accent);
    margin-bottom: 16px;
}
.config-title i { width: 18px; height: 18px; }

/* ─── Max Items Per Run control ─── */
.max-items-control {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.max-items-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.config-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}
.badge-required {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #fbbf24;
    background: rgba(251,191,36,0.1);
    border: 1px solid rgba(251,191,36,0.25);
    padding: 2px 7px;
    border-radius: 4px;
}
.max-items-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.max-items-range {
    flex: 1;
    accent-color: var(--accent);
    cursor: pointer;
    height: 4px;
    max-width: 320px;
}
.max-items-number {
    width: 64px !important;
    text-align: center;
    padding: 6px 8px !important;
    font-size: 14px !important;
    font-weight: 700;
    color: var(--text-main) !important;
}
.max-items-unit {
    font-size: 12px;
    color: var(--text-dim);
    white-space: nowrap;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.config-field { display: flex; flex-direction: column; gap: 6px; }
@keyframes fieldErrorPulse { 0%,100% { box-shadow: none; } 50% { box-shadow: 0 0 0 3px rgba(239,68,68,0.5); border-radius: 10px; } }
.field-error-pulse { animation: fieldErrorPulse 0.5s ease 3; }
.config-field.full-width { grid-column: 1 / -1; margin-top: 16px; }
.config-field-group { display: flex; gap: 16px; }
.config-field-group .config-field { flex: 1; }
.config-field label { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; display: flex; align-items: center; gap: 5px; }

/* ── Help icon ── */
.field-help { display: inline-flex; align-items: center; cursor: default; }
.field-help svg { width: 12px; height: 12px; color: var(--text-dim); opacity: 0.6; transition: opacity 0.2s; }
.field-help:hover svg { opacity: 1; color: var(--accent); }

/* ── Global tooltip (rendered at body level to escape overflow:hidden) ── */
#field-tooltip {
    position: fixed;
    z-index: 99999;
    background: rgba(15,15,25,0.97);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--text-main);
    max-width: 240px;
    line-height: 1.5;
    letter-spacing: 0;
    text-transform: none;
    pointer-events: none;
    backdrop-filter: blur(12px);
    box-shadow: 0 6px 24px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.15s;
}

.input-glass {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    transition: all 0.2s ease;
    color-scheme: dark;
}
.input-glass:focus { outline: none; border-color: var(--accent); }

/* Select dropdowns — dark native popup */
select.input-glass {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237c4dff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 32px;
    cursor: pointer;
}
select.input-glass:hover {
    border-color: var(--accent);
    background-color: rgba(124, 77, 255, 0.06);
}
select.input-glass:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
}
select.input-glass option {
    background: #1a1a2e;
    color: var(--text-main);
    padding: 8px 12px;
}

/* ── Feed filter wrapper (for tooltip positioning) ── */
.feed-filter-wrap {
    position: relative;
    display: flex;
}
.feed-filter-wrap select {
    width: 100%;
}

/* ── Premium tooltip (JS-driven .premium-tooltip) ── */
.premium-tooltip {
    position: fixed;
    background: linear-gradient(145deg, rgba(8, 6, 18, 0.92) 0%, rgba(16, 10, 32, 0.92) 100%);
    color: #ede8f5;
    font-size: 12px;
    line-height: 1.6;
    padding: 14px 20px;
    border-radius: 16px;
    border: 1px solid rgba(140, 100, 255, 0.5);
    box-shadow:
        0 0 15px rgba(124, 77, 255, 0.3),
        0 0 40px rgba(124, 77, 255, 0.1),
        0 20px 60px rgba(0, 0, 0, 0.8),
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    max-width: 320px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px) scale(0.96) perspective(800px) rotateX(2deg);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 99999;
    text-align: left;
}
.premium-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1) perspective(800px) rotateX(0deg);
}
.premium-tooltip .tip-line {
    display: block;
    padding: 2px 0;
}
.premium-tooltip .tip-label {
    color: var(--accent);
    font-weight: 600;
}
.premium-tooltip .tip-arrow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 6px;
    overflow: hidden;
}
.premium-tooltip .tip-arrow::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: rgba(35, 20, 60, 0.97);
    border-right: 1px solid rgba(124, 77, 255, 0.3);
    border-bottom: 1px solid rgba(124, 77, 255, 0.3);
}
select.input-glass optgroup {
    background: #12121f;
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 6px 8px;
}
select.input-glass optgroup option {
    background: #1a1a2e;
    color: var(--text-main);
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    padding-left: 16px;
}
/* Digital Time Picker Premium Styling */
input[type="time"].input-glass {
    font-size: 1.1rem;
    letter-spacing: 2px;
    font-weight: 700;
    text-align: center;
    background: rgba(124, 77, 255, 0.03);
    border: 1px dashed var(--glass-border);
    color: var(--accent);
    cursor: pointer;
    max-width: 240px;
    color-scheme: dark;
}

/* Keep time input visually distinct even in readonly */
input[type="time"].input-glass.inline-editable[readonly] {
    background: rgba(124, 77, 255, 0.03);
    border: 1px dashed rgba(124, 77, 255, 0.15);
}
input[type="time"].input-glass.inline-editable[readonly]:hover {
    background: rgba(124, 77, 255, 0.08);
    border: 1px solid var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

input[type="time"].input-glass:hover {
    background: rgba(124, 77, 255, 0.08);
    border: 1px solid var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

input[type="time"].input-glass.editing {
    border-style: solid;
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* Time Input Wrapper — custom clock icon always visible */
.time-input-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    max-width: 240px;
}
.time-input-wrap input[type="time"] {
    padding-right: 36px;
    width: 100%;
}
.time-input-wrap .time-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--accent);
    opacity: 0.7;
    pointer-events: none;
    transition: all 0.2s;
}
.time-input-wrap:hover .time-icon {
    opacity: 1;
    color: var(--accent);
    filter: drop-shadow(0 0 4px var(--accent-glow));
}

/* Hide browser native time picker icon (we use custom) */
input[type="time"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    width: 18px;
    height: 18px;
    position: absolute;
    right: 8px;
    cursor: pointer;
}

/* Inline Editable */
.inline-editable[readonly], .inline-editable[disabled] {
    background: transparent;
    border-color: transparent;
    cursor: pointer;
}
select.inline-editable[disabled] {
    appearance: none;
    -webkit-appearance: none;
    pointer-events: none;
}
.inline-editable[readonly]:hover, .inline-editable[disabled]:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--glass-border);
}
.inline-editable.editing {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    color: var(--text-main);
    cursor: text;
}


.span-2 { grid-column: span 2; }

/* ── Job Header Right ── */
.job-header-right { display: flex; align-items: center; gap: 16px; }
.scheduler-badge {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.78rem; color: var(--text-dim);
    background: rgba(255,255,255,0.03); padding: 6px 14px;
    border-radius: 8px; border: 1px solid var(--glass-border);
}
.scheduler-badge i { width: 14px; height: 14px; }

/* ── Day Picker ── */
.day-picker {
    display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px;
}
.day-chip {
    display: inline-flex; align-items: center; justify-content: center;
    width: 52px; height: 36px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.03);
    color: var(--text-dim);
    font-size: 0.82rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease;
    user-select: none;
}
.day-chip:hover { border-color: var(--accent); color: var(--text-main); }
.day-chip.active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 700;
    box-shadow: 0 0 10px rgba(124, 77, 255, 0.2);
}

/* ── Pipeline Blocks ── */
.pipeline-block {
    margin-top: 24px;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255,255,255,0.01);
}

.pipeline-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--glass-border);
}
.pipeline-header i { width: 22px; height: 22px; flex-shrink: 0; }
.pipeline-header h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.pipeline-header .pipeline-desc { color: var(--text-faint); font-size: 0.78rem; margin-left: auto; }

.pipeline-header.source {
    border-top: 3px solid var(--info);
    color: var(--info);
}
.pipeline-header.source h2 { color: var(--text-main); }

.pipeline-header.content {
    border-top: 3px solid var(--accent);
    color: var(--accent);
}
.pipeline-header.content h2 { color: var(--text-main); }

.pipeline-block .config-section { padding: 20px 24px; border-top: none; }
.pipeline-block .config-section + .config-section { border-top: 1px solid var(--glass-border); }
.pipeline-block .test-section { padding: 20px 24px; border-top: 1px solid var(--glass-border); }

.textarea-tall { min-height: 120px; resize: vertical; line-height: 1.6; }

/* ── Expandable Card (Prompt) ── */
.expandable-card {
    margin-top: 16px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.expandable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.2s;
}
.expandable-header:hover { background: var(--glass-hover); }
.expandable-header span { display: flex; align-items: center; gap: 8px; }
.expandable-header i { width: 16px; height: 16px; }
.expand-chevron { transition: transform 0.3s ease; }

.expandable-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
    padding: 0 18px;
}

.expandable-card.expanded .expandable-body {
    max-height: 600px;
    padding: 16px 18px;
    overflow-y: auto;
}
.expandable-card.expanded .expand-chevron {
    transform: rotate(180deg);
}

.prompt-textarea {
    width: 100%;
    min-height: 280px;
    resize: vertical;
    line-height: 1.7;
    font-size: 0.84rem;
    white-space: pre-wrap;
}

/* ── Cheerio Code Card ── */
.expandable-card--code {
    border-color: rgba(34, 211, 238, 0.12);
    border-left: 3px solid rgba(34, 211, 238, 0.35);
    border-radius: 10px;
}
.expandable-card--code .expandable-header {
    background: rgba(34, 211, 238, 0.04);
    color: #67e8f9;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.01em;
    padding: 11px 16px;
}
.expandable-card--code .expandable-header span { color: #67e8f9; }
.expandable-card--code .expandable-header i { color: #22d3ee; opacity: 0.9; }
.expandable-card--code .expandable-header:hover {
    background: rgba(34, 211, 238, 0.08);
}
.expandable-card--code.expanded {
    border-color: rgba(34, 211, 238, 0.28);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.08), 0 4px 24px rgba(0, 0, 0, 0.4);
}
.expandable-card--code .expandable-body {
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(34, 211, 238, 0.08);
}
.expandable-card--code.expanded .expandable-body {
    padding: 0;
    max-height: 750px;
}
.expandable-card--code .prompt-textarea {
    background: transparent;
    border: none !important;
    box-shadow: none !important;
    color: #cdd9e5;
    font-family: var(--font-mono) !important;
    font-size: 0.79rem !important;
    line-height: 1.7;
    padding: 18px 20px;
    min-height: 300px;
    resize: vertical;
    outline: none;
    white-space: pre;
    overflow-x: auto;
}
.expandable-card--code .prompt-textarea.editing {
    color: #e2edf7;
    background: rgba(34, 211, 238, 0.025) !important;
    box-shadow: none !important;
    border: none !important;
}

/* ── Escalation Chain Selector ── */
.escalation-chain {
    display: flex;
    align-items: center;
    gap: 0;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 12px 16px;
}
.escalation-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.18s ease;
    min-width: 110px;
    position: relative;
}
.escalation-node svg { width: 16px; height: 16px; margin-bottom: 2px; opacity: 0.4; }
.escalation-node .esc-label { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; }
.escalation-node .esc-desc { font-size: 0.66rem; opacity: 0.5; white-space: nowrap; }
.escalation-node.in-chain {
    color: rgba(255, 255, 255, 0.5);
    border-color: rgba(139, 92, 246, 0.25);
    background: rgba(139, 92, 246, 0.05);
}
.escalation-node.in-chain svg { opacity: 0.6; }
.escalation-node.is-start {
    color: #fff;
    border-color: rgba(139, 92, 246, 0.7);
    background: rgba(139, 92, 246, 0.15);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.3), 0 2px 12px rgba(139, 92, 246, 0.2);
}
.escalation-node.is-start svg { opacity: 1; color: #a78bfa; }
.escalation-node.is-start .esc-label { color: #c4b5fd; }
.escalation-node.is-start::before {
    content: 'INICIO';
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 4px;
    padding: 1px 5px;
}
.escalation-node:hover:not(.is-start) {
    border-color: rgba(139, 92, 246, 0.4);
    color: rgba(255, 255, 255, 0.75);
}
.escalation-arrow {
    display: flex;
    align-items: center;
    padding: 0 6px;
    color: rgba(255, 255, 255, 0.1);
    transition: color 0.18s;
}
.escalation-arrow svg { width: 14px; height: 14px; }
.escalation-arrow.in-chain { color: rgba(139, 92, 246, 0.45); }

/* ── Extractor Split Layout ── */
.extractor-split-body {
    display: flex !important;
    flex-direction: row;
    align-items: stretch;
    padding: 0 !important;
}
.extractor-split-body .prompt-textarea {
    flex: 0 0 58%;
    min-width: 0;
    border-right: 1px solid rgba(34, 211, 238, 0.08) !important;
    border-radius: 0 !important;
    resize: none;
}
.extractor-result-panel {
    flex: 0 0 42%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.25);
    overflow: hidden;
}
.extractor-result-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    font-size: 0.69rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.28);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    background: rgba(34, 211, 238, 0.02);
}
.extractor-result-label svg { width: 11px; height: 11px; opacity: 0.7; }
.extractor-result-label .extractor-result-count {
    margin-left: auto;
    font-size: 0.65rem;
    color: rgba(34, 211, 238, 0.5);
    font-weight: 700;
    letter-spacing: 0;
}
.extractor-result-pre {
    flex: 1;
    margin: 0;
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.38);
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-y: auto;
    max-height: 420px;
    background: transparent;
}
.extractor-result-pre.has-result { color: rgba(255, 255, 255, 0.6); }
.extractor-result-pre .res-item { margin-bottom: 6px; }
.extractor-result-pre .res-item-num { color: rgba(34, 211, 238, 0.5); margin-right: 4px; }
.extractor-result-pre .res-item-title { color: rgba(255, 255, 255, 0.75); }
.extractor-result-pre .res-item-url { color: rgba(255, 255, 255, 0.28); font-size: 0.65rem; display: block; }

/* ── Filter Catalog ── */
.filter-catalog-wrap {
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.filter-table td { font-size: 0.84rem; }

.filter-logic-badge {
    font-size: 0.7rem;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 2px 10px;
    border-radius: 6px;
    margin-left: 10px;
    font-weight: 700;
    letter-spacing: 1px;
}

.field-badge {
    font-size: 0.82rem;
    font-weight: 500;
}

.type-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.type-badge.text { background: rgba(64, 196, 255, 0.12); color: var(--info); }
.type-badge.numeric { background: rgba(255, 215, 64, 0.12); color: var(--warning); }
.type-badge.datetime { background: rgba(124, 77, 255, 0.12); color: var(--accent); }
.type-badge.boolean { background: rgba(0, 230, 118, 0.12); color: var(--success); }

.filter-value {
    background: rgba(0, 0, 0, 0.25);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-main);
}

.code-block {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-dim);
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* ── Test Sections (Phase 1 & 2) ── */
.test-section {
    padding: 20px 0;
    border-top: 1px solid var(--glass-border);
}

.test-section.phase2-locked {
    opacity: 0.4;
    pointer-events: none;
    position: relative;
}
.test-section.phase2-locked::after {
    content: '🔒 Completa la prueba de Extracción';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-dim);
    font-size: 0.9rem;
    background: rgba(0,0,0,0.6);
    padding: 8px 20px;
    border-radius: 8px;
}

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

.test-desc { color: var(--text-faint); font-size: 0.82rem; margin-bottom: 16px; }

.test-results-area { min-height: 40px; }

.test-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    padding: 14px 20px;
    color: #fca5a5;
    font-size: 0.9rem;
}

/* Phase 1 Results */
.phase1-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.stat-pill {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-dim);
}
.stat-pill.accent { border-color: var(--accent); color: var(--accent); }
.stat-pill strong { color: var(--text-main); margin-right: 4px; }

.phase1-table-wrap {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

/* Phase 2 Results */
.phase2-result-card { border-radius: 12px; padding: 20px; }
.phase2-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

.phase2-output label {
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-dim); display: block; margin-bottom: 8px;
}

.ai-result-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 16px;
    font-size: 0.88rem;
    line-height: 1.7;
    max-height: 300px;
    overflow-y: auto;
    color: var(--text-main);
}

/* ── Buttons ── */
.flex-between { display: flex; justify-content: space-between; align-items: center; }

.btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 10px 24px; border-radius: 12px; border: none;
    cursor: pointer; font-family: var(--font-main); font-weight: 600;
    transition: all 0.2s ease; font-size: 0.9rem;
}
.btn.accent { background: var(--accent); color: white; box-shadow: 0 4px 15px var(--accent-glow); }
.btn.accent:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--accent-glow); }
.btn.accent:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn.success { background: var(--success); color: #000; box-shadow: 0 4px 15px rgba(0, 230, 118, 0.3); }
.btn.success:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 230, 118, 0.4); }

.btn-sm { padding: 8px 16px; font-size: 0.82rem; }
.btn-sm i { width: 14px; height: 14px; }

.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-lg i { width: 20px; height: 20px; }

/* ── Tables ── */
.table-container { margin-top: 24px; border-radius: 16px; overflow: hidden; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 14px 20px;
    background: rgba(255,255,255,0.02); color: var(--text-dim);
    font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px;
}
.data-table td { padding: 12px 20px; border-top: 1px solid var(--glass-border); font-size: 0.88rem; }
.data-table.compact td { padding: 10px 16px; font-size: 0.82rem; }
.data-table.compact th { padding: 10px 16px; font-size: 0.72rem; }

.title-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-cell a { color: var(--info); text-decoration: none; font-family: var(--font-mono); font-size: 0.75rem; }
.url-cell a:hover { text-decoration: underline; }

.radio-select { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* ── Badges ── */
.badge { padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge.success { background: rgba(0, 230, 118, 0.15); color: #00e676; }
.badge.error { background: rgba(255, 82, 82, 0.15); color: #ff5252; }

/* ── Toasts ── */
#toast-container {
    position: fixed; top: 24px; right: 24px; z-index: 1000;
    display: flex; flex-direction: column; gap: 12px;
}
.toast {
    min-width: 320px; padding: 14px 20px; border-radius: 12px;
    backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center; gap: 12px;
    animation: slideIn 0.3s ease-out forwards;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    font-size: 0.88rem;
}
.toast.success { background: rgba(16, 185, 129, 0.12); color: #86efac; border-color: rgba(16, 185, 129, 0.2); }
.toast.error { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border-color: rgba(239, 68, 68, 0.2); }
.toast.info { background: rgba(14, 165, 233, 0.12); color: #7dd3fc; border-color: rgba(14, 165, 233, 0.2); }
.toast.warning { background: rgba(124, 77, 255, 0.15); color: #c4b5fd; border-color: rgba(124, 77, 255, 0.3); }
.toast-icon { font-size: 1.1rem; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }

/* ── Loaders ── */
.loader-wrap { display: flex; align-items: center; gap: 14px; padding: 20px; justify-content: center; }
.loader-pulse {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent);
    animation: pulse 1s ease-in-out infinite;
}
.loader-text { color: var(--text-dim); font-size: 0.88rem; }
@keyframes pulse { 0%, 100% { opacity: 0.3; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.1); } }

.empty-state { padding: 40px; text-align: center; border-radius: 16px; color: var(--text-dim); }

/* ── Utilities ── */
.center { text-align: center; }
.hidden { display: none !important; }
.flex-center { display: flex; justify-content: center; align-items: center; }

.card-footer {
    border-top: 1px solid var(--glass-border);
    padding: 32px 24px !important;
    margin-top: 24px;
    background: rgba(124, 77, 255, 0.02);
}

/* ── Toggle Switch ── */
.toggle-section .toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-switch {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; user-select: none;
}
.toggle-switch input { display: none; }

.toggle-slider {
    position: relative;
    width: 42px; height: 22px;
    background: rgba(255,255,255,0.08);
    border-radius: 14px;
    transition: all 0.3s ease;
    border: 1px solid var(--glass-border);
}
.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: all 0.3s ease;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(20px);
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.toggle-label {
    font-size: 0.78rem;
    color: var(--text-dim);
    font-weight: 500;
}

/* Extra stability for live updates */
.job-title-name { color: var(--text-main); }
.job-title-url { color: var(--text-dim); }

.toggle-desc {
    color: var(--text-faint);
    font-size: 0.78rem;
    margin-top: -8px;
    margin-bottom: 12px;
}

.toggle-body {
    transition: opacity 0.3s ease;
}

/* ── Switch Toggle (Job Activation) ── */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}
.switch-toggle input { opacity: 0; width: 0; height: 0; }
.switch-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 24px;
    transition: all 0.3s ease;
}
.switch-slider::before {
    content: '';
    position: absolute;
    height: 18px; width: 18px;
    left: 2px; bottom: 2px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: all 0.3s ease;
}
.switch-toggle input:checked + .switch-slider {
    background: rgba(0, 230, 118, 0.25);
    border-color: var(--success);
    box-shadow: 0 0 12px rgba(0, 230, 118, 0.2);
}
.switch-toggle input:checked + .switch-slider::before {
    transform: translateX(20px);
    background: var(--success);
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.5);
}
.switch-toggle.disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.switch-toggle.disabled .switch-slider {
    background: rgba(255,255,255,0.03);
}

/* Job card active/inactive visual hints */
.job-card.job-active {
    border-color: rgba(124, 77, 255, 0.2);
}
.job-card.job-active::before {
    background: var(--accent);
    opacity: 0.6;
}
.job-card.job-inactive {
    border-color: rgba(180, 160, 100, 0.15);
    opacity: 0.65;
    background: rgba(255, 255, 255, 0.025);
}
.job-card.job-inactive::before {
    background: rgba(200, 180, 120, 0.5);
    opacity: 0.5;
}
.job-card.job-inactive:hover {
    border-color: rgba(180, 160, 100, 0.25);
    background: rgba(255, 255, 255, 0.04);
}

.code-font {
    font-family: var(--font-mono) !important;
    font-size: 0.78rem !important;
}
/* ─── Filter Editor & Comparison View ─── */
.filter-editor-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    margin-top: 15px;
}

.filter-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.filter-logic-selector {
    display: flex;
    gap: 4px;
    background: rgba(0, 0, 0, 0.2);
    padding: 3px;
    border-radius: 8px;
}

.logic-btn {
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.logic-btn.active {
    background: var(--accent);
    color: white;
}

.rules-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.rule-item {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: rgba(124, 77, 255, 0.05);
    border: 1px solid rgba(124, 77, 255, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    animation: slideInLow 0.3s ease-out;
}

.rule-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.rule-col--val {
    flex: 1;
}
.rule-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
    opacity: 0.7;
}

.rule-badge {
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.rule-op {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

.rule-val {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.btn-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-remove:hover {
    opacity: 1;
}

.rule-add-form {
    border-top: 1px solid var(--glass-border);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
}

.rule-add-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1.5fr;
    gap: 10px;
    align-items: end;
}
.rule-add-row .rule-col select,
.rule-add-row .rule-col input {
    width: 100%;
}

.empty-rules-msg {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 10px;
    border: 1px dashed var(--glass-border);
    border-radius: 8px;
}

/* ─── Nested Filter Groups ─── */
.filter-group {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(124, 77, 255, 0.15);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    position: relative;
    animation: slideInLow 0.3s ease-out;
}

.filter-group:hover {
    border-color: rgba(124, 77, 255, 0.4);
    background: rgba(124, 77, 255, 0.03);
}

.filter-group .rules-list {
    margin-left: 16px;
    border-left: 1px dashed rgba(124, 77, 255, 0.3);
    padding-left: 16px;
    margin-bottom: 8px;
}

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

.btn-add-group-trigger {
    background: rgba(124, 77, 255, 0.1);
    color: #c4b5fd;
    border: 1px solid rgba(124, 77, 255, 0.2);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-group-trigger:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-1px);
}


/* Comparison View */
.test-comparison-view {
    display: grid;
    grid-template-columns: repeat(3, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 15px;
    min-height: 420px;
    max-height: 550px;
    overflow-x: auto;
    padding-bottom: 8px; /* For scrollbar */
}

.test-pane {
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
}

.pane-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 15px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
}

.pane-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.pane-content pre {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.4;
}

@keyframes slideInLow {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Pane-header color variants */
.pane-raw { background: rgba(14, 165, 233, 0.12) !important; color: #7dd3fc !important; }
.pane-extracted { background: rgba(16, 185, 129, 0.12) !important; color: #86efac !important; }
.pane-filtered { background: rgba(124, 77, 255, 0.14) !important; color: #c4b5fd !important; }

.pane-textarea {
    width: 100%;
    height: 100%;
    min-height: 280px;
    resize: none;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    line-height: 1.4;
}

/* ── Logs Feed ── */
.logs-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: none;
    overflow-y: visible;
    padding: 20px;
    border-radius: 16px;
}

.log-entry {
    display: grid;
    grid-template-columns: 120px 200px 120px 1fr;
    gap: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    font-size: 0.88rem;
    align-items: center;
    transition: background 0.2s;
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.04);
}

.log-time {
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.log-job {
    font-weight: 600;
    color: var(--accent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-status {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 4px;
    text-align: center;
}

.log-status.finished { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.log-status.error { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.log-status.processing { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }

.log-msg {
    color: var(--text-dim);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* ── Logs & Costos — Vista enriquecida ── */
.logs-exec-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 24px 0 10px;
}
.logs-exec-header h3 {
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}
.logs-month-input {
    padding: 6px 10px;
    font-size: 0.85rem;
    width: auto;
}

/* Monthly KPI Panel */
.logs-monthly-panel {
    border-radius: 14px;
    padding: 18px 22px 14px;
    margin-bottom: 8px;
}

.chat-topic-wrapper {
    position: relative;
    width: 100%;
}
/* Cuando se usa como pill-wrapper, hereda feed-tag-wrapper y override min/max-width */
.chat-topic-wrapper.feed-tag-wrapper {
    min-width: unset !important;
    max-width: unset !important;
    width: 100%;
    box-sizing: border-box;
}

.logs-monthly-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.logs-monthly-grid {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}
.logs-kpi {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 110px;
}
.logs-kpi-label {
    font-size: 0.72rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.logs-kpi-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    font-family: var(--font-mono);
}
.logs-kpi-cost { color: #ffd740; }
.logs-monthly-loading { color: var(--text-dim); font-size: 0.9rem; }

/* ─── Cost Charts Panel ──────────────────────────── */
.logs-scraped-panel {
    margin-bottom: 20px;
}
.scraped-pages-card {
    padding: 20px 24px 16px;
    border-radius: 16px;
    background: #0e0e12;
    border: 1px solid rgba(255,255,255,0.07);
}
.scraped-pages-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}
.scraped-pages-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}
.scraped-pages-title i { width: 15px; height: 15px; color: var(--accent); }
.scraped-pages-subtitle {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.35);
    margin-top: 3px;
}
.scraped-pages-total {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    letter-spacing: -0.5px;
}
.scraped-pages-chart-wrap {
    height: 100px;
    position: relative;
}

.logs-charts-panel {
    margin-bottom: 24px;
}
.logs-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.logs-chart-full {
    grid-column: 1 / -1;
}
@media (max-width: 900px) {
    .logs-charts-grid { grid-template-columns: 1fr; }
}
.logs-chart-card {
    border-radius: 16px;
    padding: 20px 24px 16px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.03);
}
.logs-chart-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 16px;
}
.logs-chart-title svg { width: 14px; height: 14px; color: var(--accent); }
.logs-chart-body {
    position: relative;
    height: 280px;
}
/* Job cost chart: altura dinámica + scroll vertical si rebasa */
.logs-chart-body--jobs {
    height: auto !important;
    max-height: 380px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(124,77,255,0.4) transparent;
}
.logs-chart-body--jobs::-webkit-scrollbar { width: 5px; }
.logs-chart-body--jobs::-webkit-scrollbar-track { background: transparent; }
.logs-chart-body--jobs::-webkit-scrollbar-thumb { background: rgba(124,77,255,0.4); border-radius: 3px; }
.logs-chart-scroll {
    position: relative;
}
.chart-filter-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 5px 14px 5px 10px;
    border-radius: 20px;
    background: rgba(124,77,255,0.15);
    border: 1px solid rgba(124,77,255,0.35);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 600;
    width: fit-content;
    animation: slideDown 0.2s ease;
}
.chart-filter-badge button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    font-size: 0.75rem;
    transition: color 0.15s;
    padding: 0 0 0 4px;
}
.chart-filter-badge button:hover { color: #fff; }
.logs-chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-dim);
    font-size: 0.85rem;
    opacity: 0.6;
}

/* Monthly history collapsible */
.logs-monthly-history {
    margin-top: 16px;
    border-top: 1px solid var(--glass-border);
    padding-top: 10px;
}
.logs-monthly-history summary {
    cursor: pointer;
    color: var(--text-dim);
    font-size: 0.8rem;
    user-select: none;
}
.logs-history-table { margin-top: 8px; font-size: 0.78rem; }
.logs-row-current td { color: var(--accent) !important; }

/* Execution log cards */
.log-exec-card {
    border-radius: 12px;
    margin-bottom: 8px;
    overflow: hidden;
}
.log-exec-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.log-exec-header:hover { background: rgba(255,255,255,0.04); }
.log-exec-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.log-status-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}
.log-status-icon.success { background: rgba(0,230,118,0.15); color: #00e676; }
.log-status-icon.error   { background: rgba(255,82,82,0.15);  color: #ff5252; }
.log-status-icon.processing { background: rgba(64,196,255,0.15); color: #40c4ff; }
.log-job-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}
.log-exec-time {
    font-size: 0.75rem;
    color: var(--text-faint);
    white-space: nowrap;
}
.log-exec-metrics {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}
.log-metric {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    color: var(--text-dim);
}
.log-metric svg { width: 12px; height: 12px; }
.log-metric-cost { color: #ffd740; }
.log-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-faint);
    transition: transform 0.2s;
}

/* Execution detail & URL table */
.log-exec-detail {
    padding: 0 16px 14px;
}
.log-exec-totals {
    display: flex;
    gap: 20px;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.log-exec-totals b { color: var(--text-main); }
.log-exec-comment { color: var(--text-faint); font-style: italic; }
.logs-url-table { font-size: 0.75rem; width: 100%; }
.logs-url-table th { font-size: 0.7rem; }
.logs-url-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logs-url-blacklisted td { color: #ff9800; opacity: 0.8; }
.logs-url-error td { color: var(--error); opacity: 0.8; }
.logs-url-capped td { color: #a78bfa; opacity: 0.75; }
.status-badge.capped { background: rgba(167,139,250,0.12); color: #a78bfa; border-color: rgba(167,139,250,0.3); }
.log-metric-warn { color: #fbbf24; }
.log-exec-warn { color: #fbbf24; font-size: 0.8rem; }
.logs-no-urls { color: var(--text-faint); font-size: 0.8rem; padding: 8px 0; }
.logs-bl-reason { cursor: help; color: #ff9800; }
.logs-loading { display: flex; justify-content: center; padding: 20px; }

/* Legacy log rows (pre-pricing) — readable history tier */
.log-legacy-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px 9px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.045);
    border-left: 2px solid transparent;
    font-size: 0.83rem;
    transition: background 0.15s, border-left-color 0.15s;
    position: relative;
}
.log-legacy-row:first-child { border-radius: 10px 10px 0 0; }
.log-legacy-row:last-of-type { border-bottom: none; border-radius: 0 0 10px 10px; }
.log-legacy-row:hover {
    background: rgba(255,255,255,0.03);
    border-left-color: rgba(124,106,255,0.25);
}
.log-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.log-status-dot.success { background: #00e676; box-shadow: 0 0 5px rgba(0,230,118,0.5); }
.log-status-dot.error   { background: #ff5252; box-shadow: 0 0 5px rgba(255,82,82,0.5); }
.log-status-dot.skipped { background: #546e7a; }
.log-legacy-name {
    font-weight: 500;
    color: #c8c8d8;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.log-legacy-time {
    font-size: 0.73rem;
    color: #c8c8d8;
    white-space: nowrap;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}
.log-legacy-items {
    font-size: 0.73rem;
    color: #c8c8d8;
    white-space: nowrap;
    min-width: 52px;
    text-align: right;
}
.log-legacy-badge {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255,255,255,0.06);
    color: #c8c8d8;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.1);
    font-weight: 600;
}

/* Legacy section wrapper */
.log-legacy-section {
    margin-top: 20px;
}
.log-legacy-section-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 4px;
}
.log-legacy-section-label span:first-child {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}
.log-legacy-section-count {
    font-size: 0.7rem;
    color: var(--text-muted);
}
.log-legacy-list {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.01) !important;
}
.log-premium-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Monthly panel empty state */
.logs-empty-kpi {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    color: var(--text-faint);
    font-size: 0.85rem;
    line-height: 1.5;
}
.logs-empty-kpi svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--accent); opacity: 0.5; }

/* Token arrows in metric */
.tok-arrow { width: 10px !important; height: 10px !important; opacity: 0.6; }

/* Engine badges */
.logs-engine-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.logs-engine-simple   { background: rgba(0,230,118,0.1);  color: #00e676; }
.logs-engine-browser  { background: rgba(64,196,255,0.1); color: #40c4ff; }
.logs-engine-scrapeops { background: rgba(255,215,64,0.1); color: #ffd740; }

/* ═══ Test Results Grid (Phase 1: 3 columns, Phase 2: 2 columns) ═══ */
.results-grid-3 {
    display: grid;
    grid-template-columns: 30% 30% 40%;
    gap: 12px;
    margin-top: 16px;
}

.results-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}

.result-pane {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.pane-header {
    padding: 10px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(124, 77, 255, 0.06);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pane-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-break: break-word;
}

.pane-content::-webkit-scrollbar {
    width: 4px;
}
.pane-content::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

/* ═══ Selectable Items Table (Phase 1 → Phase 2 bridge) ═══ */
.extract-table {
    width: 100%;
    border-collapse: collapse;
}

.extract-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.extract-row td {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
    font-size: 0.82rem;
}

.extract-row:hover {
    background: rgba(124, 77, 255, 0.06);
}

.extract-row.selected {
    background: rgba(124, 77, 255, 0.12);
}

.extract-row strong {
    color: var(--text-main);
    font-size: 0.82rem;
    font-weight: 600;
}

.radio-select {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* ═══ Filter Active Tag ═══ */
.filter-active-tag {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ═══ Source Save Footer ═══ */
.source-save-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 20px;
    margin-top: 8px;
    background: rgba(34, 197, 94, 0.04);
    border-top: 1px solid rgba(34, 197, 94, 0.12);
    border-radius: 0 0 10px 10px;
}
.save-hint {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
}

/* ═══ Cheerio Builder Agent ═══ */
.token-overflow-box {
    border-left: 4px solid #f0883e !important;
    border-color: rgba(240, 136, 62, 0.3) !important;
    background: rgba(240, 136, 62, 0.06) !important;
}
.overflow-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.overflow-info { flex: 1; }
.overflow-error-msg { font-size: 12px; opacity: 0.8; }
.overflow-stats { margin-top: 8px; font-size: 11px; color: var(--text-muted); }
.stat-orange { color: #f0883e; }
.stat-gray   { color: var(--text-muted); }
.overflow-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: flex-start; }

.cheerio-agent-panel {
    margin-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.07);
    padding-top: 14px;
}
/* Phase 1 source agent */
.phase1-agent-btn {
    font-size: 10px; padding: 4px 10px; white-space: nowrap; flex-shrink: 0;
}
.phase1-quality-ok {
    font-size: 10px; color: #34d399; font-weight: 600; flex-shrink: 0;
}
.agent-result { display: flex; flex-direction: column; gap: 10px; }
.agent-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: #a78bfa;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.agent-code-block {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 11.5px;
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 360px;
    overflow-y: auto;
    line-height: 1.55;
}

/* ═══ Cheerio Agent — Refine Bar & Iteration Badge ═══ */
.refine-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    margin-top: 8px;
}
.refine-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255,255,255,0.65);
}
.refine-bar-left i[data-lucide="check-circle"] { color: #22c55e; width: 14px; height: 14px; flex-shrink: 0; }
.cheerio-agent-standalone { margin-top: 8px; }
.iter-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 20px;
    font-size: 10px;
    color: #a78bfa;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-left: 6px;
}

/* ═══ Error Box ═══ */
.error-box {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    padding: 16px 20px;
    color: #fca5a5;
    font-size: 0.9rem;
}

.error-box strong {
    color: #f87171;
}

/* ── Toast Notifications ── */
#toast-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: rgba(15, 15, 20, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 350px;
    max-width: 550px;
    animation: toastCenterIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.interactive {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.toast-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.toast-message {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-main);
}

.toast-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    width: 100%;
    justify-content: flex-end;
}

.toast-btn {
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-family: var(--font-main);
    letter-spacing: 0.4px;
}

/* Secondary Action (Cancel) - Ghost style */
.toast-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-dim);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: scale(1.02);
}

/* Primary Action - Warning/Error context */
.toast.warning .toast-btn.primary { background: var(--warning); color: #000; }
.toast.error .toast-btn.primary { background: var(--error); color: white; }

.toast-btn.primary:hover {
    filter: brightness(1.2);
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.toast-btn.primary:active { transform: scale(0.98); }

/* Color Contexts */
.toast.success { border-left: 5px solid var(--success); }
.toast.error { border-left: 5px solid var(--error); background: rgba(30, 10, 10, 0.98); }
.toast.warning { border-left: 5px solid var(--accent, #7c4dff); background: rgba(124, 77, 255, 0.12); color: #c4b5fd; }
.toast.info { border-left: 5px solid var(--info); }

@keyframes toastCenterIn {
    from { opacity: 0; transform: scale(0.85) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.9) translateY(10px); }
}

/* ═══════════════════════════════════════════════
   INSPECTOR DE FLUJO — Fase 2
═══════════════════════════════════════════════ */
.inspector-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}

.inspector-container {
    width: 96%;
    max-width: 1480px;
    height: 92vh;
    background: #0e1117;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.04);
}

/* ── Header ── */
.inspector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: rgba(255,255,255,0.025);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.inspector-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.inspector-header-icon {
    width: 22px;
    height: 22px;
    color: var(--accent-color);
    flex-shrink: 0;
}
.inspector-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.inspector-subtitle {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--text-faint);
    letter-spacing: 0.02em;
}
.inspector-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.inspector-refine-btn { white-space: nowrap; }
.inspector-close {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(239,68,68,0.08);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.18);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
}
.inspector-close svg { width: 14px; height: 14px; }
.inspector-close:hover {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

/* ── Body: 2 columns ── */
.inspector-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}
.inspector-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.inspector-col-separator {
    width: 1px;
    background: rgba(255,255,255,0.07);
    flex-shrink: 0;
}

/* ── Column header (accent bar) ── */
.inspector-col-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.inspector-col-header svg { width: 14px; height: 14px; flex-shrink: 0; }
.inspector-col-desc {
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.02em;
    margin-left: 4px;
    opacity: 0.55;
    text-transform: none;
}
.cheerio-accent {
    background: rgba(6,182,212,0.06);
    color: #22d3ee;
    border-bottom-color: rgba(6,182,212,0.15);
}
.ia-accent {
    background: rgba(139,92,246,0.06);
    color: #a78bfa;
    border-bottom-color: rgba(139,92,246,0.15);
}

/* ── Quadrant (half-column panel) ── */
.inspector-quadrant {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* ── Panel label (sub-section divider) ── */
.inspector-panel-label {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}
.inspector-panel-label svg { width: 12px; height: 12px; opacity: 0.6; }
.inspector-copy-btn {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 3px 5px;
    cursor: pointer;
    color: rgba(255,255,255,0.35);
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.inspector-copy-btn:hover { color: rgba(255,255,255,0.8); border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.06); }
.inspector-copy-btn svg { width: 11px; height: 11px; opacity: 1; }

/* ── Size badge ── */
.inspector-size-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-faint);
    font-family: 'JetBrains Mono', monospace;
    background: rgba(255,255,255,0.06);
    padding: 1px 7px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.07);
}
.badge-warn {
    color: #fbbf24;
    background: rgba(251,191,36,0.08);
    border-color: rgba(251,191,36,0.18);
}

/* ── Code area ── */
.inspector-code {
    flex: 1;
    overflow-y: auto;
    margin: 0;
    padding: 16px 20px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 11.5px;
    line-height: 1.65;
    color: #cdd9e5;
    background: transparent;
    white-space: pre-wrap;
    word-break: break-word;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.inspector-code::-webkit-scrollbar { width: 5px; }
.inspector-code::-webkit-scrollbar-track { background: transparent; }
.inspector-code::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.inspector-code::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
.inspector-empty { color: var(--text-faint); font-style: italic; }

/* ── Divider between quadrants ── */
.inspector-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    flex-shrink: 0;
    position: relative;
}
.inspector-divider::after {
    content: '';
    position: absolute;
    left: 20px; right: 20px; top: 0;
    height: 1px;
    background: rgba(255,255,255,0.04);
}

.debug-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(14, 165, 233, 0.1);
    color: #7dd3fc;
    border: 1px solid rgba(14, 165, 233, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
}

.debug-btn:hover {
    background: rgba(14, 165, 233, 0.2);
    border-color: #0ea5e9;
}

/* Delete Button in Header */
.btn-icon-danger {
    background: transparent;
    color: var(--text-dim);
    border: none;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    transform: scale(1.1);
}

.job-actions-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 12px;
}

.badge-readonly {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    color: var(--text-faint);
    opacity: 0.45;
    cursor: default;
}
.badge-readonly svg { width: 14px; height: 14px; }

.btn-run-instant {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: #fff;
    border: 1px solid rgba(34, 197, 94, 0.4);
    padding: 6px 14px 6px 11px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    opacity: 0;
    transform: translateX(4px);
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
    white-space: nowrap;
}
.job-card-header:hover .btn-run-instant {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}
.btn-run-instant:hover:not(:disabled) {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: rgba(34, 197, 94, 0.7);
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.4);
    transform: translateX(0) translateY(-1px);
}
.btn-run-instant:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed;
    filter: grayscale(0.4);
}
.job-card-header:hover .btn-run-instant:disabled {
    opacity: 0.3 !important;
}

.job-action-divider {
    width: 1px;
    height: 18px;
    background: rgba(255,255,255,0.08);
    margin: 0 4px;
}

.dirty-badge {
    display: none;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.switch-toggle.dirty-locked { opacity: 0.4; cursor: not-allowed; }

/* ══════════════════════════════════════════
   Feed de Noticias — Premium Editorial v3
   ══════════════════════════════════════════ */

/* ─── Feed View Header ─── */
.feed-view-header h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-main);
    display: inline-block;
    position: relative;
}
.feed-view-header h1::after {
    content: none;
}
.feed-view-header .subtitle {
    font-size: 11px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-weight: 500;
    margin-top: 16px;
}
.feed-top-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 32px;
    border-bottom: 1px solid rgba(124, 77, 255, 0.12);
    margin-left: -32px;
    margin-right: -32px;
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 10, 20, 0.55);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5),
                0 1px 0 rgba(124, 77, 255, 0.08);
    transition: background 0.3s ease,
                backdrop-filter 0.3s ease,
                box-shadow 0.3s ease,
                border-color 0.3s ease;
}
.feed-top-row:hover {
    background: rgba(18, 18, 35, 1);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.7),
                0 1px 0 rgba(124, 77, 255, 0.25);
    border-bottom-color: rgba(124, 77, 255, 0.25);
}
.feed-top-row h1 {
    flex-shrink: 0;
    margin-right: 4px;
}
.feed-row-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}
.feed-top-row .feed-filters .feed-articles-count {
    flex-shrink: 0;
}
.feed-top-row .feed-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}
.feed-top-row .feed-filters > * {
    flex: 0 0 100%;
}
@media (min-width: 900px) {
    .feed-top-row .feed-filters > * {
        flex: 0 1 auto;
    }
    .feed-top-row .feed-filters > .feed-tag-wrapper {
        flex: 1 1 auto;
    }
}

/* ─── Editorial Grid — 12 columns ─── */
/* ── Feed: Featured section (top 3) ── */
.feed-grid-featured {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}
/* Hero: 1st card — 8 cols × 2 rows */
.feed-grid-featured .feed-card:nth-child(1) { grid-column: span 8; grid-row: span 2; min-height: 420px; }
/* Side: 2nd + 3rd — 4 cols each */
.feed-grid-featured .feed-card:nth-child(2),
.feed-grid-featured .feed-card:nth-child(3) { grid-column: span 4; }

/* ── Feed: Regular section (cards 4+, 4 per row) ── */
.feed-grid-regular {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
    margin-bottom: 40px;
}
.feed-card-spacer {
    visibility: hidden;
    pointer-events: none;
    min-height: 0;
}

/* ─── Card Base ─── */
.feed-card {
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(255,255,255,0.022);
    border: 1px solid rgba(255,255,255,0.07);
    display: flex;
    flex-direction: column;
    position: relative;
    animation: feedEntry 0.5s cubic-bezier(0.22,1,0.36,1) both;
    transition: transform 0.32s cubic-bezier(0.25,0.46,0.45,0.94),
                box-shadow 0.32s ease,
                border-color 0.25s ease,
                opacity 0.3s ease;
}

/* Badge "Leído" en cards visitadas */
.feed-card-read-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(139, 92, 246, 0.75);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 2;
    letter-spacing: 0.3px;
    backdrop-filter: blur(4px);
}

/* Top-edge accent line — premium micro-interaction */
.feed-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent) 0%, #a78bfa 60%, transparent 100%);
    opacity: 0;
    transition: opacity 0.28s ease;
    z-index: 10;
    border-radius: 10px 10px 0 0;
}
.feed-card:hover::before { opacity: 1; }

/* Stagger entry animation */
.feed-card:nth-child(1)  { animation-delay:   0ms; }
.feed-card:nth-child(2)  { animation-delay:  60ms; }
.feed-card:nth-child(3)  { animation-delay: 115ms; }
.feed-card:nth-child(4)  { animation-delay: 160ms; }
.feed-card:nth-child(5)  { animation-delay: 200ms; }
.feed-card:nth-child(6)  { animation-delay: 240ms; }
.feed-card:nth-child(7)  { animation-delay: 280ms; }
.feed-card:nth-child(n+8){ animation-delay: 315ms; }

@keyframes feedEntry {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.feed-card:hover {
    transform: translateY(-4px);
    border-color: rgba(124,77,255,0.22);
    box-shadow: 0 18px 52px rgba(0,0,0,0.58), 0 0 0 1px rgba(124,77,255,0.07);
}

/* ══ OVERLAY CARDS: Hero + Feature (all 3 in featured grid) ══ */

.feed-grid-featured .feed-card:nth-child(2),
.feed-grid-featured .feed-card:nth-child(3) { min-height: 275px; }

.feed-grid-featured .feed-card .feed-card-image {
    position: absolute;
    inset: 0;
    aspect-ratio: unset;
    height: 100%;
    flex-shrink: 0;
}
.feed-grid-featured .feed-card .feed-card-image img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.feed-grid-featured .feed-card .feed-card-overlay {
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.02)  0%,
        transparent       22%,
        rgba(0,0,0,0.38)  55%,
        rgba(0,0,0,0.88)  82%,
        rgba(0,0,0,0.96) 100%
    );
}
.feed-grid-featured .feed-card .feed-card-body {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    z-index: 3;
    background: none;
    padding: 48px 18px 16px;
    gap: 8px;
}
.feed-grid-featured .feed-card:nth-child(1) .feed-card-body {
    padding: 64px 24px 22px;
}
.feed-grid-featured .feed-card .feed-card-footer {
    border-top-color: rgba(255,255,255,0.12);
}
.feed-grid-featured .feed-card .feed-owner-name,
.feed-grid-featured .feed-card .feed-date { color: rgba(255,255,255,0.58); }

/* ─── Image zone (regular cards in feed-grid-regular) ─── */
.feed-card-image {
    position: relative;
    overflow: hidden;
    background: rgba(14,14,22,1);
    flex-shrink: 0;
}
.feed-grid-regular .feed-card .feed-card-image { aspect-ratio: 16 / 9; }

/* Inline meta row for regular cards (replaces hidden footer) */
.feed-card-inline-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: auto;
}
.feed-date-inline {
    font-size: 0.68rem;
    color: var(--text-faint);
    margin-left: auto;
    white-space: nowrap;
}

.feed-card-image img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 0.7s cubic-bezier(0.25,0.46,0.45,0.94);
}
.feed-card:hover .feed-card-image img { transform: scale(1.07); }

.feed-card-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 45%,
        rgba(0,0,0,0.3) 72%,
        rgba(0,0,0,0.62) 100%
    );
    pointer-events: none;
}

/* ─── Source badge (top-left on image) ─── */
.feed-card-meta {
    position: absolute;
    top: 11px; left: 11px; right: 11px;
    display: flex; align-items: flex-start;
    justify-content: space-between;
    z-index: 4;
}
.feed-job-badge {
    background: rgba(12, 8, 28, 0.72);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    padding: 5px 11px;
    border-radius: 5px;
    border: 1px solid rgba(167, 139, 250, 0.55);
    box-shadow: 0 0 10px rgba(124, 77, 255, 0.25), inset 0 1px 0 rgba(255,255,255,0.06);
    max-width: 210px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feed-card:nth-child(1) .feed-job-badge { font-size: 10.5px; padding: 6px 14px; }

/* Feed público: ocultar owner (reactivar para feeds privados) */
.feed-owner-avatar-wrap,
.feed-owner-feat { display: none !important; }

/* Avatar discreto — esquina superior derecha del card-body */
.feed-owner-avatar-wrap {
    position: absolute;
    top: 8px;
    right: 8px;
    cursor: default;
    z-index: 2;
}
.feed-card-title {
    padding-right: 42px;
}
.feed-owner-avatar-tip {
    transition: opacity 0.2s, transform 0.2s;
    opacity: 0.75;
}
.feed-owner-avatar-tip:hover { opacity: 1; transform: scale(1.08); }
.feed-card-body { position: relative; }
.feed-card-owner-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
/* Ocultar el avatar del row para no duplicar — el wrap ya lo posiciona */
.feed-card-owner-row .feed-owner-avatar-wrap,
.feed-inline-date-owner .feed-owner-avatar-wrap { display: none; }
.feed-inline-date-owner {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: auto;
}

/* ─── Card Body (regular cards) ─── */
.feed-card-body {
    padding: 13px 14px 14px;
    display: flex; flex-direction: column;
    gap: 9px; flex: 1;
}

/* ─── Title — Inter (legible, open tracking) ─── */
.feed-card-title {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #f0ede7;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    letter-spacing: 0.01em;
}
/* Hero title */
.feed-grid-featured .feed-card:nth-child(1) .feed-card-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    letter-spacing: -0.01em;
    color: #ffffff;
    text-shadow: 0 2px 24px rgba(0,0,0,0.75), 0 1px 4px rgba(0,0,0,0.9);
}
/* Feature titles (cards 2+3) */
.feed-grid-featured .feed-card:nth-child(2) .feed-card-title,
.feed-grid-featured .feed-card:nth-child(3) .feed-card-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    letter-spacing: 0em;
    color: #f6f3ef;
    text-shadow: 0 1px 12px rgba(0,0,0,0.7);
}
/* Regular cards — clean title */
.feed-grid-regular .feed-card-title {
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    letter-spacing: 0.01em;
    color: #eeeaf4;
}
.feed-grid-regular .feed-card-footer {
    display: none;
}
.feed-grid-regular .feed-card-body {
    padding: 11px 12px 13px;
    gap: 6px;
}

/* ─── Footer ─── */
.feed-card-footer {
    display: flex; align-items: center;
    justify-content: space-between;
    gap: 8px; margin-top: auto;
    padding-top: 9px;
    border-top: 1px solid rgba(255,255,255,0.065);
}
.feed-card-owner {
    display: flex; flex-direction: row;
    align-items: center; gap: 8px; flex-shrink: 0;
}
.feed-owner { display: flex; align-items: center; gap: 5px; }
.feed-owner-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.22);
    object-fit: cover; flex-shrink: 0;
}
.feed-owner-avatar-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.07); color: var(--text-dim);
}
.feed-owner-name {
    font-size: 10px; color: rgba(255,255,255,0.38);
    font-weight: 500; max-width: 80px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ─── Avatar featured (inline footer, tarjetas destacadas) ─── */
.feed-owner-avatar-feat {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 1.5px solid rgba(167,139,250,0.45);
    object-fit: cover; flex-shrink: 0;
    background: rgba(124,77,255,0.12);
}
.feed-owner-feat {
    display: flex; align-items: center; gap: 7px;
    background: rgba(12,8,28,0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(167,139,250,0.2);
    border-radius: 20px;
    padding: 4px 10px 4px 4px;
    cursor: default;
    transition: background 0.2s;
}
.feed-owner-feat:hover {
    background: rgba(124,77,255,0.15);
    border-color: rgba(167,139,250,0.4);
}
.feed-owner-feat-name {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.72);
    letter-spacing: 0.01em;
    max-width: 110px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feed-date {
    font-size: 10px; color: rgba(255,255,255,0.35);
    white-space: nowrap; flex-shrink: 0;
    letter-spacing: 0.02em; font-variant-numeric: tabular-nums;
}

/* ─── Badges ─── */
.feed-badges { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.feed-badge {
    font-size: 8.5px; font-weight: 700;
    padding: 2px 7px; border-radius: 3px;
    letter-spacing: 0.07em; text-transform: uppercase;
}
.feed-badge-pais  { background: rgba(14,165,233,0.09); color: #7dd3fc; border: 1px solid rgba(14,165,233,0.16); }
.feed-badge-idioma{ background: rgba(16,185,129,0.07); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.14); }

/* ─── Tag Input ─── */
.feed-tag-wrapper {
    position: relative; z-index: 1000;
    display: flex; flex-wrap: nowrap; align-items: center; gap: 6px;
    min-width: 180px; width: auto; flex: 0 1 auto;
    padding: 7px 12px; border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.09);
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(8px); cursor: text;
    transition: border-color 0.2s, width 0.2s;
    overflow: visible;
}
.feed-tag-wrapper:focus-within {
    border-color: rgba(124,77,255,0.5);
    background: rgba(255,255,255,0.06);
}
.feed-active-tags-inline { display: flex; flex-wrap: nowrap; gap: 6px; flex-shrink: 0; }
.feed-tag-chip { white-space: nowrap; flex-shrink: 0; }
.feed-tag-suggestions {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    z-index: 9999; background: rgba(10,10,20,0.98);
    border: 1px solid rgba(124,77,255,0.3); border-radius: 8px;
    overflow: hidden; backdrop-filter: blur(16px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.6); min-width: 220px;
}
.feed-tag-suggestion {
    display: flex; align-items: center; padding: 9px 12px;
    font-size: 12px; cursor: pointer; color: var(--text-main);
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.feed-tag-suggestion:last-child { border-bottom: none; }
.feed-tag-suggestion:hover { background: rgba(124,77,255,0.18); color: #e9d5ff; }

/* ─── Multi-select checkbox dropdown ─── */
.feed-tag-dropdown-list { padding: 4px 0; }

.feed-tag-check-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 14px; cursor: pointer;
    transition: background 0.12s;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.feed-tag-check-item:last-child { border-bottom: none; }
.feed-tag-check-item:hover { background: rgba(124,77,255,0.12); }
.feed-tag-check-item.is-checked { background: rgba(124,77,255,0.08); }
.feed-tag-check-item.is-checked:hover { background: rgba(124,77,255,0.16); }

.feed-tag-checkbox {
    width: 16px; height: 16px; border-radius: 4px;
    border: 1.5px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.04);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}
.feed-tag-check-item.is-checked .feed-tag-checkbox {
    border-color: #a78bfa;
    background: rgba(124,77,255,0.2);
}
.feed-tag-check-label {
    font-size: 12.5px; color: var(--text-main); line-height: 1.3;
}
.feed-tag-variant-count {
    font-size: 11px; color: var(--text-faint); font-weight: 400;
}
.feed-tag-check-item.is-checked .feed-tag-check-label {
    color: #e9d5ff; font-weight: 500;
}
.feed-tag-dropdown-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px;
    border-top: 1px solid rgba(124,77,255,0.2);
    background: rgba(124,77,255,0.06);
}
.feed-tag-selected-count {
    font-size: 11px; color: #a78bfa;
    font-weight: 600; letter-spacing: 0.02em;
}
.feed-tag-apply-btn {
    display: flex; align-items: center; gap: 5px;
    background: rgba(124,77,255,0.25);
    border: 1px solid rgba(124,77,255,0.45);
    color: #e9d5ff; font-size: 11px; font-weight: 600;
    padding: 5px 12px; border-radius: 5px;
    cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.feed-tag-apply-btn:hover {
    background: rgba(124,77,255,0.4);
    border-color: rgba(124,77,255,0.7);
}
.feed-tag-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: rgba(124,77,255,0.15);
    border: 1px solid rgba(124,77,255,0.4);
    color: #ddd6fe; font-size: 11px; font-weight: 600;
    padding: 3px 8px 3px 10px; border-radius: 4px;
    transition: border-color 0.15s;
}
.feed-tag-chip:hover { border-color: rgba(124,77,255,0.7); }
.feed-tag-chip-remove {
    background: none; border: none; color: #a78bfa;
    cursor: pointer; font-size: 14px; line-height: 1; padding: 0;
    display: flex; align-items: center; transition: color 0.15s;
}
.feed-tag-chip-remove:hover { color: #f87171; }

/* ─── Feed bar (count + pagination on same row) ─── */
.feed-bar {
    display: none;
}
.feed-articles-count {
    font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: #f5c542;
    background: rgba(245, 197, 66, 0.1);
    border: 1px solid rgba(245, 197, 66, 0.3);
    border-radius: 6px;
    padding: 4px 12px;
    margin: 0; white-space: nowrap; flex-shrink: 0;
}

/* ─── Pagination ─── */
.feed-pagination {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 0; flex-wrap: wrap;
}
.feed-pagination-goto {
    display: flex; align-items: center; gap: 6px;
}
.feed-goto-input {
    width: 64px; padding: 7px 10px; text-align: center;
    font-size: 12px; border-radius: 6px;
    -moz-appearance: textfield;
    appearance: textfield;
}
.feed-goto-input::-webkit-outer-spin-button,
.feed-goto-input::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
.feed-pagination-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 9px 22px; font-size: 11px; font-weight: 600;
    letter-spacing: 0.07em; text-transform: uppercase;
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    color: var(--text-dim); cursor: pointer; transition: all 0.2s;
}
.feed-pagination-btn:hover:not(:disabled) {
    background: rgba(124,77,255,0.12);
    border-color: rgba(124,77,255,0.35); color: #c4b5fd;
}
.feed-pagination-btn.disabled,
.feed-pagination-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.feed-pagination-info {
    font-size: 11px; color: var(--text-faint);
    min-width: 100px; text-align: center;
    letter-spacing: 0.06em; text-transform: uppercase;
}

/* ─── Feed header: layout compacto con chat abierto ─── */
/* Filtros siempre a la izquierda — no se mueven con el chatbot */
body.chat-open .feed-top-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
body.chat-open .feed-top-row > .feed-filters {
    justify-content: flex-start;
}

/* ─── Infinite Scroll ─── */
.feed-scroll-sentinel {
    height: 1px;
    width: 100%;
}
.feed-load-more {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 24px 0;
}
.feed-skeleton-card {
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
}
.feed-skeleton-img {
    width: 100%;
    height: 140px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.feed-skeleton-text {
    height: 12px;
    margin: 12px 14px 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
}
.feed-skeleton-text.short {
    width: 60%;
    margin-bottom: 14px;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.feed-end-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
    font-size: 13px;
    letter-spacing: 0.03em;
    opacity: 0.6;
}
@media (max-width: 800px) {
    .feed-load-more { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .feed-load-more { grid-template-columns: 1fr; }
}

/* ─── Card Preview Modal ─── */
.card-preview-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.28s cubic-bezier(0.22,1,0.36,1);
    padding: 24px;
}
.card-preview-overlay.is-visible { opacity: 1; }
.card-preview-overlay.is-visible .card-preview-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.card-preview-modal {
    position: relative;
    width: 100%; max-width: 900px;
    background: rgba(22,22,34,0.97);
    border: 1px solid rgba(124,77,255,0.18);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(124,77,255,0.08);
    transform: translateY(24px) scale(0.97);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.22,1,0.36,1), opacity 0.3s ease;
    max-height: 85vh;
    overflow-y: auto;
}

.card-preview-close {
    position: absolute; top: 12px; right: 12px; z-index: 10;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: #fff; cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.card-preview-close:hover {
    background: rgba(124,77,255,0.35);
    border-color: rgba(124,77,255,0.5);
}
.card-preview-close svg { width: 16px; height: 16px; }


.card-preview-analyst-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #9b6dff, #7c4dff 70%);
    color: #fff;
    border: none;
    cursor: pointer;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(124,77,255,0.45);
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}
.card-preview-analyst-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(124,77,255,0.65);
}
.card-preview-analyst-btn .analyst-tooltip {
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(4px);
    padding: 6px 12px;
    background: rgba(91, 33, 182, 0.95);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}
.card-preview-analyst-btn:hover .analyst-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
.card-preview-analyst-btn svg { width: 20px; height: 20px; }
.card-preview-analyst-btn .fab-badge { display: none; }
.card-preview-analyst-btn::before {
    content: '';
    position: absolute; inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(124,77,255,0.4);
    animation: fab-pulse 2.5s ease-in-out infinite;
}
/* Ideating: oculta ring, muestra burbuja de pensamiento con dots */
.card-preview-analyst-btn.ideating::before { display: none; }
.card-preview-analyst-btn.ideating .fab-badge {
    display: flex; align-items: center; justify-content: center; gap: 3px;
    position: absolute; top: -4px; right: -6px;
    min-width: 0; width: 32px; height: 24px; padding: 0 6px;
    border-radius: 12px;
    background: linear-gradient(145deg, #5b21b6, #7c4dff);
    border: 1.5px solid rgba(255,255,255,0.7);
    box-shadow: 0 0 12px rgba(124,77,255,0.4), 0 4px 16px rgba(0,0,0,0.5);
    animation: fab-bubble-float 3s ease-in-out infinite;
}
.card-preview-analyst-btn.ideating .fab-badge::after {
    content: '';
    position: absolute; bottom: -7px; left: 6px;
    width: 0; height: 0;
    border-left: 6px solid transparent; border-right: 6px solid transparent;
    border-top: 8px solid rgba(255,255,255,0.7);
}
.card-preview-analyst-btn.ideating .fab-badge::before {
    content: '';
    position: absolute; bottom: -5px; left: 7px;
    width: 0; height: 0;
    border-left: 5px solid transparent; border-right: 5px solid transparent;
    border-top: 6px solid #6d28d9;
    z-index: 1;
}
.card-preview-analyst-btn.ideating .fab-badge .ideate-dot { display: block; }
/* Thinking (hover): ring rápido */
.card-preview-analyst-btn.thinking::before {
    display: block;
    animation: fab-think-pulse 1.4s ease-in-out infinite;
    border-color: rgba(124,77,255,0.6);
}

/* Hero image */
.card-preview-hero {
    position: relative;
    width: 100%; height: 240px;
    overflow: hidden;
    background: rgba(14,14,22,1);
}
.card-preview-hero img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.card-preview-hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, transparent 30%, rgba(22,22,34,0.95) 100%);
    pointer-events: none;
}
.card-preview-hero-meta {
    position: absolute; bottom: 12px; left: 16px; right: 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card-preview-meta-left {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.card-preview-date {
    font-size: 11px; color: rgba(255,255,255,0.65);
    font-weight: 500; letter-spacing: 0.02em;
}

/* Two-column body (content + related sidebar) */
.card-preview-body {
    display: flex;
}
.card-preview-body > .card-preview-content {
    flex: 1;
    min-width: 0;
    border-right: 1px solid rgba(255,255,255,0.06);
}
.card-preview-body > .card-preview-related {
    width: 280px;
    min-width: 280px;
    margin-top: 0;
    padding: 20px 18px 24px;
    border-top: none;
}

/* Content area */
.card-preview-content {
    padding: 20px 24px 24px;
}
.card-preview-title {
    font-family: 'Playfair Display', serif;
    font-size: 20px; font-weight: 700;
    color: var(--text-main);
    line-height: 1.35;
    margin: 0 0 14px;
}
.card-preview-snippet {
    font-size: 14px; line-height: 1.65;
    color: rgba(255,255,255,0.72);
    margin: 0 0 18px;
    font-style: italic;
    border-left: 2px solid rgba(124,77,255,0.35);
    padding-left: 14px;
}

/* Tema chips */
.card-preview-temas {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 20px;
}
.preview-tema-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 14px;
    background: rgba(124,77,255,0.1);
    border: 1px solid rgba(167,139,250,0.25);
    border-radius: 20px;
    color: #c4b5fd;
    font-size: 12px; font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.22,1,0.36,1);
    letter-spacing: 0.02em;
}
.preview-tema-chip:hover {
    background: rgba(124,77,255,0.25);
    border-color: rgba(167,139,250,0.55);
    color: #e9d5ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124,77,255,0.2);
}

/* Action buttons */
.card-preview-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.card-preview-share-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: rgba(255,255,255,0.7);
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.01em;
}
.card-preview-share-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.25);
    color: #fff;
    transform: translateY(-1px);
}
.card-preview-share-btn svg { width: 14px; height: 14px; }
.card-preview-source-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px;
    background: rgba(124,77,255,0.15);
    border: 1px solid rgba(124,77,255,0.35);
    border-radius: 8px;
    color: #c4b5fd;
    font-size: 13px; font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    letter-spacing: 0.01em;
}
.card-preview-source-btn:hover {
    background: rgba(124,77,255,0.3);
    border-color: rgba(124,77,255,0.6);
    color: #e9d5ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124,77,255,0.25);
}
.card-preview-source-btn svg { width: 14px; height: 14px; }

/* ─── Related Articles ("Te pudiera interesar") ─── */
.card-preview-related {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.related-header {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: rgba(167,139,250,0.8);
    margin-bottom: 12px;
}
.related-header svg { width: 13px; height: 13px; }

.related-grid {
    display: flex; flex-direction: column; gap: 10px;
}

.related-card {
    display: flex; gap: 12px; align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.22,1,0.36,1);
    animation: relatedFadeIn 0.4s ease both;
}
.related-card:hover {
    background: rgba(124,77,255,0.08);
    border-color: rgba(124,77,255,0.2);
    transform: translateX(4px);
}

.related-card-img {
    width: 56px; height: 56px; min-width: 56px;
    border-radius: 8px; overflow: hidden;
    background: rgba(14,14,22,1);
}
.related-card-img img {
    width: 100%; height: 100%; object-fit: cover;
}

.related-card-body {
    display: flex; flex-direction: column; gap: 3px;
    min-width: 0;
}
.related-card-title {
    font-size: 12.5px; font-weight: 600;
    color: var(--text-main);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.related-card-source {
    font-size: 10px; font-weight: 500;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.02em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

@keyframes relatedFadeIn {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Topic chips en "Te puede interesar" */
.related-topics {
    display: flex; gap: 6px; flex-wrap: wrap;
    margin-bottom: 12px;
}
.related-topic-chip {
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.55);
    font-size: 11px; font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.related-topic-chip:hover {
    border-color: rgba(124,77,255,0.4);
    background: rgba(124,77,255,0.1);
    color: rgba(255,255,255,0.85);
}
.related-topic-chip.active {
    border-color: rgba(124,77,255,0.6);
    background: rgba(124,77,255,0.18);
    color: #c4b5fd;
}
.related-topics-skel {
    display: flex; gap: 6px;
    margin-bottom: 12px;
}
.related-topic-pill-skel {
    width: 72px; height: 24px;
    border-radius: 20px;
    background: linear-gradient(110deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.2s ease infinite;
}
.related-empty {
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    text-align: center;
    padding: 16px 0;
}

/* Skeleton loader for related */
.related-skeleton {
    display: flex; gap: 12px; align-items: center;
    padding: 8px 10px;
}
.related-skeleton-img {
    width: 56px; height: 56px; min-width: 56px;
    border-radius: 8px;
    background: linear-gradient(110deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.2s ease infinite;
}
.related-skeleton-text {
    flex: 1; height: 32px;
    border-radius: 6px;
    background: linear-gradient(110deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 70%);
    background-size: 200% 100%;
    animation: shimmer 1.2s ease infinite;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive: volver a layout vertical en móvil */
@media (max-width: 768px) {
    .card-preview-modal { max-width: 520px; }
    .card-preview-body { flex-direction: column; }
    .card-preview-body > .card-preview-content { border-right: none; }
    .card-preview-body > .card-preview-related {
        width: auto; min-width: auto;
        margin-top: 20px;
        padding: 0 24px 24px;
        border-top: 1px solid rgba(255,255,255,0.06);
        padding-top: 18px;
    }
}

/* ─── Card Flip 3D (contenedor real front/back) ─── */
.flip-container {
    perspective: 1200px;
    overflow: visible;
}
.flip-inner {
    position: relative;
    width: 100%; height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.flip-inner.is-flipped {
    transform: rotateY(180deg);
}
.flip-face {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 10px;
    overflow: hidden;
}
.flip-front {
    z-index: 2;
}
.flip-back {
    transform: rotateY(180deg);
    z-index: 1;
}
/* Desactivar feedEntry en cards dentro del flip y en cards post-limpieza */
.flip-back .feed-card,
.no-feed-entry .feed-card,
.feed-card[style*="animation: none"] {
    animation: none !important;
    opacity: 1 !important;
}

/* ─── Responsive ─── */

/* ── Header Feed: Tablet Landscape (768px - 1200px) ── */
@media (max-width: 1200px) {
    .feed-top-row {
        gap: 12px;
    }
    .feed-top-row h1 {
        font-size: 1.75rem;
    }
    .feed-pagination {
        gap: 8px;
    }
    .feed-tag-wrapper {
        min-width: 150px;
        max-width: 280px;
    }
}

/* ── Header Feed: Tablet Portrait (481px - 767px) ── */
@media (max-width: 767px) {
    .feed-top-row {
        gap: 10px;
    }
    .feed-top-row h1 {
        font-size: 1.5rem;
        flex: 1 1 100%;
    }
    .feed-articles-count {
        order: 1;
    }
    #feed-pagination {
        order: 2;
        flex: 1 1 auto;
    }
    .feed-top-row .feed-filters {
        order: 3;
        flex: 1 1 100%;
        gap: 8px;
    }
    .feed-top-row .feed-filters > select,
    .feed-tag-wrapper {
        flex: 1 1 auto;
        min-width: 0;
        max-width: none;
    }
}

/* ── Header Feed: Mobile (≤ 480px) ── */
@media (max-width: 480px) {
    .feed-top-row {
        gap: 12px;
        padding-bottom: 14px;
    }
    .feed-top-row h1 {
        font-size: 1.35rem;
        flex: 1 1 100%;
        margin-bottom: 4px;
    }
    .feed-articles-count {
        order: 1;
        flex: 1 1 100%;
        text-align: center;
        font-size: 10px;
        padding: 6px 10px;
    }
    #feed-pagination {
        order: 2;
        flex: 1 1 100%;
        justify-content: center;
        gap: 10px;
    }
    .feed-pagination-goto {
        display: none;
    }
    .feed-pagination-info {
        font-size: 10px;
        min-width: auto;
    }
    .feed-pagination-btn {
        padding: 8px 16px;
        font-size: 10px;
    }
    .feed-top-row .feed-filters {
        order: 3;
        flex: 1 1 100%;
        flex-direction: column;
        gap: 8px;
    }
    .feed-top-row .feed-filters > select {
        width: 100%;
        min-width: 0;
    }
    .feed-tag-wrapper {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
}

@media (max-width: 1400px) {
    .feed-grid-featured .feed-card:nth-child(1)   { grid-column: span 7; }
    .feed-grid-featured .feed-card:nth-child(2),
    .feed-grid-featured .feed-card:nth-child(3)   { grid-column: span 5; }
    .feed-grid-regular                            { grid-template-columns: repeat(4, 1fr); gap: 22px; }
}
@media (max-width: 1100px) {
    .feed-grid-featured                           { grid-template-columns: repeat(6, 1fr); }
    .feed-grid-featured .feed-card:nth-child(1)   { grid-column: span 4; grid-row: span 2; }
    .feed-grid-featured .feed-card:nth-child(2),
    .feed-grid-featured .feed-card:nth-child(3)   { grid-column: span 2; min-height: 230px; }
    .feed-grid-regular                            { grid-template-columns: repeat(3, 1fr); }
    .feed-grid-featured .feed-card:nth-child(1) .feed-card-title { font-size: 18px; }
    .feed-grid-featured .feed-card:nth-child(2) .feed-card-title,
    .feed-grid-featured .feed-card:nth-child(3) .feed-card-title { font-size: 13.5px; }
}
@media (max-width: 800px) {
    .feed-grid-featured                           { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .feed-grid-featured .feed-card:nth-child(1)   { grid-column: span 2; grid-row: span 1; min-height: 300px; }
    .feed-grid-featured .feed-card:nth-child(n+2) { grid-column: span 1; }
    .feed-grid-featured .feed-card:nth-child(1) .feed-card-title { font-size: 18px; }
    .feed-grid-featured .feed-card:nth-child(2),
    .feed-grid-featured .feed-card:nth-child(3)   { min-height: 200px; }
    .feed-grid-regular                            { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
@media (max-width: 480px) {
    .feed-grid-featured, .feed-grid-regular       { grid-template-columns: 1fr; gap: 10px; }
    .feed-grid-featured .feed-card                { grid-column: span 1 !important; grid-row: span 1 !important; }
    .feed-grid-featured .feed-card:nth-child(1)   { min-height: 260px; }
    .feed-grid-featured .feed-card:nth-child(2),
    .feed-grid-featured .feed-card:nth-child(3)   { min-height: 200px; }
}



/* ═══════════════════════════════════════════════════════
   CREDENTIALS MODULE
═══════════════════════════════════════════════════════ */
.cred-form-panel                    { margin-bottom: 20px; animation: slideDown 0.22s ease; }
@keyframes slideDown                { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.cred-form-inner                    { border-radius: 14px; padding: 28px 32px 24px; max-width: 640px; }
.cred-form-header                   { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.cred-form-title                    { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600; color: var(--text-main); }
.cred-form-title i                  { width: 16px; height: 16px; color: var(--accent); }
.cred-form-close                    { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 4px; border-radius: 6px; transition: color 0.15s, background 0.15s; }
.cred-form-close:hover              { color: var(--text-main); background: var(--glass-hover); }
.cred-form-close i                  { width: 16px; height: 16px; display: block; }

/* Provider selector */
.cred-provider-row                  { display: flex; gap: 10px; margin-bottom: 22px; }
.cred-provider-btn                  { flex: 1; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; border: 1px solid var(--glass-border); background: var(--glass-bg); cursor: pointer; color: var(--text-dim); transition: all 0.18s; font-family: var(--font-main); font-size: 14px; font-weight: 500; }
.cred-provider-btn:hover            { border-color: var(--accent); color: var(--text-main); background: var(--accent-soft); }
.cred-provider-btn.active           { border-color: var(--accent); background: var(--accent-soft); color: var(--text-main); box-shadow: 0 0 0 1px var(--accent); }
.cred-provider-icon                 { font-size: 20px; line-height: 1; }
.cred-icon-openai                   { color: #10a37f; }
.cred-icon-azure                    { color: #0089d6; }
.cred-provider-label                { font-weight: 600; }

/* Fields */
.cred-fields                        { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.cred-input                         { width: 100%; }
.cred-field-hint                    { font-size: 11px; color: var(--text-dim); margin-left: 8px; display: inline-flex; align-items: center; gap: 3px; }
.cred-field-hint i                  { width: 10px; height: 10px; }

/* ── Catálogo de Modelos IA ── */
.cred-catalog-section {
    margin-top: 40px;
}
.cred-catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.cred-catalog-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.95rem; font-weight: 600;
    color: var(--text-main); margin: 0 0 4px;
}
.cred-catalog-title svg { width: 15px; height: 15px; color: var(--accent); }
.cred-catalog-subtitle { font-size: 0.78rem; color: var(--text-faint); margin: 0; }
.cred-catalog-body { display: flex; flex-direction: column; gap: 6px; }
.cred-catalog-loading { color: var(--text-faint); font-size: 0.85rem; padding: 12px 0; }
.cred-catalog-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.025);
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease;
    overflow: hidden;
}
.cred-catalog-row::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.cred-catalog-row:hover {
    background: rgba(124, 77, 255, 0.07);
    border-color: rgba(124, 77, 255, 0.3);
    box-shadow: 0 2px 16px rgba(0,0,0,0.28), 0 0 0 1px rgba(124,77,255,0.12);
    transform: translateY(-1px);
}
.cred-catalog-row:hover::before { opacity: 1; }
.cred-catalog-model-info {
    display: flex; align-items: center; gap: 12px;
    flex: 1; min-width: 0;
}
.cred-catalog-provider-icon {
    font-size: 1.1rem;
    color: var(--accent);
    flex-shrink: 0;
    width: 22px; text-align: center;
}
.cred-catalog-name {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-main);
    display: block;
}
.cred-catalog-model-id {
    font-size: 0.7rem;
    color: var(--text-faint);
    font-family: var(--font-mono);
    display: block;
    margin-top: 1px;
}
.cred-catalog-prices {
    display: flex; gap: 20px; flex-shrink: 0;
}
.cred-catalog-price {
    display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
}
.cred-catalog-price-label {
    font-size: 0.62rem; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-faint); font-weight: 600;
}
.cred-catalog-price-val {
    font-size: 0.92rem; font-weight: 700;
    color: #b8aaff;
    font-family: system-ui, -apple-system, sans-serif;
}
.cred-catalog-price-val-out { color: #ffd740; }
.cred-catalog-price-unit {
    font-size: 0.62rem; color: var(--text-faint);
    font-weight: 400; margin-left: 1px;
}
.cred-catalog-edit-btn {
    flex-shrink: 0;
    font-size: 0.78rem;
    padding: 6px 12px;
    gap: 5px;
    border-color: rgba(255,255,255,0.1);
}
.cred-catalog-edit-btn svg { width: 12px; height: 12px; }
.cred-catalog-edit-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Pricing update modal */
.cred-pricing-modal-inner { max-width: 380px; }
.cred-pricing-model-id {
    font-size: 0.72rem; font-family: var(--font-mono);
    color: var(--text-faint); margin: -10px 0 18px;
    padding: 0 2px;
}
.cred-pricing-fields { display: flex; flex-direction: column; gap: 14px; }

/* Model pricing hint below select */
.model-pricing-hint {
    display: flex;
    align-items: stretch;
    gap: 1px;
    margin-top: 8px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
}
.mph-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 9px 14px 8px;
    gap: 3px;
    background: rgba(255,255,255,0.03);
}
.mph-item:first-child { background: rgba(124,106,255,0.08); }
.mph-item:last-child  { background: rgba(255,215,64,0.06); }
.mph-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-faint);
    font-weight: 700;
}
.mph-val {
    font-size: 1.05rem;
    font-weight: 800;
    color: #b8aaff;
    letter-spacing: -0.02em;
    line-height: 1;
    font-family: system-ui, -apple-system, sans-serif;
}
.mph-val-out { color: #ffd740; }
.mph-unit {
    font-size: 0.62rem;
    color: var(--text-faint);
    font-weight: 500;
    letter-spacing: 0.02em;
}
.mph-sep { display: none; }

/* Key reveal */
.cred-key-wrap                      { display: flex; align-items: center; gap: 0; position: relative; }
.cred-key-input                     { flex: 1; border-radius: 8px 0 0 8px !important; border-right: none !important; }
.cred-reveal-btn                    { height: 40px; width: 42px; display: flex; align-items: center; justify-content: center; background: var(--glass-bg); border: 1px solid var(--glass-border); border-left: none; border-radius: 0 8px 8px 0; cursor: pointer; color: var(--text-dim); transition: all 0.15s; user-select: none; -webkit-user-select: none; }
.cred-reveal-btn:hover              { color: var(--text-main); background: var(--glass-hover); }
.cred-reveal-btn.active             { color: var(--accent); background: var(--accent-soft); }
.cred-reveal-btn i                  { width: 15px; height: 15px; pointer-events: none; }
.cred-key-hint                      { font-size: 11px; color: var(--text-faint); margin-top: 5px; display: block; }

/* Verify status */
.cred-verify-status                 { display: flex; align-items: center; gap: 9px; padding: 11px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 18px; }
.cred-verify-status i               { width: 16px; height: 16px; flex-shrink: 0; }
.cred-verify-status.verifying       { background: rgba(124,77,255,0.08); border: 1px solid rgba(124,77,255,0.2); color: var(--text-dim); }
.cred-verify-status.success         { background: rgba(0,230,118,0.07); border: 1px solid rgba(0,230,118,0.2); color: #00e676; }
.cred-verify-status.error           { background: rgba(255,82,82,0.07); border: 1px solid rgba(255,82,82,0.2); color: #ff5252; }
@keyframes credSpin                 { to { transform: rotate(360deg); } }
.cred-verify-spin                   { animation: credSpin 0.8s linear infinite; }

/* Form footer */
.cred-form-footer                   { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.cred-save-btn                      { min-width: 170px; justify-content: center; }
.cred-save-btn:disabled             { opacity: 0.6; cursor: not-allowed; }

/* Table */
.cred-table-wrap                    { border-radius: 14px; overflow: hidden; }
.cred-table                         { width: 100%; border-collapse: separate; border-spacing: 0; }
.cred-table th                      { padding: 11px 20px; }
.cred-table td                      { padding: 16px 20px; }
.cred-table tbody tr {
    position: relative;
    transition: background 0.2s ease, box-shadow 0.2s ease;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.cred-table tbody tr:last-child     { border-bottom: none; }
.cred-table tbody tr:hover {
    background: rgba(124, 77, 255, 0.06);
    box-shadow: inset 3px 0 0 var(--accent);
}
.cred-table tbody tr:hover .cred-name-text  { color: #fff; }
.cred-name-cell                     { font-weight: 500; }
.cred-name-text                     { font-family: var(--font-mono); font-size: 13px; color: var(--text-main); transition: color 0.2s; font-weight: 600; letter-spacing: 0.01em; }
.cred-date                          { font-size: 12.5px; color: var(--text-dim); }
.cred-actions                       { text-align: right; width: 80px; }
.cred-delete-btn                    { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 6px; border-radius: 6px; transition: color 0.15s, background 0.15s; }
.cred-delete-btn:hover              { color: var(--error); background: rgba(255,82,82,0.1); }
.cred-delete-btn i                  { width: 14px; height: 14px; display: block; }
.cred-chatbot-badge                 { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: #22c55e; background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); border-radius: 20px; padding: 3px 10px; white-space: nowrap; }
.cred-jobs-badge                    { color: #22c55e; background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.3); }
.cred-chatbot-btn                   { font-size: 11px; font-weight: 500; color: var(--text-faint); background: none; border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px; cursor: pointer; white-space: nowrap; transition: color 0.15s, border-color 0.15s, background 0.15s; }
.cred-chatbot-btn:hover             { color: #22c55e; border-color: rgba(34,197,94,0.5); background: rgba(34,197,94,0.08); }

/* Provider badges in table */
.cred-type-badge                    { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }
.cred-type-openai                   { background: rgba(16,163,127,0.1); color: #10a37f; border: 1px solid rgba(16,163,127,0.2); }
.cred-type-azure                    { background: rgba(0,137,214,0.1); color: #0089d6; border: 1px solid rgba(0,137,214,0.2); }
.cred-type-default                  { background: var(--glass-bg); color: var(--text-dim); border: 1px solid var(--glass-border); }

/* Status badges in table */
.cred-status-badge                  { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px; }
.cred-status-badge i                { width: 12px; height: 12px; }
.cred-status-badge.verified         { background: rgba(0,230,118,0.08); color: #00e676; border: 1px solid rgba(0,230,118,0.2); }
.cred-status-badge.unverified       { background: rgba(255,82,82,0.08); color: #ff5252; border: 1px solid rgba(255,82,82,0.2); }

/* Empty state */
.cred-empty-row td                  { padding: 40px 16px !important; }
.cred-empty-state                   { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-faint); }
.cred-empty-state i                 { width: 32px; height: 32px; opacity: 0.3; }
.cred-empty-state p                 { text-align: center; font-size: 13.5px; line-height: 1.6; }
.cred-empty-state strong            { color: var(--text-dim); }

/* Credential rename inline */
.cred-rename-input              { width: 100%; padding: 4px 8px; font-size: 13px; font-family: var(--font-mono); }
.cred-rename-btn                { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 6px; border-radius: 6px; transition: color 0.15s, background 0.15s; }
.cred-rename-btn:hover          { color: var(--accent); background: var(--accent-soft); }
.cred-rename-btn i,
.cred-confirm-btn i             { width: 14px; height: 14px; display: block; }
.cred-confirm-btn               { background: none; border: none; color: var(--success); cursor: pointer; padding: 6px; border-radius: 6px; transition: background 0.15s; }
.cred-confirm-btn:hover         { background: rgba(0,230,118,0.1); }
.cred-actions                   { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }

/* Credential edit modal */
.cred-edit-overlay              { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; animation: fadeIn 0.15s ease; }
@keyframes fadeIn               { from { opacity: 0; } to { opacity: 1; } }
.cred-edit-modal                { width: 100%; max-width: 480px; border-radius: 16px; padding: 28px 32px 24px; animation: slideDown 0.2s ease; }
.cred-edit-header               { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.cred-edit-title                { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600; color: var(--text-main); }
.cred-edit-title i              { width: 16px; height: 16px; color: var(--accent); }
.cred-edit-provider-tag         { margin-bottom: 20px; }
.cred-edit-btn                  { background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 6px; border-radius: 6px; transition: color 0.15s, background 0.15s; }
.cred-edit-btn:hover            { color: var(--accent); background: var(--accent-soft); }
.cred-edit-btn i                { width: 14px; height: 14px; display: block; }

/* ── Chatbot FAB — Propuesta 2: Círculo animado premium ── */
.chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #9b6dff, var(--accent, #7c4dff) 70%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    border: none;
    box-shadow: 0 4px 20px rgba(124, 77, 255, 0.35);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    /* Outer ring via pseudo-element */
}
.chatbot-fab::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(124, 77, 255, 0.4);
    animation: fab-pulse 2.5s ease-in-out infinite;
}
.chatbot-fab::after {
    content: none;
    position: absolute;
    top: 50%;
    right: calc(100% + 12px);
    transform: translateY(-50%);
    left: auto;
    bottom: auto;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(13, 13, 20, 0.95);
    border: 1px solid rgba(124, 77, 255, 0.3);
    color: #c4b5fd;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.03em;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(-50%) translateX(4px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.chatbot-fab:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
.chatbot-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(124, 77, 255, 0.5);
}
.chatbot-fab:hover::before {
    animation: none;
    border-color: rgba(124, 77, 255, 0.7);
}
.chatbot-fab i { width: 24px; height: 24px; }

/* ── FAB Recommendation Prompt (hover opt-in) ── */
.fab-rec-prompt {
    position: fixed;
    bottom: 33px;
    right: 94px;
    background: rgba(91, 33, 182, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(124, 77, 255, 0.35);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transform: translateX(8px);
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
    white-space: nowrap;
}
.fab-rec-prompt.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}
.fab-rec-prompt span {
    color: #e6edf3;
    font-size: 0.82rem;
    font-weight: 500;
}
.fab-rec-prompt-actions {
    display: flex;
    gap: 6px;
}
.fab-rec-prompt-yes,
.fab-rec-prompt-no {
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.fab-rec-prompt-yes {
    background: #7c3aed;
    color: #fff;
}
.fab-rec-prompt-yes:hover {
    background: #6d28d9;
}
.fab-rec-prompt-no {
    background: rgba(255, 255, 255, 0.1);
    color: #8b949e;
}
.fab-rec-prompt-no:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #e6edf3;
}

/* ── FAB Badge numérico (insights pendientes) ── */
.fab-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 20px; height: 20px;
    border-radius: 10px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    display: none;          /* se muestra vía JS */
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 8px rgba(239,68,68,0.5);
    animation: badge-pop 0.35s cubic-bezier(0.34,1.56,0.64,1) both;
    z-index: 2;
}
.fab-badge.visible { display: flex; }
@keyframes badge-pop {
    0%   { transform: scale(0); }
    100% { transform: scale(1); }
}

/* ── Panel de Insights (Agente de Conocimiento) ── */
.fab-insight-panel {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 700px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: linear-gradient(145deg, rgba(8, 6, 18, 0.92) 0%, rgba(16, 10, 32, 0.92) 100%);
    border: 1px solid rgba(140, 100, 255, 0.5);
    border-radius: 16px;
    padding: 14px 36px 16px 16px;
    color: #ede8f5;
    font-size: 13px;
    line-height: 1.5;
    box-shadow:
        0 0 15px rgba(124, 77, 255, 0.3),
        0 0 40px rgba(124, 77, 255, 0.1),
        0 20px 60px rgba(0, 0, 0, 0.8),
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    z-index: 1001;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(124,77,255,0.3) transparent;
}
/* ── Layout 2 columnas: temas (izq) + carrusel (der) ── */
.fab-panel-body {
    display: flex;
    gap: 0;
    align-items: stretch;
}
.fab-panel-left {
    width: 200px;
    min-width: 200px;
    padding-right: 16px;
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fab-panel-right {
    flex: 1;
    min-width: 0;
    padding-left: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fab-panel-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
    z-index: 2;
}
.fab-panel-close:hover {
    background: rgba(124,77,255,0.35);
    border-color: rgba(124,77,255,0.5);
    color: #fff;
}
.fab-panel-close svg { width: 14px; height: 14px; }
.fab-insight-panel.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.fab-panel-section { display: flex; flex-direction: column; gap: 6px; }
.fab-panel-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.fab-panel-label i { color: var(--accent); }

/* ── Topic chips ── */
#fab-panel-topics {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    flex: 1;
    justify-content: space-around;
}
.fab-topic-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    border-left: 2px solid rgba(124, 77, 255, 0.35);
    color: #d6d0f0;
    padding: 5px 8px 5px 10px;
    border-radius: 0;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.2s, color 0.2s;
    font-family: inherit;
    text-align: left;
    width: 100%;
    line-height: 1.4;
}
.fab-topic-chip:hover {
    border-left-color: var(--accent);
    background: rgba(124, 77, 255, 0.1);
    color: #fff;
    transform: translateX(3px);
}
.fab-topic-rank {
    font-size: 10px;
    font-weight: 700;
    color: rgba(124, 77, 255, 0.6);
    font-variant-numeric: tabular-nums;
    min-width: 18px;
    letter-spacing: 0.06em;
    flex-shrink: 0;
    transition: color 0.2s;
}
.fab-topic-chip:hover .fab-topic-rank {
    color: var(--accent);
}
.fab-topic-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

/* ── Carrusel ── */
.fab-carousel { position: relative; }
.fab-carousel-track { position: relative; }
.fab-carousel-slide {
    display: none;
    flex-direction: column;
    gap: 8px;
    animation: fabSlideIn 0.3s ease;
}
.fab-carousel-slide.active { display: flex; }
@keyframes fabSlideIn {
    from { opacity: 0; transform: translateX(6px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Card del artículo — magazine cover: imagen full-bleed + texto overlay */
.fab-slide-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.fab-slide-card:hover {
    transform: scale(1.015);
    border-color: rgba(124, 77, 255, 0.4);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 0 12px rgba(124, 77, 255, 0.15);
}
.fab-slide-media {
    position: relative;
    width: 100%;
    height: 172px;
}
.fab-slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: rgba(255, 255, 255, 0.05);
}
.fab-slide-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(8, 6, 18, 0.96) 0%,
        rgba(8, 6, 18, 0.4) 50%,
        transparent 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 12px;
}
.fab-slide-counter {
    align-self: flex-end;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.fab-slide-bottom {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.fab-rec-source {
    font-size: 9.5px;
    color: rgba(196, 181, 253, 0.65);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.fab-rec-title {
    font-size: 12.5px;
    font-weight: 600;
    color: #f0ecff;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

/* Pregunta contextual (habilitador de negocio) */
.fab-slide-question {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 12px;
    background: rgba(124,77,255,0.08);
    border: 1px solid rgba(124,77,255,0.2);
    border-radius: 10px;
    color: #c4b5fd;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    line-height: 1.4;
    transition: all 0.2s ease;
}
.fab-slide-question:hover {
    background: rgba(124,77,255,0.2);
    border-color: var(--accent);
    color: #fff;
}
.fab-slide-question i { color: var(--accent); margin-top: 1px; }

/* Dots — barras segmentadas */
.fab-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 10px;
}
.fab-carousel-dot {
    width: 16px;
    height: 3px;
    border-radius: 2px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 0;
    transition: width 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}
.fab-carousel-dot.active {
    width: 28px;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(124, 77, 255, 0.55);
}
.fab-carousel-dot:hover:not(.active) { background: rgba(255, 255, 255, 0.4); }

#fab-panel-generic {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
#fab-panel-generic .fab-panel-label {
    text-transform: none;
    font-size: 12.5px;
    color: rgba(255,255,255,0.7);
    line-height: 1.4;
}

/* ── CTA mini para panel genérico (no logueados) ── */
.fab-panel-cta-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 10px;
    padding: 9px 12px;
    background: rgba(124,77,255,0.12);
    border: 1px solid rgba(124,77,255,0.25);
    border-radius: 10px;
    color: #c4b5fd;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}
.fab-panel-cta-mini:hover {
    background: rgba(124,77,255,0.25);
    border-color: var(--accent);
    color: #fff;
}
.fab-panel-cta-mini i { color: var(--accent); }

/* ── FAB "ideating" — nube de pensamiento (thought bubble) ── */
.chatbot-fab.ideating {
    animation: fab-ideate-glow 3s ease-in-out infinite;
}
.chatbot-fab.ideating::before {
    display: none;
}

/* Speech bubble — sien derecha del bot */
.chatbot-fab.ideating .fab-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    top: -4px;
    right: -6px;
    min-width: 0;
    width: 32px;
    height: 24px;
    padding: 0 6px;
    border-radius: 12px;
    background: linear-gradient(145deg, #5b21b6, #7c4dff);
    border: 1.5px solid rgba(255, 255, 255, 0.7);
    box-shadow:
        0 0 12px rgba(124, 77, 255, 0.4),
        0 4px 16px rgba(0, 0, 0, 0.5);
    animation: fab-bubble-float 3s ease-in-out infinite;
}

/* Speech bubble arrow — sale del bottom-left apuntando al bot */
.chatbot-fab.ideating .fab-badge::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 6px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid rgba(255, 255, 255, 0.7);
}
.chatbot-fab.ideating .fab-badge::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 7px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #6d28d9;
    z-index: 1;
}

/* Dots (estado base del ideating) */
.fab-badge .ideate-dot {
    display: none;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #c4b5fd;
    animation: fab-dot-bounce 1.4s ease-in-out infinite;
}
.chatbot-fab.ideating .fab-badge .ideate-dot { display: block; }
.fab-badge .ideate-dot:nth-child(2) { animation-delay: 0.2s; }
.fab-badge .ideate-dot:nth-child(3) { animation-delay: 0.4s; }

/* Modo icono (cada 20s muestra un símbolo) */
.chatbot-fab.ideating .fab-badge.ideate-icon-mode {
    animation: fab-bubble-float 3s ease-in-out infinite, fab-icon-pop 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
.chatbot-fab.ideating .fab-badge.ideate-icon-mode svg {
    width: 14px;
    height: 14px;
    color: #c4b5fd;
    filter: drop-shadow(0 0 4px rgba(167, 139, 250, 0.5));
}

@keyframes fab-dot-bounce {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40%           { opacity: 1;   transform: scale(1.3); }
}
@keyframes fab-bubble-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-3px); }
}
@keyframes fab-icon-pop {
    0%   { transform: translateY(0) scale(0.6); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes fab-ideate-glow {
    0%, 100% { box-shadow: 0 4px 20px rgba(124, 77, 255, 0.35); }
    50%      { box-shadow: 0 4px 30px rgba(124, 77, 255, 0.6), 0 0 15px rgba(167, 139, 250, 0.3); }
}
@keyframes fab-ideate-orbit {
    0%   { transform: scale(1.15) rotate(0deg); }
    100% { transform: scale(1.15) rotate(360deg); }
}

/* ── FAB "thinking" pulse — más rápido que el idle ── */
.chatbot-fab.thinking::before {
    animation: fab-think-pulse 1.4s ease-in-out infinite;
    border-color: rgba(124, 77, 255, 0.6);
}
@keyframes fab-think-pulse {
    0%, 100% { transform: scale(1);   opacity: 0.6; }
    50%      { transform: scale(1.3); opacity: 0; }
}

@keyframes fab-pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.25); opacity: 0; }
}

.chat-sidebar {
    position: fixed;
    top: 0;
    right: -630px;
    width: 630px;
    height: calc(100vh - 36px);
    background: #0e0e12; /* Solid Premium Dark */
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.chat-sidebar.active { right: 0; }

.chat-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}
.chat-title i { color: var(--accent); font-size: 1.4rem; }

/* ── Mini-FAB animado en header del chat ── */
.chat-header-fab {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #9b6dff, #7c4dff 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.chat-header-fab i,
.chat-header-fab svg {
    width: 16px;
    height: 16px;
    color: #fff;
}

.chat-header-fab::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(124, 77, 255, 0.4);
    animation: fab-pulse 2.5s ease-in-out infinite;
}

.chat-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    transition: color 0.2s;
}
.chat-close:hover { color: var(--error); }

.chat-messages-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}
.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 0.95rem;
    line-height: 1.5;
}
.message-bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}
.message-user {
    align-self: flex-end;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

/* ── Markdown dentro de burbujas del bot ── */
.message-bot.markdown-body { max-width: 92%; }
.message-bot.markdown-body p { margin: 0 0 1.4em; line-height: 1.75; }
.message-bot.markdown-body p:last-child { margin-bottom: 0; }
.message-bot.markdown-body strong { color: #c4b5fd; font-weight: 700; }
.message-bot.markdown-body em { color: rgba(255,255,255,0.7); font-style: italic; }
.message-bot.markdown-body h1,
.message-bot.markdown-body h2,
.message-bot.markdown-body h3 {
    color: var(--accent);
    font-weight: 700;
    margin: 0.9em 0 0.35em;
    line-height: 1.3;
}
.message-bot.markdown-body h1 { font-size: 1.05rem; }
.message-bot.markdown-body h2 { font-size: 0.98rem; }
.message-bot.markdown-body h3 { font-size: 0.92rem; color: #a78bfa; }
.message-bot.markdown-body ul,
.message-bot.markdown-body ol {
    margin: 0.5em 0 1em 1.2em;
    padding: 0;
}
.message-bot.markdown-body li { margin-bottom: 0.55em; line-height: 1.65; }
.message-bot.markdown-body hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 0.8em 0;
}
.message-bot.markdown-body code {
    background: rgba(124,77,255,0.15);
    border: 1px solid rgba(124,77,255,0.25);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 0.85em;
    font-family: 'JetBrains Mono', monospace;
    color: #c4b5fd;
}
/* Referencias inline tipo [[1]](url) */
.message-bot.markdown-body a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.72em;
    vertical-align: baseline;
    line-height: 1;
    font-weight: 700;
    background: rgba(124,77,255,0.12);
    border: 1px solid rgba(124,77,255,0.30);
    border-radius: 4px;
    padding: 2px 5px;
    margin: 0 1px;
    transition: background 0.15s;
    white-space: nowrap;
    position: relative;
    top: -1px;
}
.message-bot.markdown-body a:hover {
    background: rgba(124,77,255,0.28);
    color: #c4b5fd;
}
.message-bot.markdown-body blockquote {
    border-left: 3px solid var(--accent);
    margin: 0.5em 0;
    padding: 0.3em 0.8em;
    background: rgba(124,77,255,0.06);
    border-radius: 0 6px 6px 0;
    color: rgba(255,255,255,0.7);
    font-style: italic;
}

.chat-input-area {
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

/* Botón toggle de filtros (solo visible tras primera pregunta) */
.chat-filters-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: rgba(124, 77, 255, 0.08);
    border: 1px solid rgba(124, 77, 255, 0.15);
    border-radius: 10px;
    color: #c4b5fd;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-filters-toggle i {
    width: 16px;
    height: 16px;
}

.chat-filters-toggle .toggle-icon {
    margin-left: auto;
    transition: transform 0.3s ease;
}

.chat-filters-toggle:hover {
    background: rgba(124, 77, 255, 0.12);
    border-color: rgba(124, 77, 255, 0.3);
}

.chat-filters-toggle:not(.collapsed) .toggle-icon {
    transform: rotate(180deg);
}

/* Sección expandible (filtros + quick queries) */
.chat-expandable-section {
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-context-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.chat-control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chat-control-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-left: 4px;
}

.chat-control-group .input-glass {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-suggestions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.chat-suggestion-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(124, 77, 255, 0.08);
    border: 1px solid rgba(124, 77, 255, 0.2);
    border-radius: 12px;
    color: #c4b5fd;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
}

.chat-suggestion-btn i {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.chat-suggestion-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 77, 255, 0.2);
}

.chat-suggestion-btn:active {
    transform: translateY(0);
}

/* ── Micro-copy para anónimos ── */
.chat-anon-microcopy {
    text-align: center;
    font-size: 0.74rem;
    color: #a78bfa;
    padding: 6px 0 2px;
    font-weight: 500;
}

/* Textarea row */
.chat-textarea-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.chat-textarea {
    flex: 1;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.875rem;
    line-height: 1.4;
    overflow-y: hidden;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    transition: transform 0.15s, opacity 0.15s;
}
.chat-send-btn:hover { transform: scale(1.08); }
.chat-send-btn i { width: 18px; height: 18px; }

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px 16px !important;
    background: rgba(124,77,255,0.06) !important;
    border: 1px solid rgba(124,77,255,0.18) !important;
}
.typing-dots { display: flex; gap: 5px; align-items: center; }
.typing-dots span {
    width: 7px; height: 7px;
    background: var(--accent);
    border-radius: 50%;
    animation: typingBounce 1.3s infinite ease-in-out;
    box-shadow: 0 0 6px rgba(124,77,255,0.5);
}
.typing-dots span:nth-child(2) { animation-delay: 0.22s; }
.typing-dots span:nth-child(3) { animation-delay: 0.44s; }
.typing-label {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.03em;
    animation: typingFade 1.6s infinite ease-in-out;
}
@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30% { transform: translateY(-5px); opacity: 1; }
}
@keyframes typingFade {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Entry animations */
@keyframes msgPop {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-message {
    animation: msgPop 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ── Chat Login Overlay ── */
.chat-login-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 14, 0.92);
    backdrop-filter: blur(12px);
    z-index: 10;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: msgPop 0.25s ease forwards;
}
.chat-login-card {
    background: #16161e;
    border: 1px solid rgba(124, 77, 255, 0.25);
    border-radius: 20px;
    padding: 32px 28px;
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
.chat-login-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(124, 77, 255, 0.12);
    border: 1px solid rgba(124, 77, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}
.chat-login-icon i { width: 26px; height: 26px; }
.chat-login-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    text-align: center;
}
.chat-login-desc {
    font-size: 0.875rem;
    color: var(--text-dim);
    text-align: center;
    margin: 0;
    line-height: 1.6;
}
.chat-login-demo-user {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 16px;
    width: 100%;
}
.chat-login-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}
.chat-login-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.chat-login-user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}
.chat-login-user-email {
    font-size: 0.78rem;
    color: var(--text-dim);
}
.chat-login-btn {
    width: 100%;
    padding: 12px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}
.chat-login-btn:hover { background: #6d28d9; transform: translateY(-1px); }
.chat-login-btn i { width: 16px; height: 16px; }
.chat-login-notice {
    font-size: 0.73rem;
    color: var(--text-dim);
    text-align: center;
    margin: 0;
    line-height: 1.5;
    opacity: 0.7;
}
.chat-login-notice a { color: var(--accent); text-decoration: none; }

/* ── Chat Login Hint (debajo del textarea) ── */
.chat-login-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: var(--text-dim);
    padding: 4px 2px 0;
    opacity: 0.7;
}
.chat-login-hint a { color: var(--accent); text-decoration: none; }
.chat-login-hint a:hover { text-decoration: underline; }

/* ── Chat Session Badge (header) ── */
.chat-session-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(124, 77, 255, 0.12);
    border: 1px solid rgba(124, 77, 255, 0.25);
    border-radius: 20px;
    padding: 4px 10px 4px 4px;
    font-size: 0.75rem;
    color: var(--accent);
}
.chat-session-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-session-name { font-weight: 600; }

/* ── Chat Session Welcome message ── */
.chat-session-welcome {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    background: rgba(124, 77, 255, 0.07);
    border-color: rgba(124, 77, 255, 0.2);
    max-width: 100%;
}
.chat-session-welcome strong { color: var(--accent); }

/* ── Toast temporal de bienvenida (animaciones desde abajo) ── */
@keyframes toastSlideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

.chat-welcome-toast {
    position: relative;
    animation: toastSlideIn 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.chat-welcome-toast.exiting {
    animation: toastSlideOut 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ── Follow-up Question Chips ── */
.chat-follow-up-strip {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-self: flex-start;
    width: 100%;
    max-width: 92%;
    animation: msgPop 0.3s ease forwards;
}
.chat-follow-up-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-dim);
    padding: 0 2px;
    opacity: 0.7;
}
.chat-follow-up-chip {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-start;
    background: rgba(124, 77, 255, 0.06);
    border: 1px solid rgba(124, 77, 255, 0.2);
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    width: 100%;
}
.chat-follow-up-chip:hover {
    background: rgba(124, 77, 255, 0.14);
    border-color: rgba(124, 77, 255, 0.45);
    transform: translateX(2px);
}
.chat-follow-up-q {
    font-size: 0.875rem;
    color: var(--text-main);
    font-weight: 500;
    line-height: 1.4;
}
.chat-follow-up-ctx {
    font-size: 0.72rem;
    color: var(--accent);
    opacity: 0.75;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ── Cookie Consent Banner (GDPR) ── */
#cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: 1rem 1.5rem;
    background: rgba(18, 18, 23, 0.95);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    animation: slideUpConsent 0.3s ease-out;
}
@keyframes slideUpConsent {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.cookie-consent-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: nowrap;
}
.cookie-consent-inner p {
    font-size: 1.05rem;
    color: var(--text-main);
    line-height: 1.6;
    flex: 1;
    min-width: 200px;
    white-space: nowrap;
}
.cookie-consent-inner a {
    color: var(--accent);
    text-decoration: underline;
}
.cookie-consent-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}
.cookie-btn {
    padding: 0.65rem 1.6rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
}
.cookie-btn-accept {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.cookie-btn-accept:hover { filter: brightness(1.15); }
.cookie-btn-reject {
    background: transparent;
    color: var(--text-dim);
}
.cookie-btn-reject:hover { background: var(--glass-hover); color: var(--text-main); }

/* ── Chat: Cited Article Cards ───────────────────────────────── */
.chat-cited-section {
    margin: 10px 0 4px;
}
.chat-cited-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.28);
    margin-bottom: 8px;
}
.chat-cited-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent, #8b5cf6);
    box-shadow: 0 0 6px var(--accent, #8b5cf6);
    flex-shrink: 0;
}
.chat-cited-cards {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.chat-cited-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    padding: 8px;
    transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
    animation: citedCardIn 0.35s ease both;
}
.chat-cited-card:hover {
    background: rgba(139,92,246,0.1);
    border-color: rgba(139,92,246,0.3);
    transform: translateX(3px);
}
@keyframes citedCardIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cited-card-img-wrap {
    width: 64px;
    height: 52px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255,255,255,0.05);
}
.cited-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cited-card-img-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(139,92,246,0.25), rgba(59,130,246,0.15));
    font-size: 20px;
    font-weight: 700;
    color: rgba(255,255,255,0.45);
}
.cited-card-img-skeleton {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,rgba(255,255,255,0.04) 25%,rgba(255,255,255,0.09) 50%,rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
.cited-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.cited-card-titulo {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    color: rgba(255,255,255,0.82);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cited-card-title-skeleton {
    height: 10px;
    width: 80%;
    border-radius: 4px;
    background: linear-gradient(90deg,rgba(255,255,255,0.04) 25%,rgba(255,255,255,0.09) 50%,rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}
.cited-card-temas {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.cited-card-tema {
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: rgba(139,92,246,0.9);
    background: rgba(139,92,246,0.1);
    border: 1px solid rgba(139,92,246,0.2);
    border-radius: 4px;
    padding: 1px 5px;
    text-transform: lowercase;
}

/* ── Botón Leídos en feed ── */
.feed-read-history-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: 10px;
  color: var(--accent, #7c3aed);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.feed-read-history-btn:hover:not(.disabled) {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.4);
  transform: translateY(-1px);
}

.feed-read-history-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.feed-read-count {
  background: var(--accent, #7c3aed);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 8px;
  min-width: 20px;
  text-align: center;
}

.feed-read-history-btn.disabled .feed-read-count {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}

/* ── Modal Leídos ── */
.read-history-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(20px);
  overflow-y: auto;
  padding: 32px;
}

.read-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto 24px;
}

.read-history-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.read-history-scope-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(124, 58, 237, 0.15);
  color: var(--accent, #7c3aed);
  letter-spacing: 0.3px;
}

.read-history-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #8b949e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.read-history-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.read-history-grid {
  max-width: 1400px;
  margin: 0 auto;
}

/* ── CTA inline post-respuesta (anónimos) ── */
.chat-anon-cta {
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.chat-anon-exhausted {
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    margin-top: 8px;
}

.chat-anon-blocked {
    margin-top: 8px;
}
