:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --text: #17202a;
    --muted: #667085;
    --line: #d9e0e7;
    --primary: #126b5d;
    --primary-dark: #0d5147;
    --danger: #b42318;
    --warning-bg: #fff4df;
    --warning-text: #7a4d00;
    --ok-bg: #e7f7ee;
    --ok-text: #136a3a;
    --off-bg: #eceff3;
    --off-text: #475467;
    --shadow: 0 14px 40px rgba(25, 35, 48, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

/* Fondale tecnico: due aloni morbidi col colore dell'utente + griglia leggera.
   --user-h è impostato inline sul body (per utente); 168 = teal del brand di default. */
body:not(.public-view) {
    --user-h: 168;
    background-color: hsl(var(--user-h), 60%, 15%);
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(135deg, hsl(var(--user-h), 72%, 44%), hsl(var(--user-h), 64%, 13%));
    background-size: 44px 44px, 44px 44px, 100% 100%;
    background-attachment: fixed;
}

/* Testi direttamente sul fondale carico (fuori dai pannelli bianchi) -> chiari */
body:not(.public-view) .page-heading h1,
body:not(.public-view) .empty-state h2 {
    color: #ffffff;
}

body:not(.public-view) .page-heading p,
body:not(.public-view) .page-heading .eyebrow,
body:not(.public-view) .empty-state p,
body:not(.public-view) .list-subcount,
body:not(.public-view) .list-count,
body:not(.public-view) .console-count {
    color: rgba(255, 255, 255, 0.82);
}

body:not(.public-view) .site-footer {
    color: rgba(255, 255, 255, 0.78);
}

body:not(.public-view) .site-footer strong,
body:not(.public-view) .site-footer a {
    color: #ffffff;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.brand {
    align-items: center;
    color: var(--text);
    display: flex;
    font-size: 18px;
    font-weight: 700;
    gap: 12px;
    min-width: 0;
}

.brand img {
    display: block;
    height: auto;
    max-height: 24px;
    max-width: 180px;
    object-fit: contain;
    object-position: left center;
    width: 180px;
}

.brand span {
    border-left: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    padding-left: 12px;
    white-space: nowrap;
}

.button-row,
.actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.app-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-height: 100vh;
    padding: 22px 18px;
    position: sticky;
    top: 0;
}

.sidebar-brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 4px 4px 0;
}

.sidebar-brand img {
    max-height: 28px;
    max-width: 190px;
    width: 190px;
}

.sidebar-brand span {
    border-left: 0;
    padding-left: 0;
}

.sidebar-cta {
    margin-top: -12px;
}

