/* Pila única de tareas. No ocupa espacio dentro del explorador. */

.cc-task-stack {
    position: fixed;
    right: var(--cc-task-right, 14px);
    bottom: var(--cc-task-bottom, 14px);
    z-index: 250000;

    width: var(--cc-task-width, min(360px, calc(100vw - 28px)));
    max-width: calc(100vw - 28px);
    max-height: var(--cc-task-max-height, min(62dvh, 620px));

    display: flex;
    flex-direction: column;
    gap: 7px;

    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;

    padding: 2px;
    pointer-events: none;
}


.cc-task-card {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;

    color: var(--text);
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border);
    border-radius: 12px;

    box-shadow:
        0 10px 30px
        rgba(26, 65, 90, 0.18);

    backdrop-filter: blur(9px);
    overflow: hidden;
    pointer-events: auto;

    animation: cc-task-enter 150ms ease-out;
}


@keyframes cc-task-enter {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.cc-task-header {
    min-width: 0;

    display: flex;
    align-items: center;
    gap: 7px;

    padding: 8px 8px 5px;
}


.cc-task-icon {
    width: 29px;
    height: 29px;
    flex: 0 0 29px;

    display: grid;
    place-items: center;

    color: #2777a7;
    background: #e9f5fc;
    border: 1px solid #c9e2f0;
    border-radius: 8px;

    font-size: 13px;
    font-weight: 800;
}


.cc-task-heading {
    min-width: 0;
    flex: 1;

    display: flex;
    flex-direction: column;
    gap: 1px;
}


.cc-task-heading strong,
.cc-task-heading small {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}


.cc-task-heading strong {
    font-size: 12px;
}


.cc-task-heading small {
    color: var(--text-muted);
    font-size: 9px;
}


.cc-task-toggle,
.cc-task-cancel,
.cc-task-close {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;

    display: grid;
    place-items: center;

    padding: 0;

    color: #607f93;
    background: transparent;
    border: 0;
    border-radius: 7px;

    font-size: 15px;
    cursor: pointer;
}


.cc-task-cancel {
    color: #a45a61;
}


.cc-task-card button:hover {
    background: rgba(78, 143, 185, 0.11);
}


.cc-task-progress-area {
    padding: 0 8px 7px;
}


.cc-task-track {
    height: 5px;

    overflow: hidden;

    background: #dcecf5;
    border-radius: 999px;
}


.cc-task-bar {
    width: 0;
    height: 100%;

    background:
        linear-gradient(
            90deg,
            #4aa6d8,
            #277caf
        );

    border-radius: inherit;
    transition: width 220ms linear;
}


.cc-task-summary {
    min-width: 0;

    display: flex;
    justify-content: space-between;
    gap: 8px;

    margin-top: 4px;

    color: #607f93;
    font-size: 9px;
}


.cc-task-summary > span {
    min-width: 0;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}


.cc-task-summary > strong {
    flex: 0 0 auto;
    color: #376b8a;
    font-weight: 700;
}


.cc-task-summary-separator {
    padding-inline: 2px;
    color: #8aa1af;
}


.cc-task-details {
    display: grid;
    gap: 5px;

    padding: 7px 8px 8px;

    background: #f3f9fc;
    border-top: 1px solid #d9e9f2;
}


.cc-task-details[hidden] {
    display: none;
}


.cc-task-details > div {
    display: grid;
    grid-template-columns: 94px minmax(0, 1fr);
    gap: 7px;

    font-size: 9px;
}


.cc-task-details span {
    color: #7a97a9;
}


.cc-task-details strong {
    min-width: 0;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    color: #385d73;
    font-weight: 650;
}


.cc-task-details p {
    margin: 2px 0 0;

    color: #607f93;
    font-size: 9px;
}


.cc-task-error {
    color: #b14e57 !important;
}


.cc-task-indeterminate .cc-task-bar {
    width: 38% !important;
    animation: cc-task-indeterminate 1.1s ease-in-out infinite;
}


@keyframes cc-task-indeterminate {
    from {
        transform: translateX(-115%);
    }

    to {
        transform: translateX(305%);
    }
}


.cc-task-card.success .cc-task-icon {
    color: #2d7b56;
    background: #e7f7ef;
    border-color: #bee3cf;
}


.cc-task-card.warning .cc-task-icon {
    color: #92691f;
    background: #fff6dc;
    border-color: #ead79e;
}


.cc-task-card.error .cc-task-icon {
    color: #a44751;
    background: #fff0f1;
    border-color: #edc6ca;
}


/* Los paneles antiguos no deben competir con la pila nueva. */
#uploadPanel,
#carajilloOperationOverlay,
.archive-working-overlay {
    display: none !important;
}


@media screen and (max-width: 760px) {
    .cc-task-stack {
        left: 8px;
        right: 8px;
        bottom: max(8px, env(safe-area-inset-bottom));

        width: auto;
        max-width: none;
        max-height: min(58dvh, 520px);
    }
}
