/* ═══════════════════════════════════════════════════════════
   prediction.css  —  Módulo Prediction IA
   ═══════════════════════════════════════════════════════════ */

/* ── Animations ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

/* ── Page Header ── */
.pred-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.pred-page-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.pred-page-header-left h1 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.pred-page-icon {
    font-size: 1.5rem;
    color: var(--accent-cyan, #06b6d4);
}
.pred-page-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Connection Selector ── */
.pred-conn-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 1rem;
}
.pred-conn-selector label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
}
.pred-conn-selector select {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-input);
    color: var(--text-primary);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-family: inherit;
    min-width: 200px;
}
.pred-conn-selector select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* ── Tabs ── */
.pred-tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.25rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.pred-tabs::-webkit-scrollbar { display: none; }
.pred-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    font-family: inherit;
}
.pred-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.03);
}
.pred-tab.active {
    color: var(--accent-cyan, #06b6d4);
    border-bottom-color: var(--accent-cyan, #06b6d4);
}
.pred-tab .material-symbols-rounded {
    font-size: 1.15rem;
}
.pred-tab-badge {
    background: var(--accent-red);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 100px;
    min-width: 16px;
    text-align: center;
    line-height: 1.4;
}

/* ── Tab Content ── */
.pred-tab-content {
    display: none;
    animation: fadeInUp 0.25s ease-out;
}
.pred-tab-content.active {
    display: block;
}

/* ── KPI Cards ── */
.pred-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.pred-kpi {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.2s;
}
.pred-kpi:hover {
    border-color: var(--accent-cyan, #06b6d4);
    transform: translateY(-1px);
}
.pred-kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pred-kpi-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.pred-kpi-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
}
.pred-kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.pred-kpi-change {
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}
.pred-kpi-change.up { color: var(--accent-green); }
.pred-kpi-change.down { color: var(--accent-red); }
.pred-kpi-change .material-symbols-rounded { font-size: 0.9rem; }

/* ── Section Card ── */
.pred-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}
.pred-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.pred-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pred-section-title .material-symbols-rounded {
    font-size: 1.2rem;
    color: var(--accent-cyan, #06b6d4);
}
.pred-section-actions {
    display: flex;
    gap: 0.35rem;
}

/* ── Chart Container ── */
.pred-chart-wrap {
    position: relative;
    width: 100%;
    height: 320px;
    margin-bottom: 0.5rem;
}
.pred-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── Quick Form ── */
.pred-quick-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.pred-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.pred-form-group label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.pred-form-group input,
.pred-form-group select,
.pred-form-group textarea {
    background: var(--bg-secondary);
    border: 1px solid var(--border-input);
    color: var(--text-primary);
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
}
.pred-form-group input:focus,
.pred-form-group select:focus,
.pred-form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
}
.pred-form-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

/* ── Data Table ── */
.pred-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}
.pred-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.pred-table th {
    background: var(--bg-secondary);
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.pred-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.pred-table tr:last-child td {
    border-bottom: none;
}
.pred-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

/* ── Alerts ── */
.pred-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.pred-alert-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 10px;
    border-left: 3px solid var(--border-color);
    transition: all 0.2s;
}
.pred-alert-item:hover {
    background: var(--bg-card-hover);
}
.pred-alert-item.severity-critical {
    border-left-color: var(--accent-red);
}
.pred-alert-item.severity-warning {
    border-left-color: var(--accent-yellow);
}
.pred-alert-item.severity-info {
    border-left-color: var(--accent-blue);
}
.pred-alert-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pred-alert-icon.critical {
    background: var(--accent-red-bg);
    color: var(--accent-red);
}
.pred-alert-icon.warning {
    background: var(--accent-yellow-bg);
    color: var(--accent-yellow);
}
.pred-alert-icon.info {
    background: var(--accent-blue-bg);
    color: var(--accent-blue);
}
.pred-alert-icon .material-symbols-rounded {
    font-size: 1.1rem;
}
.pred-alert-body {
    flex: 1;
    min-width: 0;
}
.pred-alert-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}
.pred-alert-msg {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}
.pred-alert-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.pred-alert-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* ── Severity Badges ── */
.pred-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.pred-badge-critical { background: var(--accent-red-bg); color: var(--accent-red); }
.pred-badge-warning  { background: var(--accent-yellow-bg); color: var(--accent-yellow); }
.pred-badge-info     { background: var(--accent-blue-bg); color: var(--accent-blue); }
.pred-badge-area {
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan, #06b6d4);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
}

