/* ilmiocompleanno.cloud — stile aree Console, Manager e App (design "booking in cloud") */

:root {
    --blu: #0b3d91;
    --blu-vivo: #2f80ed;
    --blu-scuro: #082b66;
    --blu-chiaro: #eaf0fb;
    --grigio-bg: #f2f4f9;
    --grigio-bordo: #e2e7f0;
    --testo: #16213a;
    --testo-soft: #5b6577;
    --bianco: #ffffff;
    --verde: #0f9d58;
    --verde-bg: #e6f6ee;
    --rosso: #d93025;
    --rosso-bg: #fdecea;
    --giallo: #b06000;
    --giallo-bg: #fef3e0;
    --raggio: 14px;
    --ombra: 0 1px 2px rgba(16, 30, 54, .05), 0 8px 24px rgba(16, 30, 54, .06);
    --topbar-h: 68px;
    --sidebar-w: 264px;
    --side-bg-1: #0d2f6d;
    --side-bg-2: #071c44;
    --side-testo: rgba(233, 240, 255, .78);
    --side-muted: rgba(233, 240, 255, .42);
    --side-linea: rgba(255, 255, 255, .09);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--grigio-bg);
    color: var(--testo);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--blu); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--testo); }
code { background: #eef2f7; padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.muted { color: var(--testo-soft); }
.small { font-size: 13px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

.ico { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: -3px; }
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 26px; height: 26px; }

/* ---------- Layout ---------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(178deg, var(--side-bg-1), var(--side-bg-2) 70%);
    color: var(--side-testo);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 12px; height: var(--topbar-h); padding: 0 18px; border-bottom: 1px solid var(--side-linea); flex-shrink: 0; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; background: linear-gradient(150deg, #3f8cf3, #1a56c4); color: #fff; border-radius: 12px; box-shadow: 0 6px 16px rgba(3, 12, 32, .45), inset 0 1px 0 rgba(255, 255, 255, .25); flex-shrink: 0; font-size: 19px; }
.brand-mark .ico { width: 21px; height: 21px; }
.brand-testo { display: flex; flex-direction: column; line-height: 1.15; }
/* Colori di default per sfondi chiari (topbar App invitati); la sidebar scura li ridefinisce */
.brand-name { font-weight: 800; font-size: 16px; color: var(--testo); letter-spacing: -.2px; }
.brand-name span { color: var(--blu-vivo); }
.brand-sub { font-size: 10.5px; font-weight: 800; letter-spacing: 2px; color: var(--testo-soft); }
.sidebar .brand-name { color: #fff; }
.sidebar .brand-name span { color: #7db3ff; }
.sidebar .brand-sub { color: var(--side-muted); }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .22) transparent; }
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
.nav-gruppo { font-size: 10.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--side-muted); padding: 18px 12px 7px; }
.nav-gruppo:first-child { padding-top: 6px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--side-testo);
    padding: 10px 12px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14.5px;
    position: relative;
    transition: background .15s ease, color .15s ease;
}
.nav-link .ico { color: rgba(233, 240, 255, .5); transition: color .15s ease; }
.nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-link:hover .ico { color: rgba(233, 240, 255, .85); }
.nav-link.attivo {
    background: linear-gradient(90deg, rgba(63, 140, 243, .32), rgba(63, 140, 243, .10));
    color: #fff;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(125, 179, 255, .22);
}
.nav-link.attivo::before {
    content: "";
    position: absolute;
    left: -14px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, #7db3ff, #3f8cf3);
}
.nav-link.attivo .ico { color: #8ebcff; }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--side-linea); background: rgba(0, 0, 0, .18); }
.sidebar-user .avatar { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(150deg, #3f8cf3, #1a56c4); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; flex-shrink: 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25); }
.su-info { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; flex: 1; }
.su-nome { font-weight: 700; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-ruolo { font-size: 10.5px; color: var(--side-muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 800; }
.sidebar .btn-icon { color: var(--side-muted); }
.sidebar .btn-icon:hover { background: rgba(255, 255, 255, .1); color: #fff; border-color: transparent; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--grigio-bordo);
    padding: 0 26px;
    height: var(--topbar-h);
    position: sticky;
    top: 0;
    z-index: 20;
    flex-shrink: 0;
}
.topbar-title { font-size: 18.5px; margin: 0; flex: 1; font-weight: 750; letter-spacing: -.3px; display: flex; align-items: center; min-width: 0; }
.topbar-title::before {
    content: ""; display: inline-block; flex: 0 0 auto; width: 4px; height: 21px;
    margin-right: 12px; border-radius: 3px; background: linear-gradient(180deg, var(--blu-vivo), var(--blu));
}
.topbar-orologio { text-align: right; line-height: 1.2; }
.tb-data { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--testo-soft); }
.tb-ora { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--testo); }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.tb-avatar { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(150deg, #2f80ed, #0b3d91); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.tb-user-info { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.tb-user-name { font-weight: 700; font-size: 14px; }
.tb-user-ente { font-size: 11px; color: var(--testo-soft); text-transform: uppercase; letter-spacing: .3px; font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle { display: inline-flex; }

/* Campanella notifiche */
.topbar-bell { position: relative; }
.bell-badge { position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px; background: var(--rosso); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; line-height: 1; box-shadow: 0 0 0 2px var(--bianco); }
.bell-badge[hidden] { display: none; }
.bell-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 350px; max-width: calc(100vw - 24px); background: var(--bianco); border: 1px solid var(--grigio-bordo); border-radius: 14px; box-shadow: 0 16px 44px rgba(16, 30, 54, .2); z-index: 60; overflow: hidden; animation: modal-in .15s ease; }
.bell-menu[hidden] { display: none; }
.bell-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; font-weight: 800; border-bottom: 1px solid var(--grigio-bordo); }
.bell-head .ico { width: 17px; height: 17px; color: var(--blu); }
.bell-lista { max-height: 400px; overflow-y: auto; }
.bell-vuoto { padding: 30px 16px; text-align: center; color: var(--testo-soft); }
.bell-item { display: flex; gap: 11px; padding: 12px 15px; border-bottom: 1px solid var(--grigio-bg); }
.bell-item:hover { background: var(--grigio-bg); text-decoration: none; }
.bell-item:last-child { border-bottom: none; }
.bell-item.nuova { background: #f2f7ff; }
.bell-ico { flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; background: var(--blu-chiaro); color: var(--blu); display: grid; place-items: center; }
.bell-ico .ico { width: 17px; height: 17px; }
.bell-corpo { display: flex; flex-direction: column; min-width: 0; }
.bell-titolo { font-weight: 700; font-size: 13.5px; color: var(--testo); }
.bell-sub { font-size: 12.5px; color: var(--testo-soft); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bell-data { font-size: 11px; color: #9aa4b5; margin-top: 2px; }
@media (min-width: 861px) {
    body.nav-aperta .sidebar { display: none; }
}

.content { padding: 28px 30px 34px; width: 100%; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 27px; font-weight: 800; margin: 0; letter-spacing: -.5px; }
.page-head p { margin: 5px 0 0; color: var(--testo-soft); font-size: 14.5px; }
.page-head .toolbar, .page-head > div:last-child:not(:first-child) { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Card, griglie ---------- */

.card {
    background: var(--bianco);
    border: 1px solid var(--grigio-bordo);
    border-radius: var(--raggio);
    box-shadow: var(--ombra);
    padding: 24px 26px;
    margin-bottom: 30px;
}
.card h2 { display: flex; align-items: center; gap: 9px; font-size: 16.5px; font-weight: 750; letter-spacing: -.2px; margin: 0 0 16px; padding-bottom: 13px; border-bottom: 1px solid var(--grigio-bg); }
.card h3 { font-size: 14px; font-weight: 700; margin: 18px 0 8px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-header .card-title, .card-header h2 { margin: 0; padding: 0; border-bottom: none; }
.card-title { font-size: 16.5px; font-weight: 750; margin: 0; display: flex; align-items: center; gap: 9px; }
.card-sub { color: var(--testo-soft); font-size: 13px; margin: 2px 0 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat {
    position: relative;
    overflow: hidden;
    background: var(--bianco);
    border: 1px solid var(--grigio-bordo);
    border-radius: var(--raggio);
    box-shadow: var(--ombra);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 0;
    transition: transform .16s ease, box-shadow .16s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16, 30, 54, .06), 0 14px 34px rgba(16, 30, 54, .10); }
.stat::after {
    content: "";
    position: absolute;
    right: -34px;
    top: -34px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: currentColor;
    opacity: .045;
    pointer-events: none;
}
.stat { color: var(--blu); }
.stat:has(.stat-ico.verde) { color: var(--verde); }
.stat:has(.stat-ico.rosso) { color: var(--rosso); }
.stat:has(.stat-ico.giallo) { color: var(--giallo); }
.stat-ico { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; background: linear-gradient(160deg, #f0f5fe, var(--blu-chiaro)); color: var(--blu); font-size: 23px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(11, 61, 145, .07); }
.stat-ico .ico { width: 26px; height: 26px; }
.stat-ico.verde { background: linear-gradient(160deg, #effaf3, var(--verde-bg)); color: var(--verde); box-shadow: inset 0 0 0 1px rgba(15, 157, 88, .1); }
.stat-ico.rosso { background: linear-gradient(160deg, #fef1ef, var(--rosso-bg)); color: var(--rosso); box-shadow: inset 0 0 0 1px rgba(217, 48, 37, .09); }
.stat-ico.giallo { background: linear-gradient(160deg, #fef7e8, var(--giallo-bg)); color: var(--giallo); box-shadow: inset 0 0 0 1px rgba(176, 96, 0, .1); }
.stat-num { font-size: 33px; font-weight: 800; line-height: 1.05; letter-spacing: -.8px; color: var(--testo); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--testo-soft); font-size: 13.5px; font-weight: 600; margin-top: 3px; }
.stat-label a { font-weight: 700; }

.cols-2, .griglia-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.cols-2 > .card, .cols-3 > .card, .griglia-2 > .card { margin-bottom: 0; }
@media (max-width: 900px) { .cols-2, .cols-3, .griglia-2 { grid-template-columns: 1fr; } }

/* ---------- Tabelle ---------- */

.table-wrap { overflow-x: auto; }
table.tab, .table-wrap table { width: 100%; border-collapse: collapse; }
.tab th, .table-wrap table th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .7px;
    font-weight: 750;
    color: var(--testo-soft);
    background: #f8fafd;
    padding: 10px 12px;
    border-bottom: 1px solid var(--grigio-bordo);
    white-space: nowrap;
}
.tab thead th:first-child, .table-wrap table thead th:first-child { border-radius: 9px 0 0 9px; }
.tab thead th:last-child, .table-wrap table thead th:last-child { border-radius: 0 9px 9px 0; }
.tab td, .table-wrap table td { padding: 13px 12px; border-bottom: 1px solid #edf0f7; vertical-align: middle; }
.tab tr:last-child td, .table-wrap table tr:last-child td { border-bottom: 0; }
.tab tbody tr:hover td, .table-wrap table tbody tr:hover td { background: #f7f9fd; }
.td-azioni { text-align: right; white-space: nowrap; }
.vuoto { text-align: center; color: var(--testo-soft); padding: 28px 10px !important; }

/* ---------- Badge ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    padding: 3.5px 11px;
    border-radius: 20px;
    white-space: nowrap;
}
.badge-verde, .badge-yes { background: var(--verde-bg); color: var(--verde); }
.badge-rosso, .badge-no { background: var(--rosso-bg); color: var(--rosso); }
.badge-giallo, .badge-pending { background: var(--giallo-bg); color: var(--giallo); }
.badge-blu { background: var(--blu-chiaro); color: var(--blu); }
.badge-grigio { background: #eceff4; color: var(--testo-soft); }

.chip { display: inline-block; padding: 2.5px 10px; border-radius: 20px; font-size: 12px; background: var(--blu-chiaro); color: var(--blu); margin: 1px 2px; font-weight: 700; }
.chip-warn { background: var(--giallo-bg); color: var(--giallo); }
.chip-lg { font-size: 14px; padding: 8px 16px; box-shadow: inset 0 0 0 1px rgba(11, 61, 145, .08); }
.chip-lg.chip-warn { box-shadow: inset 0 0 0 1px rgba(176, 96, 0, .12); }

.pallino { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.pallino.on { background: var(--verde); box-shadow: 0 0 0 3px var(--verde-bg); }
.pallino.off { background: #b9c1cf; }

/* ---------- Form ---------- */

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 16px; }
.form-grid .campo-full { grid-column: 1 / -1; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 700px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }

label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 12px; color: var(--testo); }
.campo label { margin-bottom: 5px; }
.label-like { display: block; font-size: 13px; font-weight: 650; margin-bottom: 6px; color: var(--testo); }
.campo .hint, .hint { font-size: 12px; color: var(--testo-soft); margin-top: 4px; font-weight: 400; }

input[type=text], input[type=email], input[type=password], input[type=url], input[type=number],
input[type=tel], input[type=date], input[type=time], input[type=datetime-local], input[type=color], select, textarea {
    width: 100%;
    margin-top: 5px;
    padding: 9px 11px;
    border: 1px solid var(--grigio-bordo);
    border-radius: 8px;
    font: inherit;
    font-weight: 400;
    background: var(--bianco);
    color: var(--testo);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--blu);
    box-shadow: 0 0 0 3px rgba(11, 61, 145, .12);
}
textarea { min-height: 100px; resize: vertical; }
input[type=color] { padding: 3px; height: 40px; }
input[type=file] { font-size: 14px; }

/* Area di caricamento file (dropzone automatica sugli input file) */
label.filedrop {
    position: relative;
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 9px;
    border: 2px dashed var(--grigio-bordo); border-radius: 12px;
    padding: 22px 18px; background: #fafbff; cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.filedrop:hover, .filedrop.dragover { border-color: var(--blu); background: var(--blu-chiaro); }
.filedrop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.filedrop-ico { width: 52px; height: 52px; border-radius: 14px; background: var(--blu-chiaro); color: var(--blu); display: grid; place-items: center; flex-shrink: 0; }
.filedrop-ico svg { width: 26px; height: 26px; }
.filedrop-testo { min-width: 0; max-width: 100%; display: flex; flex-direction: column; align-items: center; }
.filedrop-titolo { display: block; max-width: 100%; font-weight: 700; font-size: 15px; color: var(--testo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filedrop-titolo b { color: var(--blu); font-weight: 700; }
.filedrop-hint { display: block; font-size: 12.5px; color: var(--testo-soft); margin-top: 3px; }
.filedrop-anteprima { order: -1; width: 62px; height: 62px; border-radius: 12px; object-fit: cover; display: none; box-shadow: 0 2px 8px rgba(16, 30, 54, .22); }
.filedrop.pieno { border-style: solid; border-color: var(--verde); background: var(--verde-bg); }
.filedrop.pieno .filedrop-ico { display: none; }

.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; margin-right: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.caricando { pointer-events: none; opacity: .92; }

.check-inline, .check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; margin-bottom: 8px; cursor: pointer; }
.check-inline input, .check input { width: 17px; height: 17px; margin: 0; accent-color: var(--blu); }
.check-lg { font-size: 15px; padding: 4px 0 8px; }

.form-azioni { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.app-footer {
    margin-top: auto;
    padding: 15px 24px;
    border-top: 1px solid var(--grigio-bordo);
    background: var(--bianco);
    color: var(--testo-soft);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 20px;
    flex-wrap: wrap;
}
.app-footer .footer-right a { font-weight: 700; color: var(--blu); }
.footer-firma { font-weight: 750; color: var(--blu-vivo); text-decoration: none; }
.footer-firma:hover { text-decoration: underline; }
.firma-agency { opacity: .85; font-size: 13px; }

/* ---------- Bottoni ---------- */

.btn, .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(180deg, #17499f, var(--blu));
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 9px;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(11, 61, 145, .28);
    transition: transform .12s ease, box-shadow .12s ease, filter .15s ease;
}
.btn:hover, .btn-primary:hover { color: #fff; text-decoration: none; filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 5px 16px rgba(11, 61, 145, .34); }
.btn:active { transform: translateY(0); }
.btn-secondario, .btn-ghost-dark { background: var(--bianco); color: var(--testo); border: 1px solid var(--grigio-bordo); box-shadow: 0 1px 2px rgba(16, 30, 54, .06); }
.btn-secondario:hover, .btn-ghost-dark:hover { background: var(--grigio-bg); color: var(--testo); filter: none; }
.btn-pericolo, .btn-danger { background: linear-gradient(180deg, #e2483d, var(--rosso)); box-shadow: 0 2px 6px rgba(217, 48, 37, .28); }
.btn-yellow { background: linear-gradient(180deg, #f2a516, #d97706); color: #fff; box-shadow: 0 2px 6px rgba(217, 119, 6, .3); }
.btn-yellow:hover { color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }
.btn-block { display: flex; width: 100%; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--testo-soft);
    cursor: pointer;
    font: inherit;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-icon:hover { background: var(--blu-chiaro); color: var(--blu); border-color: var(--grigio-bordo); text-decoration: none; }

.azioni-riga { display: inline-flex; gap: 4px; }
.azioni-riga form { display: inline; margin: 0; }
td form { margin: 0; display: inline-block; }

/* Mini-form nelle celle (telefono, tavolo): campo + salva ben allineati */
.mini-form { display: flex; gap: 6px; align-items: center; }
.mini-form input { margin: 0; }
.mini-form .input-tel { width: 150px; }
.mini-form .input-tavolo { width: 76px; }
.mini-form .input-nome { width: 175px; font-weight: 650; }

/* Tabelle responsive: sotto gli 820px le righe diventano card verticali,
   niente più scroll orizzontale per trovare i pulsanti */
@media (max-width: 820px) {
  .table-wrap { overflow-x: visible; }
  .table-wrap table thead { display: none; }
  .table-wrap table, .table-wrap table tbody { display: block; }
  .table-wrap table tr {
    display: block; background: var(--bianco); border: 1px solid var(--grigio-bordo);
    border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--ombra);
  }
  .table-wrap table td {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    border: 0; padding: 7px 0; text-align: right; flex-wrap: wrap;
  }
  .table-wrap table td[data-label]::before {
    content: attr(data-label);
    font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
    color: var(--testo-soft); text-align: left; flex: 0 0 auto;
  }
  .table-wrap table td:not([data-label]) { justify-content: flex-end; }
  .table-wrap table td .mini-form { justify-content: flex-end; }
  .table-wrap table td.td-sel { justify-content: flex-start; }
  .table-wrap table td.td-azioni { justify-content: flex-end; }
  .table-wrap table tr:nth-child(even) td { background: transparent; }
}

/* Selezione multipla invitati */
.td-sel { width: 34px; text-align: center; }
.td-sel input { width: 17px; height: 17px; accent-color: var(--blu-vivo); cursor: pointer; margin: 0; }
.bulk-bar {
  position: sticky; bottom: 12px; display: flex; align-items: center; gap: 12px;
  background: var(--blu); color: #fff; border-radius: 12px; padding: 10px 16px;
  margin-top: 14px; box-shadow: 0 8px 24px rgba(11, 61, 145, .35);
}
.bulk-bar strong { flex: 1; }
.bulk-bar[hidden] { display: none; }

/* Card Telegram nel riepilogo manager */
.tg-card { border-left: 4px solid #2aabee; }
.tg-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tg-ico { font-size: 30px; }
.tg-testo { flex: 1; min-width: 240px; line-height: 1.45; }

/* Piano tavoli */
.tavoli-griglia { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.tavolo-card { position: relative; display: flex; flex-direction: column; }
.tavolo-testata { margin-bottom: 8px; }
.tavolo-testata .tavolo-input-nome { flex: 1; min-width: 0; font-weight: 750; font-size: 15px; }
.tavolo-posti { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tavolo-barra { flex: 1; height: 8px; border-radius: 6px; background: var(--blu-chiaro); overflow: hidden; }
.tavolo-barra span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--blu-vivo), var(--blu)); transition: width .25s; }
.tavolo-posti.pieno .tavolo-barra span { background: linear-gradient(90deg, #f39c12, #e74c3c); }
.tavolo-conto { font-size: 12.5px; font-weight: 750; color: var(--testo-soft); white-space: nowrap; }
.tavolo-posti.pieno .tavolo-conto { color: #c0392b; }
.tavolo-ospiti { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tavolo-chip-form { display: inline; }
.chip .chip-x { border: 0; background: none; cursor: pointer; font-size: 14px; font-weight: 800; color: inherit; opacity: .55; padding: 0 0 0 4px; line-height: 1; }
.chip .chip-x:hover { opacity: 1; color: #c0392b; }
.tavolo-elimina { position: absolute; top: 14px; right: 14px; }
.tavolo-card .tavolo-testata { padding-right: 40px; }
.tavolo-riga { padding: 4px 0; border-bottom: 1px dashed var(--bordo); }
.tavolo-riga:last-child { border-bottom: 0; }
.tavolo-riga .tavolo-nome-ospite { flex: 1; min-width: 140px; }
.tavolo-card-attesa { border-left: 4px solid #f39c12; }

/* Guida installazione APK sull'invito */
.guida-apk { text-align: left; margin: 12px auto 0; max-width: 480px; background: var(--grigio-bg); border-radius: 12px; padding: 10px 16px; }
.guida-apk summary { cursor: pointer; font-weight: 750; padding: 4px 0; }
.guida-apk ol { margin: 10px 0 6px; padding-left: 22px; display: grid; gap: 7px; }
.guida-apk li { line-height: 1.45; }

/* Codice personale per l'app (dopo "Ci sarò") */
.app-codice { margin-top: 12px; }
.codice-riga { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; }
.codice-app { font-size: 20px; font-weight: 800; letter-spacing: 2px; background: var(--blu-chiaro); color: var(--blu); padding: 8px 16px; border-radius: 10px; border: 1.5px dashed var(--blu-vivo); }

/* Banner app della festa (badge ufficiali store) */
.app-badges { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.app-badges .badge-apple { height: 52px; display: block; }
.app-badges .badge-play { height: 78px; display: block; }

/* Quiz della festa */
.chip-neutra { background: #eef1f7; color: var(--testo-soft); }
a.chip { text-decoration: none; }
.missioni-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.quiz-risposte { display: grid; gap: 8px; }
.quiz-risposte .quiz-opzione { text-align: left; justify-content: flex-start; font-size: 15px; }
.quiz-riga-review { padding: 11px 14px; border-radius: 11px; border: 2px solid var(--bordo); font-weight: 650; }
.quiz-riga-review.giusta { background: #d9f2e3; border-color: #27ae60; color: #14683a; }
.quiz-riga-review.sbagliata { background: #fde3e0; border-color: #e74c3c; color: #93261a; }
.quiz-riga-review.spenta { opacity: .45; }
.quiz-timer { height: 8px; border-radius: 6px; background: var(--blu-chiaro); overflow: hidden; margin-top: 10px; }
.quiz-timer span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--blu-vivo), var(--blu)); transition: width 1s linear; }

/* Checklist "Sei pronto?" */
.checklist-card .check-barra { flex: 1; height: 8px; border-radius: 6px; background: var(--blu-chiaro); overflow: hidden; min-width: 90px; }
.checklist-card .check-barra span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #27ae60, #2ecc71); transition: width .3s; }
.check-griglia { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 6px 18px; margin-top: 10px; }
.check-voce { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; font-weight: 650; color: var(--testo); text-decoration: none; }
.check-voce.fatta { color: var(--testo-soft); }
.check-voce.fatta .check-spunta { background: #d9f2e3; color: #1e8e4d; }
.check-voce:not(.fatta) { background: var(--giallo-chiaro, #fdf6e3); }
.check-voce:not(.fatta):hover { background: var(--blu-chiaro); }
.check-spunta { width: 22px; height: 22px; border-radius: 50%; background: #eef1f7; color: var(--testo-soft); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 900; flex: none; }
.check-vai { margin-left: auto; font-size: 12px; color: var(--blu-vivo); font-weight: 750; white-space: nowrap; }

/* Landing pubblica */
.hero-azioni { text-align: center; margin: 6px 0 30px; }
.btn-hero { font-size: 18px; padding: 16px 34px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.hero-invitato { color: rgba(255, 255, 255, .9); margin-top: 18px; font-size: 15px; }

/* Countdown sull'invito */
.countdown { display: inline-block; background: var(--blu-chiaro); color: var(--blu); border-radius: 20px; padding: 6px 16px; font-weight: 750; font-size: 15px; margin: 2px 0 10px; }
.countdown strong { font-size: 18px; }

/* Lista regali sull'invito */
.gift-lista { margin-top: 4px; }
.gift-riga { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 7px 0; border-top: 1px dashed var(--bordo); }
.gift-riga .gift-titolo { flex: 1; min-width: 170px; font-weight: 700; }
.gift-riga.presa .gift-titolo { opacity: .55; text-decoration: line-through; }
.gift-riga.mia .gift-titolo { color: var(--blu); }
.avviso-rosso { color: var(--rosso); font-weight: 700; margin-top: 4px; }
.btn-icon-danger:hover { background: var(--rosso-bg); color: var(--rosso); border-color: #f3c4c0; }

/* ---------- Toast (flash) ---------- */

.flash-wrap { position: fixed; top: calc(var(--topbar-h) + 12px); right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 44px)); pointer-events: none; }
.flash {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 13px 14px 13px 15px;
    border-radius: 12px;
    font-weight: 600;
    background: var(--bianco);
    color: var(--testo);
    border: 1px solid var(--grigio-bordo);
    border-left: 4px solid var(--testo-soft);
    box-shadow: 0 12px 30px rgba(16, 30, 54, .16);
    pointer-events: auto;
    animation: toast-in .28s cubic-bezier(.2, .8, .2, 1);
}
.flash::before { content: ""; flex: 0 0 auto; width: 20px; height: 20px; margin-top: 1px; background: currentColor; -webkit-mask: center/contain no-repeat; mask: center/contain no-repeat; }
.flash-testo { flex: 1; min-width: 0; color: var(--testo); font-weight: 600; }
.flash-chiudi { flex: 0 0 auto; border: none; background: none; color: var(--testo-soft); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 2px; }
.flash-ok { border-left-color: var(--verde); color: var(--verde); }
.flash-ok::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12 2.5 2.5 4.5-5'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8.5 12 2.5 2.5 4.5-5'/%3E%3C/svg%3E"); }
.flash-errore { border-left-color: var(--rosso); color: var(--rosso); }
.flash-errore::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v5M12 16h.01'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v5M12 16h.01'/%3E%3C/svg%3E"); }
.flash-info { border-left-color: var(--blu); color: var(--blu); }
.flash-info::before { -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E"); mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E"); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.flash.uscita { animation: toast-out .3s ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* Modal di conferma */
.modal-overlay { position: fixed; inset: 0; z-index: 400; background: rgba(16, 30, 54, .5); display: grid; place-items: center; padding: 20px; }
.modal-overlay[hidden] { display: none; }
.modal-box { background: var(--bianco); border-radius: 16px; padding: 26px 26px 22px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); animation: modal-in .2s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--rosso-bg); color: var(--rosso); display: grid; place-items: center; margin: 0 auto 14px; }
.modal-ico svg { width: 28px; height: 28px; }
.modal-titolo { font-size: 18px; font-weight: 800; margin: 0 0 6px; }
.modal-msg { color: var(--testo-soft); margin: 0 0 20px; }
.modal-azioni { display: flex; gap: 10px; justify-content: center; }

/* Interruttore on/off */
.switch-form { margin: 0; display: inline-flex; }
.switch { width: 44px; height: 25px; border-radius: 20px; border: none; background: #cbd3e0; cursor: pointer; padding: 0; position: relative; transition: background .18s ease; flex: 0 0 auto; }
.switch .switch-dot { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .18s ease; }
.switch.on { background: var(--verde); }
.switch.on .switch-dot { left: 22px; }

/* ---------- Grafici statistiche ---------- */

.stat-grafico { display: flex; align-items: flex-end; gap: 4px; height: 170px; padding-top: 10px; }
.stat-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.stat-col-n { font-size: 10px; color: var(--testo-soft); margin-bottom: 4px; }
.stat-col-bar { width: 100%; max-width: 24px; background: linear-gradient(180deg, #2f80ed, #0b3d91); border-radius: 5px 5px 0 0; }
.stat-col-bar.vuota { background: var(--grigio-bordo); }
.stat-col-lbl { font-size: 10px; color: var(--testo-soft); margin-top: 6px; }
.stat-col.punta .stat-col-bar { background: linear-gradient(180deg, #f2a516, #d97706); }
.stat-col.punta .stat-col-lbl { color: #d97706; font-weight: 800; }
.stat-barre { display: flex; flex-direction: column; gap: 15px; }
.stat-barra-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.stat-barra-nome { font-weight: 600; color: var(--testo); }
.stat-barra-val { font-weight: 800; color: var(--blu); }
.stat-barra-track { height: 10px; background: var(--grigio-bg); border-radius: 6px; overflow: hidden; }
.stat-barra-fill { height: 100%; background: linear-gradient(90deg, #2f80ed, #0b3d91); border-radius: 6px; }

@media print {
    .sidebar, .topbar, .app-footer, .nav-toggle, .modal-overlay, .flash-wrap { display: none !important; }
    .content { max-width: none; padding: 0; }
    .card { box-shadow: none !important; break-inside: avoid; }
    body { background: #fff; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Login e pagine pubbliche a schermo pieno ---------- */

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--blu-scuro), var(--blu) 60%, #1a56c4);
    padding: 20px;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bianco);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(4, 16, 45, .4);
    padding: 34px 32px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-brand .brand-mark { background: var(--blu-chiaro); color: var(--blu); width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 21px; box-shadow: none; }
.login-brand h1 { font-size: 21px; margin: 0; }
.login-sub { color: var(--testo-soft); font-size: 14px; margin: 0 0 22px; font-weight: 400; }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; margin-top: 6px; }
.login-torna { display: block; text-align: center; margin-top: 16px; font-size: 13px; color: rgba(255, 255, 255, .85); }
.login-torna a { color: #fff; font-weight: 700; }

/* ---------- Home (scelta accessi) ---------- */

.hero { text-align: center; color: #fff; padding: 46px 20px 34px; }
.hero h1 { color: #fff; font-size: clamp(26px, 4.5vw, 38px); font-weight: 800; letter-spacing: -.5px; margin: 0 0 10px; }
.hero p { color: rgba(255, 255, 255, .85); margin: 0; font-size: 16px; }

.access-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; max-width: 1000px; margin: 0 auto 26px; padding: 0 20px; }
@media (max-width: 850px) { .access-grid { grid-template-columns: 1fr; max-width: 460px; } }
.access {
    background: var(--bianco); border-radius: 16px; padding: 26px 22px; text-align: center;
    text-decoration: none; color: var(--testo); display: flex; flex-direction: column; gap: 8px;
    box-shadow: 0 16px 40px rgba(4, 16, 45, .3);
    transition: transform .14s ease;
}
.access:hover { transform: translateY(-4px); text-decoration: none; }
.access-ico { width: 58px; height: 58px; border-radius: 16px; margin: 0 auto 6px; display: grid; place-items: center; font-size: 27px; background: linear-gradient(150deg, #2f80ed, #0b3d91); color: #fff; box-shadow: 0 8px 18px rgba(11, 61, 145, .35); }
.access h3 { margin: 0; font-size: 18px; font-weight: 800; }
.access p { margin: 0 0 10px; color: var(--testo-soft); font-size: 13.5px; flex: 1; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 1000px; margin: 0 auto; padding: 0 20px 46px; }
@media (max-width: 850px) { .features { grid-template-columns: 1fr; max-width: 460px; } }
.feature { background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .16); border-radius: 14px; padding: 16px 18px; color: #fff; }
.feature-icon { font-size: 22px; margin-bottom: 4px; }
.feature h3 { color: #fff; font-size: 15px; margin: 0 0 4px; }
.feature p { color: rgba(255, 255, 255, .75); font-size: 13px; margin: 0; line-height: 1.45; }

.public-footer { text-align: center; color: rgba(255, 255, 255, .6); font-size: 13px; padding: 0 20px 26px; }
.public-footer a { color: rgba(255, 255, 255, .85); font-weight: 700; }

/* ---------- Grafica della festa (nome, età, tema) ---------- */

/* Grafica della festa v2: gradiente a strati, coriandoli, emoji fluttuanti, luccichio */
.party-graphic {
  position: relative; overflow: hidden; border-radius: 18px; padding: 34px 16px 26px;
  text-align: center; color: #fff; margin-bottom: 18px; box-shadow: var(--ombra);
  background:
    radial-gradient(ellipse 65% 90% at 50% -20%, rgba(255,255,255,.28), transparent 60%),
    radial-gradient(ellipse 40% 60% at 12% 110%, rgba(255,255,255,.14), transparent 65%),
    linear-gradient(135deg, var(--pg-from, #e74c3c), var(--pg-to, #2f80ed));
}
.pg-coriandoli {
  position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image:
    radial-gradient(circle 3px at 12% 22%, #ffe08a 98%, transparent),
    radial-gradient(circle 2px at 28% 68%, #fff 98%, transparent),
    radial-gradient(circle 3px at 44% 14%, #8be0ff 98%, transparent),
    radial-gradient(circle 2px at 57% 78%, #ffd166 98%, transparent),
    radial-gradient(circle 3px at 71% 26%, #fff 98%, transparent),
    radial-gradient(circle 2px at 86% 62%, #ffb3c7 98%, transparent),
    radial-gradient(circle 2px at 94% 18%, #b8ffb0 98%, transparent),
    radial-gradient(circle 2px at 6% 82%, #8be0ff 98%, transparent);
  animation: pg-coriandoli-drift 9s linear infinite alternate;
}
@keyframes pg-coriandoli-drift { from { transform: translateY(-4px); } to { transform: translateY(6px); } }
.pg-luce {
  position: absolute; top: 0; bottom: 0; width: 45%; left: -60%; pointer-events: none;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.22), transparent);
  animation: pg-luce-sweep 6s ease-in-out infinite;
}
@keyframes pg-luce-sweep { 0%, 55% { left: -60%; } 85%, 100% { left: 130%; } }
.pg-float {
  position: absolute; bottom: -30px; pointer-events: none; opacity: 0;
  animation: pg-float-su 8s ease-in infinite;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.2));
}
@keyframes pg-float-su {
  0% { transform: translateY(0) rotate(-6deg); opacity: 0; }
  12% { opacity: .85; }
  55% { transform: translateY(-70px) rotate(7deg); opacity: .75; }
  100% { transform: translateY(-135px) rotate(-5deg); opacity: 0; }
}
.pg-emoji { font-size: 15px; letter-spacing: .45em; opacity: .85; position: relative; }
.pg-name {
  position: relative; font-size: clamp(30px, 6vw, 44px); font-weight: 900; letter-spacing: -.5px;
  margin: 2px 0 6px; line-height: 1.1;
  text-shadow: 0 3px 10px rgba(0,0,0,.35), 0 0 26px rgba(255,255,255,.25);
}
.pg-age {
  position: relative; display: inline-block; font-size: 17px; font-weight: 750;
  padding: 6px 18px; margin-bottom: 10px; border-radius: 30px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35);
  backdrop-filter: blur(4px); text-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.pg-age strong { font-size: 21px; color: var(--pg-accent, #ffd166); }
@media (prefers-reduced-motion: reduce) {
  .pg-coriandoli, .pg-luce, .pg-float { animation: none; }
  .pg-float { opacity: .5; bottom: auto; top: 12px; }
}

.theme-picker { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.theme-option { text-align: center; cursor: pointer; margin-bottom: 0; position: relative; font-weight: 400; }
.theme-option input { position: absolute; opacity: 0; }
.theme-swatch { display: flex; width: 78px; height: 50px; border-radius: 10px; align-items: center; justify-content: center; font-size: 20px; border: 3px solid transparent; }
.theme-option input:checked + .theme-swatch { border-color: #fff; box-shadow: 0 0 0 2px var(--blu); }
.theme-option small { font-size: 12px; color: var(--testo-soft); font-weight: 600; }

.color-pair { display: flex; gap: 8px; margin-top: 5px; }
.color-pair input[type=color] { width: 52px; height: 40px; margin: 0; }

/* ---------- Cornici ---------- */

.frame-picker { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0 14px; }
.frame-option { width: 116px; text-align: center; cursor: pointer; margin-bottom: 0; position: relative; font-weight: 400; }
.frame-option input { position: absolute; opacity: 0; }
.frame-option img, .frame-none {
    display: flex; align-items: center; justify-content: center;
    width: 116px; height: 116px; object-fit: contain;
    border: 2px solid var(--grigio-bordo); border-radius: 12px;
    background: repeating-conic-gradient(#e9edf2 0% 25%, #fff 0% 50%) 0 0 / 16px 16px;
}
.frame-none { color: var(--testo-soft); font-size: 12px; font-weight: 600; }
.frame-option input:checked + img,
.frame-option input:checked + .frame-none { border-color: var(--blu); box-shadow: 0 0 0 3px rgba(11, 61, 145, .15); }
.frame-option small { font-size: 12px; color: var(--testo-soft); font-weight: 600; display: block; margin-top: 3px; }
.frame-actions { display: flex; flex-direction: column; gap: 4px; margin-top: 5px; }
.frame-actions .btn, .frame-actions form .btn { width: 100%; }

.preview-stack { position: relative; border-radius: 12px; overflow: hidden; background: #0f172a; }
.preview-stack img { position: absolute; inset: 0; width: 100%; height: 100%; }
.preview-photo { object-fit: cover; }

/* ---------- Galleria foto ---------- */

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.photo-card { margin: 0; border: 1px solid var(--grigio-bordo); border-radius: 12px; overflow: hidden; background: var(--bianco); display: flex; flex-direction: column; box-shadow: var(--ombra); }
.photo-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photo-card figcaption { padding: 9px 10px; display: flex; flex-direction: column; gap: 7px; }
.photo-actions { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.qr-details { position: relative; }
.qr-details summary { list-style: none; cursor: pointer; }
.qr-details summary::-webkit-details-marker { display: none; }
.qr-pop { position: absolute; right: 0; bottom: calc(100% + 6px); width: 150px; background: var(--bianco); border: 1px solid var(--grigio-bordo); border-radius: 12px; padding: 10px; box-shadow: 0 16px 44px rgba(16, 30, 54, .2); z-index: 10; text-align: center; display: block; }

.tabs { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.tab-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--grigio-bordo); background: var(--bianco); color: var(--testo-soft); padding: 8px 14px; border-radius: 22px; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; transition: all .15s ease; }
.tab-pill:hover { border-color: #b9c6de; text-decoration: none; }
.tab-pill .tab-n { background: var(--grigio-bg); color: var(--testo-soft); border-radius: 10px; padding: 1px 8px; font-size: 12px; }
.tab-pill.attivo { background: var(--blu); color: #fff; border-color: var(--blu); box-shadow: 0 3px 10px rgba(11, 61, 145, .25); }
.tab-pill.attivo .tab-n { background: rgba(255, 255, 255, .28); color: #fff; }
.tab-action { margin-left: auto; }
.tab-action form { margin: 0; }

.qr-box { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.qr-box img { border: 1px solid var(--grigio-bordo); border-radius: 12px; padding: 6px; background: var(--bianco); }
.qr-box code { word-break: break-all; }

.thumb { width: 52px; height: 38px; object-fit: cover; border-radius: 6px; border: 1px solid var(--grigio-bordo); }

.form-card { max-width: none; }
.upload-form { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin-bottom: 12px; }
.upload-form .filedrop { flex: 1; min-width: 230px; padding: 12px 14px; }
.upload-form .filedrop-ico { width: 40px; height: 40px; }
.upload-form .filedrop-ico svg { width: 20px; height: 20px; }
.upload-form input[type=text] { max-width: 240px; margin-top: 0; }
.upload-form .btn { align-self: center; }

/* Anteprima template invito (verticale/orizzontale) */
.tpl-preview {
    border: 1px dashed var(--grigio-bordo); border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px; overflow: hidden; background: var(--grigio-bg);
}
.preview-v { aspect-ratio: 9 / 16; max-height: 340px; margin-inline: auto; max-width: 200px; }
.preview-h { aspect-ratio: 16 / 9; }
.tpl-preview img { width: 100%; height: 100%; object-fit: cover; }
.tpl-preview video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.tpl-empty span { color: var(--testo-soft); font-size: 13px; padding: 14px; text-align: center; }

/* ---------- App invitati: layout senza sidebar ---------- */

.guest-body { display: flex; flex-direction: column; min-height: 100vh; }
.guest-topbar { gap: 11px; }
.guest-topbar .brand-mark { width: 34px; height: 34px; }
.guest-topbar .brand-testo { line-height: 1.1; }
.guest-topbar .brand-name { font-size: 15px; }
.guest-title { flex: 1; text-align: right; font-size: 16px; }
.guest-title::before { display: none; }
.guest-content { margin: 0 auto; max-width: 860px; flex: 1; }
@media (max-width: 620px) {
    .guest-topbar .brand-testo { display: none; }
    .guest-title { text-align: left; }
}

/* ---------- Pagina invito (App invitati) ---------- */

.invite { max-width: 660px; margin: 0 auto; }
.invite-hero { display: block; margin-bottom: 18px; }
.invite-hero img, .invite-hero video { display: block; width: 100%; max-height: 76vh; object-fit: contain; border-radius: 14px; box-shadow: var(--ombra); background: var(--bianco); }
.invite-hero video { background: #000; }
.invite-hero-default {
    background: linear-gradient(135deg, var(--blu), #2f80ed);
    border-radius: 14px; text-align: center; padding: 42px 14px;
    font-size: 44px; letter-spacing: .3em;
}
.invite-card h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.4px; }
.invite-kicker { color: var(--testo-soft); margin: 0 0 6px; font-size: 14px; }
.invite-details { margin: 14px 0; display: grid; gap: 6px; }
.detail { display: flex; gap: 9px; align-items: baseline; font-size: 15px; }
.invite-desc { background: var(--grigio-bg); border-left: 3px solid var(--blu); padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: 14.5px; }

.rsvp-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0; }
@media (max-width: 560px) { .rsvp-choice { grid-template-columns: 1fr; } }
.rsvp-option {
    border: 2px solid var(--grigio-bordo); border-radius: 12px; padding: 16px;
    text-align: center; cursor: pointer; font-size: 16px; font-weight: 750;
    margin-bottom: 0; transition: border-color .15s, background .15s;
}
.rsvp-option input { position: absolute; opacity: 0; }
.rsvp-yes:has(input:checked) { border-color: var(--verde); background: var(--verde-bg); color: var(--verde); }
.rsvp-no:has(input:checked) { border-color: var(--rosso); background: var(--rosso-bg); color: var(--rosso); }
.rsvp-option:hover { border-color: var(--blu); }

.allergen-box { border: 1px solid var(--grigio-bordo); border-radius: 12px; padding: 12px 16px 8px; margin: 0 0 14px; }
.allergen-box legend { font-weight: 750; font-size: 14px; color: var(--testo); padding: 0 6px; }
.allergen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 12px; margin-bottom: 10px; }
.allergen-grid .check { font-weight: 500; font-size: 14px; margin-bottom: 4px; }

/* ---------- Nuove componenti invito ---------- */

.countdown-card { background: linear-gradient(135deg, var(--blu), #2f80ed); border: none; color: #fff; }
.countdown-card .countdown-n { font-size: 19px; font-weight: 700; }
.countdown-card strong { font-size: 26px; color: #ffd54f; }

.invite-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

.gift-box { background: var(--giallo-bg); border: 1px solid #f3dfb6; border-radius: 12px; padding: 12px 16px; margin: 12px 0; }
.gift-box p { margin: 6px 0; font-size: 14px; }
.gift-box code { background: #fff; }

.menu-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.menu-option { margin: 0; cursor: pointer; position: relative; font-weight: 600; }
.menu-option input { position: absolute; opacity: 0; }
.menu-option span { display: inline-block; padding: 9px 14px; border: 2px solid var(--grigio-bordo); border-radius: 22px; font-size: 14px; }
.menu-option input:checked + span { border-color: var(--blu); background: var(--blu-chiaro); color: var(--blu); }

.companion-row { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.companion-row input, .companion-row select { margin-top: 0; }
@media (max-width: 620px) { .companion-row { grid-template-columns: 1fr auto; } }

.song-form { display: flex; gap: 8px; flex-wrap: wrap; }
.song-form input { flex: 1; min-width: 150px; margin-top: 0; }

.btn-wa { background: linear-gradient(180deg, #34d05e, #1faa4b); color: #fff; box-shadow: 0 2px 6px rgba(31, 170, 75, .3); }
.btn-wa:hover { color: #fff; }

.like-btn.liked { border-color: #e5533c; color: #e5533c; background: var(--rosso-bg); }

.qr-slot { display: inline-block; }
.qr-slot.qr-locale { background: #fff; padding: 8px; border: 1px solid var(--grigio-bordo); border-radius: 12px; }
.qr-slot.qr-locale img, .qr-slot.qr-locale canvas { display: block; }

.menu-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 10px; }
.table-box { border: 1px solid var(--grigio-bordo); border-radius: 10px; padding: 10px 14px; background: #fafbfe; }
.table-name { font-weight: 750; }

.dedica { background: var(--grigio-bg); border-left: 3px solid var(--blu); border-radius: 0 10px 10px 0; padding: 10px 14px; font-style: italic; }

/* Photobooth in-browser e scanner */
.pb-stage { position: relative; border-radius: 14px; overflow: hidden; background: #0f172a; aspect-ratio: 3 / 4; max-width: 420px; margin: 0 auto 14px; }
.pb-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.pb-stage img { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.pb-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 3; transition: opacity .2s; }
.pb-flash.on { opacity: .9; }
.pb-count { position: absolute; inset: 0; display: grid; place-items: center; z-index: 3; font-size: 90px; font-weight: 800; color: #fff; text-shadow: 0 4px 20px #000; }
#scan-stage video { transform: none; }

/* Avvisi inline (dentro le pagine, non toast) */
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; font-size: 14px; font-weight: 600; }
.alert-success { background: var(--verde-bg); color: var(--verde); border-color: #bfe3c7; }
.alert-error { background: var(--rosso-bg); color: var(--rosso); border-color: #f3c4c0; }

/* Liste ospiti (riepilogo) */
.guest-list, .plain-list { list-style: none; margin: 0; padding: 0; }
.guest-list li { padding: 11px 2px; border-bottom: 1px solid var(--grigio-bg); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 7px; }
.guest-list li > .muted { flex-basis: 100%; }
.guest-list li:last-child { border-bottom: none; padding-bottom: 2px; }
.guest-list li:first-child { padding-top: 2px; }
.plain-list li { padding: 4px 0; }

/* Card con accento colorato in alto (colonne RSVP del riepilogo) */
.card-accent { border-top: 3px solid var(--blu); }
.card-accent-verde { border-top: 3px solid var(--verde); }
.card-accent-rosso { border-top: 3px solid var(--rosso); }
.card-accent-giallo { border-top: 3px solid #d97706; }

/* Banner "stai operando come" (assistenza dalla Console) */
.assist-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: linear-gradient(95deg, #fff7e8, #fef3e0);
    border: 1px solid #f3dfb6;
    border-left: 4px solid #d97706;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
    color: #7c4a03;
    box-shadow: var(--ombra);
}
.assist-banner .assist-ico { width: 38px; height: 38px; border-radius: 11px; background: #fff; color: #d97706; display: grid; place-items: center; flex-shrink: 0; font-size: 18px; box-shadow: inset 0 0 0 1px #f3dfb6; }
.assist-banner .assist-testo { flex: 1; min-width: 200px; }
.assist-banner strong { color: #5f3902; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-w) - 24px);
        transition: left .25s ease;
        z-index: 50;
        box-shadow: 0 0 44px rgba(3, 12, 32, .45);
    }
    body.nav-aperta .sidebar { left: 0; }
    .nav-toggle { display: inline-flex; font-size: 19px; }
    .content { padding: 16px; }
}
@media (max-width: 620px) {
    .topbar-orologio, .tb-user-info { display: none; }
    .topbar { gap: 10px; padding: 0 14px; }
}

/* Tabelle: su schermi stretti le righe si impilano in verticale */
@media (max-width: 900px) {
    .table-wrap { overflow-x: visible; }
    .table-wrap table thead, .tab thead { display: none; }
    .table-wrap table, .table-wrap table tbody, .tab, .tab tbody { display: block; width: 100%; }
    .table-wrap table tr, .tab tr {
        display: block;
        background: #fff;
        border: 1px solid var(--grigio-bordo);
        border-radius: 12px;
        padding: 4px 14px;
        margin-bottom: 12px;
    }
    .table-wrap table tr:hover td, .tab tr:hover td { background: transparent; }
    .table-wrap table td, .tab td {
        display: block;
        padding: 9px 0;
        border-bottom: 1px solid var(--grigio-bordo);
        text-align: left;
        white-space: normal;
    }
    .table-wrap table tr td:last-child, .tab tr td:last-child { border-bottom: 0; }
    .table-wrap table td[data-label]::before, .tab td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .4px;
        color: var(--testo-soft);
        margin-bottom: 4px;
    }
    .td-azioni { text-align: left; }
    .table-wrap table td.vuoto, .tab td.vuoto { text-align: center; }
}
