﻿/* ═══════════════════════════════════════════════════════════════════════
   NEXUS CONTROL — la sala di controllo

   PALETTE: quella STANDARD DI NEXUS, presa dalle sue pagine e non inventata.
   Fondo chiaro, grigi #f9fafb…#1f2937, azzurro d'azione #2563eb, e i tre
   stati esattamente come Nexus li scrive già altrove:
       verde   #dcfce7 / #166534   completato, in linea
       ambra   #fef3c7 / #92400e   sollecitato, a rischio
       rosso   #fee2e2 / #991b1b   escalato, fuori tempo
   Qui l'accento è il BLU, quindi l'ambra è libera di voler dire una cosa
   sola: rischio. Nessun conflitto fra identità e stato.

   🔴 IL COLORE NON DECORA. Tre stati, decisi in un punto solo
   (NexusControlService), così sala e mappa non possono contraddirsi.

   MOVIMENTO: due animazioni in tutto — il battito del nodo attivo e il
   tratteggio che scorre sul filo vivo — lente, e spente se il sistema
   chiede meno movimento.
   ═══════════════════════════════════════════════════════════════════════ */

.nxc {
    --sfondo: #f6f7f9; --carta: #ffffff; --carta-2: #f9fafb; --carta-3: #f3f4f6;
    --linea: #e5e7eb; --linea-2: #d1d5db;
    --testo: #1f2937; --testo-2: #4b5563; --testo-3: #6b7280; --testo-4: #9ca3af;
    --blu: #2563eb; --blu-soft: #eff4ff; --blu-bordo: #bfd3fd;

    --ok: #166534; --ok-bg: #dcfce7; --ok-pieno: #16a34a;
    --risk: #92400e; --risk-bg: #fef3c7; --risk-pieno: #d97706;
    --late: #991b1b; --late-bg: #fee2e2; --late-pieno: #dc2626;
    --wait: #d1d5db; --wait-txt: #9ca3af;

    /* 🔴 DENTRO IL LAYOUT, come tutte le pagine Nexus. La prima versione era
       position:fixed e copriva lo schermo intero: si mangiava la barra laterale
       di MEKKA e non si tornava più indietro. Una pagina è una pagina, anche
       quando somiglia a una sala di controllo. */
    /* Voce 76 (Max 15/09/2026): «non è a schermo intero» e poi «il menu di MEKKA deve
       sempre essere disponibile». La Sala resta nella cornice di MEKKA (menu ☰) e
       occupa tutta la larghezza. Solo il limite è cambiato; da ricontrollare da Codex (voce 77). */
    max-width: none; margin: 0; padding: 18px;
    font-family: system-ui, "Segoe UI", sans-serif; color: #1f2937; line-height: 1.45;
}
.nxc *, .nxc *::before, .nxc *::after { box-sizing: border-box; }
.nxc h1, .nxc h2, .nxc h3 { margin: 0; }
.nxc-mono { font-family: Consolas, monospace; font-variant-numeric: tabular-nums; }
.nxc button { font-family: inherit; cursor: pointer; }

/* ── intestazione: identica alle altre pagine Nexus ──────────────────── */
.nxc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.nxc-head h1 { margin: 0; font-size: 22px; }
/* Il logo vero di Nexus, lo stesso della sua pagina principale: /images/nexus/logo.png */
.nxc-logo { height: 44px; width: auto; }
.nxc-sub { font-size: 13px; color: #6b7280; }
.nxc-back { border: 1px solid #d1d5db; background: #fff; border-radius: 8px; width: 32px; height: 32px; font-size: 18px; cursor: pointer; }
.nxc-back:hover { border-color: var(--blu); color: var(--blu); }
.nxc-flex { flex: 1; }
.nxc-torna { background: #fff; border: 1px solid #d1d5db; border-radius: 8px; padding: 6px 12px; font-size: 12.5px; color: var(--testo-2); }
.nxc-torna:hover { border-color: var(--blu); color: var(--blu); }
.nxc-clock { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--testo-3); }
.nxc-clock b { color: var(--testo); }
.nxc-live { display: flex; align-items: center; gap: 6px; }
.nxc-beat { width: 7px; height: 7px; border-radius: 50%; background: var(--ok-pieno); box-shadow: 0 0 0 0 rgba(22,163,74,.25); animation: nxcBeat 3.2s ease-out infinite; }
@keyframes nxcBeat { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.25); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ── fascia di stato ───────────────────────────────────────────────── */
.nxc-strip { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)) 1.6fr; gap: 1px;
             background: var(--linea); border: 1px solid var(--linea); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.nxc-cell { background: var(--carta); padding: 11px 16px; position: relative; }
.nxc-cell::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--wait); }
.nxc-cell.late::after { background: var(--late-pieno); } .nxc-cell.risk::after { background: var(--risk-pieno); }
.nxc-cell.ok::after { background: var(--ok-pieno); } .nxc-cell.wait::after { background: var(--testo-4); }
.nxc-cell .n { font-size: 31px; font-weight: 700; line-height: 1; }
.nxc-cell.late .n { color: var(--late); } .nxc-cell.risk .n { color: var(--risk); } .nxc-cell.ok .n { color: var(--ok); }
/* Lo zero è una buona notizia e deve tacere. */
.nxc-cell.zero .n { color: var(--testo-4); font-weight: 500; }
.nxc-cell.zero::after { background: var(--linea) !important; }
.nxc-cell .l { font-size: 9.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--testo-2); font-weight: 700; margin-top: 4px; }
.nxc-cell .h { font-size: 10.5px; color: var(--testo-4); margin-top: 2px; }
.nxc-cell.wide { display: flex; align-items: center; }
.nxc-cell.wide b { color: var(--testo); }
@media (max-width: 1100px) { .nxc-strip { grid-template-columns: repeat(2, 1fr); } .nxc-cell.wide { grid-column: 1 / -1; } }