/* ── Simulator ── */
.pred-sim-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.pred-sim-vars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.pred-sim-var {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.pred-sim-var-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pred-sim-var-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
}
.pred-sim-var-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-cyan, #06b6d4);
    min-width: 3em;
    text-align: right;
}
.pred-sim-var input[type="range"] {
    width: 100%;
    accent-color: var(--accent-cyan, #06b6d4);
    height: 4px;
}
.pred-sim-result {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
}

/* ── Config Cards ── */
.pred-configs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.pred-config-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.pred-config-card:hover {
    border-color: var(--accent-cyan, #06b6d4);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.08);
}
.pred-config-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}
.pred-config-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}
.pred-config-card-badges {
    display: flex;
    gap: 4px;
}
.pred-config-card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.pred-config-card-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}
.pred-config-card-meta .material-symbols-rounded {
    font-size: 0.9rem;
}
.pred-config-card-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
}
.pred-config-card:hover .pred-config-card-actions {
    opacity: 1;
}

/* ── Scenarios ── */
.pred-scenarios-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.pred-scenario-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}
.pred-scenario-item:hover {
    border-color: var(--accent-cyan, #06b6d4);
}

/* ── Empty State ── */
.pred-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-secondary);
}
.pred-empty .material-symbols-rounded {
    font-size: 3.5rem;
    color: var(--text-muted);
}
.pred-empty h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
    font-weight: 600;
}
.pred-empty p {
    max-width: 400px;
    line-height: 1.5;
    font-size: 0.88rem;
}

/* ── Loading ── */
.pred-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem;
    color: var(--text-secondary);
}

/* ── Toast ── */
.pred-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    z-index: 9999;
    animation: fadeInUp 0.3s ease-out;
    box-shadow: var(--shadow-lg);
}
.pred-toast.success { background: var(--accent-green); }
.pred-toast.error { background: var(--accent-red); }
.pred-toast.info { background: var(--accent-blue); }

/* ── Modal ── */
.pred-modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-modal-overlay);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInUp 0.2s ease-out;
}
.pred-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.pred-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.pred-modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pred-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ── Metric pill ── */
.pred-metric {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
}
.pred-metric strong {
    color: var(--text-primary);
}

/* ── Clickable metrics bar ── */
.pred-metrics-bar {
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s, box-shadow 0.2s;
    padding: 2px;
    margin: -2px;
}
.pred-metrics-bar:hover {
    background: rgba(255,255,255,0.04);
    box-shadow: 0 0 0 1px var(--border-color);
}

/* ── Metrics Detail Modal ── */
.md-model-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.md-model-icon {
    font-size: 2rem;
    color: var(--accent-color, #06b6d4);
    background: rgba(6,182,212,0.1);
    padding: 10px;
    border-radius: 12px;
}
.md-model-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}
.md-model-tipo {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.md-semaforo {
    border: 1px solid;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 18px;
}
.md-semaforo-header {
    display: flex;
    align-items: center;
    gap: 12px;
}
.md-semaforo-label {
    font-weight: 700;
    font-size: 1.05rem;
}
.md-semaforo-value {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.md-semaforo-scale {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.md-scale-segment {
    flex: 1;
    text-align: center;
    font-size: 0.75rem;
    padding: 4px 0;
    border-radius: 6px;
    color: var(--text-secondary);
}
.md-scale-good { background: rgba(16,185,129,0.1); }
.md-scale-ok   { background: rgba(245,158,11,0.1); }
.md-scale-bad  { background: rgba(239,68,68,0.1); }

.md-metrics-table {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}
.md-metric-row {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
}
.md-metric-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.md-metric-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent-color, #06b6d4);
}
.md-metric-value {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}
.md-metric-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.md-metric-desc {
    font-size: 0.78rem;
    color: var(--text-tertiary, rgba(255,255,255,0.35));
    line-height: 1.4;
}

.md-interpretation {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: rgba(6,182,212,0.06);
    border: 1px solid rgba(6,182,212,0.15);
    border-radius: 10px;
    padding: 14px 16px;
}
.md-interpretation .material-symbols-rounded {
    font-size: 1.3rem;
    color: #06b6d4;
    flex-shrink: 0;
    margin-top: 2px;
}
.md-interpretation p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════
   CHAT IA — Drawer del asistente de predicciones
   ═══════════════════════════════════════════════════════════ */

/* ── Toggle button ── */
.pred-chat-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #06b6d4, #0891b2) !important;
    color: #fff !important;
    border: none !important;
    padding: 6px 14px !important;
    border-radius: 8px !important;
    font-weight: 600;
    font-size: 0.82rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}
.pred-chat-toggle:hover {
    background: linear-gradient(135deg, #0891b2, #0e7490) !important;
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.45);
    transform: translateY(-1px);
}
.pred-chat-toggle.active {
    background: linear-gradient(135deg, #0891b2, #155e75) !important;
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.5), 0 4px 16px rgba(6, 182, 212, 0.4);
}
.pred-chat-toggle .material-symbols-rounded { font-size: 18px; }
.pred-chat-toggle-label { white-space: nowrap; }

/* ── Drawer container ── */
.pred-chat-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    height: 100vh;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1100;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
}
.pred-chat-drawer.open {
    transform: translateX(0);
}

