/*
 * ELCOM EVENT CHECK-IN - TEMA NERO E ROSSO
 * Basato sul foglio originale v1.2, inclusa la gestione accompagnatori.
 * Per utilizzare il rosso ufficiale, modificare --brand-red e --brand-red-dark.
 */


/* ============================================================
   COLORI E VARIABILI DEL TEMA ELCOM
   ============================================================ */

:root {
    --brand-red: #c8102e;
    --brand-red-dark: #a30d25;
    --brand-black: #111111;
    --brand-black-soft: #1b1b1b;
    --brand-white: #ffffff;
    --bg: #f4f4f4;
    --paper: #ffffff;
    --ink: #181818;
    --muted: #666666;
    --line: #e5e5e5;
    --success: #1f8b4c;
    --warning: #d97706;
    --danger: #c8102e;
    --radius: 16px;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    --brand-red-soft: #fff0f3;
    --focus-ring: rgba(200, 16, 46, 0.18);
    --navy: var(--brand-black);
    --blue: var(--brand-red);
    --green: var(--success);
    --red: var(--danger);
    --light: var(--brand-red-soft);
}

/* ============================================================
   BASE E ACCESSIBILITA
   ============================================================ */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

button, input, select {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: var(--brand-red);
}

.hidden {
    display: none !important;
}

button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

button:focus-visible, input:focus-visible {
    outline: 3px solid rgba(200, 16, 46, 0.45);
    outline-offset: 2px;
}

/* ============================================================
   SCHERMATA DI ACCESSO
   ============================================================ */

.shell {
    min-height: 100vh;
}

.login-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 72% 18%, #591b2b 0, transparent 34%), var(--brand-black);
}

.login-card {
    width: min(440px, 100%);
    padding: 40px;
    background: white;
    border-radius: 26px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
}

.login-card h1 {
    font-size: 29px;
    letter-spacing: -.8px;
    margin: 22px 0 6px;
}

.login-card p {
    color: var(--muted);
    line-height: 1.5;
}

.brand-symbol {
    width: 55px;
    height: 55px;
    border-radius: 16px;
    background: var(--brand-red);
    color: var(--brand-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -2px;
}

.brand-symbol span {
    color: var(--brand-white);
    font-weight: 500;
}

.login-card form {
    margin-top: 28px;
    display: grid;
    gap: 18px;
}

.form-field {
    display: grid;
    gap: 8px;
}

.form-field label {
    font-size: 13px;
    color: #404040;
    font-weight: 700;
}

.form-field input {
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    width: 100%;
    height: 48px;
    padding: 0 14px;
    color: var(--ink);
    background: white;
}

.hint {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

.error-line {
    color: var(--danger);
    font-size: 13px;
    min-height: 16px;
}

/* ============================================================
   STRUTTURA, MENU E LAYOUT
   ============================================================ */

.app-layout {
    display: grid;
    grid-template-columns: 245px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--brand-black);
    color: var(--brand-white);
    padding: 30px 18px;
    display: flex;
    flex-direction: column;
    gap: 35px;
}

.sidebar .brand {
    display: flex;
    gap: 11px;
    align-items: center;
    margin: 0 10px;
}

.sidebar .brand-symbol {
    border: 1px solid #75303e;
    width: 42px;
    height: 42px;
    font-size: 20px;
}

.brand strong {
    font-size: 16px;
}

.brand small {
    display: block;
    color: #ababab;
    font-size: 11px;
    margin-top: 3px;
}

.nav {
    display: grid;
    gap: 7px;
}

.nav button {
    border: 0;
    border-radius: 11px;
    text-align: left;
    background: transparent;
    color: #d5d5d5;
    padding: 13px 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav button.active, .nav button:hover {
    background: var(--brand-red);
    color: var(--brand-white);
}

.nav button .nav-icon {
    font-size: 18px;
    min-width: 22px;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid #414141;
    padding: 22px 12px 0;
    color: #aaaaaa;
    font-size: 13px;
}

.sidebar-footer strong {
    color: white;
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
}

.sidebar-footer button {
    color: #e9e9e9;
    background: none;
    border: none;
    padding: 13px 0 0;
}

/* ============================================================
   PAGINE E DASHBOARD
   ============================================================ */

.main-area {
    padding: 36px clamp(18px, 4vw, 60px);
    max-width: 1550px;
    width: 100%;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: start;
    margin-bottom: 28px;
}

.page-header small {
    color: var(--muted);
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.page-header h1 {
    font-size: clamp(28px, 3vw, 39px);
    letter-spacing: -1.4px;
    margin: 7px 0 4px;
}

.page-header p {
    color: var(--muted);
    margin: 0;
}

.top-state {
    background: #e5f8ef;
    border: 1px solid #c5ead9;
    border-radius: 999px;
    color: #1a7557;
    padding: 8px 13px;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 750;
}

/* ============================================================
   INDICATORI E STATISTICHE
   ============================================================ */

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 19px;
}

.stat, .panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat {
    padding: 21px 23px;
}

.stat-label {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.stat-label i {
    font-style: normal;
    font-size: 20px;
}

.stat strong {
    font-size: 42px;
    letter-spacing: -2px;
    display: block;
    margin-top: 19px;
}

.stat small {
    color: var(--muted);
    font-size: 12px;
}

.stat.present strong {
    color: var(--brand-red);
}

.panel {
    padding: 22px;
    margin-bottom: 18px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.panel-head h2 {
    margin: 0;
    font-size: 17px;
    letter-spacing: -.4px;
}

.panel-head p {
    font-size: 13px;
    color: var(--muted);
    margin: 5px 0 0;
}

.columns {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 18px;
}

.progress-track {
    height: 12px;
    background: #eaeaea;
    border-radius: 99px;
    overflow: hidden;
    margin: 20px 0 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-red), var(--brand-red-dark));
    width: 0%;
    border-radius: 99px;
    transition: width .35s;
}

/* ============================================================
   UTILITA E PULSANTI
   ============================================================ */

.flex-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.space-between {
    justify-content: space-between;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 13px;
}

.btn {
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 11px 16px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: white;
    color: var(--ink);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
    background: #f8eff1;
}

.btn.primary {
    background: var(--brand-red);
    color: var(--brand-white);
    border-color: var(--brand-red);
}

.btn.primary:hover {
    background: var(--brand-red-dark);
    border-color: var(--brand-red-dark);
}

.btn.danger {
    color: var(--danger);
}

.btn.full {
    width: 100%;
}

.btn.small {
    font-size: 12px;
    padding: 8px 11px;
}

.btn.ghost {
    background: transparent;
}

/* ============================================================
   ETICHETTE DI STATO
   ============================================================ */

.pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    padding: 6px 10px;
    border-radius: 99px;
    white-space: nowrap;
}

.pill.ok {
    background: #e2f7eb;
    color: #128154;
}

.pill.wait {
    background: #eeeeee;
    color: #555555;
}

.pill.bad {
    background: #fff0f2;
    color: var(--danger);
}

/* ============================================================
   LISTA INVITATI
   ============================================================ */

.guest-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid #ededed;
}

.guest-row:last-child {
    border-bottom: 0;
}