/* ── corpo ─────────────────────────────────────────────────────────── */
.nxc-body { display: grid; grid-template-columns: 208px 1fr; gap: 14px; align-items: start; }
@media (max-width: 980px) { .nxc-body { grid-template-columns: 1fr; } .nxc-rail { display: none; } }
.nxc-rail { background: var(--carta); border: 1px solid var(--linea); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 18px; }
.nxc-rail h3 { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--testo-4); margin-bottom: 8px; }
.nxc-f { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--testo-2); padding: 4px 0; cursor: pointer; user-select: none; }
.nxc-f i { width: 13px; height: 13px; border: 1px solid var(--linea-2); border-radius: 4px; flex: none; font-style: normal; position: relative; }
.nxc-f.on { color: var(--testo); font-weight: 500; }
.nxc-f.on i { background: var(--blu); border-color: var(--blu); }
.nxc-f.on i::after { content: ""; position: absolute; inset: 2px 2px; border-left: 1.5px solid #fff; border-bottom: 1.5px solid #fff; transform: rotate(-45deg) translate(1px,-1px); }
.nxc-f i.dot { border-radius: 50%; border: 0; width: 9px; height: 9px; }
.nxc-f i.dot::after { content: none; }
.nxc-f i.dot.late { background: var(--late-pieno); } .nxc-f i.dot.risk { background: var(--risk-pieno); }
.nxc-f i.dot.ok { background: var(--ok-pieno); } .nxc-f i.dot.wait { background: var(--wait); }
.nxc-f:not(.on) i.dot { opacity: .32; }
.nxc-f .k { margin-left: auto; font-size: 10.5px; color: var(--testo-4); }
.nxc-cerca { width: 100%; background: var(--carta-2); border: 1px solid var(--linea-2); color: var(--testo); border-radius: 7px; padding: 7px 9px; font-size: 12px; font-family: inherit; }

.nxc-main { min-width: 0; }
.nxc-titolo { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.nxc-titolo h2 { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--testo-3); }
.nxc-titolo span { font-size: 11px; color: var(--testo-4); }

/* ── tessera operazione ────────────────────────────────────────────── */
.nxc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.nxc-op { background: var(--carta); border: 1px solid var(--linea); border-radius: 10px; overflow: hidden; cursor: pointer;
          transition: box-shadow .14s, transform .14s; }
.nxc-op:hover { box-shadow: 0 4px 14px -6px rgba(31,41,55,.18); transform: translateY(-1px); }
.nxc-op.late { border-left: 3px solid var(--late-pieno); } .nxc-op.risk { border-left: 3px solid var(--risk-pieno); }
.nxc-op.ok { border-left: 3px solid var(--ok-pieno); } .nxc-op.wait { border-left: 3px solid var(--wait); }
.nxc-op-h { padding: 11px 13px 9px; display: flex; align-items: flex-start; gap: 8px; }
.nxc-op-h b { font-size: 14px; line-height: 1.25; flex: 1; }
.nxc-tag { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.nxc-tag.late { background: var(--late-bg); color: var(--late); }
.nxc-tag.risk { background: var(--risk-bg); color: var(--risk); }
.nxc-tag.ok { background: var(--ok-bg); color: var(--ok); }
.nxc-tag.wait { background: var(--carta-3); color: var(--testo-3); }
.nxc-tag.urg { background: var(--blu-soft); color: var(--blu); }
.nxc-op-meta { padding: 0 13px 9px; display: flex; gap: 14px; font-size: 11px; color: var(--testo-4); flex-wrap: wrap; }
.nxc-op-meta b { color: var(--testo-2); font-weight: 500; }

.nxc-catena { display: flex; align-items: center; padding: 2px 13px 11px; }
.nxc-nodo { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative; }
.nxc-pallino { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--wait); background: var(--carta);
               display: grid; place-items: center; font-size: 8px; color: #fff; font-weight: 700; z-index: 2; }
.nxc-nodo.done .nxc-pallino { background: var(--ok-pieno); border-color: var(--ok-pieno); }
.nxc-nodo.now .nxc-pallino { border-color: var(--blu); box-shadow: 0 0 0 3px var(--blu-soft); }
.nxc-nodo.risk .nxc-pallino { border-color: var(--risk-pieno); background: var(--risk-pieno); }
.nxc-nodo.late .nxc-pallino { border-color: var(--late-pieno); background: var(--late-pieno); }
.nxc-nodo small { font-size: 9px; letter-spacing: .06em; color: var(--testo-4); }
.nxc-nodo.now small { color: var(--blu); } .nxc-nodo.late small { color: var(--late); } .nxc-nodo.risk small { color: var(--risk); }
.nxc-link { position: absolute; top: 7px; left: 50%; width: 100%; height: 2px; background: var(--wait); z-index: 1; }
.nxc-link.done { background: var(--ok-pieno); }

.nxc-op-f { padding: 8px 13px; border-top: 1px solid var(--linea); display: flex; justify-content: space-between;
            align-items: center; gap: 8px; font-size: 11px; background: var(--carta-2); }
.nxc-rest.late { color: var(--late); font-weight: 600; } .nxc-rest.risk { color: var(--risk); font-weight: 600; }
.nxc-rest.ok { color: var(--testo-3); }
.nxc-who { display: flex; align-items: center; gap: 6px; color: var(--testo-3); white-space: nowrap; }
.nxc-who i { width: 18px; height: 18px; border-radius: 50%; background: var(--carta-3); color: var(--testo-3);
             display: grid; place-items: center; font-size: 8px; font-style: normal; font-weight: 700; }

/* ══════════════ MAPPA ══════════════ */
.nxc-mappa { display: grid; grid-template-columns: 1fr 308px; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .nxc-mappa { grid-template-columns: 1fr; } }
.nxc-canvas { background: var(--carta); border: 1px solid var(--linea); border-radius: 10px; padding: 16px; }
.nxc-canvas-h { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.nxc-canvas-h h2 { font-size: 19px; }
.nxc-canvas-h p { margin: 3px 0 0; font-size: 11.5px; color: var(--testo-4); }
.nxc-canvas-h p b { color: var(--testo-2); }
.nxc-motivo { font-size: 12px; padding: 8px 12px; border-radius: 8px; margin-bottom: 16px; border-left: 3px solid var(--linea-2); background: var(--carta-2); color: var(--testo-2); }
.nxc-motivo.late { border-left-color: var(--late-pieno); color: var(--late); background: var(--late-bg); }
.nxc-motivo.risk { border-left-color: var(--risk-pieno); color: var(--risk); background: var(--risk-bg); }
.nxc-motivo.ok { border-left-color: var(--ok-pieno); background: var(--carta-2); }

/* ── IL FLUSSO ─────────────────────────────────────────────────────────
   Le linee le disegna il JavaScript misurando i nodi veri (nexus-flow.js):
   in CSS non si sanno le posizioni, e disegnare fra i centri delle colonne
   dava linee che non toccavano niente e non spiegavano il flusso.

   La grammatica è quella di un fork/join, che è esattamente il modello:
     · le attività della STESSA fase si uniscono a un GIUNTO
     · dal giunto riparte la fase dopo
   Il giunto è il punto in cui si aspetta: finché non ci arrivano tutte,
   non si passa. Disegnarlo rende visibile la regola invece di lasciarla
   implicita in due colonne affiancate.
   ────────────────────────────────────────────────────────────────────── */
.nxc-flow-wrap { overflow-x: auto; padding: 4px 0 8px; }
.nxc-flow { position: relative; display: flex; align-items: stretch; gap: 0; min-width: 700px; }
.nxc-fili { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: visible; }
.nxc-filo { fill: none; stroke: var(--wait); stroke-width: 2; }
.nxc-filo.done { stroke: var(--ok-pieno); }
.nxc-filo.attivo { stroke: var(--blu); stroke-dasharray: 6 5; animation: nxcCorri 1.5s linear infinite; }
.nxc-filo.risk { stroke: var(--risk-pieno); }
.nxc-filo.late { stroke: var(--late-pieno); }
@keyframes nxcCorri { to { stroke-dashoffset: -22; } }

.nxc-colonna { flex: 1 1 0; min-width: 196px; display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 2; padding-right: 4px; }
.nxc-col-h { display: flex; align-items: center; gap: 7px; margin-bottom: 2px; }
.nxc-col-h b { font-size: 11px; letter-spacing: .11em; text-transform: uppercase; color: var(--testo-3); font-weight: 600; }
.nxc-bollo { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 700;
             background: var(--carta-3); color: var(--testo-3); }
.nxc-colonna.now .nxc-bollo { background: var(--blu-soft); color: var(--blu); }
.nxc-colonna.done .nxc-bollo { background: var(--ok-bg); color: var(--ok); }

/* il giunto: dove la fase si chiude e si aspetta */
.nxc-giunto { flex: 0 0 46px; display: flex; flex-direction: column; align-items: center; justify-content: center;
              position: relative; z-index: 2; align-self: center; }
.nxc-giunto i { width: 13px; height: 13px; transform: rotate(45deg); background: var(--carta); border: 2px solid var(--wait); border-radius: 3px; }
.nxc-giunto.done i { background: var(--ok-pieno); border-color: var(--ok-pieno); }
.nxc-giunto.attivo i { border-color: var(--blu); background: var(--blu-soft); }
.nxc-giunto small { position: absolute; top: 100%; margin-top: 5px; font-size: 8.5px; letter-spacing: .07em;
                    text-transform: uppercase; color: var(--testo-4); white-space: nowrap; }

.nxc-card { background: var(--carta); border: 1px solid var(--linea-2); border-radius: 9px; padding: 10px 11px;
            cursor: pointer; transition: box-shadow .14s, border-color .14s; position: relative; }
.nxc-card:hover { border-color: var(--blu-bordo); }
.nxc-card.sel { border-color: var(--blu); box-shadow: 0 0 0 3px var(--blu-soft); }
.nxc-card.done { background: var(--carta-2); }
.nxc-st { position: absolute; right: 9px; top: 11px; width: 9px; height: 9px; border-radius: 50%; background: var(--wait); }
.nxc-card.done .nxc-st { background: var(--ok-pieno); }
.nxc-card.now .nxc-st { background: var(--blu); animation: nxcBeat2 2.6s ease-out infinite; }
@keyframes nxcBeat2 { 0% { box-shadow: 0 0 0 0 rgba(37,99,235,.3); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.nxc-card.risk .nxc-st { background: var(--risk-pieno); } .nxc-card.late .nxc-st { background: var(--late-pieno); }
.nxc-card b { display: block; font-size: 12.5px; padding-right: 16px; line-height: 1.3; }
.nxc-rep { font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--testo-4); margin-top: 3px; }
.nxc-pers { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: 11px; color: var(--testo-2); flex-wrap: wrap; }
.nxc-pers i { width: 17px; height: 17px; border-radius: 50%; background: var(--carta-3); color: var(--testo-3);
              display: grid; place-items: center; font-size: 8px; font-style: normal; font-weight: 700; }
.nxc-assente { color: var(--risk); font-size: 9.5px; font-weight: 600; }
.nxc-doc { margin-top: 7px; padding-top: 6px; border-top: 1px dashed var(--linea); font-size: 10.5px; color: var(--blu); }
/* «insieme»: le attività della stessa fase sono parallele e si aspettano */
.nxc-insieme { font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--testo-4);
               display: flex; align-items: center; gap: 5px; padding: 2px 0 0 2px; }
.nxc-insieme::before { content: ""; width: 14px; height: 1px; background: var(--linea-2); }

/* ── righello del tempo ────────────────────────────────────────────── */
.nxc-tempo { margin-top: 16px; background: var(--carta-2); border: 1px solid var(--linea); border-radius: 9px; padding: 11px 13px; }
.nxc-tempo-h { display: flex; justify-content: space-between; gap: 10px; font-size: 9.5px; letter-spacing: .1em;
               text-transform: uppercase; color: var(--testo-4); margin-bottom: 8px; }
.nxc-righello { position: relative; height: 24px; background: var(--carta-3); border-radius: 5px; overflow: hidden; }
.nxc-fetta { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; font-size: 9px;
             font-family: Consolas, monospace; font-weight: 700; overflow: hidden; }
.nxc-fetta.done { background: var(--ok-pieno); color: #fff; }
.nxc-fetta.now { background: var(--blu); color: #fff; }
.nxc-fetta.next { background: var(--linea); color: var(--testo-3); }
.nxc-fetta.over { background: var(--late-pieno); color: #fff; }
.nxc-adesso { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--testo); z-index: 3; }

.nxc-legenda { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 10.5px; color: var(--testo-4); }
.nxc-legenda span { display: flex; align-items: center; gap: 5px; }
.nxc-legenda i { width: 9px; height: 9px; border-radius: 50%; font-style: normal; }
.nxc-legenda i.ok { background: var(--ok-pieno); } .nxc-legenda i.now { background: var(--blu); }
.nxc-legenda i.risk { background: var(--risk-pieno); } .nxc-legenda i.late { background: var(--late-pieno); }
.nxc-legenda i.wait { background: var(--wait); }

/* ── pannello ──────────────────────────────────────────────────────── */
.nxc-side { background: var(--carta); border: 1px solid var(--linea); border-radius: 10px; padding: 14px;
            display: flex; flex-direction: column; gap: 14px; }
.nxc-side h3 { font-size: 16px; }
.nxc-sub { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--testo-4); }
.nxc-desc { font-size: 12px; color: var(--testo-2); }
.nxc-kv { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 6px 0; border-bottom: 1px solid var(--linea); }
.nxc-kv:last-child { border-bottom: 0; }
.nxc-kv span { color: var(--testo-4); }
.nxc-kv b { font-weight: 500; text-align: right; }
.nxc-kv b.ok { color: var(--ok); } .nxc-kv b.risk { color: var(--risk); } .nxc-kv b.late { color: var(--late); }
.nxc-barra { height: 6px; background: var(--carta-3); border-radius: 99px; overflow: hidden; }
.nxc-barra i { display: block; height: 100%; background: var(--ok-pieno); }
.nxc-barra i.risk { background: var(--risk-pieno); } .nxc-barra i.late { background: var(--late-pieno); } .nxc-barra i.wait { background: var(--wait); }
.nxc-piedino { font-size: 10.5px; color: var(--testo-4); line-height: 1.4; }
.nxc-file { display: block; padding: 7px 9px; margin-bottom: 5px; background: var(--carta-2); border: 1px solid var(--linea);
            border-radius: 7px; text-decoration: none; color: var(--testo); }
.nxc-file:hover { border-color: var(--blu-bordo); }
.nxc-file b { display: block; font-size: 11.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nxc-file span { font-size: 10px; color: var(--testo-4); }
.nxc-azioni { display: flex; gap: 6px; flex-wrap: wrap; }
.nxc-azioni button { background: var(--carta); border: 1px solid var(--linea-2); color: var(--testo-2); border-radius: 7px; padding: 6px 11px; font-size: 11.5px; }
.nxc-azioni button:hover:not(:disabled) { border-color: var(--blu); color: var(--blu); }
.nxc-azioni button.blu { background: var(--blu); border-color: var(--blu); color: #fff; }
.nxc-azioni button.blu:hover:not(:disabled) { background: #1d4ed8; color: #fff; }
.nxc-azioni button:disabled { opacity: .45; cursor: default; }
.nxc-sel { width: 100%; border: 1px solid var(--linea-2); border-radius: 7px; padding: 6px 8px; font-size: 12px;
           font-family: inherit; background: var(--carta); color: var(--testo); }

/* ── varie ─────────────────────────────────────────────────────────── */
.nxc-vuoto { padding: 70px 20px; text-align: center; color: var(--testo-3); font-size: 13px; }
.nxc-vuoto.piccolo { padding: 40px 20px; background: var(--carta); border: 1px dashed var(--linea-2); border-radius: 10px; }
.nxc-msg { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; cursor: pointer;
           padding: 10px 18px; border-radius: 8px; font-size: 12.5px; background: var(--carta); border: 1px solid var(--linea-2);
           box-shadow: 0 8px 24px -10px rgba(31,41,55,.35); }
.nxc-msg.ok { border-color: #a7f3d0; background: #ecfdf5; color: var(--ok); }
.nxc-msg.ko { border-color: #fecaca; background: var(--late-bg); color: var(--late); }

@media (prefers-reduced-motion: reduce) {
    .nxc-beat, .nxc-card.now .nxc-st { animation: none; }
    .nxc-filo.attivo { animation: none; }
    .nxc-op { transition: none; }
}
