/* App layout + shared utilities (Radzen + azzurro). Bootstrap is not loaded. */

*, *::before, *::after { box-sizing: border-box; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }

.brand-block {
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.35rem;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none !important;
}

.brand-mark {
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 0.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: #fff;
    background: linear-gradient(145deg, var(--accent), var(--accent-dark));
    box-shadow: 0 6px 16px rgba(30, 136, 229, 0.28);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-text strong { font-size: 0.98rem; color: var(--ink); }
.brand-text small { color: var(--muted); font-size: 0.72rem; }

.app-header-stack { width: 100%; padding: 0 0.75rem; }
.header-title { color: var(--muted); font-size: 0.92rem; font-weight: 600; }
.top-user { color: var(--ink); font-weight: 600; }

.app-body { background: transparent; }
.app-content {
    padding: 1.25rem 1.5rem 2.5rem;
    max-width: 1400px;
}

.app-panel-menu {
    padding-bottom: 1.5rem;
}

.app-panel-menu.is-compact .rz-navigation-item-link {
    justify-content: center;
    padding-inline: 0.55rem;
}

.sidebar-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--line);
    border-radius: 0.45rem;
    background: #fff;
    color: var(--accent-dark);
    cursor: pointer;
    padding: 0;
}

.sidebar-toggle-btn:hover {
    background: var(--gc-primary-soft);
    border-color: var(--accent);
}

.gc-sidebar-compact .brand-block {
    display: flex;
    justify-content: center;
    padding-inline: 0.5rem;
}

.gc-sidebar-compact .brand-link {
    justify-content: center;
}

@media (max-width: 900px) {
    .app-shell.sidebar-collapsed .rz-sidebar {
        transform: translateX(-100%);
        width: 0 !important;
        overflow: hidden;
        border: none;
        box-shadow: none;
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 1.25rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    margin: 0.1rem 0 0.35rem;
    font-size: 1.75rem;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    color: var(--accent);
    margin: 0;
    font-weight: 700;
}

.lead {
    margin: 0;
    color: var(--muted);
    max-width: 42rem;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    z-index: 2;
}

.page-actions-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.page-actions-divider {
    width: 1px;
    align-self: stretch;
    min-height: 1.6rem;
    background: var(--line);
    margin: 0 0.1rem;
}

.export-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.export-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
}

.export-menu-panel {
    position: absolute;
    top: calc(100% + 0.3rem);
    right: 0;
    z-index: 31;
    min-width: 9.5rem;
    padding: 0.3rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    box-shadow: 0 .35rem 1rem rgba(15, 23, 42, .14);
    display: grid;
    gap: 0.15rem;
}

.export-menu-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 0.35rem;
    padding: 0.45rem 0.55rem;
    cursor: pointer;
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
}

.export-menu-item:hover:not(:disabled) {
    background: var(--gc-primary-softer);
    color: var(--gc-primary-dark);
}

.export-menu-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.export-menu-item .rzi {
    font-size: 1.05rem;
}

/* Compact, high-contrast action buttons (white/azzurro theme) */
.page-actions .rz-button,
.gc-btn-action.rz-button {
    --rz-button-height: 2.05rem;
    --rz-button-padding-block: 0.28rem;
    --rz-button-padding-inline: 0.7rem;
    min-height: 2.05rem;
    height: auto;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: none !important;
    line-height: 1.2;
}

.page-actions .rz-button .rzi,
.gc-btn-action.rz-button .rzi {
    font-size: 1.05rem !important;
}

.page-actions .rz-button.rz-secondary,
.gc-btn-action.rz-button.rz-secondary,
.gc-btn-visible.rz-button.rz-light {
    background: #ffffff !important;
    color: var(--gc-primary-dark) !important;
    border: 1px solid var(--gc-line) !important;
}

.page-actions .rz-button.rz-secondary:hover,
.gc-btn-action.rz-button.rz-secondary:hover,
.gc-btn-visible.rz-button.rz-light:hover {
    background: var(--gc-primary-soft) !important;
    border-color: var(--gc-primary) !important;
    color: var(--gc-primary-dark) !important;
}

