        :root {
            --brand: #e11d48;
            --brand-hover: #be123c;
            --brand-light: #ffe4e6;
            --bg-page: #f8fafc;
            --border-color: #e2e8f0;
            --text-heading: #0f172a;
            --text-body: #475569;
            --text-muted: #94a3b8;
            --shadow-subtle: 0 4px 6px -1px rgba(0,0,0,0.05);
            --radius-md: 10px;
        }

        * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Plus Jakarta Sans', system-ui, sans-serif; }
        body { background: var(--bg-page); color: var(--text-body); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }

        header {
            background: white; border-bottom: 1px solid var(--border-color); padding: 14px 32px;
            display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100;
        }
        .brand-logo {
            display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 800;
            text-decoration: none; letter-spacing: -0.02em;
        }
        .logo-acad { color: #0f172a; font-weight: 800; }
        .logo-isborn { color: var(--brand); font-weight: 800; }
        .brand-badge { font-size: 11px; background: var(--brand-light); color: var(--brand); padding: 3px 8px; border-radius: 999px; font-weight: 700; margin-left: 2px; }

        .header-nav-tools {
            display: flex; align-items: center; gap: 6px;
        }
        .nav-tool-btn {
            background: transparent; border: 1px solid transparent; padding: 8px 16px; border-radius: 8px;
            font-size: 13.5px; font-weight: 600; color: #334155; cursor: pointer;
            transition: all 0.15s ease; display: inline-flex; align-items: center; gap: 7px;
        }
        .nav-tool-btn svg {
            color: #64748b; transition: color 0.15s ease; flex-shrink: 0;
        }
        .nav-tool-btn:hover {
            color: #0f172a; background: #f8fafc;
        }
        .nav-tool-btn:hover svg {
            color: #0f172a;
        }
        .nav-tool-btn.active {
            background: #f8fafc; color: #0f172a; font-weight: 700;
            border-color: #cbd5e1; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
        }
        .nav-tool-btn.active svg {
            color: var(--brand);
        }
        .header-right-group {
            display: flex; align-items: center; gap: 14px;
        }
        .header-badge-tag {
            font-size: 11px;
            font-weight: 700;
            color: #15803d;
            background: #f0fdf4;
            border: 1px solid #bbf7d0;
            padding: 4px 10px;
            border-radius: 999px;
            letter-spacing: 0.02em;
            white-space: nowrap;
        }

        /* Selettore Lingua Minimale con Bandiera & Dropdown */
        .lang-dropdown-wrapper {
            position: relative; display: inline-block;
        }
        .lang-dropdown-btn {
            display: inline-flex; align-items: center; gap: 6px;
            background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 999px;
            padding: 5px 12px; font-size: 12px; font-weight: 700; color: #334155;
            cursor: pointer; transition: all 0.15s ease; user-select: none;
        }
        .lang-dropdown-btn:hover {
            background: #f1f5f9; border-color: #cbd5e1; color: #0f172a;
        }
        .lang-flag-img {
            width: 19px; height: 13px; object-fit: cover; border-radius: 2px;
            box-shadow: 0 0 0 1px rgba(0,0,0,0.14); display: inline-block; flex-shrink: 0;
        }
        .lang-code {
            font-weight: 800; letter-spacing: 0.04em;
        }
        .chevron-icon {
            color: #64748b; transition: transform 0.2s ease; flex-shrink: 0;
        }
        .lang-dropdown-wrapper.open .chevron-icon {
            transform: rotate(180deg);
        }
        .lang-dropdown-menu {
            position: absolute; top: calc(100% + 8px); right: 0;
            background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px;
            box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.14), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
            padding: 6px; min-width: 175px; max-height: 480px; overflow-y: auto;
            z-index: 1000; flex-direction: column; gap: 2px;
        }
        .lang-option {
            display: flex; align-items: center; gap: 10px; padding: 7px 11px;
            border: none; background: transparent; border-radius: 7px;
            font-size: 13px; font-weight: 600; color: #334155; cursor: pointer;
            text-align: left; width: 100%; transition: all 0.12s ease;
        }
        .lang-option:hover {
            background: #f1f5f9; color: #0f172a;
        }
        .lang-option.active {
            background: #fff1f2; color: var(--brand); font-weight: 700;
        }
        .opt-flag {
            font-size: 15px; line-height: 1; flex-shrink: 0;
        }
        .opt-name {
            flex: 1;
        }
        .opt-code {
            font-size: 11px; font-weight: 700; color: #94a3b8;
        }
        .lang-option.active .opt-code {
            color: var(--brand);
        }

        .tool-panel-container {
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            text-align: center; padding: 44px 20px; flex: 1; width: 100%;
        }
        .tool-hero-box {
            display: flex; flex-direction: column; align-items: center; max-width: 680px; width: 100%;
        }
        .version-select-card {
            background: #ffffff; border: 1px solid var(--border-color); border-radius: 12px;
            padding: 14px 20px; width: 100%; max-width: 540px; margin-bottom: 6px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.04); text-align: left;
        }
        .version-select-label {
            font-size: 12px; font-weight: 700; color: var(--text-heading); display: block; margin-bottom: 8px;
        }
        .version-dropdown {
            width: 100%; padding: 10px 12px; font-size: 13px; font-weight: 600;
            border-radius: 8px; border: 1.5px solid #cbd5e1;
        }
        .tool-status-box {
            margin-top: 24px; padding: 24px; background: white; border: 1px solid var(--border-color);
            border-radius: 14px; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 500px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        }
        .tool-success-box {
            margin-top: 24px; padding: 28px; background: #f0fdf4; border: 1.5px solid #86efac;
            border-radius: 14px; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 500px;
            box-shadow: 0 4px 12px rgba(21, 128, 61, 0.08);
        }
        .spinner-inline-lg {
            width: 32px; height: 32px; border: 3px solid #e2e8f0; border-top-color: var(--brand);
            border-radius: 50%; animation: ringSpin 0.8s linear infinite;
        }

        .btn-add-drawings {
            background: white; border: 1px solid var(--border-color); color: #0f172a;
            padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 700;
            cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
            transition: all 0.15s ease; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
        }
        .btn-add-drawings:hover {
            border-color: var(--brand); color: var(--brand); background: var(--brand-light);
        }
        .btn-add-drawings svg {
            color: var(--brand); stroke: var(--brand);
        }

        main { flex: 1; display: flex; flex-direction: column; }

        #stage-hero {
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            text-align: center; padding: 44px 20px; flex: 1;
        }
        .hero-title { font-size: 40px; font-weight: 800; color: var(--text-heading); margin-bottom: 12px; }
        .hero-subtitle { font-size: 16px; color: var(--text-body); max-width: 600px; line-height: 1.5; margin-bottom: 34px; }

        .drop-box {
            border: 2px dashed #cbd5e1; background: white; border-radius: 16px; padding: 40px 30px;
            width: 100%; max-width: 640px; display: flex; flex-direction: column; align-items: center; cursor: pointer;
            transition: all 0.2s ease;
        }
        .drop-box.dragover, body.dragover-active .drop-box { border-color: var(--brand); background: var(--brand-light); }

        .privacy-trust-badges {
            display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
            gap: 10px; margin-top: 26px; font-size: 13px; font-weight: 500;
        }
        .trust-badge-item {
            display: inline-flex; align-items: center; gap: 7px; color: #475569;
            background: rgba(255, 255, 255, 0.95); padding: 7px 14px; border-radius: 999px;
            border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
            transition: all 0.2s ease;
        }
        .trust-badge-item:hover {
            border-color: #cbd5e1; transform: translateY(-1px);
        }
        .trust-badge-item svg {
            color: #059669; flex-shrink: 0;
        }
        .trust-badge-dot {
            color: #cbd5e1; user-select: none;
        }

        .btn-giant {
            background: var(--brand); color: white; padding: 18px 40px; border-radius: 12px;
            font-size: 18px; font-weight: 700; border: none; cursor: pointer; box-shadow: 0 10px 20px rgba(225, 29, 72, 0.3);
            display: inline-flex; align-items: center; gap: 10px;
        }
        .btn-giant:hover { background: var(--brand-hover); }

        #stage-workspace { display: none; flex: 1; height: calc(100vh - 65px); }
        .workspace-split { display: flex; width: 100%; height: 100%; }

        .workspace-gallery { flex: 1; background: #f1f5f9; padding: 24px; overflow-y: auto; }
        .gallery-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
        .cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }

        .file-card {
            background: white; border-radius: var(--radius-md); border: 1px solid var(--border-color);
            padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-subtle);
        }
        .card-top { display: flex; justify-content: space-between; align-items: center; }
        .card-filename { font-size: 13px; font-weight: 700; color: var(--text-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 210px; }
        .btn-card-del { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; font-size: 14px; }
        .btn-card-del:hover { color: var(--brand); }

        .card-preview-area {
            height: 190px; background: #f8fafc; border: 1px solid var(--border-color); border-radius: 8px; display: flex; flex-direction: column; justify-content: center;
            align-items: center; overflow: hidden; cursor: zoom-in; position: relative; padding: 10px; text-align: center;
            box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
        }
        .preview-img {
            max-width: 96%; max-height: 96%; object-fit: contain; pointer-events: none;
            background: white; border-radius: 4px; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.10); border: 1px solid #e2e8f0;
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }
        .card-preview-area:hover .preview-img {
            transform: scale(1.02);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
        }

        @keyframes ringSpin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }
        .spinner-inline {
            animation: ringSpin 0.8s linear infinite;
        }

        .progress-circle-wrap {
            position: relative; width: 72px; height: 72px; display: flex; justify-content: center; align-items: center;
        }
        .progress-circle-svg {
            transform: rotate(-90deg); width: 72px; height: 72px; overflow: visible;
        }
        .progress-circle-bg {
            fill: none; stroke: #e2e8f0; stroke-width: 5;
        }
        .progress-circle-bar {
            fill: none; stroke: var(--brand); stroke-width: 5; stroke-linecap: round;
            stroke-dasharray: 213.6; stroke-dashoffset: 213.6;
            transition: stroke-dashoffset 0.2s ease-out;
        }
        .progress-circle-inner {
            position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center;
        }
        .progress-circle-text { font-size: 13px; font-weight: 800; color: #0f172a; }
        .progress-circle-label { margin-top: 10px; font-size: 11px; color: #64748b; font-weight: 600; text-align: center; max-width: 240px; }

        .card-controls { display: none; }

        .btn-card-inspect {
            width: 100%; background: #f8fafc; border: 1px solid var(--border-color); color: var(--text-heading);
            padding: 8px 12px; border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer;
            display: flex; align-items: center; justify-content: center; gap: 6px; transition: all 0.15s ease;
        }
        .btn-card-inspect:hover {
            background: #f1f5f9; border-color: #cbd5e1; color: var(--brand);
        }

        .card-footer { display: flex; justify-content: space-between; align-items: center; }
        .tag-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: #e2e8f0; color: var(--text-heading); }
        .tag-badge.ready { background: #dcfce7; color: #15803d; }
        .tag-badge.warn { background: #fef3c7; color: #b45309; }

        .workspace-sidebar {
            width: 360px; background: white; border-left: 1px solid var(--border-color);
            display: flex; flex-direction: column; position: sticky; top: 0; height: calc(100vh - 65px);
            z-index: 20;
        }
        .sidebar-header-action {
            padding: 20px 24px 16px; border-bottom: 1px solid var(--border-color);
            background: white; display: flex; flex-direction: column; gap: 14px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03); flex-shrink: 0;
        }
        .sidebar-title-row {
            display: flex; justify-content: space-between; align-items: center;
        }
        .sidebar-title { font-size: 17px; font-weight: 800; color: var(--text-heading); margin-bottom: 0; }
        .sidebar-files-badge {
            font-size: 11px; font-weight: 700; background: #f1f5f9; color: #475569;
            padding: 3px 8px; border-radius: 6px;
        }
        .btn-action-convert {
            width: 100%; background: linear-gradient(135deg, #e11d48, #be123c); color: white;
            padding: 15px 20px; border-radius: 10px; font-size: 15px; font-weight: 800;
            border: none; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 10px;
            box-shadow: 0 4px 14px rgba(225, 29, 72, 0.35); transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
        }
        .btn-action-convert:hover {
            background: linear-gradient(135deg, #f43f5e, #e11d48);
            box-shadow: 0 6px 20px rgba(225, 29, 72, 0.45); transform: translateY(-1px);
        }
        .btn-action-convert:active {
            transform: translateY(1px); box-shadow: 0 2px 8px rgba(225, 29, 72, 0.3);
        }

        .sidebar-content { padding: 20px 24px; overflow-y: auto; flex: 1; }
        .option-group { margin-bottom: 20px; }
        .option-label { font-size: 12px; font-weight: 700; color: var(--text-heading); margin-bottom: 6px; display: block; }

        .segmented-ctrl { display: flex; background: #f1f5f9; padding: 4px; border-radius: 8px; gap: 4px; }
        .segmented-ctrl button {
            flex: 1; border: none; padding: 10px 8px; font-size: 13px; font-weight: 700; border-radius: 6px;
            background: transparent; cursor: pointer; color: var(--text-body); transition: all 0.15s ease;
        }
        .segmented-ctrl button.active { background: white; color: var(--brand); box-shadow: var(--shadow-subtle); }

        .sidebar-features {
            background: #f8fafc; border: 1px solid var(--border-color); border-radius: 8px;
            padding: 14px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 9px;
        }
        .feature-bullet {
            display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: #475569;
        }
        .feature-bullet svg {
            color: #10b981; flex-shrink: 0;
        }

        .advanced-accordion {
            border: 1px solid var(--border-color); border-radius: 8px; padding: 12px 14px;
            margin-bottom: 20px; background: white;
        }
        .advanced-accordion summary {
            font-size: 12px; font-weight: 700; color: var(--text-heading); cursor: pointer;
            user-select: none; list-style: none; display: flex; justify-content: space-between; align-items: center;
        }
        .advanced-accordion summary::-webkit-details-marker { display: none; }
        .advanced-accordion summary::after {
            content: "▾"; font-size: 13px; color: var(--text-muted); transition: transform 0.2s;
        }
        .advanced-accordion[open] summary::after {
            transform: rotate(180deg);
        }
        .advanced-content {
            margin-top: 14px; display: flex; flex-direction: column; gap: 12px;
        }

        select.form-input { width: 100%; background: white; border: 1px solid var(--border-color); padding: 8px; border-radius: 6px; font-size: 12px; }

        .sidebar-actions { display: none; }

        #stage-success {
            display: none; flex: 1; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 20px;
        }
        .report-box {
            background: white; border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; width: 100%; max-width: 600px;
            margin: 20px 0; text-align: left; max-height: 240px; overflow-y: auto; font-size: 12px;
        }
        .report-item { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f1f5f9; }

        .privacy-action-box {
            margin-top: 24px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 8px;
            width: 100%;
            max-width: 520px;
            padding-top: 20px;
            border-top: 1px solid #e2e8f0;
        }
        .btn-delete-now {
            background: #ffffff;
            color: #dc2626;
            border: 1.5px solid #fca5a5;
            padding: 10px 22px;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 8px;
            transition: all 0.2s ease;
        }
        .btn-delete-now:hover:not(:disabled):not(.deleted) {
            background: #fef2f2;
            border-color: #dc2626;
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(220, 38, 38, 0.12);
        }
        .btn-delete-now.deleted {
            background: #f0fdf4 !important;
            border-color: #86efac !important;
            color: #15803d !important;
            cursor: default !important;
            transform: none !important;
            box-shadow: none !important;
        }
        .btn-delete-now:disabled {
            opacity: 0.7;
            cursor: wait;
        }
        .privacy-auto-hint {
            font-size: 12px;
            color: #94a3b8;
        }

        /* VISUALIZZATORE CAD FULLSCREEN - SFONDO COMPLETAMENTE SCURO OPACO */
        .cad-viewer-modal {
            display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
            background: #0b1120; z-index: 9999;
            flex-direction: column; user-select: none;
        }
        .cad-viewer-toolbar {
            background: #0f172a; border-bottom: 1px solid #1e293b;
            padding: 10px 24px; display: flex; justify-content: space-between; align-items: center; color: white; z-index: 100;
        }
        .viewer-title { font-size: 14px; font-weight: 700; color: #f8fafc; }
        .viewer-controls { display: flex; align-items: center; gap: 8px; }
        
        .mode-toggle-group { display: flex; background: rgba(255,255,255,0.1); border-radius: 8px; padding: 3px; gap: 3px; margin-right: 12px; }
        .btn-mode {
            background: transparent; border: none; color: #cbd5e1; padding: 6px 12px; border-radius: 6px;
            font-size: 12px; font-weight: 700; cursor: pointer; transition: all 0.15s;
        }
        .btn-mode.active { background: white; color: var(--text-heading); }

        .btn-v-tool {
            background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15); color: white;
            padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer;
            display: inline-flex; align-items: center; gap: 4px;
        }
        .btn-v-tool:hover { background: rgba(255,255,255,0.2); }
        .btn-v-tool.active { background: var(--brand); border-color: var(--brand); color: white; }
        .btn-v-close {
            background: var(--brand); border: none; color: white; padding: 6px 14px; border-radius: 6px;
            font-size: 13px; font-weight: 800; cursor: pointer;
        }

        .cad-viewport {
            flex: 1; overflow: hidden; position: relative; cursor: grab; background: #0b1120;
            touch-action: none; -webkit-touch-callout: none; user-select: none;
        }
        .cad-viewport.mode-select { cursor: crosshair !important; }
        .cad-viewport:active { cursor: grabbing; }

        .cad-transform-layer {
            position: absolute; top: 0; left: 0; width: 0; height: 0;
            transform-origin: 0 0; will-change: transform; pointer-events: none;
        }
        .cad-sheet-bg {
            position: absolute; top: 0; left: 0;
            background: #ffffff; border: 1px solid #334155; box-shadow: 0 4px 16px rgba(0,0,0,0.5);
            pointer-events: none;
        }
        .cad-layer-canvas {
            position: absolute; top: 0; left: 0;
            pointer-events: none; user-select: none; -webkit-user-drag: none;
        }
        #cadOverviewCanvas { background: transparent; }
        #cadDetailCanvas { background: transparent; }
        #cadViewerImg {
            background: #fff; border: 1px solid #334155; box-shadow: 0 4px 16px rgba(0,0,0,0.5);
        }

        /* PANNELLO LATERALE LAYER */
        .layers-panel {
            position: absolute; top: 0; right: 0; width: 300px; height: 100%;
            background: #0f172a;
            border-left: 1px solid #1e293b; z-index: 85;
            display: flex; flex-direction: column; color: white;
            transform: translateX(100%); transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: -10px 0 25px rgba(0,0,0,0.4);
        }
        .layers-panel.open { transform: translateX(0); }
        .layers-header {
            padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.1);
            display: flex; justify-content: space-between; align-items: center;
        }
        .layers-title { font-size: 14px; font-weight: 800; color: #f8fafc; display: flex; align-items: center; gap: 6px; }
        .layers-search-box { padding: 10px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); }
        .layers-search-input {
            width: 100%; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
            border-radius: 6px; padding: 7px 10px; font-size: 12px; color: white; outline: none;
        }
        .layers-search-input:focus { border-color: var(--brand); }
        .layers-actions-bar {
            padding: 8px 18px; display: flex; gap: 8px; border-bottom: 1px solid rgba(255,255,255,0.08);
            font-size: 11px;
        }
        .btn-layer-sub {
            background: rgba(255,255,255,0.1); border: none; color: #cbd5e1; padding: 4px 8px;
            border-radius: 4px; cursor: pointer; font-size: 11px; font-weight: 600;
        }
        .btn-layer-sub:hover { background: rgba(255,255,255,0.2); color: white; }
        .layers-list { flex: 1; overflow-y: auto; padding: 8px 12px; }
        .layer-item {
            display: flex; align-items: center; justify-content: space-between;
            padding: 8px 10px; border-radius: 6px; transition: background 0.15s;
            font-size: 12px; user-select: none; cursor: pointer;
        }
        .layer-item:hover { background: rgba(255,255,255,0.06); }
        .layer-item-left { display: flex; align-items: center; gap: 8px; overflow: hidden; }
        .layer-item-name { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; max-width: 180px; }
        .layer-checkbox { cursor: pointer; width: 15px; height: 15px; accent-color: var(--brand); }

        .selection-rect {
            position: absolute; border: 2px dashed #38bdf8; background: rgba(56, 189, 248, 0.22);
            pointer-events: none; z-index: 50; display: none;
        }

        .selection-popup {
            position: absolute; background: white; border-radius: 10px; padding: 12px 16px;
            box-shadow: 0 15px 35px rgba(0,0,0,0.45); display: none; z-index: 60; align-items: center; gap: 10px;
        }
        .popup-select {
            background: #f8fafc; border: 1px solid var(--border-color); padding: 5px 8px;
            border-radius: 6px; font-size: 11px; font-weight: 700; color: var(--text-heading); cursor: pointer;
        }
        .btn-popup-action {
            background: var(--brand); color: white; border: none; padding: 7px 13px; border-radius: 6px;
            font-size: 12px; font-weight: 800; cursor: pointer; display: flex; align-items: center; gap: 4px;
        }
        .btn-popup-cancel {
            background: #f1f5f9; color: var(--text-body); border: none; padding: 7px 11px; border-radius: 6px;
            font-size: 12px; font-weight: 700; cursor: pointer;
        }

        .viewer-hud-hint {
            position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
            background: rgba(15, 23, 42, 0.88); color: #cbd5e1; padding: 6px 16px; border-radius: 999px;
            font-size: 11px; font-weight: 600; pointer-events: none; border: 1px solid rgba(255,255,255,0.1);
        }

        .viewer-loading-overlay {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(11, 17, 32, 0.95); z-index: 90;
            display: none; justify-content: center; align-items: center; flex-direction: column; gap: 12px;
        }
        .viewer-loading-overlay .progress-circle-text,
        #hdPtxt {
            color: #ffffff !important;
            font-size: 16px;
            font-weight: 800;
        }
        .viewer-loading-overlay .progress-circle-bg {
            stroke: rgba(255, 255, 255, 0.18);
        }
        .hd-progress-circle-wrap {
            position: relative; width: 80px; height: 80px; display: flex; justify-content: center; align-items: center;
        }
        .hd-progress-circle-svg {
            transform: rotate(-90deg); width: 80px; height: 80px; overflow: visible;
        }
        .hd-progress-circle-bar {
            fill: none; stroke: var(--brand); stroke-width: 5; stroke-linecap: round;
            stroke-dasharray: 213.6; stroke-dashoffset: 213.6;
            transition: stroke-dashoffset 0.2s ease-out;
        }

        /* MODALE RIEPILOGO FILE AD ALTA DENSITÀ E MASSIMO SPAZIO VISIVO */
        .conversion-modal-overlay {
            position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
            background: rgba(15, 23, 42, 0.65); backdrop-filter: blur(4px);
            z-index: 10000; display: flex; align-items: center; justify-content: center;
            padding: 16px; animation: fadeIn 0.15s ease-out;
        }
        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

        .conversion-modal-card {
            background: #ffffff; border-radius: 14px; width: 100%; max-width: 900px;
            height: 82vh; max-height: 850px; min-height: 480px; display: flex; flex-direction: column;
            box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35); border: 1px solid #e2e8f0;
            overflow: hidden; animation: slideUp 0.18s ease-out;
        }
        @keyframes slideUp { from { transform: translateY(12px) scale(0.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

        .conversion-modal-header {
            padding: 12px 20px; border-bottom: 1px solid #e2e8f0; display: flex;
            justify-content: space-between; align-items: center; background: #ffffff;
            flex-shrink: 0; gap: 14px;
        }
        .conversion-modal-header-left {
            display: flex; align-items: center; gap: 10px; flex-shrink: 0;
        }
        .conversion-modal-title {
            font-size: 17px; font-weight: 800; color: var(--text-heading); margin: 0;
        }
        .conversion-modal-count {
            font-size: 11px; font-weight: 700; background: #f1f5f9; color: #475569;
            padding: 2px 8px; border-radius: 9999px;
        }

        .modal-header-preset {
            display: flex; align-items: center; gap: 8px;
        }
        .preset-label-compact {
            font-size: 12px; font-weight: 700; color: #64748b;
        }
        .preset-pill-group {
            display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 2px; gap: 2px;
            border: 1px solid #e2e8f0;
        }
        .btn-preset-pill {
            background: transparent; border: none; font-size: 12px; font-weight: 600;
            color: #475569; padding: 4px 10px; border-radius: 6px; cursor: pointer;
            transition: all 0.12s ease; display: inline-flex; align-items: center; gap: 4px;
        }
        .btn-preset-pill:hover {
            color: var(--text-heading); background: rgba(255, 255, 255, 0.6);
        }
        .btn-preset-pill.active {
            background: #ffffff; color: var(--brand); font-weight: 700;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
        }

        .conversion-modal-close {
            background: none; border: none; font-size: 18px; color: var(--text-muted);
            cursor: pointer; padding: 4px 8px; border-radius: 6px; line-height: 1;
        }
        .conversion-modal-close:hover {
            color: var(--text-heading); background: #f1f5f9;
        }

        .conversion-modal-body {
            padding: 0; overflow: hidden; display: flex; flex-direction: column; flex: 1; min-height: 0;
        }

        .conversion-table-wrapper {
            border: none; border-radius: 0; overflow-x: auto; background: #ffffff;
            flex: 1; overflow-y: auto;
        }
        .conversion-table {
            width: 100%; border-collapse: collapse; font-size: 13px; text-align: left;
        }
        .conversion-table th {
            background: #f8fafc; padding: 9px 16px; font-weight: 700; color: #475569;
            border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 10;
            font-size: 12px;
        }
        .conversion-table td {
            padding: 8px 16px; border-bottom: 1px solid #f1f5f9; color: var(--text-body);
            vertical-align: middle;
        }
        .conversion-table tr:last-child td { border-bottom: none; }
        .conversion-table tr:hover td { background: #f8fafc; }

        .file-cell-name {
            font-weight: 600; color: var(--text-heading); display: flex; align-items: center; gap: 8px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 440px;
        }
        .file-cell-name span {
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }

        .select-row-dpi {
            font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px;
            border: 1px solid #cbd5e1; background: #ffffff; color: #1e293b; cursor: pointer;
            outline: none; transition: border-color 0.15s;
        }
        .select-row-dpi:focus {
            border-color: var(--brand);
        }

        .row-file-size {
            font-weight: 700; color: var(--text-heading); font-family: monospace; font-size: 12px;
        }

        /* FOOTER ULTRA-COMPATTO */
        .conversion-modal-footer-compact {
            padding: 10px 20px; border-top: 1px solid #e2e8f0; background: #ffffff;
            display: flex; justify-content: space-between; align-items: center; gap: 16px;
            flex-shrink: 0;
        }
        .footer-email-status {
            display: flex; align-items: center; gap: 8px; font-size: 12px;
        }
        .gauge-icon-compact { font-size: 14px; line-height: 1; }
        .gauge-text-compact { display: flex; align-items: center; gap: 5px; color: #475569; }
        .gauge-status-compact { font-weight: 700; color: #0f172a; }
        .gauge-hint-compact { color: #64748b; font-size: 11px; }
        .footer-total-pill {
            font-family: monospace; font-weight: 800; font-size: 12px; background: #f1f5f9;
            color: #0f172a; padding: 3px 8px; border-radius: 6px; border: 1px solid #e2e8f0;
            margin-left: 6px;
        }

        .conversion-modal-actions-compact {
            display: flex; align-items: center; gap: 10px; flex-shrink: 0;
        }
            padding: 16px 24px; border-top: 1px solid #e2e8f0; background: #ffffff;
            display: flex; justify-content: flex-end; align-items: center; gap: 12px;
        }
        .btn-modal-cancel {
            background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 8px;
            padding: 10px 18px; font-size: 13px; font-weight: 700; color: #475569; cursor: pointer;
        }
        .btn-modal-cancel:hover { background: #e2e8f0; color: #0f172a; }
        
        .btn-modal-confirm {
            background: var(--brand); color: #ffffff; border: none; border-radius: 8px;
            padding: 10px 24px; font-size: 14px; font-weight: 700; cursor: pointer;
            box-shadow: 0 4px 12px rgba(225, 29, 72, 0.25); display: inline-flex; align-items: center; gap: 6px;
            transition: all 0.15s ease;
        }
        .btn-modal-confirm:hover {
            background: var(--brand-hover); transform: translateY(-1px);
        }
        .btn-modal-confirm:disabled {
            opacity: 0.6; cursor: not-allowed; transform: none;
        }

        @media (max-width: 900px) {
            #stage-workspace { height: auto; }
            .workspace-split { flex-direction: column; }
            .workspace-sidebar { width: 100%; height: auto; position: static; }
            .sidebar-header-action {
                position: fixed; bottom: 0; left: 0; right: 0; z-index: 1000;
                box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.16); border-top: 1px solid var(--border-color);
                border-bottom: none; padding: 12px 18px;
            }
            .sidebar-title-row { display: none; }
            .workspace-gallery { padding-bottom: 95px; }
        }

        /* ==============================================================
           FREEMIUM, PRICING & ADS (MODELLO ILOVEPDF)
           ============================================================== */
        .btn-header-pricing {
            display: inline-flex; align-items: center; gap: 6px;
            background: #fff1f2; border: 1px solid #fecdd3; border-radius: 999px;
            padding: 5px 12px; font-size: 12.5px; font-weight: 700; color: #e11d48;
            cursor: pointer; transition: all 0.15s ease; user-select: none;
        }
        .btn-header-pricing:hover {
            background: #ffe4e6; border-color: #fda4af; transform: translateY(-1px);
        }
        .badge-pro-glow {
            background: #e11d48; color: #ffffff; font-size: 10px; font-weight: 800;
            padding: 1px 5px; border-radius: 4px; letter-spacing: 0.05em;
        }
        .btn-header-login {
            display: inline-flex; align-items: center; gap: 5px;
            background: transparent; border: 1px solid #e2e8f0; border-radius: 999px;
            padding: 5px 12px; font-size: 12px; font-weight: 600; color: #475569;
            cursor: pointer; transition: all 0.15s ease;
        }
        .btn-header-login:hover {
            background: #f8fafc; border-color: #cbd5e1; color: #0f172a;
        }

        /* SPONSOR & AD SLOTS (FREEMIUM) */
        .ad-banner-slot {
            max-width: 728px; width: 100%; margin: 28px auto 0 auto;
            min-height: 85px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px;
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            position: relative; overflow: hidden; padding: 12px;
        }
        .ad-sidebar-slot {
            max-width: 100%; margin-top: 20px; min-height: 120px;
        }
        .ad-tag {
            position: absolute; top: 4px; right: 8px; font-size: 9px; font-weight: 800;
            color: #94a3b8; letter-spacing: 0.06em;
        }
        .ad-content-placeholder {
            font-size: 12px; font-weight: 600; color: #94a3b8; text-align: center;
        }
        body.tier-pro .ad-banner-slot,
        .tier-premium .ad-banner-slot {
            display: none !important;
        }

        /* MODALE PRICING */
        .pricing-modal-card {
            background: #ffffff; border-radius: 18px; width: 100%; max-width: 900px;
            max-height: 90vh; overflow-y: auto; padding: 32px; box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
            position: relative; animation: modalSlideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
        }
        .pricing-header-center {
            text-align: center; margin-bottom: 28px;
        }
        .pricing-modal-title {
            font-size: 26px; font-weight: 800; color: #0f172a; margin-bottom: 8px;
        }
        .pricing-modal-sub {
            font-size: 14px; color: #64748b; max-width: 580px; margin: 0 auto;
        }
        .pricing-grid {
            display: grid; grid-template-columns: 1fr 1.15fr; gap: 20px; align-items: stretch;
        }
        .pricing-col {
            border: 1px solid #e2e8f0; border-radius: 14px; padding: 24px; display: flex;
            flex-direction: column; position: relative; background: #ffffff;
        }
        .pricing-col.pro-featured {
            border: 2px solid #e11d48; box-shadow: 0 12px 30px -10px rgba(225, 29, 72, 0.18);
            background: linear-gradient(180deg, #fffbfb 0%, #ffffff 100%);
        }
        .pricing-badge-popular {
            position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
            background: #e11d48; color: #ffffff; font-size: 11px; font-weight: 800;
            padding: 3px 12px; border-radius: 999px; letter-spacing: 0.04em;
        }
        .plan-name-row {
            display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
        }
        .plan-name { font-size: 20px; font-weight: 800; color: #0f172a; }
        .plan-badge-curr {
            background: #f1f5f9; color: #475569; font-size: 11px; font-weight: 700;
            padding: 2px 8px; border-radius: 6px;
        }
        .plan-price-row {
            margin-bottom: 18px;
        }
        .price-big { font-size: 34px; font-weight: 800; color: #0f172a; }
        .price-period { font-size: 13px; color: #64748b; font-weight: 500; }
        .plan-features-list {
            list-style: none; padding: 0; margin: 0 0 24px 0; display: flex; flex-direction: column; gap: 10px; flex: 1;
        }
        .plan-features-list li {
            display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: #334155; line-height: 1.4;
        }
        .plan-features-list li svg { flex-shrink: 0; margin-top: 2px; }
        .plan-btn-curr {
            background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; border-radius: 8px;
            padding: 11px; font-size: 13px; font-weight: 700; text-align: center; cursor: default;
        }
        .plan-btn-pro {
            background: #e11d48; color: #ffffff; border: none; border-radius: 8px;
            padding: 12px; font-size: 14px; font-weight: 800; text-align: center; cursor: pointer;
            box-shadow: 0 6px 16px rgba(225, 29, 72, 0.28); transition: all 0.15s ease;
        }
        .plan-btn-pro:hover {
            background: #be123c; transform: translateY(-1px);
        }

        /* MODALE LOGIN */
        .login-modal-card {
            background: #ffffff; border-radius: 16px; width: 100%; max-width: 420px;
            padding: 28px; box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
            position: relative; animation: modalSlideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
        }
        .login-tabs {
            display: flex; background: #f1f5f9; border-radius: 8px; padding: 3px; margin: 18px 0;
        }
        .login-tab-btn {
            flex: 1; border: none; background: transparent; padding: 8px; font-size: 13px;
            font-weight: 700; color: #64748b; border-radius: 6px; cursor: pointer; transition: all 0.15s ease;
        }
        .login-tab-btn.active {
            background: #ffffff; color: #0f172a; box-shadow: 0 2px 4px rgba(0,0,0,0.06);
        }
        .login-field {
            margin-bottom: 14px;
        }
        .login-field label {
            display: block; font-size: 12px; font-weight: 700; color: #334155; margin-bottom: 5px;
        }
        .login-field input {
            width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px;
            font-size: 13px; font-family: inherit; outline: none; transition: border-color 0.15s ease;
        }
        .login-field input:focus {
            border-color: #e11d48; box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.12);
        }
        .login-btn-submit {
            width: 100%; background: #0f172a; color: #ffffff; border: none; border-radius: 8px;
            padding: 12px; font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.15s ease; margin-top: 6px;
        }
        .login-btn-submit:hover { background: #1e293b; }
        .login-divider {
            text-align: center; margin: 16px 0; position: relative; font-size: 12px; color: #94a3b8;
        }
        .login-divider::before, .login-divider::after {
            content: ''; position: absolute; top: 50%; width: 30%; height: 1px; background: #e2e8f0;
        }
        .login-divider::before { left: 0; }
        .login-divider::after { right: 0; }
        .login-btn-google {
            width: 100%; background: #ffffff; color: #334155; border: 1px solid #cbd5e1; border-radius: 8px;
            padding: 10px; font-size: 13px; font-weight: 700; cursor: pointer; display: flex;
            align-items: center; justify-content: center; gap: 8px; transition: all 0.15s ease;
        }
        .login-btn-google:hover { background: #f8fafc; border-color: #94a3b8; }
