/* ==========================================================================
   VISTA PRINCIPAL: CATÁLOGO DE ÁRBOLES DE VALOR (DISEÑO MINIMALISTA)
   ========================================================================== */

.catalog-header {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.catalog-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logos-collab {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.collab-divider {
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    line-height: 1;
    user-select: none;
}

.brand-logo-img {
    height: 28px;
    width: auto;
    object-fit: contain;
    display: block;
}

.centinela-logo-img {
    height: 26px;
    width: auto;
    object-fit: contain;
    display: block;
}

.brand-divider {
    width: 1px;
    height: 22px;
    background: var(--border-color);
}

.catalog-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.catalog-subtitle {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 500;
}

.catalog-main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 36px 60px 36px;
    background: var(--bg-canvas);
}

.catalog-hero-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
}

.catalog-hero-banner h2 {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}

.catalog-hero-banner p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.catalog-stats-pills {
    display: flex;
    align-items: center;
    gap: 12px;
}

.catalog-pill {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.catalog-pill strong {
    color: var(--cyan-accent);
    font-family: var(--font-mono);
}

/* Grilla de Tarjetas del Catálogo */
.catalog-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr));
    gap: 24px;
    padding-bottom: 40px;
}

.catalog-card, .tree-catalog-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
    cursor: default;
}

.catalog-card:hover, .tree-catalog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.card-status-bar {
    height: 4px;
    width: 100%;
}
.card-status-bar.green, .status-green .card-status-bar { background: var(--status-green); }
.card-status-bar.yellow, .status-yellow .card-status-bar { background: var(--status-yellow); }
.card-status-bar.red, .status-red .card-status-bar { background: var(--status-red); }

.card-body {
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.card-kpi-highlight, .card-root-kpi-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-root-label, .kpi-h-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.card-root-val, .kpi-h-values {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
    margin-top: 2px;
}

.card-root-target {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.card-footer {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.btn-card-action, .card-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #ffffff !important;
    background: var(--cyan-accent);
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.btn-card-action:hover, .card-action-btn:hover {
    background: #0369a1;
    transform: translateY(-1px);
}

.card-action-btn-group {
    display: flex;
    gap: 8px;
    width: 100%;
}

.card-action-btn-group .btn-card-action {
    flex: 1;
    justify-content: center;
    padding: 9px 8px;
    font-size: 0.80rem;
    white-space: nowrap;
    text-align: center;
}

/* ==========================================================================
   TARJETA AGRUPADA DE CARGUÍO Y OPCIONES DESPLEGABLES
   ========================================================================== */

.carguio-grouped-card {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
    cursor: pointer;
}

.carguio-grouped-card:hover {
    border-color: #94a3b8;
}

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

.card-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-category-badge {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cyan-accent);
    background: #e0f2fe;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    width: fit-content;
}

.badge-fleet-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

/* Mini chips de flotas */
.carguio-fleet-chips-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.carguio-mini-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    color: #334155;
    text-decoration: none !important;
    transition: all 0.15s ease;
}

.carguio-mini-chip:hover {
    background: #ffffff;
    border-color: var(--cyan-accent);
    color: var(--cyan-accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.carguio-mini-chip.chip-status-green { border-left: 3px solid var(--status-green); }
.carguio-mini-chip.chip-status-yellow { border-left: 3px solid var(--status-yellow); }
.carguio-mini-chip.chip-status-red { border-left: 3px solid var(--status-red); }

.carguio-grouped-card {
    cursor: pointer;
}

/* ==========================================================================
   MODAL DE SELECCIÓN DE FLOTAS
   ========================================================================== */

.carguio-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeInModal 0.2s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.carguio-modal-container {
    background: #ffffff;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scaleInModal 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleInModal {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.carguio-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
}

.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-icon {
    font-size: 1.8rem;
    line-height: 1;
}

.carguio-modal-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 3px 0;
}

.modal-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0;
}

.btn-close-modal {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #64748b;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-close-modal:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
}

.carguio-modal-body {
    padding: 24px 28px;
    overflow-y: auto;
}

.carguio-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

@media (max-width: 768px) {
    .carguio-modal-grid {
        grid-template-columns: 1fr;
    }
}

.modal-fleet-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    border-top: 4px solid #94a3b8;
}

.modal-fleet-card.status-green { border-top-color: var(--status-green); }
.modal-fleet-card.status-yellow { border-top-color: var(--status-yellow); }
.modal-fleet-card.status-red { border-top-color: var(--status-red); }

.modal-fleet-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.mfc-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.mfc-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.mfc-title-group h4 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 4px 0;
}