.page-actions .rz-button.rz-primary,
.gc-btn-action.rz-button.rz-primary {
    background: var(--gc-primary) !important;
    border: 1px solid var(--gc-primary-dark) !important;
    color: #fff !important;
}

.page-actions .rz-button.rz-danger,
.gc-btn-action.rz-button.rz-danger {
    background: #fff !important;
    color: var(--gc-danger) !important;
    border: 1px solid #ef9a9a !important;
}

.page-actions .rz-button.rz-danger:hover,
.gc-btn-action.rz-button.rz-danger:hover {
    background: #ffebee !important;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}

.kpi {
    background: linear-gradient(180deg, #ffffff, var(--gc-primary-softer));
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    padding: 1rem 1.1rem;
    box-shadow: var(--rz-card-shadow);
}

.kpi-label {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
}

.kpi-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ink);
}

.kpi-sub {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.3;
}

.positive { color: var(--success); }
.negative { color: var(--danger); }
.muted { color: var(--muted); }
.error-text { color: var(--danger); font-weight: 600; }
.info-banner {
    background: var(--gc-primary-soft);
    border: 1px solid var(--line);
    color: var(--accent-dark);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.panel, .form-panel, .rz-card.gc-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    padding: 1rem 1.1rem;
    box-shadow: var(--rz-card-shadow);
    margin-bottom: 1rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.05rem;
}

.empty-state {
    text-align: center;
    padding: 2.5rem 1.25rem;
    background: var(--panel);
    border: 1px dashed var(--line);
    border-radius: 0.75rem;
    color: var(--muted);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem 1rem;
    align-items: start;
}

/* Form con larghezze coerenti al contenuto (non ogni campo a 100% della colonna). */
.form-grid-sized,
.form-grid-movimento {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem 1rem;
    align-items: start;
}

.form-grid-sized > .field-half,
.form-grid-movimento > .field-half {
    grid-column: span 1;
    min-width: 0;
}

.form-grid-sized > .field-full,
.form-grid-sized > .field-row,
.form-grid-movimento > .field-full,
.form-grid-movimento > .field-row {
    grid-column: 1 / -1;
}

.field-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem 1rem;
    align-items: flex-end;
}

.field-row > .field {
    flex: 0 0 auto;
    min-width: 0;
}

/* Larghezze campo per tipo di contenuto */
.field-w-date { width: 10.75rem; max-width: 100%; }
.field-w-prov { width: 4.75rem; max-width: 100%; }
.field-w-cap { width: 6.5rem; max-width: 100%; }
.field-w-civico { width: 5.5rem; max-width: 100%; }
.field-w-money { width: 9.75rem; max-width: 100%; }
.field-w-pct { width: 5.75rem; max-width: 100%; }
.field-w-code { width: 10rem; max-width: 100%; }
.field-w-piva { width: 12rem; max-width: 100%; }
.field-w-cf { width: 14rem; max-width: 100%; }
.field-w-iban { width: min(22rem, 100%); }
.field-w-email { width: min(20rem, 100%); }
.field-w-phone { width: 12rem; max-width: 100%; }
.field-w-sdi { width: 8rem; max-width: 100%; }
.field-w-ordine { width: 6.5rem; max-width: 100%; }
.field-w-md { width: 14rem; max-width: 100%; }
.field-w-stato { width: 14rem; max-width: 100%; }
.field-w-doc { width: 12rem; max-width: 100%; }
.field-w-catasto { width: 8rem; max-width: 100%; }
.field-w-mq { width: 8rem; max-width: 100%; }
.field-w-um { width: 5rem; max-width: 100%; }
.field-w-qty { width: 6.5rem; max-width: 100%; }
.field-w-nation { width: 10rem; max-width: 100%; }
.field-w-city { width: min(16rem, 100%); }
.field-w-name { width: min(16rem, 100%); }
.field-w-password { width: min(16rem, 100%); }