.avatar {
    width: 39px;
    height: 39px;
    border-radius: 12px;
    background: var(--brand-red-soft);
    color: var(--brand-red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex: none;
    font-size: 12px;
}

.guest-details {
    flex: 1;
    min-width: 0;
}

.guest-details strong {
    display: block;
    font-size: 14px;
}

.guest-details small {
    color: var(--muted);
    display: block;
    font-size: 12px;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-time {
    text-align: right;
    display: block;
    color: var(--muted);
    font-size: 12px;
}

/* ============================================================
   RICERCA E TABELLE
   ============================================================ */

.searchbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0 13px;
    min-width: 240px;
}

.searchbar input {
    border: 0;
    outline: 0;
    min-height: 43px;
    flex: 1;
    min-width: 0;
    color: var(--ink);
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 650px;
}

.data-table th {
    text-align: left;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: .6px;
    text-transform: uppercase;
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
}

.data-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #ededed;
    font-size: 13px;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table .actions {
    text-align: right;
}

/* ============================================================
   SCANNER QR
   ============================================================ */

.scan-box {
    border: 2px dashed var(--brand-red);
    border-radius: 20px;
    background: var(--brand-black);
    padding: 30px;
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 285px;
    color: var(--brand-white);
}

.scan-box video {
    width: min(100%, 460px);
    max-height: 360px;
    object-fit: cover;
    border-radius: 16px;
    background: #080808;
}

.scan-box h2 {
    margin: 16px 0 5px;
}

.scan-box p {
    color: #d7d7d7;
    line-height: 1.55;
    max-width: 440px;
}

.scan-camera {
    display: grid;
    place-items: center;
    gap: 10px;
}

.scan-illustration {
    font-size: 56px;
}

/* ============================================================
   ANTEPRIMA INVITO E CONFERMA
   ============================================================ */

.ticket-panel {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.ticket-panel .large-icon {
    font-size: 42px;
    margin-bottom: 7px;
}

.ticket-panel h2 {
    font-size: 27px;
    letter-spacing: -1px;
    margin: 0 0 7px;
}

.ticket-panel .company {
    color: var(--muted);
    margin: 0 0 18px;
}

.ticket-panel .state-note {
    padding: 12px;
    border-radius: 9px;
    background: #f7f7f7;
    color: #494949;
    font-size: 13px;
    margin-bottom: 20px;
}

.ticket-panel .state-note.success {
    background: #e6f7ed;
    color: #12794e;
}

.ticket-panel .state-note.error {
    background: #fcebed;
    color: #aa3847;
}

/* ============================================================
   MODULI E GESTIONE
   ============================================================ */

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 11px;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 17px;
}

.dropzone {
    border: 2px dashed #d4d4d4;
    border-radius: 13px;
    padding: 28px;
    text-align: center;
    background: #fdfdfd;
}

.notice {
    border: 1px solid #ebcad1;
    background: #fff5f7;
    padding: 13px 16px;
    border-radius: 12px;
    color: #683342;
    font-size: 13px;
    line-height: 1.6;
}

.row-stack {
    display: grid;
    gap: 6px;
}

.empty {
    padding: 22px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

/* ============================================================
   GRAFICI
   ============================================================ */

.bar-row {
    margin-bottom: 16px;
}

.bar-track {
    height: 7px;
    border-radius: 99px;
    background: #ededed;
    margin-top: 8px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 99px;
    background: var(--brand-red);
}

/* ============================================================
   MESSAGGI E FINESTRE
   ============================================================ */

.toast {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translate(-50%, 22px);
    padding: 13px 20px;
    border-radius: 13px;
    background: var(--brand-black);
    color: var(--brand-white);
    box-shadow: 0 15px 40px #0004;
    opacity: 0;
    pointer-events: none;
    transition: .2s;
    z-index: 100;
    text-align: center;
    max-width: 90vw;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.error {
    background: var(--brand-red-dark);
}

/* ============================================================
   MODALI
   ============================================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.74);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 60;
}

.modal {
    width: min(440px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 25px 80px #0004;
}

.modal .qr-canvas {
    display: block;
    margin: 20px auto;
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
}

.modal .code-url {
    overflow-wrap: anywhere;
    font-size: 11px;
    color: var(--muted);
    background: #f6f6f6;
    padding: 10px;
    border-radius: 9px;
}

.modal h2 {
    margin: 0 0 5px;
}

.modal p {
    margin: 0;
    color: var(--muted);
}

.modal-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.line {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 19px 0;
}

.warning {
    background: #fff5e9;
    border: 1px solid #f9dcaf;
    border-radius: 11px;
    padding: 11px 13px;
    color: #855b21;
    font-size: 13px;
}

.fullscreen-panel {
    max-width: 900px;
    margin: 0 auto;
}

.footer-note {
    font-size: 12px;
    color: var(--muted);
    padding: 10px 0;
}

/* ============================================================
   ACCOMPAGNATORI (VERSIONE 1.2)
   ============================================================ */

.group-count {
    max-width: 380px;
    margin: 20px auto;
    padding: 16px;
    border: 1px solid #ebcbd1;
    border-radius: 14px;
    background: #fff7f8;
    text-align: center;
}

.group-count label {
    display: block;
    font-weight: 700;
    font-size: 15px;
    color: var(--brand-black);
    margin-bottom: 12px;
}

.count-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.count-stepper button {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    border: 1px solid #dfc8cd;
    background: var(--brand-white);
    color: var(--brand-red);
    font-weight: 700;
    font-size: 29px;
    line-height: 1;
}

.count-stepper input {
    width: 95px;
    height: 52px;
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    color: var(--brand-black);
    border: 1px solid #dfc8cd;
    border-radius: 12px;
    background: var(--brand-white);
}

.count-stepper input::-webkit-inner-spin-button, .count-stepper input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.count-hint {
    margin: 12px 0 5px;
    font-weight: 700;
    color: var(--brand-red);
}

.group-count small {
    color: var(--muted);
    font-size: 12px;
}

/* ============================================================
   PERSONALIZZAZIONI ELCOM
   ============================================================ */

.brand-logo {
    display: block;
    width: 120px;
    max-width: 100%;
    max-height: 56px;
    height: auto;
    object-fit: contain;
}

.login-card .brand-logo {
    width: 160px;
    max-height: 76px;
    margin: 0 auto 12px;
}

.sidebar .brand-logo {
    width: 108px;
    max-height: 48px;
}

.scan-box h1, .scan-box h2, .scan-box h3, .scan-box label {
    color: var(--brand-white);
}

.scan-box .muted, .scan-box .hint {
    color: #d7d7d7;
}

.scan-box .btn:not(.primary) {
    color: var(--ink);
    background: var(--paper);
}

.scan-frame {
    border: 3px dashed var(--brand-red);
    border-radius: 20px;
    padding: 12px;
}

.btn.secondary {
    background: var(--brand-black);
    color: var(--brand-white);
    border-color: var(--brand-black);
}

.btn.secondary:hover {
    background: #333333;
    border-color: #333333;
}

.btn.danger:hover {
    background: var(--brand-red-soft);
}

.count-stepper button:hover:not(:disabled) {
    background: var(--brand-red-soft);
    border-color: var(--brand-red);
}

.form-field input:focus,.searchbar:focus-within,.count-stepper input:focus {
    outline: none;
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.topbar,.app-header {
    background: var(--brand-black);
    color: var(--brand-white);
}

.topbar a,.app-header a {
    color: var(--brand-white);
}

.sidebar .brand-logo {
    background: var(--brand-white);
    border-radius: 10px;
    padding: 6px 8px;
}


/* ============================================================
   TABLET
   ============================================================ */
@media (max-width: 950px) {

    .app-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 20;
        padding: 12px 17px;
        gap: 10px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .sidebar .brand {
        margin: 0;
    }

    .sidebar .brand small {
        display: none;
    }

    .sidebar-footer {
        display: none;
    }

    .nav {
        display: flex;
        gap: 3px;
        overflow-x: auto;
        max-width: 75vw;
    }

    .nav button {
        padding: 10px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    .nav button .nav-icon {
        display: none;
    }

    .main-area {
        padding: 24px 17px;
    }

    .columns {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ============================================================
   SMARTPHONE
   ============================================================ */
@media (max-width: 620px) {

    .stats {
        gap: 8px;
    }

    .stat {
        padding: 12px;
    }

    .stat strong {
        font-size: 32px;
        margin-top: 13px;
    }

    .stat-label {
        font-size: 11px;
    }

    .page-header h1 {
        font-size: 28px;
    }

    .page-header p {
        font-size: 12px;
    }

    .top-state {
        display: none;
    }

    .panel {
        padding: 16px;
    }

    .searchbar {
        min-width: 0;
        width: 100%;
    }

    .toolbar {
        display: grid;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .nav button {
        padding: 8px 9px;
        font-size: 11px;
    }

    .sidebar .brand-symbol {
        display: none;
    }

    .sidebar .brand strong {
        font-size: 12px;
    }

    .sidebar {
        gap: 9px;
    }

    .nav {
        max-width: 80vw;
    }

    .scan-box {
        padding: 15px;
        min-height: 240px;
    }

    .count-stepper button {
        width: 56px;
        height: 56px;
    }

    .sidebar .brand-logo {
        width: 72px;
        max-height: 40px;
        padding: 4px 5px;
    }

    .nav {
        max-width: calc(100vw - 124px);
    }
}

/* ============================================================
   STAMPA
   ============================================================ */
@media print {

    .sidebar, .page-header, .modal-actions, .no-print {
        display: none !important;
    }

    .modal-backdrop {
        position: static;
        background: white;
    }

    .modal {
        box-shadow: none;
        text-align: center;
    }

    .app-layout {
        display: block;
    }
}

/* Accessibilita: rispetta le preferenze di movimento ridotto */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}


/* V1.3 — elenco omaggi e anteprima QR composito */
.qr-controls { background: #faf7f7; border: 1px solid var(--line); border-radius: 14px; padding: 13px; margin-top: 16px; }
.qr-controls .form-grid { margin-top: 12px; }
.qr-controls input[type="number"] { width: 100%; }
.qr-controls input[type="file"] { max-width: 100%; padding: 8px; }
.modal:has(.qr-controls) { width: min(680px, 100%); }
.modal .qr-canvas { max-height: 55vh; width: auto; max-width: 100%; object-fit: contain; border: 1px solid #dedede; }
@media (max-width: 620px) { .qr-controls .form-grid { grid-template-columns: 1fr; } }

/* V1.4: area omaggi riconoscibile rispetto allo scanner ingressi. */
.gift-scan-box {
    border: 2px dashed var(--brand-red, #c8102e);
    background: #1b1b1b;
    color: #ffffff;
}
.gift-scan-box h2,
.gift-scan-box p {
    color: #ffffff;
}
.gift-scan-box .scan-camera {
    width: 100%;
}


/* ============================================================
   PAGINA PUBBLICA INVITO (v1.6.1)
   Layout dedicato: non eredita le dimensioni della card login.
   Il QR di 520 px si ridimensiona sempre nello spazio disponibile.
   ============================================================ */

.public-invite-layout {
    display: grid;
    place-items: center;
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    padding: clamp(16px, 4vw, 40px);
    background: radial-gradient(circle at 75% 10%, #571a29, transparent 48%), #111111;
}

.public-invite-card {
    width: 100%;
    max-width: 460px;
    min-width: 0;
    padding: clamp(20px, 5vw, 36px);
    background: #ffffff;
    color: #181818;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.26);
}

.public-invite-logo {
    display: block;
    width: min(180px, 70%);
    max-height: 80px;
    height: auto;
    object-fit: contain;
    margin: 0 auto 24px;
}

.public-invite-header h1 {
    font-size: clamp(23px, 5vw, 30px);
    line-height: 1.2;
    letter-spacing: -0.6px;
    margin: 0 0 10px;
}

.public-invite-event {
    font-size: clamp(13px, 3.8vw, 16px);
    color: #626262;
    margin: 0;
    line-height: 1.45;
}

.public-invite-qr-wrap {
    width: 100%;
    max-width: 320px;
    min-width: 0;
    margin: 25px auto 18px;
    padding: 12px;
    border-radius: 15px;
    background: #ffffff;
    border: 1px solid #e8e8e8;
}

.public-invite-qr {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    image-rendering: pixelated;
}

.public-invite-instructions {
    max-width: 340px;
    margin: 0 auto 20px;
    color: #626262;
    font-size: 14px;
    line-height: 1.5;
}

.public-invite-download {
    min-height: 48px;
    width: 100%;
}

@media (max-width: 420px) {
    .public-invite-layout {
        padding: 14px;
    }

    .public-invite-card {
        border-radius: 20px;
        padding: 22px 18px;
    }

    .public-invite-qr-wrap {
        padding: 8px;
        margin: 18px auto 14px;
    }
}


/* ============================================================
   V1.6.2 — INVITO GRAFICO CON QR (mobile + desktop)
   Stesso canvas utilizzato per download, email e pagina WhatsApp.
   ============================================================ */
.public-invite-art-card {
    width: min(100%, 500px);
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}
.public-invite-art {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1171 / 2048;
    border-radius: 6px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}
.public-invite-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.public-invite-buttons .btn {
    flex: 1 1 180px;
    min-height: 48px;
}
.public-invite-status {
    color: #f5f5f5;
    text-align: center;
    font-size: 14px;
}
.public-invite-zoom {
    width: min(100%, 360px);
    margin: 0 auto;
    padding: 12px;
    background: #fff;
    border-radius: 14px;
}
.public-invite-zoom[hidden] { display: none; }
.public-invite-zoom canvas {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
}
.public-invite-art-card .public-invite-instructions {
    color: #f5f5f5;
    text-align: center;
    margin: 4px auto 12px;
}
@media (max-width: 420px) {
    .public-invite-layout { padding: 10px; }
    .public-invite-art-card { gap: 10px; }
}

/* v1.6.3 — due grafiche su pagina condivisa; il secondo blocco è davvero nascosto se Omaggio=NO. */
.public-invite-layout { gap: 32px; flex-wrap: wrap; }
.public-invite-art-card[hidden] { display: none !important; }
.public-invite-heading { margin: 0 0 8px; color: #fff; font-size: clamp(19px, 3vw, 28px); text-align: center; }
@media (max-width: 550px) { .public-invite-layout { gap: 24px; } }

/* V1.6.4 - Invia inviti non ancora spediti, visibile anche dalla lista Invitati. */
.bulk-mail-panel {
    border: 1px solid #e8bdc5;
    border-left: 4px solid #c8102e;
    border-radius: 13px;
    padding: 18px;
    margin: 18px 0 22px;
    background: #fffafa;
}
.bulk-mail-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}
.bulk-mail-header h3 {
    margin: 0 0 4px;
    font-size: 18px;
    color: #211719;
}
.bulk-mail-header p {
    margin: 0;
}
.bulk-mail-count {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: #111;
    color: #fff;
    font-size: 13px;
}
.bulk-mail-actions {
    margin-top: 14px;
    flex-wrap: wrap;
}
.bulk-mail-panel #bulk-email-status {
    min-height: 20px;
    font-weight: 600;
}
.bulk-mail-panel .hint {
    margin: 6px 0 0;
}
@media (max-width: 620px) {
    .bulk-mail-panel { padding: 14px; }
    .bulk-mail-actions .btn { width: 100%; }
}

/* ============================================================
   V1.7 - SELEZIONE E GESTIONE MULTI-EVENTO
   ============================================================ */
.event-picker-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 13px;
    max-width: 520px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}
.event-picker {
    display: block;
    width: 100%;
    min-height: 45px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink);
    font-weight: 600;
}
.event-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 14px;
}
.event-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--paper);
    padding: 18px;
}
.event-card.selected {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 1px var(--brand-red);
}
.event-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.event-card h3 { margin: 0; font-size: 17px; }
.event-card .flex-row { flex-wrap: wrap; margin-top: 15px; }
.event-form .form-grid { margin-bottom: 18px; }
.public-event-title {
    color: #ffffff;
    font-size: clamp(21px, 4vw, 31px);
    font-weight: 750;
    text-align: center;
    margin: 0 0 14px;
    width: 100%;
}
@media (max-width: 950px) {
    .event-picker-label { max-width: 100%; }
    .event-card { padding: 14px; }
}

/* ============================================================
   V1.8 - LAYOUT A TRE TAB / GESTIONE EVENTO E QR CODE
   ============================================================ */

.app-layout.app-layout-horizontal {
    display: block;
    min-height: 100vh;
    background: #f5f5f6;
}

.app-layout-horizontal .top-nav-shell {
    position: relative;
    z-index: 25;
    color: #fff;
    background: #171719;
    border-bottom: 3px solid var(--brand-red);
    box-shadow: 0 3px 18px rgba(0, 0, 0, .12);
}

.top-nav-brand-row,
.top-nav-bottom {
    width: min(1420px, calc(100% - 64px));
    margin: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 22px;
}

.top-nav-brand-row { min-height: 75px; padding: 11px 0; }
.top-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.top-brand .brand-logo {
    width: 110px;
    height: 46px;
    padding: 4px 6px;
    border-radius: 8px;
    object-fit: contain;
    background: #fff;
}
.top-brand-label { display: grid; gap: 2px; }
.top-brand-label strong { font-size: 16px; letter-spacing: .09em; }
.top-brand-label small { font-size: 10px; letter-spacing: .19em; color: #bbb; }
.top-user { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.top-user > div { display: grid; gap: 3px; }
.top-user strong { font-size: 12px; }
.top-user small { font-size: 11px; color: #b6b6b9; }
.user-avatar {
    width: 35px;
    height: 35px;
    display: grid;
    place-items: center;
    color: #fff;
    border-radius: 50%;
    background: #792332;
    border: 1px solid #a53b50;
    font-size: 14px;
    font-weight: 700;
}
.top-logout {
    padding: 8px 12px;
    margin-left: 12px;
    border: 1px solid #525257;
    border-radius: 9px;
    background: transparent;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}
.top-logout:hover { background: #303034; }

.top-nav-bottom { min-height: 56px; }
.top-nav { display: flex; min-width: 0; align-items: stretch; gap: 4px; }
.top-nav button {
    appearance: none;
    border: 0;
    background: transparent;
    border-radius: 12px 12px 0 0;
    padding: 17px 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #d1d1d4;
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: background .15s, color .15s;
}
.top-nav button:hover { background: #27272a; color: #fff; }
.top-nav button.active { background: #292325; color: #fff; border-bottom-color: #ef334c; }
.top-nav .nav-icon { font-size: 20px; line-height: 1; }
.top-event-indicator {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    color: #d2d2d5;
    min-width: 0;
    text-align: right;
}
.top-event-indicator span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #38c58b; }
.event-dot.closed { background: #b7a4a9; }

.app-layout-horizontal .main-area { max-width: 1480px; padding: 33px 32px 56px; }
.app-layout-horizontal .page-header { align-items: center; margin-bottom: 24px; }
.app-layout-horizontal .page-header h1 { font-size: clamp(26px, 3vw, 36px); margin: 7px 0 3px; }
.page-eyebrow { text-transform: uppercase; font-weight: 800; letter-spacing: .1em; font-size: 10px; color: #a02b41; }
.page-eyebrow span { color: #aaa; padding: 0 4px; }
.page-header-actions { display: flex; align-items: end; justify-content: flex-end; gap: 10px; }
.page-header-actions .event-picker-label { margin: 0; min-width: 270px; max-width: 360px; }
.page-header-actions .event-picker-label span { color: #64646a; font-size: 11px; letter-spacing: .03em; }
.page-header-actions .event-picker { min-height: 43px; border-color: #d9d9de; }
.page-header-actions .refresh-top { min-height: 43px; }

.management-workspace { display: grid; gap: 19px; }
.management-overview {
    background: white;
    border-radius: 20px;
    border: 1px solid #e7e7ea;
    box-shadow: 0 5px 22px rgba(0,0,0,.035);
    padding: 25px;
    display: grid;
    gap: 21px;
}
.overview-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.overview-heading h2 { font-size: clamp(22px,2.5vw,28px); letter-spacing: -.8px; margin: 4px 0 5px; }
.overview-heading p { margin: 0; font-size: 12px; color: #74747a; }
.section-kicker { font-size: 10px; font-weight: 800; letter-spacing: .15em; color: #9e2b3c; }
.overview-block { display: grid; gap: 13px; }
.overview-block + .overview-block { border-top: 1px solid #ececef; padding-top: 20px; }
.overview-block-title { display: flex; align-items: center; gap: 12px; }
.overview-block-title h3 { font-size: 15px; margin: 0 0 3px; }
.overview-block-title p { font-size: 12px; color: #787880; margin: 0; }
.overview-symbol { background: #fff0f3; color: #c8102e; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; font-size: 20px; }
.overview-symbol.gift { background: #f3f1f2; color: #303035; }
.management-stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.management-stat-grid.gifts { grid-template-columns: repeat(3,minmax(0,1fr)); }
.management-stat {
    border: 1px solid #ebebed;
    border-radius: 14px;
    background: #f9f9fa;
    padding: 16px 17px;
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 6px;
}
.management-stat > span { color: #65656b; font-size: 12px; font-weight: 600; }
.management-stat strong { font-size: clamp(24px,3vw,34px); line-height: 1.1; letter-spacing: -1.2px; color: #1d1d20; font-variant-numeric: tabular-nums; }
.management-stat small { font-size: 10px; color: #8c8c91; }
.management-stat.positive strong { color: #12734f; }
.management-stat.pending strong { color: #9c6415; }
.management-stat.negative strong { color: #c8102e; }

.management-subnav {
    display: flex;
    overflow-x: auto;
    gap: 5px;
    border-bottom: 1px solid #dfdfe2;
    scrollbar-width: thin;
}
.management-subnav button {
    flex: 0 0 auto;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 13px 17px;
    color: #66666d;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.management-subnav button.active { border-bottom-color: #c8102e; color: #ac0f2b; }
.management-subnav button:hover { background: #f1e6e9; }
.management-content { min-width: 0; }
.management-content .panel { border-radius: 18px; }
.management-content .panel .toolbar { row-gap: 14px; }
.management-content .table-wrap { max-width: 100%; }
.management-content .data-table th { background: #fbfbfc; }
.management-content .data-table tbody tr:hover { background: #fcf8f9; }

.status-filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 2px 0 18px; }
.filter-chip {
    border: 1px solid #dfdfe2;
    border-radius: 999px;
    background: #fff;
    padding: 8px 13px;
    color: #606068;
    font-size: 12px;
    font-weight: 700;
}
.filter-chip:hover { background: #fcf0f3; }
.filter-chip.active { background: #1f1f23; color: #fff; border-color: #1f1f23; }

.scan-workspace { display: grid; gap: 18px; max-width: 1020px; margin: 0 auto; }
.mode-select-panel {
    border: 1px solid #e5e5e8;
    border-radius: 20px;
    background: #fff;
    padding: 23px;
    display: grid;
    grid-template-columns: minmax(200px,.9fr) minmax(380px,1.1fr);
    gap: 25px;
    align-items: center;
}
.mode-select-copy h2 { margin: 5px 0 4px; font-size: 20px; }
.mode-select-copy p { margin: 0; font-size: 12px; line-height: 1.55; color: #7b7b80; }
.mode-select-buttons { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.scan-mode {
    border-radius: 14px;
    min-width: 0;
    padding: 14px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    border: 2px solid #e1e1e5;
    background: #fafafb;
    color: #29292d;
}
.scan-mode.selected { border-color: #b50c2b; background: #fff1f4; }
.scan-mode strong, .scan-mode small { display: block; }
.scan-mode strong { font-size: 14px; }
.scan-mode small { font-size: 11px; color: #696970; margin-top: 3px; }
.mode-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #26262b; color: #fff; font-size: 23px; flex: 0 0 auto; }
.scan-mode.selected .mode-icon { background: #c8102e; }
.scan-workspace .fullscreen-panel { max-width: none; }
.scan-workspace .scan-box { min-height: 320px; }
.scan-workspace .fullscreen-panel .panel { border-radius: 20px; }

@media (max-width: 950px) {
    .top-nav-brand-row, .top-nav-bottom { width: min(100% - 32px, 1420px); }
    .app-layout-horizontal .main-area { padding: 25px 18px 42px; }
    .top-event-indicator { max-width: 230px; }
    .mode-select-panel { grid-template-columns: 1fr; gap: 15px; }
}
@media (max-width: 700px) {
    .top-nav-brand-row { min-height: 65px; }
    .top-brand .brand-logo { width: 80px; height: 36px; }
    .top-brand-label strong { font-size: 13px; }
    .top-brand-label small { font-size: 8px; }
    .top-user > div { display: none; }
    .user-avatar { display: none; }
    .top-logout { padding: 8px 9px; margin-left: 0; }
    .top-nav-bottom { display: block; }
    .top-nav { width: 100%; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0; }
    .top-nav button { min-width: 0; padding: 14px 4px 13px; border-radius: 8px 8px 0 0; font-size: 11px; gap: 5px; }
    .top-nav .nav-icon { font-size: 17px; }
    .top-event-indicator { display: none; }
    .app-layout-horizontal .page-header { display: grid; gap: 14px; }
    .page-header-actions { justify-content: stretch; }
    .page-header-actions .event-picker-label { flex: 1; min-width: 0; }
    .page-header-actions .refresh-top { padding: 10px 11px; font-size: 12px; }
    .management-overview { padding: 17px; border-radius: 17px; gap: 17px; }
    .management-stat-grid.guests { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .management-stat-grid.gifts { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .management-stat { padding: 11px 10px; }
    .management-stat strong { font-size: 26px; }
    .management-stat > span { font-size: 10px; }
    .overview-block-title p { font-size: 11px; }
    .management-subnav button { padding: 12px 11px; font-size: 12px; }
    .mode-select-panel { padding: 16px; }
    .scan-workspace .scan-box { min-height: 270px; }
}
@media (max-width: 390px) {
    .top-nav-brand-row, .top-nav-bottom { width: calc(100% - 24px); }
    .top-brand { gap: 7px; }
    .top-brand .brand-logo { width: 67px; }
    .top-nav button { font-size: 10px; }
    .top-nav .nav-icon { display: none; }
    .management-stat-grid.gifts { grid-template-columns: 1fr 1fr; }
    .management-stat-grid.gifts .management-stat:first-child { grid-column: 1 / -1; }
    .mode-select-buttons { gap: 7px; }
    .scan-mode { padding: 10px 8px; gap: 6px; }
    .mode-icon { width: 28px; height: 28px; font-size: 17px; }
    .scan-mode strong { font-size: 12px; }
    .scan-mode small { font-size: 9px; }
}

/* Schede mobile: non costringere la hostess a scorrere grandi tabelle. */
.guest-mobile-list, .gift-mobile-list { display: none; }
@media (max-width: 750px) {
    .management-content .guest-desktop-table,
    .management-content .gift-desktop-table { display: none; }
    .guest-mobile-list, .gift-mobile-list { display: grid; gap: 11px; }
    .mobile-person-card { border: 1px solid #e6e6e9; background: #fff; border-radius: 14px; padding: 13px; min-width: 0; }
    .mobile-person-main { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
    .mobile-person-main .avatar { width: 37px; height: 37px; flex: 0 0 37px; }
    .mobile-person-name { display: grid; min-width: 0; flex: 1 1 110px; gap: 3px; }
    .mobile-person-name strong { color: #29292d; font-size: 14px; overflow-wrap: anywhere; }
    .mobile-person-name small { color: #75757c; font-size: 11px; }
    .mobile-person-main .pill { font-size: 10px; }
    .mobile-company-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 38px; background: #fff0f3; color: #b60d2f; font-size: 21px; }
    .mobile-person-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: #565660; margin: 11px 0; }
    .mobile-person-meta b { color: #313138; }
    .mobile-person-contact { overflow-wrap: anywhere; font-size: 11px; margin: 8px 0; color: #73737b; }
    .mobile-person-actions { border-top: 1px solid #efeff0; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 7px; }
    .mobile-person-actions .btn { font-size: 11px; padding: 8px 10px; line-height: 1.25; }
    .mobile-person-actions .btn.primary { flex-grow: 1; }
    .management-content .panel { padding: 15px; }
}
@media (max-width: 360px) {
    .app-layout-horizontal .main-area { padding: 22px 12px; }
    .page-header-actions { flex-wrap: wrap; }
    .page-header-actions .refresh-top { flex: 1; }
    .top-nav button { font-size: 9px; }
    .management-content .panel { padding: 12px; }
}

/* Correzione minima dell'overflow sotto 360 px, senza cambiare la Dashboard. */
@media (max-width: 950px) {
    .app-layout-horizontal .columns { grid-template-columns: minmax(0, 1fr); }
    .app-layout-horizontal .columns > div,
    .app-layout-horizontal .columns .panel { min-width: 0; }
}
@media (max-width: 360px) {
    .app-layout-horizontal .columns .panel-head,
    .app-layout-horizontal .columns .flex-row { flex-wrap: wrap; }
}


/* ################################################################
   V1.9 — RESTYLING "ELCOM LINEA"
   Strato grafico sovrapposto: nessuna classe o logica modificata.
   Per tornare alla grafica precedente basta eliminare da qui in giù.
   Palette: rosso logo Elcom #E30613, nero, bianco, grigi neutri.
   Motivo grafico: le "linee di velocità" del pittogramma Elcom.
   ################################################################ */

@font-face { font-family: "Barlow"; src: url("/fonts/barlow-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-latin-700-normal.woff2") format("woff2"); font-weight: 700 900; font-display: swap; }
@font-face { font-family: "Barlow SC"; src: url("/fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Barlow SC"; src: url("/fonts/barlow-semi-condensed-latin-800-normal.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }
@font-face { font-family: "Barlow SC"; src: url("/fonts/barlow-semi-condensed-latin-700-italic.woff2") format("woff2"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Barlow SC"; src: url("/fonts/barlow-semi-condensed-latin-800-italic.woff2") format("woff2"); font-weight: 800 900; font-style: italic; font-display: swap; }

:root {
    --brand-red: #e30613;          /* rosso del logo Elcom */
    --brand-red-dark: #b8000e;
    --brand-red-soft: #fff1f1;
    --brand-black: #121212;
    --brand-black-soft: #1e1e1e;
    --bg: #f2f2f0;
    --paper: #ffffff;
    --ink: #161616;
    --muted: #5f5f63;
    --line: #e3e3e1;
    --success: #13784a;
    --danger: #d10512;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 18px rgba(0,0,0,.05);
    --focus-ring: rgba(227, 6, 19, .2);
    --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-display: "Barlow SC", "Barlow", system-ui, sans-serif;
    /* linee di velocità del pittogramma */
    --speed-lines: repeating-linear-gradient(180deg, var(--brand-red) 0 3px, transparent 3px 7px);
}

body { font-family: var(--font-body); font-size: 15px; background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, .stat strong, .management-stat strong { font-family: var(--font-display); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(227, 6, 19, .45); outline-offset: 2px; }

/* ---------- Logo: ritaglio automatico del PNG quadrato ---------- */
.brand-logo,
.top-brand .brand-logo,
.public-invite-logo {
    box-sizing: content-box;
    height: auto;
    max-height: none;
    aspect-ratio: 500 / 100;
    object-fit: cover;
    object-position: 50% 50%;
}
.top-brand .brand-logo {
    width: 132px;
    padding: 9px 22px 9px 18px;
    border-radius: 0;
    background: #fff;
    clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
}
.login-card .brand-logo { width: 230px; margin: 0 0 6px -6px; padding: 0; }
.public-invite-logo { width: min(220px, 70%); }

/* ---------- Accesso ---------- */
.login-layout {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 85% 0%, rgba(227, 6, 19, .22), transparent 55%),
        var(--brand-black);
}
.login-layout::before {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    width: 46vw; height: 76px;
    transform: translateY(-50%);
    background: var(--speed-lines);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 85%);
            mask-image: linear-gradient(90deg, transparent, #000 85%);
    opacity: .9;
}
.login-card {
    position: relative;
    border-radius: 6px;
    padding: 44px 40px 38px;
    border-top: 6px solid var(--brand-red);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.login-card h1 { font-style: italic; font-weight: 800; font-size: 32px; letter-spacing: -.2px; text-transform: uppercase; margin: 18px 0 6px; }
.form-field label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #3a3a3d; }
.form-field input { border-radius: 8px; border-color: #d4d4d2; height: 50px; background: #fafaf9; }
.form-field input:focus { background: #fff; }

/* ---------- Testata e navigazione ---------- */
.app-layout.app-layout-horizontal { background: var(--bg); }
.app-layout-horizontal .top-nav-shell {
    background: var(--brand-black);
    border-bottom: 0;
    box-shadow: none;
    overflow: hidden;
}
.app-layout-horizontal .top-nav-shell::before {
    content: "";
    position: absolute;
    right: 0; top: 18px;
    width: 42%; height: 39px;
    background: var(--speed-lines);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000);
            mask-image: linear-gradient(90deg, transparent, #000);
    opacity: .28;
    pointer-events: none;
}
.top-nav-brand-row, .top-nav-bottom { position: relative; }
.top-brand { gap: 16px; }
.top-brand-label strong { display: none; }
.top-brand-label small {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: .04em;
    color: #fff;
}
.user-avatar { background: var(--brand-red); border-color: var(--brand-red); border-radius: 8px; }
.top-logout { border-radius: 8px; border-color: #3d3d40; }
.top-logout:hover { background: var(--brand-red); border-color: var(--brand-red); }

.top-nav-bottom { min-height: 54px; }
.top-nav { gap: 2px; align-self: end; }
.top-nav button {
    border-radius: 8px 8px 0 0;
    border-bottom: 0;
    border-top: 3px solid transparent;
    padding: 14px 22px 15px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #b9b9bd;
}
.top-nav button:hover { background: #1f1f21; color: #fff; }
.top-nav button.active {
    background: var(--bg);
    color: var(--ink);
    border-top-color: var(--brand-red);
}
.top-nav button.active .nav-icon { color: var(--brand-red); }
.top-event-indicator { font-weight: 600; color: #e2e2e4; padding-bottom: 4px; }
.event-dot { box-shadow: 0 0 0 4px rgba(56, 197, 139, .18); }

/* ---------- Intestazione pagina ---------- */
.app-layout-horizontal .main-area { padding-top: 30px; }
.page-eyebrow { color: var(--brand-red); font-size: 11px; letter-spacing: .14em; }
.app-layout-horizontal .page-header h1 {
    font-style: italic;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -.3px;
    font-size: clamp(30px, 3.4vw, 44px);
    line-height: 1;
    margin: 8px 0 6px;
}
.page-header p { font-size: 15px; }
.event-picker, .page-header-actions .event-picker { border-radius: 8px; border-color: #d4d4d2; font-weight: 600; }

/* ---------- Pulsanti ---------- */
.btn {
    border-radius: 8px;
    border-color: #d4d4d2;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}
.btn:hover { background: #fff; border-color: var(--ink); }
.btn.primary { background: var(--brand-red); border-color: var(--brand-red); }
.btn.primary:hover { background: var(--brand-red-dark); border-color: var(--brand-red-dark); }
.btn.secondary { background: var(--brand-black); border-color: var(--brand-black); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--brand-red-soft); border-color: var(--danger); }
.btn.small { font-size: 12.5px; padding: 7px 11px; border-radius: 7px; }
.btn:disabled:hover { background: inherit; border-color: #d4d4d2; }

/* Gerarchia nelle righe invitati: un solo pulsante rosso (Check-in). */
.btn.primary[data-action="email-one"] { background: var(--brand-black); border-color: var(--brand-black); }
.btn.primary[data-action="email-one"]:hover { background: #333; border-color: #333; }
.btn[data-action="disable"] { border-color: transparent; background: transparent; color: #8a8a8e; }
.btn[data-action="disable"]:hover { color: var(--danger); background: var(--brand-red-soft); border-color: transparent; }

/* ---------- Pannelli e indicatori ---------- */
.stat, .panel { border-radius: var(--radius); border-color: var(--line); box-shadow: var(--shadow); }
.panel { padding: 24px; }
.panel-head h2 { font-size: 20px; font-weight: 700; letter-spacing: 0; }
.panel-head p { font-size: 13.5px; }
.panel-head > strong { font-family: var(--font-display); font-weight: 800; font-size: 30px; }

.stat { position: relative; padding: 20px 22px 18px; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ink); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.stat-label i { font-size: 17px; color: #9a9a9e; }
.stat strong { font-weight: 800; font-size: 56px; line-height: 1; letter-spacing: -1px; margin-top: 14px; font-variant-numeric: tabular-nums; }
.stat small { font-size: 13px; }
/* Indicatore principale: persone entrate */
.stat.present { background: var(--brand-black); border-color: var(--brand-black); color: #fff; }
.stat.present::before { background: var(--brand-red); }
.stat.present::after {
    content: ""; position: absolute; right: -10px; bottom: 18px; width: 55%; height: 32px;
    background: var(--speed-lines);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000); mask-image: linear-gradient(90deg, transparent, #000);
    opacity: .55;
}
.stat.present .stat-label, .stat.present small, .stat.present .stat-label i { color: #c9c9cc; }
.stat.present strong { color: #fff; position: relative; z-index: 1; }

.progress-track { height: 16px; border-radius: 4px; background: #ececea; margin: 22px 0 10px; }
.progress-bar {
    border-radius: 4px;
    background:
        repeating-linear-gradient(115deg, rgba(255,255,255,.16) 0 8px, transparent 8px 16px),
        var(--brand-red);
}
.bar-track { height: 8px; border-radius: 3px; background: #ececea; }
.bar-fill { border-radius: 3px; background: var(--brand-red); }
.bar-row .flex-row strong { font-variant-numeric: tabular-nums; font-weight: 600; }

.avatar { border-radius: 8px; background: var(--brand-black); color: #fff; font-family: var(--font-display); font-size: 13px; }
.guest-row { border-bottom-color: #efefed; }
.mini-time { font-variant-numeric: tabular-nums; }

/* ---------- Etichette di stato ---------- */
.pill { border-radius: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 5px 8px; }
.pill.ok { background: #e3f4ea; color: #0f6a40; }
.pill.wait { background: #efefed; color: #4e4e52; }
.pill.bad { background: var(--brand-red-soft); color: var(--danger); }
.top-state { border-radius: 5px; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }

/* ---------- Gestione evento ---------- */
.management-overview { border-radius: var(--radius); border-color: var(--line); box-shadow: var(--shadow); padding: 26px; }
.overview-heading h2 { font-style: italic; font-weight: 800; text-transform: uppercase; letter-spacing: -.2px; font-size: clamp(24px, 2.6vw, 32px); }
.section-kicker { color: var(--brand-red); letter-spacing: .16em; }
.overview-block-title h3 { font-size: 17px; font-weight: 700; }
.overview-symbol { border-radius: 8px; background: var(--brand-black); color: #fff; }
.overview-symbol.gift { background: var(--brand-red); color: #fff; }
.management-stat { position: relative; background: #fff; border-color: var(--line); border-radius: 10px; padding: 16px 18px 15px; }
.management-stat::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 2px 2px 0; background: #cfcfcd; }
.management-stat.positive::before { background: #13784a; }
.management-stat.pending::before { background: #c27a12; }
.management-stat.negative::before { background: var(--brand-red); }
.management-stat > span { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.management-stat strong { font-weight: 800; font-size: clamp(30px, 3.4vw, 44px); letter-spacing: -.5px; color: var(--ink); }
.management-stat.positive strong { color: #13784a; }
.management-stat.pending strong { color: #a8650a; }

.management-subnav { border-bottom: 2px solid #dcdcda; gap: 2px; }
.management-subnav button {
    margin-bottom: -2px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #6a6a6e;
}
.management-subnav button:hover { background: transparent; color: var(--ink); }
.management-subnav button.active { color: var(--ink); border-bottom-color: var(--brand-red); }
.management-content .panel { border-radius: var(--radius); }

.searchbar { border-radius: 8px; border-color: #d4d4d2; }
.filter-chip { border-radius: 6px; font-size: 12.5px; font-weight: 600; border-color: #d4d4d2; color: #48484c; }
.filter-chip:hover { background: #fff; border-color: var(--ink); }
.filter-chip.active { background: var(--brand-black); border-color: var(--brand-black); }

.data-table th { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: #6a6a6e; }
.management-content .data-table th { background: #f6f6f4; }
.management-content .data-table th:first-child { border-radius: 6px 0 0 6px; }
.management-content .data-table th:last-child { border-radius: 0 6px 6px 0; }
.data-table td { font-size: 14px; border-bottom-color: #efefed; }
.management-content .data-table tbody tr:hover { background: #fafaf8; }
.management-content .data-table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--brand-red); }

.bulk-mail-panel { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--brand-red); border-radius: 10px; }
.bulk-mail-header h3 { font-family: var(--font-display); font-size: 19px; color: var(--ink); }
.bulk-mail-count { border-radius: 6px; background: var(--brand-red); font-weight: 700; }
.notice { background: #fff; border-color: var(--line); border-left: 4px solid var(--brand-red); border-radius: 8px; color: #3c3c40; }
.warning { border-radius: 8px; }
.event-card { border-radius: 10px; }
.event-card.selected { border-color: var(--brand-red); box-shadow: inset 4px 0 0 var(--brand-red); }

/* ---------- Postazione QR ---------- */
.mode-select-panel { border-radius: var(--radius); border-color: var(--line); box-shadow: var(--shadow); }
.mode-select-copy h2 { font-size: 23px; }
.scan-mode { border-radius: 10px; border-width: 2px; background: #fff; }
.scan-mode.selected { border-color: var(--brand-red); background: var(--brand-red-soft); }
.mode-icon { border-radius: 7px; background: var(--brand-black); }
.scan-mode.selected .mode-icon { background: var(--brand-red); }

/* Inquadratura con angoli al posto del bordo tratteggiato */
.scan-box, .gift-scan-box {
    --c: var(--brand-red);
    border: 0;
    border-radius: 10px;
    background:
        linear-gradient(var(--c), var(--c)) top 18px left 18px / 34px 4px,
        linear-gradient(var(--c), var(--c)) top 18px left 18px / 4px 34px,
        linear-gradient(var(--c), var(--c)) top 18px right 18px / 34px 4px,
        linear-gradient(var(--c), var(--c)) top 18px right 18px / 4px 34px,
        linear-gradient(var(--c), var(--c)) bottom 18px left 18px / 34px 4px,
        linear-gradient(var(--c), var(--c)) bottom 18px left 18px / 4px 34px,
        linear-gradient(var(--c), var(--c)) bottom 18px right 18px / 34px 4px,
        linear-gradient(var(--c), var(--c)) bottom 18px right 18px / 4px 34px,
        radial-gradient(ellipse at 50% 120%, rgba(227, 6, 19, .22), transparent 60%),
        var(--brand-black);
    background-repeat: no-repeat;
}
.scan-box h2 { font-size: 26px; font-style: italic; font-weight: 800; text-transform: uppercase; }
.scan-illustration { color: var(--brand-red); }
.scan-box .btn.primary { padding: 13px 26px; font-size: 15px; }
.scan-frame { border-style: solid; border-radius: 10px; }
.fullscreen-panel .hint { margin-top: 14px; }
.group-count { border-radius: 10px; background: #fff; border-color: var(--line); }
.count-stepper button, .count-stepper input { border-radius: 8px; border-color: #d4d4d2; }
.count-stepper input { font-family: var(--font-display); }

/* ---------- Finestre, avvisi, pagina pubblica ---------- */
.modal { border-radius: 10px; border-top: 5px solid var(--brand-red); }
.toast { border-radius: 8px; border-left: 4px solid var(--brand-red); font-weight: 600; }
.toast.error { background: var(--brand-red-dark); border-left-color: #fff; }
.public-invite-layout { background: radial-gradient(ellipse at 85% 0%, rgba(227, 6, 19, .22), transparent 55%), var(--brand-black); }
.public-invite-card { border-radius: 6px; border-top: 6px solid var(--brand-red); }
.footer-note { color: #8a8a8e; }

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
    body { font-size: 14px; }
    .top-brand .brand-logo { width: 92px; padding: 7px 16px 7px 13px; height: auto; }
    .top-brand-label small { font-size: 13px; }
    .app-layout-horizontal .top-nav-shell::before { top: 14px; width: 55%; height: 32px; }
    .top-nav button { font-size: 12px; letter-spacing: .03em; padding: 12px 4px 13px; }
    .app-layout-horizontal .page-header h1 { font-size: 32px; }
    .stat strong { font-size: 40px; margin-top: 10px; }
    .stat-label { font-size: 10.5px; }
    .stat small { font-size: 12px; }
    .stat.present::after { height: 22px; bottom: 14px; }
    .management-stat strong { font-size: 30px; }
    .management-stat > span { font-size: 10px; }
    .mobile-person-card { border-radius: 10px; border-color: var(--line); }
    .mobile-company-icon { border-radius: 8px; background: var(--brand-black); color: #fff; }
    .login-card { padding: 34px 24px 28px; }
    .login-card h1 { font-size: 27px; }
    .login-card .brand-logo { width: 190px; }
    .login-layout::before { width: 70vw; top: 7%; transform: none; height: 54px; }
}
@media (max-width: 620px) {
    .stat { padding: 14px 14px 13px 16px; }
    .panel { padding: 18px; }
    .flex-row:has(> .btn.primary[data-view]) { flex-wrap: wrap; }
}
@media (max-width: 390px) {
    .top-brand .brand-logo { width: 76px; }
    .top-nav button { font-size: 11px; }
}
@media print {
    .top-nav-shell { display: none !important; }
}


/* ################################################################
   V1.9.1 — ICONE SVG (solo CSS)
   I simboli Unicode di app.js restano nel markup per accessibilità
   ma vengono sostituiti visivamente da icone a tratto (mask-image).
   La CSP consente le immagini data: (img-src 'self' data:).
   ################################################################ */
:root {
    --ic-dashboard: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='9' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='5' rx='1.5'/%3E%3Crect x='14' y='12' width='7' height='9' rx='1.5'/%3E%3Crect x='3' y='16' width='7' height='5' rx='1.5'/%3E%3C/svg%3E");
    --ic-event: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='4' width='14' height='17' rx='2'/%3E%3Cpath d='M9 2.5h6v3.5H9z'/%3E%3Cpath d='M9 11h6M9 15h4'/%3E%3C/svg%3E");
    --ic-qr: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8V5a2 2 0 0 1 2-2h3M16 3h3a2 2 0 0 1 2 2v3M21 16v3a2 2 0 0 1-2 2h-3M8 21H5a2 2 0 0 1-2-2v-3'/%3E%3Crect x='7' y='7' width='4' height='4'/%3E%3Crect x='13' y='7' width='4' height='4'/%3E%3Crect x='7' y='13' width='4' height='4'/%3E%3Cpath d='M13 13h4v4'/%3E%3C/svg%3E");
    --ic-users: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20c.6-3.6 3.3-5.5 6.5-5.5s5.9 1.9 6.5 5.5'/%3E%3Cpath d='M16 4.6a3.5 3.5 0 0 1 0 6.8M18 14.8c1.9.7 3.1 2.4 3.5 5.2'/%3E%3C/svg%3E");
    --ic-gift: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='8' width='18' height='4' rx='1'/%3E%3Cpath d='M5 12v8a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-8M12 8v13'/%3E%3Cpath d='M12 8S10.5 3.5 8 3.5A2.25 2.25 0 0 0 8 8M12 8s1.5-4.5 4-4.5A2.25 2.25 0 0 1 16 8'/%3E%3C/svg%3E");
    --ic-calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3Cpath d='M8 14h3v3H8z'/%3E%3C/svg%3E");
    --ic-sliders: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1'/%3E%3Ccircle cx='15' cy='6' r='2'/%3E%3Ccircle cx='9' cy='12' r='2'/%3E%3Ccircle cx='17' cy='18' r='2'/%3E%3C/svg%3E");
    --ic-history: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8'/%3E%3Cpath d='M3 3v5h5M12 7v5l3 2'/%3E%3C/svg%3E");
    --ic-user-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20c.6-3.6 3.3-5.5 6.5-5.5 1.6 0 3 .5 4.1 1.3'/%3E%3Cpath d='M15 18l2 2 4-4'/%3E%3C/svg%3E");
    --ic-user-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 20c.6-3.6 3.3-5.5 6.5-5.5 1.6 0 3 .5 4.1 1.3'/%3E%3Cpath d='M18 14v6M15 17h6'/%3E%3C/svg%3E");
    --ic-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
    --ic-building: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21V5a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v16M15 9h4a1 1 0 0 1 1 1v11M2 21h20M8 8h3M8 12h3M8 16h3'/%3E%3C/svg%3E");
    --ic-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E");
}
.top-nav .nav-icon,
.management-subnav button > span[aria-hidden],
.stats .stat-label i,
.overview-symbol::before,
.mode-icon::before,
.mobile-company-icon::before {
    display: inline-block;
    flex: 0 0 auto;
    font-size: 0 !important;
    color: inherit;
    background-color: currentColor;
    -webkit-mask: var(--ic) center / contain no-repeat;
            mask: var(--ic) center / contain no-repeat;
}
/* Menu principale */
.top-nav .nav-icon { width: 19px; height: 19px; }
.top-nav button[data-view="dashboard"] .nav-icon { --ic: var(--ic-dashboard); }
.top-nav button[data-view="event-management"] .nav-icon { --ic: var(--ic-event); }
.top-nav button[data-view="scanner"] .nav-icon { --ic: var(--ic-qr); }
/* Sotto-menu Gestione evento */
.management-subnav button { display: inline-flex; align-items: center; gap: 8px; }
.management-subnav button > span[aria-hidden] { width: 17px; height: 17px; }
.management-subnav button.active > span[aria-hidden] { color: var(--brand-red); }
.management-subnav button[data-section="guests"] > span { --ic: var(--ic-users); }
.management-subnav button[data-section="gifts"] > span { --ic: var(--ic-gift); }
.management-subnav button[data-section="events"] > span { --ic: var(--ic-calendar); }
.management-subnav button[data-section="manage"] > span { --ic: var(--ic-sliders); }
.management-subnav button[data-section="audit"] > span { --ic: var(--ic-history); }
/* Indicatori dashboard */
.stats .stat-label { align-items: flex-start; }
.stats .stat-label i { width: 22px; height: 22px; color: #9a9a9e; }
.stats .stat:nth-child(1) .stat-label i { --ic: var(--ic-users); }
.stats .stat:nth-child(2) .stat-label i { --ic: var(--ic-user-check); color: var(--brand-red); }
.stats .stat:nth-child(3) .stat-label i { --ic: var(--ic-user-plus); }
.stats .stat:nth-child(4) .stat-label i { --ic: var(--ic-clock); }
/* Riquadri con simbolo (testo originale nascosto, icona in ::before) */
.overview-symbol, .mode-icon, .mobile-company-icon { font-size: 0 !important; }
.overview-symbol::before, .mode-icon::before, .mobile-company-icon::before { content: ""; width: 21px; height: 21px; }
.overview-symbol::before { --ic: var(--ic-users); }
.overview-symbol.gift::before { --ic: var(--ic-gift); }
.scan-mode[data-kind="ticket"] .mode-icon::before { --ic: var(--ic-qr); }
.scan-mode[data-kind="gift"] .mode-icon::before { --ic: var(--ic-gift); }
.mobile-company-icon::before { --ic: var(--ic-building); width: 19px; height: 19px; }
@media (max-width: 700px) {
    .top-nav button { flex-direction: column; gap: 5px; }
    .top-nav .nav-icon { width: 20px; height: 20px; }
}
@media (max-width: 390px) { .top-nav .nav-icon { display: inline-block; } }

/* v1.9 - nuove componenti Corpo Mail / modifica evento */
.mail-template-panel .notice { margin-bottom: 20px; }
.mail-template-form { display: grid; gap: 16px; }
.mail-template-form .form-field { min-width: 0; }
.mail-template-form textarea { display: block; width: 100%; min-height: 270px; resize: vertical;
  font: 15px/1.65 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  padding: 14px 16px; border: 1px solid #dadada; border-radius: 12px; background: #fff; color: #242424; }
.mail-template-form textarea:focus { outline: 2px solid #c8102e; outline-offset: 1px; }
.mail-token-guide { padding: 15px; background: #f8f7f7; border: 1px solid #e6e2e2; border-radius: 12px; }
.mail-token-guide p { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.mail-token-guide code { font-size: 12px; background: white; border: 1px solid #e8e1e3;
  padding: 5px 7px; border-radius: 6px; color: #a40b23; }
.mail-template-actions { margin-top: 3px; flex-wrap: wrap; }
.mail-template-preview { margin-top: 22px; padding: 18px; background: #fff9f9;
  border: 1px solid #e6d2d5; border-radius: 14px; }
.mail-template-preview pre { font: inherit; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .mail-template-actions .btn { width: 100%; }
  .mail-template-form textarea { min-height: 310px; font-size: 14px; }
}


/* Rifiniture componenti v1.9 per il restyling ELCOM LINEA preservato. */
.mail-template-panel textarea { font-family: var(--font-body); border-radius: 8px; }
.mail-template-form textarea:focus { outline-color: var(--brand-red); }
.mail-token-guide code { color: var(--brand-red-dark); }
.mail-template-panel .notice { border-left-color: var(--brand-red); }
:root {
  --ic-mail: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='m3 7 9 7 9-7'/%3E%3C/svg%3E");
}
.management-subnav button[data-section="mail"] > span { --ic: var(--ic-mail); }

/* ============================================================
   V1.9.1 · ELCOM LINEA — layout compatto e popup operativi
   (aggiunte non distruttive al restyling già presente)
   ============================================================ */
body.modal-open { overflow: hidden; }
.modal-backdrop { overscroll-behavior: contain; }
.modal.modal-wide {
    width: min(740px, 100%);
    max-height: min(90dvh, 900px);
    overflow-y: auto;
    padding: clamp(18px, 3vw, 30px);
    border-radius: 13px;
}
.dialog-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}
.dialog-heading h2 { font-size: clamp(20px, 2vw, 25px); margin: 0 0 5px; }
.dialog-heading p { margin: 0; font-size: 13px; line-height: 1.45; }
.dialog-close {
    flex: 0 0 36px;
    width: 36px; height: 36px;
    background: #f6f6f6; border: 1px solid #dedede;
    border-radius: 8px; font-size: 17px; line-height: 1;
    color: var(--ink);
}
.dialog-close:disabled { opacity: .45; cursor: not-allowed; }
.modal-wide .form-field input,
.modal-wide .form-field select { width: 100%; }
.modal-wide .modal-actions { margin-top: 24px; }
.compact-section-header { flex-wrap: wrap; }
.compact-section-header .btn { flex: 0 0 auto; }
.compact-operation-panel { margin-bottom: 18px; }
.compact-operation-panel .panel-head { margin-bottom: 0; }
/* Filtro e invio allineati sulla medesima riga su desktop. */
.guests-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-bottom: 18px;
}
.guests-filter-row .status-filters { margin-bottom: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.guest-toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-left: auto; }
.bulk-email-trigger { white-space: normal; text-align: center; }
/* Il massivo è tutto nel dialog, non occupa spazio sopra la tabella. */
.modal-wide .bulk-mail-panel { margin: 0; padding: 0; box-shadow: none; border: 0; }
.modal-wide .bulk-mail-details { font-size: 13px; line-height: 1.65; }
.modal-wide .bulk-mail-details p { margin: 0 0 10px; }
.bulk-progress {
    margin: 18px 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fcfcfc;
}
.bulk-progress-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; font-size: 13px; margin-bottom: 8px; }
.bulk-progress progress { display: block; width: 100%; height: 11px; accent-color: var(--brand-red); }
.modal-wide .bulk-mail-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.modal-wide .bulk-mail-header { align-items: start; }
.modal-wide .bulk-mail-count { flex: 0 0 auto; }
@media (max-width: 720px) {
    .modal-backdrop { padding: 12px; }
    .modal.modal-wide { max-height: 92dvh; width: 100%; padding: 20px 16px; }
    .modal-wide .form-grid { grid-template-columns: 1fr; }
    .guests-filter-row { align-items: stretch; }
    .guest-toolbar-actions { margin-left: 0; width: 100%; }
    .guest-toolbar-actions .btn { flex: 1 1 155px; }
}
@media (max-width: 420px) {
    .dialog-heading { gap: 8px; }
    .modal-wide .bulk-mail-header { flex-wrap: wrap; }
    .modal-wide .bulk-mail-actions .btn { width: 100%; }
}

/* A evento attivo il riepilogo mostra 3 stati, a evento chiuso 4. */
.management-stat-grid.guests:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media(max-width:700px) { .management-stat-grid.guests:has(> :nth-child(3):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }


/* ============================================================
   V1.9.2 · Scelta evento dedicata e riepilogo comprimibile
   Il tema ELCOM LINEA originale resta invariato.
   ============================================================ */
.event-selection-landing { padding: clamp(28px, 4vw, 48px); text-align: center; }
.event-selection-landing h2 { font-family: var(--font-display, inherit); font-size: clamp(26px, 3.2vw, 39px); text-transform: uppercase; font-style: italic; margin: 10px 0; }
.event-selection-landing p { max-width: 570px; margin: 0 auto 22px; line-height: 1.6; }
.event-choice-list { display: grid; gap: 12px; max-height: min(56dvh, 560px); overflow-y: auto; padding: 2px 4px 3px 0; }
.event-choice-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.event-choice-card.is-current { border-left: 4px solid var(--brand-red); }
.event-choice-info { min-width: 0; flex: 1; }
.event-choice-card .event-card-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.event-choice-card h3 { font-size: 17px; margin: 0; }
.event-choice-card p { margin: 6px 0; color: #626269; font-size: 12px; overflow-wrap: anywhere; }
.event-choice-card small { font-size: 12px; color: #74747b; }
.event-choice-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.event-choice-footer { border-top: 1px solid var(--line); margin-top: 17px; padding-top: 18px; display: flex; justify-content: flex-end; }
.change-event-button { white-space: nowrap; }
.management-overview .overview-heading { align-items: center; }
.overview-heading .overview-toggle { min-width: 0; flex: 1; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 18px; text-align: left; color: var(--ink); padding: 0; background: none; border: 0; }
.overview-heading .overview-toggle:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 5px; border-radius: 5px; }
.overview-heading-copy { display: grid; min-width: 0; gap: 5px; }
.overview-heading-copy strong { font-family: var(--font-display, inherit); font-style: italic; font-weight: 800; text-transform: uppercase; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.15; }
.overview-heading .overview-location { font-size: 12px; color: #74747a; overflow-wrap: anywhere; }
.overview-heading-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.overview-chevron { width: 11px; height: 11px; border-right: 2px solid var(--brand-black); border-bottom: 2px solid var(--brand-black); transform: rotate(-135deg); transition: transform .18s; flex: 0 0 auto; margin: 5px; }
.management-overview.is-collapsed .overview-chevron { transform: rotate(45deg); }
.overview-details { display: grid; gap: 21px; }
.overview-details[hidden] { display: none !important; }
.management-overview.is-collapsed { padding-top: 18px; padding-bottom: 18px; }
@media (max-width: 720px) {
  .event-choice-card { align-items: stretch; flex-direction: column; gap: 12px; }
  .event-choice-actions { justify-content: flex-start; }
  .event-choice-actions .btn { flex: 1 1 auto; }
  .event-choice-footer .btn { width: 100%; }
  .management-overview .overview-heading { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; }
  .management-overview .overview-toggle { width: 100%; }
  .overview-heading-copy strong { font-size: clamp(22px, 6.5vw, 28px); overflow-wrap: anywhere; }
  .overview-heading-actions { justify-content: flex-start; margin-left: 0; }
  .page-header-actions .change-event-button { flex: 1 1 auto; }
}

/* ################################################################
   V1.9.4 — INGRESSO RAPIDO: icone pulsanti
   QR ingresso e omaggio usano l'iconografia già presente;
   ricerca ospite usa una lente dedicata coerente con la UI attuale.
   ################################################################ */
.quick-actions-row { gap: 10px; flex-wrap: wrap; }
.quick-action-btn { display: inline-flex; align-items: center; gap: 9px; }
.quick-action-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    font-size: 0;
    color: inherit;
    background-color: currentColor;
    -webkit-mask: var(--ic) center / contain no-repeat;
            mask: var(--ic) center / contain no-repeat;
}
.quick-action-icon.ticket { --ic: var(--ic-qr); }
.quick-action-icon.gift { --ic: var(--ic-gift); }
.quick-action-icon.search { --ic: var(--ic-search); }
@media (max-width: 700px) {
    .quick-actions-row { gap: 8px; }
    .quick-action-btn { justify-content: center; width: 100%; }
}


/* V1.9.5 — Paginazione lista invitati, stile ELCOM LINEA */
.guest-pagination {
    margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.guest-page-size-label { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 650; color: var(--muted); }
.guest-page-size-label select {
    min-height: 35px; padding: 6px 28px 6px 10px; background: #fff;
    border: 1px solid #d4d4d2; border-radius: 7px; color: var(--ink); font: inherit;
}
.guest-page-summary, .guest-page-current { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.guest-page-controls { display: inline-flex; gap: 8px; align-items: center; }
.guest-page-controls .btn { white-space: nowrap; }
@media (max-width: 700px) {
    .guest-pagination { justify-content: center; gap: 10px; }
    .guest-page-controls { width: 100%; justify-content: space-between; }
    .guest-page-summary { margin-left: auto; }
}
@media (max-width: 390px) {
    .guest-pagination { flex-direction: column; align-items: stretch; }
    .guest-page-summary { margin: 0; }
    .guest-page-controls { gap: 5px; }
    .guest-page-controls .btn { padding: 7px; font-size: 11px; }
}

/* V1.9.5 — Dashboard: tre pannelli a sinistra; aziende alfabetiche scorrevoli a destra. */
.dashboard-columns { align-items: stretch; min-width: 0; }
.dashboard-left-stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dashboard-left-stack > .panel { margin: 0; }
.dashboard-companies-panel {
    display: flex; flex-direction: column; min-width: 0;
    min-height: 0; margin: 0;
    /* L'altezza della colonna destra è determinata dai tre riquadri a sinistra. */
}
.dashboard-companies-panel > .panel-head { flex: 0 0 auto; }
.dashboard-companies-scroll {
    flex: 1 1 auto; height: 0; min-height: 0;
    overflow-y: auto; overflow-x: hidden;
    scrollbar-width: thin; scrollbar-color: #a5a5a5 #f2f2f2;
    padding-right: 10px; overscroll-behavior: contain;
}
.dashboard-companies-scroll:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 2px; }
.dashboard-companies-scroll .bar-row:last-child { margin-bottom: 0; }
@media (max-width: 950px) {
    .dashboard-columns { grid-template-columns: minmax(0, 1fr); }
    .dashboard-companies-panel { height: auto; }
    .dashboard-companies-scroll { height: auto; flex: initial; max-height: 360px; }
}
