.an-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 60px 0;
    color: #8b949e;
}

.an-error {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #f87171;
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 20px;
    font-size: 14px;
}

/* ===== Estado no vinculado ===== */
.an-no-vinculado {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 60px 40px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 16px;
    max-width: 480px;
    margin: 40px auto 0;
}

.an-no-vinculado i {
    font-size: 48px;
    color: #ff0000;
    margin-bottom: 8px;
}

.an-no-vinculado h3 {
    color: #fff;
    font-size: 20px;
    margin: 0;
}

.an-no-vinculado p {
    color: #8b949e;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 12px;
}

.an-no-vinculado .btn-guion-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    padding: 12px 24px;
}

/* ===== Badge de estado ===== */
.an-badge-wrap {
    margin: 20px 0 28px;
}

.an-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
}

.an-badge-ok {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #10b981;
}

.an-badge-pending {
    background: rgba(139, 148, 158, 0.12);
    border: 1px solid rgba(139, 148, 158, 0.3);
    color: #8b949e;
}

/* ===== Cards de progreso ===== */
.an-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.an-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 16px;
    padding: 22px;
}

.an-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #8b949e;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.an-card-header i {
    font-size: 18px;
    color: #06b6d4;
}

.an-card-numbers {
    color: #fff;
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 14px;
}

.an-card-required {
    color: #6f7783;
    font-size: 15px;
    font-weight: 600;
}

.an-progress-track {
    width: 100%;
    height: 10px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    overflow: hidden;
}

.an-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #06b6d4, #0891b2);
    border-radius: 6px;
    transition: width 0.6s ease;
}

.an-progress-fill.an-progress-complete {
    background: linear-gradient(90deg, #10b981, #059669);
}

.an-card-percent {
    margin-top: 8px;
    text-align: right;
    color: #06b6d4;
    font-size: 13px;
    font-weight: 700;
}

/* ===== Nota informativa ===== */
.an-nota {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 24px;
    padding: 16px 20px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 12px;
    color: #8b949e;
    font-size: 13px;
    line-height: 1.6;
}

.an-nota i {
    color: #06b6d4;
    font-size: 16px;
    margin-top: 2px;
}

.an-nota b {
    color: #c9d1d9;
}

@media (max-width: 900px) {
    .an-cards {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   FASE 2 — Analíticas extendidas (estilo nuevo)
   Prefijo an2- para no chocar con clases an- existentes
   ============================================ */

.an2-section {
    margin-top: 32px;
}

.an2-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.an2-head h3 {
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    letter-spacing: 0.3px;
}

.an2-eyebrow {
    color: #8b949e;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
}

.an2-time-filter {
    display: flex;
    gap: 6px;
    background: #161b22;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid #30363d;
}

.an2-time-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #8b949e;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
}

.an2-time-btn.active {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #fff;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.25);
}

.an2-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.an2-kpi {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 14px;
    padding: 18px 20px;
    border-left: 4px solid #06b6d4;
}

.an2-kpi-label {
    color: #8b949e;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.an2-kpi-value {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.an2-kpi.c-orange { border-left-color: #ff6b35; }
.an2-kpi.c-blue    { border-left-color: #4facfe; }
.an2-kpi.c-purple  { border-left-color: #a855f7; }
.an2-kpi.c-green   { border-left-color: #00d084; }
.an2-kpi.c-yellow  { border-left-color: #fbbf24; }
.an2-kpi.c-red     { border-left-color: #ff4757; }

.an2-panel {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 16px;
    padding: 22px;
    overflow: hidden;
}

.an2-panel-tag {
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 20px;
    background: #0d1117;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 1px solid #30363d;
}

.an2-panel-tag.solid {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #fff;
    border: none;
    font-weight: 700;
}

.an2-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 24px;
}

@media (max-width: 900px) {
    .an2-grid-2 {
        grid-template-columns: 1fr;
    }
}

.an2-chart-wrap {
    position: relative;
    height: 260px;
    width: 100%;
    margin-top: 16px;
}

.an2-table-wrap {
    overflow-x: auto;
    margin-top: 16px;
}

.an2-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.an2-table th {
    text-align: left;
    padding: 14px 16px;
    color: #8b949e;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
    border-bottom: 2px solid #30363d;
}

.an2-table td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid #30363d;
    color: #c9d1d9;
}

.an2-table tr {
    transition: background 0.2s ease;
    cursor: pointer;
}

.an2-table tr:hover {
    background: #1c2229;
}

.an2-table tr.top-row {
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.08), transparent);
    border-left: 3px solid #06b6d4;
}

.an2-vid-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #0d1117;
    border: 1px solid #30363d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.an2-vid-thumb.top {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    border: none;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.an2-badge-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.an2-eng-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 16px;
}

.an2-eng-item {
    text-align: center;
}

.an2-eng-circle {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 1s ease;
}

.an2-eng-circle-inner {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: #161b22;
    display: flex;
    align-items: center;
    justify-content: center;
}

.an2-eng-value {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
}

.an2-eng-label {
    font-size: 12px;
    color: #8b949e;
    display: block;
    margin-top: 8px;
}

.an2-monet-row {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 10px;
}

.an2-monet-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.an2-monet-label {
    font-size: 13px;
    color: #8b949e;
}

.an2-monet-value {
    font-size: 22px;
    font-weight: 800;
}

.an2-bar-track {
    width: 100%;
    height: 6px;
    background: #0d1117;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid #30363d;
}

.an2-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease;
}

.an2-revenue-box {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 4px;
}

.an2-revenue-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(6, 182, 212, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.an2-revenue-label {
    font-size: 12px;
    color: #8b949e;
    margin-bottom: 2px;
}

.an2-revenue-value {
    font-size: 28px;
    font-weight: 800;
    color: #06b6d4;
    margin: 0;
}

.an2-list-row {
    opacity: 0;
    transform: translateX(-14px);
    transition: all 0.5s ease;
}

.an2-list-row.show {
    opacity: 1;
    transform: translateX(0);
}

.an2-list-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.an2-list-icon {
    font-size: 20px;
}

.an2-list-name {
    font-size: 14px;
    font-weight: 600;
    flex: 1;
    color: #c9d1d9;
}

.an2-list-pct {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
}

.an2-list-bar-track {
    width: 100%;
    height: 8px;
    background: #0d1117;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #30363d;
}

.an2-list-bar-fill {
    width: 0%;
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}

.an2-demo-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    margin-left: 10px;
}


/* ============================================
   Chip de canal de YouTube conectado (Analíticas)
   ============================================ */
.an-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.an-yt-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #161b22, #1c2333);
    border: 1px solid #30363d;
    border-radius: 16px;
    padding: 10px 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    animation: an-yt-chip-in 0.4s ease;
}

@keyframes an-yt-chip-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.an-yt-chip img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ff0000;
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.12);
}