.field-grow {
    flex: 1 1 14rem;
    min-width: 12rem;
}

.field-check {
    width: auto;
    min-width: 5.5rem;
    padding-bottom: 0.45rem;
}

/* Alias legacy movimenti */
.form-grid-movimento .field-date { width: 10.75rem; max-width: 100%; }
.form-grid-movimento .field-aliquota { width: 5.75rem; max-width: 100%; }
.form-grid-movimento .field-money { width: 9.75rem; max-width: 100%; }
.form-grid-movimento .field-doc { width: 12rem; max-width: 100%; }

.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.field-span-2 { grid-column: span 2; }
.field-hint { font-size: 0.75rem; color: var(--muted); }

/* Importi / percentuali allineati a destra */
.field-w-money input,
.field-w-pct input,
.field-w-mq input,
.field-money input,
.field-aliquota input,
td.num input {
    text-align: right;
}

.filters-grid .field-w-date {
    width: 10.75rem;
    max-width: 100%;
}

.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 0.45rem 0.4rem;
    vertical-align: middle;
}

.data-table thead th {
    color: var(--gc-primary-dark);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    background: var(--gc-primary-softer);
}

.data-table tfoot td {
    background: var(--gc-primary-softer);
    font-weight: 600;
}

.data-table .num { text-align: right; }
.data-table .actions { white-space: nowrap; width: 1%; }

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--ink);
}

.form-actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-top: 1.15rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.form-actions .rz-button.rz-secondary,
.form-actions .gc-btn-action.rz-button.rz-secondary {
    background: #ffffff !important;
    color: var(--gc-primary-dark) !important;
    border: 1px solid var(--gc-line) !important;
}

.form-actions .rz-button.rz-secondary:hover,
.form-actions .gc-btn-action.rz-button.rz-secondary:hover {
    background: var(--gc-primary-soft) !important;
    border-color: var(--gc-primary) !important;
    color: var(--gc-primary-dark) !important;
}

.validation-summary {
    color: var(--danger);
    margin-bottom: 0.75rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--gc-primary-soft);
    color: var(--accent-dark);
}

.badge-success { background: #e8f5e9; color: var(--success); }
.badge-warning { background: #fff3e0; color: var(--warn); }
.badge-danger { background: #ffebee; color: var(--danger); }
.badge-info { background: #e1f5fe; color: var(--info); }
.badge-muted { background: #eceff1; color: #546e7a; }
.badge-accent { background: var(--gc-primary-soft); color: var(--accent-dark); }

.actions {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
}

.icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.45rem;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--accent-dark);
    cursor: pointer;
    text-decoration: none !important;
}

.icon-action:hover {
    background: var(--gc-primary-soft);
    border-color: var(--accent);
}

.icon-action-danger { color: var(--danger); }
.icon-action-danger:hover {
    background: #ffebee;
    border-color: #ef9a9a;
}

.icon-action .app-icon { width: 1.05rem; height: 1.05rem; }

.row-inactive { opacity: 0.65; }

.filters-panel { margin-bottom: 1rem; }
.filters-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
}
.filters-summary { margin: 0 0 0.65rem; font-size: 0.9rem; }

.stack-sm { display: flex; flex-direction: column; gap: 0.15rem; }

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background:
        radial-gradient(circle at 20% 20%, rgba(30, 136, 229, 0.18), transparent 40%),
        radial-gradient(circle at 80% 10%, rgba(144, 202, 249, 0.35), transparent 35%),
        linear-gradient(160deg, #e3f2fd, #f8fbfe 45%, #ffffff);
}

.login-panel { width: min(420px, 100%); }
.login-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1rem;
    color: var(--ink);
}
.login-brand strong { display: block; font-size: 1.15rem; }
.login-brand small { color: var(--muted); }
.login-card { padding: 1.35rem 1.4rem !important; }
.login-form { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 1rem; }

.detail-list > div {
    display: grid;
    grid-template-columns: 10rem 1fr;
    gap: 0.35rem 1rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--line);
}
.detail-list > div:last-child { border-bottom: none; }
.detail-list dt, .detail-list .label { color: var(--muted); font-size: 0.82rem; font-weight: 600; }

