/* ==========================================================================
   TOFFOLON PIANTE - DESIGN SYSTEM UFFICIALE (BIANCO MINIMALE & VERDE SALVIA)
   ARCHITETTURA RESPONSIVE FULL-DEVICE (DESKTOP, TABLET, SMARTPHONE IOS/ANDROID)
   ========================================================================== */

:root {
    /* Palette Cromatica Naturale (Ispirata al Logo Ufficiale Toffolon Piante) */
    --bg-page: #f8faf7;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f2f6ef;
    
    --border-color: #e2ebd8;
    --border-color-hover: #8da26f;
    --border-focus: #42572b;

    --green-sage: #8da26f;
    --green-olive: #708453;
    --green-dark: #3a4d25;
    --green-forest: #2b3a1a;
    --green-soft: rgba(141, 162, 111, 0.15);
    --green-badge: #f1f6ec;

    --primary: #42572b;
    --primary-light: #5e793d;
    --primary-glow: rgba(66, 87, 43, 0.2);
    
    --amber: #d97706;
    --amber-soft: rgba(245, 158, 11, 0.12);
    --red: #dc2626;
    --red-soft: rgba(239, 68, 68, 0.12);
    
    --text-main: #1c2217;
    --text-muted: #606d57;
    --text-light: #889680;

    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 26px;

    --shadow-soft: 0 4px 20px rgba(58, 77, 37, 0.05);
    --shadow-hover: 0 10px 30px rgba(58, 77, 37, 0.12);
    --shadow-modal: 0 20px 60px rgba(28, 34, 23, 0.25);
}

/* RESET & GLOBAL BOX MODEL */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-page);
    color: var(--text-main);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
}

/* PLACEHOLDER SOBRIO */
::placeholder,
input::placeholder,
textarea::placeholder {
    color: #94a3b8 !important;
    opacity: 0.8 !important;
    font-weight: 500 !important;
}

/* ==========================================================================
   HEADER BANNER MINIMALE BIANCO
   ========================================================================== */
.app-header {
    min-height: 66px;
    height: auto;
    background: #ffffff;
    border-bottom: 1.5px solid var(--border-color);
    padding: 12px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(58, 77, 37, 0.03);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.brand:hover {
    opacity: 0.92;
}

.brand-logo-img {
    height: 44px;
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    object-fit: contain;
    background: transparent;
    border: none;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.brand:hover .brand-logo-img {
    transform: scale(1.05);
}

.brand-info h1 {
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 900;
    letter-spacing: 0.5px;
    line-height: 1.15;
    color: var(--text-main);
}

.brand-info span {
    font-size: 11.5px;
    color: var(--green-sage);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.header-center-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-top-aggiorna {
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    color: var(--text-sub);
    padding: 8px 16px;
    border-radius: 20px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-top-aggiorna:hover {
    background: var(--bg-card-hover);
    border-color: var(--green-sage);
    color: var(--green-dark);
}

.user-login-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.welcome-user {
    font-size: 13px;
    font-weight: 700;
    background: var(--green-badge);
    color: var(--green-dark);
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

/* RIQUADRO GIALLO ALLARME INGRESSO FRIGO */
.fridge-alert-box {
    background: #fffbeb;
    border: 1.5px solid #f59e0b;
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
}

.fridge-alert-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.alert-bell-icon {
    font-size: 24px;
    color: #d97706;
}

.fridge-alert-header h4 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 800;
    color: #b45309;
}

.fridge-alert-header p {
    font-size: 13px;
    color: #92400e;
}

.fridge-alert-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.fridge-alert-card {
    background: #ffffff;
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}

/* ==========================================================================
   MENU PRINCIPALE & SCHEDE (DESKTOP & MOBILE GRID BIANCO/SALVIA)
   ========================================================================== */
.main-menu-container {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 32px auto;
    padding: 0 24px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.menu-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 26px;
    display: flex;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    box-shadow: var(--shadow-soft);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    color: inherit;
}

.menu-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.menu-card:active {
    transform: scale(0.98);
}

.menu-card-full {
    grid-column: 1 / -1;
}

.menu-card-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: var(--green-soft);
    color: var(--green-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    border: 1px solid rgba(141, 162, 111, 0.25);
    transition: all 0.2s ease;
}

.menu-card:hover .menu-card-icon {
    background: var(--green-sage);
    color: #ffffff;
    transform: scale(1.05);
}

.menu-card-content {
    flex: 1;
    min-width: 0;
}

.menu-card-content h3 {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 4px;
    letter-spacing: 0.3px;
    line-height: 1.3;
}

.menu-card-content p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.arrow-icon {
    font-size: 16px;
    color: var(--border-color-hover);
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.menu-card:hover .arrow-icon {
    color: var(--green-dark);
    transform: translateX(4px);
}

/* ==========================================================================
   MODULE VIEW WORKSPACE (AREA DI LAVORO SCHEDE)
   ========================================================================== */
.module-view-container {
    max-width: 1300px;
    width: 100%;
    margin: 24px auto;
    padding: 0 24px;
}

.module-view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.module-view-header h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 900;
    color: var(--text-main);
}

/* ==========================================================================
   PULSANTI & INPUT (PALETTE BOTANICA VERDE/BIANCO)
   ========================================================================== */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    min-height: 42px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary { 
    background: linear-gradient(135deg, var(--green-dark), var(--primary-light)); 
    color: #ffffff; 
    box-shadow: 0 2px 8px var(--primary-glow);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--green-forest), var(--green-dark));
}

.btn-success { 
    background: linear-gradient(135deg, #10b981, #059669); 
    color: #ffffff; 
}
.btn-warning { 
    background: linear-gradient(135deg, #f59e0b, #d97706); 
    color: #ffffff; 
}
.btn-cyan { 
    background: #f1f6ec; 
    color: var(--green-dark); 
    border: 1.5px solid var(--green-sage); 
}
.btn-secondary { 
    background: #ffffff; 
    color: var(--text-main); 
    border: 1.5px solid var(--border-color); 
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--green-sage);
}

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(0.97); }

/* INPUTS & SELECTS SU SFONDO BIANCO */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="email"],
select,
textarea {
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
    max-width: 100%;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 10px 14px;
    outline: none;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--green-sage);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(141, 162, 111, 0.2);
}

