* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: #f5f6f8;
    color: #1f2937;
}

.app-layout {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 250px;
    background: #111827;
    color: white;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
}

.brand {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 36px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar nav a {
    color: #d1d5db;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 7px;
}

.sidebar nav a:hover {
    background: #1f2937;
    color: white;
}

.nav-section {
    color: #6b7280;
    font-size: 11px;
    text-transform: uppercase;
    margin: 25px 12px 7px;
}

.sidebar-user {
    margin-top: auto;
    border-top: 1px solid #374151;
    padding-top: 18px;
}

.sidebar-user small {
    color: #9ca3af;
}

.sidebar-user form {
    margin-top: 12px;
}

.sidebar-user button {
    background: transparent;
    color: #d1d5db;
    border: 1px solid #4b5563;
    border-radius: 6px;
    padding: 7px 12px;
    cursor: pointer;
}

.main-content {
    flex: 1;
    padding: 36px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    margin: 0;
    font-size: 28px;
}

.page-header p {
    margin: 6px 0 0;
    color: #6b7280;
}

.cards {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(190px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 22px;
    border: 1px solid #e5e7eb;
}

.card span {
    display: block;
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 10px;
}

.card strong {
    font-size: 25px;
}

.panel {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 24px;
}

.panel h2 {
    margin-top: 0;
    font-size: 18px;
}

.empty-state {
    padding: 35px;
    text-align: center;
    color: #9ca3af;
}

.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 7px;
    cursor: pointer;

    font-family: inherit;
    font-size: 14px;
    font-weight: 500;

    text-decoration: none;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.primary-button {
    background: #111827;
    color: #ffffff;

    border: 1px solid #111827;

    padding: 10px 16px;
}

.primary-button:hover {
    background: #1f2937;
    border-color: #1f2937;
    color: #ffffff;
}

.secondary-button {
    background: #ffffff;
    color: #374151;

    border: 1px solid #d1d5db;

    padding: 8px 12px;
}

.secondary-button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
}

.budget-structure {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.budget-category {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.category-header {
    padding: 16px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background: #ffffff;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-budget-totals {
    display: grid;

    grid-template-columns:
        120px
        repeat(5, 120px);

    gap: 16px;
    align-items: center;

    text-align: right;
}

.category-total-label {
    color: #6b7280;

    font-size: 10px;
    font-weight: 600;

    text-transform: uppercase;
}

.category-budget-totals strong {
    font-size: 14px;
    font-weight: 700;
}

.category-code,
.subcategory-code {
    font-family: monospace;
    font-weight: 600;
}

.category-code {
    background: #f3f4f6;
    padding: 5px 8px;
    border-radius: 5px;
}

.subcategory-list {
    border-top: 1px solid #e5e7eb;
}

.subcategory-row {
    display: grid;
    grid-template-columns:
        100px
        minmax(0, 1fr)
        180px
        auto;

    align-items: center;
    gap: 16px;

    padding: 14px 20px 14px 40px;

    border-bottom: 1px solid #f3f4f6;
}

.subcategory-row:last-child {
    border-bottom: 0;
}

.category-empty {
    border-top: 1px solid #e5e7eb;
    padding: 18px 40px;
    color: #9ca3af;
}

.status-inactive {
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 12px;
}

.form-panel {
    max-width: 700px;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 7px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;

    padding: 10px 12px;

    border: 1px solid #d1d5db;
    border-radius: 7px;

    background: #ffffff;

    font-family: inherit;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6b7280;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: #6b7280;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 30px;
}

.cancel-button {
    color: #4b5563;
    text-decoration: none;
    padding: 10px 14px;
}

.form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 7px;
    margin-bottom: 22px;
}

.subcategory-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-actions,
.subcategory-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
}

.inline-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
}

.category-actions .secondary-button,
.subcategory-actions .secondary-button {
    white-space: nowrap;
}

.projects-table {
    width: 100%;
}

.projects-table-header,
.projects-table-row {
    display: grid;
    grid-template-columns:
        130px
        minmax(220px, 2fr)
        minmax(180px, 1.5fr)
        150px
        auto;

    gap: 18px;
    align-items: center;
}

.projects-table-header {
    padding: 0 12px 12px;

    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;

    border-bottom: 1px solid #e5e7eb;
}

.projects-table-row {
    padding: 15px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.projects-table-row:last-child {
    border-bottom: 0;
}

.project-code {
    font-family: monospace;
    font-weight: 600;
}

.project-status {
    display: inline-flex;
    width: fit-content;

    background: #f3f4f6;
    border-radius: 12px;

    padding: 4px 9px;

    font-size: 12px;
    font-weight: 500;
}

.table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.users-table {
    width: 100%;
}

.users-table-header,
.users-table-row {
    display: grid;

    grid-template-columns:
        minmax(180px, 1.3fr)
        minmax(240px, 1.8fr)
        180px
        100px
        auto;

    gap: 18px;
    align-items: center;
}

.users-table-header {
    padding: 0 12px 12px;

    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;

    border-bottom: 1px solid #e5e7eb;
}

.users-table-row {
    padding: 15px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.users-table-row:last-child {
    border-bottom: 0;
}

.role-badge {
    display: inline-flex;
    width: fit-content;

    background: #f3f4f6;
    border-radius: 12px;

    padding: 4px 9px;

    font-size: 12px;
    font-weight: 500;
}

.login-body {
    margin: 0;
    min-height: 100vh;
    background: #f5f6f8;
}

.login-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, 42%) 1fr;
}


/* Pannello sinistro */

.login-brand-panel {
    background: #111827;
    color: #ffffff;

    padding: 55px;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-brand-content {
    margin-top: auto;
    margin-bottom: auto;
    max-width: 480px;
}

.login-logo {
    font-size: 25px;
    font-weight: 700;
    letter-spacing: 1.5px;

    margin-bottom: 50px;
}

.login-brand-content h1 {
    margin: 0 0 18px;

    font-size: 38px;
    line-height: 1.15;
}

.login-brand-content p {
    margin: 0;

    max-width: 380px;

    color: #9ca3af;

    font-size: 17px;
    line-height: 1.6;
}

.login-brand-footer {
    color: #6b7280;
    font-size: 12px;
}


/* Pannello login */

.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;

    padding: 40px;
}