.mfc-equipments {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.mfc-equipments strong {
    color: var(--text-main);
}

.mfc-kpi-box {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mfc-kpi-actual {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    display: block;
}

.mfc-kpi-target {
    font-size: 0.74rem;
    color: var(--text-dim);
}

.mfc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 6px;
}

.btn-mfc-explore,
.btn-mfc-alerts,
.btn-mfc-proyecciones,
.btn-mfc-sensitivity {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none !important;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-mfc-explore {
    background: var(--cyan-accent);
    color: #ffffff !important;
    border: 1px solid transparent;
}

.btn-mfc-explore:hover {
    background: #0369a1;
    transform: translateY(-1px);
}

.btn-mfc-alerts {
    background: #f1f5f9;
    color: #334155 !important;
    border: 1px solid #cbd5e1;
}

.btn-mfc-alerts:hover {
    background: #e2e8f0;
    color: #0f172a !important;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.btn-mfc-proyecciones {
    background: #eff6ff;
    color: #0284c7 !important;
    border: 1px solid #bfdbfe;
}

.btn-mfc-proyecciones:hover {
    background: #dbeafe;
    color: #0369a1 !important;
    border-color: #93c5fd;
    transform: translateY(-1px);
}

.catalog-kpi-carousel { margin: 6px 0 10px; padding: 10px 14px; border: 1px solid #dbe3ef; border-radius: 10px; background: #f8fafc; cursor: default; box-sizing: border-box; }
.catalog-kpi-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 700; color: #334155; }
.catalog-kpi-nav button { border: 1px solid #cbd5e1; border-radius: 6px; width: 28px; height: 26px; background: white; color: #075985; font-size: 22px; cursor: pointer; line-height: 1; }
.catalog-kpi-slide { display: flex; flex-direction: column; gap: 4px; padding: 6px 0; }
.catalog-kpi-slide[hidden] { display: none; }
.catalog-kpi-caption, .catalog-kpi-plan { font-size: 12px; color: #475569; }
.catalog-kpi-slide strong { font-size: 26px; color: #0f172a; }
.catalog-kpi-slide strong small { font-size: 13px; font-weight: 600; }
.catalog-kpi-dots { display: flex; gap: 6px; justify-content: center; }
.catalog-kpi-dots button { padding: 0; width: 7px; height: 7px; border: 0; border-radius: 50%; background: #cbd5e1; cursor: pointer; }
.catalog-kpi-dots button[aria-pressed=true] { background: #0284c7; }
.catalog-kpi-nav button:hover { background: #e0f2fe; }
.catalog-kpi-carousel button:focus-visible { outline: 2px solid #0284c7; outline-offset: 3px; }

.catalog-kpi-dates { font-size: 12px; font-weight: 600; color: #075985; min-height: 16px; }

.catalog-kpi-values { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.catalog-kpi-pair { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-family: var(--font-mono); }
.catalog-kpi-slide strong { font-size: 1.3rem; font-weight: 800; }
.catalog-kpi-variance { font-family: var(--font-mono); font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 4px; white-space: nowrap; }
.catalog-kpi-variance.green { color: #00864a; background: #dcfce7; }
.catalog-kpi-variance.yellow { color: #a65d00; background: #fef3c7; }
.catalog-kpi-variance.red { color: #b91c1c; background: #fee2e2; }

.catalog-load-status { margin-bottom: 12px; font-size: 13px; color: #475569; }
.catalog-load-status[hidden] { display: none; }
.catalog-load-status button { margin-left: 12px; border: 1px solid #cbd5e1; border-radius: 6px; background: white; color: #075985; padding: 6px 12px; cursor: pointer; }
.catalog-kpi-loading { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: #475569; font-size: 13px; }
.catalog-loading-spinner { width: 16px; height: 16px; border: 2px solid #dbeafe; border-top-color: #0284c7; border-radius: 50%; animation: catalog-spin 1s linear infinite; }
.catalog-loading-skeleton { width: 100%; height: 26px; border-radius: 5px; background: #e2e8f0; }
@keyframes catalog-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .catalog-loading-spinner { animation: none; } }

.catalog-kpi-nav [data-kpi-period-label] { text-align: center; line-height: 1.4; }
.catalog-kpi-nav button { flex-shrink: 0; }

/* Compact spacing in the main catalog cards. */
.catalog-cards-grid .card-body { padding: 16px 24px 6px; }
.catalog-cards-grid .card-header-row { margin-bottom: 10px; }
.catalog-cards-grid .carguio-fleet-chips-row { margin-bottom: 6px; }
.catalog-cards-grid .card-footer { padding: 8px 24px; }
.catalog-kpi-loading { min-height: 98px; }

.mfc-icon .ui-icon { width: 28px; height: 28px; }

/* Acciones en una sola fila, distribuidas según la cantidad de accesos. */
.card-action-btn-group, .mfc-actions { flex-wrap: nowrap; }
.card-action-btn-group .btn-card-action { flex: 1 1 0; min-width: 0; }
.mfc-actions > a { flex: 1 0 auto; min-width: max-content; }
.mfc-actions .ui-icon { flex-shrink: 0; }
.btn-mfc-sensitivity { background: #f0fdfa; color: #0f766e !important; border: 1px solid #99f6e4; }
.btn-mfc-sensitivity:hover { background: #ccfbf1; border-color: #5eead4; transform: translateY(-1px); }

/* Pies de tarjeta alineados en una única fila para ambas líneas operacionales. */
.catalog-cards-grid { align-items: stretch; }
.catalog-cards-grid > .catalog-card:hover { transform: none; }
.catalog-cards-grid .card-action-btn-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
}
.catalog-cards-grid .card-action-btn-group .btn-card-action {
    flex: 1 0 auto;
    box-sizing: border-box;
    min-height: 36px;
    margin: 0;
    border: 1px solid transparent;
    font-family: inherit;
    line-height: 1.25;
    white-space: nowrap;
}

.catalog-cards-grid .catalog-kpi-carousel { margin-bottom: 2px; }
