/**
 * X-W CF7 Utility - Document Scanner & Quality Inspector Styles
 * Multi-Face (Fronte/Retro), Document Type Selection (CI, Patente, Passaporto, Foglio A4) & Assisted Cropper
 * Designed for Contact Form 7 integration
 */

/* Wrapper container in CF7 form */
.xw-doc-scanner-wrapper {
    display: block;
    width: 100%;
    clear: both;
    box-sizing: border-box;
}

label:has(.xw-doc-scanner-wrapper),
.wpcf7-form-control-wrap:has(.xw-doc-scanner-wrapper) {
    display: block;
    width: 100%;
}

/* Widget di caricamento documento */
.xwd-doc-widget {
    background: #ffffff;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 18px;
    margin-top: 8px;
    margin-bottom: 14px;
    transition: all 0.25s ease;
    position: relative;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}
.xwd-doc-widget:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}
.xwd-doc-widget.has-document {
    border-style: solid;
    border-color: #10b981;
    background: #f0fdf4;
}
.xwd-doc-widget.has-partial {
    border-style: solid;
    border-color: #3b82f6;
    background: #f0f9ff;
}
.xwd-doc-widget.has-warning {
    border-style: solid;
    border-color: #f59e0b;
    background: #fffbeb;
}
.xwd-doc-widget.has-error {
    border-style: solid !important;
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.xwd-doc-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}
.xwd-doc-widget-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 7px;
}
.xwd-doc-status-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.xwd-doc-status-badge.status-ready {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}
.xwd-doc-status-badge.status-partial {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}
.xwd-doc-status-badge.status-warning {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde68a;
}
.xwd-doc-status-badge.status-empty {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* Barra Selezione Tipo Documento */
.xwd-doc-type-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
}
.xwd-doc-type-label {
    font-size: 11.5px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.xwd-doc-type-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.xwd-type-pill {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    user-select: none;
}
.xwd-type-pill:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
    color: #1e293b;
}
.xwd-type-pill.is-active {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

/* Griglia Slot Fronte / Retro */
.xwd-doc-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

/* Pulsante Aggiunta/Rimozione Pagina 2 per A4 Certificati */
.xwd-doc-a4-add-page-wrap {
    margin-top: 4px;
    margin-bottom: 14px;
}
.xwd-btn-a4-toggle-page {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #f8fafc;
    border: 1px dashed #3b82f6;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
}
.xwd-btn-a4-toggle-page:hover {
    background: #eff6ff;
    border-color: #1d4ed8;
    color: #1d4ed8;
}
.xwd-btn-a4-toggle-page.is-active {
    background: #fef2f2;
    border-color: #fca5a5;
    border-style: solid;
    color: #dc2626;
}
.xwd-btn-a4-toggle-page.is-active:hover {
    background: #fee2e2;
    border-color: #ef4444;
}

.xwd-doc-slot-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
}
.xwd-doc-slot-card.is-filled {
    border-color: #10b981;
    background: #f0fdf4;
}
.xwd-doc-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    min-height: 22px;
}
.xwd-doc-slot-title {
    font-size: 12px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.3;
}
.xwd-doc-slot-title > span:first-child {
    flex-shrink: 0;
}
.xwd-doc-slot-title .slot-title-text {
    white-space: normal;
    word-break: break-word;
}
.xwd-doc-slot-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #64748b;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    line-height: 1.3;
}
.xwd-doc-slot-card.is-filled .xwd-doc-slot-badge {
    background: #dcfce7;
    color: #166534;
}

.xwd-doc-slot-preview {
    height: 110px;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    background: #f8fafc;
    overflow: hidden;
    position: relative;
}
.xwd-doc-slot-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.xwd-doc-slot-placeholder {
    color: #94a3b8;
    font-size: 11.5px;
    text-align: center;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.xwd-doc-slot-placeholder span.icon {
    font-size: 22px;
    opacity: 0.7;
}

.xwd-doc-slot-actions {
    display: flex;
    gap: 6px;
}
.xwd-btn-slot-scan, .xwd-btn-slot-file {
    flex: 1;
    padding: 6px 10px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.15s ease;
    border: none;
}
.xwd-btn-slot-scan {
    background: #2563eb;
    color: #ffffff;
}
.xwd-btn-slot-scan:hover {
    background: #1d4ed8;
}
.xwd-btn-slot-file {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}
.xwd-btn-slot-file:hover {
    background: #e2e8f0;
}

/* Barra Azioni Principali */
.xwd-doc-global-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e2e8f0;
}
.xwd-btn-guided-flow {
    padding: 9px 18px;
    font-size: 12.5px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
    transition: all 0.15s ease;
}
.xwd-btn-guided-flow:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.35);
}
.xwd-btn-pdf-upload {
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}
.xwd-btn-pdf-upload:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #1e293b;
}