/* ==========================================================================
   MODALS RESPONSIVE ARCHITECTURE
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 15, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2500;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 28px 24px;
    position: relative;
    box-shadow: var(--shadow-modal);
    margin: auto;
    box-sizing: border-box;
    color: var(--text-main);
}

.close-modal {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 26px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    z-index: 10;
    transition: color 0.15s ease;
}

.close-modal:hover {
    color: var(--text-main);
}

/* ==========================================================================
   TABLES & HORIZONTAL SCROLL CONTAINERS
   ========================================================================== */
.table-responsive-container,
div[style*="overflow-x: auto"] {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    margin-bottom: 16px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5ee;
}
::-webkit-scrollbar-thumb {
    background: #c2d4b6;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #8da26f;
}

/* ==========================================================================
   FULL-SCREEN LOGIN GATE OVERLAY & CARD BIANCA (MOBILE FRIENDLY)
   ========================================================================== */
.login-gate-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: radial-gradient(circle at center, rgba(248,250,247,0.98) 0%, rgba(226,235,216,0.95) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 16px 12px env(safe-area-inset-bottom, 20px) 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.login-gate-card {
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    box-shadow: 0 25px 60px rgba(58, 77, 37, 0.15), 0 4px 20px rgba(0, 0, 0, 0.05);
    border-radius: 24px;
    width: 100%;
    max-width: 370px;
    padding: 20px 18px;
    text-align: center;
    animation: loginGateFade 0.35s ease-out;
    margin: auto 0;
    color: var(--text-main);
}

@media (max-height: 700px) {
    .login-gate-overlay {
        align-items: flex-start;
        padding-top: 10px;
    }
    .login-gate-card {
        padding: 14px 14px;
        margin: 0;
    }
    .login-brand-logo img {
        height: 48px !important;
    }
}

@keyframes loginGateFade {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-input-select, .login-input-pin {
    width: 100%;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 16px;
    font-weight: 700;
    outline: none;
    transition: all 0.2s ease;
}

.login-input-select:focus, .login-input-pin:focus {
    border-color: var(--green-sage);
    background: #ffffff;
    box-shadow: 0 0 0 3.5px rgba(141, 162, 111, 0.2);
}

.btn-login-submit {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--green-dark) 0%, var(--primary-light) 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(66, 87, 43, 0.25);
    transition: all 0.2s ease;
    margin-top: 4px;
    min-height: 46px;
}

.btn-login-submit:hover, .btn-login-submit:active {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(66, 87, 43, 0.35);
}

/* ==========================================================================
   MEDIA QUERIES RESPONSIVE (SMARTPHONE <= 768px)
   ========================================================================== */
@media (max-width: 768px) {
    .app-header {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .brand {
        justify-content: center;
    }

    .brand-info h1 {
        font-size: 18px;
    }

    .header-center-info {
        justify-content: space-between;
        width: 100%;
    }

    .user-login-container {
        width: 100%;
        justify-content: space-between;
    }

    .main-menu-container {
        padding: 14px 12px;
        margin: 14px auto;
    }

    .menu-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .menu-card {
        padding: 18px 16px;
        min-height: 76px;
        border-radius: 16px;
        gap: 14px;
    }

    .menu-card-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
        border-radius: 12px;
    }

    .menu-card-content h3 {
        font-size: 15px;
    }

    .menu-card-content p {
        font-size: 12px;
    }

    .module-view-container {
        padding: 12px 10px;
        margin: 10px auto;
    }

    .module-view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .module-view-header h2 {
        font-size: 19px;
    }

    input[type="text"],
    input[type="number"],
    input[type="password"],
    input[type="date"],
    input[type="email"],
    select,
    textarea {
        font-size: 16px !important;
        min-height: 46px;
    }

    .btn {
        min-height: 46px;
        font-size: 14px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 10px 12px !important;
    }

    .brand-logo-img {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
    }

    .brand-info h1 {
        font-size: 16px !important;
    }

    .welcome-user {
        font-size: 12px !important;
        padding: 5px 10px !important;
    }

    .btn-top-aggiorna {
        font-size: 11px !important;
        padding: 5px 10px !important;
    }

    .menu-card {
        padding: 14px 12px !important;
    }
}

/* ===================================================
   STILI ANTEPRIMA DOCUMENTI (A4) & RESPONSIVE MOBILE
   =================================================== */

.a4-preview-modal-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: rgba(10, 15, 25, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px 12px;
    box-sizing: border-box;
}

.a4-preview-toolbar {
    background: #0f1e2b;
    border: 1.5px solid #00a99d;
    border-radius: 12px;
    padding: 12px 18px;
    max-width: 820px;
    width: 100%;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 10001;
}

.a4-preview-toolbar .toolbar-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.a4-sheet {
    background: #ffffff;
    color: #1e293b;
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto 30px auto;
    padding: 12mm 15mm;
    border-radius: 6px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.5);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

/* 1. TESTATA: LOGO BILANCIATO & DATI AZIENDALI */
.doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1.5px solid #0f172a;
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
}

