        :root {
            --ink: #122033;
            --ink-soft: #3d4f63;
            --muted: #6b7c8f;
            --line: #d7e0ea;
            --surface: #ffffff;
            --surface-2: #f4f7fb;
            --bg-1: #e8eef5;
            --bg-2: #f7f4ef;
            --primary: #1a4f7a;
            --primary-hover: #143d5e;
            --sollecito: #b45309;
            --sollecito-bg: #fff7ed;
            --promemoria: #5b4d9a;
            --video: #9f1239;
            --foto: #9d174d;
            --texture: #0e7490;
            --threed: #4338ca;
            --campionario: #a16207;
            --spedizione: #c2410c;
            --arrivo: #0369a1;
            --riunione: #0f766e;
            --high: #c2410c;
            --medium: #a16207;
            --low: #0f766e;
            --done: #64748b;
            --danger: #b91c1c;
            --danger-bg: #fef2f2;
            --success: #0f766e;
            --success-bg: #ecfdf5;
            --shadow: 0 1px 2px rgba(18, 32, 51, 0.04), 0 8px 24px rgba(18, 32, 51, 0.06);
            --radius: 14px;
            --radius-sm: 10px;
            --font: "DM Sans", system-ui, sans-serif;
            --display: "Instrument Serif", Georgia, serif;
            --col-da-fare: #1a4f7a;
            --col-in-corso: #a16207;
            --col-in-attesa: #b45309;
            --col-completata: #0f766e;
        }

        * { box-sizing: border-box; }

        body {
            margin: 0;
            min-height: 100vh;
            font-family: var(--font);
            color: var(--ink);
            background:
                radial-gradient(1200px 600px at 8% -10%, rgba(26, 79, 122, 0.12), transparent 55%),
                radial-gradient(900px 500px at 100% 0%, rgba(180, 140, 90, 0.10), transparent 50%),
                linear-gradient(165deg, var(--bg-1), var(--bg-2) 55%, #eef2f6);
            padding: 24px 16px 48px;
            -webkit-font-smoothing: antialiased;
        }

        .container { max-width: 1480px; margin: 0 auto; }

        .topbar {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: center;
            gap: 8px 10px;
            margin-bottom: 18px;
            padding-bottom: 14px;
            border-bottom: 1px solid rgba(18, 32, 51, 0.08);
            overflow: visible;
        }

        .topbar-actions {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 6px;
            flex-wrap: nowrap;
            justify-self: end;
            min-width: 0;
            position: relative;
            z-index: 60;
        }

        .brand-block {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: nowrap;
            min-width: 0;
            justify-self: start;
        }

        .brand-kicker {
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.14em;
            text-transform: uppercase;
            color: var(--primary);
            margin: 0 0 6px;
        }

        .brand-title {
            font-family: var(--display);
            font-size: clamp(1.45rem, 2.2vw, 1.85rem);
            font-weight: 400;
            line-height: 1;
            margin: 0;
            letter-spacing: -0.02em;
            white-space: nowrap;
            flex-shrink: 0;
        }

        .brand-home-btn {
            font: inherit;
            letter-spacing: inherit;
            color: inherit;
            background: none;
            border: none;
            padding: 0;
            margin: 0;
            cursor: pointer;
            line-height: 1;
        }

        .brand-home-btn:hover {
            color: var(--primary);
        }

        .brand-home-btn:focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 3px;
            border-radius: 4px;
        }

        .brand-sub {
            margin: 8px 0 0;
            color: var(--muted);
            font-size: 0.9rem;
        }

        .topbar-cta {
            display: flex;
            align-items: center;
            justify-content: center;
            flex-wrap: nowrap;
            gap: 8px;
            justify-self: center;
            min-width: 0;
        }

        .topbar-global-search {
            flex: 0 1 220px;
            min-width: 140px;
            max-width: 260px;
        }

        .topbar-global-search input {
            width: 100%;
            height: 34px;
            box-sizing: border-box;
            border: 1px solid var(--line);
            border-radius: 8px;
            padding: 0 10px;
            font: inherit;
            font-size: 0.82rem;
            background: rgba(255, 255, 255, 0.95);
            color: var(--ink);
            box-shadow: 0 1px 2px rgba(18, 32, 51, 0.04);
        }

        .topbar-global-search input:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
        }

        .topbar-global-search input::placeholder {
            color: var(--muted);
        }

        .user-selector {
            display: flex;
            flex-direction: column;
            gap: 0;
            background: var(--ink);
            border: none;
            border-radius: 8px;
            padding: 3px 8px 4px;
            box-shadow: 0 4px 14px rgba(18, 32, 51, 0.22);
            min-width: 0;
            flex-shrink: 0;
            height: 34px;
            justify-content: center;
            box-sizing: border-box;
            color: #fff;
        }

        button.user-selector,
        button.user-session {
            color: #fff;
            -webkit-text-fill-color: #fff;
        }

        .user-selector label,
        .user-selector-label {
            margin: 0;
            font-size: 0.52rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: rgba(255, 255, 255, 0.72);
            -webkit-text-fill-color: rgba(255, 255, 255, 0.72);
            line-height: 1;
            display: block;
        }

        .user-selector select {
            padding: 0;
            border: none;
            background: transparent;
            font-weight: 700;
            color: #fff;
            font-size: 0.78rem;
            width: auto;
            min-width: 72px;
            font-family: var(--font);
            letter-spacing: -0.02em;
            cursor: pointer;
            line-height: 1.1;
        }

        .user-session {
            height: auto;
            min-height: 34px;
            padding: 4px 8px 5px;
            cursor: pointer;
            font-family: var(--font);
            text-align: left;
            appearance: none;
            -webkit-appearance: none;
        }

        .user-session:hover {
            background: #1a2a3d;
        }

        .user-session-row {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .user-session-name {
            font-weight: 700;
            color: #fff !important;
            -webkit-text-fill-color: #fff;
            font-size: 0.82rem;
            letter-spacing: -0.02em;
            line-height: 1.1;
            white-space: nowrap;
        }

        .user-logout-btn {
            border: 1px solid rgba(255, 255, 255, 0.35);
            background: transparent;
            color: #fff !important;
            -webkit-text-fill-color: #fff;
            font-family: var(--font);
            font-size: 0.62rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            border-radius: 6px;
            padding: 2px 7px;
            cursor: pointer;
            line-height: 1.2;
        }

        .user-logout-btn:hover {
            background: rgba(255, 255, 255, 0.12);
            color: #fff;
        }

        /* —— Auth: login dal tasto Operatore —— */
        body.auth-locked .container > :not(.topbar):not(#authLockHint) {
            display: none !important;
        }
        body.auth-locked .topbar-cta,
        body.auth-locked .topbar-actions {
            visibility: hidden;
            pointer-events: none;
        }
        body.auth-locked #toast,
        body.auth-locked #opToast { display: none !important; }

        #authLockHint {
            display: none;
            margin: 48px auto 0;
            max-width: 320px;
            text-align: center;
            color: var(--muted);
            font-size: 0.95rem;
            line-height: 1.45;
            padding: 0 16px;
        }

        body.auth-locked #authLockHint {
            display: block;
        }

        .login-modal {
            position: fixed;
            inset: 0;
            z-index: 10000;
            display: grid;
            place-items: center;
            padding: 16px;
        }

        .login-modal[hidden] { display: none !important; }

        .login-modal-backdrop {
            position: absolute;
            inset: 0;
            z-index: 0;
            background: rgba(18, 32, 51, 0.4);
        }

        .login-card {
            position: relative;
            z-index: 1;
            width: min(300px, calc(100vw - 32px));
            background: #fff;
            border: 1px solid var(--line);
            border-radius: 12px;
            padding: 14px 14px 12px;
            box-shadow: 0 12px 32px rgba(18, 32, 51, 0.18);
            pointer-events: auto;
            overflow: hidden;
        }

        .login-card-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 10px;
        }

        .login-title {
            margin: 0;
            font-family: var(--font);
            font-size: 0.95rem;
            font-weight: 700;
            color: var(--ink);
            letter-spacing: -0.02em;
        }

        .login-close-btn {
            border: none;
            background: transparent;
            color: var(--muted);
            font-size: 0.85rem;
            line-height: 1;
            padding: 2px 4px;
            cursor: pointer;
            border-radius: 4px;
        }

        .login-close-btn:hover { color: var(--ink); background: var(--surface-2); }

        .login-form {
            display: grid;
            gap: 6px;
        }

        .login-field-label {
            margin: 4px 0 0;
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: var(--muted);
        }

        .login-form select,
        .login-form input[type="email"],
        .login-form input[type="password"],
        .login-form input[type="text"] {
            width: 100%;
            box-sizing: border-box;
            border: 1px solid var(--line);
            border-radius: 8px;
            padding: 8px 10px;
            font-family: var(--font);
            font-size: 0.88rem;
            color: var(--ink);
            background: #fff;
            pointer-events: auto;
        }

        .login-form select:focus,
        .login-form input:focus {
            outline: none;
            border-color: rgba(26, 79, 122, 0.45);
            box-shadow: 0 0 0 2px rgba(26, 79, 122, 0.1);
        }

        .login-remember {
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: flex-start;
            gap: 8px;
            width: 100%;
            max-width: 100%;
            box-sizing: border-box;
            margin: 6px 0 0;
            padding: 0;
            font-size: 0.75rem;
            font-weight: 500;
            color: var(--ink-soft);
            line-height: 1.3;
            cursor: pointer;
            user-select: none;
            text-transform: none;
            letter-spacing: normal;
        }

        .login-remember input[type="checkbox"] {
            margin: 0;
            flex: 0 0 auto;
            width: 14px;
            height: 14px;
        }

        .login-remember span {
            flex: 1 1 auto;
            min-width: 0;
            white-space: normal;
        }

        .login-error {
            margin: 0;
            padding: 6px 8px;
            border-radius: 7px;
            background: var(--danger-bg);
            color: var(--danger);
            font-size: 0.72rem;
            font-weight: 600;
            line-height: 1.3;
        }

        .login-submit {
            margin-top: 4px;
            border: none;
            border-radius: 8px;
            padding: 9px 10px;
            background: var(--primary);
            color: #fff;
            font-family: var(--font);
            font-size: 0.86rem;
            font-weight: 700;
            cursor: pointer;
        }

        .login-submit:hover { background: var(--primary-hover); }
        .login-submit:disabled {
            opacity: 0.65;
            cursor: not-allowed;
        }

        .user-selector select option {
            color: var(--ink);
            background: #fff;
            font-weight: 600;
        }

        .btn-chiudi-strumento {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            height: 34px;
            padding: 0 12px;
            border-radius: 8px;
            border: 1px solid var(--line);
            background: #fff;
            color: var(--ink);
            font-family: var(--font);
            font-weight: 700;
            font-size: 0.72rem;
            cursor: pointer;
            box-shadow: var(--shadow);
            transition: 0.15s;
            white-space: nowrap;
            flex-shrink: 0;
        }

        .btn-chiudi-strumento:hover {
            border-color: var(--ink);
            background: var(--ink);
            color: #fff;
        }

        .btn-chiudi-strumento[hidden] {
            display: none !important;
        }

        .btn-archivi {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            height: 34px;
            padding: 0 10px;
            border-radius: 8px;
            border: 1px solid var(--line);
            background: var(--surface);
            color: var(--ink);
            font-family: var(--font);
            font-weight: 700;
            font-size: 0.72rem;
            cursor: pointer;
            box-shadow: var(--shadow);
            transition: 0.15s;
            white-space: nowrap;
            flex-shrink: 0;
        }

        .btn-archivi:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        .btn-archivi.active {
            background: var(--ink);
            border-color: var(--ink);
            color: #fff;
        }

        .btn-archivi .archivi-caret {
            width: 14px;
            height: 14px;
            flex-shrink: 0;
            opacity: 0.75;
            transition: transform 0.15s;
        }

        .archivi-menu.open .btn-archivi .archivi-caret {
            transform: rotate(180deg);
        }

        .archivi-menu {
            position: relative;
        }

        .archivi-dropdown {
            position: fixed;
            top: 0;
            right: 0;
            min-width: 196px;
            padding: 6px;
            border: 1px solid var(--line);
            border-radius: 10px;
            background: #fff;
            box-shadow: 0 10px 28px rgba(18, 32, 51, 0.14);
            z-index: 1200;
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .archivi-dropdown[hidden] {
            display: none !important;
        }

        .archivi-item {
            display: block;
            width: 100%;
            text-align: left;
            border: none;
            background: transparent;
            border-radius: 7px;
            padding: 8px 10px;
            font-family: var(--font);
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--ink);
            cursor: pointer;
            transition: 0.12s;
        }

        .archivi-item:hover {
            background: rgba(18, 32, 51, 0.05);
        }

        .archivi-item.active {
            background: var(--ink);
            color: #fff;
        }

        .archivi-item[hidden] {
            display: none !important;
        }

        .archivi-sep {
            height: 1px;
            margin: 4px 6px;
            background: var(--line);
        }

        .btn-calendar {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            height: 34px;
            padding: 0 8px;
            border-radius: 8px;
            border: 1px solid var(--line);
            background: var(--surface);
            color: var(--ink);
            font-family: var(--font);
            font-weight: 700;
            font-size: 0.68rem;
            cursor: pointer;
            box-shadow: var(--shadow);
            transition: 0.15s;
            white-space: nowrap;
            flex-shrink: 0;
        }

        .btn-calendar:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        .btn-calendar.active {
            background: var(--primary);
            border-color: var(--primary);
            color: #fff;
        }

        .btn-calendar svg {
            width: 14px;
            height: 14px;
            flex-shrink: 0;
        }

        .toolbar-pubblicazioni {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: center;
            margin-bottom: 18px;
        }

        .toolbar-pubblicazioni .search-wrap {
            flex: 1;
            min-width: 220px;
            position: relative;
        }

        .toolbar-pubblicazioni .search-wrap input {
            padding-left: 40px;
            width: 100%;
            height: 42px;
            border: 1px solid var(--line);
            border-radius: 8px;
            font-family: var(--font);
            font-size: 0.9rem;
            background: #fff;
            box-sizing: border-box;
        }

        .pubbl-grid-wrap {
            background: var(--surface);
            border: 1px solid var(--line);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            overflow: auto;
        }

        .pubbl-table {
            width: 100%;
            border-collapse: collapse;
            min-width: 760px;
        }

        .pubbl-table th {
            text-align: left;
            font-size: 0.68rem;
            font-weight: 800;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--muted);
            padding: 12px 14px;
            border-bottom: 1px solid var(--line);
            background: var(--surface-2);
            position: sticky;
            top: 0;
            z-index: 1;
        }

        .pubbl-table td {
            padding: 12px 14px;
            border-bottom: 1px solid var(--line);
            font-size: 0.9rem;
            color: var(--ink-soft);
            vertical-align: middle;
        }

        .pubbl-table tr.pubbl-row {
            cursor: pointer;
            transition: background 0.12s;
        }

        .pubbl-table tr.pubbl-row:hover {
            background: #f8fafc;
        }

        .pubbl-col-prodotto strong {
            color: var(--ink);
            font-weight: 700;
        }

        .pubbl-col-data {
            white-space: nowrap;
            color: var(--muted);
            font-size: 0.82rem;
        }

        .empty-state-pubbl {
            padding: 36px 20px;
            text-align: center;
            color: var(--muted);
            font-size: 0.92rem;
            line-height: 1.5;
        }

        .empty-state-pubbl strong {
            display: block;
            color: var(--ink);
            font-size: 1.05rem;
            margin-bottom: 6px;
        }

        /* Arrivi e spedizioni */
        .spedizioni-layout {
            display: grid;
            grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.1fr);
            gap: 14px;
            align-items: start;
            min-height: 52vh;
        }

        .spedizioni-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-height: 70vh;
            overflow: auto;
            padding-right: 2px;
        }

        .spedizioni-item {
            text-align: left;
            border: 1px solid var(--line);
            background: var(--surface);
            border-radius: var(--radius-sm);
            padding: 12px 14px;
            cursor: pointer;
            transition: border-color .15s, box-shadow .15s, transform .15s;
        }

        .spedizioni-item:hover {
            border-color: #b7c7d8;
            transform: translateY(-1px);
        }

        .spedizioni-item.active {
            border-color: var(--primary);
            box-shadow: 0 0 0 2px rgba(26, 79, 122, 0.12);
        }

        .spedizioni-item-top {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
            margin-bottom: 6px;
        }

        .spedizioni-item-date {
            font-size: 0.78rem;
            color: var(--muted);
            white-space: nowrap;
        }

        .spedizioni-item strong {
            display: block;
            font-size: 0.95rem;
            color: var(--ink);
            margin-bottom: 4px;
        }

        .spedizioni-item-meta {
            display: block;
            font-size: 0.8rem;
            color: var(--muted);
            line-height: 1.35;
        }

        .spedizioni-detail-panel {
            border: 1px solid var(--line);
            border-radius: var(--radius);
            background: var(--surface);
            padding: 16px 18px;
            min-height: 280px;
            box-shadow: var(--shadow);
        }

        .spedizioni-detail-empty {
            color: var(--muted);
            font-size: 0.92rem;
            padding: 28px 8px;
            text-align: center;
        }

        .spedizioni-detail-head h3 {
            margin: 8px 0 4px;
            font-size: 1.15rem;
        }

        .spedizioni-detail-head p {
            margin: 0 0 14px;
            color: var(--muted);
            font-size: 0.88rem;
        }

        .spedizioni-detail-block {
            margin-bottom: 16px;
        }

        .spedizioni-detail-block h4 {
            margin: 0 0 8px;
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--muted);
        }

        .spedizioni-detail-actions {
            margin-top: 8px;
        }

        .materiali-lista-head,
        .materiali-row {
            display: grid;
            grid-template-columns: 1fr 110px 36px;
            gap: 8px;
            align-items: center;
        }

        .materiali-lista-head {
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--muted);
            margin-bottom: 6px;
        }

        .materiali-lista-rows {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-bottom: 10px;
        }

        .materiali-row input {
            width: 100%;
            border: 1px solid var(--line);
            border-radius: 9px;
            padding: 8px 10px;
            font: inherit;
            background: #fff;
        }

        .materiali-row-remove {
            width: 36px;
            height: 36px;
            border: 1px solid var(--line);
            border-radius: 9px;
            background: #fff;
            color: var(--muted);
            font-size: 1.2rem;
            cursor: pointer;
            line-height: 1;
        }

        .materiali-row-remove:hover {
            color: var(--danger);
            border-color: #fecaca;
            background: var(--danger-bg);
        }

        .materiali-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.9rem;
        }

        .materiali-table th,
        .materiali-table td {
            border-bottom: 1px solid var(--line);
            padding: 8px 6px;
            text-align: left;
        }

        .materiali-table th {
            font-size: 0.72rem;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--muted);
        }

        .materiali-table .materiali-qty {
            white-space: nowrap;
            font-weight: 600;
            width: 30%;
        }

        .materiali-empty {
            color: var(--muted);
            font-size: 0.88rem;
        }

        .task-materiali-preview {
            display: flex;
            flex-wrap: wrap;
            gap: 4px;
            margin: 4px 0 6px;
        }

        .task-materiali-preview span {
            font-size: 0.72rem;
            background: var(--surface-2);
            border: 1px solid var(--line);
            border-radius: 999px;
            padding: 2px 8px;
            color: var(--ink-soft);
        }

        @media (max-width: 900px) {
            .spedizioni-layout {
                grid-template-columns: 1fr;
            }
            .spedizioni-list {
                max-height: 40vh;
            }
        }

        /* Calendario */
        .cal-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
            margin-bottom: 16px;
        }

        .cal-nav {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .cal-nav button {
            width: 36px;
            height: 36px;
            border-radius: 8px;
            border: 1px solid var(--line);
            background: var(--surface);
            cursor: pointer;
            font-size: 1.1rem;
            color: var(--ink);
            font-family: var(--font);
        }

        .cal-nav button:hover { border-color: var(--primary); color: var(--primary); }

        .cal-month-label {
            font-family: var(--display);
            font-size: 1.6rem;
            margin: 0 6px;
            min-width: 180px;
            text-align: center;
            letter-spacing: -0.02em;
        }

        .cal-legend {
            display: flex;
            gap: 14px;
            flex-wrap: wrap;
            font-size: 0.75rem;
            font-weight: 600;
            color: var(--muted);
        }

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

        .cal-legend i {
            width: 10px;
            height: 10px;
            border-radius: 3px;
            display: inline-block;
        }

        .cal-legend .dot-open { background: var(--primary); }
        .cal-legend .dot-done { background: var(--success); }
        .cal-legend .dot-over { background: #dc2626; }
        .cal-legend .dot-memo { background: var(--promemoria); }
        .cal-legend .dot-riunione { background: var(--riunione); }

        .cal-op-filter {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin-left: 6px;
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: var(--muted);
        }

        .cal-op-filter select {
            width: auto;
            min-width: 120px;
            padding: 6px 10px;
            font-size: 0.82rem;
            font-weight: 600;
            text-transform: none;
            letter-spacing: 0;
            color: var(--ink);
        }

        .cal-event .cal-op {
            opacity: 0.9;
            font-weight: 500;
        }

        .cal-grid {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            gap: 6px;
        }

        .cal-dow {
            text-align: center;
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--muted);
            padding: 6px 0;
        }

        .cal-day {
            min-height: 110px;
            background: rgba(255, 255, 255, 0.85);
            border: 1px solid var(--line);
            border-radius: 10px;
            padding: 6px;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .cal-day.out {
            opacity: 0.4;
            background: transparent;
        }

        .cal-day.today {
            border-color: var(--primary);
            box-shadow: inset 0 0 0 1px rgba(26, 79, 122, 0.2);
        }

        .cal-day-num {
            font-size: 0.75rem;
            font-weight: 700;
            color: var(--ink-soft);
            margin-bottom: 2px;
        }

        .cal-day.today .cal-day-num {
            color: var(--primary);
        }

        .cal-events {
            display: flex;
            flex-direction: column;
            gap: 3px;
            overflow: auto;
            max-height: 120px;
        }

        .cal-event {
            border: none;
            border-radius: 5px;
            padding: 3px 5px;
            font-size: 0.65rem;
            font-weight: 600;
            text-align: left;
            cursor: pointer;
            font-family: var(--font);
            line-height: 1.25;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            color: #fff;
        }

        .cal-event.open { background: var(--primary); }
        .cal-event.done { background: var(--success); }
        .cal-event.overdue { background: #dc2626; }
        .cal-event.memo { background: var(--promemoria); }
        .cal-event.riunione { background: var(--riunione); }
        .cal-event.annullata {
            background: #94a3b8;
            text-decoration: line-through;
            opacity: 0.85;
        }

        .cal-more {
            font-size: 0.62rem;
            font-weight: 700;
            color: var(--muted);
            padding: 2px 4px;
        }

        .cal-nodate {
            margin-top: 18px;
            background: rgba(255,255,255,0.82);
            border: 1px solid var(--line);
            border-radius: 12px;
            padding: 14px 16px;
        }

        .cal-nodate h3 {
            margin: 0 0 10px;
            font-size: 0.85rem;
            color: var(--ink-soft);
        }

        .cal-nodate-list {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
        }

        .completate-more {
            display: none;
            padding: 8px 10px 12px;
        }

        .completate-more.show { display: block; }

        .completate-more button {
            width: 100%;
            border: 1px dashed var(--line);
            background: rgba(255, 255, 255, 0.7);
            color: var(--ink-soft);
            font-family: var(--font);
            font-size: 0.75rem;
            font-weight: 600;
            padding: 10px 8px;
            border-radius: 8px;
            cursor: pointer;
        }

        .completate-more button:hover {
            border-color: var(--success);
            color: var(--success);
            background: #fff;
        }

        @media (max-width: 900px) {
            .cal-day { min-height: 84px; }
            .cal-events { max-height: 72px; }
        }

        .btn-open-form {
            background: var(--primary);
            color: #fff;
            border: none;
            padding: 0 14px;
            min-width: 0;
            height: 34px;
            border-radius: 8px;
            cursor: pointer;
            font-family: var(--font);
            font-weight: 700;
            font-size: 0.76rem;
            letter-spacing: 0.01em;
            transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
            box-shadow: 0 6px 16px rgba(26, 79, 122, 0.28);
            white-space: nowrap;
            flex-shrink: 0;
        }

        .btn-open-form:hover {
            background: var(--primary-hover);
            transform: translateY(-2px);
            box-shadow: 0 12px 28px rgba(26, 79, 122, 0.4);
        }

        #btnNuovaAttivita {
            background: #16a34a;
            box-shadow: 0 8px 24px rgba(22, 163, 74, 0.35);
        }

        #btnNuovaAttivita:hover {
            background: #15803d;
            box-shadow: 0 12px 28px rgba(22, 163, 74, 0.45);
        }

        .filter-bar {
            background: rgba(255, 255, 255, 0.82);
            border: 1px solid var(--line);
            backdrop-filter: blur(10px);
            padding: 8px 10px;
            border-radius: 10px;
            margin-bottom: 12px;
            display: grid;
            grid-template-columns: 1.8fr repeat(4, minmax(100px, 1fr));
            gap: 8px;
            align-items: end;
            box-shadow: var(--shadow);
        }

        .global-search-panel {
            background: rgba(255, 255, 255, 0.95);
            border: 1px solid var(--line);
            border-radius: 12px;
            box-shadow: var(--shadow);
            margin: 0 0 14px;
            overflow: hidden;
        }

        .global-search-panel[hidden] {
            display: none !important;
        }

        .global-search-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 7px 12px;
            border-bottom: 1px solid var(--line);
            background: var(--surface-2);
        }

        .global-search-head strong {
            font-size: 0.8rem;
            color: var(--ink);
        }

        .global-search-count {
            margin-left: 6px;
            font-size: 0.72rem;
            font-weight: 600;
            color: var(--muted);
        }

        .global-search-close {
            border: 1px solid var(--line);
            background: #fff;
            color: var(--ink-soft);
            font-family: var(--font);
            font-size: 0.72rem;
            font-weight: 700;
            border-radius: 7px;
            padding: 4px 8px;
            cursor: pointer;
        }

        .global-search-close:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        .global-search-body {
            max-height: min(38vh, 340px);
            overflow: auto;
            padding: 6px 8px 8px;
        }

        .global-search-empty {
            padding: 18px 12px;
            text-align: center;
            color: var(--muted);
            font-size: 0.84rem;
        }

        .global-search-section {
            margin-bottom: 8px;
        }

        .global-search-section:last-child {
            margin-bottom: 0;
        }

        .global-search-section h3 {
            margin: 0 0 4px;
            padding: 2px 2px 0;
            font-size: 0.62rem;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--muted);
        }

        .global-search-section h3 span {
            font-weight: 700;
            letter-spacing: 0;
            text-transform: none;
            color: var(--ink-soft);
            margin-left: 4px;
        }

        .global-search-list {
            display: flex;
            flex-direction: column;
            gap: 3px;
        }

        .global-search-item {
            display: grid;
            grid-template-columns: 58px 1fr;
            grid-template-rows: auto auto;
            column-gap: 8px;
            row-gap: 0;
            width: 100%;
            text-align: left;
            border: 1px solid transparent;
            border-radius: 8px;
            background: var(--surface-2);
            padding: 5px 8px;
            cursor: pointer;
            font-family: var(--font);
            transition: 0.12s;
        }

        .global-search-item.compact {
            align-items: center;
        }

        .global-search-item:hover {
            border-color: var(--line);
            background: #fff;
            box-shadow: var(--shadow);
        }

        .global-search-item .gs-kind {
            grid-row: 1 / span 2;
            align-self: center;
            justify-self: start;
            font-size: 0.58rem;
            font-weight: 800;
            letter-spacing: 0.03em;
            text-transform: uppercase;
            color: #fff;
            background: var(--primary);
            border-radius: 5px;
            padding: 3px 5px;
            line-height: 1.1;
        }

        .global-search-item.kind-contact .gs-kind { background: #0f766e; }
        .global-search-item.kind-listino .gs-kind { background: #a16207; }
        .global-search-item.kind-link .gs-kind { background: #2563eb; }

        .global-search-item .gs-title {
            font-size: 0.8rem;
            font-weight: 700;
            color: var(--ink);
            line-height: 1.2;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .global-search-item .gs-meta {
            font-size: 0.68rem;
            color: var(--muted);
            line-height: 1.2;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .global-search-tile {
            display: flex;
            flex-direction: column;
            gap: 3px;
            min-height: 58px;
            padding: 7px 8px;
            border: 1px solid var(--line);
            border-radius: 9px;
            background: #fff;
            text-align: left;
            cursor: pointer;
            font-family: var(--font);
            transition: 0.12s;
            box-shadow: none;
        }

        .global-search-tile:hover {
            border-color: var(--primary);
            box-shadow: var(--shadow);
            transform: translateY(-1px);
        }

        .global-search-tile .gs-tile-badge {
            align-self: flex-start;
            font-size: 0.58rem;
            font-weight: 800;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: #fff;
            background: #0f766e;
            border-radius: 4px;
            padding: 2px 5px;
            line-height: 1.15;
        }

        .global-search-tile .gs-tile-title {
            font-size: 0.76rem;
            font-weight: 700;
            color: var(--ink);
            line-height: 1.2;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            word-break: break-word;
        }

        .global-search-main-cols {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 8px;
        }

        .global-search-main-cols.cols-5 {
            grid-template-columns: repeat(5, minmax(0, 1fr));
        }

        .global-search-col {
            min-width: 0;
            padding: 6px;
            border: 1px solid var(--line);
            border-radius: 10px;
            background: var(--surface-2);
        }

        .global-search-col-title {
            margin: 0 0 6px;
            font-size: 0.6rem;
            font-weight: 800;
            letter-spacing: 0.07em;
            text-transform: uppercase;
            color: var(--muted);
        }

        .global-search-col-title span {
            font-weight: 700;
            letter-spacing: 0;
            text-transform: none;
            color: var(--ink-soft);
            margin-left: 3px;
        }

        .global-search-col-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
            gap: 5px;
        }

        .global-search-tile.mini {
            min-height: 0;
            aspect-ratio: 1 / 1;
            padding: 5px;
            border-radius: 8px;
            gap: 2px;
            justify-content: space-between;
        }

        .global-search-tile.mini .gs-tile-badge {
            font-size: 0.5rem;
            padding: 1px 4px;
            background: rgba(255, 255, 255, 0.22);
            color: #fff;
        }

        .global-search-tile.mini .gs-tile-title {
            font-size: 0.66rem;
            font-weight: 700;
            line-height: 1.15;
            -webkit-line-clamp: 3;
            margin-top: auto;
            color: #fff;
        }

        .global-search-tile.mini.has-date .gs-tile-title {
            -webkit-line-clamp: 2;
            margin-top: 0;
        }

        .global-search-tile.mini .gs-tile-date {
            margin-top: auto;
            font-size: 0.55rem;
            font-weight: 600;
            letter-spacing: 0.02em;
            color: rgba(255, 255, 255, 0.82);
            line-height: 1.1;
            white-space: nowrap;
        }

        .gs-col-task .global-search-tile.mini {
            background: linear-gradient(145deg, #334155 0%, #1e293b 100%);
            border-color: transparent;
        }

        .gs-col-link .global-search-tile.mini {
            background: linear-gradient(145deg, #2563eb 0%, #1d4ed8 100%);
            border-color: transparent;
        }

        .gs-col-listino .global-search-tile.mini {
            background: linear-gradient(145deg, #d97706 0%, #a16207 100%);
            border-color: transparent;
        }

        .gs-col-contact .global-search-tile.mini {
            background: linear-gradient(145deg, #0f766e 0%, #0d9488 100%);
            border-color: transparent;
        }

        .gs-col-tessuto .global-search-tile.mini {
            background: linear-gradient(145deg, #be185d 0%, #9d174d 100%);
            border-color: transparent;
        }

        .global-search-link-empty {
            grid-column: 1 / -1;
            font-size: 0.7rem;
            color: var(--muted);
            padding: 6px 2px;
        }

        @media (max-width: 900px) {
            .global-search-main-cols {
                grid-template-columns: 1fr 1fr;
            }
        }

        @media (max-width: 600px) {
            .global-search-main-cols {
                grid-template-columns: 1fr;
            }
        }

        .filter-group.filter-pubbl label {
            color: var(--foto);
        }

        .filter-group label {
            display: block;
            font-weight: 600;
            margin-bottom: 3px;
            color: var(--muted);
            font-size: 0.62rem;
            letter-spacing: 0.06em;
            text-transform: uppercase;
        }

        .filter-bar input,
        .filter-bar select {
            padding: 6px 10px;
            font-size: 0.82rem;
            border-radius: 8px;
            min-height: 0;
        }

        input, select, textarea {
            width: 100%;
            padding: 11px 13px;
            border: 1px solid var(--line);
            border-radius: var(--radius-sm);
            font-family: var(--font);
            font-size: 0.95rem;
            color: var(--ink);
            background: var(--surface);
            transition: border-color 0.2s, box-shadow 0.2s;
        }

        input:focus, select:focus, textarea:focus {
            border-color: var(--primary);
            outline: none;
            box-shadow: 0 0 0 3px rgba(26, 79, 122, 0.12);
        }

        textarea { resize: vertical; min-height: 120px; line-height: 1.5; }

        .rich-toolbar {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;
        }

        .rich-editor {
            width: 100%;
            min-height: 160px;
            padding: 12px 14px;
            border: 1px solid var(--line);
            border-radius: var(--radius-sm);
            font-family: var(--font);
            font-size: 0.95rem;
            color: var(--ink);
            background: var(--surface);
            line-height: 1.55;
            white-space: pre-wrap;
            overflow-y: auto;
            transition: border-color 0.2s, box-shadow 0.2s;
        }

        .rich-editor.compact { min-height: 88px; }

        .rich-editor:focus {
            border-color: var(--primary);
            outline: none;
            box-shadow: 0 0 0 3px rgba(26, 79, 122, 0.12);
        }

        .rich-editor:empty:before {
            content: attr(data-placeholder);
            color: #94a3b8;
            pointer-events: none;
        }

        .rich-editor b, .rich-editor strong { font-weight: 700; }

        /* Kanban */
        .kanban {
            display: grid;
            grid-template-columns: repeat(4, minmax(240px, 1fr));
            gap: 14px;
            align-items: start;
            overflow-x: auto;
            padding-bottom: 8px;
        }

        .kanban-col {
            background: rgba(255, 255, 255, 0.55);
            border: 1px solid var(--line);
            border-radius: 16px;
            min-width: 240px;
            min-height: 420px;
            display: flex;
            flex-direction: column;
            transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
        }

        .kanban-col.drag-over {
            background: rgba(26, 79, 122, 0.08);
            border-color: var(--primary);
            box-shadow: inset 0 0 0 2px rgba(26, 79, 122, 0.15);
        }

        .kanban-col-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 14px 14px 12px;
            border-bottom: 1px solid rgba(18, 32, 51, 0.06);
            position: sticky;
            top: 0;
        }

        .kanban-col-title {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.82rem;
            font-weight: 700;
            letter-spacing: 0.02em;
            color: var(--ink);
            margin: 0;
        }

        .kanban-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .col-da-fare .kanban-dot { background: var(--col-da-fare); }
        .col-in-corso .kanban-dot { background: var(--col-in-corso); }
        .col-in-attesa .kanban-dot { background: var(--col-in-attesa); }
        .col-completata .kanban-dot { background: var(--col-completata); }

        .kanban-count {
            font-size: 0.72rem;
            font-weight: 700;
            color: var(--muted);
            background: var(--surface);
            border: 1px solid var(--line);
            min-width: 24px;
            height: 24px;
            border-radius: 999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0 7px;
        }

        .kanban-list {
            padding: 10px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            flex: 1;
            min-width: 0;
            min-height: 200px;
            overflow-x: hidden;
        }

        .board-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            flex-wrap: wrap;
            margin-bottom: 10px;
        }

        .board-toolbar-actions {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }

        .board-legend {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
        }

        .board-legend-chip {
            display: inline-flex;
            align-items: center;
            gap: 7px;
            padding: 6px 10px;
            border-radius: 999px;
            border: 1px solid var(--line);
            background: rgba(255, 255, 255, 0.75);
            font-size: 0.75rem;
            font-weight: 600;
            color: var(--ink-soft);
            font-family: var(--font);
            cursor: pointer;
            transition: 0.15s;
        }

        .board-legend-chip:hover {
            border-color: var(--primary);
            color: var(--ink);
        }

        .board-legend-chip.active {
            background: var(--ink);
            border-color: var(--ink);
            color: #fff;
        }

        .board-legend-chip.active b {
            color: rgba(255, 255, 255, 0.75);
        }

        .board-legend-chip b {
            font-size: 0.72rem;
            color: var(--muted);
            font-weight: 700;
        }

        .board-legend-chip .kanban-dot {
            width: 8px;
            height: 8px;
        }

        .board-legend-chip[data-stato="da-fare"] .kanban-dot { background: var(--col-da-fare); }
        .board-legend-chip[data-stato="in-attesa"] .kanban-dot { background: var(--col-in-attesa); }
        .board-legend-chip[data-stato="in-corso"] .kanban-dot { background: var(--col-in-corso); }
        .board-legend-chip[data-stato="completata"] .kanban-dot { background: var(--col-completata); }

        .btn-board-view {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            height: 38px;
            padding: 0 14px;
            border-radius: 10px;
            border: 1px solid var(--line);
            background: var(--surface);
            color: var(--ink);
            font-family: var(--font);
            font-weight: 700;
            font-size: 0.8rem;
            cursor: pointer;
            box-shadow: var(--shadow);
            transition: 0.15s;
        }

        .btn-board-view svg {
            width: 18px;
            height: 18px;
            flex-shrink: 0;
        }

        .btn-board-view:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        .btn-board-view.active {
            background: var(--ink);
            border-color: var(--ink);
            color: #fff;
        }

        .board-list {
            display: none;
            grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
            gap: 12px;
            align-items: start;
        }

        .board-list.show {
            display: grid;
        }

        .board-list .task-card {
            height: 100%;
        }

        .badge-stato {
            font-size: 0.62rem;
            padding: 3px 7px;
            border-radius: 5px;
            text-transform: uppercase;
            font-weight: 700;
            letter-spacing: 0.04em;
            display: inline-block;
            border: 1px solid transparent;
        }

        .badge-stato.da-fare {
            background: #eff6ff;
            color: var(--col-da-fare);
            border-color: #bfdbfe;
        }

        .badge-stato.in-attesa {
            background: #fff7ed;
            color: var(--col-in-attesa);
            border-color: #fed7aa;
        }

        .badge-stato.in-corso {
            background: #fffbeb;
            color: var(--col-in-corso);
            border-color: #fde68a;
        }

        .badge-stato.completata {
            background: #ecfdf5;
            color: var(--col-completata);
            border-color: #a7f3d0;
        }

        .badge-stato.annullata {
            background: #fef2f2;
            color: #b91c1c;
            border-color: #fecaca;
        }

        .kanban.hidden-view { display: none; }

        .board-list-more {
            grid-column: 1 / -1;
            display: none;
        }

        .board-list-more.show { display: block; }

        .board-list-more button {
            width: 100%;
            border: 1px dashed var(--line);
            background: rgba(255, 255, 255, 0.7);
            color: var(--ink-soft);
            font-family: var(--font);
            font-size: 0.75rem;
            font-weight: 600;
            padding: 10px 8px;
            border-radius: 8px;
            cursor: pointer;
        }

        .task-card {
            position: relative;
            background: var(--surface);
            padding: 14px;
            border-radius: 12px;
            border: 1px solid var(--line);
            border-left: 3px solid var(--line);
            box-shadow: var(--shadow);
            cursor: grab;
            transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
            user-select: none;
            min-width: 0;
            width: 100%;
            box-sizing: border-box;
            overflow: hidden;
        }

        .task-card.is-sollecito {
            border-left-color: var(--sollecito);
        }

        .task-card.is-media.etichetta-foto {
            border-left-color: var(--foto);
        }

        .task-card.is-media.etichetta-video {
            border-left-color: var(--video);
        }

        .task-card.is-riunione {
            border-left-color: var(--riunione);
        }

        /* Logo in angolo: overlay, senza restringere il contenuto / colonna */
        .task-card.has-corner-badge .card-badges {
            padding-right: 40px;
        }

        .corner-badge {
            position: absolute;
            top: 8px;
            right: 8px;
            width: 34px;
            height: 34px;
            border-radius: 50%;
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 2;
            pointer-events: none;
            flex-shrink: 0;
        }

        .corner-badge.sollecito-horn {
            background: var(--sollecito);
            box-shadow: 0 4px 12px rgba(180, 83, 9, 0.45);
        }

        .corner-badge.media-camera.foto {
            background: var(--foto);
            box-shadow: 0 4px 12px rgba(157, 23, 77, 0.45);
        }

        .corner-badge.media-camera.video {
            background: var(--video);
            box-shadow: 0 4px 12px rgba(159, 18, 57, 0.45);
        }

        .corner-badge.riunione-badge {
            background: var(--riunione);
            box-shadow: 0 4px 12px rgba(15, 118, 110, 0.45);
        }

        .corner-badge.pacco-badge.spedizione {
            background: var(--spedizione);
            box-shadow: 0 4px 12px rgba(194, 65, 12, 0.45);
        }

        .corner-badge.pacco-badge.arrivo {
            background: var(--arrivo);
            box-shadow: 0 4px 12px rgba(3, 105, 161, 0.45);
        }

        .corner-badge svg {
            width: 18px;
            height: 18px;
        }

        .task-card:active { cursor: grabbing; }

        .task-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 24px rgba(18, 32, 51, 0.1);
        }

        .task-card.dragging {
            opacity: 0.45;
            transform: rotate(1.5deg) scale(0.98);
        }

        @keyframes pulse-soon {
            0%, 100% {
                box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.45);
                border-color: #ea580c;
            }
            50% {
                box-shadow: 0 0 0 8px rgba(234, 88, 12, 0);
                border-color: #fb923c;
            }
        }

        @keyframes pulse-riunione-giallo {
            0%, 100% {
                box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.55);
                border-color: #eab308;
                filter: brightness(1);
            }
            50% {
                box-shadow: 0 0 0 10px rgba(234, 179, 8, 0);
                border-color: #facc15;
                filter: brightness(1.04);
            }
        }

        @keyframes pulse-riunione-viola {
            0%, 100% {
                box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.55);
                border-color: #7c3aed;
                filter: brightness(1);
            }
            50% {
                box-shadow: 0 0 0 10px rgba(124, 58, 237, 0);
                border-color: #a78bfa;
                filter: brightness(1.05);
            }
        }

        @keyframes pulse-alert {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.72; }
        }

        .alert-24h {
            border-color: #ea580c !important;
            border-width: 2px !important;
            background: linear-gradient(180deg, #fff7ed 0%, #fffaf5 45%, #fff 100%);
            animation: pulse-soon 1.4s ease-in-out infinite;
        }

        .alert-24h .deadline-urgent {
            color: #c2410c;
            font-weight: 800;
        }

        .alert-riunione-domani {
            border-color: #eab308 !important;
            border-width: 2px !important;
            background: linear-gradient(180deg, #fef9c3 0%, #fffbeb 45%, #fff 100%);
            animation: pulse-riunione-giallo 1.2s ease-in-out infinite;
        }

        .alert-riunione-domani .deadline-riunione {
            color: #a16207;
            font-weight: 800;
        }

        .alert-riunione-oggi {
            border-color: #7c3aed !important;
            border-width: 2px !important;
            background: linear-gradient(180deg, #ede9fe 0%, #f5f3ff 45%, #fff 100%);
            animation: pulse-riunione-viola 1.1s ease-in-out infinite;
        }

        .alert-riunione-oggi .deadline-riunione {
            color: #6d28d9;
            font-weight: 800;
        }

        .riunione-badge-domani,
        .riunione-badge-oggi {
            display: inline-block;
            margin-left: 6px;
            padding: 2px 7px;
            border-radius: 999px;
            color: #fff;
            font-size: 0.62rem;
            font-weight: 800;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            vertical-align: middle;
        }

        .riunione-badge-domani { background: #ca8a04; }
        .riunione-badge-oggi { background: #7c3aed; }

        .cal-event.riunione-domani {
            background: #eab308 !important;
            animation: pulse-riunione-giallo 1.2s ease-in-out infinite;
        }

        .cal-event.riunione-oggi {
            background: #7c3aed !important;
            animation: pulse-riunione-viola 1.1s ease-in-out infinite;
        }

        .soon-badge {
            display: inline-block;
            margin-left: 6px;
            padding: 2px 7px;
            border-radius: 999px;
            background: #ea580c;
            color: #fff;
            font-size: 0.62rem;
            font-weight: 800;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            vertical-align: middle;
        }

        .alert-overdue {
            border-color: #dc2626 !important;
            border-width: 2px !important;
            border-left-width: 5px !important;
            background: linear-gradient(180deg, #fee2e2 0%, #fff5f5 40%, #fff 100%);
            box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.15), 0 8px 22px rgba(220, 38, 38, 0.18);
        }

        .alert-overdue .task-azienda {
            color: #991b1b;
        }

        .alert-overdue .deadline-overdue {
            color: #b91c1c;
            font-weight: 800;
            font-size: 0.82rem;
        }

        .overdue-badge {
            display: inline-block;
            margin-left: 6px;
            padding: 2px 7px;
            border-radius: 999px;
            background: #dc2626;
            color: #fff;
            font-size: 0.62rem;
            font-weight: 800;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            vertical-align: middle;
        }

        .pri-Alta { border-left-color: var(--high); }
        .pri-Media { border-left-color: var(--medium); }
        .pri-Bassa { border-left-color: var(--low); }

        .badge-tipo {
            font-size: 0.62rem;
            padding: 3px 7px;
            border-radius: 5px;
            text-transform: uppercase;
            font-weight: 700;
            letter-spacing: 0.04em;
            color: #fff;
            display: inline-block;
            margin-bottom: 8px;
        }

        .card-badges {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 8px;
            align-items: center;
        }

        .card-badges .badge-tipo { margin-bottom: 0; }

        .badge-pri {
            font-size: 0.62rem;
            padding: 3px 7px;
            border-radius: 5px;
            text-transform: uppercase;
            font-weight: 700;
            letter-spacing: 0.04em;
            display: inline-block;
            border: 1px solid transparent;
        }

        .badge-pri.Alta {
            background: #fef2f2;
            color: #b91c1c;
            border-color: #fecaca;
        }

        .badge-pri.Media {
            background: #fffbeb;
            color: #b45309;
            border-color: #fde68a;
        }

        .badge-pri.Bassa {
            background: #ecfdf5;
            color: #047857;
            border-color: #a7f3d0;
        }

        .badge-pubbl {
            font-size: 0.62rem;
            padding: 3px 7px;
            border-radius: 5px;
            text-transform: uppercase;
            font-weight: 700;
            letter-spacing: 0.04em;
            display: inline-block;
            border: 1px solid transparent;
        }

        .badge-pubbl.da-pubblicare {
            background: #fff7ed;
            color: #c2410c;
            border-color: #fed7aa;
        }

        .badge-pubbl.pubblicato {
            background: #ecfdf5;
            color: #047857;
            border-color: #a7f3d0;
        }

        .badge-pubbl.non-richiesta {
            background: #f1f5f9;
            color: #475569;
            border-color: #cbd5e1;
        }

        .badge-pubbl.pending-done {
            background: #fff1f2;
            color: #be123c;
            border-color: #fecdd3;
            animation: pulse-alert 1.8s ease-in-out infinite;
        }

        .task-pubbl-date {
            display: block;
            margin-top: 4px;
            font-size: 0.72rem;
            color: var(--muted);
            font-weight: 500;
        }

        .pubbl-panel {
            margin-top: 16px;
            padding: 14px 16px;
            border-radius: 12px;
            border: 1px solid var(--line);
            background: var(--surface-2);
        }

        .pubbl-panel.needs-pub {
            border-color: #fecdd3;
            background: #fff1f2;
        }

        .pubbl-panel-row {
            display: flex;
            flex-wrap: wrap;
            gap: 10px 16px;
            align-items: center;
            justify-content: space-between;
        }

        .pubbl-panel-meta {
            font-size: 0.95rem;
            font-weight: 600;
        }

        .pubbl-panel-meta span {
            font-weight: 500;
            color: var(--muted);
        }

        .pubbl-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
        }

        .pubbl-actions input[type="date"] {
            width: auto;
            min-width: 140px;
            padding: 7px 10px;
            font-size: 0.85rem;
        }

        .btn-pubbl {
            border: none;
            border-radius: 8px;
            padding: 8px 12px;
            font-family: var(--font);
            font-size: 0.82rem;
            font-weight: 700;
            cursor: pointer;
            background: var(--foto);
            color: #fff;
        }

        .btn-pubbl:hover { filter: brightness(1.05); }

        .btn-pubbl.secondary {
            background: #fff;
            color: var(--ink);
            border: 1px solid var(--line);
        }

        .bg-da-fare { background: var(--primary); }
        .bg-pro-memoria { background: var(--promemoria); }
        .bg-sollecito { background: var(--sollecito); }
        .bg-video { background: var(--video); }
        .bg-foto { background: var(--foto); }
        .bg-texture { background: var(--texture); }
        .bg-3d { background: var(--threed); }
        .bg-campionario { background: var(--campionario); }
        .bg-spedizione-materiali { background: var(--spedizione); }
        .bg-arrivo-materiali { background: var(--arrivo); }
        .bg-riunione { background: var(--riunione); }

        .task-azienda {
            font-weight: 700;
            font-size: 0.95rem;
            margin: 0 0 4px;
            letter-spacing: -0.01em;
            line-height: 1.25;
        }

        .task-deadline {
            font-size: 0.75rem;
            color: var(--muted);
            margin-bottom: 8px;
            display: block;
        }

        .task-deadline.deadline-completata {
            color: #15803d;
            font-weight: 800;
            font-size: 0.82rem;
            letter-spacing: -0.01em;
        }

        .task-deadline.deadline-annullata {
            color: #b91c1c;
            font-weight: 800;
            font-size: 0.82rem;
            letter-spacing: -0.01em;
        }

        .task-card.is-annullata {
            opacity: 0.78;
        }

        .task-card.is-annullata .task-azienda {
            text-decoration: line-through;
            text-decoration-thickness: 1px;
            color: var(--muted);
        }

        .task-snippet {
            font-size: 0.82rem;
            color: var(--ink-soft);
            line-height: 1.45;
            max-height: 5.8em;
            min-height: 2.4em;
            overflow-y: auto;
            overflow-x: hidden;
            margin-bottom: 10px;
            padding-right: 4px;
            white-space: pre-wrap;
            word-break: break-word;
            scrollbar-width: thin;
            cursor: text;
            overscroll-behavior: contain;
        }

        .task-snippet b,
        .task-snippet strong,
        .pm-snippet b,
        .pm-snippet strong {
            font-weight: 700;
            color: var(--ink);
            background: linear-gradient(transparent 8%, #fde047 8%, #fde047 88%, transparent 88%);
            box-decoration-break: clone;
            -webkit-box-decoration-break: clone;
            padding: 0 0.12em;
        }

        .task-snippet a.snippet-link,
        .pm-snippet a.snippet-link {
            display: inline;
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.02em;
            text-decoration: none;
            color: var(--primary);
            background: #eff6ff;
            border: 1px solid #bfdbfe;
            border-radius: 5px;
            padding: 0 6px;
            line-height: 1.5;
            white-space: nowrap;
        }

        .task-snippet a.snippet-link:hover,
        .pm-snippet a.snippet-link:hover {
            background: #dbeafe;
            text-decoration: none;
        }

        .task-snippet::-webkit-scrollbar {
            width: 5px;
        }

        .task-snippet::-webkit-scrollbar-thumb {
            background: rgba(18, 32, 51, 0.22);
            border-radius: 999px;
        }

        .task-footer {
            font-size: 0.72rem;
            color: var(--muted);
            border-top: 1px solid var(--surface-2);
            padding-top: 8px;
            display: flex;
            justify-content: space-between;
            gap: 8px;
        }

        .task-footer b { color: var(--ink-soft); font-weight: 600; }

        .preferito-mini {
            background: var(--sollecito-bg);
            border: 1px solid #fed7aa;
            border-radius: 6px;
            padding: 6px 8px;
            font-size: 0.72rem;
            color: #9a3412;
            margin-bottom: 8px;
        }

        .preferito-mini b { color: #c2410c; }

        .empty-col {
            text-align: center;
            padding: 28px 12px;
            color: var(--muted);
            font-size: 0.8rem;
            border: 1px dashed var(--line);
            border-radius: 10px;
            background: rgba(255, 255, 255, 0.4);
        }

        .hint-drag {
            margin: 0 0 14px;
            font-size: 0.8rem;
            color: var(--muted);
        }

        /* Pro memoria */
        .promemoria-panel {
            background: rgba(255, 255, 255, 0.88);
            border: 1px solid #ddd6fe;
            border-radius: var(--radius);
            margin-bottom: 18px;
            box-shadow: var(--shadow);
            overflow: hidden;
        }

        .promemoria-panel > summary {
            list-style: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 14px 16px;
            background: linear-gradient(90deg, #f5f3ff, #faf8ff);
            font-weight: 700;
            color: var(--promemoria);
            user-select: none;
        }

        .promemoria-panel > summary::-webkit-details-marker { display: none; }

        .promemoria-panel > summary .pm-left {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .promemoria-panel > summary .pm-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: var(--promemoria);
        }

        .promemoria-count {
            font-size: 0.72rem;
            font-weight: 700;
            color: var(--promemoria);
            background: #fff;
            border: 1px solid #ddd6fe;
            min-width: 24px;
            height: 24px;
            border-radius: 999px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0 8px;
        }

        .promemoria-body {
            padding: 12px 14px 16px;
            border-top: 1px solid #ede9fe;
        }

        .promemoria-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
            gap: 10px;
        }

        .pm-card {
            background: #fff;
            border: 1px solid #e9e5f8;
            border-left: 4px solid var(--promemoria);
            border-radius: 12px;
            padding: 14px;
            cursor: pointer;
            transition: transform 0.15s, box-shadow 0.15s;
        }

        .pm-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(91, 77, 154, 0.12);
        }

        .pm-card.archived {
            opacity: 0.72;
            border-left-color: #94a3b8;
            background: var(--surface-2);
        }

        .pm-card-top {
            display: flex;
            justify-content: space-between;
            gap: 8px;
            align-items: flex-start;
            margin-bottom: 8px;
        }

        .pm-azienda {
            font-weight: 700;
            font-size: 0.95rem;
            margin: 0;
            letter-spacing: -0.01em;
        }

        .pm-snippet {
            font-size: 0.82rem;
            color: var(--ink-soft);
            line-height: 1.45;
            max-height: 5.8em;
            min-height: 2.2em;
            overflow-y: auto;
            overflow-x: hidden;
            margin-bottom: 10px;
            padding-right: 4px;
            white-space: pre-wrap;
            word-break: break-word;
            scrollbar-width: thin;
            cursor: text;
            overscroll-behavior: contain;
        }

        .pm-snippet::-webkit-scrollbar {
            width: 5px;
        }

        .pm-snippet::-webkit-scrollbar-thumb {
            background: rgba(18, 32, 51, 0.22);
            border-radius: 999px;
        }

        .pm-date {
            display: block;
            margin: 0 0 8px;
            font-size: 0.75rem;
            font-weight: 600;
            color: var(--promemoria);
        }

        .pm-foot {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;
            font-size: 0.72rem;
            color: var(--muted);
        }

        .pm-actions {
            display: flex;
            gap: 6px;
        }

        .pm-actions button {
            border: 1px solid var(--line);
            background: var(--surface-2);
            color: var(--ink-soft);
            font-family: var(--font);
            font-size: 0.7rem;
            font-weight: 700;
            padding: 5px 8px;
            border-radius: 6px;
            cursor: pointer;
        }

        .pm-actions button.archive {
            background: #f5f3ff;
            border-color: #ddd6fe;
            color: var(--promemoria);
        }

        .pm-actions button.restore {
            background: #fff7ed;
            border-color: #fed7aa;
            color: #c2410c;
        }

        .pm-empty {
            text-align: center;
            padding: 18px;
            color: var(--muted);
            font-size: 0.85rem;
            border: 1px dashed #ddd6fe;
            border-radius: 10px;
        }

        .pm-archive-toggle {
            margin-top: 12px;
            border: none;
            background: transparent;
            color: var(--muted);
            font-family: var(--font);
            font-size: 0.78rem;
            font-weight: 600;
            cursor: pointer;
            text-decoration: underline;
            text-underline-offset: 3px;
        }

        .pm-archive-block {
            display: none;
            margin-top: 12px;
            padding-top: 12px;
            border-top: 1px dashed #ddd6fe;
        }

        .pm-archive-block.show { display: block; }

        /* Form / modal */
        .grid-form {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 18px;
        }

        .full-width { grid-column: span 4; }

        .modal label {
            display: block;
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--ink-soft);
            font-size: 0.8rem;
        }

        .btn-format-bold {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: var(--surface-2);
            border: 1px solid var(--line);
            width: 34px;
            height: 34px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 700;
            margin-bottom: 8px;
            color: var(--ink);
            font-family: var(--font);
        }

        .btn-format-bold:hover { background: var(--line); }

        button.btn-add {
            background: var(--ink);
            color: #fff;
            border: none;
            padding: 16px;
            border-radius: var(--radius-sm);
            cursor: pointer;
            font-family: var(--font);
            font-size: 1rem;
            font-weight: 600;
            width: 100%;
            margin-top: 8px;
        }

        button.btn-add:hover { background: #0a1624; }

        /* Scheda nuova attività — layout compatto */
        #addModal .modal-content-large {
            max-width: 720px;
            max-height: calc(100vh - 28px);
            margin: 14px auto;
            padding: 0;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            border: 1px solid rgba(255, 255, 255, 0.35);
            border-radius: 16px;
        }

        #addModal .add-modal-head {
            padding: 14px 22px 12px;
            background:
                radial-gradient(600px 180px at 0% 0%, rgba(26, 79, 122, 0.14), transparent 60%),
                linear-gradient(135deg, #f4f7fb 0%, #ffffff 55%, #f7f4ef 100%);
            border-bottom: 1px solid var(--line);
            position: relative;
            flex-shrink: 0;
        }

        #addModal .add-modal-kicker {
            margin: 0 0 2px;
            font-size: 0.62rem;
            font-weight: 700;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--primary);
        }

        #addModal .add-modal-head h2 {
            margin: 0;
            font-family: var(--display);
            font-weight: 400;
            font-size: 1.45rem;
            letter-spacing: -0.02em;
            color: var(--ink);
            line-height: 1.15;
        }

        #addModal .add-modal-sub {
            margin: 4px 0 0;
            color: var(--muted);
            font-size: 0.78rem;
            line-height: 1.3;
        }

        #addModal .close {
            right: 12px;
            top: 10px;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.85);
            border: 1px solid var(--line);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            line-height: 1;
        }

        #addModal .close:hover {
            background: #fff;
            color: var(--ink);
        }

        #addModal .add-modal-body {
            padding: 12px 18px 14px;
            overflow-y: auto;
            flex: 1 1 auto;
            min-height: 0;
            -webkit-overflow-scrolling: touch;
        }

        #addModal .form-section {
            margin-bottom: 10px;
            padding: 10px 12px;
            background: var(--surface-2);
            border: 1px solid var(--line);
            border-radius: 10px;
        }

        #addModal .form-section:last-of-type { margin-bottom: 4px; }

        #addModal .form-section-title {
            margin: 0 0 8px;
            font-size: 0.62rem;
            font-weight: 700;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: var(--primary);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        #addModal .form-section-title::after {
            content: "";
            flex: 1;
            height: 1px;
            background: var(--line);
        }

        #addModal .grid-form {
            gap: 8px 10px;
        }

        #addModal .modal label {
            margin-bottom: 3px;
            font-size: 0.65rem;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: var(--muted);
        }

        #addModal input,
        #addModal select {
            background: #fff;
            padding: 7px 10px;
            font-size: 0.88rem;
            border-radius: 8px;
        }

        #addModal .field-hint {
            margin: 4px 0 0;
            font-size: 0.7rem;
            color: var(--muted);
            line-height: 1.35;
        }

        #addModal .share-checks {
            margin-top: 4px;
            gap: 6px;
        }

        #addModal .share-checks .chip-check span {
            min-height: 30px;
            padding: 4px 10px 4px 8px;
            gap: 6px;
            font-size: 0.75rem;
            color: var(--ink-soft);
        }

        /* Spunta sempre visibile (anche senza classe colore tipo) */
        #addModal .share-checks .chip-check input:checked + span {
            background: #e8eef5;
            border-color: var(--primary);
            color: var(--primary);
            box-shadow: 0 0 0 1px rgba(26, 79, 122, 0.12);
        }

        #addModal .share-checks .chip-check input:checked + span::before {
            border-color: transparent;
            background-color: var(--primary);
            background-size: 10px 10px;
            background-position: center;
            background-repeat: no-repeat;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.2l3 3 6-6.5' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        }

        #addModal .chip-check.share-tutti input:checked + span {
            background: #dbe7f2;
            border-color: var(--primary);
            color: var(--primary-hover);
        }

        #addModal .chip-check.share-tutti input:checked + span::before {
            background-color: var(--primary-hover);
        }

        #addModal #descrizioneSection {
            padding: 12px 12px 14px;
        }

        #addModal #descrizioneSection .rich-editor {
            background: #fff;
            min-height: 200px;
            border-radius: 10px;
            padding: 12px 14px;
            font-size: 0.95rem;
            line-height: 1.55;
        }

        #addModal .rich-editor {
            background: #fff;
            min-height: 120px;
            border-radius: 10px;
        }

        #addModal .rich-toolbar {
            margin-bottom: 6px;
        }

        #addModal .desc-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 6px;
        }

        #addModal .desc-header label { margin: 0; }

        #addModal .desc-header .btn-format-bold {
            width: 28px;
            height: 28px;
            margin-bottom: 0;
            font-size: 0.85rem;
        }

        #addModal .add-modal-foot {
            display: flex;
            gap: 8px;
            margin-top: 4px;
            padding-top: 4px;
        }

        #addModal .btn-add {
            flex: 1;
            margin: 0;
            background: var(--primary);
            box-shadow: 0 4px 12px rgba(26, 79, 122, 0.22);
            border-radius: 10px;
            padding: 11px 14px;
            font-size: 0.92rem;
            transition: background 0.2s, transform 0.15s;
        }

        #addModal .btn-add:hover {
            background: var(--primary-hover);
            transform: translateY(-1px);
        }

        #addModal .btn-cancel-add {
            background: #fff;
            border: 1px solid var(--line);
            color: var(--ink-soft);
            padding: 11px 14px;
            border-radius: 10px;
            font-family: var(--font);
            font-weight: 600;
            font-size: 0.88rem;
            cursor: pointer;
            min-width: 100px;
        }

        #addModal .btn-cancel-add:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        #addModal #productInfoContainer {
            display: none;
            grid-template-columns: 1fr 1fr;
            gap: 8px 10px;
            grid-column: span 4;
        }

        #addModal .chip-checks {
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
        }

        #addModal .chip-check {
            position: relative;
            margin: 0;
            cursor: pointer;
        }

        #addModal .chip-check input {
            position: absolute;
            opacity: 0;
            pointer-events: none;
        }

        #addModal .chip-check span {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            min-height: 26px;
            padding: 2px 8px;
            border-radius: 6px;
            border: 1.5px solid var(--line);
            background: #fff;
            font-size: 0.7rem;
            font-weight: 700;
            color: var(--muted);
            transition: 0.15s;
            user-select: none;
            white-space: nowrap;
        }

        #addModal .chip-check span::before {
            content: "";
            width: 11px;
            height: 11px;
            border-radius: 3px;
            border: 1.5px solid #c5d0dc;
            background: #fff;
            flex-shrink: 0;
            transition: 0.15s;
        }

        #addModal .chip-check:hover span {
            border-color: #b7c6d6;
            color: var(--ink-soft);
        }

        #addModal .chip-check input:checked + span {
            box-shadow: 0 2px 8px rgba(18, 32, 51, 0.08);
        }

        #addModal .chip-check input:checked + span::before {
            border-color: transparent;
            background-size: 10px 10px;
            background-position: center;
            background-repeat: no-repeat;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8.2l3 3 6-6.5' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        }

        #addModal .chip-check.pri-alta input:checked + span {
            background: #fef2f2;
            border-color: #fecaca;
            color: #b91c1c;
        }
        #addModal .chip-check.pri-alta input:checked + span::before { background-color: #dc2626; }

        #addModal .chip-check.pri-media input:checked + span {
            background: #fffbeb;
            border-color: #fde68a;
            color: #b45309;
        }
        #addModal .chip-check.pri-media input:checked + span::before { background-color: #d97706; }

        #addModal .chip-check.pri-bassa input:checked + span {
            background: #ecfdf5;
            border-color: #a7f3d0;
            color: #047857;
        }
        #addModal .chip-check.pri-bassa input:checked + span::before { background-color: #0f766e; }

        #addModal .chip-check.tipo-da-fare input:checked + span {
            background: #eff6ff;
            border-color: #bfdbfe;
            color: var(--primary);
        }
        #addModal .chip-check.tipo-da-fare input:checked + span::before { background-color: var(--primary); }

        #addModal .chip-check.tipo-pro-memoria input:checked + span {
            background: #f5f3ff;
            border-color: #ddd6fe;
            color: var(--promemoria);
        }
        #addModal .chip-check.tipo-pro-memoria input:checked + span::before { background-color: var(--promemoria); }

        #addModal .chip-check.tipo-sollecito input:checked + span {
            background: var(--sollecito-bg);
            border-color: #fed7aa;
            color: var(--sollecito);
        }
        #addModal .chip-check.tipo-sollecito input:checked + span::before { background-color: var(--sollecito); }

        #addModal .chip-check.tipo-video input:checked + span {
            background: #fff1f2;
            border-color: #fecdd3;
            color: var(--video);
        }
        #addModal .chip-check.tipo-video input:checked + span::before { background-color: var(--video); }

        #addModal .chip-check.tipo-foto input:checked + span {
            background: #fdf2f8;
            border-color: #fbcfe8;
            color: var(--foto);
        }
        #addModal .chip-check.tipo-foto input:checked + span::before { background-color: var(--foto); }

        #addModal .chip-check.tipo-texture input:checked + span {
            background: #ecfeff;
            border-color: #a5f3fc;
            color: var(--texture);
        }
        #addModal .chip-check.tipo-texture input:checked + span::before { background-color: var(--texture); }

        #addModal .chip-check.tipo-3d input:checked + span {
            background: #eef2ff;
            border-color: #c7d2fe;
            color: var(--threed);
        }
        #addModal .chip-check.tipo-3d input:checked + span::before { background-color: var(--threed); }

        #addModal .chip-check.tipo-campionario input:checked + span {
            background: #fffbeb;
            border-color: #fde68a;
            color: var(--campionario);
        }
        #addModal .chip-check.tipo-campionario input:checked + span::before { background-color: var(--campionario); }

        #addModal .chip-check.tipo-spedizione-materiali input:checked + span {
            background: #fff7ed;
            border-color: #fed7aa;
            color: var(--spedizione);
        }
        #addModal .chip-check.tipo-spedizione-materiali input:checked + span::before { background-color: var(--spedizione); }

        #addModal .chip-check.tipo-arrivo-materiali input:checked + span {
            background: #f0f9ff;
            border-color: #bae6fd;
            color: var(--arrivo);
        }
        #addModal .chip-check.tipo-arrivo-materiali input:checked + span::before { background-color: var(--arrivo); }

        #addModal .chip-check.tipo-riunione input:checked + span {
            background: #ecfdf5;
            border-color: #a7f3d0;
            color: var(--riunione);
        }
        #addModal .chip-check.tipo-riunione input:checked + span::before { background-color: var(--riunione); }

        #addModal #orarioRiunioneContainer {
            display: none;
            grid-column: span 2;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        #addModal #orarioRiunioneContainer.show {
            display: grid;
        }

        #addModal #titoloRiunioneContainer {
            display: none;
        }

        #addModal #titoloRiunioneContainer.show {
            display: block;
        }

        #addModal #tipoContainer {
            grid-column: span 4;
        }

        #addModal .priority-checks {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
        }

        #addModal #pubblicazioneContainer {
            display: none;
            grid-template-columns: 1fr 1fr;
            gap: 8px 10px;
            grid-column: span 4;
            margin-top: 2px;
            padding-top: 10px;
            border-top: 1px dashed var(--line);
        }

        #addModal #pubblicazioneContainer .pubbl-hint {
            grid-column: span 2;
            margin: 0;
            font-size: 0.78rem;
            color: var(--muted);
            line-height: 1.4;
        }

        #addModal .allegati-hint {
            margin: 0 0 8px;
            font-size: 0.72rem;
            color: var(--muted);
            line-height: 1.35;
        }

        .badge-condivisa {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            font-size: 0.68rem;
            font-weight: 700;
            color: #1d4ed8;
            background: #eff6ff;
            border: 1px solid #bfdbfe;
            border-radius: 6px;
            padding: 2px 7px;
            letter-spacing: 0.01em;
            white-space: nowrap;
        }

        #addModal .allegati-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-bottom: 8px;
        }

        #addModal .allegato-row {
            display: grid;
            grid-template-columns: 1fr 1.6fr auto;
            gap: 6px;
            align-items: end;
            padding: 8px;
            border: 1px solid var(--line);
            border-radius: 8px;
            background: var(--surface-2);
        }

        #addModal .allegato-row label {
            margin-bottom: 4px;
        }

        #addModal .btn-add-allegato {
            border: 1px dashed var(--line);
            background: #fff;
            color: var(--ink-soft);
            font-family: var(--font);
            font-size: 0.78rem;
            font-weight: 600;
            padding: 7px 10px;
            border-radius: 8px;
            cursor: pointer;
            width: 100%;
        }

        #addModal .btn-add-allegato:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        #addModal .allegati-actions {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }

        #addModal .btn-link-listino {
            border: 1px dashed var(--line);
            background: #fff;
            color: var(--ink-soft);
            font-family: var(--font);
            font-size: 0.82rem;
            font-weight: 600;
            padding: 10px 12px;
            border-radius: 10px;
            cursor: pointer;
            width: 100%;
        }

        #addModal .btn-link-listino:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        #addModal .listino-picker {
            margin-top: 10px;
            border: 1px solid var(--line);
            border-radius: 12px;
            background: #fff;
            padding: 10px;
        }

        #addModal .listino-picker[hidden] { display: none !important; }

        #addModal .listino-picker-search {
            width: 100%;
            margin-bottom: 8px;
        }

        #addModal .listino-picker-list {
            max-height: 220px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        #addModal .listino-picker-item {
            display: block;
            width: 100%;
            text-align: left;
            border: none;
            background: transparent;
            padding: 10px 12px;
            border-radius: 8px;
            font-family: var(--font);
            cursor: pointer;
            color: var(--ink);
        }

        #addModal .listino-picker-item:hover {
            background: var(--surface-2);
        }

        #addModal .listino-picker-item b {
            display: block;
            font-size: 0.9rem;
        }

        #addModal .listino-picker-item span {
            display: block;
            font-size: 0.75rem;
            color: var(--muted);
            margin-top: 2px;
        }

        #addModal .listino-picker-empty {
            padding: 12px;
            color: var(--muted);
            font-size: 0.85rem;
        }

        .allegato-ico.listino {
            background: #eff6ff;
            color: var(--primary);
        }

        #addModal .btn-remove-allegato {
            border: 1px solid var(--line);
            background: #fff;
            color: var(--danger);
            font-family: var(--font);
            font-size: 0.78rem;
            font-weight: 700;
            padding: 10px 12px;
            border-radius: 8px;
            cursor: pointer;
            height: 42px;
        }

        .allegati-view {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .allegato-link {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            border: 1px solid var(--line);
            border-radius: 10px;
            background: #fff;
            text-decoration: none;
            color: var(--ink);
            font-size: 0.9rem;
            font-weight: 600;
            transition: 0.15s;
            cursor: pointer;
            font-family: var(--font);
            width: 100%;
            text-align: left;
        }

        .allegato-link:hover {
            border-color: var(--primary);
            color: var(--primary);
            background: rgba(26, 79, 122, 0.04);
        }

        .allegato-link .allegato-ico {
            flex-shrink: 0;
            width: 28px;
            height: 28px;
            border-radius: 7px;
            background: #fef2f2;
            color: #b91c1c;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 0.62rem;
            font-weight: 800;
            letter-spacing: 0.04em;
        }

        .allegato-link .allegato-ico.img {
            background: #ecfdf5;
            color: #047857;
        }

        .allegato-link .allegato-ico.link {
            background: #f1f5f9;
            color: #475569;
        }

        .allegato-link .allegato-thumb {
            flex-shrink: 0;
            width: 44px;
            height: 44px;
            border-radius: 8px;
            object-fit: cover;
            border: 1px solid var(--line);
            background: var(--surface-2);
        }

        .allegato-link.local .allegato-ico {
            background: #eff6ff;
            color: var(--primary);
        }

        .allegato-link.is-img:hover {
            background: rgba(4, 120, 87, 0.04);
            border-color: #059669;
        }

        .allegato-link .allegato-meta {
            min-width: 0;
            flex: 1;
        }

        .allegato-link .allegato-nome {
            display: block;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .allegato-link .allegato-path {
            display: block;
            margin-top: 2px;
            font-size: 0.72rem;
            font-weight: 500;
            color: var(--muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .badge-allegati {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 3px;
            min-width: 22px;
            height: 22px;
            padding: 0 6px;
            border-radius: 6px;
            background: #f1f5f9;
            color: var(--ink-soft);
            border: 1px solid var(--line);
            flex-shrink: 0;
        }

        .badge-allegati svg {
            width: 13px;
            height: 13px;
            display: block;
        }

        .badge-allegati b {
            font-size: 0.65rem;
            font-weight: 800;
            font-family: var(--font);
            line-height: 1;
        }

        @media (max-width: 600px) {
            #addModal .allegato-row {
                grid-template-columns: 1fr;
            }
            #addModal .btn-remove-allegato {
                width: 100%;
            }
            #addModal .allegati-actions {
                grid-template-columns: 1fr;
            }
        }

        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            inset: 0;
            background: rgba(10, 18, 28, 0.62);
            backdrop-filter: blur(6px);
            overflow-y: auto;
            padding: 20px;
        }

        #mediaPreviewModal,
        #imgPreviewModal,
        #pdfPreviewModal {
            z-index: 4000;
            padding: 12px;
        }

        .modal-content-large,
        .modal-content {
            background: var(--surface);
            margin: 24px auto;
            padding: 40px;
            width: 100%;
            border-radius: 20px;
            position: relative;
            box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
            animation: modalIn 0.28s ease;
        }

        .modal-content-large { max-width: 960px; }
        .modal-content { max-width: 720px; }

        /* Task detail (lettura card) */
        #taskModal .modal-content.task-detail {
            max-width: min(920px, 96vw);
            width: 100%;
            padding: 0;
            overflow: hidden;
            border: 1px solid rgba(255, 255, 255, 0.35);
            box-shadow:
                0 24px 60px rgba(10, 18, 28, 0.32),
                0 2px 0 rgba(255, 255, 255, 0.4) inset;
        }

        #taskModal .task-detail-head {
            position: relative;
            padding: 22px 28px 18px;
            background:
                linear-gradient(145deg, rgba(26, 79, 122, 0.10) 0%, transparent 48%),
                linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
            border-bottom: 1px solid var(--line);
        }

        #taskModal .task-detail-head::before {
            content: "";
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 4px;
            background: linear-gradient(180deg, var(--primary), #2a6a9a);
        }

        #taskModal .task-detail-kicker {
            margin: 6px 0 2px;
            font-size: 0.62rem;
            font-weight: 700;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            color: var(--primary);
        }

        #taskModal #m-azienda {
            font-family: var(--display);
            font-weight: 400;
            font-size: clamp(1.55rem, 2.6vw, 2rem);
            line-height: 1.1;
            letter-spacing: -0.02em;
            color: var(--ink);
            margin: 0;
        }

        #taskModal .task-detail-body {
            padding: 18px 28px 24px;
        }

        #taskModal .task-detail-meta {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            margin-bottom: 14px;
        }

        #taskModal .meta-tile {
            background: var(--surface-2);
            border: 1px solid var(--line);
            border-radius: 10px;
            padding: 8px 10px;
            min-height: 0;
        }

        #taskModal .meta-tile .meta-label,
        #taskModal .read-section > .meta-label,
        #taskModal .move-label,
        #taskModal #m-prodotto-box .meta-label {
            margin-bottom: 2px;
            font-size: 0.62rem;
        }

        #taskModal .meta-tile .meta-value {
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--ink);
            line-height: 1.3;
            margin-top: 0;
        }

        #taskModal #m-esecuzione {
            color: var(--success);
        }

        #taskModal #m-prodotto-box {
            grid-column: span 2;
            background:
                linear-gradient(135deg, rgba(26, 79, 122, 0.06), transparent 60%),
                var(--surface-2);
            padding: 8px 10px;
            border-radius: 10px;
            border: 1px solid var(--line);
        }

        #taskModal #m-prodotto-box .prod-line {
            font-size: 0.92rem;
            color: var(--ink);
            margin-top: 0;
        }

        #taskModal #m-prodotto-box .prod-line span {
            color: var(--muted);
            font-weight: 500;
        }

        #taskModal .read-section {
            margin-top: 8px;
        }

        #taskModal .read-section > .meta-label {
            margin-bottom: 8px;
        }

        #taskModal .detail-box {
            background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
            padding: 18px 20px;
            border-radius: 12px;
            border: 1px solid var(--line);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
            line-height: 1.65;
            white-space: pre-wrap;
            margin-top: 0;
            color: var(--ink);
            font-size: 1.02rem;
            min-height: 160px;
            max-height: min(58vh, 520px);
            overflow-y: auto;
        }

        #taskModal .comment-box {
            background: linear-gradient(180deg, #ecfdf5, #f0fdf8);
            padding: 10px 12px;
            border-radius: 10px;
            border: 1px solid #a7f3d0;
            margin-top: 10px;
            font-style: italic;
            color: #065f46;
            white-space: pre-wrap;
            line-height: 1.45;
            font-size: 0.88rem;
        }

        #taskModal #m-commento-input-area {
            margin-top: 12px;
            padding: 10px 12px;
            border-radius: 10px;
            border: 1px dashed var(--line);
            background: rgba(244, 247, 251, 0.65);
        }

        #taskModal #m-commento-input-area > label {
            font-size: 0.62rem;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.06em;
            font-weight: 700;
        }

        #taskModal .move-label {
            margin-top: 16px;
            margin-bottom: 0;
        }

        #taskModal .status-move {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 6px;
            margin-top: 6px;
        }

        #taskModal .status-move button {
            font-family: var(--font);
            border: 1px solid var(--line);
            background: #fff;
            color: var(--ink-soft);
            padding: 8px 6px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.72rem;
            transition: 0.15s;
            box-shadow: 0 1px 2px rgba(18, 32, 51, 0.04);
        }

        #taskModal .status-move button:hover {
            border-color: var(--primary);
            color: var(--primary);
            background: rgba(26, 79, 122, 0.04);
        }

        #taskModal .status-move button.current {
            background: var(--ink);
            color: #fff;
            border-color: var(--ink);
            cursor: default;
            box-shadow: none;
        }

        #taskModal .actions-bar {
            display: flex;
            gap: 8px;
            margin-top: 14px;
            flex-wrap: wrap;
            padding-top: 12px;
            border-top: 1px solid var(--line);
        }

        #taskModal .actions-bar button {
            padding: 9px 14px;
            font-size: 0.82rem;
        }

        #taskModal .close {
            z-index: 2;
            right: 12px;
            top: 10px;
            width: 32px;
            height: 32px;
            border-radius: 999px;
            background: rgba(255, 255, 255, 0.85);
            border: 1px solid var(--line);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            color: var(--muted);
            box-shadow: var(--shadow);
        }

        #taskModal .close:hover {
            color: var(--ink);
            background: #fff;
        }

        #taskModal #modalBadges .card-badges {
            margin-bottom: 0;
            gap: 5px;
        }

        #taskModal #modalBadges .badge-tipo,
        #taskModal #modalBadges .badge-pri {
            font-size: 0.58rem;
            padding: 2px 6px;
        }

        #taskModal #m-preferito-box {
            margin-top: 8px;
            margin-bottom: 2px;
        }

        #taskModal .preferito-scheda {
            background: var(--sollecito-bg);
            border: 1px solid #fed7aa;
            border-radius: 8px;
            padding: 8px 10px;
            color: #9a3412;
            font-size: 0.82rem;
        }

        #taskModal .pubbl-panel {
            margin-top: 8px;
            padding: 10px 12px;
            border-radius: 10px;
        }

        @media (max-width: 600px) {
            #taskModal .task-detail-head,
            #taskModal .task-detail-body {
                padding-left: 16px;
                padding-right: 16px;
            }
            #taskModal .task-detail-meta {
                grid-template-columns: 1fr;
            }
            #taskModal .detail-box {
                min-height: 120px;
                max-height: min(50vh, 420px);
                font-size: 0.98rem;
                padding: 14px 16px;
            }
        }

        @keyframes modalIn {
            from { opacity: 0; transform: translateY(12px) scale(0.98); }
            to { opacity: 1; transform: none; }
        }

        .close {
            position: absolute;
            right: 22px;
            top: 18px;
            font-size: 28px;
            cursor: pointer;
            color: var(--muted);
            border: none;
            background: none;
            padding: 4px 8px;
            line-height: 1;
        }

        .close:hover { color: var(--ink); }

        .modal h2 {
            font-family: var(--display);
            font-weight: 400;
            font-size: 2rem;
            margin: 0 0 28px;
            letter-spacing: -0.02em;
        }

        .detail-box {
            background: var(--surface-2);
            padding: 20px;
            border-radius: 12px;
            border: 1px solid var(--line);
            line-height: 1.6;
            white-space: pre-wrap;
            margin-top: 10px;
            color: var(--ink-soft);
        }

        .detail-box a, .comment-box a {
            color: var(--primary);
            font-weight: 600;
        }

        .comment-box {
            background: var(--success-bg);
            padding: 14px 16px;
            border-radius: 10px;
            border: 1px solid #a7f3d0;
            margin-top: 14px;
            font-style: italic;
            color: #065f46;
            white-space: pre-wrap;
        }

        .status-move {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 8px;
            margin-top: 22px;
        }

        .status-move button {
            font-family: var(--font);
            border: 1px solid var(--line);
            background: var(--surface-2);
            color: var(--ink-soft);
            padding: 10px 8px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.75rem;
            transition: 0.15s;
        }

        .status-move button:hover { border-color: var(--primary); color: var(--primary); }
        .status-move button.current {
            background: var(--ink);
            color: #fff;
            border-color: var(--ink);
            cursor: default;
        }

        .actions-bar {
            display: flex;
            gap: 10px;
            margin-top: 18px;
            flex-wrap: wrap;
        }

        .actions-bar button {
            font-family: var(--font);
            border: none;
            padding: 13px 16px;
            border-radius: var(--radius-sm);
            cursor: pointer;
            font-weight: 600;
            font-size: 0.9rem;
            flex: 1;
            min-width: 120px;
        }

        .btn-edit-action { background: #475569; color: #fff; }
        .btn-done { background: var(--success); color: #fff; }
        .btn-annulla-riunione {
            background: #fff7ed;
            color: #c2410c;
            border: 1px solid #fdba74;
        }
        .btn-annulla-riunione:hover {
            background: #ffedd5;
            color: #9a3412;
        }
        .btn-delete { background: var(--danger-bg); color: var(--danger); flex: 0 0 auto !important; }

        .meta-label {
            font-size: 0.7rem;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.06em;
            font-weight: 600;
            margin-bottom: 4px;
        }

        .preferito-scheda {
            background: var(--sollecito-bg);
            border: 1px solid #fed7aa;
            border-radius: 8px;
            padding: 10px 12px;
            font-size: 0.9rem;
            color: #9a3412;
        }

        .preferito-scheda b { color: #c2410c; }

        #toast {
            position: fixed;
            bottom: 28px;
            right: 28px;
            background: var(--ink);
            color: #fff;
            padding: 14px 20px;
            border-radius: 12px;
            font-size: 0.9rem;
            font-weight: 500;
            box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
            opacity: 0;
            transform: translateY(12px);
            pointer-events: none;
            transition: 0.3s;
            z-index: 2000;
            max-width: 320px;
        }

        #toast.show { opacity: 1; transform: none; }

        #opToast {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -46%) scale(0.94);
            padding: 18px 36px;
            border-radius: 16px;
            font-family: var(--font);
            font-size: 1.15rem;
            font-weight: 700;
            letter-spacing: -0.01em;
            color: #fff;
            box-shadow: 0 20px 50px rgba(10, 18, 28, 0.35);
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.28s ease, transform 0.28s ease;
            z-index: 2100;
            text-align: center;
            min-width: 220px;
            border: 1px solid rgba(255, 255, 255, 0.18);
        }

        #opToast .op-toast-label {
            display: block;
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 0.12em;
            text-transform: uppercase;
            opacity: 0.8;
            margin-bottom: 4px;
        }

        #opToast .op-toast-name {
            display: block;
            font-family: var(--display);
            font-size: 1.85rem;
            font-weight: 400;
            letter-spacing: -0.02em;
            line-height: 1.1;
        }

        #opToast.show {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }

        #opToast.op-stefano { background: #1a4f7a; }
        #opToast.op-alby { background: #0f766e; }
        #opToast.op-cossa { background: #b45309; }
        #opToast.op-ale { background: #7c3aed; }
        #opToast.op-elena { background: #be185d; }

        /* Views */
        .view { display: none; }
        .view.active { display: block; animation: fadeIn 0.3s ease; }

        .nav-tabs {
            display: flex;
            gap: 4px;
            background: rgba(255, 255, 255, 0.7);
            border: 1px solid var(--line);
            padding: 4px;
            border-radius: 12px;
        }

        .nav-tab {
            padding: 10px 18px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-family: var(--font);
            font-weight: 600;
            font-size: 0.88rem;
            color: var(--muted);
            background: transparent;
            transition: 0.2s;
        }

        .nav-tab.active {
            background: var(--ink);
            color: #fff;
        }

        .nav-tab:not(.active):hover { color: var(--ink); background: rgba(18, 32, 51, 0.04); }

        .btn-contatti,
        .btn-listini,
        .btn-linkutili {
            display: none;
        }

        #archiviRivestimenti[hidden],
        #archiviMateriali[hidden],
        #archiviNuoviFp[hidden],
        #archiviCampionariSedi[hidden] {
            display: none !important;
        }

        .view-rivestimenti.active,
        .view-materiali.active,
        .view-nuovi-fp.active {
            display: block;
            margin: 0 -8px;
        }

        .view-rivestimenti.active.is-sedi {
            margin: 0;
        }

        .rivestimenti-frame,
        .materiali-frame {
            display: block;
            width: 100%;
            height: calc(100vh - 92px);
            min-height: 560px;
            border: 1px solid var(--line);
            border-radius: 14px;
            background: var(--surface);
            box-shadow: var(--shadow);
        }

        .view-rivestimenti.is-sedi .rivestimenti-frame {
            border: none;
            border-radius: 0;
            background: transparent;
            box-shadow: none;
            height: calc(100vh - 88px);
            min-height: 520px;
        }

        .toolbar-linkutili {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: center;
            margin-bottom: 18px;
        }

        .toolbar-linkutili .search-wrap {
            flex: 1;
            min-width: 200px;
            position: relative;
        }

        .toolbar-linkutili .search-wrap input {
            width: 100%;
            height: 42px;
            padding-left: 40px;
        }

        .linkutili-add-panel {
            display: none;
            margin-bottom: 18px;
            padding: 16px;
            border: 1px solid var(--line);
            border-radius: 14px;
            background: var(--surface);
            box-shadow: var(--shadow);
        }

        .linkutili-add-panel.open { display: block; }

        .linkutili-add-grid {
            display: grid;
            grid-template-columns: 1fr 1.4fr auto;
            gap: 10px;
            align-items: end;
        }

        .linkutili-add-grid label {
            display: block;
            margin-bottom: 4px;
            font-size: 0.72rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--muted);
        }

        .linkutili-add-grid input {
            width: 100%;
            height: 42px;
            border: 1px solid var(--line);
            border-radius: 8px;
            padding: 0 12px;
            font-family: var(--font);
            font-size: 0.9rem;
        }

        .linkutili-add-actions {
            display: flex;
            gap: 8px;
        }

        .linkutili-add-actions button {
            height: 42px;
            padding: 0 14px;
            border-radius: 8px;
            font-family: var(--font);
            font-weight: 700;
            font-size: 0.85rem;
            cursor: pointer;
            border: 1px solid var(--line);
        }

        .linkutili-add-actions .btn-save-linkutile {
            background: var(--ink);
            border-color: var(--ink);
            color: #fff;
        }

        .linkutili-add-actions .btn-cancel-linkutile {
            background: #fff;
            color: var(--ink-soft);
        }

        .linkutili-table {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
            gap: 12px;
            align-items: start;
        }

        .linkutile-section {
            grid-column: 1 / -1;
            margin: 10px 0 2px;
            padding: 4px 2px;
            font-size: 0.72rem;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--muted);
        }

        .linkutile-section:first-child { margin-top: 0; }

        .linkutile-card {
            position: relative;
            aspect-ratio: 1 / 1;
            width: 100%;
            border: none;
            border-radius: 16px;
            padding: 14px 12px 12px;
            cursor: pointer;
            font-family: var(--font);
            text-align: left;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            box-shadow: var(--shadow);
            transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
            overflow: hidden;
            color: #fff;
        }

        .linkutile-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 12px 24px rgba(18, 32, 51, 0.16);
            filter: brightness(1.04);
        }

        .linkutile-card.sito {
            background: linear-gradient(145deg, #2563eb 0%, #1d4ed8 55%, #1e40af 100%);
        }

        .linkutile-card.campionario {
            background: linear-gradient(145deg, #d97706 0%, #a16207 55%, #92400e 100%);
        }

        .linkutile-card.app {
            background: linear-gradient(145deg, #22c55e 0%, #16a34a 55%, #15803d 100%);
        }

        .linkutile-card-top {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 6px;
        }

        .linkutile-card-kind {
            font-size: 0.62rem;
            font-weight: 800;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            opacity: 0.9;
            background: rgba(255, 255, 255, 0.18);
            border-radius: 999px;
            padding: 4px 8px;
        }

        .linkutile-card-actions {
            display: flex;
            gap: 4px;
            opacity: 0;
            transition: opacity 0.15s;
        }

        .linkutile-card:hover .linkutile-card-actions,
        .linkutile-card:focus-within .linkutile-card-actions {
            opacity: 1;
        }

        .linkutile-card-actions button {
            width: 26px;
            height: 26px;
            border: none;
            border-radius: 7px;
            background: rgba(255, 255, 255, 0.22);
            color: #fff;
            font-size: 0.72rem;
            font-weight: 800;
            cursor: pointer;
            line-height: 1;
            padding: 0;
        }

        .linkutile-card-actions button:hover {
            background: rgba(255, 255, 255, 0.38);
        }

        .linkutile-card-body {
            min-height: 0;
            margin-top: auto;
        }

        .linkutile-card-title {
            font-size: 0.92rem;
            font-weight: 800;
            line-height: 1.25;
            letter-spacing: -0.01em;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow: hidden;
            word-break: break-word;
        }

        .linkutile-card-note {
            margin-top: 6px;
            font-size: 0.68rem;
            font-weight: 600;
            opacity: 0.88;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .empty-state-linkutili {
            grid-column: 1 / -1;
            padding: 36px 20px;
            text-align: center;
            color: var(--muted);
            font-size: 0.92rem;
            line-height: 1.5;
            border: 1px dashed var(--line);
            border-radius: 14px;
            background: var(--surface);
        }

        .empty-state-linkutili strong {
            display: block;
            color: var(--ink);
            font-size: 1.05rem;
            margin-bottom: 6px;
        }

        @media (max-width: 700px) {
            .linkutili-add-grid,
            .linkutili-add-grid[style] {
                grid-template-columns: 1fr !important;
            }
            .linkutili-table {
                grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
                gap: 10px;
            }
        }

        .toolbar-listini {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: center;
            margin-bottom: 18px;
        }

        .toolbar-listini .search-wrap {
            flex: 1;
            min-width: 220px;
            position: relative;
        }

        .toolbar-listini .search-wrap input {
            padding-left: 40px;
        }

        .listini-tipo-filters {
            display: inline-flex;
            gap: 6px;
            flex-wrap: wrap;
        }

        .listini-tipo-filters button {
            border: 1px solid var(--line);
            background: #fff;
            color: var(--ink-soft);
            font-family: var(--font);
            font-size: 0.78rem;
            font-weight: 700;
            padding: 8px 12px;
            border-radius: 8px;
            cursor: pointer;
            transition: 0.15s;
        }

        .listini-tipo-filters button:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        .listini-tipo-filters button.active {
            background: var(--ink);
            border-color: var(--ink);
            color: #fff;
        }

        .listini-add-panel {
            display: none;
            margin-bottom: 18px;
            padding: 16px 18px;
            border: 1px solid var(--line);
            border-radius: var(--radius);
            background: var(--surface);
            box-shadow: var(--shadow);
        }

        .listini-add-panel.open {
            display: block;
        }

        .listini-add-panel h3 {
            margin: 0 0 12px;
            font-size: 1rem;
            font-weight: 700;
        }

        .listini-add-grid {
            display: grid;
            grid-template-columns: 1.2fr 1fr 1.6fr auto;
            gap: 10px;
            align-items: end;
        }

        .listini-add-grid label {
            display: block;
            margin-bottom: 4px;
            font-size: 0.72rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--muted);
        }

        .listini-add-grid input,
        .listini-add-grid select {
            width: 100%;
            height: 42px;
            border: 1px solid var(--line);
            border-radius: 8px;
            padding: 0 12px;
            font-family: var(--font);
            font-size: 0.9rem;
            background: #fff;
        }

        .listini-add-actions {
            display: flex;
            gap: 8px;
        }

        .listini-add-actions button {
            height: 42px;
            padding: 0 14px;
            border-radius: 8px;
            font-family: var(--font);
            font-weight: 700;
            font-size: 0.85rem;
            cursor: pointer;
            border: 1px solid var(--line);
        }

        .listini-add-actions .btn-save-listino {
            background: var(--ink);
            border-color: var(--ink);
            color: #fff;
        }

        .listini-add-actions .btn-cancel-listino {
            background: #fff;
            color: var(--ink-soft);
        }

        .listini-table {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .listino-row {
            display: grid;
            grid-template-columns: minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(160px, 2fr) auto;
            gap: 12px;
            align-items: center;
            padding: 14px 16px;
            background: var(--surface);
            border: 1px solid var(--line);
            border-radius: var(--radius-sm);
            box-shadow: var(--shadow);
            transition: border-color 0.15s;
        }

        .listino-row:hover {
            border-color: var(--primary);
        }

        .listino-produttore {
            font-weight: 700;
            font-size: 0.95rem;
            color: var(--ink);
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .listino-titolo {
            font-size: 0.88rem;
            color: var(--ink-soft);
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .listino-tipo-chip {
            display: inline-block;
            margin-left: 8px;
            font-size: 0.62rem;
            font-weight: 800;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            padding: 3px 7px;
            border-radius: 5px;
            vertical-align: middle;
        }

        .listino-tipo-chip.listino {
            background: #eff6ff;
            color: #1d4ed8;
        }

        .listino-tipo-chip.catalogo {
            background: #f0fdf4;
            color: #15803d;
        }

        .listino-link-btn {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
            border: none;
            background: transparent;
            padding: 0;
            cursor: pointer;
            font-family: var(--font);
            text-align: left;
            color: var(--primary);
            font-weight: 600;
            font-size: 0.85rem;
        }

        .listino-link-btn:hover {
            text-decoration: underline;
        }

        .listino-link-btn:disabled {
            opacity: 0.55;
            cursor: not-allowed;
            text-decoration: none;
            color: var(--text-muted, #64748b);
        }

        .listino-link-btn .listino-url {
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .listino-link-btn .listino-ico {
            flex-shrink: 0;
            width: 26px;
            height: 26px;
            border-radius: 6px;
            background: #fef2f2;
            color: #b91c1c;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 0.58rem;
            font-weight: 800;
        }

        .listino-link-btn.local .listino-ico {
            background: #eff6ff;
            color: var(--primary);
        }

        .listino-row-actions {
            display: flex;
            gap: 6px;
            justify-content: flex-end;
        }

        .listino-row-actions button {
            border: 1px solid var(--line);
            background: #fff;
            color: var(--ink-soft);
            font-family: var(--font);
            font-size: 0.75rem;
            font-weight: 700;
            padding: 7px 10px;
            border-radius: 7px;
            cursor: pointer;
        }

        .listino-row-actions button:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        .listino-row-actions .btn-del-listino:hover {
            border-color: var(--danger);
            color: var(--danger);
        }

        .empty-state-listini {
            padding: 48px 24px;
            text-align: center;
            color: var(--muted);
            background: var(--surface);
            border: 1px dashed var(--line);
            border-radius: var(--radius);
            font-size: 0.95rem;
            line-height: 1.5;
        }

        .empty-state-listini strong {
            display: block;
            color: var(--ink);
            font-size: 1.05rem;
            margin-bottom: 6px;
        }

        .listini-dropzone {
            position: relative;
            margin-bottom: 18px;
            padding: 28px 20px;
            border: 2px dashed var(--line);
            border-radius: var(--radius);
            background: linear-gradient(180deg, #fbfcfe 0%, var(--surface-2) 100%);
            text-align: center;
            cursor: pointer;
            transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
            user-select: none;
        }

        .listini-dropzone:hover,
        .listini-dropzone.dragover {
            border-color: var(--primary);
            background: rgba(26, 79, 122, 0.06);
            box-shadow: inset 0 0 0 1px rgba(26, 79, 122, 0.12);
        }

        .listini-dropzone.uploading {
            pointer-events: none;
            opacity: 0.85;
        }

        .listini-dropzone-title {
            margin: 0 0 6px;
            font-size: 1rem;
            font-weight: 700;
            color: var(--ink);
        }

        .listini-dropzone-sub {
            margin: 0;
            font-size: 0.85rem;
            color: var(--muted);
            line-height: 1.45;
        }

        .listini-dropzone-status {
            display: none;
            margin: 12px auto 0;
            max-width: 420px;
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--primary);
        }

        .listini-dropzone.uploading .listini-dropzone-status,
        .listini-dropzone.has-status .listini-dropzone-status {
            display: block;
        }

        .listini-drop-progress {
            display: none;
            margin: 14px auto 0;
            width: min(320px, 100%);
            height: 6px;
            border-radius: 999px;
            background: #e2e8f0;
            overflow: hidden;
        }

        .listini-dropzone.uploading .listini-drop-progress {
            display: block;
        }

        .listini-drop-progress > span {
            display: block;
            height: 100%;
            width: 0%;
            background: var(--primary);
            transition: width 0.15s ease;
        }

        .listino-file-hint {
            display: none;
            margin-top: 10px;
            padding: 8px 12px;
            border-radius: 8px;
            background: #eff6ff;
            color: var(--primary);
            font-size: 0.8rem;
            font-weight: 600;
        }

        .listino-file-hint.show {
            display: block;
        }

        .listino-composer {
            display: none;
            margin-bottom: 18px;
            padding: 16px;
            border: 1px solid var(--line);
            border-radius: var(--radius);
            background: var(--surface);
            box-shadow: var(--shadow);
        }

        .listino-composer.open {
            display: block;
        }

        .listino-composer .listini-dropzone {
            margin-bottom: 14px;
        }

        .listino-composer .listini-add-panel {
            display: block;
            margin-bottom: 0;
            padding: 0;
            border: none;
            box-shadow: none;
            background: transparent;
        }

        .listino-composer .search-dropdown {
            z-index: 40;
        }

        .listino-composer-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 14px;
        }

        .listino-composer-head h3 {
            margin: 0;
            font-size: 1.05rem;
            font-weight: 700;
            color: var(--ink);
        }

        .listino-composer-head .btn-close-composer {
            border: 1px solid var(--line);
            background: #fff;
            color: var(--ink-soft);
            font-family: var(--font);
            font-size: 0.8rem;
            font-weight: 700;
            padding: 8px 12px;
            border-radius: 8px;
            cursor: pointer;
        }

        .listino-composer-head .btn-close-composer:hover {
            border-color: var(--danger);
            color: var(--danger);
        }

        .listini-drop-modes {
            display: inline-flex;
            gap: 6px;
            margin: 0 0 12px;
            flex-wrap: wrap;
            justify-content: center;
        }

        .listini-drop-modes button {
            border: 1px solid var(--line);
            background: #fff;
            color: var(--ink-soft);
            font-family: var(--font);
            font-size: 0.78rem;
            font-weight: 700;
            padding: 8px 12px;
            border-radius: 8px;
            cursor: pointer;
        }

        .listini-drop-modes button.active {
            background: var(--ink);
            border-color: var(--ink);
            color: #fff;
        }

        .listini-dropzone.mode-locale {
            cursor: default;
        }

        .listini-dropzone .listini-drop-actions {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            justify-content: center;
            margin-top: 14px;
        }

        .listini-dropzone .listini-drop-actions button {
            border: 1px solid var(--line);
            background: #fff;
            color: var(--ink);
            font-family: var(--font);
            font-size: 0.82rem;
            font-weight: 700;
            padding: 10px 14px;
            border-radius: 8px;
            cursor: pointer;
        }

        .listini-dropzone .listini-drop-actions button:hover {
            border-color: var(--primary);
            color: var(--primary);
        }

        .listino-tipo-chip.locale {
            background: #eff6ff;
            color: #1d4ed8;
        }

        @media (max-width: 900px) {
            .listini-add-grid {
                grid-template-columns: 1fr 1fr;
            }
            .listini-add-actions {
                grid-column: span 2;
            }
            .listino-row {
                grid-template-columns: 1fr;
                gap: 8px;
            }
            .listino-row-actions {
                justify-content: flex-start;
            }
        }

        @media (max-width: 600px) {
            .listini-add-grid {
                grid-template-columns: 1fr;
            }
            .listini-add-actions {
                grid-column: span 1;
                width: 100%;
            }
            .listini-add-actions button {
                flex: 1;
            }
        }

        .btn-secondary {
            background: var(--surface);
            color: var(--ink);
            border: 1px solid var(--line);
            padding: 12px 16px;
            border-radius: var(--radius-sm);
            cursor: pointer;
            font-family: var(--font);
            font-weight: 600;
            font-size: 0.88rem;
            transition: 0.15s;
            box-shadow: var(--shadow);
        }

        .btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

        .btn-secondary.amber {
            background: #fff7ed;
            border-color: #fed7aa;
            color: #9a3412;
        }

        .toolbar-contatti {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: center;
            margin-bottom: 18px;
        }

        .toolbar-contatti .search-wrap {
            flex: 1;
            min-width: 220px;
            position: relative;
        }

        .toolbar-contatti .search-wrap input {
            padding-left: 40px;
        }

        .toolbar-interni {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            align-items: center;
            margin-bottom: 16px;
        }

        .toolbar-interni .search-wrap {
            flex: 1;
            min-width: 220px;
            position: relative;
        }

        .toolbar-interni .search-wrap input {
            padding-left: 40px;
        }

        .interni-columns {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 10px;
        }

        .interni-col {
            display: flex;
            flex-direction: column;
            gap: 4px;
            min-width: 0;
        }

        .interno-card {
            display: flex;
            align-items: center;
            gap: 8px;
            min-height: 40px;
            padding: 6px 10px;
            border: 1px solid var(--line);
            border-radius: 10px;
            background: var(--surface);
            position: relative;
        }

        .interni-col .interno-card:nth-child(even) {
            background: var(--surface-2);
        }

        .interno-card.highlighted {
            background: #fff7ed !important;
            border-color: #fdba74;
            box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.25);
        }

        .interno-ext {
            flex-shrink: 0;
            min-width: 36px;
            text-align: center;
            font-size: 0.82rem;
            font-weight: 800;
            color: #fff;
            background: var(--primary);
            border-radius: 7px;
            padding: 3px 6px;
        }

        .interno-info {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            font-size: 0.88rem;
            color: var(--ink);
        }

        .interno-surname {
            font-weight: 750;
            text-transform: uppercase;
            letter-spacing: 0.01em;
        }

        .interno-actions {
            display: none;
            gap: 3px;
            flex-shrink: 0;
        }

        .interno-card:hover .interno-actions {
            display: flex;
        }

        .interno-act {
            width: 26px;
            height: 26px;
            border-radius: 7px;
            border: 1px solid var(--line);
            background: #fff;
            color: var(--muted);
            cursor: pointer;
            font-size: 0.85rem;
            line-height: 1;
            padding: 0;
        }

        .interno-act.fav.on,
        .interno-act.fav:hover {
            color: #b45309;
            border-color: #fde68a;
            background: #fffbeb;
        }

        .interno-act.edit:hover {
            color: var(--primary);
            border-color: #b7c7d8;
        }

        .interno-act.del:hover {
            color: var(--danger);
            border-color: #fecaca;
            background: var(--danger-bg);
        }

        .interno-modal {
            max-width: 420px;
        }

        @media (max-width: 980px) {
            .interni-columns {
                grid-template-columns: 1fr 1fr;
            }
        }

        @media (max-width: 640px) {
            .interni-columns {
                grid-template-columns: 1fr;
            }
            .interno-actions {
                display: flex;
            }
        }

        @media print {
            .topbar,
            .toolbar-interni,
            .interno-actions,
            .btn-chiudi-strumento,
            .archivi-menu {
                display: none !important;
            }
            .interni-columns {
                gap: 4px;
            }
            .interno-card {
                break-inside: avoid;
                box-shadow: none;
            }
            .interno-card.highlighted {
                background: #fff7ed !important;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }
        }

        .search-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--muted);
            pointer-events: none;
            width: 18px;
            height: 18px;
        }

        .stat-pill {
            font-size: 0.75rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: var(--muted);
            background: rgba(255,255,255,0.8);
            border: 1px solid var(--line);
            padding: 10px 14px;
            border-radius: 999px;
        }

        .stat-pill b { color: var(--ink); }

        .suppliers-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 16px;
        }

        .supplier-card {
            background: var(--surface);
            border: 1px solid var(--line);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            transition: transform 0.15s, box-shadow 0.15s;
        }

        .supplier-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 12px 28px rgba(18, 32, 51, 0.1);
        }

        .supplier-card-head {
            padding: 16px 18px;
            border-bottom: 1px solid var(--line);
            background: var(--surface-2);
            display: flex;
            justify-content: space-between;
            gap: 12px;
            align-items: flex-start;
        }

        .supplier-card-head h3 {
            margin: 0;
            font-size: 1.05rem;
            font-weight: 700;
            letter-spacing: -0.01em;
            line-height: 1.25;
        }

        .supplier-sku {
            display: inline-block;
            margin-top: 6px;
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--ink-soft);
            background: #fff;
            border: 1px solid var(--line);
            padding: 3px 8px;
            border-radius: 6px;
        }

        .supplier-cat-badge {
            display: inline-block;
            margin: 6px 6px 0 0;
            padding: 3px 8px;
            border-radius: 6px;
            font-size: 0.68rem;
            font-weight: 800;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: #fff;
            vertical-align: middle;
        }

        .supplier-cat-badge.fornitore { background: var(--primary); }
        .supplier-cat-badge.cliente { background: #0f766e; }
        .supplier-cat-badge.tessuti {
            background: #a16207;
        }

        .supplier-card.cliente {
            border-left: 4px solid #0f766e;
        }

        .supplier-card.is-tessuti {
            border-left: 4px solid #a16207;
        }

        #supplierModal .tessuti-flag-label {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin: 0;
            padding: 10px 12px;
            border: 1.5px solid var(--line);
            border-radius: 10px;
            background: #fff;
            cursor: pointer;
            font-size: 0.88rem;
            font-weight: 700;
            color: var(--ink-soft);
            text-transform: none;
            letter-spacing: 0;
        }

        #supplierModal .tessuti-flag-label:has(input:checked) {
            border-color: #a16207;
            background: #fffbeb;
            color: #92400e;
        }

        #supplierModal .tessuti-flag-label input {
            width: 16px;
            height: 16px;
            accent-color: #a16207;
        }

        #supplierModal .categoria-checks {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }

        #supplierModal .categoria-checks label {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 10px 14px;
            border: 1px solid var(--line);
            border-radius: 8px;
            background: #fff;
            cursor: pointer;
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--ink-soft);
        }

        #supplierModal .categoria-checks label:has(input:checked) {
            border-color: var(--primary);
            background: #eff6ff;
            color: var(--primary);
        }

        #supplierModal .categoria-checks label.cat-cliente:has(input:checked) {
            border-color: #0f766e;
            background: #ecfdf5;
            color: #0f766e;
        }

        .supplier-badges {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-top: 10px;
        }

        .tipo-badge {
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            padding: 4px 8px;
            border-radius: 6px;
            color: #fff;
        }

        .tipo-badge.diotti { background: #0f766e; }
        .tipo-badge.marchio { background: #7c3aed; }
        .tipo-badge.noname { background: #2563eb; }
        .tipo-badge.altro { background: #64748b; }

        .tipologia-checks {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }

        .tipologia-checks label {
            display: inline-flex !important;
            align-items: center;
            gap: 8px;
            margin: 0 !important;
            padding: 10px 12px;
            border: 1px solid var(--line);
            border-radius: 8px;
            background: var(--surface-2);
            font-size: 0.82rem !important;
            font-weight: 600 !important;
            cursor: pointer;
            text-transform: none !important;
            letter-spacing: 0 !important;
            color: var(--ink) !important;
        }

        .tipologia-checks label:has(input:checked) {
            border-color: var(--primary);
            background: #e8f1f8;
        }

        .supplier-card-head a {
            display: block;
            margin-top: 4px;
            font-size: 0.78rem;
            color: var(--primary);
            text-decoration: none;
            word-break: break-all;
        }

        .supplier-card-head a:hover { text-decoration: underline; }

        .supplier-actions {
            display: flex;
            gap: 4px;
            flex-shrink: 0;
        }

        .icon-btn {
            border: none;
            background: transparent;
            color: var(--muted);
            width: 32px;
            height: 32px;
            border-radius: 8px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .icon-btn:hover { background: #fff; color: var(--primary); }
        .icon-btn.danger:hover { color: var(--danger); background: var(--danger-bg); }

        .supplier-card-body {
            padding: 16px 18px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            flex: 1;
        }

        .supplier-block-label {
            display: block;
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--muted);
            margin-bottom: 6px;
        }

        .supplier-area {
            font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
            font-size: 0.78rem;
            color: var(--ink-soft);
            background: var(--surface-2);
            border: 1px solid var(--line);
            border-radius: 8px;
            padding: 10px;
            white-space: pre-wrap;
            word-break: break-word;
            line-height: 1.45;
        }

        .contact-chip {
            padding: 10px 12px;
            border-radius: 8px;
            border: 1px solid var(--line);
            background: var(--surface-2);
            font-size: 0.8rem;
            margin-bottom: 8px;
            position: relative;
        }

        .contact-chip.preferito {
            border-color: #fed7aa;
            background: var(--sollecito-bg);
        }

        .contact-chip .nome { font-weight: 700; color: var(--ink); }
        .contact-chip .ruolo { font-weight: 400; color: var(--muted); }
        .contact-chip .email { color: var(--primary); margin-top: 2px; word-break: break-all; }
        .contact-chip .email-row {
            display: flex;
            align-items: flex-start;
            gap: 6px;
            margin-top: 2px;
        }
        .contact-chip .email-row .email {
            margin-top: 0;
            flex: 1;
            min-width: 0;
            line-height: 1.35;
        }
        .contact-chip .btn-copy-email {
            flex-shrink: 0;
            width: 28px;
            height: 28px;
            border: 1px solid var(--line);
            border-radius: 7px;
            background: #fff;
            color: var(--ink-soft);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            padding: 0;
        }
        .contact-chip .btn-copy-email:hover {
            border-color: var(--primary);
            color: var(--primary);
            background: #f8fafc;
        }
        .contact-chip .btn-copy-email svg {
            width: 14px;
            height: 14px;
            display: block;
        }
        .contact-chip .tel { color: var(--ink-soft); font-weight: 600; margin-top: 2px; }
        .contact-chip .star {
            position: absolute;
            top: 8px;
            right: 10px;
            color: #d97706;
            font-size: 0.85rem;
        }

        .supplier-notes {
            font-size: 0.78rem;
            color: var(--muted);
            font-style: italic;
            line-height: 1.45;
            white-space: pre-wrap;
        }

        .contact-form-row {
            padding: 14px;
            border-radius: 10px;
            border: 1px solid var(--line);
            background: var(--surface-2);
            margin-bottom: 10px;
        }

        .contact-form-row .row-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-bottom: 8px;
        }

        .contact-form-row .row-foot {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;
        }

        .contact-form-row label.pref {
            font-size: 0.72rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--muted);
            display: flex;
            align-items: center;
            gap: 6px;
            cursor: pointer;
        }

        .btn-link-danger {
            border: none;
            background: none;
            color: var(--danger);
            font-size: 0.72rem;
            font-weight: 700;
            text-transform: uppercase;
            cursor: pointer;
            font-family: var(--font);
        }

        .btn-ghost {
            border: 1px solid var(--line);
            background: var(--surface);
            color: var(--ink-soft);
            padding: 8px 12px;
            border-radius: 8px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            font-family: var(--font);
        }

        .btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

        .modal-actions-foot {
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            margin-top: 24px;
            padding-top: 18px;
            border-top: 1px solid var(--line);
        }

        .btn-cancel {
            background: var(--surface);
            border: 1px solid var(--line);
            color: var(--ink-soft);
            padding: 12px 18px;
            border-radius: var(--radius-sm);
            font-weight: 600;
            cursor: pointer;
            font-family: var(--font);
        }

        .btn-save-supplier {
            background: var(--primary);
            border: none;
            color: #fff;
            padding: 12px 18px;
            border-radius: var(--radius-sm);
            font-weight: 600;
            cursor: pointer;
            font-family: var(--font);
        }

        .btn-save-supplier:hover { background: var(--primary-hover); }

        .search-combo {
            position: relative;
        }

        .search-combo input {
            width: 100%;
        }

        .search-dropdown {
            display: none;
            position: absolute;
            left: 0;
            right: 0;
            top: calc(100% + 4px);
            max-height: 240px;
            overflow-y: auto;
            background: #fff;
            border: 1px solid var(--line);
            border-radius: 10px;
            box-shadow: 0 12px 28px rgba(18, 32, 51, 0.14);
            z-index: 20;
        }

        .search-dropdown.show { display: block; }

        .search-dropdown button {
            display: block;
            width: 100%;
            text-align: left;
            border: none;
            background: transparent;
            padding: 10px 12px;
            font-family: var(--font);
            font-size: 0.92rem;
            color: var(--ink);
            cursor: pointer;
        }

        .search-dropdown button:hover,
        .search-dropdown button.active {
            background: var(--surface-2);
            color: var(--primary);
        }

        .search-dropdown .search-empty {
            padding: 12px;
            color: var(--muted);
            font-size: 0.85rem;
        }

        .search-dropdown button.richiedente-opt {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

        .search-dropdown button.richiedente-opt .opt-hint {
            font-size: 0.68rem;
            font-weight: 600;
            color: var(--muted);
            opacity: 0;
            transition: opacity 0.12s;
            white-space: nowrap;
        }

        .search-dropdown button.richiedente-opt:hover .opt-hint,
        .search-dropdown button.richiedente-opt.active .opt-hint {
            opacity: 1;
        }

        .search-dropdown button.azienda-opt-interna {
            font-weight: 700;
            color: var(--primary);
            border-bottom: 1px solid var(--line);
            background: #eff6ff;
        }

        .search-dropdown button.azienda-opt-interna:hover,
        .search-dropdown button.azienda-opt-interna.active {
            background: #dbeafe;
            color: var(--primary-hover);
        }

        .richiedente-ctx {
            position: fixed;
            z-index: 5000;
            min-width: 160px;
            background: #fff;
            border: 1px solid var(--line);
            border-radius: 10px;
            box-shadow: 0 12px 28px rgba(18, 32, 51, 0.16);
            padding: 6px;
            display: none;
        }

        .richiedente-ctx.show { display: block; }

        .richiedente-ctx button {
            display: block;
            width: 100%;
            text-align: left;
            border: none;
            background: transparent;
            padding: 10px 12px;
            border-radius: 8px;
            font-family: var(--font);
            font-size: 0.88rem;
            color: #b91c1c;
            font-weight: 700;
            cursor: pointer;
        }

        .richiedente-ctx button:hover {
            background: #fef2f2;
        }

        .empty-state-contatti strong {
            display: block;
            color: var(--ink);
            font-size: 1.05rem;
            margin-bottom: 6px;
        }

        @media (max-width: 1100px) {
            .kanban {
                grid-template-columns: repeat(4, minmax(260px, 1fr));
            }
        }

        @media (max-width: 900px) {
            .filter-bar { grid-template-columns: 1fr 1fr; }
            .grid-form { grid-template-columns: 1fr 1fr; }
            .full-width { grid-column: span 2; }
            .status-move { grid-template-columns: 1fr 1fr; }
            .contact-form-row .row-grid { grid-template-columns: 1fr; }
            .btn-open-form {
                width: auto;
                min-width: 0;
                padding: 0 14px;
            }
            #addModal .add-modal-head,
            #addModal .add-modal-body { padding-left: 14px; padding-right: 14px; }
            #addModal .grid-form > div[style*="span 2"] { grid-column: span 2 !important; }
        }

        @media (max-width: 600px) {
            body { padding: 14px 10px 40px; }
            .filter-bar, .grid-form { grid-template-columns: 1fr; }
            .full-width { grid-column: span 1; }
            .modal-content-large, .modal-content { padding: 28px 18px; }
            .kanban { grid-template-columns: minmax(280px, 1fr); }
            #addModal .grid-form > div[style*="span 2"] { grid-column: span 1 !important; }
            #addModal #tipoContainer { grid-column: span 1; }
            #addModal #productInfoContainer,
            #addModal #pubblicazioneContainer { grid-template-columns: 1fr; }
            #addModal #pubblicazioneContainer .pubbl-hint { grid-column: span 1; }
            #addModal .add-modal-foot { flex-direction: column-reverse; }
            #addModal .btn-cancel-add { width: 100%; }
        }

        .backup-panel { max-width: 980px; }
        .backup-hero {
            margin-bottom: 16px;
            padding: 16px 18px;
            border: 1px solid var(--line);
            border-radius: 14px;
            background: var(--surface);
            box-shadow: var(--shadow);
        }
        .backup-kicker {
            margin: 0 0 4px;
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--muted);
        }
        .backup-hero h2 {
            margin: 0 0 6px;
            font-family: var(--display);
            font-size: clamp(1.6rem, 2.5vw, 2.1rem);
            font-weight: 400;
        }
        .backup-hero p {
            margin: 0;
            color: var(--ink-soft);
            max-width: 46rem;
            line-height: 1.45;
        }
        .backup-toolbar {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
            margin-bottom: 12px;
        }
        .backup-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 8px;
            margin-bottom: 16px;
        }
        .backup-item {
            display: flex;
            gap: 10px;
            align-items: flex-start;
            padding: 12px 14px;
            border: 1px solid var(--line);
            border-radius: 12px;
            background: var(--surface);
            cursor: pointer;
        }
        .backup-item:hover { border-color: #b7c7d8; }
        .backup-item input { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; }
        .backup-item strong { display: block; font-size: 0.92rem; }
        .backup-item small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.78rem; line-height: 1.35; }
        .backup-format {
            margin-bottom: 16px;
            padding: 14px 16px;
            border: 1px solid var(--line);
            border-radius: 14px;
            background: var(--surface);
        }
        .backup-format h3 { margin: 0 0 10px; font-size: 0.95rem; }
        .backup-format-options { display: grid; gap: 8px; }
        .backup-format-card {
            display: flex;
            gap: 10px;
            align-items: flex-start;
            padding: 10px 12px;
            border: 1px solid var(--line);
            border-radius: 12px;
            background: var(--surface-2);
            cursor: pointer;
        }
        .backup-format-card:has(input:checked) {
            border-color: rgba(26, 79, 122, 0.35);
            background: rgba(26, 79, 122, 0.06);
        }
        .backup-format-card input { margin-top: 3px; }
        .backup-format-card strong { display: block; }
        .backup-format-card small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.78rem; }
        .backup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
        .backup-status { margin: 0; color: var(--ink-soft); font-size: 0.88rem; font-weight: 600; }
        .backup-status.error { color: var(--danger); }
        @media (max-width: 800px) {
            .backup-grid { grid-template-columns: 1fr; }
        }
