/* ============================================================
   La coda del server di wainow Lab (D533.6): la pagina
   Components/ServerQueue.razor e la riga dal vivo della chat
   (Components/QueueStatusLine.razor). Ogni colore viene dai token di
   css/wainow/ (--nx-*), come lab-chat.css: il tema scuro si deriva da solo.
   ============================================================ */

.nl-queue {
    display: flex;
    flex-direction: column;
    gap: var(--wainow-space-3, 12px);
    font-family: var(--wainow-font-family, system-ui, sans-serif);
    color: var(--nx-text);
    min-width: 0;
}

.nl-queue-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--wainow-space-3, 12px);
}
.nl-queue-title { font-size: 1.25rem; font-weight: 600; margin: 0; }
.nl-queue-stamp { color: var(--nx-text-faint); font-size: var(--wainow-fs-caption, .8rem); }
.nl-queue-hint { color: var(--nx-text-muted); }

/* l'indicatore del carico, nei colori semantici di wainow */
.nl-load {
    font-size: var(--wainow-fs-caption, .8rem);
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 999px;
    background: var(--nx-field);
    color: var(--nx-text-muted);
}
.nl-load-free { background: var(--nx-success-bg); color: var(--nx-success-ink); }
.nl-load-light { background: color-mix(in srgb, var(--nx-corallo) 20%, var(--nx-surface)); color: var(--nx-corallo-ink); }
.nl-load-busy { background: var(--nx-warning-bg); color: var(--nx-warning-ink); }
.nl-load-unknown { background: var(--nx-error-bg); color: var(--nx-danger-ink); }

.nl-queue-cards {
    display: grid;
    /* a schermo stretto una colonna sola, mai oltre il bordo */
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: var(--wainow-space-3, 12px);
}
.nl-queue-card {
    background: var(--nx-surface);
    border: 1px solid var(--nx-line);
    border-radius: var(--nx-radius-card, 12px);
    box-shadow: var(--nx-shadow-card, none);
    padding: var(--wainow-space-3, 12px) var(--wainow-space-4, 16px);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nl-queue-card-title { font-size: var(--wainow-fs-caption, .8rem); color: var(--nx-text-faint); text-transform: uppercase; letter-spacing: .04em; }
.nl-queue-card-main { font-size: 1.05rem; font-weight: 600; }
.nl-queue-card-line { color: var(--nx-text-muted); }
.nl-queue-card-note { color: var(--nx-text-faint); font-size: var(--wainow-fs-caption, .8rem); margin-top: 4px; }

.nl-queue-subtitle { font-size: 1rem; font-weight: 600; margin: var(--wainow-space-2, 8px) 0 0; }
.nl-queue-empty { color: var(--nx-text-muted); }

.nl-queue-table-wrap { overflow-x: auto; }
.nl-queue-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--nx-surface);
    border: 1px solid var(--nx-line);
    border-radius: var(--nx-radius-card, 12px);
}
.nl-queue-table th {
    text-align: left;
    font-weight: 600;
    font-size: var(--wainow-fs-caption, .8rem);
    color: var(--nx-text-faint);
    padding: 8px 12px;
    border-bottom: 1px solid var(--nx-line);
}
.nl-queue-table td { padding: 8px 12px; border-bottom: 1px solid var(--nx-line); vertical-align: top; }
.nl-queue-table tr:last-child td { border-bottom: 0; }
.nl-queue-mine td { background: color-mix(in srgb, var(--nx-corallo) 8%, var(--nx-surface)); }
.nl-queue-closed td { color: var(--nx-text-muted); }

.nl-queue-state {
    display: inline-block;
    font-size: var(--wainow-fs-caption, .8rem);
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 999px;
    margin-right: 6px;
}
.nl-queue-state-waiting { background: var(--nx-warning-bg); color: var(--nx-warning-ink); }
.nl-queue-state-inprogress { background: color-mix(in srgb, var(--nx-corallo) 20%, var(--nx-surface)); color: var(--nx-corallo-ink); }
.nl-queue-line { color: var(--nx-text-muted); }

.nl-queue-notice {
    color: var(--nx-text-muted);
    font-size: var(--wainow-fs-caption, .8rem);
    border-top: 1px solid var(--nx-line);
    padding-top: var(--wainow-space-2, 8px);
}

/* la riga dal vivo nella chat */
.nl-queue-live { display: flex; flex-direction: column; gap: 4px; }
.nl-queue-live-row {
    font-size: var(--wainow-fs-caption, .8rem);
    padding: 6px 12px;
    border-radius: var(--wainow-radius-md, 8px);
    background: var(--nx-field);
    color: var(--nx-text-muted);
}
.nl-queue-live-waiting { background: var(--nx-warning-bg); color: var(--nx-warning-ink); }
.nl-queue-live-inprogress { background: color-mix(in srgb, var(--nx-corallo) 14%, var(--nx-surface)); color: var(--nx-corallo-ink); }
.nl-queue-live-kind { font-weight: 600; margin-right: 6px; }

