/* ==========================================================================
   Registro Visitatori — design system
   ========================================================================== */

:root {
    --bg: #f2f4f8;
    --surface: #ffffff;
    --surface-2: #f7f8fb;
    --ink: #0e1630;
    --ink-2: #3a4560;
    --muted: #6b7489;
    --line: #e3e7ef;
    --line-strong: #cfd5e1;

    --brand: #2f4bd8;
    --brand-strong: #1b2a6b;
    --brand-soft: #eef1fd;
    --accent: #0f9d8a;
    --accent-soft: #e6f6f3;

    --ok: #157a46;
    --ok-soft: #e7f5ed;
    --danger: #b42318;
    --danger-soft: #fdeceb;
    --warn: #a15c07;
    --warn-soft: #fdf3e3;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(14, 22, 48, .06);
    --shadow: 0 1px 2px rgba(14, 22, 48, .05), 0 8px 24px rgba(14, 22, 48, .06);
    --shadow-lg: 0 2px 4px rgba(14, 22, 48, .06), 0 18px 48px rgba(14, 22, 48, .12);
    --focus: 0 0 0 3px rgba(47, 75, 216, .28);

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 750; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
a { color: var(--brand); }
small { font-size: 13px; }

.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #2640c0; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-2); border-color: #b9c1d1; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(14, 22, 48, .05); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #f0c5c1; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #106238; }

.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: 17px; border-radius: var(--radius); }
.btn-xl { min-height: 64px; padding: 0 28px; font-size: 20px; border-radius: var(--radius); }
.btn-xl .icon { width: 24px; height: 24px; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; min-height: 32px; padding: 0; }

/* ---------- Forms ---------- */

.field { display: grid; gap: 6px; }
.field > span, .field-label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.field > .field-hint, .field-hint { font-size: 13px; font-weight: 400; color: var(--muted); }
.field-hint code { font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }

input[type="file"].input { padding: 6px; }
input[type="file"].input::file-selector-button {
    margin-right: 12px;
    padding: 6px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.input, .select, .textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.input::placeholder, .textarea::placeholder { color: #9aa2b4; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.select[multiple] { padding: 6px; }
.input-lg { min-height: 60px; padding: 12px 18px; font-size: 20px; border-radius: var(--radius); }

.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 42px; }
.input-icon > .input-lg { padding-left: 52px; }
.input-icon > .input-lg + .icon, .input-icon .icon-lg { width: 22px; height: 22px; left: 18px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}
.checkbox input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }

/* ---------- Surfaces ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-body { padding: 20px; }
.card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.card-head p { font-size: 13px; color: var(--muted); }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-weight: 550;
}
.alert .icon { margin-top: 2px; }
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: #c6e7d4; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: #f5cbc7; }
.alert-info { background: var(--brand-soft); color: var(--brand-strong); border-color: #d6ddfa; }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: #f3dfbd; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    background: var(--surface-2);
    color: var(--ink-2);
    border: 1px solid var(--line);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: #c6e7d4; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: #f3dfbd; }
.badge-muted { color: var(--muted); }
.badge-plain::before { display: none; }

.avatar {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 750;
    font-size: 13px;
    flex: none;
}

.empty {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 36px 20px;
    text-align: center;
    color: var(--muted);
}
.empty .icon { width: 32px; height: 32px; color: #a8b0c2; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafbfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form, .table .actions details { display: inline-block; vertical-align: middle; }
.table .actions details[open] { display: block; margin-bottom: 6px; }
.row-inactive td { color: var(--muted); }

.person { display: flex; align-items: center; gap: 12px; }
.person strong { display: block; font-weight: 650; }
.person small { color: var(--muted); }

.meter { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; min-width: 80px; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* ---------- Brand ---------- */

.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.01em; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: #fff;
    box-shadow: 0 4px 12px rgba(47, 75, 216, .35);
}
.brand-mark .icon { width: 19px; height: 19px; }