.split-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.cantiere-map-panel {
    margin-top: 1.25rem;
    margin-bottom: 0.25rem;
}

.cantiere-map-panel .panel-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.cantiere-map-panel .map-osm-link {
    font-size: 0.82rem;
    white-space: nowrap;
}

.cantiere-map-frame {
    width: 100%;
    height: 320px;
    border-radius: 0.65rem;
    border: 1px solid var(--line);
    overflow: hidden;
    background: var(--gc-primary-softer, #f0f7fc);
}

.cantiere-map-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.cantiere-map-placeholder {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 120px;
    padding: 1rem 0;
}

.cantiere-map-caption {
    margin: 0.55rem 0 0;
    font-size: 0.82rem;
}

.gc-grid-wrap {
    overflow: hidden;
    padding: 0;
}

.gc-grid-wrap .rz-datatable,
.gc-grid-wrap .rz-grid-table {
    border: none;
}

/* Keep custom multi-select usable without Bootstrap */
.multi-select { position: relative; }
.multi-select-toggle {
    width: 100%;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.4rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--rz-border-radius);
    background: #fff;
    cursor: pointer;
}
.multi-select-menu {
    position: absolute;
    z-index: 20;
    left: 0; right: 0;
    top: calc(100% + 0.25rem);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    box-shadow: var(--rz-card-shadow);
    max-height: 14rem;
    overflow: auto;
    padding: 0.35rem;
}
.multi-select-option {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.4rem 0.45rem;
    border-radius: 0.35rem;
    cursor: pointer;
}
.multi-select-option:hover { background: var(--gc-primary-soft); }
.multi-select-empty { padding: 0.65rem; }

/* Lightweight stand-ins if any leftover Bootstrap class names remain */
.form-control {
    width: 100%;
    min-height: 2.4rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--rz-border-radius);
    background: #fff;
    color: var(--ink);
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--rz-input-focus-shadow);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 0.45rem;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
}
.btn-primary { background: var(--accent); border-color: var(--accent-dark); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { background: var(--gc-primary-soft); border-color: var(--accent); color: var(--accent-dark); }
.btn-danger { background: var(--danger); border-color: #b71c1c; color: #fff; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn-link, .link-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 0;
    font: inherit;
}
.link-btn:hover { text-decoration: underline; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

/* Document / allegato modals kept as lightweight overlays */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(16, 32, 48, 0.45);
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1rem;
}
.modal-panel {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid var(--line);
    box-shadow: 0 18px 50px rgba(16, 32, 48, 0.22);
    width: min(720px, 100%);
    max-height: min(90vh, 900px);
    overflow: auto;
    padding: 1rem 1.15rem;
}

.drop-zone {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border: 1.5px dashed var(--accent);
    background: var(--gc-primary-softer);
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: center;
    color: var(--muted);
    margin-bottom: 1rem;
}
.drop-zone.is-dragover {
    background: var(--gc-primary-soft);
    border-color: var(--accent-dark);
}

.permessi-table { width: 100%; border-collapse: collapse; }
.permessi-table th, .permessi-table td {
    border-bottom: 1px solid var(--line);
    padding: 0.55rem 0.4rem;
    text-align: center;
}
.permessi-table th:first-child,
.permessi-table td:first-child { text-align: left; }

#blazor-error-ui {
    background: #ffebee;
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,.12);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
}
#blazor-error-ui .dismiss { cursor: pointer; margin-left: 1rem; }
#blazor-error-ui.show { display: block; }

/* Allegati icons */
.table-allegati-icons {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    max-width: 9.5rem;
}

