/*
 * App-specific styling for the projects dashboard. Everything reuses the
 * brand-kit's --gooo-* tokens so it stays visually consistent with the shared
 * chrome; only the CI-status colors are introduced here since the brand kit
 * doesn't ship a semantic "success/failure" palette.
 */

/* This app renders only the brand bar — it has no second-tier .gooo-appbar — so
   the sticky chrome is 44px, not the 96px the brand kit assumes by default. Left
   at 52px the sidebar's `top: var(--gooo-chrome-h)` overshoots the real chrome,
   and because a sticky box can't leave its containing block the overshoot only
   applies on pages long enough to give it slack: short pages pinned the nav
   under the bar, long ones (queue, cluster) dropped it 52px, so the nav appeared
   to jump vertically between pages. */
:root {
    --gooo-appbar-h: 0px;
}

/* The browser's default 8px body margin otherwise shows as a light frame
   around the dark shell (the shell paints its own background, body doesn't). */
html,
body {
    margin: 0;
}

body {
    background: var(--gooo-bg, #0b0f17);
}

.gooo-page-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--gooo-text-strong);
    margin: 0 0 0.35rem;
}

.gooo-page-lede {
    color: var(--gooo-muted);
    margin: 0 0 1.5rem;
    max-width: 60ch;
}

.gooo-page-lede a {
    color: var(--gooo-accent);
    text-decoration: none;
}

.gooo-page-lede a:hover {
    text-decoration: underline;
}

.gooo-project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.gooo-project-card {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.gooo-project-card__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gooo-project-card__icon {
    font-size: 1.2rem;
    line-height: 1;
}

.gooo-project-card__name {
    font-weight: 600;
    color: var(--gooo-text-strong);
}

.gooo-project-card__desc {
    margin: 0;
    color: var(--gooo-muted);
    font-size: 0.86rem;
    flex: 1;
}

.gooo-project-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.gooo-project-card__link {
    align-self: flex-start;
}

.gooo-dot-inline {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.gooo-badge--ci-success { color: #34d399; border-color: rgba(52, 211, 153, 0.35); }
.gooo-badge--ci-failure { color: var(--gooo-danger); border-color: rgba(251, 113, 133, 0.35); }
.gooo-badge--ci-running { color: var(--gooo-accent); border-color: rgba(125, 211, 252, 0.35); }
.gooo-badge--ci-none,
.gooo-badge--ci-unknown { color: var(--gooo-faint); }

.gooo-badge--status-up { color: #34d399; border-color: rgba(52, 211, 153, 0.35); }
.gooo-badge--status-down { color: var(--gooo-danger); border-color: rgba(251, 113, 133, 0.35); }
.gooo-badge--status-unknown { color: var(--gooo-faint); }

/* Compact status lozenges for the featured services shown on the dashboard. */
.gooo-section-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--gooo-text-strong);
    margin: 2.5rem 0 0;
}

.gooo-status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.gooo-status-lozenge {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    min-width: 260px;
}

.gooo-status-lozenge__icon {
    font-size: 1.4rem;
    line-height: 1;
}

.gooo-status-lozenge__body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.gooo-status-lozenge__name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--gooo-text-strong);
}

.gooo-status-lozenge__desc {
    font-size: 0.85rem;
}

/* ---- Cluster page ---------------------------------------------------- */

.gooo-badge--task-running,
.gooo-badge--leader { color: #34d399; border-color: rgba(52, 211, 153, 0.35); }
.gooo-badge--task-pending { color: #fbbf24; border-color: rgba(251, 191, 36, 0.35); }
.gooo-badge--task-failed { color: var(--gooo-danger); border-color: rgba(251, 113, 133, 0.35); }

.gooo-cluster3d-wrap {
    position: relative;
    margin-top: 1rem;
}

.gooo-cluster3d {
    position: relative;
    height: 640px;
    border: 1px solid var(--gooo-border);
    border-radius: var(--gooo-radius);
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 30%, #0d1524 0%, #05070c 70%);
    cursor: grab;
}

.gooo-cluster3d canvas {
    display: block;
}

.gooo-cluster3d__loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--gooo-muted);
    font-size: 0.9rem;
    margin: 0;
}