body.pred-chat-open .main-content {
    margin-right: 420px;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
body:not(.pred-chat-open) .main-content {
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Header ── */
.pred-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}
.pred-chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pred-chat-icon {
    font-size: 28px;
    color: var(--accent-cyan, #06b6d4);
    background: rgba(6, 182, 212, 0.12);
    padding: 8px;
    border-radius: 12px;
}
.pred-chat-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}
.pred-chat-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

/* ── Model selector ── */
.pred-chat-model-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.6);
    flex-shrink: 0;
}
.pred-chat-model-icon { font-size: 16px; color: var(--text-muted); }
.pred-chat-model-bar select {
    flex: 1;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-input);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.75rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-appearance: auto;
}
.pred-chat-model-bar select:hover { border-color: var(--text-muted); }
.pred-chat-model-bar select:focus {
    border-color: var(--accent-cyan, #06b6d4);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

/* ── Messages area ── */
.pred-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
.pred-chat-messages::-webkit-scrollbar { width: 5px; }
.pred-chat-messages::-webkit-scrollbar-track { background: transparent; }
.pred-chat-messages::-webkit-scrollbar-thumb { background: var(--bg-secondary); border-radius: 4px; }

/* ── Welcome ── */
.pred-chat-welcome {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-muted);
}
.pred-chat-welcome-icon {
    font-size: 48px;
    color: var(--accent-cyan, #06b6d4);
    display: block;
    margin: 0 auto 16px;
    opacity: 0.6;
}
.pred-chat-welcome h4 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 8px;
}
.pred-chat-welcome p {
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

/* ── Chat bubbles ── */
.pred-chat-msg {
    max-width: 90%;
    min-width: 0;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.55;
    word-break: break-word;
    overflow-wrap: anywhere;
    animation: fadeInUp 0.25s ease-out;
}
.pred-chat-msg-user {
    align-self: flex-end;
    background: var(--accent-cyan, #06b6d4);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.pred-chat-msg-assistant {
    align-self: flex-start;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}
.pred-chat-msg-assistant p { margin: 0 0 6px; }
.pred-chat-msg-assistant p:last-child { margin-bottom: 0; }
.pred-chat-msg-assistant code {
    background: rgba(6, 182, 212, 0.15);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--accent-cyan, #06b6d4);
    word-break: break-all;
}
.pred-chat-msg-assistant pre {
    background: var(--bg-card);
    padding: 10px 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 0.78rem;
    max-width: 100%;
}
.pred-chat-msg-assistant ol,
.pred-chat-msg-assistant ul {
    padding-left: 1.2em;
    margin: 4px 0;
}
.pred-chat-msg-assistant pre code {
    background: none;
    padding: 0;
}

/* ── Action chips ── */
.pred-chat-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.pred-chat-action-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    white-space: nowrap;
}
.pred-chat-action-chip.crear {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}
.pred-chat-action-chip.ejecutar,
.pred-chat-action-chip.ejecutar_rapida {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
}
.pred-chat-action-chip.eliminar {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

/* ── Token badge ── */
.pred-chat-token-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 6px;
    font-size: 0.65rem;
    color: rgba(148, 163, 184, 0.5);
    user-select: none;
    transition: color .2s;
}
.pred-chat-msg-assistant:hover .pred-chat-token-badge {
    color: rgba(148, 163, 184, 0.8);
}

/* ── Typing indicator ── */
.pred-chat-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    max-width: 90%;
}
.pred-chat-typing-dots { display: flex; gap: 4px; }
.pred-chat-typing-dots span {
    width: 7px;
    height: 7px;
    background: var(--accent-cyan, #06b6d4);
    border-radius: 50%;
    animation: predTypingBounce 1.4s infinite ease-in-out;
}
.pred-chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.pred-chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes predTypingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ── Suggestions ── */
.pred-chat-suggestions {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}
.pred-chat-suggestions::-webkit-scrollbar { display: none; }
.pred-chat-suggestions:empty { display: none; }
.pred-chat-suggestion {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 20px;
    color: var(--accent-cyan, #06b6d4);
    font-size: 0.78rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.pred-chat-suggestion:hover {
    background: rgba(6, 182, 212, 0.18);
    border-color: rgba(6, 182, 212, 0.4);
}
.pred-chat-suggestion .material-symbols-rounded { font-size: 14px; }

/* ── Input area ── */
.pred-chat-input-area {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    flex-shrink: 0;
}
.pred-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-input);
    border-radius: 14px;
    padding: 4px;
    transition: border-color 0.2s ease;
}
.pred-chat-input-wrap:focus-within {
    border-color: var(--accent-cyan, #06b6d4);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}
#predChatInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.87rem;
    padding: 10px 12px;
    resize: none;
    min-height: 20px;
    max-height: 120px;
    line-height: 1.4;
    outline: none;
    font-family: inherit;
}
#predChatInput::placeholder { color: var(--text-muted); }
.pred-chat-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--accent-cyan, #06b6d4);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.pred-chat-send:hover { background: #0891b2; }
.pred-chat-send:disabled { opacity: 0.4; cursor: not-allowed; }
.pred-chat-send .material-symbols-rounded { font-size: 18px; }

/* ── Archivo adjunto ── */
.pred-chat-file-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin-bottom: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-input);
    border-radius: 10px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.pred-chat-file-preview img {
    width: 48px; height: 48px;
    object-fit: cover;
    border-radius: 6px;
}
.pred-chat-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pred-chat-file-remove {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 2px; border-radius: 4px; display: flex;
}
.pred-chat-file-remove:hover { color: var(--text-primary); background: var(--bg-card); }
.pred-chat-attach-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 4px 2px; display: flex; align-items: center;
    border-radius: 6px; transition: color .15s; flex-shrink: 0;
}
.pred-chat-attach-btn:hover { color: var(--text-primary); }
.pred-chat-file-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; margin-bottom: 6px;
    background: rgba(6, 182, 212, 0.12); border-radius: 6px;
    font-size: 0.78rem; color: var(--accent-cyan, #06b6d4);
}
.pred-chat-file-chip .material-symbols-rounded { font-size: .85rem; }
.pred-chat-file-chip-img { flex-direction: column; align-items: flex-start; padding: 6px; }
.pred-chat-file-chip-img img { max-width: 180px; max-height: 120px; border-radius: 6px; object-fit: cover; }
.pred-chat-file-chip-img span { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; word-break: break-all; }

/* ═══════════════════════════════════════════
   CLIMA TOGGLE & COORDS
   ═══════════════════════════════════════════ */
.pred-clima-toggle { padding-top: 0.25rem; }
.pred-switch-label {
    display: flex; align-items: center; gap: 0.5rem;
    cursor: pointer; font-weight: 500; font-size: 0.88rem;
    color: var(--text-primary);
}
.pred-switch-wrap {
    position: relative; width: 38px; height: 20px; flex-shrink: 0;
}
.pred-switch-wrap input { opacity: 0; width: 0; height: 0; position: absolute; }
.pred-switch-slider {
    position: absolute; inset: 0; border-radius: 10px;
    background: var(--bg-tertiary); transition: background 0.25s;
}
.pred-switch-slider::after {
    content: ''; position: absolute; left: 2px; top: 2px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--text-muted); transition: transform 0.25s, background 0.25s;
}
.pred-switch-wrap input:checked + .pred-switch-slider {
    background: var(--primary);
}
.pred-switch-wrap input:checked + .pred-switch-slider::after {
    transform: translateX(18px); background: #fff;
}
.pred-clima-hint {
    display: block; font-size: 0.78rem; color: var(--text-muted);
    margin-top: 0.25rem; padding-left: 3.2rem;
}
.pred-clima-coords {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
    padding: 0.75rem 1rem; margin-top: -0.25rem;
    border-left: 3px solid var(--primary); border-radius: 0 8px 8px 0;
    background: color-mix(in srgb, var(--primary) 5%, transparent);
    animation: predClimaCoordsIn 0.3s ease;
}
@keyframes predClimaCoordsIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.pred-clima-coords .pred-form-group { margin: 0; }
.pred-metric-weather {
    background: color-mix(in srgb, var(--primary) 12%, transparent) !important;
    border-color: var(--primary) !important;
}

