@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Syne:wght@600;700;800&display=swap');

:root {
    --ink: #12141a;
    --muted: #5f6572;
    --line: #d9dde5;
    --bg: #eef1f6;
    --panel: #ffffff;
    --sidebar: #0f141c;
    --sidebar-text: #c8ceda;
    --sidebar-active: #f4f6fa;
    --accent: #b4233a;
    --accent-soft: rgba(180, 35, 58, 0.12);
    --ok: #1f7a4c;
    --warn: #9a6700;
    --shadow: 0 10px 30px rgba(15, 20, 28, 0.08);
    --radius: 14px;
    --sidebar-w: 260px;
    --sidebar-w-collapsed: 78px;
    --topbar-h: 60px;
    --font: 'Manrope', system-ui, sans-serif;
    --display: 'Syne', 'Manrope', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(900px 420px at 0% 0%, rgba(180, 35, 58, 0.08), transparent 55%),
        radial-gradient(700px 380px at 100% 0%, rgba(35, 70, 120, 0.08), transparent 50%),
        var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
    transition: grid-template-columns .22s ease;
}
.app.sidebar-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: linear-gradient(180deg, #141b26 0%, var(--sidebar) 100%);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 40;
    border-right: 1px solid rgba(255,255,255,.06);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.1rem 1rem;
    min-height: var(--topbar-h);
}
.sidebar-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #d6455d, #7a1526);
    color: #fff;
    display: grid;
    place-items: center;
    font-family: var(--display);
    font-weight: 800;
    flex: 0 0 auto;
}
.sidebar-brand strong {
    font-family: var(--display);
    color: #fff;
    font-size: 1.05rem;
    letter-spacing: .02em;
    line-height: 1.1;
}
.sidebar-brand small {
    display: block;
    color: #8b93a3;
    font-size: .72rem;
    margin-top: .15rem;
}
.sidebar-nav {
    padding: .5rem .7rem 1rem;
    overflow: auto;
    flex: 1;
}
.nav-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #7d8698;
    padding: .85rem .65rem .35rem;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .72rem .75rem;
    border-radius: 10px;
    color: var(--sidebar-text);
    margin-bottom: .2rem;
    transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active {
    background: rgba(180, 35, 58, .22);
    color: var(--sidebar-active);
    box-shadow: inset 0 0 0 1px rgba(180, 35, 58, .35);
}
.nav-ico {
    width: 1.35rem;
    text-align: center;
    flex: 0 0 auto;
    opacity: .9;
}
.nav-text { white-space: nowrap; overflow: hidden; }

.app.sidebar-collapsed .sidebar-brand strong,
.app.sidebar-collapsed .sidebar-brand small,
.app.sidebar-collapsed .nav-text,
.app.sidebar-collapsed .nav-label { display: none; }
.app.sidebar-collapsed .nav-link { justify-content: center; padding-inline: .6rem; }

