:root {
    --ink: #17212b;
    --muted: #65727e;
    --paper: #ffffff;
    --canvas: #f3f6f5;
    --primary: #0d695d;
    --primary-dark: #084b43;
    --line: #dfe6e3;
    --warning: #fff1ce;
    --danger: #a22626;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
a { color: inherit; }
.topbar {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5vw;
    color: white;
    background: var(--primary-dark);
}
.brand { font-size: 1.15rem; font-weight: 750; text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 22px; }
.topbar nav a, .link-button { color: white; font: inherit; text-decoration: none; }
.topbar form { margin: 0; }
.link-button { padding: 0; border: 0; background: none; cursor: pointer; }
.container { width: min(1180px, 90vw); margin: 0 auto; padding: 44px 0 64px; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
h1 { margin: 4px 0 8px; font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.04em; }
h2 { margin: 0 0 20px; font-size: 1.25rem; }
h3 { margin: 24px 0 10px; font-size: .95rem; }
.eyebrow { margin: 0; color: var(--primary); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted, .empty { color: var(--muted); }
.primary-button {
    display: inline-flex;
    justify-content: center;
    padding: 12px 18px;
    border: 0;
    border-radius: 10px;
    color: white;
    background: var(--primary);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.primary-button:hover { background: var(--primary-dark); }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat, .panel, .login-card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 30px rgba(34, 54, 47, .05); }
.stat { padding: 18px; }
.stat span { display: block; min-height: 38px; color: var(--muted); font-size: .85rem; }
.stat strong { font-size: 1.8rem; }
.stat.warning { background: var(--warning); border-color: #f0d997; }
.two-columns { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; }
.panel { padding: 24px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; }
.clean-list { margin: 0; padding: 0; list-style: none; }
.clean-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.danger-text { color: var(--danger); }
.login-card { width: min(460px, 100%); margin: 7vh auto 0; padding: 34px; }
.login-card h1 { font-size: 2.1rem; }
.form-stack { display: grid; gap: 10px; margin-top: 24px; }
.form-stack input { width: 100%; padding: 12px; border: 1px solid #bcc9c5; border-radius: 9px; font: inherit; }
.form-stack .primary-button { margin-top: 10px; }
.error, .message { padding: 12px 14px; border-radius: 9px; background: #fce7e7; color: var(--danger); }

@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .two-columns { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .topbar { padding: 0 5vw; }
    .topbar nav a { display: none; }
    .container { width: 92vw; padding-top: 28px; }
    .hero { align-items: flex-start; flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .panel { padding: 18px; }
}

/* Applicazione */
.app-body { min-height: 100vh; overflow-x: hidden; }
.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    display: flex;
    width: 264px;
    flex-direction: column;
    color: #dce9e5;
    background: #0b302d;
    border-right: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 86px;
    padding: 18px 22px;
    color: white;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 12px;
    color: #0b302d;
    background: #bde8d9;
    font-size: .85rem;
    font-weight: 900;
}
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand strong { font-size: 1.02rem; }
.sidebar-brand small { margin-top: 1px; color: #9fc0b8; font-size: .78rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 18px 12px; }
.nav-heading {
    margin: 22px 12px 8px;
    color: #71958d;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.nav-heading:first-of-type { margin-top: 16px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 3px 0;
    padding: 10px 12px;
    border-radius: 10px;
    color: #d1e0dc;
    font-size: .9rem;
    font-weight: 620;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}
.nav-item:hover { color: white; background: rgba(255, 255, 255, .07); }
.nav-item.active { color: #092e2a; background: #bde8d9; }
.nav-icon {
    display: grid;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 7px;
    font-size: .7rem;
    font-weight: 850;
    opacity: .82;
}
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.technical-link {
    display: block;
    margin: 0 10px 10px;
    color: #84a9a1;
    font-size: .72rem;
    text-decoration: none;
}
.user-box { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: rgba(255, 255, 255, .055); }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: #0b302d; background: #d7eee7; font-weight: 850; }
.user-meta { min-width: 0; flex: 1; }
.user-meta strong, .user-meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta strong { color: white; font-size: .82rem; }
.user-meta small { margin-top: 2px; color: #84a9a1; font-size: .68rem; }
.user-box form { margin: 0; }
.logout-button { padding: 6px; border: 0; color: #aac5bf; background: transparent; font-size: 1.1rem; cursor: pointer; }
.workspace { min-height: 100vh; margin-left: 264px; }
.content { width: min(1420px, calc(100vw - 320px)); margin: 0 auto; padding: 42px 0 68px; }
.mobile-header { display: none; }
.sidebar-overlay { display: none; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.page-header.compact { align-items: flex-start; }
.page-header h1 { margin: 5px 0 4px; font-size: clamp(2rem, 4vw, 3rem); }
.page-description { max-width: 700px; margin: 6px 0 0; }
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.back-link { display: inline-block; margin-bottom: 14px; color: var(--primary); font-size: .85rem; font-weight: 700; text-decoration: none; }
.data-panel { padding: 0; overflow: hidden; }
.search-bar { display: flex; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.search-bar input {
    min-width: 0;
    flex: 1;
    padding: 11px 13px;
    border: 1px solid #becbc7;
    border-radius: 9px;
    background: #fbfcfc;
    font: inherit;
}
.bulk-actions-bar { display: flex; align-items: center; justify-content: flex-end; flex-wrap: nowrap; gap: 14px; min-height: 58px; padding: 9px 20px; overflow-x: auto; border-bottom: 1px solid var(--line); background: #fbfcfc; }
.bulk-select-label { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 9px; color: var(--ink); white-space: nowrap; cursor: pointer; }
.bulk-select-label strong { color: var(--primary-dark); font-size: .86rem; }
.bulk-select-label input, .bulk-row-checkbox { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.bulk-actions-summary { display: flex; align-items: center; flex: 0 0 auto; gap: 10px; white-space: nowrap; }
.selection-count-badge { min-width: 96px; padding: 7px 11px; border: 1px solid #d5e1dd; border-radius: 999px; color: #536661; background: white; font-size: .76rem; font-weight: 700; text-align: center; }
.bulk-delete-button { min-width: 156px; padding: 8px 13px; transition: opacity .15s ease, background .15s ease; }
.danger-button:disabled { border-color: #d7dddb; color: #8a9793; background: #eef1f0; opacity: 1; cursor: not-allowed; }
.selection-column { width: 56px; min-width: 56px; text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.secondary-button, .quiet-button, .danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border-radius: 9px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}
.secondary-button { border: 1px solid #9fb5af; color: var(--primary-dark); background: white; }
.quiet-button { border: 1px solid var(--line); color: var(--muted); background: #f8faf9; }
.danger-button { border: 1px solid #942222; color: white; background: #a82c2c; }
.data-table th:first-child, .data-table td:first-child { padding-left: 20px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 20px; }
.data-table tbody tr:hover { background: #f8fbfa; }
.data-table tbody tr:has(.bulk-row-checkbox:checked) { background: #edf7f3; box-shadow: inset 3px 0 0 var(--primary); }
.data-table td { max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.data-table th.selection-column, .data-table td.selection-column { box-sizing: border-box; padding-right: 0; padding-left: 0; vertical-align: middle; }
.table-row-link { display: block; margin: -14px -10px; padding: 14px 10px; color: inherit; text-decoration: none; }
.data-table td:first-child .table-row-link { color: var(--primary-dark); font-weight: 800; }
.actions-heading { text-align: right; }
.row-actions { text-align: right; }
.row-actions a { display: inline-block; margin-left: 12px; color: var(--primary); font-size: .82rem; font-weight: 750; text-decoration: none; }
.row-actions .danger-link { color: var(--danger); }
.empty-state { padding: 70px 24px; text-align: center; }
.empty-state h2 { margin: 10px 0 5px; }
.empty-state p { margin: 0 0 22px; color: var(--muted); }
.empty-symbol { display: grid; width: 46px; height: 46px; margin: 0 auto; place-items: center; border-radius: 50%; color: var(--primary); background: #e1f1ec; font-size: 1.5rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 16px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .84rem; }
.pagination a { color: var(--primary); font-weight: 700; text-decoration: none; }
.edit-form { width: min(880px, 100%); padding: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.form-field { min-width: 0; }
.form-field:has(textarea), .form-field:has(input[type="file"]), .checkbox-field { grid-column: 1 / -1; }
.form-field > label:not(.checkbox-label) { display: block; margin-bottom: 7px; color: #31433f; font-size: .82rem; font-weight: 750; }
.required { margin-left: 3px; color: var(--danger); }
.form-control { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #b9c8c4; border-radius: 9px; color: var(--ink); background: white; font: inherit; }
.form-control:focus { outline: 3px solid rgba(13, 105, 93, .12); border-color: var(--primary); }
.form-control[type="file"] { height: auto; padding: 9px; background: #f8faf9; }
.form-field a { color: var(--primary); }
.checkbox-label { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.form-check { width: 18px; height: 18px; accent-color: var(--primary); }
.help-text { display: block; margin-top: 6px; color: var(--muted); }
.field-error { display: block; margin-top: 6px; color: var(--danger); font-weight: 650; }
.form-error { margin-bottom: 20px; }
.form-error ul { margin: 0; padding-left: 18px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.messages { margin-bottom: 20px; }
.message { background: #e4f2ed; color: #14564d; }
.message.error { background: #fce7e7; color: var(--danger); }
.delete-card { width: min(620px, 100%); padding: 36px; }
.delete-card h1 { margin-top: 8px; font-size: 2.2rem; }
.bulk-delete-card { width: min(760px, 100%); }
.bulk-delete-list { max-height: 320px; margin: 20px 0; padding: 0; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; list-style: none; }
.bulk-delete-list li { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.bulk-delete-list li:last-child { border-bottom: 0; }
.bulk-delete-list span { color: var(--muted); font-size: .82rem; }
.danger-symbol { display: grid; width: 48px; height: 48px; margin-bottom: 24px; place-items: center; border-radius: 50%; color: white; background: var(--danger); font-weight: 900; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 4px 0 0; }
.count-badge { padding: 6px 10px; border-radius: 999px; color: var(--primary-dark); background: #e3f1ed; font-size: .76rem; font-weight: 750; }
.auth-container { width: min(1100px, 90vw); margin: 0 auto; padding: 44px 0 64px; }

@media (max-width: 1080px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .workspace { margin-left: 0; }
    .content { width: min(94vw, 1000px); padding-top: 28px; }
    .mobile-header { display: flex; align-items: center; gap: 14px; height: 62px; padding: 0 3vw; color: white; background: #0b302d; }
    .menu-button { border: 0; color: white; background: transparent; font-size: 1.4rem; cursor: pointer; }
    .menu-open .sidebar { transform: translateX(0); }
    .menu-open .sidebar-overlay { position: fixed; inset: 0; z-index: 20; display: block; background: rgba(6, 25, 23, .48); }
}

@media (max-width: 720px) {
    .page-header { align-items: stretch; flex-direction: column; }
    .page-header .primary-button { align-self: flex-start; }
    .form-grid { grid-template-columns: 1fr; }
    .form-field { grid-column: 1; }
    .search-bar { flex-wrap: wrap; }
    .search-bar input { flex-basis: 100%; }
    .header-actions { justify-content: flex-start; }
    .row-actions { min-width: 170px; }
    .bulk-actions-bar { justify-content: flex-end; padding: 10px 16px; }
}

/* Inserimento guidato ordine */
.wizard-form { display: grid; gap: 32px; }
.wizard-step { padding: 26px 28px; }
.step-heading { margin-bottom: 22px; }
.step-heading h2 { margin: 1px 0 3px; }
.step-heading p { margin: 0; color: var(--muted); font-size: .86rem; }
.choice-list { margin: 2px 0 18px; }
.radio-options { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.radio-options li { margin: 0; }
.radio-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 13px;
    border: 1px solid #bac9c5;
    border-radius: 10px;
    background: #fbfcfc;
    font-size: .84rem;
    font-weight: 680;
    cursor: pointer;
}
.radio-options input { accent-color: var(--primary); }
.radio-options label:has(input:disabled) { opacity: .5; background: #f1f3f2; cursor: not-allowed; }
.conditional-panel { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: #f9fbfa; }
.conditional-panel[hidden], .inline-warning[hidden], .certification-summary[hidden] { display: none; }
.nested-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.nested-section h3 { margin: 0 0 14px; color: var(--ink); font-size: 1rem; }
.certification-summary {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.4fr);
    gap: 20px;
    margin-top: 16px;
    padding: 18px;
    border: 1px solid #bcd1cb;
    border-radius: 12px;
    background: white;
}
.certification-summary p { margin: 5px 0 0; color: var(--muted); font-size: .84rem; white-space: pre-line; }
.certification-summary dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 12px 0 0; }
.certification-summary dl div { min-width: 0; }
.certification-summary dt { color: var(--muted); font-size: .68rem; font-weight: 750; text-transform: uppercase; }
.certification-summary dd { margin: 3px 0 0; overflow: hidden; font-size: .82rem; font-weight: 700; text-overflow: ellipsis; }
.status-badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.status-valid { color: #146149; background: #dcf3e9; }
.status-warning { color: #785411; background: #fff0c5; }
.status-expired, .status-missing { color: #8b2626; background: #fbe3e3; }
.test-report-cell { display: flex; align-items: flex-start; flex-direction: column; gap: 7px; min-width: 110px; }
.test-report-actions { display: flex; align-items: center; gap: 5px; }
.test-report-actions-end { justify-content: flex-end; }
.test-report-action { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; padding: 0; border: 1px solid #b7cbc5; border-radius: 7px; color: var(--primary-dark); background: #f5faf8; font-size: 1rem; font-weight: 900; line-height: 1; text-decoration: none; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.test-report-action:hover { transform: translateY(-1px); border-color: var(--primary); box-shadow: 0 3px 8px rgba(18, 43, 38, .12); }
.test-report-action-danger { border-color: #e5b8b8; color: var(--danger); background: #fff5f5; }
.test-report-action.is-disabled { border-color: #dfe6e4; color: #9aa6a2; background: #f3f5f4; opacity: .55; cursor: not-allowed; }
.test-report-action.is-disabled:hover { transform: none; border-color: #dfe6e4; box-shadow: none; }
.test-report-status-link { text-decoration: none; }
.test-report-lot small { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; font-weight: 500; white-space: nowrap; }
.inline-warning { margin: 14px 0 0; padding: 13px 15px; border: 1px solid #ead08a; border-radius: 10px; color: #71500c; background: #fff4d5; font-size: .85rem; }
.wizard-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
    padding: 24px 0 30px;
    border-top: 1px solid var(--line);
}
.order-certification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px 22px;
    border: 1px solid;
    border-radius: 14px;
}
.order-certification h2 { margin: 5px 0 3px; }
.order-certification p:last-child { margin: 0; color: var(--muted); }
.certification-ok { border-color: #a9d7c6; background: #eff9f5; }
.certification-warning { border-color: #e9cf87; background: #fff9e9; }
.certification-error { border-color: #e4b2b2; background: #fff3f3; }
.certification-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.declaration-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 20px; border-bottom: 1px solid var(--line); background: #fbfcfc; }
.declaration-select-all { display: inline-flex; align-items: center; flex: 0 0 auto; gap: 9px; color: var(--primary-dark); font-size: .82rem; font-weight: 750; white-space: nowrap; cursor: pointer; }
.declaration-select-all input, .declaration-row-checkbox { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.declaration-generation-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; white-space: nowrap; }
.declaration-generation-actions .primary-button { min-width: 156px; padding: 9px 13px; }
.primary-button:disabled { color: #8a9793; background: #dfe5e3; box-shadow: none; cursor: not-allowed; }
.selection-placeholder { color: #a6b1ae; }
.declaration-cell { min-width: 160px; }
.declaration-cell small { display: block; margin-top: 4px; color: var(--muted); font-size: .7rem; }
.document-link { color: var(--primary); font-weight: 800; text-decoration: none; }
.declaration-document { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.declaration-document-info { min-width: 0; }
.document-downloads { display: flex; align-items: center; flex: 0 0 auto; flex-direction: column; gap: 5px; }
.document-format-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 24px; border: 1px solid currentColor; border-radius: 6px; font-size: .58rem; font-weight: 900; line-height: 1; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.document-format-icon:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(18, 43, 38, .13); }
.document-format-pdf { color: #b4232d; background: #fff3f4; }
.document-format-word { color: #185abd; background: #f0f6ff; }
.inline-generate-button { padding: 0; border: 0; color: var(--primary); background: transparent; font: inherit; font-size: .8rem; font-weight: 800; cursor: pointer; }
.data-table tbody tr:has(.declaration-row-checkbox:checked) { background: #edf7f3; box-shadow: inset 3px 0 0 var(--primary); }
.generation-dialog { width: min(520px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; color: var(--ink); background: white; box-shadow: 0 24px 70px rgba(7, 35, 31, .28); }
.generation-dialog::backdrop { background: rgba(6, 25, 23, .55); backdrop-filter: blur(2px); }
.generation-dialog-content { padding: 28px; }
.generation-dialog h2 { margin: 5px 0 8px; font-size: 1.45rem; }
.generation-dialog .muted { margin: 0 0 22px; line-height: 1.5; }
.generation-date-field { display: block; }
.generation-date-field span { display: block; margin-bottom: 7px; color: #31433f; font-size: .8rem; font-weight: 750; }
.generation-date-field input { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid #b9c8c4; border-radius: 9px; color: var(--ink); background: white; font: inherit; }
.generation-date-field input:focus { outline: 3px solid rgba(13, 105, 93, .12); border-color: var(--primary); }
.generation-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.calculated-total {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--primary-dark);
    background: #e7f3ef;
    font-size: .86rem;
}
.calculated-total strong { margin-left: 5px; font-size: 1.05rem; }
.generated-order-note { margin: 20px 0 0; padding: 13px 15px; border-radius: 10px; color: var(--primary-dark); background: #e7f3ef; font-size: .84rem; }
.inline-note { margin: 14px 0 0; color: var(--muted); font-size: .84rem; }
.compact-nested { padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.compact-nested + .compact-nested { margin-top: 18px; }

/* Dettaglio fornitore e storico Moduli E */
.supplier-detail-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 22px; margin-bottom: 24px; }
.supplier-card { padding: 26px 28px; }
.supplier-card h2 { margin: 4px 0 20px; }
.supplier-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; margin: 0; }
.detail-list div { min-width: 0; }
.detail-list .detail-wide { grid-column: 1 / -1; }
.detail-list dt { margin-bottom: 4px; color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; font-weight: 680; }
.detail-list a, .supplier-history td a { color: var(--primary); font-weight: 750; text-decoration: none; }
.supplier-card-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.missing-certification { padding: 18px; border: 1px solid #e4b2b2; border-radius: 12px; background: #fff3f3; }
.missing-certification h3 { margin: 0 0 5px; color: var(--danger); }
.missing-certification p { margin: 0 0 18px; color: var(--muted); }
.supplier-history { margin-top: 0; }
.compact-empty { padding: 42px 24px; }
.supplier-document-settings { margin-top: 24px; }
.supplier-document-settings > summary { width: max-content; margin-left: auto; color: #8a9692; font-size: .72rem; cursor: pointer; user-select: none; }
.supplier-document-settings > summary:hover { color: var(--primary); }
.supplier-document-settings-panel { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 28px; margin-top: 10px; }
.supplier-document-settings-panel h2 { margin: 5px 0 8px; }
.supplier-document-settings-panel p.muted { max-width: 700px; margin-bottom: 20px; }
.supplier-image-form { max-width: 680px; }
.supplier-image-actions { margin: 18px 0 0; padding: 0; }
.supplier-image-preview { display: flex; align-items: center; justify-content: center; min-height: 160px; padding: 14px; border: 1px dashed #bdcac6; border-radius: 12px; color: var(--muted); background: #fafcfb; font-size: .78rem; text-align: center; }
.supplier-image-preview span { display: block; }
.supplier-image-preview img { display: block; max-width: 190px; max-height: 150px; object-fit: contain; }

@media (max-width: 720px) {
    .wizard-step { padding: 20px 18px; }
    .radio-options { align-items: stretch; flex-direction: column; }
    .certification-summary { grid-template-columns: 1fr; }
    .certification-summary dl { grid-template-columns: 1fr; }
    .wizard-actions { align-items: stretch; flex-direction: column-reverse; }
    .order-certification { align-items: flex-start; flex-direction: column; }
    .certification-actions { justify-content: flex-start; }
    .declaration-toolbar { align-items: stretch; flex-direction: column; }
    .declaration-generation-actions { justify-content: flex-start; overflow-x: auto; }
    .supplier-detail-grid { grid-template-columns: 1fr; }
    .detail-list { grid-template-columns: 1fr; }
    .detail-list .detail-wide { grid-column: 1; }
    .supplier-card-actions { justify-content: flex-start; }
    .supplier-document-settings-panel { grid-template-columns: 1fr; }
}

/* Importazione articoli da Excel */
.import-intro { margin-bottom: 20px; }
.import-intro h2 { margin: 5px 0 8px; }
.import-intro p:not(.eyebrow) { max-width: 920px; margin-bottom: 0; color: var(--muted); }
.import-section-spacer { height: 28px; }
.import-upload { margin-bottom: 24px; }
.import-preview { margin-top: 24px; }
.import-errors { margin: 20px 24px; padding: 16px 18px; border: 1px solid #e3aaaa; border-radius: 10px; color: var(--danger); background: #fff1f1; }
.import-errors ul { margin: 8px 0 0; padding-left: 20px; }
.import-table td { vertical-align: top; white-space: normal; }
.import-table small { color: var(--muted); }
.import-table .decision-cell { min-width: 300px; }
.conflict-row { background: #fffaf0; }
.row-warnings { min-width: 260px; margin: 9px 0 0; padding-left: 17px; color: #785411; font-size: .76rem; }
.import-confirm-actions { margin: 0; padding: 20px 24px; }

/* Modifica compatta delle righe di un ordine */
.bulk-edit-order-form { padding: 0; overflow: hidden; }
.order-lines-bulk-actions { border-top: 0; }
.bulk-edit-table td { vertical-align: top; }
.bulk-edit-table .form-control { min-width: 110px; min-height: 40px; padding: 8px 9px; }
.bulk-edit-table td:nth-child(5) .form-control { min-width: 150px; }
.row-delete-button { margin-left: 12px; padding: 0; border: 0; color: var(--danger); background: transparent; font: inherit; font-size: .82rem; font-weight: 750; cursor: pointer; }
.bulk-edit-actions { margin: 0; padding: 20px 24px; }
.formset-error { margin: 18px 20px 0; }
.formset-row-error td { color: var(--danger); background: #fff3f3; font-size: .8rem; }

/* Container e file di carico */
.container-suppliers { margin-bottom: 24px; }
.container-lines .data-table a { color: var(--primary); font-weight: 750; text-decoration: none; }
.container-import-grid { grid-template-columns: minmax(220px, 1fr) minmax(180px, .7fr); }
.container-import-grid .form-field-wide { grid-column: 1 / -1; }

/* Backup, ripristino e reset */
.backup-overview-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 20px; margin-bottom: 24px; }
.backup-action-card, .backup-location-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.backup-action-card h2, .backup-location-card h2 { margin: 5px 0 8px; }
.backup-action-card p.muted, .backup-location-card p.muted { margin: 0; max-width: 650px; line-height: 1.5; }
.backup-action-card form { flex: 0 0 auto; margin-top: 5px; }
.backup-location-card { display: block; }
.backup-location-card code { display: block; margin: 13px 0 10px; padding: 11px 13px; overflow-wrap: anywhere; border: 1px solid #c9d8d4; border-radius: 9px; color: var(--primary-dark); background: #f4f8f7; font-size: .8rem; }
.backup-list-panel { margin-bottom: 24px; }
.backup-table td code { font-size: .75rem; }
.backup-row-actions { display: flex; align-items: flex-start; justify-content: flex-end; gap: 8px; }
.compact-button { padding: 8px 11px; font-size: .78rem; white-space: nowrap; }
.restore-details { text-align: left; }
.restore-details[open] { min-width: 320px; }
.restore-details > summary { list-style: none; }
.restore-details > summary::-webkit-details-marker { display: none; }
.restore-confirmation { width: 320px; margin-top: 8px; padding: 18px; border: 1px solid #e0adad; border-radius: 12px; background: white; box-shadow: 0 10px 28px rgba(44, 18, 18, .12); white-space: normal; }
.restore-confirmation p { margin: 0 0 13px; color: var(--danger); line-height: 1.4; }
.restore-confirmation label { display: block; margin-bottom: 7px; font-size: .78rem; }
.restore-confirmation .form-control { margin-bottom: 10px; }
.restore-confirmation .danger-button { width: 100%; }
.reset-panel { border-color: #e0b5b5; }
.reset-panel-copy { display: flex; align-items: flex-start; gap: 18px; }
.reset-panel-copy .danger-symbol { flex: 0 0 auto; margin: 0; }
.reset-panel-copy h2 { margin: 4px 0 7px; }
.reset-panel-copy p { margin: 0 0 5px; line-height: 1.5; }
.reset-form { margin-top: 24px; padding-top: 20px; border-top: 1px solid #ecd0d0; }
.reset-form > label { display: block; margin-bottom: 8px; font-size: .82rem; }
.reset-form > div { display: flex; gap: 10px; }
.reset-form .form-control { max-width: 360px; }
.reset-form .danger-button { white-space: nowrap; }

@media (max-width: 720px) {
    .import-table .decision-cell { min-width: 250px; }
    .container-import-grid { grid-template-columns: 1fr; }
    .container-import-grid .form-field-wide { grid-column: 1; }
    .backup-overview-grid { grid-template-columns: 1fr; }
    .backup-action-card { flex-direction: column; }
    .reset-form > div { align-items: stretch; flex-direction: column; }
    .reset-form .form-control { max-width: none; }
}