.allegati-hover {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.allegato-trigger {
    position: relative;
}

.allegati-count {
    position: absolute;
    top: -0.3rem;
    right: -0.35rem;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1rem;
    text-align: center;
}

.allegati-chooser {
    display: grid;
    gap: 0.25rem;
    padding: 0.15rem 0;
}

.drop-zone-compact {
    padding: 0.45rem 0.7rem;
    margin-bottom: 0.65rem;
    border-radius: 0.5rem;
    min-height: 0 !important;
}

.drop-zone-compact .drop-zone-content strong {
    font-size: 0.9rem;
}

.drop-zone-compact .drop-zone-content p {
    margin: 0.2rem 0 0;
    font-size: 0.78rem;
    line-height: 1.25;
}

.movimento-editor.is-dialog,
.preventivo-editor.is-dialog {
    max-height: min(78vh, 920px);
    overflow: auto;
    padding-right: 0.15rem;
}

/* SPIKE: right-side drawer — taller scroll area + sticky Salva/Annulla */
.movimento-editor.is-side-dialog,
.preventivo-editor.is-side-dialog {
    max-height: calc(100vh - 3.5rem);
    overflow: auto;
    padding-bottom: 0.25rem;
}

.movimento-editor.is-side-dialog .form-actions,
.preventivo-editor.is-side-dialog .form-actions,
.documento-upload-dialog.is-side-dialog .documento-upload-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin-top: 0.75rem;
    padding: 0.85rem 0 0.35rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 28%);
    border-top: 1px solid var(--gc-line, var(--line));
}

.documento-upload-dialog.is-side-dialog {
    max-height: calc(100vh - 3.5rem);
    overflow: auto;
    padding-bottom: 0.25rem;
}

.movimento-editor.is-dialog .gc-panel,
.preventivo-editor.is-dialog .gc-panel {
    margin-bottom: 0.85rem;
}

.movimento-editor.is-dialog .gc-panel:last-child,
.preventivo-editor.is-dialog .gc-panel:last-child {
    margin-bottom: 0;
}

.documento-upload-dialog {
    display: grid;
    gap: 0.85rem;
}

.documento-upload-dialog .documenti-drop {
    margin-bottom: 0;
}

.documento-upload-files {
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    padding: 0.65rem 0.75rem;
    background: #fff;
}

.documento-upload-file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
}

.documento-upload-file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.88rem;
}

.documento-upload-cantiere-locked {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--line);
    border-radius: var(--rz-border-radius);
    background: var(--gc-primary-softer);
    font-weight: 600;
    color: var(--ink);
}

.documento-upload-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.25rem;
    padding-top: 0.25rem;
}

.allegato-preview-dialog {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 60vh;
    gap: 0.75rem;
}

.allegato-preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

.allegato-preview-body {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.allegato-preview-body .preview-image,
.allegato-preview-body .preview-frame {
    width: 100%;
    height: 100%;
    min-height: 55vh;
    border: 0;
    border-radius: 0.4rem;
    background: #f8fafc;
}

.allegati-popover-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.35rem;
    align-items: center;
    padding: 0.2rem;
    border-radius: 0.3rem;
}

.allegati-popover-item:hover {
    background: #f3f6f4;
}

.allegati-popover-open {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 0.35rem 0.25rem;
    cursor: pointer;
    text-align: left;
}

.allegati-popover-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.88rem;
    color: var(--ink);
}

.allegati-popover-download {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-dark);
    padding: 0.2rem 0.4rem;
    white-space: nowrap;
}