.doc-header-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex: 0 0 auto;
}

.doc-header-logo img {
    height: 95px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    display: block;
}

.doc-header-company {
    text-align: right;
    font-size: 7.8pt;
    line-height: 1.35;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    padding-left: 20px;
}

.doc-header-company .company-name {
    font-size: 10.5pt;
    font-weight: 900;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: -0.2px;
    margin-bottom: 2px;
}

.doc-header-company .passport-text {
    font-size: 7.8pt;
    font-weight: 800;
    color: #000000;
    margin-top: 3px;
    letter-spacing: 0.2px;
}

/* 2. CARD CLIENTE & CARD DETTAGLIO DOCUMENTO */
.doc-client-grid {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
}

.card-client {
    background: #ffffff;
    border: 1.5px solid #0f172a;
    border-radius: 6px;
    padding: 9px 12px;
}

.card-client-title {
    font-size: 7pt;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 2px;
}

.card-client .client-name {
    font-size: 10pt;
    font-weight: 800;
    color: #000000;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.card-client .client-details {
    font-size: 8pt;
    color: #1e293b;
    line-height: 1.35;
}

.card-doc-info {
    background: #ffffff;
    border: 1.5px solid #0f172a;
    border-radius: 6px;
    padding: 9px 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.doc-pill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1.5px solid #0f172a;
    color: #000000;
    padding: 5px 8px;
    border-radius: 4px;
    margin-bottom: 5px;
}

.doc-pill .doc-type {
    font-size: 8pt;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #000000;
    white-space: nowrap;
}

.doc-pill .doc-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10pt;
    font-weight: 900;
    color: #000000;
    white-space: nowrap;
}

.doc-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    font-size: 7.8pt;
    color: #1e293b;
}

/* STRISCIA TRASPORTO */
.transport-strip {
    background: #ffffff;
    border: 1px solid #64748b;
    border-radius: 4px;
    padding: 6px 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    font-size: 7.5pt;
    margin-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
}

.transport-item span {
    color: #475569;
    font-weight: 700;
    display: block;
    font-size: 6.8pt;
    text-transform: uppercase;
}

.transport-item strong {
    color: #000000;
    font-weight: 800;
}

/* 3. TABELLA ARTICOLI COMPATTA */
.doc-table-container {
    flex-grow: 1;
    margin-bottom: 10px;
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 7.8pt;
}

.doc-table thead th {
    background: #f1f5f9;
    color: #000000;
    font-weight: 800;
    font-size: 6.8pt;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 5px 6px;
    text-align: left;
    border-top: 1.5px solid #0f172a;
    border-bottom: 1.5px solid #0f172a;
}

.doc-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
}

.doc-table td {
    padding: 3.5px 6px;
    vertical-align: middle;
    color: #000000;
    font-size: 7.8pt;
}

.plant-name {
    font-weight: 700;
    color: #000000;
    font-size: 7.8pt;
    line-height: 1.2;
}

.lot-text {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 6.2pt;
    font-weight: 600;
    color: #475569;
    margin-top: 1px;
}

