:root {
    --bg-color: #f6f8fb;
    --header-bg: #ffffff;
    --card-bg: #ffffff;
    
    /* Aramark Brand Identity */
    --brand-primary: #eb002a;   /* Aramark Red */
    --brand-navy: #022035;      /* Aramark Dark Navy */
    --brand-slate: #2f3a41;     /* Aramark Slate Grey */
    --brand-cyan: #41b6e6;      /* Aramark Accent Cyan */
    
    --success-color: #128a55;   /* Aramark-aligned emerald green */
    --error-color: #eb002a;     /* Aramark Red */
    --warning-color: #f59e0b;
    
    --text-primary: #022035;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    
    /* Premium shadows */
    --shadow-sm: 0 2px 4px rgba(2, 32, 53, 0.02);
    --shadow-md: 0 4px 12px rgba(2, 32, 53, 0.06);
    --shadow-lg: 0 10px 30px rgba(2, 32, 53, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 10% 20%, rgba(65, 182, 230, 0.04) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(235, 0, 42, 0.03) 0%, transparent 40%);
    color: var(--text-primary);
    font-family: 'Inter', 'Outfit', sans-serif;
    margin: 0;
    padding: 30px 20px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ── BRAND HEADER ── */
.brand-header {
    background: var(--header-bg);
    border-radius: 16px;
    padding: 18px 28px;
    margin-bottom: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.brand-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--brand-primary) 0%, var(--brand-cyan) 100%);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    display: flex;
    align-items: center;
    user-select: none;
}

.brand-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 2.2rem;
    letter-spacing: -2px;
    color: var(--brand-navy);
    text-transform: lowercase;
    line-height: 1;
    display: inline-block;
}

.brand-spark {
    width: 28px;
    height: 28px;
    margin-left: 2px;
    transform: translateY(-2px);
    display: inline-block;
}

.effice-logo-container {
    display: flex;
    align-items: center;
}

.effice-logo-img {
    height: 22px;
    width: auto;
    display: block;
}

.brand-divider {
    width: 1px;
    height: 35px;
    background-color: var(--border-color);
}

.logo-text h1 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--brand-navy);
    letter-spacing: -0.3px;
    font-family: 'Outfit', sans-serif;
}

.logo-text p {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* ── HEADER SUMMARY PILLS ── */
.header-summary {
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-pill {
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.running-pill {
    background: rgba(18, 138, 85, 0.08);
    color: var(--success-color);
    border: 1px solid rgba(18, 138, 85, 0.2);
}

.idle-pill {
    background: rgba(100, 116, 139, 0.08);
    color: var(--text-secondary);
    border: 1px solid rgba(100, 116, 139, 0.2);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(18, 138, 85, 0.08);
    padding: 6px 14px;
    border-radius: 99px;
    border: 1px solid rgba(18, 138, 85, 0.15);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success-color);
    border-radius: 50%;
    position: relative;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(18, 138, 85, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(18, 138, 85, 0); }
    100% { box-shadow: 0 0 0 0 rgba(18, 138, 85, 0); }
}

.status-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--success-color);
    letter-spacing: 0.2px;
}

.header-stats {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--brand-navy);
    font-variant-numeric: tabular-nums;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.5px;
}

/* ── BOTS GRID ── */
.bots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 20px;
    align-items: start;
}

/* ── BOT CARD ── */
@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bot-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                transform  0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity    0.3s;
    position: relative;
    overflow: hidden;
    animation: cardFadeIn 0.35s ease both;
}

.bot-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background-color: var(--brand-primary);
    transition: background-color 0.3s;
}

