/* Calendario Cometa — design system locale, senza dipendenze. */
:root {
    color-scheme: light;
    --navy: #101e36;
    --navy-soft: #1b2e4b;
    --primary: #3975e8;
    --primary-soft: #edf5ff;
    --surface-soft: #f8fbff;
    --text: #233955;
    --border: #e3edf7;
    --primary-hover: #1c43a4;
    --ink: var(--text);
    --muted: #617089;
    --line: var(--border);
    --canvas: #f5f9ff;
    --surface: #fff;
    --positive: #13745c;
    --positive-bg: #e9f7f0;
    --warning: #89580d;
    --warning-bg: #fff6e2;
    --danger: #b43643;
    --danger-bg: #fff0f1;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 2px 5px #3565a005, 0 12px 32px #3565a00a;
    --space: 24px;
    --sidebar: 232px;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 14px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}
a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    color: var(--primary-hover);
}
button,input,select,textarea {
    font: inherit;
}
button,a,input,select,textarea {
    -webkit-tap-highlight-color: transparent;
}
a,button,input,select,textarea {
    transition: background-color .15s,border-color .15s,box-shadow .15s;
}
:focus-visible {
    outline: 3px solid #6b9af0;
    outline-offset: 3px;
}
h1,h2,h3,p {
    margin: 0 0 12px;
}
h1 {
    font-size: clamp(26px,2.5vw,36px);
    line-height: 1.2;
    letter-spacing: -1.1px;
    font-weight: 750;
}
h2 {
    font-size: 18px;
    letter-spacing: -.3px;
    line-height: 1.4;
}
h3 {
    font-size: 15px;
}
small,.muted {
    color: var(--muted);
}
svg.icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.eyebrow {
    display: block;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 1.7px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}