.num-col {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.center-col {
    text-align: center;
}

/* 4. TOTALI SOPRA ALLE NOTE */
.totals-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
    width: 100%;
}

.card-totals {
    background: #ffffff;
    border: 1.5px solid #0f172a;
    border-radius: 6px;
    padding: 8px 14px;
    min-width: 250px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 8.2pt;
    margin-bottom: 2px;
    color: #334155;
}

.total-row strong {
    color: #000000;
    font-variant-numeric: tabular-nums;
}

.grand-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1.5px solid #0f172a;
    margin-top: 3px;
    padding-top: 4px;
    font-size: 11pt;
    font-weight: 900;
    color: #000000;
}

/* 5. NOTE & CONDIZIONI A TUTTA LARGHEZZA */
.notes-card-full {
    background: #ffffff;
    border: 1px solid #64748b;
    border-radius: 4px;
    padding: 5px 9px;
    font-size: 6.8pt;
    color: #334155;
    line-height: 1.3;
    margin-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
}

.notes-card-full strong {
    color: #000000;
    margin-right: 4px;
    text-transform: uppercase;
}

/* 6. FIRME & TIMBRO A TUTTA LARGHEZZA */
.signatures-full-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    width: 100%;
    margin-bottom: 8px;
    box-sizing: border-box;
}

.signature-box-large {
    border: 1.5px dashed #0f172a;
    background: #ffffff;
    border-radius: 6px;
    padding: 10px 14px;
    text-align: center;
    min-height: 92px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.signature-label {
    font-size: 7.2pt;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: left;
}

.signature-line {
    border-bottom: 1px solid #94a3b8;
    margin-top: 42px;
    width: 100%;
}

/* PIEDIPAGINA ISTITUZIONALE IBAN & PRIVACY A NORMA DI LEGGE */
.doc-footer {
    border-top: 1px solid #0f172a;
    padding-top: 6px;
    font-size: 6.8pt;
    color: #334155;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.iban-row {
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 7.2pt;
    font-weight: 700;
    color: #000000;
    letter-spacing: 0.2px;
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 4px;
}

.privacy-legal-text {
    font-size: 6.2pt;
    color: #64748b;
    line-height: 1.25;
    text-align: justify;
    font-style: italic;
}

/* RESPONSIVE MOBILE SULLO SCHERMO (SMARTPHONE) */
@media screen and (max-width: 768px) {
    .a4-preview-modal-overlay {
        padding: 8px 6px;
    }

    .a4-preview-toolbar {
        padding: 10px 12px;
        margin-bottom: 10px;
    }

    .a4-preview-toolbar .toolbar-info strong {
        font-size: 13px !important;
    }

    .a4-preview-toolbar .toolbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .a4-preview-toolbar .toolbar-actions .btn {
        flex: 1;
        font-size: 11px !important;
        padding: 8px 6px !important;
        min-height: 38px !important;
        text-align: center;
        justify-content: center;
    }

    .a4-sheet {
        padding: 16px 12px !important;
        border-radius: 8px !important;
        margin-bottom: 20px !important;
    }

    .doc-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    .doc-header-company {
        text-align: left !important;
        font-size: 8.5pt !important;
    }

    .doc-client-grid {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .doc-client-box, .doc-dest-box {
        min-width: unset !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .doc-ddt-info {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .doc-table {
        min-width: 500px;
    }

    .doc-footer-grid {
        display: flex !important;
        flex-direction: column-reverse !important;
        gap: 12px !important;
        margin-top: 14px !important;
    }

    .doc-totals-box {
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* STAMPA UFFICIALE A4 PERFETTA SU 1 PAGINA */
@media print {
    @page {
        size: A4 portrait;
        margin: 0mm;
    }

    html, body {
        width: 210mm !important;
        height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #000000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
    }

    /* Nasconde tutto il corpo del gestionale quando la modale è attiva */
    body > *:not(#anteprimaStampaA4Modal) {
        display: none !important;
    }

    .no-print, .a4-preview-toolbar, .btn, .modal:not(#anteprimaStampaA4Modal) {
        display: none !important;
    }

    #anteprimaStampaA4Modal {
        position: static !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        display: block !important;
    }

    #printableA4Document, .a4-sheet {
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        width: 210mm !important;
        max-width: 210mm !important;
        min-height: 297mm !important;
        height: 297mm !important;
        padding: 12mm 15mm 12mm 15mm !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        page-break-after: avoid !important;
        page-break-inside: avoid !important;
        background: #ffffff !important;
        color: #000000 !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
    }
}

/* ========================================================================= */
/* RIMOZIONE STEPPER / FRECCETTE NATIVE DESKTOP (SAFARI & CHROME SU MAC)     */
/* ========================================================================= */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none;
    appearance: none;
    margin: 0; 
}
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}


