@charset "UTF-8";
/* ==========================================================================
   Ordinoo · System Integrator — stile pagina principale (bozzetto MVP)
   Diagramma: nodi HTML + linee SVG (generate lato PHP). Icone in puro CSS.
   ========================================================================== */

:root {
    --bg:          #0e1420;
    --bg-soft:     #161f30;
    --panel:       #1b2740;
    --panel-2:     #223050;
    --border:      #2c3c5f;
    --text:        #e7edf6;
    --text-dim:    #93a1bd;
    --accent:      #3d8bff;   /* System Integrator */
    --ordinoo:     #26d07c;   /* Ordinoo */
    --active:      #2fd67a;
    --planned:     #52648a;
    --custom:      #a879ff;
    --partner:     #e0a33e;   /* API via partner/dispositivo */
    --testing:     #f5c518;   /* connettore scritto, da collaudare */
    --notpos:      #e5675a;   /* non è un POS */
    --radius:      14px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(1100px 600px at 15% -10%, #1a2740 0%, transparent 60%),
        radial-gradient(900px 500px at 110% 120%, #10281f 0%, transparent 55%),
        var(--bg);
}

/* ----- App shell --------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ----- Sidebar ----------------------------------------------------------- */
.sidebar {
    flex: 0 0 236px;
    width: 236px;
    align-self: flex-start;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: rgba(12, 18, 30, 0.72);
    backdrop-filter: blur(8px);
    overflow: hidden;
}
.sidebar__brand {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
}
.sidebar__logo    { height: 22px; width: auto; align-self: flex-start; }
.sidebar__product { font-size: 12px; color: var(--text-dim); letter-spacing: .4px; }

.sidebar__nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 12px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 9px;
    border: 1px solid transparent;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
.nav-item .ic { width: 19px; height: 19px; flex: 0 0 auto; }
.nav-item__label { flex: 1; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.is-active {
    background: linear-gradient(90deg, rgba(61, 139, 255, .18), rgba(61, 139, 255, .04));
    border-color: rgba(61, 139, 255, .35);
    color: var(--text);
}
.nav-item.is-active .ic { color: var(--accent); }
.nav-item.is-soon { color: #5b6b8c; cursor: default; }
.nav-item.is-soon:hover { background: transparent; color: #5b6b8c; }
.nav-item__soon {
    font-size: 9px; text-transform: uppercase; letter-spacing: .5px;
    padding: 2px 7px; border-radius: 999px;
    border: 1px solid var(--border); color: var(--text-dim);
}
.nav-item__ext { margin-left: auto; font-size: 12px; color: var(--text-dim); }

/* intestazione di sezione nel menu (con separatore) */
.nav-head {
    margin: 16px 12px 4px;
    padding: 14px 12px 0;
    border-top: 1px solid var(--border);
    font-size: 10.5px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase;
    color: var(--text-dim);
}

.sidebar__foot {
    margin-top: auto;                  /* incollato in fondo alla sidebar */
    display: flex; align-items: center; gap: 8px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-dim);
}
.sidebar__user   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__logout { margin-left: auto; color: var(--text-dim); text-decoration: none; }
.sidebar__logout:hover { color: var(--text); }
.sidebar__dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--active); box-shadow: 0 0 8px var(--active);
    flex: 0 0 auto;
}

/* ----- Intestazione di pagina ------------------------------------------- */
.pagehead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(14, 20, 32, 0.5);
    backdrop-filter: blur(6px);
}
.pagehead__title { margin: 0; font-size: 20px; font-weight: 650; }
.pagehead__env {
    font-size: 12px; color: var(--text-dim);
    border: 1px solid var(--border); border-radius: 999px;
    padding: 4px 12px; text-transform: uppercase; letter-spacing: .6px;
}

/* ----- Stage (contenuto pagina) ----------------------------------------- */
.stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
    padding: 36px 24px 48px;
}
.stage__caption {
    max-width: 760px; margin: 0; text-align: center;
    color: var(--text-dim); font-size: 15px; line-height: 1.6;
}
.stage__caption strong { color: var(--text); }

/* ----- Riepilogo e legenda dello stato di integrazione ------------------ */
.summary { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.summary__chip {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 12.5px; color: var(--text-dim);
    padding: 5px 12px; border-radius: 999px;
    background: var(--panel); border: 1px solid var(--border);
}
.summary__chip b { color: var(--text); }
.summary__dot, .legend__dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--planned); flex: 0 0 auto;
}
.legend {
    display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;
    font-size: 12px; color: var(--text-dim);
}
.legend__item { display: inline-flex; align-items: center; gap: 7px; }

.summary__chip--integrated .summary__dot, .legend__item--integrated .legend__dot,
.summary__chip--file       .summary__dot, .legend__item--file       .legend__dot { background: var(--active); }
.summary__chip--public     .summary__dot, .legend__item--public     .legend__dot { background: var(--accent); }
.summary__chip--partner    .summary__dot, .legend__item--partner    .legend__dot { background: var(--partner); }
.summary__chip--request    .summary__dot, .legend__item--request    .legend__dot { background: var(--planned); }
.summary__chip--testing    .summary__dot, .legend__item--testing    .legend__dot { background: var(--testing); }
.summary__chip--notpos     .summary__dot, .legend__item--notpos     .legend__dot { background: var(--notpos); }
.legend__item--custom .legend__dot { background: var(--custom); }

/* ----- Contenitore del diagramma ---------------------------------------- */
.diagram-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 8px;
}
.diagram {
    position: relative;
    flex: 0 0 auto;   /* dimensioni fisse: coordinate condivise con l'SVG */
}