.skip-link {
    position: fixed;
    top: -100px;
    left: 20px;
    z-index: 20;
    background: white;
    padding: 12px;
}
.skip-link:focus {
    top: 10px;
}
/* Shell e navigazione */
.app-shell {
    min-height: 100vh;
}
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    background: linear-gradient(165deg,#fff 5%,#f1f8ff 70%,#e6f1ff);
    color: var(--text);
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow-y: auto;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    line-height: 1.3;
    padding: 0 8px 34px;
}
.brand:hover {
    color: white;
}
.brand strong {
    font-size: 19px;
    letter-spacing: -.5px;
}
.brand small {
    display: block;
    color: #a8b9d3;
    font-size: 11px;
    letter-spacing: 1px;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 12px;
    background: linear-gradient(140deg,#5485ff,#355acf);
    color: white;
    box-shadow: 0 4px 15px #0002;
}
.brand-mark svg {
    width: 27px;
    height: 27px;
}
.nav-label {
    color: #8fa4c3;
    font-size: 10px;
    letter-spacing: 1.5px;
    padding: 0 14px;
    margin-bottom: 10px;
}
.nav-links {
    display: grid;
    gap: 6px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border-radius: 9px;
    color: #607593;
    font-weight: 550;
    font-size: 13px;
    min-height: 44px;
}
.nav-link:hover {
    color: white;
    background: #e6f0ff;
}
.nav-link[aria-current=page] {
    background: linear-gradient(115deg,#3c78e8,#63a3ef);
    color: white;
    box-shadow: 0 6px 16px #3878df26, inset 0 1px #ffffff50;
}
.sidebar-footer {
    margin-top: auto;
    padding: 30px 14px 0;
    color: #92a8c7;
    font-size: 11px;
}
.sidebar-footer strong {
    display: block;
    color: #c4d2e7;
    font-size: 12px;
}
.app-main {
    margin-left: var(--sidebar);
    min-width: 0;
}
.topbar {
    height: 80px;
    border-bottom: 1px solid var(--line);
    background: #ffffffed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 36px;
}
.topbar-title {
    font-size: 14px;
    font-weight: 650;
}
.topbar-context {
    font-size: 11px;
    color: var(--muted);
    display: block;
}
.user-menu {
    display: flex;
    align-items: center;
    gap: 14px;
}
.avatar {
    width: 36px;
    height: 36px;
    background: #edf2ff;
    color: var(--primary);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 750;
    text-transform: uppercase;
}
.user-info {
    font-size: 12px;
    line-height: 1.45;
}
.user-info strong {
    display: block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-info span {
    font-size: 11px;
    color: var(--muted);
}
.app-content {
    max-width: 1640px;
    margin: auto;
    padding: 34px 36px 56px;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
}
.page-header p {
    color: var(--muted);
    margin: 8px 0 0;
}
.page-header h1 {
    margin: 0;
}
.page-header .eyebrow {
    color: var(--primary);
}
.mobile-nav {
    display: none;
}
.app-public {
    min-height: 100vh;
}
/* Componenti condivisi */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
    min-width: 0;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.card-header h2 {
    margin: 0;
}
.section-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 24px;
}
.section-grid>.card {
    margin: 0;
}
.stack {
    display: grid;
    gap: 24px;
}
.stack>.card {
    margin: 0;
}
.button,button,.azioni>a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    background: var(--primary);
    color: white;
    font-weight: 650;
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}
.button:hover,button:hover,.azioni>a:hover {
    background: var(--primary-hover);
    color: white;
}
.button.secondary,button.secondary,.azioni>a {
    background: white;
    border-color: var(--line);
    color: var(--ink);
}
.button.secondary:hover,button.secondary:hover,.azioni>a:hover {
    background: #f0f4fb;
    border-color: #bccae0;
    color: var(--primary);
}
.button.danger,button.danger {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: #f3ccd1;
}
.button.success,button.success {
    background: var(--positive);
    color: white;
}
.button.small,button.small {
    min-height: 36px;
    padding: 6px 11px;
    font-size: 12px;
}
.button.ghost {
    background: transparent;
    color: var(--muted);
    border-color: transparent;
}
.button:disabled,button:disabled {
    opacity: .5;
    cursor: not-allowed;
}
.azioni,.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.azioni {
    margin: 18px 0;
}
.azioni form,.toolbar form {
    margin: 0;
}
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.5;
    background: #edf2ff;
    color: #3455a1;
    white-space: normal;
}
.badge.positive,.status-CHIUSO,.status-ESEGUITO,.status-FATTURATO,.status-CONSEGNATO {
    background: var(--positive-bg);
    color: var(--positive);
}
.badge.warning,.status-DA_FATTURARE,.status-ATTESA_RICAMBI {
    background: var(--warning-bg);
    color: var(--warning);
}
.badge.neutral,.status-ANNULLATO {
    background: #eef1f5;
    color: #59677c;
}
.badge.danger {
    background: var(--danger-bg);
    color: var(--danger);
}
.status-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.empty-state {
    padding: 36px 20px;
    text-align: center;
    color: var(--muted);
}
.empty-state strong {
    display: block;
    color: var(--ink);
    font-size: 15px;
    margin: 8px 0;
}
.empty-state p {
    margin: 0;
    font-size: 13px;
}
.empty-icon {
    display: inline-grid;
    place-items: center;
    background: #edf2ff;
    color: var(--primary);
    width: 44px;
    height: 44px;
    border-radius: 13px;
}
.alert {
    padding: 16px 20px;
    border: 1px solid #d4e1ff;
    border-radius: 12px;
    background: #eef4ff;
    color: #294d94;
    margin-bottom: 20px;
}
.alert.success {
    color: var(--positive);
    background: var(--positive-bg);
    border-color: #c8e8d9;
}
.alert.warning,.avviso {
    color: var(--warning);
    background: var(--warning-bg);
    border-color: #efdcaf;
}
.alert.error {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: #f0cbd0;
}
.alert p:last-child {
    margin: 0;
}
.alert a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.text-block {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.contact-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.contact-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f6fb;
    border-radius: 7px;
    padding: 6px 10px;
    font-size: 12px;
    overflow-wrap: anywhere;
}
.detail-label {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 4px;
}
.detail-value {
    font-size: 15px;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.stat-value {
    font-size: 46px;
    font-weight: 750;
    line-height: 1.15;
    letter-spacing: -2px;
    margin: 16px 0;
}
.kpi {
    position: relative;
    overflow: hidden;
}
.kpi:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
}
.kpi.warning:before {
    background: #d7a044;
}
.kpi a {
    font-size: 13px;
    font-weight: 650;
}
.stat-caption {
    color: var(--muted);
    font-size: 12px;
}
.time-total {
    padding: 15px 20px;
    background: #edf3ff;
    border-radius: 12px;
    min-width: 165px;
}
.time-total strong {
    display: block;
    font-size: 26px;
    color: var(--primary);
    letter-spacing: -.7px;
}
.record {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
}
.record:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}
.record:first-child {
    padding-top: 0;
}
.record p {
    margin: 5px 0 0;
    color: var(--muted);
}
.record .azioni {
    margin: 0;
}
.record-main {
    min-width: 0;
    overflow-wrap: anywhere;
}
.record-code {
    font-size: 11px;
    color: var(--muted);
    margin-right: 6px;
}
/* Form e filtri */
.form-card {
    max-width: 940px;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 20px 24px;
}
.field {
    min-width: 0;
}
.field.wide {
    grid-column: 1/-1;
}
label {
    display: block;
    margin-bottom: 7px;
    font-size: 12px;
    font-weight: 650;
    color: #34455e;
}
.required {
    color: var(--primary);
    margin-left: 3px;
}
input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea {
    width: 100%;
    min-height: 43px;
    border: 1px solid #cfd8e6;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 10px 12px;
    max-width: 100%;
    box-shadow: 0 1px 2px #17263e03;
}
input:hover,select:hover,textarea:hover {
    border-color: #9fb2cd;
}
input:focus,select:focus,textarea:focus {
    border-color: #5080e4;
    box-shadow: 0 0 0 3px #2859cc12;
}
textarea {
    min-height: 125px;
    resize: vertical;
    line-height: 1.6;
}
input[type=checkbox],input[type=radio] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    vertical-align: middle;
    margin: 4px 8px 4px 0;
}
.helptext,.field-help {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
}
.field-help ul {
    padding-left: 18px;
}
.errorlist {
    list-style: none;
    padding: 0;
    margin: 6px 0;
    color: var(--danger);
    font-size: 12px;
    font-weight: 550;
}
.has-error input,.has-error select,.has-error textarea,[aria-invalid=true] {
    border-color: var(--danger)!important;
}
.form-actions {
    border-top: 1px solid var(--line);
    margin-top: 24px;
    padding-top: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
}
.filters {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}
.filters .form-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    flex: 1;
}
.filters .field {
    flex: 1;
    min-width: 145px;
}
.filters .field.wide {
    flex-basis: 200px;
}
.filters .field:has(input[type=checkbox]) {
    flex: 0 0 auto;
    min-width: 145px;
}
.filters>.field {
    flex: 1;
}
.filters .field-help {
    display: none;
}
/* Tables */
.table-card {
    padding: 0;
    overflow: hidden;
}
.table-card .card-header {
    padding: 20px 24px;
    margin: 0;
    border-bottom: 1px solid var(--line);
}
.tabella {
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: thin;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}
th {
    background: #f8fafd;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .65px;
    text-transform: uppercase;
    font-weight: 700;
    padding: 14px 18px;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
}
td {
    padding: 17px 18px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    overflow-wrap: anywhere;
}
tbody tr:last-child td {
    border-bottom: 0;
}
tbody tr:hover {
    background: #fafcff;
}
td strong {
    font-weight: 650;
}
td .muted {
    display: block;
    font-size: 11px;
    margin-top: 3px;
}
.table-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    min-width: 145px;
}
.table-actions form {
    margin: 0;
}
.table-link {
    font-weight: 650;
}
.cell-summary {
    min-width: 180px;
    max-width: 340px;
}
.nowrap {
    white-space: nowrap;
}
/* Calendario mensile e giornaliero */
.calendar-header h1 {
    text-transform: capitalize;
}
.calendar-toolbar {
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--line);
}
.calendar-toolbar .button {
    min-height: 36px;
    padding: 6px 12px;
}
.calendar-key {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 11px;
    color: var(--muted);
}
.calendar-key span {
    display: flex;
    align-items: center;
    gap: 6px;
}
.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-block;
}
.dot.green {
    background: var(--positive);
}
.calendario {
    table-layout: fixed;
    min-width: 770px;
}
.calendario th {
    text-align: center;
    background: white;
    padding: 16px 6px;
    font-size: 10px;
}
.calendario td {
    height: 146px;
    padding: 8px;
    border-right: 1px solid var(--line);
    transition: background .15s;
}
.calendario td:last-child {
    border-right: 0;
}
.calendario td:nth-child(n+6) {
    background: #f8fafd;
}
.calendario td:hover {
    background: #f0f5fe;
}
.calendario tr:hover {
    background: transparent;
}
.calendario .outside {
    background: #f9fafc;
    color: #8995a8;
}
.outside .day-number {
    color: #8995a8;
}
.day-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 7px;
}
.day-number {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    color: var(--ink);
    border-radius: 9px;
    font-size: 12px;
    font-weight: 650;
}
.day-number:hover {
    background: #e3ebfc;
}
.today .day-number {
    background: var(--primary);
    color: white;
}
.calendario td.today {
    background: #f5f8ff;
    box-shadow: inset 0 2px var(--primary);
}
.today-label {
    font-size: 9px;
    color: var(--primary);
    font-weight: 700;
}
.day-events {
    max-height: 165px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #becde6 transparent;
}
.appointment {
    display: block;
    background: #edf3ff;
    border: 1px solid #dde8ff;
    border-left: 3px solid #527cdd;
    color: #284775;
    border-radius: 6px;
    margin: 5px 0;
    padding: 7px 8px;
    font-size: 11px;
    line-height: 1.4;
    overflow: hidden;
}
.appointment:hover {
    background: #e1ebff;
    box-shadow: 0 2px 6px #2859cc15;
    color: #173f86;
}
.appointment strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 2px 0;
}
.appointment small {
    font-size: 9px;
    color: inherit;
    display: block;
}
.appointment time {
    font-weight: 750;
    font-size: 10px;
}
.appointment.status-CONFERMATO,.appointment.status-ARRIVATO,.appointment.status-ESEGUITO {
    background: #edf8f3;
    border-color: #d3ecdf;
    border-left-color: #3a977c;
    color: #21664f;
}
.appointment.status-ANNULLATO {
    background: #fff0f2;
    border-color: #f5d9de;
    color: #a5495c;
}
.calendar-footer {
    padding: 13px 22px;
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.day-event {
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 24px;
    padding: 20px 24px;
    align-items: center;
    border-bottom: 1px solid var(--line);
}
.day-event:last-child {
    border: 0;
}
.day-event time {
    font-size: 20px;
    color: var(--primary);
    font-weight: 700;
}
.day-event time small {
    display: block;
    font-size: 11px;
    font-weight: 400;
}
.calendar-hint {
    display: none;
}
/* Login e stampa */
.login-page {
    background: radial-gradient(ellipse at 15% 15%,#dce7ff 0,transparent 48%),radial-gradient(ellipse at 85% 85%,#e3ebf8 0,transparent 45%),#f3f6fb;
}
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
}
.login-card {
    width: 100%;
    max-width: 430px;
    background: white;
    border: 1px solid #dfe7f4;
    border-radius: 24px;
    box-shadow: 0 24px 80px #172b5010;
    padding: 40px;
}
.login-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 38px;
}
.login-brand strong {
    display: block;
    font-size: 20px;
    letter-spacing: -.6px;
}
.login-brand small {
    display: block;
    font-size: 11px;
}
.login-card h1 {
    font-size: 28px;
}
.login-card .field {
    margin-top: 20px;
}
.login-card .login-submit {
    width: 100%;
    margin-top: 26px;
}
.login-footer {
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    margin: 24px 0 0;
}
.scheda {
    max-width: 1000px;
    margin: auto;
    background: white;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 40px;
}
.print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid var(--navy);
    padding-bottom: 22px;
    margin-bottom: 26px;
    gap: 20px;
}
.print-header h1 {
    font-size: 26px;
}
.print-header p {
    margin: 0;
}
.scheda section {
    margin: 24px 0;
}
.scheda section h2 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
}
.scheda p {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.scheda table {
    table-layout: fixed;
}
.print-total {
    text-align: right;
    font-size: 16px;
    font-weight: 700;
    margin-top: 12px;
}
@media(min-width:1600px) {
    .calendario td {
        height: 170px;
    }
}
@media(max-width:1150px) {
    :root {
        --sidebar: 205px;
    }
    .app-content {
        padding: 26px 22px;
    }
    .topbar {
        padding: 0 22px;
    }
    .user-info strong {
        max-width: 120px;
    }
    .calendar-key {
        display: none;
    }
    .section-grid {
        gap: 18px;
    }
}
@media(max-width:800px) {
    .sidebar {
        position: static;
        width: auto;
        padding: 16px;
    }
    .sidebar .brand {
        padding: 0 0 14px;
    }
    .sidebar-footer,.nav-label {
        display: none;
    }
    .nav-links {
        display: flex;
        overflow-x: auto;
        gap: 6px;
        padding-bottom: 3px;
    }
    .nav-link {
        white-space: nowrap;
        padding: 9px 12px;
        min-height: 42px;
    }
    .nav-link .icon {
        width: 17px;
        height: 17px;
    }
    .app-main {
        margin: 0;
    }
    .topbar {
        height: 65px;
        padding: 0 20px;
    }
    .topbar-context {
        display: none;
    }
    .app-content {
        padding: 24px 18px 40px;
    }
    .page-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }
    .section-grid {
        grid-template-columns: 1fr;
    }
    .card {
        padding: 20px;
    }
    .table-card {
        padding: 0;
    }
    .calendar-hint {
        display: block;
        margin: 0 0 12px;
        font-size: 11px;
        color: var(--muted);
    }
    .form-grid {
        gap: 18px;
    }
    .table-card table:not(.calendario) {
        min-width: 650px;
    }
    .scheda {
        padding: 24px;
    }
    .record {
        flex-wrap: wrap;
    }
    .calendar-footer {
        flex-wrap: wrap;
    }
}
@media(max-width:480px) {
    .topbar-title {
        font-size: 12px;
    }
    .avatar {
        display: none;
    }
    .user-menu {
        gap: 8px;
    }
    .user-info strong {
        max-width: 100px;
    }
    .topbar {
        padding: 0 16px;
    }
    .app-content {
        padding: 22px 14px 36px;
    }
    .page-header {
        gap: 16px;
    }
    .page-header>.button {
        width: 100%;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .field.wide {
        grid-column: auto;
    }
    .filters {
        gap: 12px;
    }
    .filters .field {
        min-width: 100%;
    }
    .filters .form-grid {
        display: grid;
        grid-template-columns: 1fr;
    }
    .filters button {
        width: 100%;
    }
    .calendar-toolbar {
        padding: 14px;
    }
    .day-event {
        grid-template-columns: 65px 1fr;
        gap: 14px;
        padding: 18px;
    }
    .day-event>.button {
        grid-column: 2;
        justify-self: start;
    }
    .login-card {
        padding: 30px 24px;
    }
    .print-header {
        flex-wrap: wrap;
    }
    .form-actions {
        flex-wrap: wrap;
    }
}
@media(prefers-reduced-motion:reduce) {
    *,*:before,*:after {
        transition: none!important;
        animation: none!important;
        scroll-behavior: auto!important;
    }
}
/* Cometa · seconda edizione: superfici luminose e scheduler */
[hidden] { display: none !important; }
body { background: radial-gradient(ellipse at 90% 0,#eaf3ff,transparent 48%),var(--canvas); }
.sidebar { border-right: 1px solid #dfeaf7; box-shadow: 4px 0 30px #426f9c05; }
.brand,.brand:hover { color: var(--text); }
.brand small,.nav-label { color: #7a90ae; }
.brand-mark { background: linear-gradient(140deg,#78b7ff,#3a70e0); box-shadow: 0 6px 15px #407cdb30,inset 0 1px #ffffff60; }
.nav-link { border-radius: 13px; min-height: 47px; }
.nav-link:hover { color: var(--primary); }
.nav-link[aria-current=page]:hover { color: white; }
.sidebar-footer { position: relative; overflow: hidden; min-height: 160px; display: flex; flex-direction: column; justify-content: flex-end; color: #7c90ac; }
.sidebar-footer strong { color: #627e9e; }
.sidebar-footer:before { content: ''; position: absolute; width: 180px; height: 38px; border-radius: 100%; transform: rotate(-35deg); background: linear-gradient(90deg,transparent,#c9e2ff88); right: -35px; top: 36px; box-shadow: 0 20px 0 #deedff70; pointer-events: none; }
.topbar { height: 72px; background: #ffffffc9; }
.app-content { padding: 30px 28px 48px; max-width: 1920px; }
.page-header h1 { font-size: clamp(28px,2.3vw,38px); letter-spacing: -1.3px; }
.page-header p { font-size: 13px; }
.card { background: linear-gradient(155deg,#fff 75%,#fbfdff); }
.card-header { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.button,button { background: linear-gradient(120deg,#3975e8,#5696ee); box-shadow: 0 3px 8px #3875d51a,inset 0 1px #ffffff26; transition: transform .16s,box-shadow .16s,background .16s; }
.button:hover,button:hover { transform: translateY(-1px); box-shadow: 0 6px 16px #3975e826; }
.button.secondary,button.secondary { box-shadow: 0 2px 4px #4773aa05; }
.badge { border-radius: 8px; }
.status-CONFERMATO,.status-ARRIVATO,.status-IN_LAVORAZIONE { color: #25765e; background: #eaf8f0; }
.status-ANNULLATO { color: #a94359; background: #fff0f2; }
.status-DA_FATTURARE { color: #6654a5; background: #f0edff; }
.status-DA_COMPLETARE,.status-ATTESA_RICAMBI { color: #a66a25; background: #fff2df; }
.kpi { padding: 28px; background: radial-gradient(circle at 95% 0,#e9f2ff,transparent 65%),#fff; }
.kpi:after { content: ''; position: absolute; right: -18px; top: -24px; width: 140px; height: 140px; border: 25px solid #cce0fa30; border-radius: 50%; pointer-events: none; }
.open-kpi { background: linear-gradient(120deg,#fff,#fff8ee); }
.open-kpi:before { background: #edb061; }
.billing-kpi,.billing-summary { background: linear-gradient(120deg,#fff,#f1f0ff); }
.billing-kpi:before { background: #9c8ad7; }
.billing-summary { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.billing-summary p { margin: 0; color: var(--muted); }
.billing-summary .stat-value { color: #7360b6; margin: 0; }
.filters { background: linear-gradient(110deg,#fff,#f8fbff); }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea { border-radius: 12px; background-color: #fbfdff; border-color: #dce6f2; box-shadow: inset 0 2px 3px #436c9e03; }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23617089' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.errorlist { background: #fff2f4; border-radius: 8px; padding: 8px 12px; }
.table-card th { background: #f7faff; padding-top: 17px; padding-bottom: 17px; }
.table-card td { padding-top: 21px; padding-bottom: 21px; }
.table-link { display: inline-flex; gap: 10px; align-items: center; }
.client-avatar { display: inline-grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(135deg,#e6f1ff,#f0edff); color: #5377b8; text-transform: uppercase; }
.time-total { background: linear-gradient(120deg,#eaf3ff,#f4f8ff); border: 1px solid #dfeaff; box-shadow: 0 6px 18px #3e76c00a; }
.form-actions { background: #f8fbff; padding: 18px; border-radius: 0 0 12px 12px; }
.admin-action-bar { border-top: 3px solid #b8d4fb; background: linear-gradient(120deg,#fff,#eff6ff); }
.mobile-toggle { display: none; }
.calendar-layout { display: grid; grid-template-columns: minmax(0,1fr) 254px; gap: 22px; align-items: start; }
.calendar-main { min-width: 0; }
/* Profondità del calendario: solo superfici, senza variazioni della geometria degli eventi. */
:where(#cometa-calendar) .scheduler-card {
    border-color: #d6e2ef;
    background: linear-gradient(145deg,#fffffff5,#f5f9ffef);
    box-shadow: 0 12px 34px #284b7510,0 2px 6px #284b7508,inset 0 1px #fff;
    backdrop-filter: blur(12px);
}
:where(#cometa-calendar) .calendar-context > .card:nth-child(-n+3) {
    border-color: #dbe5f0;
    background: radial-gradient(ellipse at 100% 0,#e9f2ff80,transparent 65%),linear-gradient(145deg,#fffffff5,#f5f9ffed);
    box-shadow: 0 8px 24px #284b7510,0 1px 3px #284b7508,inset 0 1px #fff;
    backdrop-filter: blur(10px);
}
:where(#cometa-calendar) .calendar-context > .card:nth-child(-n+3) label { color: #405978; font-weight: 600; }
:where(#cometa-calendar) .calendar-context > .card:nth-child(-n+3) input:not([type=hidden]),
:where(#cometa-calendar) .calendar-context > .card:nth-child(-n+3) select {
    background-color: #ffffffd9;
    border-color: #d6e1ee;
    box-shadow: inset 0 1px 3px #24476e08,0 1px #fff;
}
:where(#cometa-calendar) .calendar-context > .card:nth-child(-n+3) input:focus,
:where(#cometa-calendar) .calendar-context > .card:nth-child(-n+3) select:focus { border-color: #80abe3; box-shadow: 0 0 0 3px #4b89df1a; }
:where(#cometa-calendar) .appointment.status-CONFERMATO,
:where(#cometa-calendar) .appointment.status-ARRIVATO,
:where(#cometa-calendar) .appointment.status-ESEGUITO { background: linear-gradient(135deg,#f2fbf7,#e0f2e9); }
:where(#cometa-calendar) .appointment strong { font-weight: 750; }
:where(#cometa-calendar) .appointment small { opacity: .88; }
:where(#cometa-calendar) .calendar-footer { background: linear-gradient(180deg,#f9fbfe,#f0f5fc); border-top-color: #dce6f2; box-shadow: inset 0 1px #fff; }

.calendar-context .card { padding: 20px; margin-bottom: 18px; }
:where(#cometa-calendar) .calendar-context h2 { font-size: 14px; color: #29456b; font-weight: 700; letter-spacing: -.2px; }
.calendar-context label:not(:first-child) { margin-top: 16px; }
:where(#cometa-calendar) .calendar-context .eyebrow { font-size: 9px; color: #41638c; font-weight: 750; }
:where(#cometa-calendar) .calendar-toolbar { padding: 18px; flex-wrap: wrap; gap: 12px; background: radial-gradient(ellipse at 100% 0,#e4effb99,transparent 65%),linear-gradient(135deg,#ffffffef,#f3f8ffed); border-bottom: 1px solid #dce6f2; box-shadow: inset 0 1px #fff; }
:where(#cometa-calendar) .calendar-toolbar h2 { font-size: 17px; margin: 0; text-transform: capitalize; color: #23436b; font-weight: 750; letter-spacing: -.35px; text-shadow: 0 1px #fff; }
:where(#cometa-calendar) .view-switch { display: flex; padding: 4px; border: 1px solid #dbe5f1; border-radius: 12px; background: linear-gradient(150deg,#eaf1fa,#f3f7fc); box-shadow: inset 0 1px 3px #294d7710,0 1px #fff; }
.view-switch button { background: transparent; box-shadow: none; color: var(--muted); min-height: 32px; padding: 5px 10px; border-radius: 8px; font-size: 12px; }
:where(#cometa-calendar) .view-switch button[aria-pressed=true] { color: var(--primary); background: linear-gradient(145deg,#fff,#f8fbff); box-shadow: 0 2px 7px #31619620,inset 0 1px #fff; font-weight: 700; }
.calendar-feedback { margin: 0; padding: 0 18px; font-size: 12px; color: var(--muted); background: #f6faff; }
.calendar-feedback:not(:empty) { padding-top: 12px; padding-bottom: 12px; }
:where(#cometa-calendar) .scheduler-scroll { max-height: 760px; overflow: auto; scrollbar-width: thin; scrollbar-color: #bfcfe3 #f5f8fc; position: relative; background: linear-gradient(145deg,#fff,#f7faff); }
.time-grid { min-width: 720px; }
.time-grid.single-day { min-width: 300px; }
.time-head,.time-body { display: grid; grid-template-columns: 54px repeat(7,minmax(0,1fr)); }
.single-day .time-head,.single-day .time-body { grid-template-columns: 54px minmax(0,1fr); }
:where(#cometa-calendar) .time-head { position: sticky; top: 0; z-index: 3; background: linear-gradient(180deg,#fffffff5,#f0f5fcef); border-bottom: 1px solid #d3dfed; box-shadow: 0 4px 12px #26466c10,inset 0 1px #fff; backdrop-filter: blur(10px); }
.time-zone { font-size: 9px; text-align: center; padding-top: 24px; color: var(--muted); }
.time-day { padding: 12px 4px; border-radius: 0; background: transparent; color: var(--muted); box-shadow: none; display: flex; flex-direction: column; font-size: 10px; text-transform: uppercase; letter-spacing: .6px; gap: 4px; }
.time-day strong { font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -1px; width: 38px; height: 36px; border-radius: 12px; }
:where(#cometa-calendar) .time-day.today { background: linear-gradient(180deg,#e5f0ff,#f1f7ff); color: #3978ca; box-shadow: inset 0 3px #5b9eeb; }
:where(#cometa-calendar) .time-day.today strong { background: linear-gradient(135deg,#347add,#6aa9f3); color: white; box-shadow: 0 4px 10px #3f80e238,inset 0 1px #ffffff66; }
.time-day:hover { background: #edf5ff; color: var(--primary); transform: none; box-shadow: none; }
.time-body { height: 1440px; }
:where(#cometa-calendar) .time-axis { background: linear-gradient(90deg,#f5f8fc,#fcfdff); border-right: 1px solid #dce5f0; }
.time-axis span { display: block; height: 60px; font-size: 10px; text-align: center; color: #8293aa; padding-top: 3px; }
:where(#cometa-calendar) .time-column { position: relative; border-right: 1px solid #dce6f080; background: repeating-linear-gradient(to bottom,transparent 0,transparent 29px,#dce6f04d 29px,#dce6f04d 30px,transparent 30px,transparent 59px,#d4dfedb3 59px,#d4dfedb3 60px),linear-gradient(90deg,#fff9,#f6f9fd55); }
:where(#cometa-calendar) .time-column:nth-child(odd) { background-color: #f6f9fd; }
:where(#cometa-calendar) .time-column:nth-child(n+7) { background-color: #f1f5fb; }
:where(#cometa-calendar) .time-column.today { background-color: #e8f2ff; box-shadow: inset 1px 0 #a9c9f13d,inset -1px 0 #a9c9f13d; }
:where(#cometa-calendar) .appointment { border-radius: 10px; background: linear-gradient(135deg,#f3f7ff,#e3edff); box-shadow: 0 2px 5px #264b7914,inset 0 1px #ffffffb3; transition: transform .15s,box-shadow .15s; }
.appointment:hover { transform: translateY(-2px); box-shadow: 0 5px 14px #3465a01c; z-index: 2; }
:where(#cometa-calendar) .appointment.status-ANNULLATO { background: linear-gradient(135deg,#fff6f7,#fbe7ec); border-color: #f4d6df; border-left-color: #d87e91; color: #a3495f; }
:where(#cometa-calendar) .appointment.status-ATTESA_RICAMBI,:where(#cometa-calendar) .appointment.status-DA_COMPLETARE { background: linear-gradient(135deg,#fff8ec,#ffecd3); border-color: #f4dbb8; color: #9c6321; }
.timed-event { position: absolute; margin: 0; padding: 5px 7px; min-height: 0; font-size: 11px; line-height: 1.3; }
.event-description { display: block; font-size: 10px; margin-top: 5px; opacity: .82; overflow: hidden; }
.month-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); min-width: 720px; }
:where(#cometa-calendar) .month-heading { padding: 16px 5px; text-align: center; font-size: 10px; font-weight: 650; color: #627c9c; border-bottom: 1px solid #d3dfed; background: linear-gradient(180deg,#fff,#f1f6fc); }
:where(#cometa-calendar) .month-cell { min-height: 150px; padding: 9px; border-right: 1px solid #dce6f080; border-bottom: 1px solid #dce6f0b3; background: linear-gradient(145deg,#ffffffb3,#f8fbff66); box-shadow: inset 0 1px #ffffffb3; }
.month-cell:nth-child(7n),.month-cell:nth-child(7n-1) { background-color: #fafcff; }
:where(#cometa-calendar) .month-cell.today { background: linear-gradient(145deg,#f0f7ff,#e7f1ff); box-shadow: inset 0 3px #70a6f0; }
.month-cell.outside { background: #f7f9fc; }
.month-cell.outside .day-number { color: #a1adc0; }
.month-cell .day-number { background: transparent; padding: 0; min-height: 32px; box-shadow: none; color: var(--text); }
.month-cell.today .day-number { background: var(--primary); color: white; }
.month-cell .day-events { max-height: 200px; }
.mini-card .card-header { gap: 5px; padding: 0; border: 0; margin-bottom: 12px; }
.mini-card .card-header h2 { font-size: 12px; text-transform: capitalize; text-align: center; }
.mini-card button.small { padding: 3px 8px; min-height: 30px; }
.mini-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 3px; }
.mini-weekday { text-align: center; font-size: 9px; color: var(--muted); padding: 5px 0; }
.mini-day { background: transparent; box-shadow: none; color: var(--text); min-height: 27px; padding: 3px 0; font-size: 11px; border-radius: 8px; }
.mini-day.outside { color: #a7b3c5; }
:where(#cometa-calendar) .mini-day.is-today { border-color: #a7c9fa; color: var(--primary); background: linear-gradient(145deg,#f5faff,#e9f2ff); box-shadow: inset 0 1px #fff; font-weight: 700; }
:where(#cometa-calendar) .mini-day.selected { background: linear-gradient(135deg,#427fe3,#78aff0); color: white; box-shadow: 0 3px 8px #477fd530,inset 0 1px #ffffff66; }
.mini-day:hover { background: #eaf3ff; color: var(--primary); }
.filter-reset { margin-top: 14px; width: 100%; }
.closure-panel { border-color: #dce6f6; background: linear-gradient(155deg,#fff,#f8faff); }
.closure-metric { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 14px; margin: 12px 0; border-radius: 13px; font-size: 12px; border: 1px solid #f6e2c4; background: linear-gradient(120deg,#fff8ed,#fff2df); color: #9f6a27; transition: transform .15s,box-shadow .15s; }
.closure-metric strong { grid-column: 2; grid-row: 1/3; align-self: center; font-size: 30px; letter-spacing: -1px; }
.closure-metric small { color: inherit; font-size: 10px; }
.closure-metric.billing { color: #6956a6; background: linear-gradient(120deg,#f6f3ff,#efedff); border-color: #e4def8; }
.closure-metric.clear { background: #f0f9f5; color: #33745a; border-color: #dceee4; }
.closure-metric:hover { transform: translateY(-2px); box-shadow: 0 5px 15px #53698914; }
.closure-banner { background: linear-gradient(110deg,#fff6e7,#f4f2ff); border: 1px solid #eadfcd; border-left: 4px solid #e9b76d; color: #746047; box-shadow: 0 6px 20px #b991500a; }
.closure-banner strong { display: block; margin-bottom: 9px; font-size: 13px; }
.closure-banner .toolbar { gap: 18px; font-size: 11px; }
.legend-card>div { display: flex; align-items: center; gap: 9px; margin: 12px 0; font-size: 11px; color: var(--muted); }
.dot.orange { background: #e7ae61; }.dot.red { background: #d88b9c; }
.login-page { background: radial-gradient(ellipse at 20% 10%,#dbeeff,transparent 55%),radial-gradient(ellipse at 90% 85%,#e4eaff,transparent 50%),#f7fbff; }
.login-card { box-shadow: 0 3px 8px #36639906,0 30px 90px #36639918; border: 1px solid #ffffff; background: linear-gradient(150deg,#fff,#fbfdff); }
@media(min-width:1600px) { .calendar-layout { grid-template-columns: minmax(0,1fr) 280px; gap: 26px; } }
@media(max-width:1250px) { .calendar-layout { grid-template-columns: minmax(0,1fr); } .calendar-context { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; } .calendar-context .card { margin: 0; } }
@media(max-width:800px) { .sidebar { position: relative; } .sidebar .brand { padding-bottom: 0; } .nav-ready .mobile-toggle { display: block; position: absolute; right: 18px; top: 18px; } .nav-links { display: flex; margin-top: 18px; flex-wrap: wrap; } .sidebar.nav-ready .nav-links { display: none; } .sidebar.nav-ready.menu-open .nav-links { display: flex; } .nav-link { flex: 1 1 160px; } .sidebar-footer { display: none; } .app-content { padding: 24px 18px 40px; } .calendar-toolbar { padding: 14px; } .calendar-toolbar h2 { order: -1; flex-basis: 100%; } .scheduler-scroll { max-height: 650px; } }
@media(max-width:540px) { .calendar-context { grid-template-columns: 1fr; } .calendar-layout { gap: 16px; } .view-switch { margin-left: auto; } .view-switch button { padding: 5px 8px; font-size: 11px; } .calendar-toolbar .toolbar { gap: 4px; } .calendar-toolbar .toolbar button { padding: 5px 8px; } .app-content { padding: 22px 12px 36px; } .billing-summary { align-items: flex-start; } .client-avatar { display: inline-grid; } }
@page {
    size: A4;
    margin: 15mm;
}
@media print {
    body {
        background: white;
        color: #111;
        font-size: 10pt;
        line-height: 1.45;
    }
    .sidebar,.topbar,.azioni,.no-print,.skip-link,.app-messages {
        display: none!important;
    }
    .app-shell,.app-main,.app-content {
        display: block!important;
        margin: 0!important;
        padding: 0!important;
        max-width: none!important;
    }
    .scheda {
        max-width: none;
        border: 0;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }
    .print-header {
        border-color: #333;
        margin-bottom: 18px;
        padding-bottom: 14px;
    }
    .print-header h1 {
        font-size: 20pt;
    }
    .scheda section {
        margin: 16px 0;
    }
    .scheda h2 {
        break-after: avoid;
        color: #333!important;
    }
    .scheda p {
        orphans: 3;
        widows: 3;
    }
    .scheda th,.scheda td {
        padding: 7px 8px;
        font-size: 9pt;
        background: white!important;
        border-color: #ddd;
    }
    .scheda thead {
        display: table-header-group;
    }
    .scheda tr {
        break-inside: avoid;
    }
    .badge {
        background: white!important;
        color: #222!important;
        border: 1px solid #ccc;
    }
    .print-total {
        break-before: avoid;
    }
    .section-grid {
        display: block;
    }
    .card {
        box-shadow: none;
        border-color: #ccc;
    }
    a {
        color: #111;
        text-decoration: none;
    }
    .muted,.detail-label,.eyebrow {
        color: #555;
    }
}
[data-section-spacing] {
    margin-top: 24px;
}
.status-NON_FATTURABILE {
    background: #eef1f5;
    color: #59677c;
}
.page-header h1 {
    overflow-wrap: anywhere;
}
@media print {
    [data-section-spacing] {
        margin-top: 16px;
    }
}

/* Statistiche del riepilogo Cometa. */
.statistiche-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.statistiche-cards h3 { font-size: 14px; }
.statistiche-table { overflow-x: auto; }
.statistiche-table table { width: 100%; min-width: 650px; }
.statistiche-bar-row { display: grid; grid-template-columns: 3em minmax(0, 1fr) 6em; align-items: center; gap: 12px; margin-top: 12px; }
.statistiche-bar-row > span:last-child { text-align: right; }
.statistiche-bar-track { background: var(--primary-soft); border-radius: 4px; overflow: hidden; }
.statistiche-bar { height: 16px; background: var(--primary); border-radius: 4px; }
@media (max-width: 480px) { .statistiche-cards { grid-template-columns: 1fr; } }