/* ==========================================================================
   Backend
   ========================================================================== */

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--brand-strong);
    color: #fff;
}
.app-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 24px;
}
.app-header .brand-mark { background: rgba(255, 255, 255, .14); box-shadow: none; }
.app-header .site-switch .select {
    min-width: 240px;
    min-height: 36px;
    background-color: rgba(255, 255, 255, .1);
    border-color: rgba(255, 255, 255, .2);
    color: #fff;
}
.app-header .site-switch .select option { color: var(--ink); }
.app-header .btn-ghost { color: rgba(255, 255, 255, .85); }
.app-header .btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; font-size: 13px; line-height: 1.25; }
.user-chip .avatar { background: rgba(255, 255, 255, .16); color: #fff; width: 32px; height: 32px; }
.user-chip small { display: block; color: rgba(255, 255, 255, .65); }

.app-nav { background: var(--surface); border-bottom: 1px solid var(--line); }
.app-nav-inner { display: flex; gap: 4px; max-width: 1280px; margin: 0 auto; padding: 0 16px; overflow-x: auto; }
.app-nav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 12px 12px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
}
.app-nav a:hover { color: var(--ink); }
.app-nav a.active { color: var(--brand); border-bottom-color: var(--brand); }
.app-nav .count {
    min-width: 20px;
    padding: 0 6px;
    border-radius: 99px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    line-height: 20px;
    text-align: center;
}