/* Il toggle e un <button>: batte la regola button.button{background:#fff} */
.sidebar-cta [data-download-toggle] {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.sidebar-cta [data-download-toggle]:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.side-nav {
    display: grid;
    gap: 6px;
}

.side-nav a {
    border-radius: 6px;
    color: var(--text);
    font-weight: 700;
    padding: 11px 12px;
    text-decoration: none;
}

.side-nav a:hover,
.side-nav a.active {
    background: var(--off-bg);
    color: var(--primary);
}

.sidebar-actions {
    display: grid;
    gap: 10px;
    margin-top: auto;
}

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

.main-shell .page {
    flex: 1 0 auto;
    width: 100%;
}

.user-pill {
    background: var(--off-bg);
    border-radius: 999px;
    color: var(--off-text);
    font-size: 12px;
    font-weight: 700;
    padding: 8px 10px;
}

.actions form {
    margin: 0;
}

.page {
    margin: 0 auto;
    max-width: 1180px;
    padding: 34px 24px 60px;
}

.auth-page {
    max-width: 1180px;
}

.page-heading {
    align-items: flex-start;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 24px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    font-size: 30px;
    margin-bottom: 6px;
}

h2 {
    font-size: 20px;
}

.muted,
.subtext,
.hint {
    color: var(--muted);
}

.subtext {
    display: block;
    font-size: 12px;
    margin-top: 4px;
}

.hint {
    font-size: 13px;
    margin: 18px 0 0;
}

.panel,
.table-wrap,
.empty-state {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    padding: 24px;
}

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

table {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}

.col-qr {
    width: 86px;
}

.col-name {
    width: 112px;
}

.col-link {
    width: 210px;
}

.col-destination {
    width: auto;
}

.col-scans {
    width: 84px;
}

.col-status {
    width: 78px;
}

.col-actions {
    width: 360px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 14px 10px;
    text-align: left;
    vertical-align: top;
}

th:last-child,
td:last-child {
    padding-right: 18px;
}

th {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

.truncate {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.button,
button.button {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    text-decoration: none;
}

.button:hover {
    text-decoration: none;
}

.button-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-ghost {
    background: transparent;
}

.button-danger {
    border-color: #f3c1bd;
    color: var(--danger);
}

.button-danger:hover {
    background: #fff1f0;
    border-color: #f4a9a2;
    color: var(--danger);
}

.button-danger-solid {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
}

.button-danger-solid:hover {
    background: #8f1b13;
    border-color: #8f1b13;
    color: #ffffff;
}

.button-small {
    font-size: 13px;
    min-height: 34px;
    padding: 7px 8px;
}

.button-wide {
    width: 100%;
}

.download-menu {
    display: inline-flex;
    position: relative;
}

.download-menu-wide {
    display: flex;
    width: 100%;
}

.download-options {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: var(--shadow);
    display: none;
    min-width: 112px;
    overflow: hidden;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 20;
}

.download-menu.is-open .download-options {
    display: grid;
}

.download-options button,
.download-options a {
    background: #ffffff;
    border: 0;
    color: var(--text);
    cursor: pointer;
    display: block;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 14px;
    text-align: left;
    text-decoration: none;
}

.download-options button:hover,
.download-options a:hover {
    background: var(--off-bg);
    color: var(--primary);
}

.download-menu-wide .download-options {
    left: 0;
    right: 0;
}

.copy-link {
    background: transparent;
    border: 0;
    color: var(--primary);
    cursor: pointer;
    display: block;
    font: inherit;
    max-width: 100%;
    overflow: hidden;
    padding: 0;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
}

.badge-live {
    background: var(--ok-bg);
    color: var(--ok-text);
}

.badge-off {
    background: var(--off-bg);
    color: var(--off-text);
}

.badge-nfc {
    background: #e8f2ff;
    color: #175cd3;
}

.auth-shell {
    display: grid;
    min-height: calc(100vh - 160px);
    place-items: center;
}

.auth-panel {
    max-width: 420px;
    width: 100%;
}

.auth-logo {
    display: block;
    height: auto;
    margin-bottom: 22px;
    max-height: 38px;
    max-width: 320px;
    object-fit: contain;
    object-position: left center;
    width: 320px;
}

.stack {
    display: grid;
    gap: 16px;
}

label span {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 7px;
}

input,
textarea,
select {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    min-height: 44px;
    padding: 10px 12px;
    width: 100%;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(18, 107, 93, 0.14);
}

.filter-form {
    margin: 0;
}

.filter-form select {
    min-height: 40px;
    min-width: 210px;
}

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

.check-row input {
    min-height: auto;
    width: auto;
}

.check-row span {
    margin: 0;
}

/* Switch stile iPhone (riusabile) */
.switch {
    align-items: center;
    cursor: pointer;
    display: inline-flex;
    gap: 10px;
}

.switch input {
    height: 0;
    margin: 0;
    min-height: 0;
    opacity: 0;
    position: absolute;
    width: 0;
}

.switch-track {
    background: #cbd5e1;
    border-radius: 999px;
    flex: 0 0 auto;
    height: 24px;
    position: relative;
    transition: background 0.18s ease;
    width: 42px;
}

.switch-knob {
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.25);
    height: 20px;
    left: 2px;
    position: absolute;
    top: 2px;
    transition: transform 0.18s ease;
    width: 20px;
}

.switch input:checked + .switch-track {
    background: var(--primary);
}

.switch input:checked + .switch-track .switch-knob {
    transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
    outline: 3px solid rgba(18, 107, 93, 0.22);
    outline-offset: 1px;
}

.switch-label {
    font-weight: 600;
}

.switch-sm .switch-track {
    height: 20px;
    width: 36px;
}

.switch-sm .switch-knob {
    height: 16px;
    width: 16px;
}

.switch-sm input:checked + .switch-track .switch-knob {
    transform: translateX(16px);
}

/* Toggle rapido attiva/disattiva sulla card QR */
.qr-card-toggle {
    bottom: 12px;
    position: absolute;
    right: 12px;
    z-index: 3;
}

.qr-console-card .qr-card-open {
    padding-bottom: 36px;
}

.form-grid {
    align-items: start;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) 340px;
}

.qr-preview {
    display: grid;
    gap: 14px;
}

.qr-canvas,
.qr-thumb {
    align-items: center;
    aspect-ratio: 1;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    padding: 18px;
}

.qr-thumb {
    border-radius: 6px;
    min-width: 72px;
    padding: 6px;
    width: 72px;
}

.qr-canvas canvas,
.qr-canvas img,
.qr-thumb canvas,
.qr-thumb img {
    height: auto !important;
    max-width: 100%;
    width: 100% !important;
}

.short-url {
    color: var(--muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.link-panel {
    display: grid;
    gap: 8px;
    margin-bottom: 24px;
}

.chart-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 24px;
}

.chart-panel {
    display: grid;
    gap: 16px;
}

.chart-head {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.chart-head h2 {
    margin-bottom: 0;
}

.chart-legend {
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    font-weight: 700;
    gap: 12px;
}

.chart-legend span {
    align-items: center;
    display: inline-flex;
    gap: 6px;
}

.chart-legend i {
    border-radius: 999px;
    display: inline-block;
    height: 9px;
    width: 9px;
}

.legend-qr,
.bar-qr {
    background: var(--primary);
}

.legend-nfc,
.bar-nfc {
    background: #175cd3;
}

.trend-switch {
    background: var(--off-bg);
    border-radius: 999px;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 3px;
}

.trend-switch-btn {
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    min-height: 0;
    padding: 6px 14px;
    width: auto;
}

.trend-switch-btn.is-active {
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
    color: var(--text);
}

.trend-panel {
    transition: opacity 0.18s ease;
}

.trend-panel[hidden] {
    display: none;
}

.trend-chart {
    position: relative;
}

.trend-svg {
    display: block;
    height: auto;
    overflow: visible;
    width: 100%;
}

.trend-grid {
    stroke: var(--line);
    stroke-width: 1;
}

.trend-ylabel {
    fill: var(--muted);
    font-size: 10px;
    text-anchor: end;
}

.trend-xlabel {
    fill: var(--muted);
    font-size: 10px;
    text-anchor: middle;
}

.trend-line {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.trend-line-qr {
    stroke: var(--primary);
}

.trend-line-nfc {
    stroke: #175cd3;
}

.trend-area {
    opacity: 0.1;
    stroke: none;
}

.trend-area-qr {
    fill: var(--primary);
}

.trend-area-nfc {
    fill: #175cd3;
}

.trend-dot {
    stroke: #ffffff;
    stroke-width: 1;
}

.trend-dot-qr {
    fill: var(--primary);
}

.trend-dot-nfc {
    fill: #175cd3;
}

.trend-hit {
    fill: transparent;
}

.trend-guide {
    stroke: var(--line);
    stroke-dasharray: 3 3;
    stroke-width: 1;
}

.trend-tooltip {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(16, 24, 40, 0.12);
    font-size: 12px;
    left: 0;
    padding: 8px 10px;
    pointer-events: none;
    position: absolute;
    top: 0;
    transform: translate(-50%, calc(-100% - 8px));
    white-space: nowrap;
    z-index: 5;
}

.trend-tooltip[hidden] {
    display: none;
}

.trend-tooltip strong {
    display: block;
    margin-bottom: 4px;
}

.trend-tt-row {
    align-items: center;
    color: var(--text);
    display: flex;
    gap: 6px;
}

.trend-tt-dot {
    border-radius: 50%;
    display: inline-block;
    height: 8px;
    width: 8px;
}

.source-split-bar {
    background: var(--line);
    border-radius: 999px;
    display: flex;
    height: 14px;
    margin: 10px 0 14px;
    overflow: hidden;
}

.source-split-bar span {
    display: block;
}

.stats-filter-form {
    align-items: flex-end;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.stats-filter-form label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    gap: 4px;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.qr-modal-danger-zone {
    gap: 8px;
}

.view-tabs {
    margin: 0;
}

.filter-form {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-form input[type="search"] {
    min-height: 40px;
    min-width: 200px;
    width: auto;
}

.filter-form select {
    width: auto;
}

.bar-chart {
    align-items: end;
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(var(--bars), minmax(7px, 1fr));
    min-height: 178px;
}

.bar-item {
    align-items: center;
    display: grid;
    gap: 7px;
    min-width: 0;
}

.bar-track {
    align-items: end;
    background: #f1f4f7;
    border-radius: 999px;
    display: flex;
    height: 132px;
    overflow: hidden;
    width: 100%;
}

.bar-stack {
    align-items: stretch;
    border-radius: 999px;
    display: flex;
    flex-direction: column-reverse;
    overflow: hidden;
    width: 100%;
}

.bar-stack span {
    display: block;
    min-height: 0;
    width: 100%;
}

.bar-label {
    color: var(--muted);
    font-size: 10px;
    overflow: hidden;
    text-align: center;
    text-overflow: clip;
    white-space: nowrap;
    width: 100%;
}

.qr-card-list {
    display: grid;
    gap: 14px;
}

.qr-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 16px;
    overflow: hidden;
    padding: 16px;
    position: relative;
}

.qr-card-main {
    align-items: flex-start;
    display: grid;
    gap: 18px;
    grid-template-columns: 86px minmax(0, 1fr);
}

.qr-card-content {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.qr-card-head {
    align-items: flex-start;
    display: flex;
    gap: 14px;
    justify-content: space-between;
}

.qr-card-head h2 {
    font-size: 18px;
    margin-bottom: 2px;
}

.qr-card-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) 120px;
}

.label {
    color: var(--muted);
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.truncate-link {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.qr-card-actions {
    align-items: center;
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 14px;
}

.delete-warning {
    align-items: center;
    background: #fff7f6;
    border: 1px solid #f4a9a2;
    border-radius: 8px;
    bottom: 14px;
    box-shadow: 0 18px 42px rgba(180, 35, 24, 0.16);
    color: #61140e;
    display: none;
    gap: 16px;
    justify-content: space-between;
    left: 14px;
    overflow: hidden;
    padding: 14px;
    position: absolute;
    right: 14px;
    z-index: 30;
}

.delete-warning strong,
.delete-warning span {
    display: block;
}

.delete-warning span {
    font-size: 13px;
    margin-top: 3px;
}

.delete-warning-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.delete-timer {
    background: #f7cbc7;
    bottom: 0;
    height: 4px;
    left: 0;
    position: absolute;
    right: 0;
}

.delete-timer span {
    animation: delete-timer 8s linear forwards;
    background: var(--danger);
    display: block;
    height: 100%;
    width: 0;
}

.qr-card.is-confirming-delete .delete-warning {
    display: flex;
}

@keyframes delete-timer {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.empty-state {
    padding: 48px 24px;
    text-align: center;
}

.flash,
.alert {
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 12px 14px;
}

.flash {
    background: var(--ok-bg);
    border: 1px solid rgba(19, 106, 58, 0.28);
    color: var(--ok-text);
}

.alert {
    background: var(--warning-bg);
    border: 1px solid rgba(122, 77, 0, 0.24);
    color: var(--warning-text);
}

.alert p:last-child {
    margin-bottom: 0;
}

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

.metric span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    margin-bottom: 8px;
}

.metric strong {
    font-size: 26px;
}

.metric .metric-sub {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-top: 6px;
}

.diag-grid {
    align-items: start;
    display: grid;
    gap: 22px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.diag-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.diag-row {
    align-items: center;
    background: #f6f8fb;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 13px 16px;
}

.diag-label {
    font-weight: 700;
}

.diag-label small {
    font-weight: 600;
    margin-left: 6px;
}

.diag-badge {
    border-radius: 999px;
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 4px 10px;
}

.diag-badge.is-ok {
    background: #e7f6ec;
    color: #1a7f45;
}

.diag-badge.is-ko {
    background: #fde8e8;
    color: #b42318;
}

.diag-value {
    color: var(--muted);
    flex: 0 0 auto;
    font-weight: 700;
}

.error-box {
    background: #111827;
    border-radius: 8px;
    color: #ffffff;
    overflow-x: auto;
    padding: 16px;
    text-align: left;
}

.site-footer {
    align-items: flex-start;
    color: var(--muted);
    display: flex;
    font-size: 12px;
    gap: 20px;
    justify-content: space-between;
    margin: 0 auto;
    max-width: 1180px;
    padding: 0 24px 28px;
}

.section-head {
    align-items: flex-start;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.site-footer div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}

.site-footer strong {
    color: var(--text);
}

.fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 14px;
}

.fieldset legend {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    padding: 0 6px;
}

.simple-list,
.editor-card {
    display: grid;
    gap: 12px;
}

.list-row,
.editor-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
}

.list-row {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.editor-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.eyebrow {
    color: #9b6a00;
    display: block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.console-heading {
    margin-bottom: 14px;
}

.console-count {
    color: var(--muted);
    font-weight: 700;
    margin: -8px 0 18px;
    text-align: right;
}

.list-toolbar {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.list-count {
    color: var(--muted);
    font-weight: 700;
}

.list-subcount {
    color: var(--muted);
    font-weight: 600;
    margin: 8px 0 0;
}

.qr-console-grid {
    display: grid;
    gap: 22px;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
}

.qr-console-grid.is-sort-error {
    outline: 3px solid rgba(180, 35, 24, 0.18);
    outline-offset: 6px;
}

.qr-console-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    min-height: 148px;
    padding: 0;
    position: relative;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.qr-console-card:hover {
    border-color: #b7c8dd;
    box-shadow: 0 12px 28px rgba(14, 24, 39, 0.13);
}

.qr-console-card.is-dragging {
    opacity: 0.48;
}

.qr-console-card.is-inactive .qr-drag-handle,
.qr-console-card.is-inactive .qr-card-open {
    opacity: 0.58;
}

.bv-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    min-height: 140px;
    padding: 0;
    position: relative;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.bv-card:hover {
    border-color: #b7c8dd;
    box-shadow: 0 12px 28px rgba(14, 24, 39, 0.13);
}

.bv-card.is-dragging {
    opacity: 0.48;
}

.drag-ghost {
    box-shadow: 0 20px 44px rgba(14, 24, 39, 0.3);
    margin: 0;
    opacity: 0.92;
    pointer-events: none;
    position: fixed;
    z-index: 1000;
}

.is-drag-source {
    opacity: 0.32;
}

body.is-reordering {
    cursor: grabbing;
    user-select: none;
}

.bv-card .qr-card-open {
    text-decoration: none;
}

.bv-card-dot {
    border-radius: 999px;
    height: 12px;
    position: absolute;
    right: 14px;
    top: 14px;
    width: 12px;
    z-index: 1;
}

.bv-card-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bv-card-actions {
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    margin-top: auto;
    padding: 10px 10px;
}

.bv-card-actions .button-small {
    font-size: 12px;
    padding: 6px 7px;
}

.bv-card-actions .button[data-confirm-action] {
    min-width: 80px;
}

.bv-color-row {
    align-items: center;
    display: flex;
    flex-direction: row;
    gap: 14px;
}

.bv-color-row input[type="color"] {
    border: 1px solid var(--line);
    border-radius: 6px;
    height: 42px;
    min-height: 42px;
    padding: 2px;
    width: 64px;
}

.console-filter {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.qr-drag-handle {
    align-items: center;
    background: #d9e6f5;
    border: 0;
    border-right: 1px solid #c6d6e8;
    color: #102a4c;
    cursor: grab;
    display: flex;
    font-size: 24px;
    font-weight: 800;
    justify-content: center;
    min-height: 100%;
    padding: 0;
    touch-action: none;
}

.qr-drag-handle:active {
    cursor: grabbing;
}

.qr-card-open {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    display: grid;
    gap: 12px;
    grid-template-columns: 68px minmax(0, 1fr);
    grid-template-rows: 1fr;
    min-width: 0;
    padding: 16px;
    text-align: left;
}

.qr-card-visual {
    align-items: center;
    background: transparent;
    border-bottom: 0;
    display: flex;
    justify-content: center;
    overflow: hidden;
    padding: 0;
}

.qr-card-visual .qr-thumb {
    box-shadow: none;
    min-width: 62px;
    width: 62px;
}

.qr-card-summary {
    align-content: start;
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 0;
}

.qr-card-summary .badge {
    position: absolute;
    right: 14px;
    top: 14px;
}

.qr-card-summary strong {
    color: #081a33;
    display: block;
    font-size: 17px;
    line-height: 1.15;
    overflow-wrap: anywhere;
    padding-right: 72px;
}

.qr-card-summary span:not(.badge),
.qr-card-summary small {
    color: var(--muted);
    font-size: 12px;
}

.qr-card-summary small {
    display: block;
    font-weight: 700;
}

.qr-card-summary .qr-card-meta {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.9;
}

.qr-modal {
    display: none;
    inset: 0;
    padding: 22px;
    position: fixed;
    z-index: 100;
}

.qr-modal.is-open {
    display: block;
}

.qr-modal-backdrop {
    background: rgba(20, 30, 43, 0.42);
    inset: 0;
    position: fixed;
}

.qr-modal-panel {
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    box-shadow: 0 28px 90px rgba(14, 24, 39, 0.34);
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    height: min(86vh, 860px);
    margin: 0 auto;
    max-width: 1160px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.qr-modal-close {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    font-size: 28px;
    height: 44px;
    justify-content: center;
    line-height: 1;
    position: absolute;
    right: 22px;
    top: 22px;
    width: 44px;
    z-index: 2;
}

.qr-modal-side {
    align-items: center;
    background:
        linear-gradient(180deg, rgba(10, 17, 29, 0.08), rgba(10, 17, 29, 0.28)),
        #d9e6f5;
    display: flex;
    justify-content: center;
    min-width: 0;
    padding: 22px;
    position: relative;
}

.qr-modal-menu {
    color: #102a4c;
    font-size: 28px;
    font-weight: 900;
    left: 16px;
    position: absolute;
    top: 12px;
}

.qr-modal-qr {
    width: 138px;
}

.qr-modal-content {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-width: 0;
    overflow-y: auto;
    padding: 38px 26px 34px;
}

.qr-modal-head {
    align-items: stretch;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 52px 22px 0;
}

.qr-modal-head h2 {
    color: #081a33;
    font-size: 30px;
    margin: 10px 0 4px;
}

.qr-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

.button.button-soft-green {
    background: rgba(18, 107, 93, 0.1);
    border-color: rgba(18, 107, 93, 0.32);
    color: var(--primary-dark);
}

.button.button-soft-green:hover {
    background: rgba(18, 107, 93, 0.16);
}

.button.button-soft-blue {
    background: #eaf1fe;
    border-color: #c5d8fb;
    color: #1550b8;
}

.button.button-soft-blue:hover {
    background: #dfe9fd;
}

.button.button-soft-amber {
    background: var(--warning-bg);
    border-color: #f1d49a;
    color: var(--warning-text);
}

.button.button-soft-amber:hover {
    background: #ffedcf;
}

.button.is-confirming {
    background: rgba(180, 35, 24, 0.12);
    border-color: var(--danger);
    color: var(--danger);
}

.button.is-confirming:hover {
    background: rgba(180, 35, 24, 0.18);
}

.button[data-confirm-action] {
    justify-content: center;
    min-width: 96px;
    position: relative;
}

.button[data-confirm-action]::after {
    background: var(--danger);
    bottom: -6px;
    content: '';
    height: 2px;
    left: 0;
    opacity: 0;
    position: absolute;
    right: 0;
    transform: scaleX(0);
    transform-origin: left;
}

.button.is-confirming::after {
    animation: confirm-countdown 4s linear forwards;
    opacity: 1;
}

@keyframes confirm-countdown {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

.qr-modal-rows {
    display: grid;
    flex: 1 1 auto;
    min-height: 0;
}

.qr-modal-danger-zone {
    background: #ffffff;
    border-top: 1px solid var(--line);
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-top: auto;
    padding-top: 18px;
    position: sticky;
    bottom: 0;
}

.qr-detail-row {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(210px, 0.7fr) minmax(0, 1fr);
    padding: 18px 0;
}

.qr-detail-row strong {
    color: #183153;
    display: block;
}

.qr-detail-row span,
.qr-detail-row p {
    color: var(--muted);
    margin: 0;
}

.qr-detail-metric strong {
    color: var(--text);
    font-size: 24px;
}

.has-modal {
    overflow: hidden;
}

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

.users-list {
    display: grid;
    gap: 14px;
}

.user-role-group {
    display: grid;
    gap: 12px;
}

.user-role-group + .user-role-group {
    border-top: 1px solid var(--line);
    padding-top: 18px;
}

.user-role-title {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.user-role-title h3 {
    margin: 0;
}

.public-view {
    background: #eef3f2;
    min-height: 100vh;
}

.business-card-page {
    min-height: 100vh;
}

.business-card-hero {
    align-items: center;
    background: var(--card-surround, linear-gradient(135deg, rgba(18, 107, 93, 0.96), rgba(16, 31, 39, 0.98)), #123f3a);
    color: #ffffff;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 460px);
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    padding: 34px 24px;
    position: relative;
}

.business-card-hero--with-note {
    grid-template-columns: minmax(0, 460px) minmax(220px, 320px);
}

.business-card-hero::before {
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 42px 42px;
    content: "";
    inset: 0;
    opacity: 0.28;
    position: absolute;
}

.business-card-orbit {
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    height: 520px;
    left: 50%;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 520px;
}

.business-card-orbit::before,
.business-card-orbit::after {
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: inherit;
    content: "";
    inset: 52px;
    position: absolute;
}

.business-card-orbit::after {
    animation: card-pulse 5s ease-in-out infinite;
    inset: 112px;
}

.business-card-shell,
.business-card-note {
    position: relative;
    z-index: 1;
}

.business-card-shell {
    animation: card-enter 700ms ease-out both;
    aspect-ratio: 55 / 85;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 28px 80px rgba(5, 15, 20, 0.34);
    box-sizing: border-box;
    color: var(--text);
    display: flex;
    flex-direction: column;
    max-width: 100%;
    text-align: center;
    width: min(400px, 90vw);
}

.business-card-band {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 26px 28px 0;
}

.business-card-top {
    align-items: center;
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Lo slot logo regge qualsiasi proporzione: largo, quadrato o alto. */
.business-card-logo {
    display: block;
    height: auto;
    max-height: 84px;
    max-width: 200px;
    object-fit: contain;
    object-position: center;
    width: auto;
}

.business-card-logo--invert {
    filter: brightness(0) invert(1);
}

.business-card-person {
    text-align: center;
}

.business-card-person h1 {
    color: var(--card-accent, #238a82);
    font-size: 26px;
    line-height: 1.12;
    margin: 0;
}

.business-card-role {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    margin: 6px 0 0;
    text-transform: uppercase;
}

.business-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 16px;
    padding: 16px 28px 24px;
}

.business-card-rule {
    align-self: center;
    background: var(--line);
    display: block;
    height: 1px;
    margin: 0;
    width: 150px;
}

.business-card-contact {
    display: grid;
    gap: 6px;
}

.business-card-contact a {
    color: var(--muted);
    font-weight: 500;
    text-decoration: none;
}

.business-card-company {
    display: grid;
    gap: 5px;
    margin-top: auto;
    text-align: center;
}

.business-card-company::before {
    background: var(--line);
    content: "";
    height: 1px;
    justify-self: center;
    margin-bottom: 14px;
    width: 150px;
}

.business-card-company strong {
    font-size: 16px;
}

.business-card-company span {
    color: var(--muted);
    font-size: 14px;
}

.business-card-actions {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-action,
.business-card-copy {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    justify-content: center;
    min-height: 44px;
    padding: 11px 14px;
    text-decoration: none;
}

.card-action:hover,
.business-card-copy:hover {
    text-decoration: none;
}

.card-action-primary,
.business-card-copy {
    background: var(--card-accent, #126b5d);
    border-color: var(--card-accent, #126b5d);
    color: #ffffff;
}

/* ---- Template A · Essenziale (default): bianco, filetto accent in alto ---- */
.bv-tpl-essenziale .business-card-shell {
    border-top: 4px solid var(--card-accent, #238a82);
}

/* ---- Template B · Testata: fascia superiore a tinta piena ---- */
.bv-tpl-testata .business-card-band {
    background: var(--card-accent, #238a82);
    border-radius: 16px 16px 0 0;
    gap: 14px;
    padding: 30px 30px 26px;
}

.bv-tpl-testata .business-card-person h1 {
    color: #ffffff;
}

.bv-tpl-testata .business-card-role {
    color: rgba(255, 255, 255, 0.85);
}

.bv-tpl-testata .business-card-rule {
    display: none;
}

/* ---- Template C · Cornice: filetto a riquadro, nome con grazie ---- */
.bv-tpl-cornice .business-card-shell {
    background: #f7f5ef;
    padding: 16px;
}

.bv-tpl-cornice .business-card-shell::before {
    border: 1.5px solid var(--card-accent, #238a82);
    border-radius: 9px;
    content: "";
    inset: 8px;
    pointer-events: none;
    position: absolute;
    z-index: -1;
}

.bv-tpl-cornice .business-card-band {
    padding: 26px 24px 0;
}

.bv-tpl-cornice .business-card-body {
    padding: 20px 24px 26px;
}

.bv-tpl-cornice .business-card-person h1 {
    color: #2a2a28;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 28px;
}

.bv-tpl-cornice .business-card-role {
    color: var(--card-accent, #238a82);
}

/* ---- Template D · Notturno: card scura, accent sui pulsanti ---- */
.bv-tpl-notturno .business-card-shell {
    background: #11201e;
    border: 1px solid #1f3a35;
    color: #cfe3dd;
}

.bv-tpl-notturno .business-card-person h1 {
    color: #ffffff;
}

.bv-tpl-notturno .business-card-role {
    color: #6fb9a8;
}

.bv-tpl-notturno .business-card-contact a {
    color: #a9c4bd;
}

.bv-tpl-notturno .business-card-rule,
.bv-tpl-notturno .business-card-company::before {
    background: #274b44;
}

.bv-tpl-notturno .business-card-company strong {
    color: #eaf5f1;
}

.bv-tpl-notturno .business-card-company span {
    color: #88a8a0;
}

.bv-tpl-notturno .card-action {
    background: transparent;
    border-color: #2f574f;
    color: #bfe7dd;
}

.bv-tpl-notturno .card-action-primary {
    background: var(--card-accent, #2fb597);
    border-color: var(--card-accent, #2fb597);
    color: #ffffff;
}

/* ---- Template E · Fascia (la "storica" di Silvia: fascia colorata marcata in alto) ---- */
.bv-tpl-fascia .business-card-shell {
    border-top: 50px solid var(--card-accent, #238a82);
}

/* ---- Form biglietto: selettore template + upload logo ---- */
.bv-template-pick {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bv-template-option {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 8px;
    padding: 10px 12px;
}

.bv-template-option input {
    margin: 0;
    width: auto;
}

.bv-template-option:has(input:checked) {
    border-color: #238a82;
    box-shadow: inset 0 0 0 1px #238a82;
}

.bv-template-name {
    font-weight: 600;
}

.bv-change-graphics {
    font-size: 13px;
    justify-self: start;
    text-decoration: none;
}

.bv-graphics-recap {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
}

.bv-graphics-dot {
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-block;
    height: 20px;
    width: 20px;
}

/* ---- Editor biglietto: form + anteprima dal vivo ---- */
.bv-edit-grid {
    align-items: start;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) 380px;
}

.bv-live {
    position: sticky;
    top: 16px;
}

.bv-live-stage {
    background: color-mix(in srgb, var(--card-accent, #238a82) 16%, #0c1614);
    border: 1px solid var(--line);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    padding: 20px 18px;
}

.bv-live-card {
    max-width: 340px;
    width: 100%;
}

.bv-live .business-card-shell {
    box-shadow: 0 14px 40px rgba(5, 15, 20, 0.28);
    width: 100%;
}

.bv-live-hint {
    font-size: 12px;
    margin: 10px 0 0;
    text-align: center;
}

/* selettore template a lista con mini-thumbnail */
.bv-template-list {
    --prev-accent: #238a82;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.bv-template-row {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 8px;
    position: relative;
    text-align: center;
    transition: border-color 140ms ease, box-shadow 140ms ease;
    width: 96px;
}

.bv-template-row:hover {
    border-color: var(--prev-accent);
}

.bv-template-row input {
    height: 1px;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

.bv-template-row:has(input:checked) {
    border-color: var(--prev-accent);
    box-shadow: inset 0 0 0 1px var(--prev-accent);
}

.bv-template-row:has(input:focus-visible) {
    outline: 2px solid var(--prev-accent);
    outline-offset: 2px;
}

.bv-template-row-name {
    font-size: 13px;
    font-weight: 600;
}

.bv-thumb {
    aspect-ratio: 55 / 85;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 4px;
    flex: none;
    overflow: hidden;
    width: 44px;
}

.bv-thumb-essenziale {
    border-top: 3px solid var(--prev-accent);
}

.bv-thumb-fascia {
    border-top: 9px solid var(--prev-accent);
}

.bv-thumb-testata {
    background: linear-gradient(var(--prev-accent) 36%, #ffffff 36%);
}

.bv-thumb-cornice {
    background: #f7f5ef;
    box-shadow: inset 0 0 0 1.5px var(--prev-accent);
}

.bv-thumb-notturno {
    background: #11201e;
}

@media (max-width: 1024px) {
    .bv-edit-grid {
        grid-template-columns: 1fr;
    }

    .bv-live {
        position: static;
    }

    .bv-live-stage {
        margin: 0 auto;
        max-width: 420px;
        width: 100%;
    }
}

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

.bv-logo-current {
    align-items: center;
    background: #f4f2ec;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 14px;
    padding: 10px 12px;
}

.bv-logo-current img {
    background: #ffffff;
    border-radius: 6px;
    max-height: 56px;
    max-width: 120px;
    object-fit: contain;
    padding: 4px;
}

.bv-logo-remove {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 14px;
    gap: 6px;
}

.bv-logo-remove input {
    margin: 0;
    width: auto;
}

/* ---- Selettore template (passo 1 della creazione) ---- */
.bv-choose {
    --prev-accent: #238a82;
    display: grid;
    gap: 22px;
}

.bv-choose-theme {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.bv-choose-theme-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.bv-choose-swatches {
    align-items: center;
    display: flex;
    gap: 8px;
}

.bv-swatch {
    background: var(--sw);
    border: 2px solid transparent;
    border-radius: 999px;
    box-shadow: 0 0 0 1px var(--line);
    cursor: pointer;
    height: 28px;
    padding: 0;
    width: 28px;
}

.bv-swatch.is-active {
    border-color: #ffffff;
    box-shadow: 0 0 0 2px var(--sw);
}

.bv-swatch-custom {
    align-items: center;
    display: inline-flex;
}

.bv-swatch-custom input[type="color"] {
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
    height: 30px;
    padding: 2px;
    width: 38px;
}

.bv-choose-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
}

.bv-choose-card {
    appearance: none;
    -webkit-appearance: none;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    font: inherit;
    gap: 12px;
    padding: 14px;
    position: relative;
    text-align: left;
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
    width: 100%;
}

.bv-choose-card:hover {
    border-color: var(--prev-accent);
    box-shadow: 0 10px 24px rgba(5, 15, 20, 0.12);
    transform: translateY(-2px);
}

.bv-choose-card:active {
    transform: translateY(0);
}

.bv-choose-card:focus-visible {
    outline: 2px solid var(--prev-accent);
    outline-offset: 2px;
}

.bv-choose-go {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    margin-top: auto;
}

.bv-choose-card:hover .bv-choose-go,
.bv-choose-card:focus-visible .bv-choose-go {
    color: var(--prev-accent);
}

.bv-choose-head {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bv-choose-name {
    font-weight: 700;
}

.bv-choose-desc {
    color: var(--muted);
    font-size: 12px;
}

/* anteprima compatta del biglietto */
.bv-prev {
    aspect-ratio: 55 / 85;
    background: #ffffff;
    border-radius: 10px;
    box-sizing: border-box;
    box-shadow: 0 6px 18px rgba(5, 15, 20, 0.12);
    color: #2a2a28;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.bv-prev-band {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 14px 0;
}

.bv-prev-logo {
    align-self: stretch;
    border: 1px dashed #c9c4b8;
    border-radius: 6px;
    color: #7c7c78;
    font-size: 10px;
    letter-spacing: 2px;
    padding: 7px 6px;
}

.bv-prev-name {
    color: var(--prev-accent);
    font-size: 16px;
    font-weight: 700;
}

.bv-prev-role {
    color: #9a948a;
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.bv-prev-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    padding: 12px 14px 14px;
}

.bv-prev-contact {
    color: #8a857c;
    font-size: 11px;
    line-height: 1.6;
}

.bv-prev-btns {
    display: grid;
    gap: 6px;
    grid-template-columns: 1fr 1fr;
}

.bv-prev-btn {
    border: 1px solid #d8d3c8;
    border-radius: 6px;
    color: #56524b;
    font-size: 10px;
    font-weight: 700;
    overflow: hidden;
    padding: 7px 4px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bv-prev-btn-primary {
    background: var(--prev-accent);
    border-color: var(--prev-accent);
    color: #ffffff;
}

.bv-prev-foot {
    color: #aaa49a;
    font-size: 9px;
    margin-top: auto;
}

.bv-prev-essenziale {
    border-top: 3px solid var(--prev-accent);
}

.bv-prev-testata .bv-prev-band {
    background: var(--prev-accent);
    border-radius: 10px 10px 0 0;
    padding-bottom: 14px;
}

.bv-prev-testata .bv-prev-logo {
    border-color: rgba(255, 255, 255, 0.5);
    color: #eafff7;
}

.bv-prev-testata .bv-prev-name {
    color: #ffffff;
}

.bv-prev-testata .bv-prev-role {
    color: rgba(255, 255, 255, 0.8);
}

.bv-prev-cornice {
    background: #f7f5ef;
    box-shadow: inset 0 0 0 1.5px var(--prev-accent), 0 6px 18px rgba(5, 15, 20, 0.12);
}

.bv-prev-cornice .bv-prev-logo {
    border-color: rgba(0, 0, 0, 0.18);
    color: var(--prev-accent);
}

.bv-prev-cornice .bv-prev-name {
    color: #2a2a28;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 17px;
}

.bv-prev-cornice .bv-prev-role {
    color: var(--prev-accent);
}

.bv-prev-notturno {
    background: #11201e;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    color: #cfe3dd;
}

.bv-prev-notturno .bv-prev-logo {
    border-color: #355a52;
    color: #9fe1cb;
}

.bv-prev-notturno .bv-prev-name {
    color: #ffffff;
}

.bv-prev-notturno .bv-prev-role {
    color: #6fb9a8;
}

.bv-prev-notturno .bv-prev-contact {
    color: #a9c4bd;
}

.bv-prev-notturno .bv-prev-btn {
    border-color: #2f574f;
    color: #bfe7dd;
}

.bv-prev-notturno .bv-prev-btn-primary {
    background: var(--prev-accent);
    border-color: var(--prev-accent);
    color: #ffffff;
}

.bv-prev-notturno .bv-prev-foot {
    color: #5f8279;
}

.bv-prev-fascia {
    border-top: 20px solid var(--prev-accent);
}

.business-card-details {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
}

.business-card-details div {
    min-width: 0;
}

.business-card-details dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.business-card-details dd {
    font-weight: 700;
    margin: 0;
    overflow-wrap: anywhere;
}

.business-card-summary {
    color: var(--muted);
    margin-bottom: 0;
}

.business-card-note {
    animation: card-enter 700ms 160ms ease-out both;
    align-self: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    color: #ffffff;
    display: grid;
    gap: 12px;
    padding: 18px;
}

.business-card-note span {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.business-card-note p {
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: 0;
}

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes card-pulse {
    0%,
    100% {
        opacity: 0.32;
        transform: scale(1);
    }
    50% {
        opacity: 0.82;
        transform: scale(1.08);
    }
}

@media (max-width: 820px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        border-bottom: 1px solid var(--line);
        border-right: 0;
        min-height: auto;
        position: static;
    }

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

    .page-heading,
    .section-head,
    .site-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .page {
        padding: 24px 16px 44px;
    }

    .form-grid,
    .stats-grid,
    .chart-grid,
    .users-grid,
    .diag-grid {
        grid-template-columns: 1fr;
    }

    .bar-chart {
        gap: 3px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .bar-item {
        min-width: 16px;
    }

    .actions {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .qr-card-main,
    .qr-card-grid {
        grid-template-columns: 1fr;
    }

    .qr-card .qr-thumb {
        width: 86px;
    }

    .qr-card-head,
    .delete-warning {
        align-items: flex-start;
        flex-direction: column;
    }

    .delete-warning-actions {
        width: 100%;
    }

    .button-row {
        flex-wrap: wrap;
    }

    .table-wrap {
        overflow: visible;
    }

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
        width: 100%;
    }

    colgroup,
    thead {
        display: none;
    }

    tr {
        border-bottom: 1px solid var(--line);
        display: grid;
        gap: 10px;
        grid-template-columns: 82px minmax(0, 1fr);
        padding: 14px;
    }

    tr:last-child {
        border-bottom: 0;
    }

    td {
        border-bottom: 0;
        padding: 0;
    }

    td:nth-child(n+3) {
        grid-column: 1 / -1;
    }

    .actions {
        flex-direction: row;
    }

    .console-count {
        text-align: left;
    }

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

    .qr-console-card {
        min-height: 142px;
    }

    .qr-card-open {
        grid-template-columns: 62px minmax(0, 1fr);
        grid-template-rows: 1fr;
        padding: 14px;
    }

    .qr-card-visual .qr-thumb {
        min-width: 56px;
        width: 56px;
    }

    .qr-modal {
        padding: 12px;
    }

    .qr-modal-panel {
        grid-template-columns: 1fr;
        height: calc(100vh - 24px);
    }

    .qr-modal-side {
        min-height: 164px;
    }

    .qr-modal-qr {
        width: 112px;
    }

    .qr-modal-content {
        padding: 22px 18px 26px;
    }

    .qr-modal-close {
        right: 16px;
        top: 16px;
    }

    .qr-modal-head {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 0 52px 18px 0;
    }

    .qr-modal-head h2 {
        font-size: 26px;
    }

    .qr-modal-actions {
        justify-content: flex-start;
    }

    .qr-modal-danger-zone {
        justify-content: flex-start;
    }

    .qr-detail-row {
        align-items: start;
        grid-template-columns: 1fr;
    }

    .business-card-hero {
        grid-template-columns: 1fr;
        justify-content: stretch;
        min-height: 100vh;
        padding: 22px 16px;
    }

    .business-card-shell {
        justify-self: center;
    }

    .business-card-band {
        padding: 22px 20px 0;
    }

    .bv-tpl-fascia .business-card-shell {
        border-top-width: 36px;
    }

    .business-card-body {
        gap: 14px;
        padding: 14px 20px 22px;
    }

    .bv-tpl-testata .business-card-band {
        padding: 24px 20px 22px;
    }

    .bv-tpl-cornice .business-card-band {
        padding: 22px 18px 0;
    }

    .bv-tpl-cornice .business-card-body {
        padding: 16px 18px 22px;
    }

    .business-card-logo {
        max-height: 72px;
        max-width: 180px;
    }

    .business-card-person h1 {
        font-size: 23px;
    }

    .business-card-details {
        grid-template-columns: 1fr;
    }

    .business-card-note {
        justify-self: center;
        max-width: min(88vw, 376px);
        width: 100%;
    }
}