.an-yt-chip-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.an-yt-chip-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #8b949e;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
}

.an-yt-chip-label i {
    color: #ff0000;
    font-size: 12px;
}

.an-yt-chip-nombre {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.an-yt-disconnect-btn {
    background: none;
    border: none;
    color: #6f7783;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    font-size: 18px;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
    margin-left: 4px;
}

.an-yt-disconnect-btn:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}
.an-yt-add-btn {
    background: none;
    border: none;
    color: #6f7783;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    font-size: 18px;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
    margin-left: 4px;
}
.an-yt-add-btn:hover {
    color: #3fb950;
    background: rgba(63, 185, 80, 0.1);
}

/* Modal de confirmación */
.an-yt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
    animation: an-yt-fade-in 0.15s ease;
}

@keyframes an-yt-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.an-yt-modal-box {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 18px;
    padding: 32px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.an-yt-modal-box i {
    font-size: 44px;
    color: #f59e0b;
    margin-bottom: 16px;
    display: block;
}

.an-yt-modal-box p {
    color: #c9d1d9;
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 24px;
}

.an-yt-modal-box p b {
    color: #fff;
}

.an-yt-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.an-yt-modal-actions button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 22px;
    border-radius: 10px;
    border: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.15s;
}

.an-yt-modal-actions button:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

.an-yt-modal-si {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: #fff;
}

.an-yt-modal-no {
    background: #30363d;
    color: #c9d1d9;
}

@media (max-width: 700px) {
    .an-yt-chip-wrap {
        justify-content: flex-start;
    }
    .an-yt-chip-nombre {
        max-width: 140px;
    }
}
/* ==========================================
   Desplegable de canales conectados (YouTube)
   Agregar al final de tu hoja de estilos
   ========================================== */

.an-yt-chip-wrap {
  position: relative;
}

.an-yt-chip {
  cursor: pointer;
}

.an-yt-toggle-btn {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.an-yt-toggle-btn:hover {
  opacity: 1;
}

.an-yt-toggle-btn.open {
  transform: rotate(180deg);
}

.an-yt-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  max-height: 340px;
  overflow-y: auto;
  background: #12161c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 50;
  padding: 10px;
}

.an-yt-dropdown-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.55;
  padding: 4px 8px 8px;
}

.an-yt-dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.an-yt-dropdown-empty {
  padding: 12px 8px;
  font-size: 13px;
  opacity: 0.6;
  text-align: center;
}

.an-yt-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.an-yt-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.an-yt-dropdown-item.active {
  background: rgba(6, 182, 212, 0.12);
}

.an-yt-dropdown-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.an-yt-dropdown-item-name {
  flex: 1;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.an-yt-item-check {
  color: #06b6d4;
  font-size: 15px;
  flex-shrink: 0;
}

.an-yt-item-remove {
  background: transparent;
  border: none;
  color: #ef4444;
  opacity: 0.5;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}

.an-yt-item-remove:hover {
  opacity: 1;
}
/* ==========================================
   Fix de contraste — desplegable de canales
   ========================================== */

.an-yt-dropdown {
  background: #161b22 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.an-yt-dropdown-title {
  color: #8b949e !important;
  opacity: 1 !important;
}

.an-yt-dropdown-empty {
  color: #8b949e !important;
}

.an-yt-dropdown-item-name {
  color: #f0f6fc !important;
  font-weight: 500;
}

.an-yt-dropdown-item img {
  background: #21262d;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.an-yt-dropdown-item.active .an-yt-dropdown-item-name {
  color: #06b6d4 !important;
}

.an-yt-item-check {
  color: #06b6d4 !important;
}

.an-yt-item-remove i {
  color: #ef4444 !important;
}