.main {
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.app-footer {
    flex: 0 0 auto;
    margin-top: auto;
    padding: .85rem 1.1rem 1rem;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .72);
}
.app-footer p {
    margin: 0;
    font-size: .74rem;
    line-height: 1.45;
    color: var(--muted);
    text-align: center;
}
.app-footer a {
    color: var(--ink);
    font-weight: 650;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.app-footer a:hover { color: var(--accent); }
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem 1.1rem;
    background: rgba(238, 241, 246, .82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(217, 221, 229, .8);
}
.topbar-left { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.icon-btn {
    border: 1px solid var(--line);
    background: var(--panel);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--ink);
}
.page-title {
    margin: 0;
    font-family: var(--display);
    font-size: 1.15rem;
    font-weight: 700;
}
.page-sub { margin: .1rem 0 0; color: var(--muted); font-size: .85rem; }
.content {
    flex: 1 1 auto;
    padding: 1.1rem;
}

.flash {
    padding: .85rem 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}
.flash-ok { background: #e8f7ef; color: #145c38; border-color: #b7e4c7; }
.flash-err { background: #fdecea; color: #8a1c1c; border-color: #f5c2c0; }
.flash-warn { background: #fff8e6; color: #7a5a00; border-color: #f0d78c; }

.last-code-box {
    display: inline-flex;
    align-items: baseline;
    gap: .45rem;
    margin: 0;
    padding: .4rem .7rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    flex: 0 0 auto;
    white-space: nowrap;
}
.last-code-label {
    color: var(--muted);
    font-size: .78rem;
}
.last-code-value {
    font-size: .9rem;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .85rem;
    margin-bottom: 1rem;
}
.kpi {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}
a.kpi-link {
    text-decoration: none;
    color: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
a.kpi-link:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    box-shadow: 0 4px 14px rgba(20, 28, 45, .08);
}
.kpi-cal {
    border-width: 1px;
}
.kpi-cal-past {
    background: linear-gradient(160deg, #f1f5f9 0%, #e8eef5 100%);
    border-color: #94a3b8;
}
.kpi-cal-past span { color: #64748b; }
.kpi-cal-past strong { color: #475569; }
.kpi-cal-past:hover {
    border-color: #64748b;
    box-shadow: 0 4px 14px rgba(71, 85, 105, .12);
}
.kpi-cal-future {
    background: linear-gradient(160deg, #ecfdf8 0%, #d1fae5 100%);
    border-color: #5eead4;
}
.kpi-cal-future span { color: #0f766e; }
.kpi-cal-future strong { color: #0f766e; }
.kpi-cal-future:hover {
    border-color: #0f766e;
    box-shadow: 0 4px 14px rgba(15, 118, 110, .14);
}
.btn-cal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    background: #0f766e;
    color: #fff;
    border: 1px solid #134e4a;
    border-radius: 10px;
    padding: .55rem .95rem;
    font-weight: 650;
    font-size: .9rem;
    text-decoration: none;
    cursor: pointer;
}
.btn-cal:hover {
    background: #0d9488;
    color: #fff;
}
.quick-access {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .65rem;
}
.quick-access .btn,
.quick-access .btn-cal {
    width: 100%;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    min-height: 2.65rem;
    padding: .7rem .85rem;
}
.kpi span { display: block; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi strong {
    display: block;
    margin-top: .4rem;
    font-family: var(--display);
    font-size: 1.7rem;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.charts {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: .85rem;
    margin-bottom: 1rem;
}
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
}
.panel h2 {
    margin: 0 0 .85rem;
    font-family: var(--display);
    font-size: 1.05rem;
}
.chart-wrap { position: relative; height: 260px; }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .85rem;
}
.toolbar-with-last-code {
    justify-content: flex-start;
    align-items: center;
}
.toolbar-with-last-code .filter-bar {
    flex: 1 1 280px;
    min-width: 0;
}
.toolbar-actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.search-form { display: flex; gap: .5rem; flex: 1; min-width: 220px; max-width: 420px; }
.filter-bar {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr auto;
    gap: .5rem;
    width: 100%;
}
.filter-bar.filter-bar-simple {
    grid-template-columns: minmax(0, 1fr) auto;
    max-width: 640px;
}
@media (max-width: 860px) {
    .filter-bar,
    .filter-bar.filter-bar-simple { grid-template-columns: 1fr; }
    .toolbar-with-last-code { flex-direction: column; align-items: stretch; }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    border-radius: 10px;
    padding: .65rem .95rem;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: .92rem;
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.05); }
.btn-secondary { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-danger { background: #fff; border-color: #f0b4b4; color: #9b1c1c; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-sm { padding: .4rem .65rem; font-size: .82rem; }
.btn-xs { padding: .22rem .45rem; font-size: .72rem; border-radius: 7px; }

/* Azioni elenco: colori leggeri e distinti */
.btn-edit {
    background: #e8f1fb;
    border-color: #b7cce6;
    color: #245a8f;
}
.btn-edit:hover { background: #dceaf8; border-color: #9dbdda; }
.btn-clone {
    background: #e7f6ef;
    border-color: #b5ddc8;
    color: #1f6b4a;
}
.btn-clone:hover { background: #d8f0e5; border-color: #97cfb4; }
.btn-clone-clienti {
    background: #f8efe4;
    border-color: #e2c9a8;
    color: #8a5a22;
}
.btn-clone-clienti:hover { background: #f3e5d4; border-color: #d6b68a; }
.btn-clone-articoli {
    background: #f8efe4;
    border-color: #e2c9a8;
    color: #8a5a22;
}
.btn-clone-articoli:hover { background: #f3e5d4; border-color: #d6b68a; }
.btn-preview {
    background: #f4f6fa;
    border-color: #cfd6e3;
    color: #3a4658;
    min-width: 1.7rem;
    padding-left: .28rem;
    padding-right: .28rem;
}
.btn-preview:hover { background: #e9eef6; border-color: #b7c0d0; }

.clone-link-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin: 0 0 .85rem;
    padding: .55rem .75rem;
    background: #f7f9fc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}
.clone-link-badges-compact {
    margin: .25rem 0 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    gap: .2rem;
}
.clone-link-badges-label {
    font-size: .8rem;
    color: var(--muted);
    margin-right: .15rem;
}
.clone-link-badge {
    display: inline-block;
    font-size: .72rem;
    line-height: 1.2;
    font-weight: 600;
    text-decoration: none;
    padding: .18rem .4rem;
    border-radius: 6px;
    border: 1px solid transparent;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
a.clone-link-badge:hover { text-decoration: underline; }
.clone-link-badge-origine {
    background: #eef4fb;
    border-color: #c5d6ea;
    color: #2a567f;
}
.clone-link-badge-copia {
    background: #f8efe4;
    border-color: #e2c9a8;
    color: #8a5a22;
}
.clone-link-badge-muted {
    opacity: .75;
    cursor: default;
}
.clone-link-preview {
    min-width: 1.45rem;
    padding: .1rem .2rem;
    font-size: .75rem;
    line-height: 1;
}

.input, .select, .textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 10px;
    padding: .65rem .75rem;
    color: var(--ink);
}
.textarea { min-height: 110px; resize: vertical; }
.textarea-lg { min-height: 140px; }
.html-editor-shell {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    border-radius: 8px;
}
.html-editor-shell > .ql-toolbar.ql-snow {
    display: flex;
    flex-wrap: wrap;
    gap: .15rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: .25rem 0 .55rem;
    border: none;
    border-bottom: 1px solid var(--line);
    flex: 0 0 auto;
}
.html-editor-shell > .ql-toolbar.ql-snow .ql-formats {
    margin-right: .45rem;
}
.html-editor {
    background: transparent;
    border: none;
    border-radius: 0;
    min-height: 140px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    flex: 1 1 auto;
}
.html-editor.ql-container.ql-snow {
    border: none;
    font-family: var(--font);
    font-size: .95rem;
}
.html-editor .ql-editor {
    min-height: 140px;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.richtext {
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
}
.richtext p { margin: 0 0 .55rem; white-space: pre-wrap; }
.richtext p:last-child { margin-bottom: 0; }
.richtext ul, .richtext ol { margin: .25rem 0 .55rem 1.2rem; padding: 0; }
.richtext li { margin: .15rem 0; white-space: pre-wrap; }
.textarea.textarea-preserve,
.scheda-value.prewrap {
    white-space: pre-wrap;
}
a.row-open-link {
    color: inherit;
    text-decoration: none;
}
a.row-open-link:hover {
    color: var(--accent);
    text-decoration: underline;
}
.input:focus, .select:focus, .textarea:focus {
    outline: 2px solid rgba(180, 35, 58, .25);
    border-color: #d36a7a;
}

.table-wrap {
    overflow: auto;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    max-width: 100%;
}
.note-tip {
    position: fixed;
    z-index: 80;
    display: none;
    max-width: min(420px, calc(100vw - 24px));
    max-height: min(280px, 50vh);
    overflow: auto;
    padding: .65rem .75rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(20, 28, 45, .18);
    font-size: .82rem;
    line-height: 1.35;
    color: var(--ink);
    white-space: pre-wrap;
    word-break: break-word;
    pointer-events: none;
}
.note-tip.is-visible { display: block; }
table.data {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}
table.data th, table.data td {
    padding: .75rem .85rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
    font-size: .92rem;
}
a.th-sort {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    color: inherit;
    text-decoration: none;
    font: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
}
a.th-sort::after {
    content: '⇅';
    font-size: .72em;
    opacity: .35;
    font-weight: 700;
}
a.th-sort.is-asc::after { content: '▲'; opacity: .9; }
a.th-sort.is-desc::after { content: '▼'; opacity: .9; }
a.th-sort:hover { color: var(--accent); }
a.th-sort:hover::after { opacity: .85; }

table.data th {
    background: #f7f8fb;
    color: var(--muted);
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    position: sticky;
    top: 0;
}
table.data tr:hover td { background: #fafbfd; }
table.data td.actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    vertical-align: middle;
}
table.data td.actions .btn {
    vertical-align: middle;
}
table.data td.actions .inline-form {
    display: inline;
    margin: 0;
}
table.data .thumb {
    display: block;
}
.thumb {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 8px;
    background: #eceff4;
    border: 1px solid var(--line);
}
.thumb-sm {
    width: 72px;
    height: 72px;
    border-radius: 8px;
}
table.data.data-compact {
    /* Desktop: layout fisso come prima (foto 72px, niente scrollbar forzata) */
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}
table.data.data-compact th,
table.data.data-compact td {
    padding: .35rem .4rem;
    font-size: .78rem;
    line-height: 1.25;
}
table.data.data-compact th {
    font-size: .68rem;
    letter-spacing: .03em;
    white-space: nowrap;
}
table.data.data-compact th.col-foto,
table.data.data-compact td.col-foto {
    width: 5.75rem;
    max-width: 5.75rem;
    padding-left: .35rem;
    padding-right: .5rem;
    text-align: center;
    vertical-align: middle;
}
table.data.data-compact td.col-foto .thumb-sm {
    width: 72px;
    height: 72px;
    margin: 0 auto;
}
.list-photo {
    position: relative;
    display: inline-block;
    line-height: 0;
    vertical-align: middle;
}
.list-photo-count {
    position: absolute;
    right: -4px;
    bottom: -4px;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 .28rem;
    border-radius: 999px;
    background: #1c2333;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    line-height: 1.15rem;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
    pointer-events: none;
    z-index: 1;
}
table.data.data-compact th.col-codice,
table.data.data-compact td.col-codice { width: 6%; }
table.data.data-compact th.col-nome,
table.data.data-compact td.col-nome { width: 8%; }
table.data.data-compact th.col-famiglia,
table.data.data-compact td.col-famiglia { width: 6%; }
table.data.data-compact th.col-stagione,
table.data.data-compact td.col-stagione { width: 5.5%; }
table.data.data-compact th.col-fornitore,
table.data.data-compact td.col-fornitore { width: 13%; }
table.data.data-compact th.col-cod-forn,
table.data.data-compact td.col-cod-forn { width: 8%; }
table.data.data-compact th.col-dim,
table.data.data-compact td.col-dim { width: 8%; }
table.data.data-compact th.col-comp,
table.data.data-compact td.col-comp { width: 9%; }
table.data.data-compact th.col-note,
table.data.data-compact td.col-note { width: 17%; }
table.data.data-compact th.col-actions,
table.data.data-compact td.actions {
    width: 7.25rem;
    white-space: nowrap;
}
table.data.data-compact tr.row-link {
    cursor: pointer;
}
table.data.data-compact tr.row-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
table.data.data-compact .cell-clip {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
table.data.data-compact .cell-note {
    position: relative;
    max-width: none;
}
table.data.data-compact .cell-note-preview {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}
table.data.data-compact .cell-note-popup {
    display: none;
}
table.data.data-compact td.actions .btn {
    margin-left: .1rem;
    min-width: 0;
}
table.data.data-compact-anagrafica th.col-nome,
table.data.data-compact-anagrafica td.col-nome { width: 22%; }
table.data.data-compact-anagrafica th.col-fornitore,
table.data.data-compact-anagrafica td.col-fornitore { width: 14%; }
table.data.data-compact-anagrafica th.col-note,
table.data.data-compact-anagrafica td.col-note { width: 18%; }
table.data.data-compact-anagrafica th.col-actions,
table.data.data-compact-anagrafica td.actions { width: 4.75rem; }
.thumb-lg {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    background: #eceff4;
    border: 1px solid var(--line);
}
.photo-field-row {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    flex-wrap: wrap;
}
.photo-preview {
    flex: 0 0 auto;
}
.photo-field-controls {
    flex: 1;
    min-width: 160px;
}
.photo-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    border: 1px dashed var(--line);
    background: #f7f8fb;
    display: grid;
    place-items: center;
    text-align: center;
    padding: .5rem;
    font-size: .78rem;
}
.form-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 300px);
    gap: 1rem;
    align-items: start;
}
.form-split:not(:has(.form-split-side)) {
    grid-template-columns: minmax(0, 1fr);
}
.form-split-main {
    min-width: 0;
}
.form-stack {
    display: grid;
    gap: 1.15rem;
    min-width: 0;
}
.form-split-side {
    position: sticky;
    top: calc(var(--topbar-h) + .85rem);
    text-align: center;
}
.multi-photo-field.is-dragover {
    outline: 2px dashed #b4233a;
    outline-offset: 4px;
    border-radius: 12px;
    background: rgba(180, 35, 58, .04);
}
.multi-photo-field.is-uploading {
    opacity: .72;
    pointer-events: none;
}
.multi-photo-toolbar {
    margin: 0 0 .85rem;
    padding: .65rem .7rem;
    border-radius: 10px;
    border: 1px dashed #c5ccd8;
    background: #f3f5f9;
    text-align: left;
}
.multi-photo-toolbar .hint {
    margin: 0 0 .65rem;
}
.multi-photo-add-btn {
    width: 100%;
    font-weight: 650;
    background: #fff;
    border-color: #c5ccd8;
    box-shadow: 0 1px 0 rgba(15, 20, 28, 0.04);
}
.multi-photo-add-btn:hover {
    border-color: #aeb6c4;
    background: #fafbfc;
}
.multi-photo-add-btn[hidden] {
    display: none !important;
}
.multi-photo-field .multi-photo-list {
    padding-top: .35rem;
}
.multi-photo-field .multi-photo-item .input {
    border-color: transparent;
    background: transparent;
    padding: .55rem .2rem;
    color: var(--muted);
    cursor: default;
}
.multi-photo-field .multi-photo-item .input:focus {
    outline: none;
    border-color: transparent;
    background: transparent;
}
.multi-photo-item:focus-within {
    border-color: #d36a7a;
    box-shadow: 0 0 0 3px rgba(180, 35, 58, .14);
}
.form-split-side .side-title {
    margin: 0 0 .85rem;
    font-family: var(--display);
    font-size: 1.05rem;
}
.form-split-side .photo-field,
.form-split-side .multi-photo-field {
    margin-bottom: 1rem;
    text-align: left;
}
.form-split-side .photo-field-row,
.form-split-side .multi-photo-item {
    justify-content: center;
}
.form-split-side .photo-preview,
.form-split-side .photo-placeholder,
.form-split-side .thumb-lg {
    margin-inline: auto;
}
.multi-photo-item.is-preferred {
    border-color: #b4233a;
    box-shadow: 0 0 0 2px rgba(180, 35, 58, .12);
}
.photo-prefer {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    width: 100%;
    margin-top: .15rem;
    font-size: .82rem;
    font-weight: 650;
    color: var(--ink);
    cursor: pointer;
    user-select: none;
}
.photo-prefer input:disabled + span {
    opacity: .45;
    cursor: default;
}
.multi-photo-list {
    display: grid;
    gap: 1.1rem;
}
.multi-photo-item {
    position: relative;
    display: flex;
    gap: .65rem;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: .25rem;
    padding: 1rem .75rem .75rem;
    border: 1px solid #c5ccd8;
    border-radius: 12px;
    background: #fff;
}
.multi-photo-remove {
    position: absolute;
    top: 0;
    right: .65rem;
    transform: translateY(-50%);
    z-index: 1;
    margin: 0;
    padding: 0 .45rem;
    border: none;
    background: var(--panel);
    font: inherit;
    font-size: .76rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .01em;
    color: #9b1c1c;
    cursor: pointer;
}
.multi-photo-remove:hover {
    color: #7a1212;
    text-decoration: underline;
}
.multi-photo-remove[hidden] {
    display: none !important;
}
.photo-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
}
.photo-thumbs-side {
    flex-direction: column;
    align-items: center;
}
img.thumb,
img.thumb-lg,
[data-photo-preview] img {
    cursor: zoom-in;
}
.lightbox[hidden] { display: none !important; }
.lightbox {
    position: fixed;
    inset: 0;
    /* Sopra i modal (anteprima lookup, ecc.) così lo zoom immagine non resta dietro */
    z-index: 110;
    display: grid;
    place-items: center;
    padding: 1rem;
}
.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 16, .78);
}
.lightbox-dialog {
    position: relative;
    z-index: 1;
    width: min(960px, 100%);
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
}
.lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 7rem);
    object-fit: contain;
    border-radius: 10px;
    background: #111;
    box-shadow: 0 16px 48px rgba(0,0,0,.35);
}
.lightbox-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.96);
    border-radius: 12px;
    padding: .55rem .7rem;
}
.lightbox-close {
    position: absolute;
    top: -.25rem;
    right: -.25rem;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 999px;
    background: #fff;
    color: var(--ink);
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 2;
}
.modal[hidden] { display: none !important; }
.modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 1rem;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 16, .55);
}
.modal-dialog {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    background: var(--card, #fff);
    border: 1px solid var(--line, #e5e7eb);
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(0,0,0,.22);
    padding: 1.25rem 1.25rem 1rem;
}
.modal-title {
    margin: 0 2rem 0 0;
    font-size: 1.15rem;
}
.modal-hint {
    margin: .35rem 0 1rem;
    font-size: .9rem;
}
.modal-form .field {
    margin-bottom: .85rem;
}
.modal-form .field label {
    display: block;
    margin-bottom: .3rem;
    font-size: .85rem;
    font-weight: 600;
}
.modal-form input[type="text"],
.modal-form input[type="file"] {
    width: 100%;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    margin-top: 1rem;
}
.modal-close {
    position: absolute;
    top: .55rem;
    right: .55rem;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 999px;
    background: var(--bg, #f3f4f6);
    color: var(--ink);
    font-size: 1.25rem;
    cursor: pointer;
}
@media (max-width: 860px) {
    .form-split { grid-template-columns: 1fr; }
    .form-split-side { position: static; order: 0; }
}
.muted { color: var(--muted); }
.actions:not(td) {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
    align-items: center;
}
td.actions {
    display: table-cell;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem 1rem;
}
.form-grid .full { grid-column: 1 / -1; }
.field {
    position: relative;
    margin-top: .2rem;
    padding: .95rem .85rem .75rem;
    border: 1px solid #c5ccd8;
    border-radius: 12px;
    background: #fff;
    min-width: 0;
    max-width: 100%;
}
.field > label {
    position: absolute;
    top: 0;
    left: .7rem;
    transform: translateY(-50%);
    z-index: 1;
    margin: 0;
    padding: 0 .4rem;
    background: var(--panel);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .01em;
    line-height: 1.2;
    color: #2f3642;
    max-width: calc(100% - 1.4rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.field:focus-within {
    border-color: #d36a7a;
    box-shadow: 0 0 0 3px rgba(180, 35, 58, .16);
}
.field .input,
.field .select,
.field .textarea {
    border-color: transparent;
    background: transparent;
    border-radius: 8px;
    padding-left: .2rem;
    padding-right: .2rem;
}
.field .input:focus,
.field .select:focus,
.field .textarea:focus {
    outline: none;
    border-color: transparent;
    background: #f6f7fa;
}
.field .html-editor-shell {
    margin: 0;
}
.field .hint {
    margin-top: .35rem;
    font-size: .78rem;
    color: var(--muted);
}
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1.25rem;
    padding: 1rem 0 .15rem;
    border-top: 1px solid var(--line);
    background: var(--panel);
}
.form-split-main > .form-actions {
    margin-top: 1.35rem;
}

.field-lookup {
    overflow: visible;
    z-index: 2;
}
.field-lookup:focus-within {
    z-index: 40;
}
.lookup { position: relative; }
.lookup-control {
    position: relative;
    display: flex;
    align-items: center;
}
.lookup-control .lookup-input {
    padding-right: 4.1rem;
}
.lookup-preview,
.lookup-clear {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 1.6rem;
    height: 1.6rem;
    border: none;
    border-radius: 999px;
    background: #eef0f4;
    color: var(--muted);
    font-size: .95rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.lookup-preview { right: 2.15rem; }
.lookup-clear { right: .35rem; font-size: 1rem; }
.lookup-preview:hover,
.lookup-clear:hover {
    background: #e2e6ee;
    color: var(--ink);
}
.lookup-preview[hidden],
.lookup-clear[hidden] { display: none !important; }
.lookup-results {
    position: absolute;
    left: 0; right: 0; top: calc(100% + 4px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow);
    max-height: 260px;
    overflow: auto;
    z-index: 50;
    display: none;
}
.lookup-results.open { display: block; }
.lookup-item {
    display: flex;
    align-items: flex-start;
    gap: .45rem;
    padding: .55rem .65rem;
    cursor: pointer;
    border-bottom: 1px solid #eef0f4;
}
.lookup-item-main { flex: 1; min-width: 0; }
.lookup-item:last-child { border-bottom: none; }
.lookup-item:hover { background: var(--accent-soft); }
.lookup-item small { display: block; color: var(--muted); }
.lookup-item-eye {
    flex: 0 0 auto;
    width: 1.7rem;
    height: 1.7rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    font-size: .9rem;
    line-height: 1;
}
.lookup-item-eye:hover {
    color: var(--ink);
    border-color: #b7c0d0;
    background: #f5f7fb;
}
.lookup-preview-modal .lookup-preview-dialog {
    width: min(920px, 96vw);
    max-height: min(88vh, 900px);
    overflow: auto;
}
.lookup-preview-body {
    margin: .35rem 0 1rem;
}
.lookup-preview-body .scheda-embed-head {
    margin-bottom: .65rem;
}
.lookup-preview-body .form-split {
    gap: .85rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: .55rem 1rem;
}
.detail-grid dt { color: var(--muted); font-size: .85rem; }
.detail-grid dd { margin: 0; }
.detail-grid dd a { color: var(--accent); text-decoration: none; }
.detail-grid dd a:hover { text-decoration: underline; }

/* Schede stile AppGini (label | valore) */
.scheda-fields {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.scheda-field {
    display: grid;
    grid-template-columns: minmax(140px, 220px) 1fr;
    gap: .55rem 1rem;
    padding: .55rem 0;
    border-bottom: 1px solid #eef0f4;
    align-items: start;
}
.scheda-field:last-child { border-bottom: none; padding-bottom: 0; }
.scheda-field:first-child { padding-top: 0; }
.scheda-label {
    color: var(--muted);
    font-size: .88rem;
    font-weight: 600;
    padding-top: .1rem;
}
.scheda-value {
    margin: 0;
    min-width: 0;
    word-break: break-word;
}
.scheda-value a { color: var(--accent); text-decoration: none; }
.scheda-value a:hover { text-decoration: underline; }
@media (max-width: 640px) {
    .scheda-field { grid-template-columns: 1fr; gap: .2rem; }
}

.related-panel {
    margin-top: 1rem;
}
.related-title {
    margin: 0 0 .75rem;
    font-size: 1rem;
}
.related-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .45rem;
}
.related-row {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}
.related-item-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0;
}
.related-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex: 1 1 auto;
    min-width: 0;
    padding: .7rem .9rem;
    border: none;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    font: inherit;
}
.related-item:hover,
.related-row.is-open .related-item {
    background: var(--accent-soft);
}
.related-label { font-weight: 600; }
.related-count {
    min-width: 2.2rem;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: .85rem;
    text-align: center;
}
.related-open {
    display: inline-flex;
    align-items: center;
    padding: 0 .9rem;
    border-left: 1px solid var(--line);
    color: var(--accent);
    font-size: .82rem;
    text-decoration: none;
    white-space: nowrap;
}
.related-open:hover { text-decoration: underline; }
.related-expand {
    border-top: 1px solid var(--line);
    background: #f7f8fb;
}
.related-expand[hidden] { display: none !important; }
.related-expand-inner { padding: .65rem .9rem .8rem; }
.related-preview-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .35rem;
}
.related-preview-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}
.related-preview-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .75rem;
    width: 100%;
    padding: .5rem .65rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}
.related-preview-toggle:hover,
.related-preview-row.is-open > .related-preview-toggle {
    background: var(--accent-soft);
}
.related-preview-title { font-weight: 600; }
.related-preview-sub { color: var(--muted); font-size: .88rem; }
.related-preview-embed {
    border-top: 1px solid var(--line);
    background: #fafbfd;
    padding: .65rem;
}
.related-preview-embed[hidden] { display: none !important; }
.related-preview-empty,
.related-preview-hint {
    margin: 0;
    color: var(--muted);
    font-size: .88rem;
}
.related-preview-hint { margin-top: .5rem; }
.scheda-embed {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}
.scheda-embed-head {
    padding: .55rem .85rem;
    border-bottom: 1px solid var(--line);
    background: #f3f5f9;
}
.scheda-embed-title { font-size: .95rem; }
.scheda-embed-body {
    margin: 0;
    padding: .75rem;
}
.scheda-embed-body .panel {
    box-shadow: none;
}
.related-filter-banner {
    margin-bottom: .9rem;
}
.related-filter-banner a { color: inherit; font-weight: 600; }

.pagination { display: flex; gap: .35rem; flex-wrap: wrap; margin: 0; }
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 .55rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: .85rem;
}
.pagination .active span { background: var(--accent); color: #fff; border-color: var(--accent); }
.list-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1rem;
    margin-top: .9rem;
}
.list-footer-meta { font-size: .9rem; }
.list-footer-pager { flex: 1 1 auto; display: flex; justify-content: center; }
.list-footer-perpage {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    font-size: .88rem;
}
.list-footer-perpage label { color: var(--muted); }
.select-sm {
    width: auto;
    min-width: 4.5rem;
    padding: .35rem .55rem;
    font-size: .85rem;
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 16, .45);
    z-index: 35;
}
.overlay.show { display: block; }

@media (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .charts { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .app, .app.sidebar-collapsed { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        width: min(86vw, 280px);
        transform: translateX(-105%);
        transition: transform .22s ease;
    }
    .app.sidebar-open .sidebar { transform: translateX(0); }
    .app.sidebar-collapsed .sidebar-brand strong,
    .app.sidebar-collapsed .sidebar-brand small,
    .app.sidebar-collapsed .nav-text,
    .app.sidebar-collapsed .nav-label { display: initial; }
    .app.sidebar-collapsed .nav-link { justify-content: flex-start; padding-inline: .75rem; }
    .form-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content { padding: .85rem; }

    /* Solo mobile / schermi stretti: scroll orizzontale, colonne non schiacciate */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }
    .table-wrap::-webkit-scrollbar { height: 10px; }
    .table-wrap::-webkit-scrollbar-thumb {
        background: #c5ccd8;
        border-radius: 6px;
    }
    table.data,
    table.data.data-compact {
        width: max-content;
        min-width: 1100px;
        table-layout: auto;
    }
    table.data.data-compact-anagrafica {
        min-width: 820px;
    }
    table.data.data-compact th.col-foto,
    table.data.data-compact td.col-foto {
        width: 5.75rem;
        min-width: 5.75rem;
        max-width: none;
    }
    table.data.data-compact td.col-foto .thumb-sm {
        width: 72px;
        height: 72px;
    }
}
@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .kpi strong { font-size: 1.4rem; }
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: linear-gradient(160deg, #eef1f6, #f7f8fb 45%, #e8edf5);
}
.auth-card {
    width: min(420px, 100%);
    padding: 1.25rem 1.35rem 1.5rem;
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
}
.auth-brand small { display: block; color: var(--muted); }
.auth-title { margin: 0 0 1rem; font-size: 1.35rem; }
.auth-form .field { margin-bottom: .85rem; }
.hp-field {
    position: absolute;
    left: -10000px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}
.captcha-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}
.captcha-img {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    flex: 0 0 auto;
    width: 220px;
    height: 64px;
    image-rendering: auto;
}
.auth-form .field .captcha-row .input,
.captcha-row .input {
    flex: 1 1 140px;
    min-width: 120px;
    min-height: 2.5rem;
    border: 1px solid #c5ccd8 !important;
    background: #fff !important;
    border-radius: 8px;
    padding: .55rem .7rem !important;
    color: var(--ink);
}
.auth-form .field .captcha-row .input:focus,
.captcha-row .input:focus {
    border-color: #d36a7a !important;
    background: #fff !important;
    box-shadow: 0 0 0 3px rgba(180, 35, 58, .16);
    outline: none;
}
.check-line {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: 0 0 .9rem;
    font-size: .9rem;
}
.topbar-user { font-size: .85rem; margin-right: .35rem; }
.docs-count {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    font-size: .78rem;
    text-decoration: none;
    color: var(--ink);
    white-space: nowrap;
}
.docs-count:hover { color: var(--accent); }
table.data.data-compact th.col-docs,
table.data.data-compact td.col-docs {
    width: 3.4rem;
    text-align: center;
}
.documenti-panel { margin-top: 1rem; }
.documenti-upload {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: .75rem;
}
.documenti-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: .35rem;
}
.documenti-list li {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    align-items: center;
}
.qr-box {
    width: 180px;
    margin: .75rem 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: .5rem;
}
.btn-danger {
    background: #fdecea;
    border-color: #f0b8b4;
    color: #8a1c1c;
}
.password-gen-row {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    align-items: center;
}
.password-gen-row .input { flex: 1 1 160px; }

.cal-legend {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-bottom: .65rem;
    font-size: .85rem;
}
.cal-dot {
    display: inline-block;
    width: .65rem;
    height: .65rem;
    border-radius: 2px;
    margin-right: .25rem;
    vertical-align: middle;
}
.cal-dot-shared { background: #b4233a; }
.cal-dot-personal {
    background: #0f766e;
    box-shadow: inset 0 0 0 1px #134e4a;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 2px,
        rgba(255,255,255,.25) 2px,
        rgba(255,255,255,.25) 3px
    );
}
.cal-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .65rem 1rem;
    margin-bottom: .55rem;
}
.cal-toolbar-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .65rem .85rem;
    min-width: 0;
}
.cal-toggle-end {
    margin-left: auto;
}
.cal-hint {
    margin: 0 0 .65rem;
    font-size: .82rem;
    line-height: 1.35;
}
.cal-multiday-hint {
    margin: .15rem 0 .55rem;
    font-size: .82rem;
}
.cal-panel { padding: .75rem 1rem 1.1rem; overflow-x: auto; }
#eurosetaCalendar { min-height: 560px; }
.fc .fc-highlight {
    background: rgba(180, 35, 58, .14) !important;
    opacity: 1;
}
.fc .fc-timegrid-slot {
    height: 2.1rem;
}
.fc .fc-timegrid-event {
    min-height: 1.1rem;
    font-size: .78rem;
}
.fc .fc-timegrid-now-indicator-line {
    border-color: var(--accent, #b4233a);
}
@media (max-width: 700px) {
    #eurosetaCalendar { min-height: 70vh; }
    .fc .fc-toolbar {
        flex-direction: column;
        gap: .45rem;
        align-items: stretch;
    }
    .fc .fc-toolbar-chunk {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: .25rem;
    }
    .fc .fc-button {
        padding: .35rem .45rem;
        font-size: .75rem;
    }
    .fc .fc-toolbar-title { font-size: 1rem; text-align: center; }
    .fc .fc-timegrid-slot { height: 1.85rem; }
}
.cal-toggle {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .85rem;
    cursor: pointer;
    user-select: none;
    margin-right: .35rem;
}
.cal-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.cal-toggle-ui {
    width: 2.4rem;
    height: 1.25rem;
    border-radius: 999px;
    background: #cfd5e0;
    position: relative;
    transition: background .15s ease;
}
.cal-toggle-ui::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
    transition: transform .15s ease;
}
.cal-toggle input:checked + .cal-toggle-ui { background: #0f766e; }
.cal-toggle input:checked + .cal-toggle-ui::after { transform: translateX(1.1rem); }
.cal-dialog {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0;
    width: min(520px, calc(100vw - 2rem));
    box-shadow: 0 12px 40px rgba(20, 28, 45, .18);
}
.cal-dialog::backdrop { background: rgba(20, 28, 45, .35); }
.cal-form { padding: 1.1rem 1.25rem 1.25rem; }
.cal-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}
.fc .fc-toolbar-title { font-size: 1.15rem; font-weight: 700; }
.fc .fc-button-primary {
    background: var(--accent, #b4233a);
    border-color: var(--accent, #b4233a);
}
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: #8e1a2d;
    border-color: #8e1a2d;
}
.fc .fc-daygrid-event { border-radius: 4px; }
.fc .cal-event-shared {
    background-color: #b4233a !important;
    border-color: #8e1a2d !important;
    border-style: solid !important;
    border-width: 1px !important;
}
.fc .cal-event-personal {
    background-color: #0f766e !important;
    border-color: #134e4a !important;
    border-left: 4px solid #5eead4 !important;
    border-style: solid !important;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 3px,
        rgba(255,255,255,.12) 3px,
        rgba(255,255,255,.12) 5px
    ) !important;
    font-style: italic;
}
.fc .cal-event-personal .fc-event-title::before {
    content: 'Privato · ';
    font-style: normal;
    font-weight: 700;
    font-size: .72em;
    letter-spacing: .02em;
    opacity: .95;
}
.fc-list .cal-event-personal .fc-list-event-dot {
    border-color: #0f766e !important;
}
.fc-list .cal-event-shared .fc-list-event-dot {
    border-color: #b4233a !important;
}