/* ═══════════════════════════════════════════
   MAP PICKER MODAL
   ═══════════════════════════════════════════ */
.pred-map-modal {
    width: min(600px, 92vw);
    max-height: 85vh;
}
.pred-map-container {
    width: 100%;
    height: 400px;
    cursor: crosshair;
}
.pred-map-container .leaflet-control-attribution {
    font-size: 0.65rem;
    background: color-mix(in srgb, var(--bg-primary) 85%, transparent);
}
.pred-map-info {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--primary) 5%, transparent);
    border-top: 1px solid var(--border);
}
.pred-map-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.pred-map-coords-display {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

@media (max-width: 600px) {
    .pred-map-container { height: 300px; }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .pred-chat-drawer { width: 100%; }
    body.pred-chat-open .main-content { margin-right: 0; }
    .pred-chat-toggle-label { display: none; }

    /* Medido en 390px: la cabecera de acciones ocupaba 402px y sacaba la página
       22px fuera de pantalla. Se deja envolver en varias filas. */
    .pred-page-header,
    .pred-page-header-right { flex-wrap: wrap; min-width: 0; }
    .pred-page-header-right { width: 100%; justify-content: flex-start; }
    .pred-tabs { flex-wrap: wrap; }

    .pred-sim-layout {
        grid-template-columns: 1fr;
    }
    .pred-kpis {
        grid-template-columns: 1fr 1fr;
    }
    .pred-quick-form {
        grid-template-columns: 1fr;
    }
    .pred-tabs {
        gap: 0;
    }
    .pred-tab {
        padding: 0.5rem 0.6rem;
        font-size: 0.78rem;
    }
}

/* ── Section descriptions ── */
.pred-section-desc {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary, #4f46e5);
    background: var(--card-bg, #f8f9fa);
    border-radius: 0 6px 6px 0;
    font-size: 0.85rem;
    color: var(--text-secondary, #6b7280);
    line-height: 1.45;
}

/* ── Model hint ── */
.pred-model-hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-secondary, #6b7280);
    font-style: italic;
    min-height: 1.2em;
}

/* ── Model badge (result modal) ── */
.pred-model-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--primary, #4f46e5);
    color: #fff;
}

/* ── Result modal overlay ── */
.pred-result-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.pred-result-dialog {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.pred-result-dialog .modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pred-result-dialog .modal-header h3 { margin: 0; font-size: 1.05rem; }
.pred-result-dialog .modal-body { padding: 1.25rem; }
.pred-result-dialog .modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Loading spinner (result modal) ── */
.pred-result-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2.5rem 1rem;
}
.pred-result-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border, #e5e7eb);
    border-top-color: var(--primary, #4f46e5);
    border-radius: 50%;
    animation: predSpin 0.7s linear infinite;
}
@keyframes predSpin { to { transform: rotate(360deg); } }

/* ── Success message in result modal ── */
.pred-result-modal-ok {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success, #10b981);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.75rem;
}

/* ── Metric pills in result modal ── */
.pred-result-modal-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.pred-result-modal-summary .pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    background: var(--card-bg, #f3f4f6);
    border: 1px solid var(--border, #e5e7eb);
}

/* ── Edit config modal ── */
.pred-edit-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.pred-edit-dialog {
    background: var(--card-bg, #fff);
    border-radius: 12px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.pred-edit-dialog .modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pred-edit-dialog .modal-header h3 { margin: 0; font-size: 1.05rem; }
.pred-edit-dialog .modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.85rem; }
.pred-edit-dialog .modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border, #e5e7eb);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════
   PREDICTION WIZARD (same design system as BI wizard)
   ═══════════════════════════════════════════════════════════ */
.pred-wiz-modal {
    max-width: 920px !important;
    width: 96% !important;
    max-height: 92vh !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pred-wiz-modal .wiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px 16px;
    border-bottom: 1px solid var(--border, #1e293b);
}
.pred-wiz-modal .wiz-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.pred-wiz-modal .wiz-logo {
    font-size: 32px;
    border-radius: 12px;
    padding: 8px;
}
.pred-wiz-modal .wiz-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}
.pred-wiz-modal .wiz-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}
.pred-wiz-modal .wiz-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 16px 28px;
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid var(--border-color);
}
.pred-wiz-modal .wiz-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s;
    opacity: 0.45;
}
.pred-wiz-modal .wiz-step.active {
    opacity: 1;
    background: rgba(6, 182, 212, 0.1);
}
.pred-wiz-modal .wiz-step.completed { opacity: 0.8; }
.pred-wiz-modal .wiz-step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    background: var(--bg-secondary);
    border: 2px solid var(--border-input);
    color: var(--text-muted);
    transition: all 0.25s;
    flex-shrink: 0;
}
.pred-wiz-modal .wiz-step.active .wiz-step-num {
    background: var(--accent-cyan, #06b6d4);
    border-color: var(--accent-cyan, #06b6d4);
    color: #fff;
}
.pred-wiz-modal .wiz-step.completed .wiz-step-num {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #fff;
}
.pred-wiz-modal .wiz-step-info {
    display: flex;
    flex-direction: column;
}
.pred-wiz-modal .wiz-step-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.pred-wiz-modal .wiz-step-desc {
    font-size: 11px;
    color: var(--text-muted);
}
.pred-wiz-modal .wiz-step-line {
    width: 32px;
    height: 2px;
    background: var(--border-input);
    margin: 0 4px;
    border-radius: 2px;
    transition: background 0.25s;
}
.pred-wiz-modal .wiz-step-line.done {
    background: var(--accent-green);
}
@media (max-width: 768px) {
    .pred-wiz-modal .wiz-step-info { display: none; }
    .pred-wiz-modal .wiz-step { padding: 6px 8px; }
    .pred-wiz-modal .wiz-step-line { width: 16px; }
}
.pred-wiz-modal .wiz-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}
.pred-wiz-modal .wiz-panel {
    display: none;
}
.pred-wiz-modal .wiz-panel.active {
    display: block;
    animation: wizPredFadeIn 0.3s ease;
}
@keyframes wizPredFadeIn {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}
.pred-wiz-modal .wiz-panel-header {
    margin-bottom: 20px;
}
.pred-wiz-modal .wiz-panel-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text-primary);
}
.pred-wiz-modal .wiz-panel-header p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}
.pred-wiz-modal .wiz-type-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}
@media (max-width: 640px) {
    .pred-wiz-modal .wiz-type-grid { grid-template-columns: 1fr; }
}
.pred-wiz-modal .wiz-type-card {
    display: flex;
    gap: 14px;
    padding: 18px;
    border-radius: 14px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.25s;
    background: var(--bg-card);
    position: relative;
}
.pred-wiz-modal .wiz-type-card:hover {
    border-color: rgba(6, 182, 212, 0.4);
    background: rgba(6, 182, 212, 0.04);
}
.pred-wiz-modal .wiz-type-card.selected {
    border-color: var(--accent-cyan, #06b6d4);
    background: rgba(6, 182, 212, 0.08);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}
.pred-wiz-modal .wiz-type-card.selected::after {
    content: 'check_circle';
    font-family: 'Material Symbols Rounded';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    color: var(--accent-cyan, #06b6d4);
}
.pred-wiz-modal .wiz-type-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pred-wiz-modal .wiz-type-icon .material-symbols-rounded {
    font-size: 26px;
}
.pred-wiz-modal .wiz-type-info {
    flex: 1;
    min-width: 0;
}
.pred-wiz-modal .wiz-type-info strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.pred-wiz-modal .wiz-type-info p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}
.pred-wiz-modal .wiz-type-preview {
    width: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.pred-wiz-modal .wiz-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.1);
}
.pred-wiz-modal .wiz-footer-right {
    display: flex;
    gap: 8px;
}
.pred-wiz-modal .wiz-footer .btn { min-width: 100px; }