.gooo-cluster3d-label {
    font-family: var(--gooo-font);
    font-size: 9.6px; /* 20% smaller than the original 12px */
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
    pointer-events: none;
}

.gooo-cluster3d-label--node {
    font-size: 10.4px; /* 20% smaller than the original 13px */
}

/* Shared targeting-reticle chrome for both planet (node) and asteroid (task)
   labels: square corners, a translucent black border, background glass.
   The label is anchored (via CSS2DObject.center) at its own left-middle edge
   rather than centered on the sphere, so this margin is what actually
   creates the visible gap between the sphere and its label. */
.gooo-cluster3d-label--boxed {
    position: absolute;
    margin-left: 10px;
    color: var(--gooo-text-strong);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 0;
    background: var(--gooo-surface-glass);
    border: 1px solid rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    /* Planets (nodes) get red brackets; asteroids (tasks) override this to
       orange below so the two kinds read as visually distinct at a glance. */
    --bracket-color: #ef4444;
}

.gooo-cluster3d-label--task.gooo-cluster3d-label--boxed {
    --bracket-color: #fb923c;
}

/* Targeting-reticle corner brackets: four 8px L-marks sitting right on top
   of the translucent black border, via a pseudo-element so they don't
   disturb the label's own box model. */
.gooo-cluster3d-label--boxed::before {
    content: '';
    position: absolute;
    inset: -1px;
    pointer-events: none;
    background-repeat: no-repeat;
    background-image:
        linear-gradient(var(--bracket-color), var(--bracket-color)), linear-gradient(var(--bracket-color), var(--bracket-color)),
        linear-gradient(var(--bracket-color), var(--bracket-color)), linear-gradient(var(--bracket-color), var(--bracket-color)),
        linear-gradient(var(--bracket-color), var(--bracket-color)), linear-gradient(var(--bracket-color), var(--bracket-color)),
        linear-gradient(var(--bracket-color), var(--bracket-color)), linear-gradient(var(--bracket-color), var(--bracket-color));
    background-size:
        8px 1px, 1px 8px,
        8px 1px, 1px 8px,
        8px 1px, 1px 8px,
        8px 1px, 1px 8px;
    background-position:
        top left, top left,
        top right, top right,
        bottom left, bottom left,
        bottom right, bottom right;
}

.gooo-cluster3d-label--boxed.is-visible::before {
    background-image:
        linear-gradient(var(--gooo-accent), var(--gooo-accent)), linear-gradient(var(--gooo-accent), var(--gooo-accent)),
        linear-gradient(var(--gooo-accent), var(--gooo-accent)), linear-gradient(var(--gooo-accent), var(--gooo-accent)),
        linear-gradient(var(--gooo-accent), var(--gooo-accent)), linear-gradient(var(--gooo-accent), var(--gooo-accent)),
        linear-gradient(var(--gooo-accent), var(--gooo-accent)), linear-gradient(var(--gooo-accent), var(--gooo-accent));
}

.gooo-cluster3d-label--boxed.is-occluded {
    visibility: hidden;
}

.gooo-cluster3d-label__sub {
    display: inline-block;
    margin-top: 1px;
    font-family: var(--gooo-mono);
    font-size: 9px;
    color: var(--gooo-faint);
}

.gooo-cluster3d-trash {
    font-size: 78px;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
}

.gooo-cluster3d__tooltip {
    display: none;
    position: absolute;
    z-index: 10;
    max-width: 240px;
    padding: 0.6rem 0.75rem;
    border-radius: var(--gooo-radius-sm);
    background: var(--gooo-surface-glass);
    border: 1px solid var(--gooo-border);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--gooo-text);
    pointer-events: none;
}

.gooo-cluster3d__legend {
    position: absolute;
    bottom: 0.75rem;
    left: 0.75rem;
    z-index: 5;
    padding: 0.6rem 0.8rem;
    border-radius: var(--gooo-radius-sm);
    background: var(--gooo-surface-glass);
    border: 1px solid var(--gooo-border);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-size: 0.76rem;
    color: var(--gooo-muted);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    pointer-events: none;
}