/* ----- Linee di collegamento (SVG) -------------------------------------- */
.wires {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}
.wire {
    fill: none;
    stroke: var(--planned);
    stroke-width: 1.8;
    stroke-linecap: round;
    opacity: .5;
    stroke-dasharray: 5 9;
    animation: flow 1.15s linear infinite;
}
/* varianti per stato di integrazione (API) */
.wire--request    { stroke: var(--planned); }
.wire--integrated,
.wire--file {
    stroke: var(--active);
    stroke-width: 2.6;
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(47, 214, 122, .55));
}
.wire--public  { stroke: var(--accent);  stroke-width: 2.4; opacity: .95; }
.wire--testing { stroke: var(--testing); stroke-width: 2.4; opacity: .95; }
.wire--partner { stroke: var(--partner); stroke-width: 2.2; opacity: .9; }
.wire--notpos  { stroke: var(--notpos);  stroke-dasharray: 2 7; opacity: .6; }
.wire--custom  { stroke: var(--custom);  stroke-dasharray: 2 7; opacity: .7; }
@keyframes flow { to { stroke-dashoffset: -14; } }

.wire-api {
    fill: none;
    stroke: url(#apiGrad);
    stroke-width: 3.4;
    stroke-linecap: round;
    stroke-dasharray: 7 8;
    animation: flow 0.9s linear infinite;
}
.wire-fb {
    fill: none;
    stroke: #f6a821;
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-dasharray: 7 8;
    animation: flow 0.9s linear infinite;
    filter: drop-shadow(0 0 4px rgba(246, 168, 33, .45));
}
.wire-fe {                            /* Ordinoo API ↕ Frontend Dashboard (viola) */
    fill: none;
    stroke: var(--custom);
    stroke-width: 3.2;
    stroke-linecap: round;
    stroke-dasharray: 7 8;
    animation: flow 0.9s linear infinite;
    filter: drop-shadow(0 0 4px rgba(168, 121, 255, .45));
}
.wire-api__pill { fill: rgba(16, 24, 40, .96); stroke: var(--border); stroke-width: 1; }
.wire-api__label {
    fill: var(--text);
    font-family: var(--font);
    font-size: 12px; font-weight: 700; letter-spacing: .6px;
}

/* ----- Nodi gestionali (icone server), senza raggruppamento ------------- */
.gnode {
    position: absolute;
    left: 0;
    width: 280px;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 11px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    z-index: 2;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
}

/* icona "server" (unità rack 1U) disegnata in CSS */
.node__icon {
    position: relative;
    flex: 0 0 auto;
    width: 42px; height: 26px;
    border-radius: 5px;
    background: linear-gradient(180deg, #2b3a5b, #1c2740);
    border: 1px solid #38496e;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.node__icon::before {          /* feritoie di aerazione */
    content: "";
    position: absolute; left: 7px; top: 6px;
    width: 15px; height: 2px; border-radius: 2px;
    background: #56688f;
    box-shadow: 0 4px 0 #56688f, 0 8px 0 #56688f;
}
.node__icon::after {           /* LED di stato */
    content: "";
    position: absolute; right: 7px; top: 9px;
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--planned);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .25);
}