/* ============================================================
   «La macchina adesso» (24/11, Components/MachineLoadPanel.razor):
   CPU, memoria e dischi con il livello. Lo stato ha sempre la parola
   (la pastiglia), il colore la accompagna; la barra riempie nel colore
   del livello su una traccia dello stesso tono piu' chiaro; l'andamento
   e' una linea nel tono smorzato con l'ultimo punto nell'accento.
   ============================================================ */

.nl-mload { display: flex; flex-direction: column; gap: var(--wainow-space-2, 8px); min-width: 0; }
.nl-mload-title { margin: 0; }

.nl-mload-chip {
    font-size: var(--wainow-fs-caption, .8rem);
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--nx-field);
    color: var(--nx-text-muted);
    white-space: nowrap;
}
.nl-mload-chip-normal { background: var(--nx-success-bg); color: var(--nx-success-ink); }
.nl-mload-chip-high { background: var(--nx-warning-bg); color: var(--nx-warning-ink); }
.nl-mload-chip-overloaded { background: var(--nx-error-bg); color: var(--nx-danger-ink); }

.nl-mload-card { --nl-mload-color: var(--nx-text-faint); gap: 6px; min-width: 0; }
.nl-mload-normal { --nl-mload-color: var(--nx-corallo); }
.nl-mload-high { --nl-mload-color: var(--nx-warning); }
.nl-mload-overloaded {
    --nl-mload-color: var(--nx-danger);
    border-color: color-mix(in srgb, var(--nx-danger) 45%, var(--nx-line));
}
.nl-mload-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nl-mload-value { font-size: 1.5rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }

.nl-mload-meter {
    height: 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--nl-mload-color) 18%, var(--nx-surface));
    overflow: hidden;
}
.nl-mload-meter-fill { height: 100%; border-radius: 999px; background: var(--nl-mload-color); transition: width .4s ease; }

.nl-mload-note { font-size: var(--wainow-fs-caption, .8rem); font-weight: 600; color: var(--nx-text); }
.nl-mload-high .nl-mload-note { color: var(--nx-warning-ink); }
.nl-mload-overloaded .nl-mload-note { color: var(--nx-danger-ink); }

.nl-mload-spark { position: relative; height: 40px; margin-top: 4px; }
.nl-mload-spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.nl-mload-spark-line {
    fill: none;
    stroke: var(--nx-text-faint);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}
.nl-mload-spark-threshold {
    stroke: var(--nx-danger);
    stroke-width: 1;
    stroke-dasharray: 4 3;
    opacity: .55;
    vector-effect: non-scaling-stroke;
}
.nl-mload-spark-hit { fill: transparent; pointer-events: all; }
.nl-mload-spark-hit:hover { fill: color-mix(in srgb, var(--nx-corallo) 14%, transparent); }
.nl-mload-spark-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nx-corallo);
    box-shadow: 0 0 0 2px var(--nx-surface);
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.nl-mload-spark-caption { font-size: var(--wainow-fs-caption, .8rem); color: var(--nx-text-faint); }

/* il motore non scrive da un po': i numeri restano, piu' tenui */
.nl-mload-stale .nl-mload-cards { opacity: .6; }

/* la pagina «Carico della macchina» (25/11, Components/MachineLoadPage.razor): il riquadro e, per l'amministratore, i
   processi che consumano di piu' in due tabelle affiancate (per CPU e per memoria) che vanno a capo sotto i 760 px */
.nl-mload-procs { display: flex; flex-direction: column; gap: var(--wainow-space-2, 8px); min-width: 0; }
.nl-mload-procs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr));
    gap: var(--wainow-space-3, 12px);
    min-width: 0;
}
.nl-mload-procs-grid.nl-mload-stale { opacity: .6; }
.nl-mload-procs-card { gap: 6px; min-width: 0; }
.nl-mload-procs-table .nl-mload-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nl-mload-procs-table .nl-mload-strong { font-weight: 600; }
.nl-mload-proc-name { overflow-wrap: anywhere; }
.nl-mload-kind {
    display: inline-block;
    font-size: var(--wainow-fs-caption, .8rem);
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--nx-field);
    color: var(--nx-text-muted);
    white-space: nowrap;
}
.nl-mload-kind-claudesession { background: color-mix(in srgb, var(--nx-corallo) 16%, var(--nx-surface)); color: var(--nx-corallo-ink); }
.nl-mload-kind-testrun,
.nl-mload-kind-testslot { background: var(--nx-warning-bg); color: var(--nx-warning-ink); }
.nl-mload-kind-wainowservice,
.nl-mload-kind-database { background: var(--nx-success-bg); color: var(--nx-success-ink); }

/* la riga del carico nelle chat (Components/MachineLoadChatLine.razor): discreta, come la riga della coda */
.nl-mload-chatline {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: var(--wainow-fs-caption, .8rem);
    background: var(--nx-warning-bg);
    color: var(--nx-warning-ink);
}
.nl-mload-chatline-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--nx-warning);
    transform: translateY(-1px);
}

@media (forced-colors: active) {
    .nl-mload-meter { border: 1px solid CanvasText; }
    .nl-mload-meter-fill { background: Highlight; }
    .nl-mload-spark-dot { background: Highlight; }
}