.gooo-cluster3d__legend-title {
    font-weight: 600;
    color: var(--gooo-text-strong);
    margin-bottom: 0.15rem;
}

.gooo-cluster3d__legend-hint {
    margin-top: 0.25rem;
    max-width: 22ch;
}

.gooo-cluster3d__swatch {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    margin-right: 0.4rem;
}

.gooo-cluster3d__focus {
    position: absolute;
    top: 0.75rem;
    left: 1rem;
    z-index: 5;
    max-width: 70%;
    font-family: "Segoe Script", "Bradley Hand", "Brush Script MT", cursive;
    font-style: italic;
    font-size: 2.28rem;
    line-height: 1.15;
    color: var(--gooo-text-strong);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.gooo-cluster3d__altimeter {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--gooo-radius-sm);
    background: var(--gooo-surface-glass);
    border: 1px solid var(--gooo-border);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-family: var(--gooo-mono);
    pointer-events: none;
}

.gooo-cluster3d__altimeter-row {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.gooo-cluster3d__altimeter-label {
    font-size: 0.7rem;
    color: var(--gooo-faint);
    letter-spacing: 0.08em;
    width: 2.2em;
}

.gooo-cluster3d__altimeter-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #34d399;
    min-width: 3.2em;
}

.gooo-cluster3d__altimeter-value--vel {
    color: #7dd3fc;
}

.gooo-cluster3d__altimeter-value--rot {
    color: #c084fc;
}

.gooo-cluster3d__altimeter-unit {
    font-size: 0.72rem;
    color: var(--gooo-muted);
}

/* ---- Cluster page: plain-text fallback list, below the 3D scene -------- */