.node__label { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.node__name  { font-size: 13.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node__vendor{ font-size: 11px; color: var(--text-dim); white-space: nowrap; }

.node__badge {
    flex: 0 0 auto;
    font-size: 10px; letter-spacing: .3px;
    padding: 3px 8px; border-radius: 999px;
    color: var(--text-dim);
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* varianti per stato di integrazione (API) */
.gnode--integrated, .gnode--file { border-color: rgba(47, 214, 122, .55); background: linear-gradient(180deg, rgba(47, 214, 122, .12), var(--panel-2)); }
.gnode--integrated .node__icon::after, .gnode--file .node__icon::after { background: var(--active); box-shadow: 0 0 8px var(--active); }
.gnode--integrated .node__badge, .gnode--file .node__badge { color: #061019; background: var(--active); border-color: transparent; font-weight: 600; }

.gnode--public { border-color: rgba(61, 139, 255, .5); }
.gnode--public .node__icon::after { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.gnode--public .node__badge { color: #06131f; background: var(--accent); border-color: transparent; font-weight: 600; }

.gnode--testing { border-color: rgba(245, 197, 24, .5); }
.gnode--testing .node__icon::after { background: var(--testing); box-shadow: 0 0 8px var(--testing); }
.gnode--testing .node__badge { color: #1c1500; background: var(--testing); border-color: transparent; font-weight: 600; }

.gnode--partner .node__icon::after { background: var(--partner); box-shadow: 0 0 8px var(--partner); }
.gnode--partner .node__badge { color: var(--partner); border-color: rgba(224, 163, 62, .5); }

.gnode--request .node__badge { color: var(--text-dim); }

.gnode--notpos { border-color: rgba(229, 103, 90, .5); border-style: dashed; }
.gnode--notpos .node__icon::after { background: var(--notpos); box-shadow: 0 0 8px var(--notpos); }
.gnode--notpos .node__name { text-decoration: line-through; text-decoration-color: rgba(229, 103, 90, .6); }
.gnode--notpos .node__badge { color: var(--notpos); border-color: rgba(229, 103, 90, .5); }

.gnode--custom { border-style: dashed; }
.gnode--custom .node__icon::after { background: var(--custom); box-shadow: 0 0 8px var(--custom); }
.gnode--custom .node__badge { color: var(--custom); border-color: rgba(168, 121, 255, .5); }

/* ----- Database (cilindro) in puro CSS ---------------------------------- */
.db-slot {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 2;
}
.database {
    position: relative;
    width: 118px; height: 128px;
    --db: var(--accent);
}
.database--ordinoo   { --db: var(--ordinoo); }
.database--firestore { --db: #f6a821; }   /* ambra Firebase */

.database__body {
    position: absolute; inset: 18px 0 0 0;
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--db) 78%, #0b1220) 0%,
        color-mix(in srgb, var(--db) 45%, #0b1220) 100%);
    border: 2px solid color-mix(in srgb, var(--db) 85%, #fff 0%);
    border-top: none;
    border-radius: 0 0 59px 59px / 0 0 22px 22px;
}
.database__body::before,          /* due "dischi" intermedi */
.database__body::after {
    content: "";
    position: absolute; left: -2px; right: -2px;
    height: 20px;
    border: 2px solid color-mix(in srgb, var(--db) 85%, #0b1220);
    border-radius: 50%;
    opacity: .55;
}
.database__body::before { top: 24px; }
.database__body::after  { top: 56px; }

.database__disc {                 /* disco superiore (ellisse) */
    position: absolute; top: 0; left: 0; right: 0;
    height: 36px;
    background: color-mix(in srgb, var(--db) 92%, #fff 12%);
    border: 2px solid color-mix(in srgb, var(--db) 85%, #fff 0%);
    border-radius: 50%;
    box-shadow: 0 0 26px color-mix(in srgb, var(--db) 55%, transparent);
}

/* ----- Layer API (rettangolo) in puro CSS — Ordinoo API ----------------- */
.apilayer {
    position: relative;
    width: 118px; height: 112px;
    --db: var(--ordinoo);
    display: flex; flex-direction: column; justify-content: center; gap: 11px;
    padding: 0 15px;
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--db) 30%, #0b1220) 0%,
        color-mix(in srgb, var(--db) 15%, #0b1220) 100%);
    border: 2px solid color-mix(in srgb, var(--db) 85%, #fff 0%);
    border-radius: 13px;
    box-shadow: 0 0 26px color-mix(in srgb, var(--db) 30%, transparent),
                inset 0 1px 0 rgba(255, 255, 255, .08);
}
.apilayer__row {          /* "endpoint" impilati = layer API */
    height: 13px; border-radius: 4px;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--db) 72%, #0b1220),
        color-mix(in srgb, var(--db) 44%, #0b1220));
    border: 1px solid color-mix(in srgb, var(--db) 80%, #fff 0%);
}

/* ----- Frontend Dashboard (blocco UI) in puro CSS ----------------------- */
.frontend {
    position: relative;
    --db: var(--custom);              /* viola */
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--db) 26%, #0b1220) 0%,
        color-mix(in srgb, var(--db) 13%, #0b1220) 100%);
    border: 2px solid color-mix(in srgb, var(--db) 85%, #fff 0%);
    border-radius: 12px;
    box-shadow: 0 0 26px color-mix(in srgb, var(--db) 28%, transparent),
                inset 0 1px 0 rgba(255, 255, 255, .07);
    overflow: hidden;
}
.frontend__bar {                      /* barra "finestra" con 3 pallini */
    position: absolute; top: 0; left: 0; right: 0; height: 22px;
    background: color-mix(in srgb, var(--db) 42%, #0b1220);
    border-bottom: 1px solid color-mix(in srgb, var(--db) 65%, #0b1220);
}
.frontend__bar::before {
    content: ""; position: absolute; left: 10px; top: 8.5px;
    width: 5px; height: 5px; border-radius: 50%;
    background: rgba(255, 255, 255, .6);
    box-shadow: 9px 0 0 rgba(255, 255, 255, .38), 18px 0 0 rgba(255, 255, 255, .38);
}
.frontend__chart {                    /* mini grafico a barre = dashboard */
    position: absolute; left: 16px; right: 16px; top: 34px; bottom: 14px;
    display: flex; align-items: flex-end; gap: 9px;
}
.frontend__chart i {
    flex: 1; border-radius: 3px 3px 0 0;
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--db) 78%, #fff 0%),
        color-mix(in srgb, var(--db) 42%, #0b1220));
}
.frontend__chart i:nth-child(1) { height: 52%; }
.frontend__chart i:nth-child(2) { height: 84%; }
.frontend__chart i:nth-child(3) { height: 38%; }
.frontend__chart i:nth-child(4) { height: 66%; }

.db-caption {
    position: absolute;
    transform: translateX(-50%);
    text-align: center;
    z-index: 2;
    display: flex; flex-direction: column; gap: 2px;
    white-space: nowrap;
}
/* ancorata dal basso: la didascalia sta SOPRA il nodo (sotto passano le frecce) */
.db-caption--above { transform: translate(-50%, -100%); }
.db-caption b    { font-size: 15px; font-weight: 650; }
.db-caption span { font-size: 12px; color: var(--text-dim); }

/* ----- Footer ------------------------------------------------------------ */
.footer {
    position: relative;
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-dim);
    font-size: 12.5px;
}
.footer__version {
    position: absolute; right: 24px; top: 50%; transform: translateY(-50%);
    font-size: 11.5px; font-weight: 600; letter-spacing: .3px;
    color: var(--text-dim); opacity: .85;
}

/* ----- Pagine con pannello / datatable ---------------------------------- */
.stage--plain { align-items: stretch; }

.panel {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel__title { margin: 0; font-size: 18px; font-weight: 650; }
.panel__sub { margin: 4px 0 0; font-size: 13px; color: var(--text-dim); }
.counter { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; }

.backlink { color: var(--text-dim); text-decoration: none; font-size: 13px; align-self: flex-start; }
.backlink:hover { color: var(--text); }

.notice {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text-dim);
    font-size: 14px; line-height: 1.55;
}
.notice strong { color: var(--text); }
.notice code { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--text); }

.flash { padding: 11px 15px; border-radius: 9px; font-size: 13.5px; border: 1px solid transparent; }
.flash--ok    { background: rgba(47, 214, 122, .12); border-color: rgba(47, 214, 122, .4); color: #b8f3d4; }
.flash--error { background: rgba(255, 90, 90, .12);  border-color: rgba(255, 90, 90, .4);  color: #ffc4c4; }

/* ----- Datatable --------------------------------------------------------- */
.table-wrap {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--panel);
}
.dtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.dtable thead th {
    text-align: left;
    font-size: 11.5px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
    color: var(--text-dim);
    padding: 12px 16px;
    background: rgba(255, 255, 255, .02);
    border-bottom: 1px solid var(--border);
}
.dtable tbody td { padding: 13px 16px; border-bottom: 1px solid rgba(44, 60, 95, .5); vertical-align: middle; }
.dtable tbody tr:last-child td { border-bottom: none; }
.dtable tbody tr:hover { background: rgba(255, 255, 255, .015); }
.dtable tr.is-editing:hover { background: transparent; }
.ta-center { text-align: center; }
.ta-right  { text-align: right; }
.empty { color: var(--text-dim); text-align: center; padding: 22px 16px; }

.cdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 9px; background: var(--planned); vertical-align: middle; }
.cdot--active { background: var(--active); box-shadow: 0 0 7px var(--active); }
.cdot--custom { background: var(--custom); }
.cname { font-weight: 550; }
/* Casella dedicata dell'istanza, sotto il nome del cliente (instances.php) */
.cmail { margin-top: 3px; font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cmail .mono { font-size: 11.5px; color: var(--text-dim); }
.cvendor { color: var(--text-dim); font-size: 12px; margin-left: 8px; }

.endpoint, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--text); }
.muted { color: var(--text-dim); }

.chip {
    display: inline-block; text-decoration: none;
    font-size: 12px; color: var(--text-dim);
    padding: 4px 11px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--panel-2);
}
.chip:hover { color: var(--text); border-color: var(--accent); }

.badge { display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-dim); }
.badge--active  { color: #061019; background: var(--active); border-color: transparent; font-weight: 600; }
.badge--custom  { color: var(--custom); border-color: rgba(168, 121, 255, .5); }
.badge--error   { color: #ffc4c4; border-color: rgba(229, 72, 77, .55); background: rgba(229, 72, 77, .12); }

.confirm { color: #ffc4c4; font-size: 13px; margin-right: 8px; }

/* ----- Scheda anagrafica (dettaglio chiave) ------------------------------ */
.card {
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--panel); padding: 16px 18px;
}
.card__title { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
.subhead { margin: 6px 0 -6px; font-size: 14px; font-weight: 600; }
.dl {
    display: grid; margin: 0;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px 26px;
}
.dl dt, .dl dd { margin: 0; }
.dl__k { font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase; color: var(--text-dim); }
.dl__v { font-size: 13.5px; margin-top: 4px; word-break: break-word; }

/* ----- Bottoni ----------------------------------------------------------- */
.btn {
    display: inline-block;
    font-size: 13px; font-weight: 550; line-height: 1;
    padding: 8px 14px; border-radius: 8px;
    text-decoration: none; cursor: pointer;
    border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
}
.btn:hover { border-color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #07172e; font-weight: 600; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; color: var(--text-dim); }
.btn--ghost:hover { color: var(--text); }
.btn--danger { background: #e5484d; border-color: #e5484d; color: #fff; font-weight: 600; }
/* Azione annunciata ma non ancora cablata: si vede, non si preme. */
.btn.is-disabled { opacity: .45; cursor: not-allowed; }
.btn.is-disabled:hover { border-color: var(--border); }
.inline { display: inline; }
.dtable .btn + .btn, .confirm + .inline, .inline + .btn { margin-left: 6px; }
.dtable .btn + .inline, .dtable .inline + .inline { margin-left: 6px; }

/* ----- Form (inline edit / add) ----------------------------------------- */
.editform, .addform__row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.editform { padding: 4px 0; }
.addform {
    border: 1px solid var(--border); border-radius: 12px;
    background: var(--panel); padding: 16px 18px;
}
.addform__title { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim); }
.field--grow { flex: 1 1 240px; min-width: 200px; }
.field span { letter-spacing: .2px; }
.field input {
    background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: 13.5px; padding: 8px 11px; min-width: 160px;
    font-family: inherit;
}
.field input:focus { outline: none; border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-dim); padding-bottom: 8px; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.editform__actions { display: flex; gap: 8px; padding-bottom: 1px; }

/* ----- Responsive: sidebar solo icone ----------------------------------- */
@media (max-width: 820px) {
    .sidebar { flex-basis: 62px; width: 62px; }
    .sidebar__brand { align-items: center; padding: 18px 0; }
    .sidebar__logo,
    .sidebar__product,
    .nav-item__label,
    .nav-item__soon,
    .nav-item__ext,
    .nav-head,
    .sidebar__foot span { display: none; }
    .nav-item { justify-content: center; gap: 0; padding: 10px 0; }
    .sidebar__foot { justify-content: center; }
    .pagehead { padding: 16px 18px; }
}

/* ----- Caricamento file (carica.php) ------------------------------------- */
.panel__head-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.uploadform { margin-top: 4px; }
.uploadzone {
    position: relative; margin: 4px 0 14px;
    border: 1.5px dashed var(--border); border-radius: 12px;
    background: var(--bg-soft); padding: 22px 18px; text-align: center;
    transition: border-color .15s, background .15s;
}
.uploadzone:hover, .uploadzone:focus-within { border-color: var(--accent); background: var(--panel-2); }
.uploadzone input[type="file"] {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}
.uploadzone__hint { display: block; font-size: 13px; color: var(--text-dim); pointer-events: none; }
.uploadzone input[type="file"]:focus-visible + .uploadzone__hint { color: var(--text); }
.uploadform__actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ----- Mappatura POS → Ordinoo (mappatura.php) --------------------------- */
.mapbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.mapbar__info { font-size: 13px; color: var(--text-dim); }
.mapbar__actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.tabs2 { display: flex; gap: 4px; margin: 16px 0 10px; }
.tabs2 a {
    font-size: 13px; padding: 7px 14px; border-radius: 8px; text-decoration: none;
    color: var(--text-dim); border: 1px solid transparent;
}
.tabs2 a.on { color: var(--text); background: var(--panel-2); border-color: var(--border); }
.maptable td { vertical-align: middle; }
.mapsel {
    width: 100%; max-width: 520px;
    background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: 13px; padding: 7px 10px;
}
.mapsel:focus { outline: none; border-color: var(--accent); }

/* ----- Pannello clienti (clienti.php) ------------------------------------ */
.mapmini {
    display: inline-block; width: 92px; height: 6px; border-radius: 3px;
    background: var(--panel-2); overflow: hidden; vertical-align: middle; margin-right: 6px;
}
.mapmini span { display: block; height: 100%; background: var(--active); }


/* ----- Documentazione API (api.php) -------------------------------------- */
.doc-toc { display: flex; flex-wrap: wrap; gap: 8px; }

.doc-h {
    margin: 26px 0 -2px;
    font-size: 15px; font-weight: 600; letter-spacing: .2px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    scroll-margin-top: 20px;
}
.doc-h:first-of-type { margin-top: 14px; }

.doc-p { margin: 0; font-size: 13.5px; line-height: 1.65; color: var(--text-dim); }
.doc-p strong, .doc-p em { color: var(--text); }
.doc-p em { font-style: normal; font-weight: 550; }
.doc-p code, .dtable code, .card code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--text); }

.doc-link { color: var(--accent); text-decoration: none; }
.doc-link:hover { text-decoration: underline; }

/* Intestazione endpoint: pillola metodo + path */
.doc-ep {
    display: flex; align-items: center; flex-wrap: wrap; gap: 11px;
    padding: 13px 16px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--panel);
}
.doc-method {
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 11px; font-weight: 700; letter-spacing: .6px;
    padding: 4px 9px; border-radius: 6px; color: #061019;
}
.doc-method--get  { background: var(--active); }
.doc-method--post { background: var(--accent); }
.doc-ep__path { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; font-weight: 550; }
.doc-ep__desc { color: var(--text-dim); font-size: 13px; }

/* Blocchi di codice */
.doc-code {
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-soft); overflow: hidden;
}
.doc-code__label {
    padding: 8px 14px;
    font-size: 11px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
    color: var(--text-dim);
    background: rgba(255, 255, 255, .02);
    border-bottom: 1px solid var(--border);
}
.doc-code pre {
    margin: 0; padding: 14px 16px;
    max-height: 420px; overflow: auto;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 12.5px; line-height: 1.6; color: var(--text);
    white-space: pre; tab-size: 2;
}

/* ----- Avviso "installazione non completata" (partials/layout_top.php) ---- */
.setupbar {
    margin: 0; padding: 13px 24px;
    background: rgba(245, 197, 24, .12);
    border-bottom: 1px solid rgba(245, 197, 24, .45);
    color: #f7e6a8; font-size: 13.5px;
}
.setupbar strong { color: #fff6d5; }
.setupbar a { color: #fff; font-weight: 600; text-decoration: none; margin-left: 6px; }
.setupbar a:hover { text-decoration: underline; }

/* ----- Accesso (login.php) ----------------------------------------------- */
.loginpage { display: flex; align-items: center; justify-content: center; padding: 24px; }
.login {
    width: 100%; max-width: 380px;
    display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.login__brand { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.login__logo    { height: 26px; width: auto; }
.login__product { font-size: 12px; color: var(--text-dim); letter-spacing: .4px; }
.login__card {
    width: 100%;
    display: flex; flex-direction: column; gap: 14px;
    padding: 26px 24px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
}
.login__title { margin: 0; font-size: 19px; letter-spacing: -.2px; }
.login__sub   { margin: -8px 0 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.login__submit { margin-top: 6px; padding: 11px 14px; font-size: 14px; }
.login__foot  { margin: 0; font-size: 11.5px; color: var(--text-dim); letter-spacing: .3px; }

/* --- Server Status (stato.php): CPU, memoria, disco ----------------------- */
.srv {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.srv__box {
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg-soft); padding: 13px 14px;
}
.srv__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.srv__title { font-size: 12.5px; font-weight: 600; color: var(--text-dim); letter-spacing: .3px; text-transform: uppercase; }
.srv__pct { font-size: 21px; font-weight: 600; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.srv__pct--ok   { color: var(--active); }
.srv__pct--warn { color: var(--testing); }
.srv__pct--ko   { color: var(--notpos); }

/* Barra d'uso: fondo neutro, riempimento colorato come la percentuale. */
.meter {
    margin: 9px 0 12px; height: 6px; border-radius: 999px;
    background: var(--panel-2); overflow: hidden;
}
.meter__fill { display: block; height: 100%; border-radius: 999px; transition: width .3s ease; }
.meter__fill--ok   { background: var(--active); }
.meter__fill--warn { background: var(--testing); }
.meter__fill--ko   { background: var(--notpos); }

.srv__dl { display: grid; gap: 5px; margin: 0; font-size: 12.5px; }
.srv__dl > div { display: flex; justify-content: space-between; gap: 12px; }
.srv__dl dt { margin: 0; color: var(--text-dim); }
.srv__dl dd {
    margin: 0; text-align: right; font-variant-numeric: tabular-nums;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 62%;
}

/* ============================================================
   Casella email (casella.php): elenco in stile client di posta
   ============================================================ */

.mail {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-soft);
    overflow: hidden;
}
.mail__row {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 13px 16px;
    border-bottom: 1px solid rgba(44, 60, 95, .5);
}
.mail__row:last-child { border-bottom: none; }
.mail__row:hover { background: rgba(255, 255, 255, .015); }
.mail__row--orphan { box-shadow: inset 3px 0 0 #e6a23c; }
.mail__row--bounce { box-shadow: inset 3px 0 0 #e5484d; }

.mail__avatar {
    flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 650; color: #eaf1ff;
    background: hsl(var(--h, 215), 40%, 32%);
    user-select: none;
}

.mail__main { flex: 1 1 auto; min-width: 0; }
.mail__line1 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mail__from { font-size: 14px; font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.mail__addr { font-size: 12px; color: var(--text-dim); overflow-wrap: anywhere; }
.mail__date { margin-left: auto; font-size: 12px; color: var(--text-dim); white-space: nowrap; }

.mail__subject {
    margin-top: 2px; font-size: 13.5px; color: var(--text);
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    overflow-wrap: anywhere;
}
.mail__row--unread .mail__from,
.mail__row--unread .mail__subject { font-weight: 650; }
.mail__row--unread .mail__subject::before {
    content: ""; flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent);
}

.mail__state { margin-top: 3px; font-size: 12px; color: var(--text-dim); }

.mail__atts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.att {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; padding: 3px 10px; border-radius: 999px;
    border: 1px solid var(--border); color: var(--text-dim);
    font-family: ui-monospace, Menlo, Consolas, monospace;
    max-width: 100%; overflow-wrap: anywhere;
}
.att--ok { border-color: rgba(47, 214, 122, .45); color: #b8f3d4; }
.att--no { opacity: .7; }
.att__size { font-family: inherit; opacity: .75; }
.att__clip {
    /* graffetta disegnata in CSS: mezza pillola ruotata */
    flex: 0 0 auto; width: 6px; height: 11px;
    border: 1.5px solid currentColor; border-top: none;
    border-radius: 0 0 5px 5px;
    transform: rotate(-40deg); margin-top: -2px;
}

.mail__more { margin-top: 6px; font-size: 12.5px; }
.mail__more summary { cursor: pointer; color: var(--text-dim); }
.mail__more summary:hover { color: var(--text); }
.mail__moretext { margin-top: 4px; color: var(--text-dim); overflow-wrap: anywhere; }

.mail__side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.btn--sm { padding: 5px 12px; font-size: 12.5px; }

@media (max-width: 640px) {
    .mail__row { flex-wrap: wrap; }
    .mail__side { flex-direction: row; margin-left: 46px; }
}

/* Allegati scaricabili: il chip è un link */
a.att { text-decoration: none; cursor: pointer; }
a.att:hover { border-color: var(--accent); color: var(--text); }
a.att--ok:hover { color: #d9fbe8; }

/* Modal «apri email» (casella.php) */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal__back { position: absolute; inset: 0; background: rgba(5, 9, 16, .72); }
.modal__panel {
    position: relative; width: min(880px, calc(100vw - 32px)); height: min(82vh, 720px);
    display: flex; flex-direction: column;
    background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .5); overflow: hidden;
}
.modal__bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.modal__title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal__frame { flex: 1 1 auto; width: 100%; border: 0; background: #0e1420; }

/* Mittenti da intercettare (pannello istanze in casella.php) */
.senders { max-width: 340px; }
.senders__chip {
    display: inline-flex; align-items: center; gap: 5px;
    border: 1px solid var(--border); border-radius: 999px;
    padding: 2px 6px 2px 10px; margin: 0 4px 6px 0; font-size: 12px;
}
.senders__chip code { font-size: 11.5px; }
.senders__x {
    border: 0; background: transparent; color: var(--text-dim);
    font-size: 14px; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 50%;
}
.senders__x:hover { color: #ffc4c4; }
.senders__add { display: flex; gap: 6px; align-items: center; margin-top: 2px; }
.senders__input {
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    padding: 5px 9px; font-size: 12.5px; width: 180px;
}
.senders__input:focus { outline: none; border-color: var(--accent); }

/* ----- Account SMTP (smtp.php) -------------------------------------------
   Il riquadro dei parametri è fatto per essere LETTO AD ALTA VOCE al telefono:
   valori grandi e monospaziati, non un elenco di campi qualunque. */
.smtp-params { margin-top: 4px; }
.smtp-big {
    font-size: 15px; font-weight: 600; letter-spacing: .2px;
    display: inline-block; padding: 3px 9px; border-radius: 7px;
    background: var(--bg-soft); border: 1px solid var(--border);
    user-select: all;                      /* un clic seleziona tutto il valore */
}
.smtp-note { margin: 12px 0 0; font-size: 12.5px; line-height: 1.6; }
.smtp-note strong, .smtp-note em { color: var(--text); }
.smtp-note em { font-style: normal; font-weight: 550; }

.smtp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.smtp-edit { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }

.smtp-filtri { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.smtp-cerca { display: flex; gap: 8px; align-items: flex-end; margin-left: auto; }

/* Transcript della sessione: dialogo SMTP per intero, a capo conservati.
   È lo strumento con cui si capisce DOVE si è rotto un invio. */
.smtp-transcript { margin-top: 6px; }
.smtp-transcript pre { max-height: 320px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ─── Riconciliazione DDT: integrazioni allo stile SI ─────────────────────── */
.loginwrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.logincard { width: 100%; max-width: 380px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.field input, .field select {
    width: 100%; box-sizing: border-box; padding: 9px 12px; border-radius: 8px;
    border: 1px solid var(--border); background: rgba(255,255,255,.04); color: var(--text);
    font: inherit;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }
.form-error { color: #ffc4c4; font-size: 13px; }
.form-note { color: var(--text-dim); font-size: 12px; }
.appfoot { padding: 18px 28px; color: var(--text-dim); font-size: 12px; border-top: 1px solid var(--border); }
.kv { display: grid; grid-template-columns: 220px 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; }
.badge--ok { color: #0a1f12; background: #46c878; border-color: transparent; font-weight: 600; }
.badge--warn { color: #ffdf9e; border-color: rgba(255, 190, 80, .5); background: rgba(255, 190, 80, .12); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.loglines { font: 12px/1.55 ui-monospace, monospace; white-space: pre-wrap; word-break: break-word;
    background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: 8px; padding: 12px; max-height: 420px; overflow: auto; }
.tnum { font-variant-numeric: tabular-nums; }

/* ─── Overview: mappa del flusso + funnel esiti ───────────────────────────── */
.flowhead { display:flex; align-items:baseline; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:4px; }
.stat .n .pct { font-size: 0.9rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.flowmap { display:flex; align-items:stretch; gap:6px; overflow-x:auto; padding:6px 2px 10px; }
.flownode { flex:1 1 0; min-width:118px; background:var(--bg-soft); border:1px solid var(--border);
    border-radius:10px; padding:10px 11px; position:relative; }
.flownode__t { font-size:0.82rem; font-weight:600; color:var(--text); }
.flownode__d { font-size:0.70rem; color:var(--text-dim); margin-top:3px; line-height:1.35; }
.flownode__n { position:absolute; top:8px; right:9px; font-family:ui-monospace,monospace; font-size:0.74rem;
    font-variant-numeric:tabular-nums; color:#07172e; background:var(--ordinoo); border-radius:999px;
    padding:1px 7px; font-weight:700; }
.flowarrow { align-self:center; color:var(--text-dim); font-size:0.9rem; flex:0 0 auto; }
.flowbar__title { font-size:0.78rem; color:var(--text-dim); margin:0 0 7px; letter-spacing:.02em; }
.flowbar { display:flex; height:26px; border-radius:7px; overflow:hidden; background:var(--bg-soft);
    border:1px solid var(--border); }
.flowbar__empty { color:var(--text-dim); font-size:0.76rem; padding:5px 10px; }
.flowseg { display:flex; align-items:center; justify-content:center; min-width:2px; transition:width .3s; }
.flowseg span { font-size:0.72rem; font-weight:700; color:#07172e; font-variant-numeric:tabular-nums; }
.flowlegend { display:flex; flex-wrap:wrap; gap:4px 14px; margin-top:9px; }
.flowlegend .lg { font-size:0.74rem; color:var(--text-dim); display:inline-flex; align-items:center; gap:6px; }
.flowlegend .lg b { color:var(--text); font-variant-numeric:tabular-nums; }
.dot { width:9px; height:9px; border-radius:2px; display:inline-block; }
.seg-ok    { background:var(--ordinoo); }
.seg-info  { background:var(--custom); }
.seg-warn  { background:var(--partner); }
.seg-alert { background:var(--notpos); }
.seg-muted { background:var(--planned); }

/* stat tiles (riusate in Overview) */
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; }
.stat { background:var(--bg-soft); border:1px solid var(--border); border-radius:10px; padding:12px 14px; }
.stat .n { font-size:1.7rem; font-weight:600; font-variant-numeric:tabular-nums; line-height:1.1; color:var(--text); }
.stat .l { font-size:0.76rem; color:var(--text-dim); margin-top:4px; line-height:1.35; }

/* ─── Card full width (richiesta CEO 05/09) ───────────────────────────────── */
.stage { align-items: stretch; }
.stage > .card, .stage > .grid2, .stage > form, .stage > div { width: 100%; box-sizing: border-box; }
.grid2 { grid-template-columns: 1fr; }   /* card impilate, ciascuna a tutta larghezza */
.card { width: 100%; box-sizing: border-box; }

/* ─── Tabelle: stile base (le pagine usano <table> semplice) + DataTables ──── */
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-wrap thead th {
    text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
    color: var(--text-dim); padding: 11px 14px; background: rgba(255,255,255,.02);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table-wrap tbody td { padding: 11px 14px; border-bottom: 1px solid rgba(44,60,95,.5); vertical-align: middle; }
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover td { background: rgba(255,255,255,.015); }
.table-wrap td .dim, .dim { color: var(--text-dim); }

/* Contenitore che ospita una tabella DataTables: niente clip, un po' d'aria */
.table-wrap:has(table.dt) { overflow: visible; padding: 12px 14px; }

/* DataTables 2.x — tema scuro coerente col pannello */
.dt-container { color: var(--text); font-size: 13px; }
.dt-container .dt-length, .dt-container .dt-info, .dt-container .dt-search { color: var(--text-dim); font-size: 12.5px; margin: 6px 0; }
.dt-container .dt-search input, .dt-container .dt-length select {
    background: var(--bg-soft); color: var(--text); border: 1px solid var(--border);
    border-radius: 8px; padding: 6px 10px; margin-left: 6px; font: inherit;
}
.dt-container .dt-search input::placeholder { color: var(--text-dim); }
.dt-container .dt-search input:focus, .dt-container .dt-length select:focus { outline: none; border-color: var(--accent); }
table.dataTable thead th { cursor: pointer; }
table.dataTable thead th.dt-orderable-asc:hover, table.dataTable thead th.dt-orderable-desc:hover { color: var(--text); }
.dt-container .dt-paging { margin-top: 10px; }
.dt-container .dt-paging .dt-paging-button {
    color: var(--text-dim) !important; border: 1px solid var(--border) !important; border-radius: 8px;
    margin: 0 2px; padding: 5px 11px !important; background: var(--bg-soft);
}
.dt-container .dt-paging .dt-paging-button.current {
    color: #07172e !important; background: var(--accent); border-color: var(--accent) !important; font-weight: 600;
}
.dt-container .dt-paging .dt-paging-button:hover:not(.disabled) { border-color: var(--accent) !important; color: var(--text) !important; }
.dt-container .dt-paging .dt-paging-button.disabled { opacity: .4; }

/* ─── Modal (opzioni run riconciliazione) ─────────────────────────────────── */
.rd-modal-backdrop {
    display: none; position: fixed; inset: 0; z-index: 200;
    background: rgba(3, 8, 16, .6); backdrop-filter: blur(2px);
    align-items: flex-start; justify-content: center; padding: 8vh 20px 20px;
}
.rd-modal-backdrop.is-open { display: flex; }
.rd-modal {
    background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
    width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.rd-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.rd-modal__head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.rd-modal__close { background: none; border: none; color: var(--text-dim); font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; }
.rd-modal__close:hover { color: var(--text); }
.rd-modal__body { padding: 18px; }
.rd-modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }

/* ─── Tabelle: leggibilità (sfondo, zebra, hover evidenziato) ──────────────── */
.table-wrap thead th, table.dataTable thead th {
    background: #202d47 !important; color: var(--text) !important; border-bottom: 1px solid var(--border) !important;
}
.table-wrap tbody td, table.dataTable tbody td { background: transparent; border-bottom-color: rgba(255,255,255,.06) !important; color: var(--text); }
.table-wrap tbody tr:nth-child(even) td, table.dataTable tbody tr:nth-child(even) > td { background: rgba(255,255,255,.035); }
.table-wrap tbody tr:hover td, table.dataTable tbody tr:hover > td {
    background: rgba(61,139,255,.20) !important; color: var(--text) !important;
}
table.dataTable tbody tr, .table-wrap tbody tr { transition: background-color .12s ease; }

/* ─── Link testuali nel contenuto ──────────────────────────────────────────── */
/* Solo le ancore SENZA classe (es. «Sincronizza» nelle note): i link con
   classe (.btn, .nav-item, .doc-link, a.att…) mantengono il proprio colore.
   Prima queste cadevano sul viola di default del browser, illeggibile sul
   tema scuro. */
a:not([class]) { color: var(--accent); text-decoration: none; }
a:not([class]):hover { text-decoration: underline; }

/* ─── Tooltip (contatore + ⓘ, es. «DDT associati») ────────────────────────── */
/* Il box viene creato dal JS globale in position:fixed sul body, così non è
   ritagliato dall'overflow della .table-wrap né dalla paginazione DataTables. */
.tip { display: inline-flex; align-items: center; gap: 6px; cursor: default; }
.tip__ic {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    border: 1px solid var(--border); color: var(--text-dim);
    font: italic 700 10px/1 Georgia, "Times New Roman", serif; cursor: help; user-select: none;
}
.tip:hover .tip__ic { border-color: var(--accent); color: var(--accent); }
.tipbox {
    position: fixed; z-index: 10000; max-width: 380px;
    background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
    font-size: 12px; color: var(--text); pointer-events: none;
}
.tipbox__title { font-weight: 600; margin-bottom: 6px; }
.tipbox__t { border-collapse: collapse; width: 100%; }
.tipbox__t th, .tipbox__t td { padding: 3px 8px; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, .07); font-size: 12px; white-space: nowrap; }
.tipbox__t th { color: var(--text-dim); font-weight: 600; }
.tipbox__t .ta-right { text-align: right; }
.tipbox__more { color: var(--text-dim); margin-top: 5px; }

/* ─── Tessere di sintesi: varianti colore del numero ───────────────────────── */
.stat--ok .n { color: #46c878; }
.stat--warn .n { color: #ffbe50; }
.stat--error .n { color: #ff6b6b; }

/* ─── Barra di avanzamento di una run in background ───────────────────────── */
.runbar {
    background: var(--bg-soft); border: 1px solid rgba(61, 139, 255, .35);
    border-radius: 10px; padding: 12px 14px; margin: 0 0 14px;
}
.runbar__head { font-size: 13px; margin-bottom: 8px; }
.runbar__track { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.runbar__fill {
    height: 100%; border-radius: 999px; background: var(--accent);
    transition: width .4s ease; animation: rd-pulse 1.6s ease-in-out infinite;
}
@keyframes rd-pulse { 50% { opacity: .65; } }

/* ─── Tabelle larghe: intestazioni a capo e scroll contenuto ──────────────── */
/* Le intestazioni erano `nowrap`: una colonna con nome lungo (es. «DDT
   Associati nel motore Riconciliazione v2») allargava la tabella oltre la card
   e, con overflow visible, a scorrere in orizzontale era l'INTERA pagina.
   Ora l'intestazione va a capo e l'eventuale eccedenza scorre dentro la card.
   L'overflow visible non serve più: il tooltip è position:fixed sul body. */
.table-wrap thead th { white-space: normal; }
.table-wrap:has(table.dt) { overflow-x: auto; }

/* ─── Visualizzatore della scansione DDT ──────────────────────────────────── */
.rd-modal--wide { max-width: min(1100px, 94vw); }
.rd-imgbox { display: flex; justify-content: center; max-height: 78vh; overflow: auto; padding: 10px; }
.rd-imgbox img { max-width: 100%; height: auto; border-radius: 8px; background: #fff; }

/* ─── Schede a due colonne (dettaglio fattura) ────────────────────────────── */
/* Le coppie etichetta/valore stavano su una colonna sola: a card piena
   larghezza restava metà scheda vuota. Su schermi larghi le coppie si
   dispongono a due a due (dt, dd, dt, dd si auto-posizionano nella griglia);
   `.kv-wide` tiene un valore lungo su tutta la riga. */
@media (min-width: 980px) {
    .kv--2 { grid-template-columns: 158px minmax(190px, 1fr) 158px minmax(190px, 1fr); column-gap: 30px; }
    .kv--2 dd.kv-wide { grid-column: 2 / -1; }
}
.kv dd .badge { vertical-align: baseline; }
/* Le coppie a tutta riga devono partire dalla prima colonna: senza questo
   l'etichetta finisce in colonna 3 e il valore, dovendo iniziare in colonna 2,
   va a capo lasciando un buco accanto all'etichetta. */
@media (min-width: 980px) { .kv--2 dt.kv-k { grid-column: 1; } }

/* ─── Confronto righe fattura ↔ bolla ─────────────────────────────────────── */
/* Bordo colorato a sinistra: si vede a colpo d'occhio dove sono le differenze
   anche scorrendo la tabella, senza leggere la colonna «Esito». */
.rd-cmp--inv  td:first-child { box-shadow: inset 3px 0 0 rgba(229, 72, 77, .8); }
.rd-cmp--ddt  td:first-child { box-shadow: inset 3px 0 0 rgba(255, 190, 80, .8); }
.rd-cmp--diff td:first-child { box-shadow: inset 3px 0 0 rgba(255, 190, 80, .8); }
.rd-cmp--inv  td, .rd-cmp--ddt td, .rd-cmp--diff td { background: rgba(255, 190, 80, .05); }
.rd-cmp--inv  td { background: rgba(229, 72, 77, .06); }
.rd-cmp__warn { color: #ffdf9e; }
tfoot td { border-top: 1px solid var(--border); padding-top: 10px; }

/* ─── Percorso di navigazione ─────────────────────────────────────────────── */
.crumbs { font-size: 12px; color: var(--text-dim); margin-bottom: 3px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--text-dim); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs__sep { opacity: .5; }
.pagehead { align-items: flex-start; }
/* Percorso: un filo più leggibile del testo «dim» puro. */
.crumbs { font-size: 12.5px; color: #8fa3c6; }
.crumbs a { color: #8fa3c6; }
