/*
 * Vista del responsabile: a scrivania, da vicino. Tema chiaro di base, testata scura con il logo.
 * Stessi token e stessi esiti della TV (token.css): un'officina, un solo linguaggio di colori.
 */
body.resp { min-height: 100vh; font-size: 15px; line-height: 1.4; --pad: 28px; }

/* ---------- testata ---------- */
.r-testa {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 24px;
  padding: 14px var(--pad); background: var(--band); color: var(--band-text);
}
.r-testa .logo { height: 30px; width: auto; display: block; }
.r-titolo { display: flex; flex-direction: column; gap: 2px; padding-left: 24px; border-left: 1px solid #ffffff2a; }
.r-titolo .occhiello { font-size: 11px; }
.r-titolo h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1.1; color: var(--band-text); }
.r-comandi { display: flex; align-items: center; gap: 10px; justify-self: end; }
.r-ora { text-align: right; padding-left: 20px; border-left: 1px solid #ffffff22; }
.r-ora .num { font-weight: 700; font-size: 26px; line-height: 1; }
.r-data { font-size: 12px; color: var(--band-text-2); margin-top: 3px; }
.r-data::first-letter { text-transform: uppercase; }
.r-data .s { color: #ffb547; }

/* segmenti e comandi */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button {
  font: inherit; font-size: 14px; font-weight: 700; color: var(--text-2); background: transparent; border: 0;
  padding: 8px 14px; cursor: pointer; border-left: 1px solid var(--line-2);
}
.seg button:first-child { border-left: 0; }
.seg button:hover { color: var(--text); background: var(--surface-3); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--text); color: var(--surface); }
.seg.scuro { background: transparent; border-color: #ffffff33; }
.seg.scuro button { color: var(--band-text-2); border-color: #ffffff33; }
.seg.scuro button:hover { background: #ffffff14; color: #fff; }
.seg.scuro button[aria-pressed="true"] { background: #fff; color: #17181a; }
.seg.piccolo button { font-size: 13px; padding: 6px 11px; }
.r-comandi select, .btn-icona, .btn-link {
  font: inherit; font-size: 14px; color: var(--band-text); background: transparent; border: 1px solid #ffffff33;
  border-radius: var(--radius); padding: 7px 10px; cursor: pointer; text-decoration: none;
}
.r-comandi select option { color: #17181a; }
.btn-icona { display: inline-flex; align-items: center; padding: 7px 9px; }
.btn-icona:hover, .btn-link:hover, .r-comandi select:hover { background: #ffffff14; }
:focus-visible { outline: 2px solid var(--ver-fill); outline-offset: 2px; }

.r-avviso { padding: 10px var(--pad); font-weight: 700; background: var(--att-bg); color: var(--att); border-bottom: 1px solid var(--att-fill); }
.r-avviso.grave { background: var(--crit-bg); color: var(--crit); border-color: var(--crit-fill); }

/* ---------- corpo ---------- */
.r-corpo { padding: 22px var(--pad) 32px; display: flex; flex-direction: column; gap: 18px; max-width: 1800px; margin: 0 auto; }

.kpi-riga { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.kc {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 15px 12px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.kc .et { font-family: var(--font-occhiello); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kc .v { font-weight: 700; font-size: 30px; line-height: 1.05; font-variant-numeric: tabular-nums lining-nums; color: var(--text); }
.kc .v small { font-size: 15px; font-weight: 400; color: var(--text-2); margin-left: 3px; }
.kc .s { font-size: 13px; color: var(--text-2); }
.kc.e-oltre-preventivo .v, .kc.e-oltre-obiettivo .v, .kc.e-da-verificare .v { color: var(--c); }
.kc.e-oltre-preventivo { border-top: 3px solid var(--cf); }
.kc.e-oltre-obiettivo { border-top: 3px solid var(--cf); }
.kc.e-da-verificare { border-top: 3px dashed var(--cf); }
.kc.zero .v { color: var(--text-3); }

/* distribuzione degli esiti */
.esiti-riga { display: flex; flex-direction: column; gap: 7px; }
.dist { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: var(--surface-3); }
.dist i { display: block; height: 100%; background: var(--cf); }
.dist i.e-senza-riferimento { background: repeating-linear-gradient(135deg, var(--cf) 0 4px, var(--surface-3) 4px 8px); }
.dist i.e-da-verificare { background: repeating-linear-gradient(90deg, var(--cf) 0 5px, var(--surface-3) 5px 8px); }
.dist-leg { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--text-2); }
.dist-leg span { display: inline-flex; align-items: center; gap: 6px; }
.dist-leg b { color: var(--text); font-variant-numeric: tabular-nums; }
.dist-leg i { width: 10px; height: 10px; border-radius: 2px; background: var(--cf); display: inline-block; }
.dist-leg .e-senza-riferimento i { background: repeating-linear-gradient(135deg, var(--cf) 0 2px, transparent 2px 4px); outline: 1px solid var(--cf); }
.dist-leg .e-da-verificare i { background: transparent; outline: 2px dashed var(--cf); outline-offset: -2px; }

.r-schede { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.r-dati { display: flex; align-items: center; gap: 10px; }
.r-dati-et { font-size: 13px; color: var(--text-3); }

.r-griglia { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.r-principale { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.r-stato { padding: 80px 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; color: var(--text-2); }
.r-stato h2 { margin: 0; font-family: var(--font-display); font-size: 24px; color: var(--text); }
.r-stato p { margin: 0; max-width: 520px; }
.r-stato.errore h2 { color: var(--crit); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--text-2); animation: gira 1s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------- Gantt per ponte ---------- */
.g-testa { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.g-testa h2 { margin: 0; font-size: 15px; font-weight: 700; }
.leg { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-2); }
.leg span { display: inline-flex; align-items: center; gap: 6px; }
.leg i { display: inline-block; width: 18px; height: 9px; border-radius: 2px; background: var(--cf); }
.leg .e-senza-riferimento i { background: repeating-linear-gradient(135deg, var(--cf) 0 3px, transparent 3px 6px); outline: 1px solid var(--cf); }
.leg .e-da-verificare i { background: transparent; outline: 2px dashed var(--cf); outline-offset: -2px; }
.leg .aperta i { background: var(--surface); outline: 2px solid var(--text-2); outline-offset: -2px; }
.leg .lt-tacca i { width: 3px; height: 14px; background: var(--text); }
.leg .lt-tacca.obi i { background: var(--text-3); }

.g-scorri { overflow-x: auto; }
.gantt { min-width: 980px; --col-et: 210px; position: relative; }
.g-asse, .g-riga { display: grid; grid-template-columns: var(--col-et) minmax(0, 1fr); }
.g-asse { position: sticky; top: 0; background: var(--surface); z-index: 2; border-bottom: 1px solid var(--line); height: 30px; }
.g-asse .pista { position: relative; }
.g-asse .h { position: absolute; top: 8px; transform: translateX(-50%); font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.g-riga { min-height: 44px; border-bottom: 1px solid var(--line); }
.g-riga:last-child { border-bottom: 0; }
.g-riga:hover { background: var(--surface-2); }
.g-et { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px; min-width: 0; border-right: 1px solid var(--line); }
.g-et .pn { font-family: var(--font-display); font-weight: 700; font-size: 19px; width: 26px; text-align: right; color: var(--text); flex: none; }
.g-et .pn.vuoto { color: var(--text-3); font-family: var(--font-body); font-size: 13px; }
.g-et .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-et .st { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.g-et .chi { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.pista { position: relative; }
.g-riga .pista { background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: var(--passo-ora) 100%; background-position: var(--offset-ora) 0; }
.g-riga .vuota-txt { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--text-3); }

.bar {
  position: absolute; min-width: 4px;
  background: var(--cf); border-radius: 3px; border: 0; padding: 0 6px; margin: 0;
  font: inherit; font-size: 12px; font-weight: 700; color: #fff; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: clip; cursor: pointer;
  display: flex; align-items: center;
}
.bar:hover { filter: brightness(1.08); }
.bar.e-senza-riferimento { background: repeating-linear-gradient(135deg, var(--cf) 0 5px, var(--none-bg) 5px 10px); color: var(--text); }
.bar.e-da-verificare { background: var(--ver-bg); outline: 2px dashed var(--cf); outline-offset: -2px; color: var(--ver); }
.bar.aperta { background: var(--cb); outline: 2px solid var(--cf); outline-offset: -2px; color: var(--c); }
.bar.aperta.e-senza-riferimento { background: repeating-linear-gradient(135deg, var(--none-bg) 0 5px, var(--surface) 5px 10px); color: var(--text-2); }
.bar.aperta::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 3px; background: var(--cf); animation: pulsa 1.6s ease-in-out infinite; }
.bar.e-da-verificare::after { display: none; }
.bar.sel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); z-index: 3; }
.bar .freccia { margin-right: 3px; }
@keyframes pulsa { 50% { opacity: .25; } }
.tacca { position: absolute; width: 3px; margin-left: -1.5px; background: var(--text); border-radius: 1px; pointer-events: none; z-index: 2; }
.tacca.obi { background: var(--text-3); width: 2px; margin-left: -1px; }
.ora-linea { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--brand); z-index: 4; pointer-events: none; }
.ora-linea b { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; font-size: 11px; padding: 1px 5px; border-radius: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-fuori { position: absolute; transform: translateY(-50%); font-size: 11px; font-weight: 700; color: var(--ver); white-space: nowrap; }

/* ---------- per operatore ---------- */
.tab { width: 100%; border-collapse: collapse; font-size: 14px; }
.tab th {
  text-align: left; font-family: var(--font-occhiello); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface);
  position: sticky; top: 0;
}
.tab th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.tab th button:hover { color: var(--text); }
.tab th button:focus-visible { outline: 2px solid var(--ver-fill); outline-offset: 2px; }
.tab th .dir { font-size: 10px; color: var(--text); }
.tab th.n, .tab td.n { text-align: right; }
.tab td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-variant-numeric: tabular-nums; }
.tab tr:last-child td { border-bottom: 0; }
.tab tbody tr:hover { background: var(--surface-2); }
.tab .nome { font-weight: 700; }
.tab .sub { display: block; font-size: 12px; color: var(--text-3); font-weight: 400; }
.tab .muto { color: var(--text-3); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--c); background: var(--cb); padding: 3px 8px; border-radius: 4px; white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--cf); }
.pill.e-da-verificare { outline: 1px dashed var(--cf); }
.resa-v { font-weight: 700; }
.resa-c { display: block; font-size: 12px; color: var(--text-3); }
.mini { position: relative; height: 14px; min-width: 180px; background: var(--surface-3); border-radius: 2px; }
.mini i { position: absolute; top: 0; bottom: 0; background: var(--cf); border-radius: 1px; }
.mini i.aperta { background: var(--cb); outline: 1.5px solid var(--cf); outline-offset: -1.5px; }
.mini i.e-senza-riferimento { background: repeating-linear-gradient(135deg, var(--cf) 0 3px, transparent 3px 6px); }
.mini i.e-da-verificare { background: transparent; outline: 1.5px dashed var(--cf); outline-offset: -1.5px; }
.mini .ml { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--brand); }
.tab-scorri { overflow-x: auto; }

/* ---------- pannello laterale ---------- */
.r-lato { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.lato-testa { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.lato-testa .occhiello { font-size: 11px; }
.lato-testa h2 { margin: 0; font-family: var(--font-display); font-size: 19px; }
.lato-testa .indietro { all: unset; cursor: pointer; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.lato-testa .indietro:hover { color: var(--text); text-decoration: underline; }
.lato-gruppo { padding: 10px 16px 6px; }
.lato-gruppo h3 { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-occhiello); }
.voce {
  all: unset; box-sizing: border-box; display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  width: 100%; padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.voce:last-child { border-bottom: 0; }
.voce:hover { background: var(--surface-2); }
.voce:focus-visible { outline: 2px solid var(--ver-fill); outline-offset: -2px; }
.voce > i { align-self: stretch; background: var(--cf); border-radius: 2px; }
.voce.e-da-verificare > i { background: repeating-linear-gradient(180deg, var(--cf) 0 4px, transparent 4px 7px); }
.voce > span { min-width: 0; display: flex; flex-direction: column; }
.voce .t1 { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voce .t2 { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voce .vv { font-weight: 700; font-size: 14px; color: var(--c); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lato-vuoto { padding: 18px 16px; color: var(--text-2); font-size: 14px; }

.det { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.det-esito { padding: 10px 12px; border-radius: var(--radius); background: var(--cb); color: var(--c); font-weight: 700; border-left: 4px solid var(--cf); }
.det-esito small { display: block; font-weight: 400; color: var(--text-2); margin-top: 2px; }
.det dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px 14px; font-size: 14px; }
.det dt { color: var(--text-3); }
.det dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.det dd.arrivo { font-weight: 400; color: var(--text-3); font-style: italic; }
.det .tempi { display: flex; flex-direction: column; gap: 6px; }
.det .tempi .barra-d { position: relative; height: 12px; background: var(--surface-3); border-radius: 2px; }
.det .tempi .barra-d i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--cf); border-radius: 2px; }
.det .tempi .barra-d .tk { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; background: var(--text); }
.det .tempi .barra-d .tk.obi { background: var(--text-3); width: 2px; }
.det .anom { margin: 0; padding: 10px 12px; background: var(--ver-bg); color: var(--ver); border-radius: var(--radius); font-size: 13.5px; font-weight: 700; }
.det .nota-sim { font-size: 12px; color: var(--text-3); margin: 0; }

.r-nota { margin: 0; font-size: 12.5px; color: var(--text-3); }
.r-nota .sim { color: var(--text-2); }

/* tooltip in-app (mai il title del browser per i dati) */
.tip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 300px;
  background: var(--band); color: var(--band-text); border-radius: var(--radius); padding: 9px 11px; font-size: 13px; line-height: 1.35;
}
.tip b { display: block; font-size: 14px; }
.tip .r { color: var(--band-text-2); }

/* ---------- schermi stretti ---------- */
@media (max-width: 1280px) {
  .kpi-riga { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .r-griglia { grid-template-columns: minmax(0, 1fr); }
  .r-lato { position: static; max-height: none; }
}
@media (max-width: 760px) {
  body.resp { --pad: 16px; }
  .r-testa { grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; }
  .r-titolo { padding-left: 12px; }
  .r-titolo h1 { font-size: 19px; }
  .r-comandi { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; flex-wrap: wrap; }
  .r-ora { grid-column: 3; grid-row: 1; padding-left: 0; border-left: 0; }
  .kpi-riga { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gantt { --col-et: 150px; }
}
.r-lato:empty { display: none; }
@media (max-width: 760px) {
  .r-testa .logo { height: 22px; }
  .r-titolo h1 { font-size: 17px; white-space: nowrap; }
  .r-titolo .occhiello { font-size: 10px; white-space: nowrap; }
}