.login-card {
    width: 100%;
    max-width: 420px;

    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 12px;

    padding: 40px;

    box-shadow:
        0 10px 30px rgba(17, 24, 39, 0.06);
}

.login-card h2 {
    margin: 0;
    font-size: 27px;
}

.login-subtitle {
    margin: 8px 0 32px;
    color: #6b7280;
}

.login-button {
    width: 100%;
    margin-top: 5px;
}

.login-help {
    margin-top: 25px;

    color: #9ca3af;

    text-align: center;
    font-size: 12px;
}

.login-mobile-logo {
    display: none;
}


/* Mobile */

@media (max-width: 800px) {

    .login-layout {
        display: block;
    }

    .login-brand-panel {
        display: none;
    }

    .login-form-panel {
        min-height: 100vh;
        padding: 24px;
    }

    .login-card {
        padding: 30px;
    }

    .login-mobile-logo {
        display: block;

        margin-bottom: 35px;

        font-size: 22px;
        font-weight: 700;
        letter-spacing: 1px;
    }

}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);

    display: flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    padding: 0;
    border: 0;
    background: transparent;

    color: #6b7280;
    cursor: pointer;

    font-size: 18px;
}

.password-toggle:hover {
    color: #111827;
}

.pm-selection {
    display: flex;
    flex-direction: column;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    overflow: hidden;
}

.pm-option {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 12px 14px;

    cursor: pointer;

    border-bottom: 1px solid #f3f4f6;
}

.pm-option:last-child {
    border-bottom: 0;
}

.pm-option:hover {
    background: #f9fafb;
}

.pm-option input {
    width: auto;
    margin: 0;
}

.pm-option-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pm-option-info strong {
    font-size: 14px;
}

.pm-option-info span {
    color: #6b7280;
    font-size: 12px;
}

.form-notice {
    padding: 12px 14px;

    background: #f9fafb;

    border: 1px solid #e5e7eb;
    border-radius: 7px;

    color: #6b7280;
}

.project-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.info-label {
    display: block;
    margin-bottom: 5px;

    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
}

.project-section {
    margin-top: 20px;
}

