/* "Supplier Connector" e' piu' lungo di "Reprint Hub": alla misura originale
   di Hope UI il titolo usciva dalla barra laterale da 16.2rem. Deve restare su
   una riga sola, perche' mandandolo a capo si impila una lettera per riga
   quando la barra laterale e' ridotta a icone. */
.sidebar-header .logo-title,
.iq-navbar .navbar-brand .logo-title {
    margin-left: var(--sp-3);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

/* Fra 992px e 1200px Hope UI toglie il margine al contenuto ma lascia la barra
   laterale al suo posto: il menu finiva sopra al pulsante che lo chiude,
   rendendolo non cliccabile. Qui il contenuto resta affiancato, come sopra i
   1200px, e il pulsante continua a comprimere la barra. */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .sidebar + .main-content { margin-left: var(--sidebar-width); }
    .sidebar-nascosta .sidebar + .main-content { margin-left: 0; }
}

.stato {
    display: inline-block; border-radius: var(--radius-pill); padding: 4px 10px;
    font-size: 12px; font-weight: 700; white-space: nowrap;
    background: var(--neutral-bg); color: var(--neutral-text);
}
.stato-WAITING_PAYMENT, .stato-DATA_REVIEW, .stato-IN_INVIO, .stato-PRONTA_ATTESA { background: var(--warn-bg); color: var(--warn-text); }
.stato-READY, .stato-PRONTA { background: var(--accent-soft); color: var(--accent-soft-text); }
.stato-READY_REVIEWED, .stato-GENERATED_SIMULATION, .stato-SENT, .stato-INVIATA,
.stato-PROCESSED, .stato-RESENT, .stato-RESOLVED { background: var(--ok-bg); color: var(--ok-text); }
.stato-DATA_ERROR, .stato-MANUAL_REVIEW, .stato-FALLITA, .stato-FAILED, .stato-INVALID { background: var(--danger-bg); color: var(--danger-text); }
.stato-HISTORICAL, .stato-COMPLETED_HISTORICAL { background: #f4f3ff; color: #5925dc; }
.stato-NO_SUPPLIER_LINES, .stato-DUPLICATE, .stato-SUPERSEDED { background: var(--surface-2); color: var(--text-muted); }
.stato-TO_CORRECT, .stato-CORRECTED, .stato-READY_TO_RESEND { background: var(--warn-bg); color: var(--warn-text); }
.stato-CLOSED_ACCEPTED, .stato-CLOSED_IGNORED, .stato-CLOSED_MANUAL, .stato-ACCEPTED { background: var(--surface-2); color: var(--text-muted); }

.grafico { display: block; overflow: visible; }
.grafico .griglia { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 5; }
.grafico .asse { font-size: 11px; fill: var(--text-faint); font-family: var(--font); }
.grafico .area-linea { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.grafico .punto-vivo { transition: r .15s ease; }
.grafico .punto:hover .punto-vivo { r: 6.5; }
.grafico .colonna:hover rect { filter: brightness(.92); }

.legenda { display: flex; gap: 16px; padding: 6px 4px 0; font-size: 12px; color: var(--text-muted); }
.legenda i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

.ciambella-blocco { display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); width: 100%; }
.ciambella-blocco .ciambella { width: 100%; max-width: 240px; height: auto; display: block; }
.ciambella-n { font-size: 40px; font-weight: 800; fill: var(--text); font-family: var(--font); letter-spacing: -.04em; }
.ciambella-sub { font-size: 12px; fill: var(--text-muted); font-family: var(--font); }
.ciambella-legenda { list-style: none; margin: 0; padding: 0; width: 100%; }
.ciambella-legenda a { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: 13px; color: var(--text-muted); text-decoration: none; border-bottom: 1px solid var(--border); }
.ciambella-legenda li:last-child a { border-bottom: 0; }
.ciambella-legenda a:hover { color: var(--accent); }
.ciambella-legenda i { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.ciambella-legenda span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ciambella-legenda em { font-style: normal; font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ciambella-legenda b { min-width: 34px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

.grafico .etichetta-ultimo rect { fill: var(--text); opacity: .92; }
.grafico .etichetta-ultimo text { fill: #fff; font-size: 12px; font-weight: 700; font-family: var(--font); }

.scintilla { display: block; width: 100%; height: 100%; }
.scintilla polyline { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }

.kpi {
    position: relative; overflow: hidden; height: 100%;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
    padding: 16px 18px 62px;
    transition: box-shadow .18s ease, transform .18s ease;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-testa { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-etichetta {
    font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--text-muted);
}
.kpi-valore {
    display: block; margin-top: 10px; font-size: 34px; font-weight: 800; line-height: 1;
    letter-spacing: -.035em; color: var(--text); font-variant-numeric: tabular-nums;
}
.kpi-nota { display: block; margin-top: 6px; font-size: 12px; color: var(--text-faint); }
.kpi-fondo { position: absolute; left: 0; right: 0; bottom: 0; height: 56px; pointer-events: none; }
.kpi .scintilla polyline { stroke: var(--tinta); }

.grafico .cima { font-size: 10.5px; font-weight: 700; fill: var(--text-faint); font-family: var(--font); }

.scarto { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-pill); }
.scarto-su { background: var(--ok-bg); color: var(--ok-text); }
.scarto-giu { background: var(--danger-bg); color: var(--danger-text); }
.scarto-piatto { background: var(--surface-2); color: var(--text-muted); }

.classifica { list-style: none; margin: 0; padding: 0; }
.classifica li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.classifica li:last-child { border-bottom: 0; }
.classifica .codice { font-size: 13px; font-weight: 700; color: var(--text); }
.classifica .quanti { font-size: 13px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.classifica .nome { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.classifica .asta { grid-column: 1 / -1; height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.classifica .asta span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

.riquadro-dato {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 14px 16px; height: 100%;
}
.riquadro-dato small { display: block; color: var(--text-muted); font-size: 12px; font-weight: 600; }
.riquadro-dato b { display: block; margin-top: 6px; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }
.riquadro-dato .nota { display: block; margin-top: 4px; font-size: 11.5px; color: var(--text-faint); }

.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--text-muted); font-weight: 600; }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
@media (max-width: 640px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 8px; } }

.avviso-lista { margin: 0; padding-left: 18px; font-size: 13px; }
.avviso-lista li { margin-bottom: 3px; }
.avviso-errore { color: var(--danger-text); }
.avviso-warning { color: var(--warn-text); }

.nome-file { font-size: 11.5px; overflow-wrap: anywhere; color: var(--text-muted); }
.testo-grezzo {
    white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2);
    border: 1px solid var(--border); padding: 12px; border-radius: var(--radius-sm);
    font-size: 12.5px; margin: 0;
}
.cella-scelta { width: 74px; text-align: center; }
.cella-scelta input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

.accesso { min-height: 100dvh; display: grid; place-items: center; padding: var(--sp-5); background: var(--bg); }
.accesso-riquadro {
    width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: var(--sp-6);
}
.accesso-marchio { display: flex; align-items: center; gap: 12px; margin-bottom: var(--sp-5); }
.accesso-marchio img { width: 44px; height: 44px; border-radius: var(--radius-sm); }
.accesso-marchio h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.accesso-marchio p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-muted); }
.accesso-riquadro .form-label { font-size: 13px; font-weight: 600; color: var(--text); }
.accesso-nota { margin: var(--sp-5) 0 0; font-size: 11.5px; color: var(--text-faint); text-align: center; }
.accesso-mostra {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none;
    color: var(--text-muted); font-size: 12px; font-weight: 700; padding: 6px 8px; cursor: pointer;
    border-radius: var(--radius-sm);
}
.accesso-mostra:hover { background: var(--surface-2); color: var(--text); }
.hub-wa-icon { width: 28px; height: 28px; min-width: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center; position: relative; border-radius: 50%; }
.hub-wa-icon svg { width: 24px; height: 24px; }
.hub-wa-pending { border: 0; background: transparent; color: #d97706; }
.hub-wa-pending:hover { color: #b45309; }
.hub-wa-sent { border: 0; background: transparent; color: #0f9d8d; }
.hub-wa-sent:hover { color: #087f73; }
.hub-wa-sent::after { content: "✓"; position: absolute; right: -2px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; background: #0f9d8d; color: #fff; font-size: 9px; line-height: 12px; text-align: center; font-weight: 700; }
.hub-wa-unavailable { border: 0; background: transparent; color: #94a3b8; }
.hub-wa-pending[aria-disabled="true"] { border: 0; background: transparent; color: #94a3b8; }
.hub-wa-icon[aria-disabled="true"] { cursor: not-allowed; opacity: .7; }