.gooo-cluster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.gooo-cluster-node {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gooo-cluster-node__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gooo-cluster-node__hostname {
    font-weight: 600;
    color: var(--gooo-text-strong);
    font-family: var(--gooo-mono);
    font-size: 0.92rem;
}

.gooo-cluster-node__dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    flex: none;
}
.gooo-cluster-node__dot--ready { background: #34d399; }
.gooo-cluster-node__dot--down,
.gooo-cluster-node__dot--disconnected { background: var(--gooo-danger); }
.gooo-cluster-node__dot--unknown { background: var(--gooo-faint); }

.gooo-cluster-node__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.gooo-cluster-node__tasks {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-top: 1px solid var(--gooo-border-soft);
    padding-top: 0.65rem;
}

.gooo-cluster-node__empty {
    margin: 0;
    font-size: 0.85rem;
}

.gooo-cluster-task {
    display: grid;
    grid-template-columns: auto 7px auto minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: var(--gooo-radius-sm);
    padding: 2px 4px;
    margin: -2px -4px;
}

.gooo-cluster-task:hover {
    background: var(--gooo-surface-2);
}

.gooo-cluster-task__select {
    accent-color: var(--gooo-accent);
    cursor: pointer;
}

.gooo-cluster-task__dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    flex: none;
    transform: translateY(-1px);
}
.gooo-cluster-task__dot--running { background: #34d399; }
.gooo-cluster-task__dot--pending,
.gooo-cluster-task__dot--assigned,
.gooo-cluster-task__dot--preparing,
.gooo-cluster-task__dot--starting { background: #fbbf24; }
.gooo-cluster-task__dot--failed,
.gooo-cluster-task__dot--rejected,
.gooo-cluster-task__dot--shutdown { background: var(--gooo-danger); }

.gooo-cluster-task__service {
    font-weight: 600;
    color: var(--gooo-text);
}

.gooo-cluster-task__image,
.gooo-cluster-task__container {
    font-family: var(--gooo-mono);
    font-size: 0.78rem;
}

.gooo-cluster-task__image {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* ---- Build-queue pipeline ------------------------------------------- */

.gooo-queue {
    display: grid;
    grid-template-columns: 1fr 1.3fr 1fr;
    gap: 1.25rem;
    margin-top: 1.25rem;
    align-items: stretch;
    position: relative;
}

/* Flow arrows sitting in the gaps between the three columns. */
.gooo-queue::before,
.gooo-queue::after {
    content: "";
    position: absolute;
    top: 2.1rem;
    width: 1rem;
    height: 1rem;
    background: var(--gooo-faint);
    opacity: 0.5;
    -webkit-mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12h14M13 6l6 6-6 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    mask: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12h14M13 6l6 6-6 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    animation: gooo-queue-arrow 1.8s ease-in-out infinite;
    pointer-events: none;
}
.gooo-queue::before { left: calc(40% - 0.5rem); }
.gooo-queue::after { left: calc(70.5% - 0.5rem); animation-delay: 0.4s; }

@keyframes gooo-queue-arrow {
    0%, 100% { opacity: 0.25; transform: translateX(-2px); }
    50% { opacity: 0.7; transform: translateX(2px); }
}

.gooo-queue.is-stale { opacity: 0.7; transition: opacity 0.3s; }

/* Before the first poll lands, show a neutral loading hint rather than the
   "nothing here" empty states (which would be misleading). */
.gooo-queue.is-loading .gooo-queue__empty { display: none; }

.gooo-queue.is-loading .gooo-queue__lane::after {
    content: "Loading\2026";
    color: var(--gooo-faint);
    font-size: 0.85rem;
    padding: 0.6rem 0.25rem;
}

.gooo-queue__col {
    background: var(--gooo-surface, rgba(255, 255, 255, 0.02));
    border: 1px solid var(--gooo-border);
    border-radius: var(--gooo-radius);
    padding: 0.95rem 1rem;
    /* Equal, comfortable column height; the job lane scrolls inside rather
       than letting a full Done column stretch the page into a tall wall. */
    height: min(72vh, 760px);
    min-height: 360px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gooo-queue__col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.1rem 0.25rem 0.5rem;
    border-bottom: 1px solid var(--gooo-border);
}

.gooo-queue__col-title {
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gooo-muted);
}

.gooo-queue__col-count {
    font-variant-numeric: tabular-nums;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gooo-text-strong);
    background: var(--gooo-border);
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    min-width: 1.5rem;
    text-align: center;
}

/* No pill until the first poll fills the count in. */
.gooo-queue__col-count:empty {
    display: none;
}

.gooo-queue__lane {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-right: 0.3rem;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--gooo-faint) 50%, transparent) transparent;
}

.gooo-queue__lane::-webkit-scrollbar {
    width: 8px;
}

.gooo-queue__lane::-webkit-scrollbar-track {
    background: transparent;
}

.gooo-queue__lane::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--gooo-faint) 40%, transparent);
    border-radius: 999px;
}

/* Compact runner status strip at the top of the In Progress column. */
.gooo-queue__runnerbar {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}

.gooo-queue__empty {
    font-size: 0.85rem;
    padding: 0.6rem 0.25rem;
    margin: 0;
}

/* --- PR clusters --- */

.gooo-qgroup {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
}

.gooo-qgroup--pr {
    gap: 0.5rem;
    padding: 0.5rem 0.55rem 0.55rem;
    border: 1px solid var(--gooo-border);
    border-left: 2px solid hsl(var(--repo-hue, 200) 65% 58%);
    border-radius: calc(var(--gooo-radius) - 2px);
    background: rgba(255, 255, 255, 0.015);
}

.gooo-qgroup__head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.1rem;
}

.gooo-qgroup--solo .gooo-qgroup__head {
    display: none;
}

.gooo-qgroup__dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: hsl(var(--repo-hue, 200) 65% 60%);
    flex: 0 0 auto;
}

.gooo-qgroup__repo {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gooo-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gooo-qgroup__pr {
    font-family: var(--gooo-mono, ui-monospace, monospace);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gooo-text-strong);
}

.gooo-qgroup__count {
    margin-left: auto;
    font-size: 0.66rem;
    color: var(--gooo-faint);
    white-space: nowrap;
}

