/* telofixo — foglio di stile minimale, senza build step */

:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --border: #e3e6ea;
    --text: #1d2330;
    --muted: #667085;
    --primary: #2f5bea;
    --primary-hover: #2449c4;
    --primary-soft: #eef2fe;
    --danger: #d92d20;
    --danger-soft: #fef3f2;
    --success: #067647;
    --success-soft: #ecfdf3;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --font: ui-sans-serif, 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;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

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

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.mb-1 { margin-bottom: .5rem; }
.pre-line { white-space: pre-line; }
.m-0 { margin: 0; }
.mt-section { margin-top: 1.25rem; }
.grow { flex: 1; }

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

.container { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }
.container-narrow { max-width: 960px; }
.container-slim { max-width: 760px; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar .container {
    display: flex;
    align-items: center;
    gap: .5rem 1.5rem;
    min-height: 60px;
    flex-wrap: wrap;
    padding-top: .65rem;
}

.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand em, .app-footer-brand em { font-style: normal; color: var(--primary); }
.brand-with-logo { display: inline-flex; align-items: center; gap: .55rem; }
.brand-logo { width: 1.9rem; height: 1.9rem; flex: none; }

.nav-toggle { display: none; }
.nav-toggle-label { display: none; margin-left: auto; cursor: pointer; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: 8px; }

.nav { display: flex; align-items: center; gap: .25rem; flex: 1 1 100%; }
.nav a, .nav .nav-button {
    color: var(--muted);
    padding: .45rem .75rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: .92rem;
}
.nav a:hover, .nav .nav-button:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav .spacer { flex: 1; }
.nav form { margin: 0; }
.nav .nav-button { background: none; border: 0; cursor: pointer; font: inherit; font-weight: 500; font-size: .92rem; }
.nav .user { color: var(--text); font-weight: 600; font-size: .92rem; padding: 0 .5rem; }

.main { padding: 1.75rem 0 3rem; }
/* The footer stays at the bottom of short pages: the main area takes the free height. */
body:has(> .app-footer, > .public-footer) { min-height: 100vh; display: flex; flex-direction: column; }
body:has(> .app-footer, > .public-footer) > .main { flex: 1 0 auto; }
.app-footer { border-top: 1px solid var(--border); background: var(--surface); padding: .9rem 0; font-size: .8rem; color: var(--muted); text-align: center; }
.app-footer-content { display: flex; align-items: center; justify-content: center; gap: .45rem; }
.app-footer-logo { width: 1.1rem; height: 1.1rem; flex: none; }
.app-footer-brand { color: var(--text); }
/* Version tooltip on the footer logo: shown at once on hover (a native title appears only after a delay). */
.app-footer-version { position: relative; display: flex; cursor: help; }
.app-footer-version::after {
    content: attr(data-tooltip); position: absolute; bottom: calc(100% + .45rem); left: 50%; transform: translateX(-50%);
    z-index: 5; pointer-events: none; white-space: nowrap; opacity: 0; transition: opacity .12s;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 8px 20px rgba(16, 24, 40, .12); padding: .3rem .55rem; color: var(--text);
}
.app-footer-version:hover::after { opacity: 1; }

/* Customer-facing pages: header and footer sized and coloured like the emails' (resources/views/vendor/mail/html/themes/telofixo.css). */
.public-header { padding: 1.5rem 1.25rem; text-align: center; }
.public-brand { display: inline-flex; align-items: center; gap: .625rem; font-size: 1.25rem; font-weight: 700; color: var(--text); }
.public-logo { width: 3rem; height: 3rem; flex: none; }
/* An uploaded logo keeps its proportions (often wider than tall). */
.public-logo-image { width: auto; max-width: 12rem; object-fit: contain; }
.public-header + .main { padding-top: .25rem; }
.public-footer { padding: 0 1.25rem 2rem; text-align: center; font-size: .75rem; color: var(--muted); }
.public-footer p { margin: 0 0 .5rem; }

/* ---------- Notifications ---------- */

.notification-bell { margin-left: auto; }
.notification-bell ~ .nav-toggle-label { margin-left: 0; }
.notification-bell-button {
    position: relative; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; padding: 0;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); cursor: pointer;
}
.notification-bell-button:hover, .notification-bell-button:focus-visible { color: var(--text); background: var(--bg); }
.notification-count {
    position: absolute; top: -.4rem; right: -.45rem; min-width: 1.2rem; height: 1.2rem; padding: 0 .3rem;
    border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1.2rem; text-align: center;
}
/* Below the header, aligned with the right edge of the container. */
.notification-panel {
    inset: 64px max(1rem, calc((100vw - 1180px) / 2 + 1.25rem)) auto auto; margin: 0;
    width: min(400px, calc(100vw - 2rem)); max-height: calc(100vh - 80px); overflow-y: auto; padding: 0;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
    box-shadow: 0 12px 32px rgba(16, 24, 40, .14);
}
.notification-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.notification-panel-header h3 { margin: 0; font-size: 1rem; }
.notification-panel-footer { display: block; padding: .7rem 1rem; border-top: 1px solid var(--border); text-align: center; font-size: .88rem; font-weight: 500; }
.link-button { border: 0; background: none; padding: 0; color: var(--primary); font: inherit; font-size: .85rem; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
.notification-list { list-style: none; margin: 0; padding: 0; }
.notification-list li + li { border-top: 1px solid var(--border); }
.notification-item { margin: 0; }
.notification-item button {
    display: grid; gap: .15rem; width: 100%; padding: .75rem 1rem .75rem 1.6rem; position: relative;
    border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.notification-item button:hover, .notification-item button:focus-visible { background: var(--bg); }
.notification-item.is-unread button { background: var(--primary-soft); }
.notification-item.is-unread button:hover { background: #e3e9fd; }
.notification-item.is-unread button::before {
    content: ""; position: absolute; left: .65rem; top: 1.15rem; width: .45rem; height: .45rem; border-radius: 50%; background: var(--primary);
}
.notification-title { font-weight: 600; font-size: .92rem; }
.notification-item:not(.is-unread) .notification-title { font-weight: 500; }
.notification-body { font-size: .88rem; color: var(--muted); white-space: pre-line; }
.notification-time { font-size: .78rem; color: var(--muted); }

/* ---------- Global search ---------- */

.global-search { position: relative; flex: 1 1 300px; margin: 0; }
.global-search input[type=search] { padding-right: 2rem; background: var(--bg); }
.global-search input[type=search]:focus { background: var(--surface); }
.global-search-hint {
    position: absolute; right: .55rem; top: 50%; transform: translateY(-50%);
    font: 600 .72rem/1 var(--font); color: var(--muted);
    border: 1px solid var(--border); border-radius: 4px; padding: .15rem .35rem; background: var(--surface);
    pointer-events: none;
}
.global-search:focus-within .global-search-hint { display: none; }
.global-search.is-loading::after {
    content: ""; position: absolute; right: .7rem; top: 50%; width: .9rem; height: .9rem; margin-top: -.45rem;
    border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%;
    animation: gs-spin .7s linear infinite; pointer-events: none;
}
@keyframes gs-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .global-search.is-loading::after { animation-duration: 2s; } }
.global-search-results {
    position: absolute; top: calc(100% + 6px); left: 0; width: max(100%, 380px); max-height: 70vh; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(16, 24, 40, .14); z-index: 20; padding: .35rem 0;
}
.gs-group + .gs-group { border-top: 1px solid var(--border); margin-top: .35rem; padding-top: .35rem; }
.gs-group-title { padding: .35rem .9rem; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.gs-option { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem .9rem; color: var(--text); }
.gs-option:hover, .gs-option[aria-selected=true] { background: var(--primary-soft); text-decoration: none; }
.gs-text { display: flex; flex-direction: column; min-width: 0; }
.gs-title { font-weight: 600; font-size: .9rem; }
.gs-subtitle { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-option mark { background: #fff3c4; color: inherit; border-radius: 2px; padding: 0 1px; }
.gs-empty { padding: .9rem; color: var(--muted); font-size: .9rem; }
.gs-more { display: block; padding: .55rem .9rem; border-top: 1px solid var(--border); margin-top: .35rem; font-size: .85rem; font-weight: 500; }
.customer-picker-control { position: relative; }
.customer-picker-control .global-search-results { width: 100%; }

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.page-header p { margin: .25rem 0 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Card ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 1.25rem; }
.grid > .card + .card { margin-top: 0; }
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.card-body { padding: 1.25rem; }
.card-footer { padding: .9rem 1.25rem; border-top: 1px solid var(--border); }
.card-toolbar { padding: .75rem 1.25rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; background: #fafbfc; }
.text-danger { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.active-filters { justify-content: flex-start; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: .82rem; font-weight: 500; }
.chip:hover { text-decoration: none; background: #e0e8fd; }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* One row of KPI cards, however many the user is allowed to see. */
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.span-2 { grid-column: span 2; }

.stat { padding: 1.1rem 1.25rem; }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.75rem; font-weight: 650; margin-top: .2rem; }

/* ---------- Description list ---------- */

.details { display: grid; grid-template-columns: 160px 1fr; gap: .6rem 1rem; margin: 0; }
.details dt { color: var(--muted); font-size: .88rem; }
.details dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- Table ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .75rem 1.25rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafbfc; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.table-plain td { padding-left: 0; padding-right: 0; }
.table-plain tbody tr:hover { background: none; }
td.indent { padding-left: 2rem; }
.th-sub { text-transform: none; letter-spacing: 0; font-weight: 400; }
/* Sortable column headers (x-sortable-th). */
.sort-link { display: inline-flex; align-items: center; gap: .3rem; color: inherit; white-space: nowrap; }
.sort-link:hover, .sort-link.is-active { color: var(--text); text-decoration: none; }
.sort-indicator { font-size: .7rem; opacity: .4; }
.sort-link:hover .sort-indicator { opacity: .8; }
.sort-link.is-active .sort-indicator { opacity: 1; color: var(--primary); }

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

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid-tight { gap: 1rem; }
.grid-tight { gap: .6rem 1.25rem; }
.field label, .field-label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: .35rem; }
.field .required::after { content: " *"; color: var(--danger); }
.hint { color: var(--muted); font-size: .8rem; margin-top: .3rem; }
.secret-input { display: flex; gap: .5rem; align-items: center; }
.secret-input input { flex: 1; }
.char-counter { color: var(--muted); font-size: .8rem; margin-top: .3rem; text-align: right; font-variant-numeric: tabular-nums; }
.char-counter.is-low { color: #b54708; font-weight: 600; }

input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number],
input[type=date], input[type=search], select, textarea {
    width: 100%;
    padding: .55rem .75rem;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid #d0d5dd;
    border-radius: 8px;
    transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 91, 234, .15); }
input:disabled, select:disabled { background: var(--bg); color: var(--muted); }
.is-invalid { border-color: var(--danger) !important; }
.error { color: var(--danger); font-size: .82rem; margin-top: .3rem; }

.checkbox { display: flex; align-items: flex-start; gap: .55rem; font-size: .92rem; cursor: pointer; }
.checkbox input { margin-top: .2rem; width: 16px; height: 16px; accent-color: var(--primary); }

.accessory-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .6rem; }
.accessory { padding: .35rem .7rem .35rem .55rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: .88rem; align-items: center; }
.accessory input { margin-top: 0; }
.accessory:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.accessory[hidden] { display: none; }
.accessory-add { display: flex; gap: .5rem; max-width: 420px; }
.fieldset { border: 0; padding: 0; margin: 0; }
.fieldset legend { font-weight: 600; margin-bottom: .75rem; padding: 0; }
.fieldset + .fieldset { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.filters input[type=search] { flex: 1 1 240px; width: auto; }
.filters select { flex: 0 1 220px; width: auto; }

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1rem;
    font: inherit;
    font-weight: 500;
    font-size: .92rem;
    line-height: 1.2;
    border-radius: 8px;
    border: 1px solid #d0d5dd;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #fda29b; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }
.inline-form { display: inline; margin: 0; }

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    background: #f2f4f7;
    color: #344054;
}
.badge-blue { background: #eff8ff; color: #175cd3; }
.badge-amber { background: #fffaeb; color: #b54708; }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-teal { background: #f0fdf9; color: #107569; }
.badge-red { background: var(--danger-soft); color: #b42318; }

/* ---------- Alerts ---------- */

.alert { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1.25rem; border: 1px solid; font-size: .92rem; }
.alert-success { background: var(--success-soft); border-color: #abefc6; color: var(--success); }
.alert-error { background: var(--danger-soft); border-color: #fecdca; color: #b42318; }

.audit-changes { list-style: none; margin: 0; padding: 0; font-size: .82rem; display: grid; gap: .15rem; max-width: 420px; }
.audit-changes li { overflow-wrap: anywhere; }

/* ---------- Attachments ---------- */

.attachment-list { list-style: none; margin: 0; padding: 0; }
.attachment-list li { display: flex; align-items: center; gap: .75rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--border); }
.attachment-list li:last-child { border-bottom: 0; }
.attachment-type { flex: none; min-width: 44px; padding: .3rem .4rem; border-radius: 6px; background: var(--bg); color: var(--muted); font-size: .7rem; font-weight: 700; text-align: center; }
.attachment-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.attachment-info a { overflow-wrap: anywhere; font-weight: 500; }
.attachment-info .meta { color: var(--muted); font-size: .8rem; }
.attachment-upload { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.attachment-input { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 220px; }
.attachment-input input[type=file] { flex: 1; min-width: 0; font-size: .88rem; }
.attachment-counter { flex: none; font-size: .8rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; padding: .15rem .5rem; border-radius: 999px; background: var(--bg); }
.attachment-counter.is-over { color: #b42318; background: var(--danger-soft); }

/* ---------- Timeline ---------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1.1rem 1.4rem; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .meta { color: var(--muted); font-size: .8rem; }
.timeline .note { margin-top: .3rem; font-size: .9rem; white-space: pre-line; }
.timeline .note-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.comm-list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .35rem; }
.comm-list li { padding: .45rem .6rem; background: var(--bg); border-radius: 8px; font-size: .85rem; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.comm-list li::before, .comm-list li::after { display: none; }
.comm-recipient { font-weight: 500; overflow-wrap: anywhere; }
.comm-error { flex-basis: 100%; color: var(--danger); font-size: .8rem; }

/* ---------- Ticket progress ---------- */

.progress { display: flex; list-style: none; margin: 0; padding: 0; }
.progress-step { position: relative; flex: 1 1 0; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 .35rem; min-width: 0; }
.progress-step::before {
    content: "";
    position: absolute;
    top: 15px;
    right: 50%;
    width: 100%;
    height: 2px;
    background: var(--border);
}
.progress-step:first-child::before { display: none; }
.progress-marker {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
}
.progress-text { display: flex; flex-direction: column; margin-top: .5rem; gap: .1rem; }
.progress-label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.progress-date { font-size: .8rem; }
.progress-meta { font-size: .75rem; color: var(--muted); }

.progress-step.is-done .progress-marker { background: var(--primary); border-color: var(--primary); color: #fff; }
.progress-step.is-done .progress-label { color: var(--text); }
.progress-step.is-done::before,
.progress-step.is-current::before,
.progress-step.is-skipped::before,
.progress-step.is-cancelled::before { background: var(--primary); }
.progress-step.is-current .progress-marker { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.progress-step.is-current .progress-label { color: var(--primary); }
.progress-step.is-skipped .progress-marker { border-style: dashed; }
.progress-step.is-cancelled .progress-marker { background: var(--danger); border-color: var(--danger); color: #fff; }
.progress-step.is-cancelled .progress-label { color: var(--danger); }

button.progress-marker { cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; padding: 0; }
.progress-marker.is-clickable { border-color: var(--primary); color: var(--primary); border-style: solid; transition: transform .12s, box-shadow .12s; }
.progress-marker.is-clickable:hover, .progress-marker.is-clickable:focus-visible { transform: scale(1.12); box-shadow: 0 0 0 4px var(--primary-soft); outline: none; }
.progress-step.is-done .progress-marker.is-clickable { color: #fff; }
.progress-footer { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }

/* ---------- Dialog ---------- */

.dialog { width: min(480px, calc(100% - 2rem)); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 20px 40px rgba(16, 24, 40, .18); color: var(--text); }
.dialog::backdrop { background: rgba(16, 24, 40, .45); }
.dialog form { margin: 0; }
.dialog-body { padding: 1.25rem; }
.notify-channels { display: grid; gap: .45rem; }
.notify-channels legend { font-size: .9rem; font-weight: 500; margin-bottom: .35rem; }
.dialog-footer { padding: .9rem 1.25rem; border-top: 1px solid var(--border); justify-content: flex-end; }

/* ---------- Empty / auth ---------- */

.empty { padding: 2.5rem 1.25rem; text-align: center; color: var(--muted); }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-box { width: 100%; max-width: 400px; }
.auth .brand { display: block; text-align: center; font-size: 1.4rem; margin-bottom: 1.25rem; }
.auth .brand-with-logo { display: flex; justify-content: center; }
.auth .brand-logo { width: 2.4rem; height: 2.4rem; }
.auth .brand-large { flex-direction: column; align-items: center; gap: .75rem; font-size: 1.9rem; margin-bottom: 1.5rem; }
.auth .brand-large .brand-logo { width: 7rem; height: 7rem; }
.stack > * + * { margin-top: 1rem; }

/* ---------- Pagination ---------- */

.pagination { display: flex; gap: .3rem; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; justify-content: center; }
.pagination a, .pagination span {
    display: block;
    min-width: 34px;
    padding: .35rem .6rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .88rem;
    color: var(--text);
    background: var(--surface);
}
.pagination a:hover { background: var(--bg); text-decoration: none; }
.pagination .active span { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .disabled span { color: #98a2b3; }

/* ---------- Impostazioni ---------- */

.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: .15rem; position: sticky; top: 1rem; }
.settings-nav a { padding: .5rem .75rem; border-radius: 8px; color: var(--text); }
.settings-nav a:hover { background: var(--bg); text-decoration: none; }
.settings-nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.settings-content > .card + .card, .settings-content > .card + p { margin-top: 1.25rem; }
.status-message + .status-message, .settings-content .card-body > .field + .field { margin-top: 1rem; }
.status-message-header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.settings-preview { background: var(--bg); }
.settings-preview h3 { margin: .5rem 0 .25rem; }

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

@media (max-width: 960px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3, .grid-main { grid-template-columns: minmax(0, 1fr); }
    .settings-layout { grid-template-columns: minmax(0, 1fr); }
    .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 760px) {
    .nav-toggle-label { display: block; }
    .global-search { order: 3; flex-basis: 100%; margin-bottom: .75rem; }
    .global-search-hint { display: none; }
    .global-search-results { width: 100%; }
    .nav { order: 4; display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: .75rem; }
    .nav .spacer { display: none; }
    .nav .user { padding: .5rem .75rem; border-top: 1px solid var(--border); margin-top: .25rem; }
    .nav-toggle:checked ~ .nav { display: flex; }
    .nav .nav-button { width: 100%; text-align: left; }

    .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
    .span-2 { grid-column: auto; }
    .details { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
    .details dd { margin-bottom: .6rem; }
    th, td { padding: .65rem .9rem; }
    .hide-sm { display: none; }

    .progress { flex-direction: column; }
    .progress-step { flex-direction: row; align-items: flex-start; text-align: left; gap: .75rem; padding: 0 0 1rem; }
    .progress-step:last-child { padding-bottom: 0; }
    .progress-step::before { display: none; }
    .progress-step:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--border); }
    .progress-step.is-done::after, .progress-step.is-skipped::after { background: var(--primary); }
    .progress-text { margin-top: .3rem; }
    .main { padding-top: 1.25rem; }
}

/* ---------- Charts ---------- */

.chart { margin: 0; }
.chart-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-bottom: .5rem; }
.chart-legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.chart-key { width: 10px; height: 10px; border-radius: 2px; background: var(--key); }
.chart-key-line { width: 14px; height: 2px; border-radius: 1px; }
.chart-plot { overflow-x: auto; overflow-y: visible; }
.chart-canvas { position: relative; min-width: calc(var(--chart-width, 640px) * .75); }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 4px; }
.chart-grid line { stroke: #e9ebee; stroke-width: 1; }
.chart-grid line.chart-baseline { stroke: #c9ced6; }
.chart-grid text, .chart-axis text { fill: #8a909a; font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-end-label { fill: var(--text); font-size: 12px; font-weight: 600; paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
.chart-crosshair { stroke: #b3b9c3; stroke-width: 1; }
.chart-hover-band { fill: rgba(16, 24, 40, .04); }
.chart-svg a path { transition: opacity .12s; }
.chart-svg a:hover path { opacity: .85; }
.chart-tooltip {
    position: absolute; top: 0; z-index: 5; pointer-events: none; min-width: 140px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 8px 20px rgba(16, 24, 40, .12); padding: .5rem .65rem; font-size: .8rem;
}
.chart-tooltip-title { color: var(--muted); margin-bottom: .25rem; }
.chart-tooltip-row { display: flex; align-items: center; gap: .45rem; white-space: nowrap; }
.chart-tooltip-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.chart-data { margin-top: .5rem; font-size: .85rem; }
.chart-data summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.chart-data table { margin-top: .5rem; }
.chart-data th, .chart-data td { padding: .4rem .6rem; }

.bar-list { display: grid; gap: .6rem; }
.bar-list-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; align-items: center; gap: .75rem; color: var(--text); font-size: .88rem; }
a.bar-list-row:hover { text-decoration: none; }
a.bar-list-row:hover .bar-list-bar span { opacity: .85; }
.bar-list-bar { height: 14px; background: transparent; }
.bar-list-bar span { display: block; height: 100%; background: #2a78d6; border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-list-value { font-weight: 600; font-variant-numeric: tabular-nums; }

.stats-filters { display: flex; gap: .75rem 1rem; flex-wrap: wrap; align-items: center; }
.date-range { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0; padding: 2px 2px 2px .75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: .88rem; color: var(--muted); }
.date-range.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.date-range input[type=date] { width: auto; padding: .3rem .5rem; font-size: .88rem; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 2px; flex-wrap: wrap; }
.segmented a { padding: .4rem .8rem; border-radius: 6px; color: var(--muted); font-size: .88rem; font-weight: 500; }
.segmented a:hover { text-decoration: none; color: var(--text); background: var(--bg); }
.segmented a[aria-current=page] { background: var(--primary); color: #fff; }
a.stat { color: inherit; display: block; transition: border-color .12s, box-shadow .12s; }
a.stat:hover { text-decoration: none; border-color: #b8c7f5; box-shadow: 0 0 0 3px var(--primary-soft); }
.stat .hint-link { font-size: .75rem; color: var(--primary); margin-top: .2rem; }

/* ---------- Satisfaction survey ---------- */

.nps-scale { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: .35rem; margin-top: .75rem; }
.nps-scale label { margin: 0; }
.nps-scale input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.nps-scale span { display: block; padding: .7rem 0; text-align: center; font-weight: 700; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }
.nps-scale label:hover span { border-color: var(--primary); }
.nps-scale input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.nps-scale input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.nps-scale-preview span { cursor: default; padding: .45rem 0; font-size: .85rem; }
.nps-score { font-size: 1.6rem; font-weight: 700; }
.nps-split { display: flex; gap: 2px; height: 6px; margin-top: .35rem; border-radius: 3px; overflow: hidden; }
.nps-promoters { background: var(--success); }
.nps-passives { background: #f79009; }
.nps-detractors { background: var(--danger); }
.nps-legend { display: flex; justify-content: space-between; margin-top: .35rem; }
@media (max-width: 520px) { .nps-scale { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* ---------- Info popover ("i" button) ---------- */

.stat-with-info { position: relative; display: grid; }
.stat-with-info > .info-button { position: absolute; top: .9rem; right: .9rem; }
.stat-with-info .label { padding-right: 1.75rem; }
.heading-with-info { display: flex; align-items: center; gap: .5rem; }
.info-button {
    width: 1.35rem; height: 1.35rem; padding: 0; border-radius: 50%; border: 1px solid var(--border);
    background: var(--surface); color: var(--muted); font: italic 700 .8rem/1 Georgia, serif; cursor: pointer;
}
.info-button:hover, .info-button:focus-visible { color: var(--primary); border-color: var(--primary); }
.info-popover {
    width: min(460px, calc(100vw - 2rem)); padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text); box-shadow: 0 16px 40px rgba(16, 24, 40, .2);
}
.info-popover::backdrop { background: rgba(16, 24, 40, .25); }
.info-popover-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.info-popover-header h3 { margin: 0; font-size: 1rem; }
.info-popover-close { border: 0; background: none; font-size: 1.4rem; line-height: 1; color: var(--muted); cursor: pointer; }
.info-popover-body { padding: .2rem 1.1rem .9rem; font-size: .9rem; }
.nps-info-legend { list-style: none; padding: 0; margin: .5rem 0; }
.nps-info-legend li { display: flex; align-items: center; gap: .45rem; margin: .25rem 0; }
.nps-info-legend span { width: .75rem; height: .75rem; border-radius: 2px; flex: none; }

/* ---------- Receipt (print) ---------- */

.receipt-page { background: #e9ebef; }
.receipt-actions { max-width: 148mm; margin: 1.25rem auto .75rem; display: flex; justify-content: space-between; gap: .5rem; }
.receipt { max-width: 148mm; margin: 0 auto 2rem; background: #fff; padding: 10mm; box-shadow: var(--shadow); font-size: 13px; }
.receipt-header { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: .75rem; border-bottom: 2px solid var(--text); }
.shop-logo-setting { display: grid; gap: 1rem; justify-items: start; }
.shop-logo-preview { max-width: 240px; max-height: 96px; object-fit: contain; padding: .5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.receipt-logo { display: block; max-width: 45mm; max-height: 18mm; margin-bottom: .35rem; object-fit: contain; }
.receipt-number { font-size: 1.25rem; font-weight: 700; letter-spacing: .02em; }
.receipt-section { padding: .75rem 0; border-bottom: 1px solid var(--border); }
.receipt-section h3 { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .35rem; }
.receipt-details { grid-template-columns: 110px 1fr; gap: .3rem .75rem; }
.receipt-codes { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.receipt-qr { display: flex; gap: .75rem; align-items: center; flex: 1 1 260px; }
.receipt-qr svg { width: 30mm; height: 30mm; flex: none; }
.receipt-url { overflow-wrap: anywhere; margin: .3rem 0 0; }
.receipt-barcode { text-align: center; }
.receipt-barcode svg { width: 50mm; height: 14mm; display: block; }
.receipt-signatures { display: flex; gap: 2rem; margin-top: 1.75rem; }
.receipt-signatures div { flex: 1; border-top: 1px solid var(--text); padding-top: .3rem; font-size: .8rem; color: var(--muted); margin-top: 1.5rem; }

@page { size: A5; margin: 8mm; }

@media print {
    .no-print { display: none !important; }
    .receipt-page { background: #fff; }
    .receipt { box-shadow: none; padding: 0; margin: 0; max-width: none; }
}