/* Box Documento Composito / PDF Finale */
.xwd-doc-composite-preview {
    margin-top: 12px;
    background: #ffffff;
    border: 1px solid #10b981;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.xwd-doc-composite-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}
.xwd-doc-composite-thumb {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
}
.xwd-btn-reset-doc {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 11px;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}
.xwd-btn-reset-doc:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Modale Scanner Fotocamera */
.xwd-scanner-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.94);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    backdrop-filter: blur(5px);
    overflow: hidden;
}
.xwd-scanner-header {
    padding: 14px 20px;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
    background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, transparent 100%);
}
.xwd-scanner-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.xwd-scanner-title {
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Selettore rapido tipo e step bar nella fotocamera */
.xwd-scanner-subbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.xwd-scanner-type-switcher {
    display: flex;
    gap: 6px;
}
.xwd-scan-pill {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.xwd-scan-pill.active {
    background: #38bdf8;
    color: #0f172a;
    border-color: #38bdf8;
    font-weight: 700;
}

.xwd-scanner-step-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}
.xwd-scanner-step {
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #94a3b8;
    font-weight: 600;
}
.xwd-scanner-step.current {
    background: #22c55e;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}
.xwd-scanner-step.done {
    background: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

/* Viewport Fotocamera */
.xwd-scanner-viewport-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.xwd-scanner-video {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.xwd-scanner-guide-box {
    position: relative;
    width: 86%;
    max-width: 520px;
    aspect-ratio: 1.586; /* Standard Carta Identità / Patente ID-1 */
    border: 3.5px solid #22c55e;
    border-radius: 14px;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.72);
    z-index: 5;
    pointer-events: none;
    animation: xwdGuidePulse 2.5s infinite;
}
.xwd-guide-instruction {
    position: absolute;
    bottom: -44px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 480px;
    text-align: center;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 5px rgba(0,0,0,0.9);
    background: rgba(15, 23, 42, 0.75);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Silhouettes filigrana all'interno della cornice guida */
.xwd-guide-silhouette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    opacity: 0.45;
}
.xwd-guide-silhouette.mode-front {
    justify-content: space-between;
    align-items: center;
}
.xwd-silhouette-photo {
    width: 32%;
    height: 75%;
    border: 2px dashed rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 28px;
}
.xwd-silhouette-lines {
    width: 58%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.xwd-silhouette-line {
    height: 6px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 3px;
}

.xwd-guide-silhouette.mode-back {
    flex-direction: column;
    justify-content: space-between;
}
.xwd-silhouette-strip {
    height: 24%;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    border: 1px dashed rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #ffffff;
    font-weight: 700;
}

/* Modifica cornice e sagoma per Passaporto (ID-3 ratio ~1.42) */
.xwd-scanner-guide-box.is-passport {
    width: 82% !important;
    max-width: 460px !important;
    aspect-ratio: 1.42 !important;
    border-color: #38bdf8 !important;
    border-radius: 10px !important;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.78) !important;
}

.xwd-guide-silhouette.mode-passport {
    flex-direction: column !important;
    justify-content: space-between !important;
    padding: 14px !important;
}
.xwd-passport-top-header {
    border-bottom: 1.5px dashed rgba(255, 255, 255, 0.6);
    padding-bottom: 5px;
    font-size: 11px;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: 1.5px;
    text-align: center;
}
.xwd-passport-mid-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    margin: 8px 0;
}
.xwd-passport-mrz-zone {
    background: rgba(0, 0, 0, 0.5);
    border: 1px dashed rgba(56, 189, 248, 0.8);
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.xwd-passport-mrz-line {
    font-family: 'Courier New', Courier, monospace;
    font-size: 9.5px;
    color: #38bdf8;
    letter-spacing: 1.2px;
    white-space: nowrap;
    overflow: hidden;
    opacity: 0.95;
    text-align: left;
}

/* Modifica cornice e sagoma per Foglio A4 / Certificati (Portrait ratio ~0.707) */
.xwd-scanner-guide-box.is-a4 {
    width: auto !important;
    height: 70vh !important;
    max-height: 560px !important;
    aspect-ratio: 0.707 !important;
    border-color: #818cf8 !important;
    border-radius: 8px !important;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.78) !important;
}
.xwd-guide-silhouette.mode-a4 {
    flex-direction: column !important;
    justify-content: flex-start !important;
    padding: 18px 14px !important;
    gap: 10px;
}
.xwd-a4-top-header {
    border-bottom: 2px dashed rgba(255, 255, 255, 0.6);
    padding-bottom: 6px;
    font-size: 11px;
    font-weight: 800;
    color: #a5b4fc;
    letter-spacing: 1px;
    text-align: center;
}
.xwd-a4-body-lines {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
    flex: 1;
}
.xwd-a4-body-line {
    height: 5px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 3px;
}
.xwd-a4-stamp-box {
    margin-top: auto;
    align-self: flex-end;
    width: 40%;
    height: 44px;
    border: 1.5px dashed rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #ffffff;
    font-weight: 700;
}

@keyframes xwdGuidePulse {
    0% { border-color: #22c55e; }
    50% { border-color: #38bdf8; }
    100% { border-color: #22c55e; }
}

.xwd-scanner-footer {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 10;
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, transparent 100%);
}
.xwd-scanner-capture-btn {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: #ffffff;
    border: 6px solid rgba(255,255,255,0.4);
    box-shadow: 0 0 24px rgba(255,255,255,0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s ease;
}
.xwd-scanner-capture-btn:active {
    transform: scale(0.92);
}
.xwd-scanner-capture-inner {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 26px;
}

/* Modale Ispettore Qualità & Ritaglio */
.xwd-inspector-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.88);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    padding: 15px;
    box-sizing: border-box;
}
.xwd-inspector-card {
    background: #ffffff;
    border-radius: 14px;
    width: 100%;
    max-width: 800px;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
    overflow: hidden;
}
.xwd-inspector-header {
    background: #1e293b;
    color: #ffffff;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.xwd-inspector-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

/* Banner Step Ispettore */
.xwd-inspector-step-notice {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #1e40af;
}

.xwd-inspector-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}
.xwd-inspector-tools button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.xwd-inspector-tools button:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}
#xwdToolSelectAllBtn {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}
#xwdToolSelectAllBtn:hover {
    background: #dbeafe;
    border-color: #60a5fa;
}
.xwd-crop-stage-container {
    background: #0f172a;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    max-height: 380px;
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
}
.xwd-crop-canvas {
    max-width: 100%;
    max-height: 360px;
    display: block;
    cursor: move;
}

/* Metriche di Qualità */
.xwd-quality-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
}
.xwd-metric-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.xwd-metric-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}
.xwd-metric-value {
    font-size: 12.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
}
.xwd-metric-value.good { color: #16a34a; }
.xwd-metric-value.warning { color: #d97706; }
.xwd-metric-value.bad { color: #dc2626; }

/* Box Conferma Leggibilità */
.xwd-confirm-readability-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: #78350f;
}

.xwd-inspector-footer {
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@media (max-width: 640px) {
    .xwd-doc-widget {
        padding: 14px 12px;
    }
    .xwd-doc-widget-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .xwd-doc-status-badge {
        align-self: flex-start;
    }
    /* Schede Fronte / Retro in colonna singola per visualizzazione spaziosa su mobile */
    .xwd-doc-slots-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    .xwd-doc-slot-card {
        padding: 12px;
        border-radius: 10px;
    }
    .xwd-doc-slot-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        margin-bottom: 8px;
    }
    .xwd-doc-slot-title {
        font-size: 12px;
        line-height: 1.35;
    }
    .xwd-doc-slot-title .slot-title-text {
        white-space: normal;
        word-break: break-word;
    }
    .xwd-doc-slot-badge {
        font-size: 10px;
        padding: 2px 7px;
        border-radius: 8px;
        flex-shrink: 0;
    }
    .xwd-doc-slot-preview {
        height: 125px;
        margin-bottom: 8px;
    }
    .xwd-doc-slot-placeholder {
        font-size: 11px;
        padding: 8px;
        gap: 4px;
    }
    .xwd-doc-slot-placeholder span.icon {
        font-size: 22px;
    }
    .xwd-doc-slot-actions {
        gap: 6px;
    }
    .xwd-btn-slot-scan, .xwd-btn-slot-file {
        padding: 8px 10px;
        font-size: 11.5px;
        min-height: 36px;
    }
    .xwd-doc-type-bar {
        padding: 8px 10px;
        gap: 6px;
    }
    .xwd-type-pill {
        padding: 5px 10px;
        font-size: 11.5px;
    }
    .xwd-doc-a4-add-page-wrap {
        width: 100%;
    }
    .xwd-btn-a4-toggle-page {
        width: 100%;
        justify-content: center;
        text-align: center;
        padding: 9px 12px;
    }
    /* Azioni principali a tutta larghezza su mobile */
    .xwd-doc-global-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .xwd-btn-guided-flow,
    .xwd-btn-pdf-upload,
    .xwd-btn-single-page-confirm {
        width: 100%;
        justify-content: center;
        text-align: center;
        padding: 10px 14px;
        box-sizing: border-box;
    }
    .xwd-scanner-subbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .xwd-scanner-guide-box {
        width: 92%;
    }
    .xwd-scanner-guide-box.is-a4 {
        height: 60vh !important;
    }
}