.bot-card:not(.bot-idle) {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.bot-idle {
    opacity: 0.60;
}

.bot-card.bot-idle::before {
    background-color: #cbd5e1;
}

/* ── BOT HEADER ── */
.bot-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.bot-status-icon {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
    background: #f1f5f9;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s;
}

.bot-card:not(.bot-idle) .bot-status-icon {
    background: rgba(235, 0, 42, 0.05);
    border-color: rgba(235, 0, 42, 0.15);
}

.bot-status-icon.rotating {
    animation: spin 3s linear infinite;
    display: inline-flex;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.bot-info {
    flex: 1;
    min-width: 0;
}

/* Operador como título principal */
.bot-operator-name {
    margin: 6px 0 4px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.2px;
}

/* Fila de subtítulo + hora de inicio + última actividad */
.bot-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bot-subtitle {
    margin: 0;
    font-size: 0.76rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bot-starttime {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    padding: 1px 7px;
    background: #f1f5f9;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.bot-lastseen {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    margin-left: auto;
}

/* ── BADGES ── */
.bot-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 4px;
    align-items: center;
}

/* Status badge (Activo / En Pausa) */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.badge-running {
    background: rgba(18, 138, 85, 0.08);
    color: var(--success-color);
    border: 1px solid rgba(18, 138, 85, 0.2);
}

.badge-running .badge-dot {
    background: var(--success-color);
    animation: pulse 1.8s infinite;
}

.badge-idle {
    background: #f1f5f9;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.badge-idle .badge-dot {
    background: #94a3b8;
}

.machine-badge {
    background: #f1f5f9;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 500;
    white-space: nowrap;
}

.group-badge {
    background: rgba(18, 138, 85, 0.06);
    color: var(--success-color);
    border: 1px solid rgba(18, 138, 85, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
}

.company-badge {
    background: rgba(245, 158, 11, 0.06);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.15);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── METRICS ── */
.bot-metrics-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 7px;
}

.constancias-metrics-grid {
    grid-template-columns: repeat(4, 1fr);
}

.mini-metric {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 10px 4px;
    border-radius: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    min-height: 66px;
    transition: background-color 0.2s;
}

.mini-metric:hover {
    background: #f1f5f9;
}

.mini-metric .label {
    font-size: 0.59rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.mini-metric .value {
    font-size: 1.2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--brand-navy);
    font-family: 'Outfit', sans-serif;
}

.value.success { color: var(--success-color); }
.value.error   { color: var(--error-color); }
.value.review  { color: var(--warning-color); }
.value.process-error { color: #db2777; }
.value.highlight-value { color: var(--brand-cyan); }
.value.neutral { color: var(--brand-slate); }

/* ── PROGRESS BAR ── */
.bot-progress-section {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.bot-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.bot-progress-info strong {
    color: var(--brand-navy);
}

.progress-pct {
    font-weight: 800;
    color: var(--brand-primary);
    font-size: 0.9rem;
    font-family: 'Outfit', sans-serif;
}

.progress-pct.constancias-pct {
    color: var(--brand-cyan);
}

.progress-bar-container {
    background: #f1f5f9;
    height: 10px;
    border-radius: 99px;
    overflow: hidden;
    border: 1px solid rgba(2, 32, 53, 0.05);
}

.progress-bar {
    background: linear-gradient(90deg, var(--brand-primary) 0%, #ff4b60 100%);
    height: 100%;
    border-radius: 99px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-bar.constancias-bar {
    background: linear-gradient(90deg, var(--brand-cyan) 0%, #76d0f5 100%);
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.20), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ── STEPS LOG ── */
.bot-steps {
    display: flex;
    flex-direction: column;
    gap: 5px;
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
}

.bot-step {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-radius: 7px;
    font-size: 0.76rem;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid transparent;
    color: var(--brand-slate);
    font-weight: 500;
}

.bot-step-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bot-step-time {
    flex-shrink: 0;
    font-size: 0.68rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.bot-step.current {
    background: rgba(235, 0, 42, 0.04);
    color: var(--brand-primary);
    font-weight: 700;
    border: 1px solid rgba(235, 0, 42, 0.1);
    border-left: 4px solid var(--brand-primary);
}

.constancias-card .bot-step.current {
    background: rgba(65, 182, 230, 0.05);
    color: #0b80b3;
    border: 1px solid rgba(65, 182, 230, 0.15);
    border-left: 4px solid var(--brand-cyan);
}

.bot-step.completed {
    color: #475569;
    background: #f8fafc;
}

.bot-step.pending {
    color: var(--text-secondary);
    opacity: 0.5;
    background: transparent;
    border: 1px dashed var(--border-color);
}

.bot-step.error {
    background: rgba(235, 0, 42, 0.04);
    color: var(--error-color);
    border: 1px solid rgba(235, 0, 42, 0.12);
}

/* ── UTILITY ── */
.loading-state,
.no-bots {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    grid-column: 1 / -1;
}

.loading-state p,
.no-bots {
    margin: 10px 0 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--brand-navy);
}

.no-bots small {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.spinner {
    width: 38px;
    height: 38px;
    border: 4px solid #f1f5f9;
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    margin: 0 auto 14px;
}

/* ── FOOTER ── */
.dashboard-footer {
    margin-top: 36px;
    text-align: center;
    padding: 18px 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 500;
}

.dashboard-footer strong {
    color: var(--brand-navy);
    font-weight: 700;
}


/* ===============================================================
   ALTAS / BAJAS / MODIFICACIONES - ENHANCED CARD STYLES v3
   =============================================================== */

/* Base card */
.bot-card.altas-bajas-card {
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(2, 32, 53, 0.04), 0 1px 3px rgba(2, 32, 53, 0.02);
    border-radius: 16px;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
.bot-card.altas-bajas-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(2, 32, 53, 0.08), 0 2px 6px rgba(2, 32, 53, 0.03);
}

.bot-card.altas-bajas-card::before {
    height: 4px;
    border-radius: 16px 16px 0 0;
}

/* Per-hoja top border colors */
.card-theme-altas::before { background: linear-gradient(90deg, #128a55 0%, #34d399 100%); }
.card-theme-bajas::before { background: linear-gradient(90deg, #eb002a 0%, #f97316 100%); }
.card-theme-modif::before { background: linear-gradient(90deg, #41b6e6 0%, #022035 60%, #eb002a 100%); }

/* Card glow animations */
@keyframes cardGlowPulseAltas {
    0%, 100% { box-shadow: 0 4px 18px rgba(18, 138, 85, 0.12), 0 0 0 1px rgba(18, 138, 85, 0.22); }
    50%       { box-shadow: 0 8px 30px rgba(18, 138, 85, 0.24), 0 0 0 1.5px rgba(18, 138, 85, 0.42); }
}
@keyframes cardGlowPulseBajas {
    0%, 100% { box-shadow: 0 4px 18px rgba(235, 0, 42, 0.12), 0 0 0 1px rgba(235, 0, 42, 0.22); }
    50%       { box-shadow: 0 8px 30px rgba(235, 0, 42, 0.24), 0 0 0 1.5px rgba(235, 0, 42, 0.42); }
}
@keyframes cardGlowPulseModif {
    0%, 100% { box-shadow: 0 4px 18px rgba(65, 182, 230, 0.14), 0 0 0 1px rgba(65, 182, 230, 0.26); }
    50%       { box-shadow: 0 8px 30px rgba(65, 182, 230, 0.28), 0 0 0 1.5px rgba(65, 182, 230, 0.50); }
}

.glow-altas { animation: cardGlowPulseAltas 3.2s ease-in-out infinite; }
.glow-bajas { animation: cardGlowPulseBajas 3.2s ease-in-out infinite; }
.glow-modif { animation: cardGlowPulseModif 3.2s ease-in-out infinite; }

/* Status Icon in header */
.bot-status-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}
.bot-status-icon.status-running {
    background: linear-gradient(135deg, rgba(65, 182, 230, 0.12), rgba(2, 32, 53, 0.04));
    border: 1px solid rgba(65, 182, 230, 0.35);
    color: var(--brand-cyan);
}
.bot-status-icon.glow-icon-altas {
    background: linear-gradient(135deg, rgba(18, 138, 85, 0.12), rgba(52, 211, 153, 0.05));
    border-color: rgba(18, 138, 85, 0.35);
    color: #128a55;
}
.bot-status-icon.glow-icon-bajas {
    background: linear-gradient(135deg, rgba(235, 0, 42, 0.12), rgba(249, 115, 22, 0.05));
    border-color: rgba(235, 0, 42, 0.35);
    color: #eb002a;
}
.bot-status-icon.glow-icon-modif {
    background: linear-gradient(135deg, rgba(65, 182, 230, 0.12), rgba(2, 32, 53, 0.04));
    border-color: rgba(65, 182, 230, 0.35);
    color: #0b80b3;
}
.bot-status-icon.status-completed {
    background: rgba(18, 138, 85, 0.10);
    border: 1px solid rgba(18, 138, 85, 0.30);
    color: var(--success-color);
}
.bot-status-icon.status-idle {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #94a3b8;
}

.spin-icon {
    animation: iconSpin 3s linear infinite;
}
@keyframes iconSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pulse-icon {
    animation: iconPulse 1.8s ease-in-out infinite;
}
@keyframes iconPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.6; transform: scale(1.12); }
}

/* Aramark Spark Animated Running Icon */
.aramark-running-wrapper {
    position: relative;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.aramark-spark-spin {
    width: 24px;
    height: 24px;
    animation: aramarkSpin 3.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    transform-origin: 50% 50%;
    filter: drop-shadow(0 2px 5px rgba(235, 0, 42, 0.35));
}
@keyframes aramarkSpin {
    0%   { transform: rotate(0deg) scale(1); }
    50%  { transform: rotate(180deg) scale(1.08); }
    100% { transform: rotate(360deg) scale(1); }
}


/* Badges */
.bot-badges {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.process-badge-altas-bajas {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 6px;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.hoja-badge-altas { background: #128a55; color: #fff; box-shadow: 0 2px 5px rgba(18,138,85,0.22); }
.hoja-badge-bajas { background: #eb002a; color: #fff; box-shadow: 0 2px 5px rgba(235,0,42,0.22); }
.hoja-badge-modif { background: #022035; color: #fff; box-shadow: 0 2px 5px rgba(2,32,53,0.22); }

.mode-badge {
    background: rgba(65, 182, 230, 0.09);
    color: #0b80b3;
    border: 1px solid rgba(65, 182, 230, 0.28);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.failure-badge {
    background: rgba(235, 0, 42, 0.1);
    color: #eb002a;
    border: 1px solid rgba(235, 0, 42, 0.25);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.batch-badge {
    background: rgba(11, 128, 179, 0.10);
    color: #0b80b3;
    border: 1px solid rgba(11, 128, 179, 0.28);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.f301-period-badge {
    background: #0284c7 !important;
    color: #ffffff !important;
    border: 1px solid #0369a1 !important;
    font-weight: 700 !important;
    font-size: 0.72rem !important;
    padding: 3px 10px !important;
    border-radius: 6px !important;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.25) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
}

.bot-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.bot-starttime {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Metrics grid */
.altas-bajas-metrics-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.card-metric {
    padding: 10px 10px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(2, 32, 53, 0.02);
    min-height: 72px;
    transition: border-color 0.3s, transform 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.card-metric:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(2, 32, 53, 0.04);
}
.card-metric .label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.card-metric-altas { border-top: 3px solid rgba(18,138,85,0.45); }
.card-metric-bajas { border-top: 3px solid rgba(235,0,42,0.45); }
.card-metric-modif { border-top: 3px solid rgba(65,182,230,0.50); }

.card-metric .value {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.2;
    margin-top: 2px;
    font-family: 'Outfit', sans-serif;
}
.card-metric .subtext {
    font-size: 0.62rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 1px;
}

/* Progress bar */
.altas-bajas-progress {
    background: #ffffff;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(2, 32, 53, 0.02);
}
.progress-label-group { display: flex; align-items: baseline; gap: 6px; }
.progress-main-label { font-size: 0.8rem; font-weight: 700; color: var(--brand-navy); }
.progress-sub-label { font-size: 0.74rem; color: var(--text-secondary); }
.progress-pct.complete { color: var(--success-color); }

/* Per-theme progress bars */
.bar-altas { background: linear-gradient(90deg, #128a55 0%, #34d399 100%); }
.bar-bajas { background: linear-gradient(90deg, #eb002a 0%, #f97316 100%); }
.bar-modif { background: linear-gradient(90deg, #41b6e6 0%, #022035 60%, #eb002a 100%); }

/* Shimmer animation on active progress bar */
.bar-shimmer { position: relative; overflow: hidden; }
.bar-shimmer::after {
    content: '';
    position: absolute;
    top: 0; left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.45) 50%, transparent 100%);
    animation: barShimmer 1.8s ease-in-out infinite;
}
@keyframes barShimmer {
    0%   { left: -60%; }
    100% { left: 120%; }
}

/* ===============================================================
   ACTIVIDAD DEL BOT: LÍNEA EN VIVO (VISIBILIDAD COMPLETA)
   =============================================================== */
.live-activity-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px 14px;
    width: 100%;
    box-shadow: inset 0 1px 2px rgba(2, 32, 53, 0.02);
}

.live-activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.hitos-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 3px 8px;
    border-radius: 6px;
    flex-shrink: 0;
}
.hitos-label-altas { background: #128a55; color: #fff; box-shadow: 0 2px 4px rgba(18,138,85,0.2); }
.hitos-label-bajas { background: #eb002a; color: #fff; box-shadow: 0 2px 4px rgba(235,0,42,0.2); }
.hitos-label-modif { background: #022035; color: #fff; box-shadow: 0 2px 4px rgba(2,32,53,0.2); }

.live-activity-time {
    font-size: 0.70rem;
    color: var(--text-secondary);
    background: #ffffff;
    border: 1px solid rgba(2, 32, 53, 0.08);
    padding: 2px 8px;
    border-radius: 5px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Animated Clock for Activity Box and Start Time */
.clock-icon-animated {
    display: inline-block;
    flex-shrink: 0;
    color: #0b80b3;
    vertical-align: middle;
    animation: clockPulseGlow 3s ease-in-out infinite;
}

.clock-hand {
    transform-origin: 12px 12px;
    animation: clockSpin 6s linear infinite;
}

@keyframes clockSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes clockPulseGlow {
    0%, 100% { opacity: 0.85; filter: drop-shadow(0 0 0 rgba(11, 128, 179, 0)); }
    50%      { opacity: 1; filter: drop-shadow(0 0 3px rgba(11, 128, 179, 0.5)); }
}

.live-activity-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
}

.live-activity-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Radar dot for active line */
.activity-radar {
    position: relative;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.radar-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--brand-cyan);
}
.radar-wave {
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: rgba(65, 182, 230, 0.4);
    animation: radarPulse 1.8s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}
.radar-altas .radar-dot  { background-color: #128a55; }
.radar-altas .radar-wave { background-color: rgba(18, 138, 85, 0.4); }
.radar-bajas .radar-dot  { background-color: #eb002a; }
.radar-bajas .radar-wave { background-color: rgba(235, 0, 42, 0.4); }
.radar-modif .radar-dot  { background-color: #0b80b3; }
.radar-modif .radar-wave { background-color: rgba(65, 182, 230, 0.4); }

@keyframes radarPulse {
    0%   { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(2.2); opacity: 0; }
}

.live-activity-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--brand-navy);
    line-height: 1.35;
    font-family: 'Inter', sans-serif;
    word-break: normal;
    overflow-wrap: break-word;
    animation: activityFadeIn 0.3s ease;
}

@keyframes activityFadeIn {
    from { opacity: 0; transform: translateY(2px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* ── SECCIÓN DE FILAS CON OBSERVACIÓN / ERROR ── */
.bot-errors-section {
    margin-top: 14px;
    background: #fff5f5;
    border: 1px solid rgba(235, 0, 42, 0.18);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: activityFadeIn 0.3s ease;
}

.bot-errors-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #c5162a;
}

.bot-errors-header-title {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bot-errors-count-badge {
    background: #fed7d7;
    color: #c5162a;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 800;
}

.bot-errors-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 110px;
    overflow-y: auto;
    padding-right: 4px;
}

.bot-errors-list::-webkit-scrollbar {
    width: 4px;
}
.bot-errors-list::-webkit-scrollbar-thumb {
    background: rgba(235, 0, 42, 0.25);
    border-radius: 4px;
}

.bot-error-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #ffffff;
    border: 1px solid rgba(235, 0, 42, 0.15);
    border-left: 3px solid #ef4444;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.74rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.bot-error-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.bot-error-row-badge {
    background: rgba(235, 0, 42, 0.12);
    color: #c5162a;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.68rem;
    flex-shrink: 0;
}

.bot-error-rut {
    color: #1e293b;
    font-family: monospace;
    font-weight: 700;
    font-size: 0.72rem;
}

.bot-error-time {
    color: #94a3b8;
    font-size: 0.68rem;
    font-family: monospace;
    margin-left: auto;
}

.bot-error-desc {
    color: #475569;
    font-size: 0.73rem;
    line-height: 1.35;
    word-break: break-word;
    font-weight: 500;
}

/* Estado sin errores (OK) */
.bot-errors-section.no-errors {
    background: #f0fdf4;
    border: 1px solid rgba(18, 138, 85, 0.2);
}
.bot-errors-header.header-ok {
    color: #128a55;
}
.bot-errors-count-badge.badge-ok {
    background: #dcfce7;
    color: #128a55;
}
.bot-error-item.item-ok {
    background: #ffffff;
    border: 1px solid rgba(18, 138, 85, 0.15);
    justify-content: center;
    padding: 7px 10px;
}
.bot-error-desc-ok {
    color: #128a55;
    font-weight: 600;
    font-size: 0.74rem;
}

/* Responsive */
@media (max-width: 900px) {
    .bots-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
}
@media (max-width: 500px) {
    .bots-grid { grid-template-columns: 1fr; }
    body { padding: 16px 12px; }
    .brand-header { padding: 14px 16px; }
    .altas-bajas-metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