.app-main { max-width: 1280px; margin: 0 auto; padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head > div:first-child { flex: 1; min-width: 240px; }
.page-head p { color: var(--muted); margin-top: 4px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { padding: 18px 20px; display: grid; gap: 4px; }
.kpi span { font-size: 13px; font-weight: 650; color: var(--muted); }
.kpi strong { font-size: 28px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi.highlight { background: linear-gradient(135deg, var(--brand), var(--brand-strong)); color: #fff; border: none; }
.kpi.highlight span { color: rgba(255, 255, 255, .75); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 4px 3px 10px;
    border-radius: 99px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: 13px;
    font-weight: 600;
}
.chip form { display: inline; }
.chip button {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}
.chip button:hover { background: rgba(27, 42, 107, .12); }
.chip .icon { width: 13px; height: 13px; }

.pending-item {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.pending-item:last-child { border-bottom: none; }
.pending-item .info { flex: 1; min-width: 200px; }
.pending-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); }

details.inline-edit > summary { list-style: none; display: inline-flex; }
details.inline-edit > summary::-webkit-details-marker { display: none; }
details.inline-edit[open] > summary { display: none; }
.inline-edit-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-edit-form .input { min-height: 34px; width: auto; flex: 1; min-width: 120px; }

/* ---------- Auth ---------- */

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(47, 75, 216, .18), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(15, 157, 138, .14), transparent 60%),
        var(--bg);
}
.auth-card { width: min(100%, 420px); padding: 32px; box-shadow: var(--shadow-lg); border: none; border-radius: var(--radius-lg); }
.auth-card .brand { margin-bottom: 24px; }
.auth-card h1 { font-size: 22px; }
.auth-card-wide { width: min(100%, 520px); }
.auth-links { display: grid; justify-items: center; gap: 8px; margin-top: 20px; font-size: 14px; }

.input.input-otp {
    min-height: 56px;
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: .3em;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.input.input-otp::placeholder { color: #c3c9d6; }

.setup-steps { gap: 20px; padding-left: 22px; }
.setup-steps li { padding-left: 4px; }
.qr-box {
    width: 200px;
    height: 200px;
    margin: 14px 0 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}
.qr-box svg { display: block; width: 100%; height: 100%; }
.manual-key summary { cursor: pointer; color: var(--brand); font-size: 14px; font-weight: 600; }
.manual-key code {
    display: block;
    margin: 10px 0 4px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 16px;
    letter-spacing: .08em;
    word-break: break-all;
    user-select: all;
}

.recovery-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 16px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.recovery-grid code {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: .05em;
    text-align: center;
    padding: 6px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid var(--line);
}

@media print {
    body * { visibility: hidden; }
    .auth-card .brand, .auth-card h1, .recovery-grid, .recovery-grid * { visibility: visible; }
    .auth { background: none; }
    .auth-card { box-shadow: none; }
}

/* ==========================================================================
   Kiosk (tablet)
   ========================================================================== */

body.kiosk {
    font-size: 17px;
    background:
        radial-gradient(1000px 700px at 0% 0%, rgba(47, 75, 216, .14), transparent 60%),
        radial-gradient(900px 600px at 100% 100%, rgba(15, 157, 138, .12), transparent 60%),
        var(--bg);
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
body.kiosk input, body.kiosk textarea { -webkit-user-select: text; user-select: text; }

.kiosk-shell {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 32px 24px;
}
.kiosk-header { display: flex; align-items: center; gap: 16px; min-height: 56px; }
.kiosk-header .brand { font-size: 18px; }
.kiosk-meta { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.kiosk-site { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 600; }
.kiosk-site .icon { color: var(--brand); }
.kiosk-clock { font-size: 28px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kiosk-back { margin-left: -12px; }
.kiosk-logo { display: block; height: 52px; width: auto; max-width: 260px; object-fit: contain; object-position: left center; }
.kiosk-logo.small { height: 36px; max-width: 160px; object-position: right center; }

/* Logo nelle impostazioni della sede: riproduce l'intestazione del tablet. */
.logo-preview { display: flex; align-items: center; gap: 16px; min-height: 84px; padding: 16px 20px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--bg); }
.logo-preview .kiosk-logo { height: 52px; }
.logo-preview .brand { color: var(--muted); }
.logo-source { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: end; }
.logo-source .or { padding-bottom: 12px; color: var(--muted); font-size: 13px; font-weight: 600; }

.kiosk-main { display: grid; align-content: center; gap: 28px; padding: 24px 0; }
.kiosk-footer { display: flex; justify-content: center; }
.kiosk-footer a { color: var(--muted); font-size: 14px; text-decoration: none; padding: 8px 12px; border-radius: 8px; }
.kiosk-footer a:hover { background: rgba(14, 22, 48, .05); }

.kiosk-hero { text-align: center; display: grid; gap: 10px; }
.kiosk-hero h1 { font-size: clamp(32px, 4.5vw, 48px); font-weight: 800; letter-spacing: -.03em; }
.kiosk-hero p { font-size: 20px; color: var(--muted); }

.kiosk-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.kiosk-action {
    position: relative;
    display: grid;
    align-content: end;
    gap: 6px;
    min-height: 300px;
    padding: 32px;
    border-radius: 28px;
    color: #fff;
    text-decoration: none;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: transform .15s ease, box-shadow .15s ease;
}
.kiosk-action:active { transform: scale(.985); }
.kiosk-action::after {
    content: "";
    position: absolute;
    right: -60px;
    top: -60px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}
.kiosk-action .action-icon {
    position: absolute;
    top: 32px;
    left: 32px;
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: rgba(255, 255, 255, .16);
}
.kiosk-action .action-icon .icon { width: 38px; height: 38px; }
.kiosk-action strong { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.kiosk-action small { font-size: 18px; opacity: .8; }
.kiosk-action.in { background: linear-gradient(140deg, #3651e0, var(--brand-strong)); }
.kiosk-action.out { background: linear-gradient(140deg, #14a892, #0b6b5e); }

.kiosk-toast {
    position: fixed;
    left: 50%;
    top: 92px;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 26px;
    border-radius: 18px;
    background: var(--ink);
    color: #fff;
    font-size: 20px;
    font-weight: 650;
    box-shadow: var(--shadow-lg);
    animation: toast-in .3s ease;
}
.kiosk-toast .toast-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); }
.kiosk-toast.leaving { opacity: 0; transform: translate(-50%, -12px); transition: all .3s ease; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -12px); } }

.kiosk-panel {
    width: min(100%, 820px);
    margin: 0 auto;
    padding: 32px;
    background: var(--surface);
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
}
.kiosk-panel.narrow { width: min(100%, 600px); }
.kiosk-panel h1 { font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.kiosk-panel .lead { font-size: 18px; color: var(--muted); margin-top: 6px; }
.kiosk-panel .field > span { font-size: 15px; }
.kiosk-panel .input { min-height: 56px; font-size: 19px; padding: 10px 16px; border-radius: var(--radius); }
.kiosk-panel .input-icon > .input { padding-left: 52px; }
.kiosk-panel .input-icon > .icon { left: 18px; width: 22px; height: 22px; }

.kiosk-form { display: grid; gap: 22px; margin-top: 28px; }
.kiosk-panel .input-code {
    min-height: 76px;
    font-size: 36px;
    font-weight: 750;
    letter-spacing: .25em;
    text-align: center;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.kiosk-panel .input-code::placeholder { color: #c3c9d6; letter-spacing: .25em; }
.setup-alt { margin-top: 22px; text-align: center; color: var(--muted); font-size: 16px; }
.setup-alt a { font-weight: 650; }

.code-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    border: 1px dashed #b9c4f5;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 20px;
    font-weight: 750;
    letter-spacing: .12em;
    user-select: all;
}
.avatar .icon { width: 18px; height: 18px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ink-2); }
.steps li::marker { color: var(--brand); font-weight: 700; }
.code-pill.expired { background: var(--surface-2); color: var(--muted); border-color: var(--line-strong); text-decoration: line-through; }
.kiosk-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.step-title { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: var(--ink-2); }
.step-num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 13px; }

.person-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 340px;
    overflow-y: auto;
    padding: 2px;
}
.person-grid:empty { display: none; }
#referentHint { padding: 4px 12px; margin-top: -8px; font-size: 16px; }
.person-tile { position: relative; }
.person-tile input { position: absolute; opacity: 0; pointer-events: none; }
.person-tile label {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 10px 14px;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    font-weight: 650;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.person-tile label .avatar { width: 40px; height: 40px; font-size: 14px; }
.person-tile input:checked + label { border-color: var(--brand); background: var(--brand-soft); }
.person-tile input:checked + label .avatar { background: var(--brand); color: #fff; }
.person-tile input:focus-visible + label { box-shadow: var(--focus); }

.consent { padding: 16px 18px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); font-size: 16px; }
.consent button.link { padding: 0; border: none; background: none; color: var(--brand); font: inherit; font-weight: 650; text-decoration: underline; cursor: pointer; }

.result-list { display: grid; gap: 10px; min-height: 120px; align-content: start; }
.result-item { position: relative; }
.result-item input { position: absolute; opacity: 0; pointer-events: none; }
.result-item label {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.result-item label .avatar { width: 46px; height: 46px; font-size: 16px; }
.result-item label strong { display: block; font-size: 19px; }
.result-item label small { color: var(--muted); font-size: 15px; }
.result-item label .since { margin-left: auto; color: var(--muted); font-size: 15px; white-space: nowrap; }
.result-item input:checked + label { border-color: var(--accent); background: var(--accent-soft); }
.result-item input:checked + label .avatar { background: var(--accent); color: #fff; }
.result-hint { padding: 28px 12px; text-align: center; color: var(--muted); }

dialog.sheet {
    width: min(92vw, 720px);
    max-height: 80vh;
    padding: 0;
    border: none;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
}
dialog.sheet::backdrop { background: rgba(14, 22, 48, .45); }
dialog.sheet .sheet-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
dialog.sheet .sheet-body { padding: 24px; overflow-y: auto; max-height: calc(80vh - 160px); font-size: 16px; line-height: 1.6; color: var(--ink-2); }

.rich-text p { margin: 0; }
.rich-text p + p { margin-top: 1.1em; }
.rich-text strong { color: var(--ink); font-weight: 700; }

.editor-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.editor-toolbar .btn-icon { font-weight: 800; font-size: 15px; }
.editor-preview {
    padding: 18px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink-2);
    max-height: 420px;
    overflow-y: auto;
}
.editor-preview:empty::before { content: "L'anteprima apparirà qui."; color: var(--muted); }
dialog.sheet .sheet-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }

.status-screen { display: grid; justify-items: center; gap: 16px; text-align: center; }
.status-icon { display: grid; place-items: center; width: 88px; height: 88px; border-radius: 50%; background: var(--warn-soft); color: var(--warn); }
.status-icon .icon { width: 40px; height: 40px; }
.status-icon.pulse { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px rgba(161, 92, 7, .08); } }

.idle-bar { position: fixed; left: 0; bottom: 0; height: 4px; background: var(--brand); opacity: .35; transition: width 1s linear; }

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

@media (max-width: 1000px) {
    .grid-2, .grid-sidebar { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
    .app-header-inner { flex-wrap: wrap; padding: 12px 16px; }
    .app-header .site-switch { order: 3; width: 100%; }
    .app-header .site-switch .select { width: 100%; min-width: 0; }
    .user-chip > div { display: none; }
    .app-main { padding: 16px; }
    .kiosk-shell { padding: 16px; }
    .kiosk-actions { grid-template-columns: 1fr; }
    .kiosk-action { min-height: 210px; padding: 24px; border-radius: 22px; }
    .kiosk-action .action-icon { top: 24px; left: 24px; width: 56px; height: 56px; border-radius: 16px; }
    .kiosk-action .action-icon .icon { width: 30px; height: 30px; }
    .kiosk-action strong { font-size: 28px; }
    .kiosk-hero p { font-size: 17px; }
    .kiosk-panel { padding: 22px; border-radius: 20px; }
    .kiosk-form .two { grid-template-columns: 1fr; }
    .kiosk-site { display: none; }
    .kiosk-logo { height: 40px; max-width: 180px; }
    .kiosk-logo.small { height: 30px; max-width: 120px; }
    .logo-source { grid-template-columns: 1fr; }
    .logo-source .or { padding: 0; }
    .table th, .table td { padding: 10px 12px; }
}