.cell-ellipsis {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.badge-compact {
    min-width: 1.8rem;
    padding: 0.15rem 0.4rem;
    font-size: 0.72rem;
}

.movimenti-grid .rz-data-table .rz-cell,
.movimenti-grid .rz-grid-table td {
    font-size: 0.88rem;
}

.color-swatch {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 1px solid var(--line);
    vertical-align: middle;
    margin-right: 0.4rem;
}

.field-color {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.field-color input[type="color"] {
    width: 2.75rem;
    height: 2.2rem;
    padding: 0.15rem;
    border: 1px solid var(--line);
    border-radius: 0.4rem;
    background: #fff;
    cursor: pointer;
}

.allegato-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 0.35rem;
    background: var(--gc-primary-softer);
    cursor: pointer;
    line-height: 1;
    text-decoration: none !important;
}

.allegato-icon-btn:hover {
    background: var(--gc-primary-soft);
    border-color: var(--line);
    transform: translateY(-1px);
}

.allegato-type-icon,
.app-icon {
    width: 1.35rem;
    height: 1.35rem;
    display: block;
}

.allegato-icon-btn.is-pdf .allegato-type-icon,
.allegato-icon-btn.is-image .allegato-type-icon,
.allegato-icon-btn.is-xml .allegato-type-icon,
.allegato-icon-btn.is-excel .allegato-type-icon,
.allegato-icon-btn.is-word .allegato-type-icon,
.allegato-icon-btn.is-zip .allegato-type-icon,
.allegato-icon-btn.is-file .allegato-type-icon {
    width: 1.4rem;
    height: 1.4rem;
}

.preview-unavailable {
    display: grid;
    gap: 1rem;
    justify-items: center;
    padding: 2rem 1rem;
    text-align: center;
}

.preview-panel {
    width: min(960px, 100%);
    height: min(90vh, 900px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.preview-body {
    flex: 1;
    min-height: 0;
    padding: 0;
    background: #102030;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    object-fit: contain;
}

.preview-frame {
    width: 100%;
    height: 100%;
    min-height: 70vh;
    border: 0;
    background: #fff;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.05rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-list {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
}

.category-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--line);
}

.totals-box {
    margin-top: 0.9rem;
    display: grid;
    gap: 0.35rem;
}

.totals-box > div {
    display: flex;
    justify-content: space-between;
    font-size: 0.92rem;
}

.category-chart-wrap {
    width: 100%;
    min-height: 220px;
    margin-bottom: 0.35rem;
}

.category-pie-chart {
    height: 240px;
    width: 100%;
}

.file-btn {
    cursor: pointer;
    margin: 0;
}

.documenti-drop {
    min-height: 9.5rem;
    position: relative;
}

.drop-zone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.drop-zone-content {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.drop-zone-content .btn {
    pointer-events: none;
}

.documenti-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.documento-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    background: #fff;
    overflow: hidden;
    box-shadow: var(--rz-card-shadow);
}

.documento-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 10rem;
    border: 0;
    padding: 0;
    background: var(--gc-primary-softer);
    overflow: hidden;
}

.documento-thumb.is-previewable {
    cursor: pointer;
}

.documento-thumb.is-previewable:hover {
    filter: brightness(0.97);
}

.documento-thumb.is-file {
    cursor: default;
}

.documento-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.documento-type-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
}

.documento-type-icon .allegato-type-icon {
    width: 2.75rem;
    height: 2.75rem;
}

.thumb-label {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--accent-dark);
}

.documento-body {
    display: grid;
    gap: 0.35rem;
    padding: 0.85rem 1rem 1rem;
}

.documento-name {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.documento-cantiere {
    font-size: 0.85rem;
    font-weight: 600;
}

.documento-desc {
    margin: 0;
    font-size: 0.88rem;
}

.documento-meta {
    margin: 0;
    font-size: 0.8rem;
}

.documento-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin-top: 0.35rem;
}

@media (max-width: 1100px) {
    .kpi-grid,
    .split-panels,
    .form-grid,
    .form-grid-sized,
    .form-grid-movimento,
    .filters-grid { grid-template-columns: 1fr; }
    .field-span-2 { grid-column: span 1; }
    .form-grid-sized > .field-half,
    .form-grid-sized > .field-full,
    .form-grid-sized > .field-row,
    .form-grid-movimento > .field-half,
    .form-grid-movimento > .field-full,
    .form-grid-movimento > .field-row { grid-column: span 1; }
    .page-header { flex-direction: column; }
    .detail-list > div { grid-column: span 1; grid-template-columns: 1fr; }
    .app-content { padding: 1rem; }
    .category-pie-chart { height: 280px; }
}
