/* ==========================================================================
   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; }