.gooo-qgroup__body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Inside a PR box, the repo + ref on each card just echo the group header. */
.gooo-qgroup--pr .gooo-qjob__repo,
.gooo-qgroup--pr .gooo-qjob__ref {
    display: none;
}

/* --- job card --- */

.gooo-qjob {
    --st: var(--gooo-faint);
    position: relative;
    display: flex;
    align-items: stretch;
    /* Keep full height inside the scrolling flex-column lane; without this a
       full column would shrink every card to a sliver instead of overflowing. */
    flex: 0 0 auto;
    gap: 0.7rem;
    padding: 0.7rem 0.85rem 0.7rem 0.72rem;
    background: var(--gooo-card-bg, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--gooo-border);
    border-radius: calc(var(--gooo-radius) - 2px);
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.gooo-qjob:hover {
    border-color: color-mix(in srgb, var(--st) 55%, var(--gooo-border));
    transform: translateY(-1px);
}

.gooo-qjob__accent {
    flex: 0 0 3px;
    border-radius: 3px;
    background: var(--st);
    box-shadow: 0 0 8px -1px var(--st);
}

.gooo-qjob__main {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
}

.gooo-qjob__repo {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.gooo-qjob__dot {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: hsl(var(--repo-hue, 200) 65% 60%);
    box-shadow: 0 0 0 2px hsl(var(--repo-hue, 200) 65% 60% / 0.18);
}

.gooo-qjob__repo-name {
    font-size: 0.72rem;
    color: var(--gooo-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gooo-qjob__name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gooo-text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gooo-qjob__meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--gooo-muted);
    min-width: 0;
}

.gooo-qjob__ref {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--gooo-mono, ui-monospace, monospace);
    opacity: 0.85;
}

.gooo-qjob__timer {
    margin-left: auto;
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    color: var(--st);
    font-weight: 600;
}

.gooo-qjob__spinner {
    display: none;
    flex: 0 0 auto;
    align-self: center;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid color-mix(in srgb, var(--st) 30%, transparent);
    border-top-color: var(--st);
    animation: gooo-queue-spin 0.8s linear infinite;
}

@keyframes gooo-queue-spin { to { transform: rotate(360deg); } }

/* status palette */
.gooo-qjob.is-waiting { --st: #fbbf24; }
.gooo-qjob.is-running { --st: var(--gooo-accent, #7dd3fc); }
.gooo-qjob.is-success { --st: #34d399; }
.gooo-qjob.is-failure { --st: var(--gooo-danger, #fb7185); }
.gooo-qjob.is-cancelled,
.gooo-qjob.is-skipped,
.gooo-qjob.is-unknown { --st: var(--gooo-faint); }

.gooo-qjob.is-waiting .gooo-qjob__accent { animation: gooo-queue-breathe 2.2s ease-in-out infinite; }
.gooo-qjob.is-running .gooo-qjob__spinner { display: block; }

/* running cards get a faint travelling sheen */
.gooo-qjob.is-running::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 40%, color-mix(in srgb, var(--gooo-accent, #7dd3fc) 14%, transparent) 50%, transparent 60%);
    background-size: 220% 100%;
    animation: gooo-queue-sheen 2.4s linear infinite;
}

@keyframes gooo-queue-sheen {
    0% { background-position: 140% 0; }
    100% { background-position: -40% 0; }
}

@keyframes gooo-queue-breathe {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.gooo-qjob.is-leaving { z-index: 0; }

/* --- runner status chips (top of the In Progress column) --- */

.gooo-qrunner-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--gooo-border);
    border-radius: 999px;
    background: var(--gooo-card-bg, rgba(255, 255, 255, 0.03));
    transition: border-color 0.25s, box-shadow 0.25s;
}

.gooo-qrunner-chip.is-busy {
    border-color: color-mix(in srgb, var(--gooo-accent, #7dd3fc) 45%, var(--gooo-border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--gooo-accent, #7dd3fc) 18%, transparent);
}

.gooo-qrunner-chip__status {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--gooo-faint);
    flex: 0 0 auto;
}

.gooo-qrunner-chip.is-online .gooo-qrunner-chip__status {
    background: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18);
}

.gooo-qrunner-chip.is-busy .gooo-qrunner-chip__status {
    animation: gooo-queue-breathe 1.4s ease-in-out infinite;
}

.gooo-qrunner-chip__name {
    font-weight: 600;
    color: var(--gooo-text-strong);
    font-size: 0.8rem;
}

.gooo-qrunner-chip__ver {
    font-size: 0.7rem;
    font-family: var(--gooo-mono, ui-monospace, monospace);
}

@media (max-width: 780px) {
    .gooo-queue { grid-template-columns: 1fr; }
    .gooo-queue__col { height: auto; min-height: 0; }
    .gooo-queue__lane { max-height: 60vh; }
    .gooo-queue::before, .gooo-queue::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .gooo-queue::before, .gooo-queue::after,
    .gooo-qjob.is-waiting .gooo-qjob__accent,
    .gooo-qjob.is-running::after,
    .gooo-qrunner-chip.is-busy .gooo-qrunner-chip__status { animation: none; }
    .gooo-qjob.is-running .gooo-qjob__spinner { animation-duration: 2s; }
}

/* ------------------------------------------------------------------ machines */

/*
 * Per-host telemetry cards. The visual language carries the liveness rule that
 * the JS enforces in data: a live card is tinted by its own CPU temperature via
 * --machine-hue, an away card drops to greyscale and fades its readings, and a
 * card whose heartbeat age we could not establish is dimmer still. Nothing here
 * should ever make a sleeping machine look like a running one.
 */
.gooo-machines {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    align-items: start;
}

.gooo-machines__empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 2rem 0;
    text-align: center;
}

.gooo-machine {
    /* Falls back to the neutral accent hue until a live temperature arrives, so
       a card never flashes red on first paint. */
    --machine-hue: 210;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.9rem 1rem 0.75rem;
    border-top: 2px solid hsl(var(--machine-hue) 80% 60% / 0.55);
    transition: opacity 240ms ease, filter 240ms ease;
}

.gooo-machine.is-away,
.gooo-machine.is-unknown {
    opacity: 0.55;
    filter: grayscale(0.85);
}

.gooo-machine.is-unknown {
    opacity: 0.4;
    border-top-style: dashed;
}

.gooo-machine__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gooo-machine__icon {
    font-size: 1.1rem;
    line-height: 1;
}

.gooo-machine__name {
    font-weight: 600;
    color: var(--gooo-text-strong);
    font-family: var(--gooo-font-mono, ui-monospace, monospace);
}

.gooo-machine__state {
    margin-left: auto;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gooo-muted);
}

.gooo-machine.is-live .gooo-machine__state {
    color: hsl(var(--machine-hue) 80% 65%);
}

.gooo-machine__sparkwrap {
    min-height: 44px;
}

.gooo-machine__spark {
    display: block;
    width: 100%;
    height: 44px;
}

.gooo-machine__stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem 0.9rem;
}

.gooo-machine__stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.82rem;
    min-width: 0;
}

.gooo-machine__stat-label {
    color: var(--gooo-muted);
    white-space: nowrap;
}

.gooo-machine__stat-value {
    color: var(--gooo-text-strong);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* The headline reading. Spans both columns so CPU temperature reads as the
   card's subject rather than as one of ten equal rows. */
.gooo-machine__stat--accent {
    grid-column: 1 / -1;
    font-size: 1rem;
}

.gooo-machine__stat--accent .gooo-machine__stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: hsl(var(--machine-hue) 80% 68%);
}

.gooo-machine.is-away .gooo-machine__stat--accent .gooo-machine__stat-value,
.gooo-machine.is-unknown .gooo-machine__stat--accent .gooo-machine__stat-value {
    color: var(--gooo-muted);
}

.gooo-machine__foot {
    font-size: 0.72rem;
    border-top: 1px solid var(--gooo-border);
    padding-top: 0.5rem;
}