/* ── Prediction Wizard Step 2: Options ── */
.pred-wiz-options {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.pred-wiz-option-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pred-wiz-option-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.pred-wiz-area-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
@media (max-width: 640px) {
    .pred-wiz-area-grid { grid-template-columns: repeat(2, 1fr); }
}
.pred-wiz-area-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.25s;
    background: var(--bg-card);
    text-align: center;
}
.pred-wiz-area-card:hover {
    border-color: rgba(6, 182, 212, 0.4);
    background: rgba(6, 182, 212, 0.04);
}
.pred-wiz-area-card.selected {
    border-color: var(--accent-cyan, #06b6d4);
    background: rgba(6, 182, 212, 0.08);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}
.pred-wiz-area-card .material-symbols-rounded {
    font-size: 28px;
    color: var(--accent-cyan, #06b6d4);
}
.pred-wiz-area-card span:last-child {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.pred-wiz-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
}
.pred-wiz-select:focus {
    outline: none;
    border-color: var(--accent-cyan, #06b6d4);
}
.pred-wiz-enrich-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: border-color 0.2s;
}
.pred-wiz-enrich-card:hover {
    border-color: rgba(6, 182, 212, 0.3);
}
.pred-wiz-enrich-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}
.pred-wiz-enrich-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pred-wiz-enrich-icon .material-symbols-rounded {
    font-size: 24px;
}
.pred-wiz-enrich-left strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 3px;
}
.pred-wiz-enrich-left p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}
.pred-wiz-clima-coords {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 14px 16px;
    border-left: 3px solid var(--accent-cyan, #06b6d4);
    border-radius: 0 10px 10px 0;
    background: rgba(6, 182, 212, 0.04);
    animation: wizPredFadeIn 0.3s ease;
}

/* ── Generate action ── */
.pred-wiz-modal .wiz-generate-action {
    text-align: center;
    padding: 20px 0;
}
.pred-wiz-modal .wiz-btn-generate {
    font-size: 16px !important;
    padding: 14px 32px !important;
    border-radius: 14px !important;
    gap: 10px;
}
.pred-wiz-modal .wiz-btn-generate .material-symbols-rounded { font-size: 22px; }
.pred-wiz-modal .wiz-gen-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
}
.pred-wiz-modal .wiz-preview-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: rgba(16,185,129,0.06);
    border: 1px solid rgba(16,185,129,0.2);
    border-radius: 12px;
    margin-bottom: 20px;
}
.pred-wiz-modal .wiz-preview-header h4 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}
.pred-wiz-modal .wiz-preview-header p {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 2px 0 0;
}
.pred-wiz-modal .wiz-review-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 24px;
}
.pred-wiz-modal .wiz-review-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.pred-wiz-modal .wiz-review-row:last-child { border-bottom: none; }
.pred-wiz-modal .wiz-review-row .material-symbols-rounded {
    font-size: 22px;
    color: var(--text-muted);
    margin-top: 1px;
}
.pred-wiz-modal .wiz-review-row strong {
    color: var(--text-secondary);
    font-size: 13px;
    margin-right: 4px;
}
.pred-wiz-modal .wiz-review-row div {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}
.pred-wiz-modal .wiz-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 18px;
}
.pred-wiz-modal .wiz-summary-card h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.pred-wiz-modal .wiz-summary-card h4 .material-symbols-rounded { font-size: 18px; }
.pred-wiz-modal .wiz-summary-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pred-wiz-modal .wiz-summary-item {
    display: flex;
    gap: 10px;
    font-size: 13px;
}
.pred-wiz-modal .wiz-sum-label {
    color: var(--text-muted);
    min-width: 70px;
}
.pred-wiz-modal .wiz-sum-value {
    color: var(--text-primary);
    font-weight: 500;
}
.pred-wiz-modal .wiz-prompt-area textarea:focus,
.pred-wiz-modal .wiz-prompt-area input:focus {
    outline: none;
    border-color: var(--accent-cyan, #06b6d4) !important;
}
.pred-wiz-modal .wiz-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.pred-wiz-modal .wiz-suggestion {
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.pred-wiz-modal .wiz-suggestion:hover {
    border-color: var(--accent-cyan, #06b6d4);
    color: var(--accent-cyan, #06b6d4);
}
.pred-wiz-modal .wiz-suggestion-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}
.pred-wiz-modal .wiz-rev-prompt {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-style: italic;
    color: var(--text-secondary) !important;
}

/* ═══ Reposición de Stock — Tabla y botones ═══ */
.pred-repo-table { width:100%; border-collapse:collapse; font-size:13px; }
.pred-repo-table th { background:var(--bg-tertiary,#1e293b); color:var(--text-primary); padding:8px 10px; text-align:left; font-weight:600; font-size:11px; text-transform:uppercase; letter-spacing:.5px; position:sticky; top:0; z-index:1; }
.pred-repo-table td { padding:7px 10px; border-bottom:1px solid var(--border,#334155); }
.pred-repo-table tbody tr:hover { background:rgba(6,182,212,.06); }
.pred-repo-table tr.repo-critica { background:rgba(239,68,68,.08); }
.pred-repo-table tr.repo-critica:hover { background:rgba(239,68,68,.14); }
.pred-repo-table tr.repo-alta { background:rgba(245,158,11,.06); }
.pred-repo-table tr.repo-alta:hover { background:rgba(245,158,11,.12); }

.pred-export-btn {
    display:inline-flex; align-items:center; gap:4px;
    background:var(--accent-cyan,#06b6d4); color:#000; border:none;
    padding:6px 14px; border-radius:6px; font-size:12px; font-weight:600;
    cursor:pointer; transition:background .2s;
}
.pred-export-btn:hover { background:#22d3ee; }
.pred-export-btn .material-symbols-rounded { font-size:16px; }
.pred-export-btn-alt { background:transparent; color:var(--text-secondary); border:1px solid var(--border); }
.pred-export-btn-alt:hover { background:var(--bg-tertiary); color:var(--text-primary); }

/* Paginator */
.pred-pager-bar { display:flex; align-items:center; gap:12px; margin-bottom:8px; flex-wrap:wrap; }
.pred-pager-select { background:var(--bg-secondary); color:var(--text-primary); border:1px solid var(--border); border-radius:6px; padding:4px 8px; font-size:13px; cursor:pointer; }
.pred-pager-nav { display:flex; align-items:center; justify-content:center; gap:4px; margin-top:12px; }
.pred-pager-btn { background:var(--bg-secondary); color:var(--text-secondary); border:1px solid var(--border); border-radius:6px; padding:4px 10px; font-size:13px; cursor:pointer; min-width:32px; text-align:center; transition:all .15s; }
.pred-pager-btn:hover:not(:disabled) { background:var(--bg-tertiary); color:var(--text-primary); border-color:var(--accent); }
.pred-pager-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); font-weight:600; }
.pred-pager-btn:disabled { opacity:.35; cursor:not-allowed; }

/* ═══════════════════════════════════════════════
   COMPARATIVA — Datos reales vs predicción
   ═══════════════════════════════════════════════ */
.pred-compare-bar {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}
.pred-compare-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--accent-orange, #f97316);
    color: var(--accent-orange, #f97316);
    background: transparent;
    cursor: pointer;
    transition: all .2s;
}
.pred-compare-btn:hover:not(:disabled) {
    background: rgba(249, 115, 22, 0.1);
    border-color: #fb923c;
}
.pred-compare-btn:disabled {
    opacity: .6;
    cursor: wait;
}
.pred-compare-btn .material-symbols-rounded { font-size: 18px; }
@keyframes spin { to { transform: rotate(360deg); } }
.pred-compare-btn .spin { animation: spin 1s linear infinite; }

.pred-accuracy-panel {
    margin-top: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.pred-accuracy-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-primary);
}
.pred-accuracy-header .material-symbols-rounded { font-size: 20px; }
.pred-accuracy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1px;
    background: var(--border);
}
.pred-accuracy-card {
    background: var(--bg-primary);
    padding: 14px 16px;
    text-align: center;
}
.pred-accuracy-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.pred-accuracy-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}
