/* Combotool embed — ventana 3D sobre Programas */
.cb-stage {
    position: relative;
    width: 100%;
    padding: clamp(12px, 2vw, 24px) 0;
    background: transparent;
    perspective: 1400px;
    perspective-origin: 50% 42%;
    overflow: visible;
    min-height: min(760px, 82vh);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-scene {
    width: 100%;
    max-width: 1280px;
    height: min(760px, 74vh);
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    transform: translateZ(48px);
    transition: transform 0.14s ease-out;
    will-change: transform;
}

.cb-stage .embed-scale-port {
    transform-style: preserve-3d;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cb-window {
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.cb-embed {
    --cb-bg-sidebar: #09090b;
    --cb-bg-main: #121214;
    --cb-bg-card: #18181b;
    --cb-border: #27272a;
    --cb-text: #f4f4f5;
    --cb-muted: #a1a1aa;
    --cb-blue: #3b82f6;
    --cb-green: #22c55e;
    --cb-yellow: #eab308;
    --cb-active: rgba(59, 130, 246, 0.1);

    width: 100%;
    height: 100%;
    border-radius: 12px;
    border: 1px solid #3f3f46;
    background: var(--cb-bg-main);
    box-shadow:
        0 30px 60px -12px rgba(0, 0, 0, 0.7),
        0 18px 36px -18px rgba(0, 0, 0, 0.8),
        0 48px 80px -24px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--cb-text);
}

.cb-embed * {
    box-sizing: border-box;
}

.cb-embed .cb-frame {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.cb-embed .cb-titlebar {
    height: 40px;
    background: #050505;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 0 14px;
    border-bottom: 1px solid var(--cb-border);
    flex-shrink: 0;
    user-select: none;
}

.cb-embed .cb-traffic {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cb-embed .cb-traffic__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.cb-embed .cb-traffic__dot--close { background: #ff5f57; }
.cb-embed .cb-traffic__dot--min { background: #febc2e; }
.cb-embed .cb-traffic__dot--max { background: #28c840; }

.cb-embed .cb-titlebar-title {
    justify-self: center;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.72);
}

.cb-embed .cb-app {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.cb-embed .cb-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--cb-bg-sidebar);
    border-right: 1px solid var(--cb-border);
    padding: 18px 0;
    display: flex;
    flex-direction: column;
}

.cb-embed .cb-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px 18px;
}

.cb-embed .cb-logo-icon {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: linear-gradient(135deg, #a8a29e, #d6d3d1);
}

.cb-embed .cb-logo h1 {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.cb-embed .cb-logo p {
    font-size: 10px;
    color: var(--cb-muted);
}

.cb-embed .cb-nav-title {
    padding: 0 16px;
    font-size: 10px;
    color: var(--cb-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.cb-embed .cb-nav {
    list-style: none;
    padding: 0 8px;
    margin-bottom: 12px;
}

.cb-embed .cb-nav li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--cb-muted);
}

.cb-embed .cb-nav li.is-active {
    background: var(--cb-active);
    color: var(--cb-blue);
}

.cb-embed .cb-nav li i {
    font-size: 16px;
}

.cb-embed .cb-workspace {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cb-embed .cb-topbar {
    height: 52px;
    border-bottom: 1px solid var(--cb-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.cb-embed .cb-breadcrumb {
    font-size: 13px;
    font-weight: 600;
}

.cb-embed .cb-breadcrumb span {
    color: var(--cb-muted);
    font-weight: 400;
}

.cb-embed .cb-content {
    flex: 1;
    overflow: hidden;
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.cb-embed .cb-banner {
    border: 1px solid var(--cb-blue);
    border-radius: 8px;
    padding: 16px 18px;
    background: var(--cb-bg-card);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.cb-embed .cb-banner::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--cb-blue);
}

.cb-embed .cb-banner h2 {
    font-size: 15px;
    margin-bottom: 4px;
}

.cb-embed .cb-banner p {
    font-size: 12px;
    color: var(--cb-muted);
    line-height: 1.5;
}

.cb-embed .cb-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    flex-shrink: 0;
}

.cb-embed .cb-stat {
    background: var(--cb-bg-card);
    border: 1px solid var(--cb-border);
    border-radius: 8px;
    padding: 14px;
    position: relative;
    overflow: hidden;
}

.cb-embed .cb-stat::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.cb-embed .cb-stat--blue::before { background: var(--cb-blue); }
.cb-embed .cb-stat--green::before { background: var(--cb-green); }
.cb-embed .cb-stat--yellow::before { background: var(--cb-yellow); }

.cb-embed .cb-stat-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cb-muted);
    margin-bottom: 8px;
}

.cb-embed .cb-stat-val {
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s;
}

.cb-embed .cb-stat--blue .cb-stat-val { color: var(--cb-blue); }
.cb-embed .cb-stat--green .cb-stat-val { color: var(--cb-green); }
.cb-embed .cb-stat--yellow .cb-stat-val { color: var(--cb-yellow); }

.cb-embed .cb-stat-desc {
    font-size: 10px;
    color: var(--cb-muted);
    margin-top: 6px;
}

.cb-embed .cb-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 14px;
}

.cb-embed .cb-tasks-head {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--cb-muted);
    margin-bottom: 8px;
}

.cb-embed .cb-tasks {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.cb-embed .cb-task {
    background: var(--cb-bg-card);
    border: 1px solid var(--cb-border);
    border-radius: 8px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px 14px;
    align-items: center;
    opacity: 0;
    transform: translateY(8px);
    animation: cb-task-in 0.45s ease forwards;
}

@keyframes cb-task-in {
    to {
        opacity: 1;
        transform: none;
    }
}

.cb-embed .cb-task.is-running {
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.06);
}

.cb-embed .cb-task.is-completed {
    border-color: rgba(34, 197, 94, 0.25);
    opacity: 0.92;
}

.cb-embed .cb-task.is-queued {
    opacity: 0.55;
}

.cb-embed .cb-task-info h4 {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cb-embed .cb-task-info p {
    font-size: 10px;
    color: var(--cb-muted);
}

.cb-embed .cb-task-progress {
    grid-column: 1 / -1;
}

.cb-embed .cb-task-progress-top {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--cb-muted);
    margin-bottom: 5px;
}

.cb-embed .cb-task-pct {
    color: var(--cb-blue);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.cb-embed .cb-task.is-completed .cb-task-pct {
    color: var(--cb-green);
}

.cb-embed .cb-task-bar {
    height: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.cb-embed .cb-task-fill {
    height: 100%;
    width: 0%;
    background: var(--cb-blue);
    border-radius: 3px;
    transition: width 0.35s linear;
    position: relative;
}

.cb-embed .cb-task.is-completed .cb-task-fill {
    background: var(--cb-green);
    transition: width 0.5s ease;
}

.cb-embed .cb-task.is-running .cb-task-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
    animation: cb-shimmer 1.8s ease-in-out infinite;
}

@keyframes cb-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.cb-embed .cb-tag {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.cb-embed .cb-tag--run {
    background: rgba(59, 130, 246, 0.12);
    color: var(--cb-blue);
}

.cb-embed .cb-tag--done {
    background: rgba(34, 197, 94, 0.12);
    color: var(--cb-green);
}

.cb-embed .cb-tag--wait {
    background: rgba(255, 255, 255, 0.04);
    color: var(--cb-muted);
}

.cb-embed .cb-mails {
    background: var(--cb-bg-card);
    border: 1px solid var(--cb-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.cb-embed .cb-mails-head {
    padding: 10px 12px;
    border-bottom: 1px solid var(--cb-border);
    font-size: 11px;
    color: var(--cb-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.cb-embed .cb-mails-head strong {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 13px;
    font-weight: 600;
    color: var(--cb-green);
    font-variant-numeric: tabular-nums;
}

.cb-embed .cb-mails-stream {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10px;
    line-height: 1.35;
    mask-image: linear-gradient(180deg, #000 0%, #000 82%, transparent 100%);
}

.cb-embed .cb-mails-stream.is-burst {
    animation: cb-mails-flash 0.12s ease-out;
}

@keyframes cb-mails-flash {
    from { background: rgba(59, 130, 246, 0.04); }
    to { background: transparent; }
}

.cb-embed .cb-mail {
    color: #e4e4e7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 2px 0;
}

.cb-embed .cb-mail b {
    color: var(--cb-blue);
    font-weight: 500;
}

/* Escala vía .embed-scale-port en investigador.css */

@media (max-width: 1024px) {
    .cb-stage {
        min-height: 0 !important;
        overflow: hidden;
        perspective: none;
    }
}