.assigned-user {
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.assigned-user:last-child {
    border-bottom: 0;
}

.assigned-user div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.assigned-user span {
    color: #6b7280;
    font-size: 13px;
}

.project-notes {
    white-space: pre-line;
}

.audit-table {
    width: 100%;
}

.audit-table-header,
.audit-table-row {
    display: grid;

    grid-template-columns:
        155px
        minmax(160px, 1fr)
        minmax(170px, 1fr)
        110px
        minmax(220px, 1.5fr);

    gap: 18px;
    align-items: center;
}

.audit-table-header {
    padding: 0 12px 12px;

    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;

    border-bottom: 1px solid #e5e7eb;
}

.audit-table-row {
    padding: 14px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.audit-table-row:last-child {
    border-bottom: 0;
}

.audit-date {
    color: #6b7280;
    font-size: 13px;
}

.audit-action {
    font-weight: 500;
}

.audit-details {
    display: flex;
    flex-direction: column;
    gap: 3px;

    color: #6b7280;
    font-size: 13px;
}

.audit-project-link {
    color: #111827;
    font-weight: 600;
    text-decoration: none;
}

.audit-project-link:hover {
    text-decoration: underline;
}

.project-nav {
    display: flex;
    gap: 6px;

    margin-bottom: 24px;

    border-bottom: 1px solid #e5e7eb;
}

.project-nav-link {
    padding: 10px 14px;

    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;

    border-bottom: 2px solid transparent;
}

.project-nav-link:hover {
    color: #111827;
}

.project-nav-link.active {
    color: #111827;
    border-bottom-color: #111827;
}

.budget-initialize-form {
    margin-top: 20px;
}

.budget-summary {
    display: flex;
    justify-content: flex-end;
    gap: 12px;

    margin-bottom: 20px;
}

.budget-summary > div {
    min-width: 220px;

    padding: 16px 20px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.budget-summary span {
    display: block;

    margin-bottom: 5px;

    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
}

.budget-summary strong {
    font-size: 22px;
}

.economic-summary {
    margin-bottom: 20px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;

    overflow: hidden;
}

.economic-summary-title {
    padding: 18px 20px;

    border-bottom: 1px solid #e5e7eb;
}

.economic-summary-title h2 {
    margin: 0 0 4px 0;

    font-size: 18px;
}

.economic-summary-title p {
    margin: 0;

    color: #6b7280;
    font-size: 13px;
}

.economic-summary-grid {
    display: grid;

    grid-template-columns:
        minmax(180px, 1.4fr)
        repeat(5, minmax(125px, 1fr));

    align-items: center;
    gap: 16px;

    padding: 13px 20px;

    border-bottom: 1px solid #f3f4f6;
}

.economic-summary-grid > span:not(:first-child),
.economic-summary-grid > strong:not(:first-child) {
    text-align: right;
}

.economic-summary-header {
    background: #f9fafb;

    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.economic-summary-total {
    background: #f9fafb;

    border-bottom: 0;
}

.economic-summary-total strong {
    font-size: 15px;
}

.economic-variance {
    font-weight: 600;
}

.variance-positive {
    color: #b91c1c;
}

.variance-negative {
    color: #047857;
}

.budget-project-structure {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.project-budget-row {
    display: grid;

    grid-template-columns:
        85px
        minmax(210px, 1fr)
        150px
        120px
        120px
        120px
        120px
        120px;

    align-items: center;
    gap: 16px;

    padding: 14px 20px 14px 40px;

    border-bottom: 1px solid #f3f4f6;
}

.project-budget-row:last-child {
    border-bottom: 0;
}

.budget-row-header {
    padding-top: 9px;
    padding-bottom: 9px;

    background: #f9fafb;

    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

@media (max-width: 1100px) {
    .accounting-selection-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1000px) {

    .budget-summary {
        flex-wrap: wrap;
    }

    .budget-summary > div {
        flex: 1 1 220px;
    }

    .budget-project-structure {
        overflow-x: auto;
    }

    .project-budget-row {
        min-width: 1200px;
    }
    
    .budget-cost-type-column {
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    .category-header {
        min-width: 1200px;
    }

    .economic-summary {
        overflow-x: auto;
    }

    .economic-summary-grid {
        min-width: 1000px;
    }
}

.budget-amount {
    text-align: right;
}

.budget-commitment-link {
    color: inherit;
    font-weight: 400;
    text-decoration: none;
    border-bottom: 1px dotted #9ca3af;
}

.budget-commitment-link:hover {
    border-bottom-style: solid;
}

.budget-commitment-link:hover {
    border-bottom-style: solid;
}

.project-budget-edit-row {
    display: grid;

    grid-template-columns:
        100px
        minmax(0, 1fr)
        190px
        180px
        auto;

    align-items: center;
    gap: 16px;

    padding: 12px 20px 12px 40px;

    border-bottom: 1px solid #f3f4f6;
}

.budget-cost-type-field {
    min-width: 0;
}

.budget-cost-type-select {
    width: 100%;
    min-width: 0;

    padding: 9px 10px;

    border: 1px solid #d1d5db;
    border-radius: 7px;

    background: #ffffff;
}

.project-budget-edit-row:last-child {
    border-bottom: 0;
}

.budget-input-wrapper {
    display: flex;
    align-items: center;

    border: 1px solid #d1d5db;
    border-radius: 7px;

    background: #ffffff;

    overflow: hidden;
}

.budget-input-wrapper span {
    padding-left: 12px;

    color: #6b7280;
}

.budget-input-wrapper input {
    width: 100%;

    padding: 9px 12px 9px 7px;

    border: 0;
    outline: 0;

    background: transparent;

    text-align: right;
    font-family: inherit;
    font-size: 14px;
}

.budget-edit-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;

    gap: 12px;

    margin-top: 24px;
    padding-bottom: 30px;
}

.budget-structure-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 20px;
}

.form-divider {
    margin: 10px 0 25px;
    border: 0;
    border-top: 1px solid #e5e7eb;
}

.form-section-title {
    margin: 0 0 18px;
    font-weight: 600;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background: rgba(17, 24, 39, 0.45);
}

.modal-overlay[hidden] {
    display: none;
}

.modal-dialog {
    width: 100%;
    max-width: 460px;

    padding: 28px;

    background: #ffffff;
    border-radius: 12px;

    box-shadow:
        0 20px 50px rgba(17, 24, 39, 0.18);
}

.modal-dialog h2 {
    margin: 0 0 14px;
}

.modal-dialog p {
    color: #6b7280;
}

.modal-item {
    margin: 18px 0;
    padding: 14px;

    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.modal-warning {
    font-size: 13px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;

    margin-top: 24px;
}

.suppliers-table {
    width: 100%;
}

.suppliers-table-header,
.suppliers-table-row {
    display: grid;

    grid-template-columns:
        minmax(220px, 2fr)
        minmax(130px, 1fr)
        minmax(130px, 1fr)
        minmax(200px, 1.5fr)
        100px
        auto;

    gap: 16px;
    align-items: center;
}

.suppliers-table-header {
    padding: 0 12px 12px;

    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;

    border-bottom: 1px solid #e5e7eb;
}

.suppliers-table-row {
    padding: 14px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.suppliers-table-row:last-child {
    border-bottom: 0;
}

.suppliers-table-row > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.table-secondary {
    color: #6b7280;
    font-size: 12px;
}

.status-active {
    display: inline-block;

    padding: 4px 8px;

    background: #f0fdf4;
    color: #166534;

    border-radius: 999px;

    font-size: 12px;
    font-weight: 500;
}

.form-group textarea {
    width: 100%;
    padding: 10px 12px;

    border: 1px solid #d1d5db;
    border-radius: 7px;

    font-family: inherit;
    font-size: 14px;

    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: #6b7280;
}

/* Google Places - autocomplete indirizzo fornitori */

#google-address-autocomplete {
    width: 100%;
}

#google-address-autocomplete gmp-place-autocomplete {
    display: block;
    width: 100%;

    color-scheme: light;

    --gmpx-color-surface: #ffffff;
    --gmpx-color-on-surface: #111827;
    --gmpx-color-on-surface-variant: #6b7280;
    --gmpx-color-primary: #111827;
    --gmpx-color-outline: #d1d5db;

    font-family: inherit;
    font-size: 14px;

    border: 1px solid #d1d5db !important;
    border-radius: 7px !important;
    outline: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
}

/*
 * Il componente Google espone alcune parti del controllo
 * attraverso ::part().
 */
#google-address-autocomplete gmp-place-autocomplete::part(input) {
    min-height: 46px;

    padding: 10px 12px;

    background: transparent;

    border: none !important;
    border-radius: 0;

    outline: none !important;
    box-shadow: none !important;

    color: #111827;

    font-family: inherit;
    font-size: 14px;

    box-sizing: border-box;
}

#google-address-autocomplete gmp-place-autocomplete::part(input):focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.form-help {
    display: block;

    margin-top: 6px;

    color: #6b7280;

    font-size: 12px;
    line-height: 1.4;
}

.form-help {
    display: block;
    margin-top: 6px;

    color: #6b7280;
    font-size: 12px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
}

.supplier-contacts {
    width: 100%;
}

.supplier-contact-header,
.supplier-contact-row {
    display: grid;

    grid-template-columns:
        minmax(180px, 1.5fr)
        minmax(220px, 1.5fr)
        minmax(150px, 1fr)
        90px
        230px;

    column-gap: 20px;
    align-items: center;
}

.supplier-contact-header {
    padding: 0 0 10px;

    color: #6b7280;

    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;

    border-bottom: 1px solid #e5e7eb;
}

.supplier-contact-status {
    display: flex;
    align-items: center;
}

.supplier-contact-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.supplier-contact-row {
    padding: 16px 0;

    border-bottom: 1px solid #f3f4f6;
}

.supplier-contact-row:last-child {
    border-bottom: 0;
}

.supplier-contact-person {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.supplier-contact-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.supplier-contact-header span:nth-child(4),
.supplier-contact-status {
    justify-self: center;
}

.supplier-contact-header span:nth-child(5),
.supplier-contact-actions {
    justify-self: end;
}

.danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    margin-top: 32px;
    padding-top: 24px;

    border-top: 1px solid #e5e7eb;
}

.danger-zone-text {
    min-width: 0;
}

.danger-zone-text strong {
    display: block;
    margin-bottom: 5px;
}

.danger-zone-text p {
    margin: 0;

    color: #6b7280;
    font-size: 13px;
    line-height: 1.5;
}

.danger-button {
    padding: 9px 14px;

    border: 1px solid #dc2626;
    border-radius: 7px;

    background: #ffffff;
    color: #b91c1c;

    font-family: inherit;
    font-size: 14px;
    font-weight: 500;

    cursor: pointer;
}

.danger-button:hover {
    background: #fef2f2;
}

.supplier-categories-table {
    width: 100%;
}

.supplier-categories-header,
.supplier-categories-row {
    display: grid;

    grid-template-columns:
        120px
        minmax(250px, 1fr)
        100px
        120px;

    column-gap: 20px;
    align-items: center;
}

.supplier-categories-header {
    padding: 0 12px 10px;

    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;

    border-bottom: 1px solid #e5e7eb;
}

.supplier-categories-row {
    padding: 14px 12px;

    border-bottom: 1px solid #f3f4f6;
}

.supplier-categories-row:last-child {
    border-bottom: 0;
}

.supplier-category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.supplier-category-tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 7px 10px;

    background: #f9fafb;

    border: 1px solid #e5e7eb;
    border-radius: 7px;

    font-size: 13px;
}

.supplier-category-tag strong {
    font-family: monospace;
    font-size: 12px;
}

.supplier-category-selection {
    display: flex;
    flex-direction: column;

    border: 1px solid #e5e7eb;
    border-radius: 8px;

    overflow: hidden;
}

.supplier-category-option {
    display: flex;
    align-items: center;
    gap: 14px;

    padding: 14px 16px;

    cursor: pointer;

    border-bottom: 1px solid #f3f4f6;
}

.supplier-category-option:last-child {
    border-bottom: 0;
}

.supplier-category-option:hover {
    background: #f9fafb;
}

.supplier-category-option input {
    width: 18px;
    height: 18px;
}

.supplier-category-option > div {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.supplier-category-option strong {
    min-width: 70px;
    font-family: monospace;
}

.supplier-category-option span {
    color: #374151;
}

.supplier-category-tag-inactive {
    opacity: 0.65;
    background: #f9fafb;
}

.supplier-category-inactive-label {
    margin-left: 4px;

    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.rfq-table {
    width: 100%;
}

.rfq-table-header,
.rfq-table-row {
    display: grid;

    grid-template-columns:
        160px
        170px
        minmax(260px, 1fr)
        110px
        130px
        110px;

    column-gap: 20px;
    align-items: center;
}

.rfq-table-header {
    padding: 0 12px 10px;

    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;

    border-bottom: 1px solid #e5e7eb;
}

.rfq-table-row {
    padding: 14px 12px;

    border-bottom: 1px solid #f3f4f6;
}

.rfq-table-row:last-child {
    border-bottom: 0;
}

.table-link {
    color: inherit;
    text-decoration: none;
}

.table-link:hover {
    text-decoration: underline;
}

.rfq-items-table {
    width: 100%;
}

.rfq-items-row .table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.rfq-items-header,
.rfq-items-row {
    display: grid;

    grid-template-columns:
        70px
        minmax(300px, 1fr)
        120px
        80px
        minmax(180px, 0.7fr)
        210px;

    column-gap: 20px;
    align-items: center;
}

.rfq-items-header {
    padding: 0 12px 10px;

    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;

    border-bottom: 1px solid #e5e7eb;
}

.rfq-items-row {
    padding: 14px 12px;

    border-bottom: 1px solid #f3f4f6;
}

.rfq-items-row:last-child {
    border-bottom: 0;
}

.rfq-supplier-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rfq-supplier-option {
    display: grid;

    grid-template-columns:
        36px
        minmax(280px, 1fr)
        minmax(260px, 0.8fr);

    gap: 18px;
    align-items: center;

    padding: 16px;

    border: 1px solid #e5e7eb;
    border-radius: 8px;

    background: #ffffff;
}

.rfq-supplier-select {
    display: flex;
    justify-content: center;
}

.rfq-supplier-select input {
    width: 18px;
    height: 18px;
}

.rfq-supplier-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.rfq-supplier-info label {
    cursor: pointer;
}

.rfq-supplier-contact {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rfq-supplier-contact label {
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
}

.rfq-supplier-contact select {
    width: 100%;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rfq-issue-checks {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rfq-issue-check {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rfq-issue-warnings {
    margin-top: 20px;
    padding: 14px 16px;

    border: 1px solid #e5e7eb;
    border-radius: 8px;

    background: #f9fafb;
}

.rfq-issue-warnings ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.rfq-revision-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 12px 0;

    border-bottom: 1px solid #f3f4f6;
}

.rfq-revision-row:last-child {
    border-bottom: 0;
}

.rfq-revision-row > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.rfq-revision-items-header,
.rfq-revision-items-row {
    display: grid;

    grid-template-columns:
        70px
        minmax(300px, 1fr)
        120px
        80px
        minmax(180px, 0.7fr);

    column-gap: 20px;
    align-items: center;
}

.rfq-revision-items-header,
.rfq-revision-documents-header {
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.rfq-revision-items-header,
.rfq-revision-items-row {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.rfq-revision-documents-header,
.rfq-revision-documents-row {
    display: grid;

    grid-template-columns:
        minmax(200px, 1fr)
        minmax(180px, 0.8fr)
        100px
        minmax(240px, 1.2fr)
        100px;

    gap: 16px;
    align-items: center;

    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.rfq-hash {
    font-family: monospace;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.quotation-supplier-block {
    padding: 16px 0;
    border-bottom: 1px solid #e5e7eb;
}

.quotation-supplier-block:last-child {
    border-bottom: 0;
}

.quotation-supplier-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 12px;
}

.quotation-supplier-header > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.quotation-row {
    display: grid;
    grid-template-columns:
        minmax(180px, 1fr)
        120px
        140px
        120px
        100px;

    gap: 16px;
    align-items: center;

    padding: 12px;

    border-top: 1px solid #f3f4f6;
}

.quotation-row > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.quotation-empty-state {
    margin-top: 8px;
}

.quotation-items-header,
.quotation-items-row {
    display: grid;

    grid-template-columns:
        55px
        minmax(220px, 1fr)
        90px
        60px
        110px
        120px
        150px
        210px;

    gap: 16px;
    align-items: center;
}

.quotation-items-row .table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: nowrap;
}

.quotation-items-row .table-actions .secondary-button,
.quotation-items-row .table-actions .danger-button {
    white-space: nowrap;
}

.quotation-items-header {
    padding: 0 12px 10px;

    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;

    border-bottom: 1px solid #e5e7eb;
}

.quotation-items-row {
    padding: 14px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.quotation-items-row:last-child {
    border-bottom: 0;
}

.quotation-comparison-wrapper {
    width: 100%;
    overflow-x: auto;
}

.quotation-comparison-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
}

.quotation-comparison-table th,
.quotation-comparison-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

.quotation-comparison-table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
}

.quotation-comparison-table th:not(:first-child),
.quotation-comparison-table td:not(:first-child) {
    min-width: 220px;
}

.comparison-description-column {
    min-width: 280px;
}

.comparison-subtitle {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
}

.comparison-line-total {
    display: block;
    margin-top: 5px;
    font-size: 12px;
}

.comparison-included {
    font-weight: 500;
}

.comparison-section-row td {
    padding-top: 22px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #6b7280;
}

.comparison-additional-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 10px;
}

.comparison-additional-item:last-child {
    margin-bottom: 0;
}

.comparison-total-row td {
    border-top: 2px solid #d1d5db;
    font-size: 15px;
}

.comparison-evaluate-button {
    display: inline-block;
    margin-top: 10px;
}

.evaluation-scope-table {
    width: 100%;
}

.evaluation-scope-header,
.evaluation-scope-row {
    display: grid;
    grid-template-columns:
        80px
        minmax(300px, 1fr)
        220px
        140px;

    column-gap: 20px;
    align-items: center;
}

.evaluation-scope-header {
    padding: 0 12px 10px;

    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;

    border-bottom: 1px solid #e5e7eb;
}

.evaluation-scope-row {
    padding: 14px 12px;
    border-bottom: 1px solid #f3f4f6;
}

.evaluation-scope-row:last-child {
    border-bottom: 0;
}

.selection-type-options {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.selection-type-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;

    padding: 14px 16px;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    cursor: pointer;
}

.selection-type-option input {
    margin-top: 4px;
}

.selection-type-option span {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.selection-type-option small {
    color: #6b7280;
}

.partial-selection-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.partial-selection-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;

    padding: 12px 14px;

    border: 1px solid #e5e7eb;
    border-radius: 8px;

    cursor: pointer;
}

.partial-selection-item input {
    margin-top: 4px;
}

.partial-selection-item span {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.partial-selection-item small {
    color: #6b7280;
}

.assignment-summary {
    margin: 12px 0 16px;
    padding: 12px 14px;

    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.assignment-conflict {
    border-width: 2px;
}

.assignment-list {
    width: 100%;
}

.assignment-row {
    display: grid;
    grid-template-columns:
        minmax(320px, 1fr)
        minmax(280px, 1fr);

    gap: 24px;
    align-items: center;

    padding: 14px 12px;

    border-bottom: 1px solid #f3f4f6;
}

.assignment-row:last-child {
    border-bottom: 0;
}

.assignment-item-description {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.assignment-detail {
    display: block;
    margin-top: 4px;

    font-size: 12px;
    color: #6b7280;
}

.budget-source-badge {
    display: inline-block;

    margin-left: 8px;

    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.budget-source-post-baseline {
    background: #f3e8ff;
    color: #7e22ce;
}

.budget-source-forecast {
    background: #fff7ed;
    color: #c2410c;
}

.post-baseline-row {
    background: #fcfcfd;
}

.budget-source-manual {
    color: #6b7280;
}

.budget-source-rfq {
    color: #2563eb;
}

.budget-item-description {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.budget-item-description .budget-source-badge {
    margin-left: 0;
    white-space: nowrap;
}

.budget-source-link {
    text-decoration: none;
}

.budget-source-link:hover {
    text-decoration: underline;
}

.budget-input-locked {
    background: #f3f4f6;
}

.budget-input-locked input {
    background: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

.budget-item-locked-label {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.budget-rdo-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.budget-rdo-lock {
    display: inline-flex;
    align-items: center;

    padding: 5px 9px;

    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;

    color: #6b7280;
    font-size: 11px;
    font-weight: 600;

    white-space: nowrap;
}

.budget-remove-source-button {
    white-space: nowrap;
}

.budget-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.budget-title-row h1 {
    margin: 0;
}

.budget-status-badge {
    display: inline-flex;
    align-items: center;

    padding: 6px 10px;
    border-radius: 999px;

    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.budget-status-badge.consolidated {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

.budget-status-badge.draft {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.cost-type-options {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(240px, 1fr)
    );
    gap: 12px;
}

.cost-type-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;

    padding: 14px;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    cursor: pointer;
}

.cost-type-option input {
    margin-top: 3px;
}

.cost-type-option span {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cost-type-option small {
    font-weight: 400;
    line-height: 1.4;
}

.budget-classification-summary {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(150px, 1fr)
    );
    gap: 12px;
    margin-bottom: 20px;
}

.budget-classification-summary > div {
    display: flex;
    flex-direction: column;
    gap: 4px;

    padding: 14px 16px;

    border: 1px solid #e5e7eb;
    border-radius: 8px;

    background: #fff;
}

.budget-classification-summary span {
    font-size: 12px;
    color: #6b7280;
}

.budget-classification-summary strong {
    font-size: 20px;
}

.subcategory-cost-type {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.cost-type-badge {
    display: inline-flex;
    align-items: center;

    padding: 5px 9px;
    border-radius: 999px;

    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;

    white-space: nowrap;
}

.cost-type-badge.plant {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

.cost-type-badge.complementary {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

.cost-type-badge.unclassified {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.latest-action-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.latest-action-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;

    padding: 18px;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    cursor: pointer;
}

.latest-action-option input {
    margin-top: 4px;
}

.latest-action-option span {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.latest-action-option small {
    color: #6b7280;
    line-height: 1.4;
}

.latest-action-section {
    margin-top: 24px;
}

.latest-item-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;

    margin-bottom: 22px;
}

.latest-item-summary > div {
    padding: 14px 16px;

    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.latest-item-summary span {
    display: block;
    margin-bottom: 4px;

    color: #6b7280;
    font-size: 11px;
    text-transform: uppercase;
}

@media (max-width: 900px) {
    .latest-action-options,
    .latest-item-summary {
        grid-template-columns: 1fr;
    }
}

.is-hidden {
    display: none !important;
}

.latest-mode-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.latest-mode-section h3 {
    margin: 0 0 18px 0;
    font-size: 18px;
}

.latest-existing-details {
    margin-top: 18px;
}

.latest-structure-box {
    margin: 18px 0 24px 0;

    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;

    overflow: hidden;
}

.latest-structure-title {
    padding: 12px 16px;

    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;

    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.latest-structure-category {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.latest-structure-category:last-child {
    border-bottom: 0;
}

.latest-structure-category > strong {
    display: block;
    margin-bottom: 10px;
}

.latest-structure-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 7px 12px;
    margin-top: 5px;

    background: #ffffff;
    border: 1px solid #eef0f2;
    border-radius: 6px;

    color: #374151;
    font-size: 13px;
}

@media (max-width: 900px) {
    .latest-structure-item {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* =========================================================
   ACCOUNTING IMPORT
   ========================================================= */

.accounting-import-summary {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.accounting-import-stat {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    background: #ffffff;
}

.accounting-import-stat span {
    display: block;
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 7px;
}

.accounting-import-stat strong {
    display: block;
    font-size: 24px;
    line-height: 1.2;
}

.accounting-file-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
}

.accounting-file-item small {
    display: block;
    color: #6b7280;
    margin-bottom: 5px;
}

.accounting-file-item div {
    font-weight: 500;
    overflow-wrap: anywhere;
}

.accounting-status {
    padding: 12px 14px;
    border-radius: 7px;
    margin-bottom: 18px;
    border: 1px solid;
}

.accounting-status-success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.accounting-status-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.accounting-status-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.accounting-issues {
    width: 100%;
    overflow-x: auto;
}

.accounting-issues table {
    width: 100%;
    border-collapse: collapse;
}

.accounting-issues th {
    text-align: left;
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
}

.accounting-issues td {
    padding: 11px 12px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.accounting-issues tbody tr:last-child td {
    border-bottom: none;
}

.accounting-import-section {
    margin-bottom: 22px;
}

.accounting-import-section h2 {
    margin-top: 0;
}

.accounting-import-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

.accounting-import-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

/* =========================================================
   ACCOUNTING REGISTER FILTERS
   ========================================================= */

.accounting-filter-form {
    margin: 20px 0 24px;
    padding: 18px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.accounting-filter-search {
    margin-bottom: 18px;
}

.accounting-filter-search label {
    display: block;
    font-weight: 600;
    margin-bottom: 7px;
}

.accounting-filter-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: white;
    font-family: inherit;
    font-size: 14px;
}

.accounting-filter-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px 18px;
}

.accounting-filter-grid .form-group {
    margin-bottom: 0;
}

.accounting-filter-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}

.accounting-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin: 18px 0 12px;
    color: #4b5563;
}

.accounting-sort-link {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.accounting-sort-link:hover {
    color: #111827;
    text-decoration: underline;
}

.accounting-pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 18px;
    margin-top: 24px;
}

.accounting-pagination > div:last-child {
    text-align: right;
}

.accounting-pagination-status {
    color: #6b7280;
    white-space: nowrap;
}

/* =========================================================
   ACCOUNTING AUTOCOMPLETE
   ========================================================= */

.accounting-autocomplete {
    position: relative;
}

.accounting-autocomplete-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 100;

    max-height: 320px;
    overflow-y: auto;

    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 7px;

    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.08);
}

.accounting-autocomplete-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    width: 100%;
    padding: 10px 12px;

    border: 0;
    border-bottom: 1px solid #f3f4f6;

    background: #ffffff;
    text-align: left;
    cursor: pointer;

    font-family: inherit;
}

.accounting-autocomplete-item:last-child {
    border-bottom: 0;
}

.accounting-autocomplete-item:hover {
    background: #f9fafb;
}

.accounting-autocomplete-type {
    margin-bottom: 3px;

    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.accounting-autocomplete-item strong {
    color: #111827;
    font-size: 14px;
    font-weight: 500;
}

.accounting-selection-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;

    margin-top: 14px;
    margin-bottom: 24px;
}

.accounting-report-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;

    margin: 14px 0 18px;
}

.accounting-selection-item {
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
}

.accounting-selection-item span {
    display: block;
    margin-bottom: 6px;
    color: #6b7280;
    font-size: 13px;
}

.accounting-selection-item strong {
    display: block;
    margin-bottom: 4px;
    font-size: 18px;
}

.accounting-selection-item > div {
    color: #4b5563;
    font-size: 14px;
}

.accounting-selection-total {
    background: #f9fafb;
}

/* =========================================================
   ACCOUNTING INVOICE REPORT
   ========================================================= */

.invoice-report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.invoice-report-header h1 {
    margin: 0;
}

.invoice-report-header p {
    margin: 6px 0 0;
    color: #6b7280;
}

.invoice-report-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.invoice-report-section {
    margin-bottom: 20px;
}

.invoice-report-filter-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
}

.invoice-report-filter-grid span,
.invoice-report-summary span {
    display: block;
    margin-bottom: 5px;
    color: #6b7280;
    font-size: 13px;
}

.invoice-report-filter-grid strong {
    font-size: 14px;
}

.invoice-report-summary {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(160px, 1fr));
    gap: 14px;
}

.invoice-report-summary > div {
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.invoice-report-summary strong {
    display: block;
    font-size: 20px;
}

.invoice-report-summary small {
    display: block;
    margin-top: 5px;
    color: #4b5563;
}

.invoice-report-net {
    background: #f9fafb;
}

.invoice-report-table {
    width: 100%;
    overflow-x: auto;
}

.invoice-report-table table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-report-table th {
    padding: 9px 10px;
    border-bottom: 1px solid #d1d5db;
    text-align: left;
    color: #6b7280;
    font-size: 12px;
}

.invoice-report-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
    font-size: 13px;
}


/* =========================================================
   PRINT
   ========================================================= */

@media print {

    @page {
        size: A4 landscape;
        margin: 12mm;
    }

    body {
        background: #ffffff;
    }

    .sidebar,
    .no-print {
        display: none !important;
    }

    .app-layout,
    .main-content,
    .content {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .invoice-report-header {
        margin-bottom: 14px;
    }

    .invoice-report-header h1 {
        font-size: 22px;
    }

    .invoice-report-section {
        break-inside: avoid;
        margin-bottom: 14px;
        padding: 14px;
        box-shadow: none;
    }

    .invoice-report-table {
        overflow: visible;
    }

    .invoice-report-table table {
        font-size: 10px;
    }

    .invoice-report-table th,
    .invoice-report-table td {
        padding: 5px 6px;
    }

    .invoice-report-table tr {
        break-inside: avoid;
    }

    .invoice-report-summary > div {
        padding: 10px;
    }

    .invoice-report-summary strong {
        font-size: 16px;
    }

}

.invoice-report-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-top: 12px;
}

.invoice-report-meta span {
    display: block;
    margin-bottom: 3px;
    color: #6b7280;
    font-size: 12px;
}

.invoice-report-meta strong {
    font-size: 13px;
}

.invoice-report-chart {
    width: 100%;
    min-height: 260px;
    margin: 16px 0 24px;
    padding: 12px;

    box-sizing: border-box;

    border: 1px solid #e5e7eb;
    border-radius: 8px;

    background: #ffffff;
}

.invoice-report-chart svg {
    display: block;
    width: 100%;
    height: auto;
}

.invoice-chart-label {
    font-size: 6px;
    fill: #6b7280;
}

.invoice-chart-value {
    font-size: 8px;
    font-weight: 600;
    fill: #111827;
}

.invoice-chart-axis {
    stroke: #d1d5db;
    stroke-width: 1;
}

.invoice-chart-zero {
    stroke: #6b7280;
    stroke-width: 1;
}

@media print {

    .invoice-report-chart {
        min-height: 0;
        padding: 8px;
        break-inside: avoid;
    }

    .invoice-report-chart svg {
        max-height: 230px;
    }

}

.invoice-chart-line {
    fill: none;
    stroke: #111827;
    stroke-width: 1.8;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.invoice-chart-point {
    fill: #ffffff;
    stroke: #111827;
    stroke-width: 1.4;
}

.invoice-report-footer {
    margin-top: 24px;
    padding-top: 10px;

    border-top: 1px solid #e5e7eb;

    color: #6b7280;
    font-size: 11px;
    text-align: center;
}

.invoice-chart-grid {
    stroke: #e5e7eb;
    stroke-width: 1;
}

.invoice-chart-axis-label {
    fill: #6b7280;
    font-size: 6px;
}

.invoice-chart-legend {
    fill: #4b5563;
    font-size: 6px;
}

.invoice-chart-net-value {
    fill: #111827;
    font-size: 6px;
    font-weight: 600;
}

.invoice-chart-bar-invoices {
    fill: #111827;
}

.invoice-chart-bar-credit {
    fill: #9ca3af;
}

.invoice-chart-zero {
    stroke: #6b7280;
    stroke-width: 1.5;
}

.invoice-chart-tooltip {
    position: fixed;
    z-index: 10000;

    min-width: 230px;
    max-width: 320px;

    padding: 12px 14px;

    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;

    box-shadow:
        0 8px 24px
        rgba(15, 23, 42, 0.14);

    color: #111827;
    font-size: 12px;

    pointer-events: none;
}

.invoice-chart-tooltip[hidden] {
    display: none;
}

.invoice-chart-tooltip-title {
    display: block;

    margin-bottom: 8px;
    padding-bottom: 7px;

    border-bottom: 1px solid #e5e7eb;

    font-size: 12px;
    font-weight: 700;
}

.invoice-chart-tooltip-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;

    gap: 20px;

    margin-top: 5px;
}

.invoice-chart-tooltip-row span {
    color: #6b7280;
}

.invoice-chart-tooltip-row strong {
    white-space: nowrap;
    font-variant-numeric:
        tabular-nums;
}

@media print {
    .invoice-chart-tooltip {
        display: none !important;
    }
}

.accounting-document-link {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

.accounting-document-link:hover {
    text-decoration: underline;
}

/* ==========================================
   REVALUE - DASHBOARD IMPUTAZIONE CONTABILE
   ========================================== */

.accounting-mapping-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.accounting-mapping-stats > div {
    min-width: 0;
}

.accounting-mapping-stats .info-label {
    display: block;
    margin-bottom: 8px;
}

.accounting-mapping-stats strong {
    display: block;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
}

@media (max-width: 1100px) {
    .accounting-mapping-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .accounting-mapping-stats {
        grid-template-columns: 1fr;
    }
}


/* ==========================================
   REVALUE - TABELLA MAPPING CONTABILI
   ========================================== */

.accounting-mappings-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 20px;
}

.accounting-mappings-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.accounting-mappings-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.accounting-mappings-table td {
    padding: 16px;
    font-size: 14px;
    vertical-align: middle;
    border-bottom: 1px solid #edf0f4;
}

.accounting-mappings-table tbody tr:last-child td {
    border-bottom: none;
}

.accounting-mappings-table tbody tr:hover {
    background-color: #f8fafc;
}

.accounting-mappings-table th:nth-child(1) {
    width: 20%;
}

.accounting-mappings-table th:nth-child(2) {
    width: 12%;
}

.accounting-mappings-table th:nth-child(3) {
    width: 33%;
}

.accounting-mappings-table th:nth-child(4) {
    width: 25%;
}

.accounting-mappings-table th:nth-child(5) {
    width: 10%;
}

.mapping-type-label {
    font-weight: 500;
    color: #334155;
}

.accounting-mappings-table .table-secondary {
    margin-left: 6px;
}

/* ==========================================
   REVALUE - LAYOUT CONSOLE MAPPING
   ========================================== */

.accounting-mapping-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.accounting-mapping-page > .panel {
    margin-top: 0;
    margin-bottom: 0;
}

/* ==========================================
   REVALUE - PAGINAZIONE MAPPING CONTABILI
   ========================================== */

.accounting-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.accounting-pagination-info {
    font-size: 14px;
    color: #64748b;
}

.accounting-pagination-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.accounting-pagination .pagination-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 600px) {
    .accounting-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .accounting-pagination-actions {
        justify-content: space-between;
    }
}

/* ==========================================
   REVALUE - RICERCA MAPPING CONTABILI
   ========================================== */

.accounting-mapping-search {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin: 24px 0;
}

.accounting-mapping-search .form-group {
    flex: 1;
    min-width: 250px;
    margin-bottom: 0;
}

.accounting-mapping-search input {
    width: 100%;
}

.accounting-mapping-search button,
.accounting-mapping-search .secondary-button {
    white-space: nowrap;
}

@media (max-width: 600px) {
    .accounting-mapping-search {
        flex-direction: column;
        align-items: stretch;
    }

    .accounting-mapping-search .form-group {
        width: 100%;
        min-width: 0;
    }
}

/* ==========================================
   REVALUE - AUTOCOMPLETE CONTABILITÀ
   ========================================== */

.accounting-autocomplete {
    position: relative;
    width: 100%;
}

.accounting-autocomplete-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 100;
    background: #ffffff;
    border: 1px solid #dce2e8;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    max-height: 320px;
    overflow-y: auto;
}

.accounting-autocomplete-results[hidden] {
    display: none;
}

.accounting-autocomplete-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid #edf0f4;
}

.accounting-autocomplete-item:last-child {
    border-bottom: none;
}

.accounting-autocomplete-item:hover,
.accounting-autocomplete-item.active {
    background: #f1f5f9;
}

.accounting-autocomplete-item strong {
    font-size: 13px;
    color: #0f172a;
}

.accounting-autocomplete-item span {
    font-size: 13px;
    color: #64748b;
}

/* ==========================================
   REVALUE - ORDINAMENTO VOCI CONTABILI
   ========================================== */

.accounting-mapping-search .form-group:has(
    #mapping-sort
) {
    flex: 0 0 220px;
    min-width: 180px;
}

.accounting-mapping-search select {
    width: 100%;
}

@media (max-width: 600px) {
    .accounting-mapping-search .form-group:has(
        #mapping-sort
    ) {
        flex: 1 1 100%;
        width: 100%;
    }
}

/* ==========================================
   REVALUE - FILTRO AFFIDABILITÀ
   ========================================== */

.accounting-mapping-search .form-group:has(
    #mapping-reliability
) {
    flex: 0 0 190px;
    min-width: 170px;
}

@media (max-width: 600px) {

    .accounting-mapping-search .form-group:has(
        #mapping-reliability
    ) {
        flex: 1 1 100%;
        width: 100%;
    }

}

/* ==========================================
   REVALUE - STATO IMPUTAZIONE CONTABILE
   ========================================== */

.accounting-mapping-state {
    white-space: nowrap;
}

.mapping-pending-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
}

.mapping-unassigned-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 12px;
    font-weight: 600;
}


/* ==========================================
   REVALUE - RIPRISTINO PASSWORD
========================================== */

.revalue-modal {
    width: min(520px, calc(100% - 32px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    margin: auto;
    padding: 0;
    border: 1px solid #dfe3ea;
    border-radius: 12px;
    background: #ffffff;
    color: #243044;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.revalue-modal::backdrop {
    background: rgba(15, 23, 42, 0.55);
}

.revalue-modal-content {
    padding: 28px;
}

.revalue-modal-content h2 {
    margin: 0 0 20px;
    font-size: 22px;
    font-weight: 600;
}

.revalue-modal-content p {
    line-height: 1.6;
    margin-bottom: 18px;
}

.revalue-modal-content .form-group {
    margin-bottom: 20px;
}

.revalue-modal-content input {
    box-sizing: border-box;
    width: 100%;
}

.revalue-modal-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.revalue-modal-actions button {
    min-height: 40px;
}

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

.revalue-modal button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.revalue-modal .password-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.revalue-modal .password-field input {
    min-width: 0;
    flex: 1;
}

@media (max-width: 520px) {
    .revalue-modal-content {
        padding: 20px;
    }

    .revalue-modal-actions {
        flex-direction: column-reverse;
    }

    .revalue-modal-actions button {
        width: 100%;
    }
}
