/* ── GesQ Design System ───────────────────────────────────── */

:root {
    --gesq-primary: #1e40af;
    --gesq-primary-dark: #1e3a8a;
    --gesq-accent: #0ea5e9;
    --gesq-accent-soft: #e0f2fe;
    --gesq-brand-panel-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 55%, #172554 100%);
    --gesq-sidebar-bg: linear-gradient(180deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
    --gesq-sidebar-shadow: 4px 0 24px rgba(15, 23, 42, 0.06);
    --gesq-sidebar-border: #e2e8f0;
    --gesq-sidebar-brand: #0f172a;
    --gesq-sidebar-tagline: #64748b;
    --gesq-sidebar-section: #94a3b8;
    --gesq-sidebar-link: #334155;
    --gesq-sidebar-link-hover: #1e40af;
    --gesq-sidebar-hover-bg: rgba(30, 64, 175, 0.06);
    --gesq-sidebar-active-bg: linear-gradient(135deg, rgba(14, 165, 233, 0.12) 0%, rgba(37, 99, 235, 0.14) 100%);
    --gesq-sidebar-active-border: rgba(37, 99, 235, 0.28);
    --gesq-sidebar-active-text: #1e3a8a;
    --gesq-sidebar-active-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
    --gesq-sidebar-input-bg: #ffffff;
    --gesq-sidebar-input-border: #e2e8f0;
    --gesq-sidebar-input-text: #0f172a;
    --gesq-sidebar-input-placeholder: #94a3b8;
    --gesq-sidebar-input-focus-border: rgba(37, 99, 235, 0.45);
    --gesq-sidebar-input-focus-bg: #ffffff;
    --gesq-sidebar-search-fade: linear-gradient(180deg, #ffffff 0%, #ffffff 72%, rgba(255, 255, 255, 0) 100%);
    --gesq-sidebar-clear: #64748b;
    --gesq-sidebar-clear-hover: #0f172a;
    --gesq-sidebar-clear-hover-bg: rgba(15, 23, 42, 0.06);
    --gesq-sidebar-empty: #94a3b8;
    --gesq-sidebar-icon: #2563eb;
    --gesq-sidebar-scrollbar: rgba(15, 23, 42, 0.18);
    --gesq-bg: #f1f5f9;
    --gesq-surface: #ffffff;
    --gesq-border: #e2e8f0;
    --gesq-text: #0f172a;
    --gesq-text-secondary: #475569;
    --gesq-text-muted: #94a3b8;
    --gesq-header-bg: rgba(255, 255, 255, 0.72);
    --gesq-mobile-btn-bg: #ffffff;
    --gesq-table-head-bg: #f8fafc;
    --gesq-table-hover-bg: #e8f4fd;
    --gesq-input-bg: #ffffff;
    --gesq-field-readonly-bg: #f1f5f9;
    --gesq-bar-gradient: linear-gradient(0deg, #ffffff 0%, #eff6ff 100%);
    --gesq-bar-panel-bg: rgba(255, 255, 255, 0.65);
    --gesq-bar-panel-border: #bfdbfe;
    --gesq-detail-header-bg: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
    --gesq-group-row-bg: #f8f9fa;
    --gesq-mobile-card-bg: #ffffff;
    --gesq-radius: 14px;
    --gesq-radius-sm: 10px;
    --gesq-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
    --gesq-shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.1);
    --gesq-gradient-hero: linear-gradient(135deg, #1e40af 0%, #0ea5e9 50%, #06b6d4 100%);
    --gesq-gradient-revenue: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    --gesq-gradient-warning: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
    --gesq-main-header-height: 4.5rem;
    --gesq-doc-detail-header-height: 4.25rem;
    --gesq-doc-footer-height: 4.5rem;
    --gesq-doc-righe-inline-footer-height: 3.25rem;
    --gesq-doc-editor-articoli-chrome: 21rem;
}

[data-bs-theme="dark"] {
    color-scheme: dark;
    --gesq-sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 55%, #172554 100%);
    --gesq-sidebar-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
    --gesq-sidebar-border: rgba(255, 255, 255, 0.08);
    --gesq-sidebar-brand: #ffffff;
    --gesq-sidebar-tagline: rgba(255, 255, 255, 0.5);
    --gesq-sidebar-section: rgba(255, 255, 255, 0.38);
    --gesq-sidebar-link: rgba(255, 255, 255, 0.72);
    --gesq-sidebar-link-hover: #ffffff;
    --gesq-sidebar-hover-bg: rgba(255, 255, 255, 0.08);
    --gesq-sidebar-active-bg: linear-gradient(135deg, rgba(56, 189, 248, 0.22) 0%, rgba(37, 99, 235, 0.28) 100%);
    --gesq-sidebar-active-border: rgba(56, 189, 248, 0.25);
    --gesq-sidebar-active-text: #ffffff;
    --gesq-sidebar-active-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
    --gesq-sidebar-input-bg: rgba(255, 255, 255, 0.06);
    --gesq-sidebar-input-border: rgba(255, 255, 255, 0.12);
    --gesq-sidebar-input-text: #ffffff;
    --gesq-sidebar-input-placeholder: rgba(255, 255, 255, 0.38);
    --gesq-sidebar-input-focus-border: rgba(56, 189, 248, 0.45);
    --gesq-sidebar-input-focus-bg: rgba(255, 255, 255, 0.1);
    --gesq-sidebar-search-fade: linear-gradient(180deg, #0f172a 0%, #0f172a 72%, rgba(15, 23, 42, 0) 100%);
    --gesq-sidebar-clear: rgba(255, 255, 255, 0.55);
    --gesq-sidebar-clear-hover: #ffffff;
    --gesq-sidebar-clear-hover-bg: rgba(255, 255, 255, 0.08);
    --gesq-sidebar-empty: rgba(255, 255, 255, 0.45);
    --gesq-sidebar-icon: #93c5fd;
    --gesq-sidebar-scrollbar: rgba(255, 255, 255, 0.2);
    --gesq-bg: #0f172a;
    --gesq-surface: #1e293b;
    --gesq-border: #334155;
    --gesq-text: #f1f5f9;
    --gesq-text-secondary: #cbd5e1;
    --gesq-text-muted: #94a3b8;
    --gesq-accent-soft: #0c4a6e;
    --gesq-header-bg: rgba(30, 41, 59, 0.9);
    --gesq-mobile-btn-bg: #1e293b;
    --gesq-table-head-bg: #1e293b;
    --gesq-table-hover-bg: #334155;
    --gesq-input-bg: #0f172a;
    --gesq-field-readonly-bg: #334155;
    --gesq-bar-gradient: linear-gradient(0deg, #1e293b 0%, #172554 100%);
    --gesq-bar-panel-bg: rgba(15, 23, 42, 0.8);
    --gesq-bar-panel-border: #1e40af;
    --gesq-detail-header-bg: linear-gradient(180deg, #1e293b 0%, #172554 100%);
    --gesq-group-row-bg: #334155;
    --gesq-mobile-card-bg: #1e293b;
    --gesq-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 4px 16px rgba(0, 0, 0, 0.2);
    --gesq-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    color: var(--gesq-text);
    background: var(--gesq-bg);
    -webkit-font-smoothing: antialiased;
    /* PWA / notch: evita overscroll rubber-band che “rompe” lo shell app */
    overscroll-behavior-y: none;
}

html {
    height: 100%;
    height: -webkit-fill-available;
}

body {
    min-height: 100%;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
}

a {
    color: var(--gesq-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

a:hover {
    color: var(--gesq-accent);
}

.sidebar {
    background: var(--gesq-sidebar-bg);
}

/* ── Page header ─────────────────────────────────────────── */

.page-header {
    margin-bottom: 1.75rem;
}

.page-header h1 {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--gesq-text);
    margin-bottom: 0.35rem;
    line-height: 1.2;
}

.page-header p,
.page-header .text-muted {
    color: var(--gesq-text-secondary) !important;
    font-size: 0.95rem;
    margin: 0;
}

.page-header .breadcrumb {
    background: none;
    padding: 0;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.page-header .breadcrumb-item a {
    color: var(--gesq-text-muted);
}

.page-header .breadcrumb-item.active {
    color: var(--gesq-text-secondary);
}

/* ── Lead scheda: sticky command bar ─────────────────────── */

.gesq-lead-scheda-toolbar {
    position: sticky;
    top: var(--gesq-main-header-height);
    z-index: 9;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 1rem;
    padding: 0.65rem 0.15rem;
    background: var(--gesq-bg);
    border-bottom: 1px solid var(--gesq-border);
    box-shadow: 0 6px 14px -10px rgba(15, 23, 42, 0.35);
}

.gesq-lead-scheda-toolbar__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.gesq-lead-scheda-toolbar__icon {
    flex-shrink: 0;
    font-size: 0.95rem;
    line-height: 1;
    color: var(--gesq-text-secondary);
    opacity: 0.9;
}

.gesq-lead-scheda-toolbar__btn:hover .gesq-lead-scheda-toolbar__icon,
.gesq-lead-scheda-toolbar__btn:focus-visible .gesq-lead-scheda-toolbar__icon {
    color: var(--gesq-text);
    opacity: 1;
}

.gesq-lead-scheda-toolbar__btn:disabled .gesq-lead-scheda-toolbar__icon {
    opacity: 0.55;
}

.gesq-lead-scheda-toolbar__btn.btn-primary .gesq-lead-scheda-toolbar__icon {
    color: inherit;
    opacity: 1;
}

/* ── Cliente Verinox (lead / clienti) ─────────────────────── */

.gesq-verinox-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1.2;
    border-radius: 0.35rem;
    background: #ea580c !important;
    color: #fff !important;
    border: none;
    vertical-align: middle;
}

.gesq-verinox-banner {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0 0 1rem;
    padding: 0.85rem 1.1rem;
    border-radius: var(--gesq-radius-sm, 0.5rem);
    background: #ffedd5;
    border: 1px solid #fdba74;
    border-left: 5px solid #ea580c;
    color: #9a3412;
    font-weight: 700;
    font-size: 1.05rem;
}

.gesq-verinox-banner--compact {
    margin: 0;
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
}

.gesq-verinox-banner .bi {
    color: #ea580c;
    font-size: 1.15em;
    flex-shrink: 0;
}

[data-bs-theme="dark"] .gesq-verinox-banner {
    background: rgba(234, 88, 12, 0.22);
    border-color: #c2410c;
    border-left-color: #fb923c;
    color: #fdba74;
}

[data-bs-theme="dark"] .gesq-verinox-banner .bi {
    color: #fb923c;
}

.gesq-verinox-check--on {
    background: #ffedd5;
    border: 1px solid #fdba74;
}

[data-bs-theme="dark"] .gesq-verinox-check--on {
    background: rgba(234, 88, 12, 0.22);
    border-color: #c2410c;
}

/* ── Dashboard hero ──────────────────────────────────────── */

.dashboard-hero {
    background: var(--gesq-gradient-hero);
    border-radius: var(--gesq-radius);
    padding: 1.75rem 2rem;
    margin-bottom: 1.75rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--gesq-shadow-lg);
}

.dashboard-hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.dashboard-hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: 20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.dashboard-hero h1 {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
    position: relative;
}

.dashboard-hero p {
    opacity: 0.85;
    margin: 0;
    font-size: 0.95rem;
    position: relative;
}

/* ── Stat cards ──────────────────────────────────────────── */

.stat-card {
    background: var(--gesq-surface);
    border-radius: var(--gesq-radius);
    padding: 1rem 1.1rem;
    box-shadow: var(--gesq-shadow);
    border: 1px solid var(--gesq-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: 100%;
    min-width: 0;
    container-type: inline-size;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--gesq-shadow-lg);
}

.stat-card__icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-size: 1.35rem;
    background-repeat: no-repeat;
    background-position: center;
}

.stat-card__body {
    min-width: 0;
    flex: 1 1 0;
}

.stat-card .stat-value {
    font-size: clamp(0.82rem, 0.65rem + 0.55cqi, 1.35rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: var(--gesq-text);
    line-height: 1.15;
    overflow-wrap: anywhere;
}

@container (max-width: 13rem) {
    .stat-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.85rem 0.9rem;
    }

    .stat-card__icon {
        width: 2rem;
        height: 2rem;
        background-size: 1.1rem;
    }

    .stat-card .stat-value {
        font-size: clamp(0.78rem, 0.5rem + 2.8cqi, 1.05rem);
    }
}

.stat-card .stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gesq-text-muted);
    margin-top: 0.2rem;
}

.stat-clients .stat-card__icon { background-color: #dbeafe; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%232563eb'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z'/%3E%3C/svg%3E"); }
.stat-suppliers .stat-card__icon { background-color: #ede9fe; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%237c3aed'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4'/%3E%3C/svg%3E"); }
.stat-warehouse .stat-card__icon { background-color: #d1fae5; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23059669'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4'/%3E%3C/svg%3E"); }
.stat-warning .stat-card__icon { background-color: #ffedd5; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23ea580c'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z'/%3E%3C/svg%3E"); }
.stat-offers .stat-card__icon { background-color: #ccfbf1; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230d9488'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z'/%3E%3C/svg%3E"); }
.stat-orders .stat-card__icon { background-color: #e0f2fe; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230284c7'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z'/%3E%3C/svg%3E"); }
.stat-repairs .stat-card__icon { background-color: #fef3c7; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23d97706'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z'/%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 12a3 3 0 11-6 0 3 3 0 016 0z'/%3E%3C/svg%3E"); }
a.stat-card { color: inherit; }

/* ── Highlight cards ─────────────────────────────────────── */

.highlight-card {
    display: block;
    box-sizing: border-box;
    border-radius: var(--gesq-radius);
    padding: 1.25rem 1.5rem;
    color: #fff;
    box-shadow: var(--gesq-shadow-lg);
    height: 100%;
    min-width: 0;
    position: relative;
    z-index: 1;
    isolation: isolate;
    overflow: hidden;
    background-color: #2563eb; /* fallback opaco se il gradient fallisce */
}

.highlight-card::after {
    content: '';
    position: absolute;
    inset: auto -1.25rem -1.25rem auto;
    width: 5.5rem;
    height: 5.5rem;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.highlight-card__label,
.highlight-card__value,
.highlight-card__hint {
    position: relative;
    z-index: 1;
}

.highlight-card__hint {
    margin-top: 0.45rem;
    font-size: 0.75rem;
    line-height: 1.35;
    opacity: 0.88;
}

.highlight-card--revenue {
    background-color: #1e40af;
    background-image: var(--gesq-gradient-revenue);
}

.highlight-card--pending {
    background-color: #d97706;
    background-image: var(--gesq-gradient-warning);
}

.highlight-card--success {
    background-color: #0d9488;
    background-image: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #2dd4bf 100%);
}

.highlight-card--info {
    background-color: #0369a1;
    background-image: linear-gradient(135deg, #0369a1 0%, #0ea5e9 50%, #38bdf8 100%);
}

.highlight-card__label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.9;
    margin-bottom: 0.45rem;
}

.highlight-card__value {
    font-size: clamp(1.15rem, 0.9rem + 1.2vw, 1.75rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

a.highlight-card,
a.highlight-card:hover,
a.highlight-card:focus,
a.highlight-card:visited {
    color: #fff;
    text-decoration: none;
}

a.highlight-card--clickable,
button.highlight-card--clickable {
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.highlight-card--clickable:hover,
button.highlight-card--clickable:hover {
    transform: translateY(-2px);
    color: #fff;
}

a.highlight-card--clickable:focus-visible,
button.highlight-card--clickable:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    color: #fff;
}

.highlight-card--active {
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--bs-primary);
}

.highlight-cards-row {
    position: relative;
    z-index: 2;
}

.dashboard-link-card {
    display: block;
    height: 100%;
    padding: 1.1rem 1.25rem;
    background: var(--gesq-surface);
    border: 1px solid var(--gesq-border);
    border-radius: var(--gesq-radius);
    box-shadow: var(--gesq-shadow);
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-link-card:hover {
    border-color: var(--bs-primary);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    color: inherit;
}

.dashboard-link-card__title {
    font-weight: 650;
    font-size: 1.05rem;
    color: var(--gesq-text);
    margin-bottom: 0.35rem;
}

.dashboard-link-card__desc {
    font-size: 0.875rem;
    color: var(--gesq-text-secondary);
    line-height: 1.4;
}

.gesq-docs__toc-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gesq-text-muted);
    margin-bottom: 0.75rem;
}

.gesq-docs__toc ul li {
    margin-bottom: 0.4rem;
}

.gesq-docs__toc a {
    color: var(--gesq-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
}

.gesq-docs__toc a:hover {
    color: var(--bs-primary);
}

.gesq-docs section h2 {
    margin-bottom: 0.75rem;
}

/* ── Cards & tables ──────────────────────────────────────── */

.gesq-card {
    background: var(--gesq-surface);
    border: 1px solid var(--gesq-border);
    border-radius: var(--gesq-radius);
    box-shadow: var(--gesq-shadow);
    overflow: hidden;
}

.gesq-card .card-header {
    background: var(--gesq-surface);
    border-bottom: 1px solid var(--gesq-border);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 1rem 1.25rem;
    color: var(--gesq-text);
}

.gesq-card .card-body {
    padding: 1.25rem;
}

.table-panel {
    background: var(--gesq-surface);
    border: 1px solid var(--gesq-border);
    border-radius: var(--gesq-radius);
    box-shadow: var(--gesq-shadow);
    overflow: hidden;
}

.gesq-table {
    margin: 0;
}

.gesq-table thead th {
    background: var(--gesq-table-head-bg);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gesq-text-muted);
    border-bottom: 1px solid var(--gesq-border);
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.gesq-table tbody td {
    vertical-align: middle;
    font-size: 0.875rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: var(--gesq-text-secondary);
}

.gesq-table tbody tr:last-child td {
    border-bottom: none;
}

.gesq-table tbody tr {
    background-color: var(--gesq-surface);
    transition: background-color 0.15s ease;
}

.gesq-table:not(.gesq-detail-table) tbody tr:hover,
.gesq-table:not(.gesq-detail-table) tbody tr:hover td {
    background-color: var(--gesq-table-hover-bg);
}

.gesq-table tbody tr.gesq-table__row--clickable {
    cursor: pointer;
}

.gesq-table tbody tr.gesq-table__row--clickable:focus-visible {
    outline: 2px solid var(--gesq-primary);
    outline-offset: -2px;
}

.gesq-table tbody td strong,
.gesq-table tbody td a {
    color: var(--gesq-text);
}

.gesq-table tfoot td {
    background: var(--gesq-table-head-bg);
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    border-top: 2px solid var(--gesq-border);
}

/* ── Search & forms ──────────────────────────────────────── */

.search-box {
    max-width: 400px;
    flex: 1;
    background: var(--gesq-surface);
    border: 1px solid var(--gesq-border);
    border-radius: var(--gesq-radius-sm);
    overflow: hidden;
    box-shadow: var(--gesq-shadow);
}

.search-box .input-group-text {
    background: transparent;
    border: none;
    color: var(--gesq-text-muted);
    padding-left: 1rem;
}

.search-box .form-control {
    border: none;
    padding: 0.65rem 0.5rem;
    font-size: 0.9rem;
    box-shadow: none !important;
}

.search-box .form-control:focus {
    background: transparent;
}

.search-box .btn {
    border: none;
    color: var(--gesq-text-muted);
}

.form-select {
    border-radius: var(--gesq-radius-sm);
    border-color: var(--gesq-border);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--gesq-shadow);
}

.form-select:focus {
    border-color: var(--gesq-accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

/* ── Buttons ─────────────────────────────────────────────── */

.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    font-weight: 600;
    border-radius: 8px;
    padding: 0.45rem 1rem;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-outline-primary {
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    border-color: #bfdbfe;
    color: var(--gesq-primary);
}

.btn-outline-primary:hover {
    background: var(--gesq-accent-soft);
    border-color: var(--gesq-accent);
    color: var(--gesq-primary-dark);
}

/* ── Badges ──────────────────────────────────────────────── */

.badge {
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

.badge.bg-secondary {
    background: #e2e8f0 !important;
    color: #475569 !important;
}

/* Bootstrap bg-warning/bg-info default to white badge text — unreadable on light fills */
.badge.bg-warning:not(.text-bg-warning) {
    color: #212529 !important;
}

.badge.bg-info:not(.text-bg-info) {
    color: #212529 !important;
}

.badge.tipo-o { background: #ccfbf1 !important; color: #0f766e !important; }
.badge.tipo-e { background: #ede9fe !important; color: #5b21b6 !important; }
.badge.tipo-c { background: #e0f2fe !important; color: #0369a1 !important; }
.badge.tipo-p { background: #f1f5f9 !important; color: #475569 !important; }
.badge.tipo-b { background: #ffedd5 !important; color: #c2410c !important; }
.badge.tipo-f { background: #dbeafe !important; color: #1d4ed8 !important; }
.badge.tipo-a { background: #f3e8ff !important; color: #7e22ce !important; }
.badge.tipo-m { background: #dcfce7 !important; color: #15803d !important; }

/* ── Empty & loading states ──────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 3.5rem 2rem;
    color: var(--gesq-text-muted);
    background: var(--gesq-surface);
    border: 2px dashed var(--gesq-border);
    border-radius: var(--gesq-radius);
}

.empty-state::before {
    content: '📭';
    display: block;
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

.loading-state {
    text-align: center;
    padding: 4rem 2rem;
}

.loading-state .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--gesq-primary) !important;
}

.loading-state p {
    margin-top: 1rem;
    color: var(--gesq-text-muted);
    font-size: 0.9rem;
}

/* ── Alerts ──────────────────────────────────────────────── */

.alert {
    border-radius: var(--gesq-radius-sm);
    border: none;
    font-size: 0.9rem;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
}

/* ── Pagination ──────────────────────────────────────────── */

.pagination .page-link {
    border-radius: 8px !important;
    margin: 0 2px;
    border: 1px solid var(--gesq-border);
    color: var(--gesq-text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.pagination .page-item.active .page-link {
    background: var(--gesq-primary);
    border-color: var(--gesq-primary);
}

/* ── Detail dl ───────────────────────────────────────────── */

dl.row dt {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gesq-text-muted);
}

dl.row dd {
    color: var(--gesq-text);
    font-weight: 500;
}

h6 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gesq-text-muted);
    margin-bottom: 0.5rem;
}

/* ── Bootstrap overrides ─────────────────────────────────── */

.btn:focus, .btn:active:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.text-primary {
    color: var(--gesq-primary) !important;
}

.spinner-border.text-primary {
    color: var(--gesq-primary) !important;
}

.display-6 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* ── Debug panels ────────────────────────────────────────── */

.debug-panel {
    position: fixed;
    bottom: 0;
    right: 1.25rem;
    z-index: 1050;
    max-width: min(720px, calc(100vw - 2rem));
    font-size: 0.8rem;
}

.debug-panel__toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: #0f172a;
    color: #f8fafc;
    border: none;
    border-radius: 8px 8px 0 0;
    padding: 0.35rem 0.75rem;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.2;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.25);
    cursor: pointer;
}

.debug-panel__badge {
    background: #f59e0b;
    color: #0f172a;
    border-radius: 999px;
    padding: 0.05rem 0.35rem;
    font-size: 0.65rem;
    min-width: 1.1rem;
    line-height: 1.2;
    text-align: center;
}

.debug-panel__body {
    display: none;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 10px 10px 0 0;
    max-height: 45vh;
    overflow-y: auto;
    padding: 0.75rem;
    box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.35);
}

.debug-panel--open .debug-panel__body {
    display: block;
}

.debug-panel__toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.debug-panel__hint {
    color: #94a3b8;
    font-size: 0.72rem;
}

.debug-panel__empty {
    color: #94a3b8;
    margin: 0;
    padding: 1rem 0;
    text-align: center;
}

.debug-panel--left {
    left: 1.25rem;
    right: auto;
}

.debug-panel__toggle--error {
    background: #450a0a;
}

.debug-panel__badge--error {
    background: #f87171;
    color: #450a0a;
}

.debug-exception {
    background: #1e293b;
    border: 1px solid #7f1d1d;
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.5rem;
}

.debug-exception__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.68rem;
}

.debug-exception__index {
    color: #fca5a5;
    font-weight: 700;
}

.debug-exception__time {
    color: #94a3b8;
}

.debug-exception__source {
    color: #fbbf24;
}

.debug-exception__type {
    color: #f87171;
    font-weight: 600;
}

.debug-exception__message {
    color: #fecaca;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    word-break: break-word;
}

.debug-exception__inner {
    color: #cbd5e1;
    font-size: 0.72rem;
    margin-bottom: 0.35rem;
    word-break: break-word;
}

.debug-exception__inner strong {
    color: #fbbf24;
}

.debug-exception__stack {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.68rem;
    line-height: 1.4;
    color: #94a3b8;
    background: #0b1220;
    border-radius: 6px;
    padding: 0.5rem 0.6rem;
    max-height: 12rem;
    overflow-y: auto;
}

.gesq-error-alert__detail {
    margin-top: 0.5rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.45;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    border: none;
}

/* ── Mobile layout ───────────────────────────────────────── */

.mobile-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mobile-list__card {
    background: var(--gesq-mobile-card-bg);
    border: 1px solid var(--gesq-border);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.mobile-list__card--clickable {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.mobile-list__card--clickable:hover {
    background-color: var(--gesq-table-hover-bg);
}

.mobile-list__card--clickable:focus-visible {
    outline: 2px solid var(--gesq-primary);
    outline-offset: 2px;
}

.gesq-picker-results {
    position: absolute;
    z-index: 1050;
    width: 100%;
    max-height: 280px;
    overflow-y: auto;
    margin-top: 0.25rem;
    border-radius: var(--gesq-radius-sm);
}

.gesq-stato-select__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
}

.gesq-stato-select__menu {
    position: fixed;
    z-index: 1051;
    min-width: 0;
    width: auto;
    margin-top: 0;
}

.gesq-stato-select__trigger {
    display: flex;
    align-items: center;
}

.gesq-stato-select__trigger .gesq-stato-select__badge {
    display: block;
    width: 100%;
    text-align: left;
}

.gesq-stato-select__item {
    padding: 0.35rem 0.5rem;
    border: none;
}

.gesq-stato-select__item--selected {
    outline: 2px solid var(--gesq-primary);
    outline-offset: -2px;
}

.gesq-righe-order .btn {
    line-height: 1;
    min-width: 1.75rem;
}

.gesq-stato {
    font-weight: 600;
}

.gesq-stato--buon-fine {
    background-color: #28a745 !important;
    color: #fff !important;
}

.gesq-stato--attesa {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.gesq-stato--spedire {
    background-color: #5bc0de !important;
    color: #212529 !important;
}

.gesq-stato--rifiutata {
    background-color: #dc3545 !important;
    color: #fff !important;
}

.gesq-stato--trasformata {
    background-color: #1e5631 !important;
    color: #fff !important;
}

.gesq-stato--annullata {
    background-color: #fd7e14 !important;
    color: #fff !important;
}

.gesq-field-required {
    background-color: #fff3cd !important;
}

.gesq-section-required {
    background-color: #fff3cd;
    border-radius: var(--gesq-radius-sm);
    padding: 0.75rem;
}

.gesq-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 2000;
}

.gesq-modal {
    position: fixed;
    inset: 0;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    pointer-events: none;
}

.gesq-modal__dialog {
    pointer-events: auto;
    background: var(--gesq-surface);
    border-radius: var(--gesq-radius-sm);
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
}

.gesq-modal__dialog--wide {
    max-width: min(1100px, 96vw);
}

.gesq-modal__dialog--import-mailchimp {
    max-width: min(760px, 96vw);
}

.gesq-modal__dialog--import-mailchimp .gesq-modal__body {
    line-height: 1.55;
}

.gesq-modal__dialog--import-mailchimp .gesq-modal__footer {
    align-items: stretch;
}

.gesq-modal__dialog--import-mailchimp .gesq-modal__footer .btn {
    white-space: normal;
    min-height: 2.75rem;
}

@media (max-width: 720px) {
    .gesq-modal__dialog--import-mailchimp .gesq-modal__footer {
        flex-direction: column;
    }

    .gesq-modal__dialog--import-mailchimp .gesq-modal__footer .btn {
        width: 100%;
    }
}

.gesq-modal__dialog--viewport-90 {
    width: min(90vw, 100%);
    max-width: min(90vw, 100%);
    height: min(90vh, calc(100vh - 2rem));
    max-height: min(90vh, calc(100vh - 2rem));
}

.gesq-modal--viewport-90 .gesq-modal__body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.gesq-modal--viewport-90 .gesq-modal__table-wrap {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}

.gesq-modal--articoli-da-doc .gesq-articoli-da-doc__content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.gesq-modal--articoli-da-doc .gesq-articoli-da-doc__docs {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.gesq-modal--articoli-da-doc .gesq-articoli-da-doc__content--split .gesq-articoli-da-doc__docs {
    flex: 1 1 42%;
    min-height: 0;
}

.gesq-modal--articoli-da-doc .gesq-articoli-da-doc__righe {
    flex: 1 1 58%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    padding-top: 0.75rem;
}

.gesq-modal--articoli-da-doc .gesq-articoli-da-doc__righe-title {
    flex-shrink: 0;
}

.gesq-modal--articoli-da-doc .gesq-articoli-da-doc__righe-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.gesq-modal--articoli-da-doc .gesq-articoli-da-doc__riga--usata > td {
    background-color: color-mix(in srgb, var(--bs-primary, #0d6efd) 8%, transparent);
}

@media (max-width: 576px) {
    .gesq-modal__dialog--viewport-90 {
        width: 100%;
        max-width: 100%;
        height: calc(100vh - 1rem);
        max-height: calc(100vh - 1rem);
    }
}

.gesq-modal__dialog--presentazione-banca {
    width: 80vw;
    max-width: 80vw;
    height: 80vh;
    max-height: 80vh;
}

.gesq-modal--presentazione-banca .gesq-modal__body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0.75rem 1rem 0.5rem;
}

.gesq-presentazione-banca__intro {
    flex-shrink: 0;
    margin-bottom: 0.5rem !important;
}

.gesq-presentazione-banca__scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.15rem;
}

.gesq-presentazione-banca__section-title {
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--gesq-surface);
    padding: 0.35rem 0;
}

.gesq-presentazione-banca__table-wrap {
    margin-bottom: 0.75rem;
}

.gesq-presentazione-banca__table {
    font-size: 0.8125rem;
    table-layout: fixed;
    width: 100%;
}

.gesq-presentazione-banca__table th,
.gesq-presentazione-banca__table td {
    vertical-align: middle;
    padding: 0.35rem 0.4rem;
}

.gesq-presentazione-banca__table .gesq-col-num { width: 3.25rem; }
.gesq-presentazione-banca__table .gesq-col-data { width: 4.5rem; }
.gesq-presentazione-banca__table .gesq-col-importo { width: 5.5rem; }
.gesq-presentazione-banca__table .gesq-col-flag { width: 2.25rem; }
.gesq-presentazione-banca__table .gesq-col-azioni { width: 7.5rem; }
.gesq-presentazione-banca__table .gesq-col-cliente {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gesq-presentazione-banca__table .gesq-col-banca {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 6rem;
}
.gesq-presentazione-banca__table .gesq-col-note { width: 28%; }

.gesq-presentazione-banca__group-row td {
    background: var(--gesq-group-row-bg);
    font-size: 0.8rem;
    padding: 0.3rem 0.4rem;
    white-space: normal;
    line-height: 1.3;
}

.gesq-presentazione-banca__note {
    font-size: 0.75rem;
    min-height: 1.75rem;
    resize: vertical;
    max-height: 4.5rem;
}

.gesq-presentazione-banca__note-save {
    font-size: 0.7rem;
    line-height: 1.2;
}

.gesq-presentazione-banca__totals {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-end;
    gap: 0.65rem 1.25rem;
    padding: 0.65rem 0.15rem 0.15rem;
    margin-top: 0.35rem;
    border-top: 2px solid var(--gesq-primary, #1e40af);
    background: var(--gesq-bar-gradient);
    box-shadow: 0 -4px 16px rgba(30, 64, 175, 0.08);
}

.gesq-presentazione-banca__total-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
    background: var(--gesq-bar-panel-bg);
    border: 1px solid var(--gesq-bar-panel-border);
    border-radius: 8px;
    padding: 0.35rem 0.75rem;
}

.gesq-presentazione-banca__total-item--grand {
    border-color: var(--gesq-primary, #1e40af);
    background: var(--gesq-surface);
}

.gesq-presentazione-banca__total-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gesq-primary-dark, #1e3a8a);
}

.gesq-presentazione-banca__total-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gesq-primary, #1e40af);
    white-space: nowrap;
}

.gesq-presentazione-banca__total-item--grand .gesq-presentazione-banca__total-value {
    font-size: 1.3rem;
}

.riba-ant-form__note {
    min-height: 9rem;
    resize: vertical;
    font-size: 0.95rem;
    line-height: 1.45;
}

.riba-ant-form__caricato {
    min-width: 7.5rem;
}

.riba-ant-form__data-caricamento {
    min-width: 10.5rem;
}

.riba-ant-list__filtro-in-banca {
    width: auto;
    min-width: 10rem;
}

.riba-ant-list__note {
    min-width: 12rem;
    max-width: 36rem;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--gesq-text-muted);
    vertical-align: top;
}

.riba-ant-list .gesq-table tbody td {
    vertical-align: top;
}

.riba-ant-mobile__note {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.45;
    font-size: 0.9rem;
    color: var(--gesq-text-secondary);
}

.mobile-card__row--stack {
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
}

.mobile-card__row--stack .mobile-card__label {
    text-align: left;
}

.gesq-modal__dialog--export-contabilita {
    max-width: min(1180px, 98vw);
    max-height: calc(100vh - 1rem);
    height: min(880px, calc(100vh - 1rem));
}

.gesq-modal--export-contabilita .gesq-modal__body {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.gesq-export-contabilita__filters {
    flex-shrink: 0;
}

.gesq-export-contabilita__iva {
    flex-shrink: 0;
}

.gesq-export-contabilita__iva-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.25rem;
}

.gesq-export-contabilita__iva-cell {
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: 0.25rem;
    padding: 0.2rem 0.35rem;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.2;
}

.gesq-export-contabilita__iva-cell--active {
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.08);
}

.gesq-export-contabilita__iva-label {
    display: block;
    color: var(--bs-secondary-color);
    font-size: 0.65rem;
}

.gesq-export-contabilita__iva-value {
    display: block;
    font-weight: 600;
    font-size: 0.7rem;
}

.gesq-export-contabilita__scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.gesq-export-contabilita__table {
    font-size: 0.8125rem;
}

.gesq-export-contabilita__cliente {
    max-width: 10rem;
}

.gesq-export-contabilita__riga {
    font-size: 0.75rem;
    white-space: normal;
    word-break: break-word;
}

.gesq-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    flex-shrink: 0;
}

.gesq-modal__title {
    margin: 0;
    font-size: 1.1rem;
}

.gesq-modal__body {
    padding: 1rem 1.25rem;
    overflow: auto;
    flex: 1;
}

.gesq-modal__footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Dialogo email documento: resta visibile tra header e footer fissi */
.gesq-modal--email-doc {
    align-items: flex-start;
    padding-top: calc(var(--gesq-main-header-height) + var(--gesq-doc-detail-header-height) + 0.5rem);
    padding-bottom: calc(var(--gesq-doc-footer-height) + 0.75rem);
}

.gesq-modal--email-doc .gesq-modal__dialog {
    max-height: calc(
        100vh - var(--gesq-main-header-height) - var(--gesq-doc-detail-header-height)
        - var(--gesq-doc-footer-height) - 1.5rem
    );
}

.gesq-modal__table-wrap {
    max-height: 55vh;
    overflow-y: auto;
}

/* ── Fattura elettronica XML SDI ──────────────────────────── */

.gesq-col-fe-xml {
    width: 7.5rem;
    white-space: nowrap;
    overflow: visible;
    position: relative;
}

.documento-fe-xml-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    overflow: visible;
}

/* Tooltip esplicativi sulle icone XML in lista FE */
.gesq-tip {
    position: relative;
}

.gesq-tip::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    z-index: 2100;
    min-width: 10rem;
    max-width: 16rem;
    padding: 0.4rem 0.55rem;
    border-radius: var(--gesq-radius-sm);
    background: var(--bs-emphasis-color, #212529);
    color: var(--bs-body-bg, #fff);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.35;
    text-align: center;
    white-space: normal;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease, visibility 0.12s ease;
}

.gesq-tip::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 2px);
    transform: translateX(-50%);
    z-index: 2100;
    border: 5px solid transparent;
    border-top-color: var(--bs-emphasis-color, #212529);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.12s ease, visibility 0.12s ease;
}

.gesq-tip:hover::after,
.gesq-tip:hover::before,
.gesq-tip:focus-visible::after,
.gesq-tip:focus-visible::before {
    opacity: 1;
    visibility: visible;
}

.gesq-tip--error::after {
    background: var(--bs-danger);
    max-width: 18rem;
}

.gesq-tip--error::before {
    border-top-color: var(--bs-danger);
}

.gesq-fe-xml-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--gesq-radius-sm);
    border: 1px solid transparent;
    padding: 0;
    background: transparent;
}

.gesq-fe-xml-icon--present {
    color: var(--bs-success);
    border-color: rgba(var(--bs-success-rgb), 0.35);
    background: rgba(var(--bs-success-rgb), 0.08);
    cursor: pointer;
}

.gesq-fe-xml-icon--present:hover:not(:disabled) {
    background: rgba(var(--bs-success-rgb), 0.16);
}

.gesq-fe-xml-icon--missing {
    color: var(--bs-warning);
    border-color: rgba(var(--bs-warning-rgb), 0.4);
    background: rgba(var(--bs-warning-rgb), 0.12);
}

.gesq-fe-xml-icon--folder {
    color: var(--gesq-primary);
    border-color: rgba(30, 64, 175, 0.25);
    background: rgba(30, 64, 175, 0.06);
    cursor: pointer;
}

.gesq-fe-xml-icon--folder:hover:not(:disabled) {
    background: rgba(30, 64, 175, 0.12);
}

.gesq-fe-xml-icon--validate {
    color: var(--bs-secondary);
}

.gesq-fe-xml-icon--validate:hover:not(:disabled) {
    background: rgba(25, 135, 84, 0.12);
    color: var(--bs-success);
}

.gesq-fe-xml-icon--bank {
    color: #0d6efd;
    border-color: rgba(13, 110, 253, 0.3);
}

.gesq-fe-xml-icon--bank:hover:not(:disabled) {
    background: rgba(13, 110, 253, 0.12);
}

.fe-cerca-pagamento__section-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.fe-cerca-pagamento__table-wrap {
    max-height: 280px;
    overflow: auto;
}

.fe-cerca-pagamento__table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--gesq-table-head-bg, var(--bs-tertiary-bg, #f8f9fa));
    box-shadow: 0 1px 0 var(--gesq-border, #dee2e6);
}

.fe-cerca-pagamento__conto {
    max-width: 8rem;
}

.fe-cerca-pagamento__desc {
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fe-cerca-pagamento__giust {
    font-size: 0.75rem;
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fe-cerca-pagamento__row--linked {
    background: rgba(var(--bs-success-rgb), 0.08);
}

.mov-bancari-list__conto {
    max-width: 10rem;
}

.mov-bancari-list__desc {
    max-width: 22rem;
}

.mov-bancari-list__cliente {
    max-width: 12rem;
}

.mov-bancari-spese-table__bar-col {
    width: 8rem;
    min-width: 6rem;
}

.mov-bancari-spese-bar {
    height: 0.45rem;
    background: var(--bs-secondary-bg);
    border-radius: 999px;
    overflow: hidden;
}

.mov-bancari-spese-bar__fill {
    height: 100%;
    width: var(--pct, 0%);
    max-width: 100%;
    background: var(--bs-danger);
    border-radius: inherit;
    transition: width 0.2s ease;
}

.gesq-search-hit {
    padding: 0 0.12em;
    border-radius: 0.15em;
    background: #fef08a;
    color: inherit;
    font-weight: inherit;
}

[data-bs-theme="dark"] .gesq-search-hit {
    background: #854d0e;
    color: #fef9c3;
}

.gesq-stat-section {
    overflow: hidden;
}

.gesq-stat-section--collapsed .gesq-stat-section__toggle {
    border-radius: var(--gesq-radius-sm);
}

.gesq-stat-section__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    width: 100%;
    padding: 0.85rem 1.1rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.gesq-stat-section__toggle:hover {
    background: var(--gesq-table-head-bg);
}

.gesq-stat-section__toggle-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    min-width: 0;
}

.gesq-stat-section__title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bs-secondary-color);
}

.gesq-stat-section__extra {
    font-size: 0.8rem;
}

.gesq-stat-section__summary {
    margin-left: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
}

.gesq-stat-section__chevron {
    flex-shrink: 0;
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
    line-height: 1;
}

.gesq-stat-section__body {
    padding: 0 1.1rem 1.1rem;
    border-top: 1px solid var(--gesq-border-color, var(--bs-border-color));
}

.gesq-card .gesq-stat-section.gesq-card {
    margin-bottom: 1.25rem;
    box-shadow: none;
}

.gesq-fe-xml-create-btn--compact {
    min-width: 2rem;
    padding-inline: 0.35rem;
}

.gesq-sort-header {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: inherit;
    width: 100%;
}

th.text-end .gesq-sort-header {
    justify-content: flex-end;
}

th.text-center .gesq-sort-header {
    justify-content: center;
}

.gesq-sort-header:hover {
    color: var(--bs-primary);
}

.gesq-sort-header--active {
    color: var(--bs-primary);
}

.gesq-sort-header__icon {
    font-size: 0.75rem;
    opacity: 0.55;
    line-height: 1;
}

.gesq-sort-header--active .gesq-sort-header__icon {
    opacity: 1;
}

.gesq-infinite-scroll-sentinel {
    height: 1px;
    width: 100%;
}

.gesq-infinite-scroll-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Allegati drag & drop ─────────────────────────────────── */

.gesq-allegati-drop {
    border-radius: var(--gesq-radius-sm);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.gesq-allegati-drop--active {
    border: 2px dashed var(--gesq-primary);
    background: var(--gesq-accent-soft);
    padding: 0.75rem;
}

.gesq-allegati-drop--uploading {
    opacity: 0.85;
    pointer-events: none;
}

.gesq-allegati-drop__hint {
    margin-bottom: 0.5rem;
}

/* ── Lead import JSON (drop + multifile) ──────────────────── */

.gesq-lead-import-drop {
    position: relative;
}

.gesq-lead-import-drop--busy {
    opacity: 0.85;
    pointer-events: none;
}

.gesq-lead-import-drop__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

/* ── AI Upload (carico merci) ─────────────────────────────── */

.gesq-ai-upload__zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.75rem 1.25rem;
    border: 2px dashed var(--gesq-border);
    border-radius: var(--gesq-radius-sm);
    background: var(--gesq-surface);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.gesq-ai-upload__zone:hover {
    border-color: var(--gesq-primary);
    background: var(--gesq-accent-soft);
}

.gesq-ai-upload__zone--busy {
    cursor: default;
    pointer-events: none;
    opacity: 0.85;
}

.gesq-ai-upload__icon {
    font-size: 1.5rem;
    line-height: 1;
    margin-bottom: 0.5rem;
    color: var(--gesq-primary);
}

.gesq-ai-upload__title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.gesq-ai-upload__hint {
    max-width: 28rem;
}

.gesq-ai-upload__input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Documento: campi emesso / modificabile ───────────────── */

.gesq-doc-field {
    background-color: var(--gesq-input-bg);
    border: 1px solid var(--gesq-border);
    border-radius: var(--gesq-radius-sm);
    padding: 0.45rem 0.75rem;
    margin: 0;
    min-height: 2.125rem;
}

.gesq-doc-detail--emesso .gesq-doc-field {
    background-color: var(--gesq-field-readonly-bg);
    border-color: var(--gesq-border);
}

.gesq-doc-form .form-control,
.gesq-doc-form .form-select,
.gesq-doc-form .gesq-stato-select__trigger {
    background-color: var(--gesq-input-bg);
}

.gesq-doc-form--emesso .form-control:not(:focus):not(.gesq-field-required),
.gesq-doc-form--emesso .form-select:not(:focus):not(.gesq-field-required),
.gesq-doc-form--emesso .gesq-stato-select__trigger:not(:focus) {
    background-color: var(--gesq-field-readonly-bg);
}

.gesq-doc-detail--emesso .gesq-detail-table tbody td,
.gesq-doc-detail--emesso .gesq-detail-table tfoot td {
    background-color: var(--gesq-table-head-bg);
}

/* Righe separatore documento (codice ---) */
.gesq-riga-separatore td {
    background-color: #e3f2fd !important;
}

.gesq-riga-separatore__descrizione {
    font-weight: 600;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.gesq-riga-separatore__descrizione.form-control {
    background-color: #e3f2fd;
    border: none;
    box-shadow: none;
}

.gesq-riga-separatore__descrizione.form-control:focus {
    background-color: #e3f2fd;
    border: none;
    box-shadow: none;
    outline: none;
}

.gesq-detail-table .gesq-riga-descrizione-col,
.gesq-detail-table td.gesq-riga-descrizione-cell,
.gesq-detail-table td.gesq-riga-descrizione-readonly {
    overflow: hidden;
    vertical-align: top;
    min-width: 8rem;
    max-width: 0;
}

.gesq-riga-descrizione {
    resize: vertical;
    overflow: auto;
    display: block;
    box-sizing: border-box;
    min-height: 2.5rem;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    line-height: 1.35;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.gesq-riga-descrizione-readonly {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow: hidden;
}

/* Lista articoli in modifica documento: area scroll che riempie lo spazio verticale residuo */
main.main-area:has(.gesq-doc-editor) {
    min-height: 0;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}

article.content:has(.gesq-doc-editor) {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

article.content:has(.gesq-doc-editor) > :not(.gesq-doc-editor) {
    flex-shrink: 0;
}

.gesq-doc-editor {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

.gesq-doc-editor > :not(.gesq-doc-editor__articoli) {
    flex-shrink: 0;
}

.gesq-doc-editor__articoli {
    flex: 1 1 0;
    min-height: 14rem;
    max-height: calc(100dvh - var(--gesq-main-header-height) - var(--gesq-doc-editor-articoli-chrome));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gesq-doc-editor__articoli > .card-header {
    flex-shrink: 0;
}

.gesq-doc-editor__articoli-body {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
    overflow: hidden;
}

.gesq-doc-editor__actions {
    flex-shrink: 0;
}

.gesq-doc-righe-editor {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gesq-doc-righe-editor__toolbar {
    flex-shrink: 0;
    overflow: visible;
    position: relative;
    z-index: 3;
}

.gesq-doc-righe-editor__list-wrap {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gesq-doc-righe-editor__list-wrap--with-footer {
    min-height: 0;
}

.gesq-doc-righe-editor__empty {
    flex: 1 1 auto;
    padding-right: 4.5rem;
    padding-bottom: 3.5rem;
}

.gesq-doc-righe-editor__list-wrap--with-footer .gesq-doc-righe-editor__empty {
    padding-bottom: 3.75rem;
}

.gesq-doc-righe-editor__body-zone {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gesq-doc-righe-editor__table-frame {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gesq-doc-righe-editor__table-frame--split {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.gesq-doc-righe-editor__split-table {
    min-width: 640px;
    margin-bottom: 0;
    table-layout: fixed;
    width: 100%;
}

.gesq-doc-righe-editor__split-table thead th {
    position: static;
    box-shadow: none;
    background: var(--gesq-table-head-bg);
    border-bottom: 1px solid var(--gesq-border);
}

.gesq-doc-righe-th {
    position: relative;
}

.gesq-doc-righe-col-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
    touch-action: none;
    z-index: 2;
}

.gesq-doc-righe-col-resize-handle:hover,
.gesq-doc-righe-col-resize-handle.gesq-doc-righe-col-resize-handle--active {
    background: color-mix(in srgb, var(--gesq-primary, #0d6efd) 35%, transparent);
}

body.gesq-doc-righe-col-resizing {
    cursor: col-resize !important;
    user-select: none;
}

body.gesq-doc-righe-col-resizing * {
    cursor: col-resize !important;
}

.gesq-doc-righe-editor__table-frame--split > .gesq-doc-righe-editor__split-table:first-child {
    flex-shrink: 0;
}

.gesq-doc-righe-editor__tbody-scroll {
    flex: 0 1 auto;
    min-height: 0;
    height: fit-content;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4rem;
}

.gesq-doc-righe-editor__split-table--body tbody tr:last-child td {
    border-bottom-width: 0;
}

.gesq-doc-righe-editor__scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 3.75rem;
}

.gesq-doc-righe-editor__list-wrap--with-footer .gesq-doc-righe-editor__scroll {
    padding-bottom: 0.5rem;
}

.gesq-doc-righe-editor__fab {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 3;
}

.gesq-doc-righe-editor__body-zone .gesq-doc-righe-editor__fab {
    bottom: 0.75rem;
}

.gesq-doc-righe-editor__fab-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
}

.gesq-doc-righe-editor__fab-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.5rem);
    z-index: 1051;
    min-width: 16.5rem;
    padding: 0.35rem 0;
    background: var(--gesq-surface, #fff);
    border: 1px solid var(--gesq-border, #dee2e6);
    border-radius: var(--gesq-radius-sm, 0.375rem);
}

.gesq-doc-righe-editor__fab-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.65rem;
    font-weight: 300;
    line-height: 1;
    box-shadow: 0 4px 16px rgba(30, 64, 175, 0.35);
}

.gesq-doc-righe-editor__fab-btn:hover,
.gesq-doc-righe-editor__fab-btn:focus-visible {
    box-shadow: 0 6px 20px rgba(30, 64, 175, 0.45);
}

.gesq-doc-righe-readonly-table .gesq-detail-table {
    table-layout: fixed;
    width: 100%;
}

.gesq-doc-righe-editor__scroll .gesq-detail-table,
.gesq-doc-righe-editor__split-table {
    min-width: 640px;
    table-layout: fixed;
    width: 100%;
}

.gesq-doc-form .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--gesq-table-head-bg);
    box-shadow: 0 1px 0 var(--gesq-border);
}

/* Barra fissa dettaglio documento */
.gesq-doc-detail-page {
    padding-top: var(--gesq-doc-detail-header-height);
}

.gesq-doc-detail-page--footer {
    padding-bottom: calc(var(--gesq-doc-footer-height) + 0.75rem);
}

.gesq-doc-detail-header {
    position: fixed;
    top: var(--gesq-main-header-height);
    left: 0;
    right: 0;
    z-index: 1030;
    background: var(--gesq-detail-header-bg);
    border-bottom: 2px solid #e3f2fd;
    box-shadow: 0 6px 28px rgba(227, 242, 253, 0.85);
    overflow: visible;
}

.gesq-doc-detail-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #e3f2fd;
}

.gesq-doc-detail-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    min-height: var(--gesq-doc-detail-header-height);
    padding: 0.65rem 1.5rem;
}

.gesq-doc-detail-header__meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1 1 auto;
}

.gesq-doc-nav-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.gesq-doc-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    flex-shrink: 0;
}

.gesq-doc-back-link svg {
    display: block;
}

.gesq-doc-detail-header__title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    min-width: 0;
}

.gesq-doc-detail-header__tipo {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gesq-primary-dark);
    background: var(--gesq-accent-soft);
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
    border: 1px solid #bae6fd;
}

.gesq-doc-detail-header__numero {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gesq-primary);
}

.gesq-doc-detail-header__data {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gesq-text-secondary);
    white-space: nowrap;
    padding-left: 0.65rem;
    border-left: 2px solid #bfdbfe;
}

.gesq-doc-detail-header__actions {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    max-width: 100%;
}

.gesq-doc-action-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem 0.5rem;
    min-width: 0;
    max-width: 100%;
}

.gesq-doc-action-toolbar__group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    max-width: 100%;
}

.gesq-doc-action-toolbar__group + .gesq-doc-action-toolbar__group {
    padding-left: 0.5rem;
    margin-left: 0.15rem;
    border-left: 1px solid var(--gesq-border, #dee2e6);
}

.gesq-doc-action-toolbar__group-inner {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.gesq-doc-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.gesq-doc-action-btn__icon {
    flex-shrink: 0;
    opacity: 0.85;
}

.gesq-doc-action-btn__chevron {
    flex-shrink: 0;
    opacity: 0.65;
    margin-left: 0.1rem;
}

.gesq-doc-action-btn--dropdown {
    padding-right: 0.55rem;
}

.gesq-doc-action-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    line-height: 1.2;
}

.gesq-doc-action-badge--ok {
    background: rgba(var(--bs-success-rgb), 0.12);
    color: var(--bs-success-text-emphasis, #0a3622);
}

.gesq-doc-action-badge--missing {
    background: rgba(var(--bs-warning-rgb), 0.15);
    color: var(--bs-warning-text-emphasis, #997404);
}

.gesq-doc-action-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.gesq-doc-action-dropdown__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
}

.gesq-doc-action-dropdown__menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    z-index: 1050;
    min-width: 14rem;
    background: var(--gesq-surface, #fff);
    border: 1px solid var(--gesq-border, #dee2e6);
    border-radius: var(--gesq-radius-sm, 0.25rem);
    padding: 0.25rem 0;
}

.document-print-actions-host--header {
    position: relative;
}

.gesq-doc-detail-header__options {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 3;
    width: min(32rem, calc(100vw - 2rem));
    background: var(--gesq-surface);
    border: 1px solid var(--gesq-border);
    border-radius: var(--gesq-radius-sm);
    box-shadow: var(--gesq-shadow-lg);
}

.gesq-doc-detail-header__options-body {
    padding: 0.85rem 1rem;
}

@media (min-width: 641px) {
    .gesq-doc-detail-header {
        left: 272px;
    }
}

@media (min-width: 641px) and (max-width: 1399.98px) {
    :root {
        --gesq-doc-detail-header-height: 6.25rem;
    }
}

@media (max-width: 640.98px) {
    :root {
        --gesq-main-header-height: 3.75rem;
        --gesq-doc-detail-header-height: 4.75rem;
        --gesq-doc-footer-height: 5.25rem;
        --gesq-doc-righe-inline-footer-height: 5.5rem;
        --gesq-doc-editor-articoli-chrome: 17rem;
    }

    .gesq-doc-detail-header__inner {
        align-items: flex-start;
    }

    .gesq-doc-detail-header__actions {
        width: 100%;
    }
}

/* Barra fissa righe documento */
.gesq-doc-righe-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1010;
    background: var(--gesq-bar-gradient);
    border-top: 2px solid #e3f2fd;
    box-shadow: 0 -6px 28px rgba(227, 242, 253, 0.85);
}

.gesq-doc-righe-footer--sticky {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    flex-shrink: 0;
    z-index: 2;
    margin-top: auto;
    border-bottom: 2px solid #e3f2fd;
    box-shadow: none;
}

.gesq-doc-righe-footer--sticky .gesq-doc-righe-footer__inner--readonly {
    min-height: var(--gesq-doc-righe-inline-footer-height);
    margin: 0;
    padding: 0.5rem 1rem;
    padding-right: 4.5rem;
    border-color: #90caf9;
}

.gesq-doc-righe-footer:not(.gesq-doc-righe-footer--sticky)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #e3f2fd;
}

.gesq-doc-righe-footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    max-width: 100%;
    min-height: var(--gesq-doc-footer-height);
    padding: 0.85rem 1.5rem;
    margin: 0 auto;
}

.gesq-doc-righe-footer__total {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    flex-wrap: wrap;
    background: var(--gesq-bar-panel-bg);
    border: 1px solid var(--gesq-bar-panel-border);
    border-radius: 10px;
    padding: 0.45rem 0.85rem;
}

.gesq-doc-righe-footer__label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gesq-primary-dark);
}

.gesq-doc-righe-footer__value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gesq-primary);
}

.gesq-doc-righe-footer__inner--readonly {
    justify-content: flex-end;
    background: var(--gesq-bar-panel-bg);
    border-radius: 10px;
    margin: 0 0.5rem;
    padding: 0.65rem 1rem;
    border: 1px solid var(--gesq-bar-panel-border);
}

.gesq-doc-detail-footer__item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gesq-doc-detail-footer__value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gesq-text);
}

.gesq-doc-detail-footer__item--totale .gesq-doc-righe-footer__value {
    font-size: 1.45rem;
}

.gesq-doc-detail-footer__item--totale {
    padding-left: 1rem;
    margin-left: 0.25rem;
    border-left: 2px solid #93c5fd;
}

@media (min-width: 641px) {
    .gesq-doc-righe-footer:not(.gesq-doc-righe-footer--sticky) {
        left: 272px;
    }

    .gesq-doc-righe-footer__inner--readonly {
        gap: 1.5rem 2rem;
    }
}

@media (max-width: 640.98px) {
    .gesq-doc-righe-footer__inner--readonly {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
    }

    .gesq-doc-righe-footer--sticky .gesq-doc-righe-footer__inner--readonly {
        padding-right: 1rem;
    }

    .gesq-doc-detail-footer__item {
        justify-content: space-between;
    }
}

.gesq-doc-sezioni__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.gesq-doc-sezioni__toggle:hover {
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.gesq-doc-sezioni--collapsed .gesq-doc-sezioni__toggle {
    border-radius: var(--gesq-radius-sm, 0.25rem);
}

.gesq-doc-sezioni__toggle-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    min-width: 0;
}

.gesq-doc-sezioni__title {
    font-weight: 600;
    font-size: 0.95rem;
}

.gesq-doc-sezioni__summary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gesq-doc-sezioni__chevron {
    flex-shrink: 0;
    color: var(--bs-secondary-color);
    font-size: 0.75rem;
}

.gesq-doc-sezioni__tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.15rem;
    padding: 0.5rem 0.75rem 0;
    border-bottom: 1px solid var(--bs-border-color);
    overflow-x: auto;
    scrollbar-width: thin;
}

.gesq-doc-sezioni__tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    border-radius: var(--gesq-radius-sm, 0.25rem) var(--gesq-radius-sm, 0.25rem) 0 0;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.gesq-doc-sezioni__tab:hover {
    color: var(--bs-body-color);
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.gesq-doc-sezioni__tab--active {
    color: var(--bs-primary);
    border-bottom-color: var(--bs-primary);
    background: var(--bs-body-bg);
}

.gesq-doc-sezioni__tab-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--bs-warning);
}

.gesq-doc-sezioni__tab-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    background: rgba(var(--bs-warning-rgb), 0.15);
    color: var(--bs-warning-text-emphasis, #997404);
}

.gesq-doc-sezioni__tab-count {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    font-weight: 400;
}

.gesq-doc-sezioni__content {
    padding: 0.75rem 1rem 1rem;
}

.gesq-doc-sezioni-embed {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.gesq-doc-sezioni-embed > .card-body {
    padding-left: 0;
    padding-right: 0;
}

.gesq-doc-sezioni-panel {
    padding: 0;
}

.gesq-doc-notes__field {
    background-color: var(--gesq-input-bg) !important;
}

.gesq-doc-notes--collapsed .gesq-doc-notes__toggle {
    border-radius: var(--gesq-radius-sm);
}

.gesq-doc-notes__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    width: 100%;
    padding: 0.85rem 1.1rem;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.gesq-doc-notes__toggle:hover {
    background: var(--gesq-table-head-bg);
}

.gesq-doc-notes--has-content.gesq-doc-notes--collapsed .gesq-doc-notes__toggle {
    background: #fffbeb;
}

.gesq-doc-notes--has-content.gesq-doc-notes--collapsed .gesq-doc-notes__toggle:hover {
    background: #fef3c7;
}

.gesq-doc-notes__toggle-main {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.gesq-doc-notes__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gesq-text);
}

.gesq-doc-notes__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 8px;
    background: #fde68a;
    color: #b45309;
    flex-shrink: 0;
}

.gesq-doc-notes__badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
}

.gesq-doc-notes__chevron {
    color: var(--gesq-text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.gesq-doc-notes__body {
    border-top: 1px solid var(--gesq-border);
    padding-top: 1rem;
}

.gesq-doc-allegati__icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.gesq-doc-allegati.gesq-doc-notes--has-content.gesq-doc-notes--collapsed .gesq-doc-notes__toggle {
    background: #eff6ff;
}

.gesq-doc-allegati.gesq-doc-notes--has-content.gesq-doc-notes--collapsed .gesq-doc-notes__toggle:hover {
    background: #dbeafe;
}

.gesq-doc-allegati.gesq-doc-notes--has-content.gesq-doc-notes--collapsed .gesq-doc-notes__badge {
    color: #1d4ed8;
    background: #dbeafe;
    border-color: #93c5fd;
}

.gesq-infinite-scroll-info {
    padding: 0.5rem 0 0.25rem;
    text-align: center;
}

/* ── Cliente dettaglio ───────────────────────────────────── */

.gesq-tabs .nav-link {
    font-weight: 500;
    color: var(--gesq-text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.5rem 1rem;
}

.gesq-tabs .nav-link.active {
    color: var(--gesq-primary);
    border-bottom-color: var(--gesq-primary);
    background: transparent;
}

.cliente-kpi-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.cliente-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.cliente-kpi__label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--gesq-text-muted, #6b7280);
    letter-spacing: 0.03em;
}

.cliente-kpi__value {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.cliente-kpi__trend-icon {
    font-size: 0.9rem;
    margin-left: 0.15rem;
}

.gesq-dl-compact dt {
    font-size: 0.8rem;
    color: var(--gesq-text-muted, #6b7280);
}

.gesq-dl-compact dd {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.gesq-chart-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    isolation: isolate;
}

.gesq-chart-wrap canvas {
    display: block;
    max-width: 100% !important;
}

.gesq-table--compact td,
.gesq-table--compact th {
    padding: 0.35rem 0.5rem;
    font-size: 0.875rem;
}

.gesq-table__actions {
    width: 2.25rem;
    padding-left: 0.25rem !important;
    padding-right: 0.25rem !important;
    text-align: center;
    vertical-align: middle;
}

.gesq-btn-icon {
    width: 2rem;
    height: 2rem;
    padding: 0;
    line-height: 1;
    font-size: 1.1rem;
    font-weight: 700;
}

.mobile-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.mobile-card__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gesq-text);
    line-height: 1.3;
}

.mobile-card__title a {
    color: inherit;
    text-decoration: none;
}

.mobile-card__title a:hover {
    color: var(--gesq-primary);
}

.mobile-card__meta {
    font-size: 0.8rem;
    color: var(--gesq-text-muted);
    margin-top: 0.15rem;
}

.mobile-card__subtitle {
    font-size: 0.875rem;
    color: var(--gesq-text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.mobile-card__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.3rem 0;
    font-size: 0.875rem;
}

.mobile-card__row--highlight {
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--gesq-border);
}

.mobile-card__label {
    color: var(--gesq-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    flex-shrink: 0;
}

.mobile-card__value-truncate {
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.mobile-card__actions {
    margin-top: 0.85rem;
}

.mobile-card__actions .btn {
    min-height: 2.5rem;
}

.document-print-actions .btn svg {
    vertical-align: -2px;
}

.gesq-list-toolbar .search-box {
    flex: 1 1 100%;
    min-width: 0;
}

.gesq-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.gesq-pagination .page-link {
    min-width: 2.25rem;
    min-height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-panel--scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-panel--scroll .gesq-table {
    min-width: 640px;
}

@media (max-width: 767.98px) {
    .page-header h1 {
        font-size: 1.5rem;
    }

    .dashboard-hero h1 {
        font-size: 1.6rem;
    }

    .dashboard-hero p {
        font-size: 0.9rem;
    }

    .stat-card {
        padding: 0.85rem;
    }

    .stat-value {
        font-size: 1.35rem;
    }

    .highlight-card__value {
        font-size: clamp(1.05rem, 2.8vw, 1.35rem);
    }

    .gesq-card .card-header {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .gesq-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .gesq-pagination .pagination {
        justify-content: center;
    }

    .gesq-pagination__info {
        text-align: center;
    }

    .debug-panel {
        left: 0.5rem;
        right: 0.5rem;
        max-width: none;
    }

    .debug-panel--left {
        left: 0.5rem;
        right: 0.5rem;
    }

    .debug-panel__body {
        max-height: 38vh;
    }

    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) thead {
        display: none;
    }

    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) colgroup {
        display: none;
    }

    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody tr {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.55rem 0.7rem;
        margin-bottom: 0.85rem;
        border: 1px solid var(--gesq-border);
        border-radius: 10px;
        padding: 0.75rem 0.85rem;
        background: var(--gesq-mobile-card-bg);
        width: 100%;
        box-sizing: border-box;
    }

    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0.2rem;
        flex: 1 1 100%;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        padding: 0;
        border: none;
        text-align: left !important;
        white-space: normal;
        overflow: visible;
        box-sizing: border-box;
    }

    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--gesq-text-muted);
        text-align: left;
        flex-shrink: 0;
        line-height: 1.2;
    }

    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td:not([data-label])::before,
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label=""]::before {
        display: none;
    }

    /* Campi corti: due per riga, label sopra valore */
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Q.tà"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="U.M."],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Prezzo (€)"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Sconto"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="IVA"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Pz/conf."],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Totale"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="#"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Stampa"] {
        flex: 1 1 calc(50% - 0.35rem);
        width: auto !important;
        min-width: calc(50% - 0.35rem) !important;
        max-width: calc(50% - 0.35rem) !important;
    }

    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Codice"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Descrizione"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Lotto/Seriale"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Categoria"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Sezione"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td.gesq-riga-descrizione-cell,
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td.gesq-riga-descrizione-readonly,
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td.gesq-riga-separatore__descrizione {
        flex: 1 1 100%;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
    }

    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td.gesq-riga-descrizione-readonly,
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td.gesq-riga-descrizione-cell {
        overflow: visible;
    }

    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody .gesq-riga-descrizione,
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody .gesq-riga-descrizione-readonly {
        width: 100%;
        max-width: none;
        overflow: visible;
        overflow-wrap: break-word;
        word-break: normal;
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td .form-control,
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td .form-select,
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td textarea {
        width: 100%;
        max-width: none;
    }

    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Prezzo (€)"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Totale"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Q.tà"],
    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Sconto"] {
        font-variant-numeric: tabular-nums;
    }

    .gesq-detail-table:not(.gesq-doc-righe-editor__split-table) tbody td[data-label="Totale"] {
        font-weight: 600;
    }

    .gesq-detail-table__totals tr {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 0.25rem 1rem;
        padding: 0.35rem 0;
    }

    .gesq-detail-table__totals td {
        border: none;
        padding: 0.15rem 0;
        max-width: none !important;
        min-width: 0 !important;
        width: auto !important;
    }

    .gesq-detail-table__totals td[colspan] {
        display: none;
    }
}

/* ── Login ───────────────────────────────────────────────── */

.login-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--gesq-bg);
}

.login-brand {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    padding-top: max(3rem, env(safe-area-inset-top, 0px));
    padding-left: max(3rem, env(safe-area-inset-left, 0px));
    background: var(--gesq-brand-panel-bg);
    color: #fff;
    overflow: hidden;
}

.login-brand__content {
    position: relative;
    z-index: 1;
    max-width: 22rem;
}

.login-brand__logo {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.login-brand__title {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin: 0 0 0.75rem;
    line-height: 1.1;
}

.login-brand__tagline {
    margin: 0 0 2rem;
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.72);
}

.login-brand__features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.login-brand__features li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
}

.login-brand__features li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gesq-accent);
    flex-shrink: 0;
    box-shadow: 0 0 8px var(--gesq-accent);
}

.login-brand__glow {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.login-brand__glow--1 {
    width: 420px;
    height: 420px;
    top: -120px;
    right: -80px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.35) 0%, transparent 70%);
}

.login-brand__glow--2 {
    width: 320px;
    height: 320px;
    bottom: -60px;
    left: -40px;
    background: radial-gradient(circle, rgba(30, 64, 175, 0.4) 0%, transparent 70%);
}

.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
    padding-right: max(2rem, env(safe-area-inset-right, 0px));
    position: relative;
    background:
        radial-gradient(ellipse at 100% 0%, rgba(30, 64, 175, 0.06) 0%, transparent 45%),
        radial-gradient(ellipse at 0% 100%, rgba(14, 165, 233, 0.05) 0%, transparent 45%),
        var(--gesq-bg);
}

.login-panel {
    width: 100%;
    max-width: 400px;
}

.login-panel__header {
    margin-bottom: 2rem;
}

.login-panel__eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gesq-accent);
    margin-bottom: 0.5rem;
}

.login-panel__title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--gesq-text);
    margin: 0 0 0.35rem;
    line-height: 1.2;
}

.login-panel__subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: var(--gesq-text-secondary);
}

.login-alert {
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    border-radius: var(--gesq-radius-sm);
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 0.9rem;
    line-height: 1.45;
}

.login-alert--domain {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.login-alert--user {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.login-alert__title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
}

.login-alert__message {
    margin: 0 0 0.5rem;
}

.login-alert__details {
    margin-top: 0.65rem;
    font-size: 0.82rem;
}

.login-alert__details summary {
    cursor: pointer;
    font-weight: 600;
    user-select: none;
    margin-bottom: 0.35rem;
}

.login-alert__details ul {
    margin: 0.35rem 0 0;
    padding-left: 1.15rem;
}

.login-alert__details li {
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.login-alert__details li:last-child {
    margin-bottom: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-field__label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gesq-text-secondary);
    margin-bottom: 0.4rem;
}

.login-field__control {
    position: relative;
}

.login-field__icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.1rem;
    height: 1.1rem;
    opacity: 0.45;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
}

.login-field__icon--user {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z'/%3E%3C/svg%3E");
}

.login-field__icon--lock {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z'/%3E%3C/svg%3E");
}

.login-field__input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.65rem;
    font-size: 1rem; /* evita zoom automatico iOS su focus */
    font-family: inherit;
    color: var(--gesq-text);
    background: var(--gesq-input-bg);
    border: 1.5px solid var(--gesq-border);
    border-radius: var(--gesq-radius-sm);
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 2.75rem;
    -webkit-appearance: none;
    appearance: none;
}

.login-field__input::placeholder {
    color: var(--gesq-text-muted);
}

.login-field__input:hover {
    border-color: #cbd5e1;
}

.login-field__input:focus {
    outline: none;
    border-color: var(--gesq-primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}

.login-domain {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    font-size: 0.82rem;
    color: var(--gesq-text-secondary);
    background: var(--gesq-accent-soft);
    border: 1px solid #bae6fd;
    border-radius: var(--gesq-radius-sm);
}

.login-domain--muted {
    background: var(--gesq-table-head-bg);
    border-color: var(--gesq-border);
}

.login-domain__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.login-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1.25rem;
    margin-top: 0.25rem;
    min-height: 2.85rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--gesq-gradient-revenue);
    border: none;
    border-radius: var(--gesq-radius-sm);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    box-shadow: 0 4px 14px rgba(30, 64, 175, 0.35);
    -webkit-tap-highlight-color: transparent;
}

.login-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(30, 64, 175, 0.4);
}

.login-submit:active:not(:disabled) {
    transform: translateY(0);
}

.login-submit:disabled {
    opacity: 0.75;
    cursor: wait;
}

.login-submit__spinner {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: login-spin 0.7s linear infinite;
}

@keyframes login-spin {
    to { transform: rotate(360deg); }
}

.login-footer {
    margin: 2rem 0 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--gesq-text-muted);
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .login-brand {
        padding: max(1.25rem, env(safe-area-inset-top, 0px))
                 max(1.25rem, env(safe-area-inset-right, 0px))
                 1.25rem
                 max(1.25rem, env(safe-area-inset-left, 0px));
        min-height: auto;
    }

    .login-brand__content {
        max-width: none;
        text-align: center;
    }

    .login-brand__logo {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 1.35rem;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 0.85rem;
        border-radius: 12px;
    }

    .login-brand__title {
        font-size: 1.65rem;
        margin-bottom: 0.4rem;
    }

    .login-brand__tagline {
        margin-bottom: 0;
        font-size: 0.875rem;
        line-height: 1.45;
    }

    .login-brand__features {
        display: none;
    }

    .login-brand__glow--1,
    .login-brand__glow--2 {
        opacity: 0.55;
    }

    .login-main {
        align-items: flex-start;
        padding: 1.25rem
                 max(1.25rem, env(safe-area-inset-right, 0px))
                 max(1.5rem, env(safe-area-inset-bottom, 0px))
                 max(1.25rem, env(safe-area-inset-left, 0px));
    }

    .login-panel {
        max-width: 100%;
    }

    .login-panel__header {
        margin-bottom: 1.35rem;
    }

    .login-panel__title {
        font-size: 1.4rem;
    }

    .login-panel__subtitle {
        font-size: 0.9rem;
    }

    .login-form {
        gap: 1rem;
    }

    .login-footer {
        margin-top: 1.5rem;
        padding-bottom: 0.25rem;
    }
}

@media (max-width: 480px) {
    .login-brand__tagline {
        display: none;
    }

    .login-brand {
        padding-top: max(1rem, env(safe-area-inset-top, 0px));
        padding-bottom: 1rem;
    }

    .login-brand__logo {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.2rem;
        margin-bottom: 0.6rem;
    }

    .login-brand__title {
        font-size: 1.45rem;
        margin-bottom: 0;
    }

    .login-main {
        padding-top: 1rem;
    }

    .login-panel__eyebrow {
        font-size: 0.68rem;
    }

    .login-domain {
        flex-wrap: wrap;
        font-size: 0.78rem;
    }
}

/* ── Theme toggle ─────────────────────────────────────────── */

.gesq-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: 10px;
    flex-shrink: 0;
}

.gesq-theme-toggle svg {
    display: block;
}

/* ── Share / notifiche condivisioni ───────────────────────── */

.gesq-modal--share {
    /* sopra header sticky (z-index 10) e pannelli correlati */
    z-index: 2200;
    align-items: center;
    padding: max(1rem, env(safe-area-inset-top, 0px)) 1rem;
}

.gesq-modal-backdrop--share {
    z-index: 2199;
}

.gesq-modal--share .gesq-modal__dialog {
    max-height: min(90vh, calc(100dvh - 2rem));
    overflow: hidden;
}

.gesq-modal--share .gesq-modal__body {
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.gesq-share-link {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.gesq-share-link__input {
    flex: 1 1 auto;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
}

.gesq-share-link__copy {
    flex-shrink: 0;
    white-space: nowrap;
}

.gesq-share-link__copied {
    font-size: 0.8rem;
    color: var(--bs-success, #198754);
    font-weight: 600;
}

.gesq-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.55rem;
    border-radius: 10px;
    flex-shrink: 0;
}

.gesq-share-btn svg {
    display: block;
    flex-shrink: 0;
}

.gesq-share-btn__label {
    font-size: 0.8rem;
    font-weight: 600;
}

.gesq-share-notif {
    position: relative;
    flex-shrink: 0;
}

.gesq-share-notif__btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: 10px;
}

.gesq-share-notif__btn svg {
    display: block;
}

.gesq-share-notif__badge {
    position: absolute;
    top: -0.2rem;
    right: -0.25rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
}

.gesq-share-notif__panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    width: min(22rem, 88vw);
    max-height: min(24rem, 70vh);
    display: flex;
    flex-direction: column;
    background: var(--gesq-surface);
    border: 1px solid var(--gesq-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    z-index: 40;
    overflow: hidden;
}

.gesq-share-notif__panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--gesq-border);
}

.gesq-share-notif__list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
}

.gesq-share-notif__item {
    border-bottom: 1px solid var(--gesq-border);
}

.gesq-share-notif__item--unread {
    background: color-mix(in srgb, var(--bs-primary) 8%, transparent);
}

.gesq-share-notif__link {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    padding: 0.7rem 0.85rem;
    color: inherit;
    cursor: pointer;
}

.gesq-share-notif__link:hover {
    background: color-mix(in srgb, var(--gesq-text) 5%, transparent);
}

.gesq-share-notif__title {
    font-size: 0.88rem;
    font-weight: 600;
}

.gesq-share-notif__meta {
    font-size: 0.72rem;
    color: var(--gesq-text-muted);
    margin-top: 0.15rem;
}

.gesq-share-notif__msg {
    font-size: 0.8rem;
    margin-top: 0.35rem;
    color: var(--gesq-text-secondary);
}

.gesq-share-notif__empty {
    padding: 1rem 0.85rem;
    font-size: 0.85rem;
}

.login-theme-toggle {
    position: absolute;
    top: max(0.75rem, env(safe-area-inset-top, 0px));
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    z-index: 2;
}

.gesq-modal {
    padding: max(0.75rem, env(safe-area-inset-top, 0px))
             max(0.75rem, env(safe-area-inset-right, 0px))
             max(0.75rem, env(safe-area-inset-bottom, 0px))
             max(0.75rem, env(safe-area-inset-left, 0px));
}

.gesq-modal__dialog {
    max-height: calc(100dvh - 1.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}

@media (max-width: 575.98px) {
    .gesq-modal:not(.gesq-modal--viewport-90):not(.gesq-modal--email-doc):not(.gesq-modal--share):not(.gesq-modal--presentazione-banca):not(.gesq-modal--export-contabilita) {
        align-items: flex-end;
        padding-left: 0;
        padding-right: 0;
        padding-bottom: 0;
    }

    .gesq-modal:not(.gesq-modal--viewport-90):not(.gesq-modal--email-doc):not(.gesq-modal--share):not(.gesq-modal--presentazione-banca):not(.gesq-modal--export-contabilita) .gesq-modal__dialog {
        max-width: 100%;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0px)));
    }

    .gesq-modal:not(.gesq-modal--viewport-90):not(.gesq-modal--email-doc):not(.gesq-modal--share):not(.gesq-modal--presentazione-banca):not(.gesq-modal--export-contabilita) .gesq-modal__footer {
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
        gap: 0.5rem;
    }

    .gesq-modal:not(.gesq-modal--viewport-90):not(.gesq-modal--email-doc):not(.gesq-modal--share):not(.gesq-modal--presentazione-banca):not(.gesq-modal--export-contabilita) .gesq-modal__footer .btn {
        flex: 1 1 auto;
        min-height: 2.75rem;
    }
}

[data-bs-theme="dark"] .gesq-presentazione-banca__section-title {
    background: var(--gesq-surface);
}

[data-bs-theme="dark"] .gesq-doc-notes--has-content.gesq-doc-notes--collapsed .gesq-doc-notes__toggle {
    background: #422006;
}

[data-bs-theme="dark"] .gesq-doc-notes--has-content.gesq-doc-notes--collapsed .gesq-doc-notes__toggle:hover {
    background: #78350f;
}

[data-bs-theme="dark"] .gesq-riga-separatore td {
    background-color: #1e3a5f !important;
}

[data-bs-theme="dark"] .gesq-riga-separatore__descrizione,
[data-bs-theme="dark"] .gesq-riga-separatore__descrizione.form-control,
[data-bs-theme="dark"] .gesq-riga-separatore__descrizione.form-control:focus {
    background-color: #1e3a5f;
}

.fatture-spa-host {
    margin: -0.5rem -0.25rem 0;
    min-height: calc(100vh - 6rem);
}

.fatture-spa-host .fatture-ui h1 {
    font-size: 1.5rem;
}

/* ── Fatture lista dashboard ──────────────────────────────── */
.fatture-lista-dashboard {
    margin-bottom: 1.5rem;
}

.fatture-lista-dashboard__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.fatture-lista-dashboard__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.fatture-lista-dashboard__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.fatture-lista-dashboard__layout {
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

@media (max-width: 991.98px) {
    .fatture-lista-dashboard__layout {
        grid-template-columns: 1fr;
    }
}

.fatture-lista-dashboard__sidebar .card-body {
    padding: 1rem;
}

.fatture-lista-dashboard__riepilogo {
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: var(--bs-tertiary-bg, #f8f9fa);
    border: 1px solid var(--bs-border-color);
}

.fatture-lista-dashboard__note-utente {
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color);
}

.fatture-lista-dashboard__note-text {
    min-height: 7rem;
    resize: vertical;
    font-size: 0.8125rem;
    line-height: 1.45;
}

.fatture-lista-dashboard__stati-totali {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.fatture-lista-dashboard__stato-totale {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    background: var(--bs-body-bg, #fff);
    color: inherit;
    font-size: 0.8125rem;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.fatture-lista-dashboard__stato-totale:hover {
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.fatture-lista-dashboard__stato-totale--active {
    border-color: var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.08);
    font-weight: 600;
}

.fatture-lista-dashboard__stato-importo {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.fatture-lista-dashboard__table-card {
    overflow: hidden;
}

.fatture-lista-dashboard__table-wrap {
    max-height: calc(100vh - 14rem);
    overflow: auto;
}

.fatture-lista-dashboard__table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bs-tertiary-bg, #f8f9fa);
}

.fatture-lista-dashboard__xml-cell {
    position: relative;
    display: inline-flex;
    justify-content: center;
}

.fatture-lista-dashboard__xml-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 0.25rem;
}

.fatture-lista-dashboard__xml-trigger:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.fatture-lista-dashboard__xml-popover {
    display: none;
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.35rem);
    right: 0;
    width: min(24rem, 70vw);
    padding: 0.75rem;
    text-align: left;
    white-space: normal;
    color: var(--bs-body-color);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1.25rem rgba(15, 23, 42, 0.18);
}

.fatture-lista-dashboard__xml-cell:hover .fatture-lista-dashboard__xml-popover,
.fatture-lista-dashboard__xml-cell:focus-within .fatture-lista-dashboard__xml-popover {
    display: block;
}

.fatture-lista-dashboard__xml-path {
    display: block;
    max-height: 6rem;
    overflow: auto;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    font-size: 0.75rem;
}

.fatture-lista-dashboard__row--pagata {
    background: rgba(16, 185, 129, 0.06);
}

.fatture-lista-dashboard__row--da_pagare {
    background: rgba(245, 158, 11, 0.05);
}

.fatture-lista-dashboard__row--ritardo {
    background: rgba(139, 92, 246, 0.06);
}

.fatture-lista-dashboard__row--pianificata {
    background: rgba(14, 165, 233, 0.05);
}

.fatture-lista-dashboard__row--da_presentare_banca {
    background: rgba(6, 182, 212, 0.05);
}

.fatture-lista-dashboard__row--ndc {
    background: rgba(244, 63, 94, 0.09);
}

.fatture-lista-dashboard__row--ndc.fatture-lista-dashboard__row--pagata {
    background: linear-gradient(90deg, rgba(244, 63, 94, 0.09), rgba(16, 185, 129, 0.06));
}

.fatture-lista-dashboard__row--ndc.fatture-lista-dashboard__row--da_pagare {
    background: linear-gradient(90deg, rgba(244, 63, 94, 0.09), rgba(245, 158, 11, 0.05));
}

.fatture-lista-dashboard__row--ndc.fatture-lista-dashboard__row--ritardo {
    background: linear-gradient(90deg, rgba(244, 63, 94, 0.09), rgba(139, 92, 246, 0.06));
}

.fatture-lista-dashboard__stato-importo--negativo {
    color: var(--bs-danger);
    font-weight: 600;
}

.fatture-lista-dashboard__pianificazione {
    font-size: 0.875rem;
    white-space: nowrap;
}

.fattura-stato-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.fattura-stato-badge--pagata {
    background: #d1fae5;
    color: #047857;
}

.fattura-stato-badge--da-pagare {
    background: #fef3c7;
    color: #b45309;
}

.fattura-stato-badge--ritardo {
    background: #ede9fe;
    color: #5b21b6;
}

.fattura-stato-badge--banca {
    background: #cffafe;
    color: #0e7490;
}

.fattura-stato-badge--pianificata {
    background: #e0f2fe;
    color: #0369a1;
}

.fattura-stato-badge--default {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

.fattura-azioni-dropdown {
    position: relative;
}

.fattura-azioni-dropdown__toggle {
    padding: 0.15rem 0.35rem;
    line-height: 1;
}

.fattura-azioni-dropdown__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
}

/* position:fixed + top/left impostati da gesqFixedDropdown.positionMenu
   per uscire da .fatture-lista-dashboard__table-wrap (overflow:auto) / card. */
.fattura-azioni-dropdown__menu {
    position: fixed;
    z-index: 1051;
    display: block;
    min-width: 14.5rem;
    padding: 0.35rem 0;
    margin: 0;
    font-size: 0.875rem;
    color: var(--bs-body-color);
    text-align: left;
    list-style: none;
    background-color: var(--bs-body-bg);
    background-clip: padding-box;
    border: var(--bs-border-width) solid var(--bs-border-color-translucent);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--bs-box-shadow);
}

.gesq-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.45rem 0.85rem;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.gesq-dropdown-item:hover,
.gesq-dropdown-item:focus-visible {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
}

.gesq-dropdown-item:disabled,
.gesq-dropdown-item[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.gesq-dropdown-item--muted {
    cursor: default;
    color: var(--bs-secondary-color);
    font-size: 0.8125rem;
}

.gesq-dropdown-item--muted:hover {
    background: transparent;
}

.gesq-dropdown-item__icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    color: var(--bs-secondary-color);
}

.fattura-azioni-dropdown__menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
}

.fattura-azioni-dropdown__menu .dropdown-divider {
    margin: 0.35rem 0;
}

.gesq-col-selector {
    position: relative;
    display: inline-block;
    /* Escape parent overflow:hidden (card / doc editor scroll regions) for the menu */
    z-index: 2;
}

.gesq-col-selector__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
}

/* Default: open to the right of the trigger (safe when Colonne is near the left edge).
   Parents (.gesq-card, .gesq-doc-editor__articoli, .gesq-doc-righe-editor, article.content)
   use overflow:hidden / overflow-x:hidden and clip a right-aligned menu that extends left. */
.gesq-col-selector__menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: auto;
    z-index: 1050;
    min-width: 11rem;
    padding: 0.35rem 0;
    background-color: var(--bs-body-bg);
    border: var(--bs-border-width) solid var(--bs-border-color-translucent);
    border-radius: var(--bs-border-radius);
}

.gesq-col-selector--end .gesq-col-selector__menu {
    left: auto;
    right: 0;
}

.gesq-col-selector__item {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0.35rem 0.85rem;
    font-size: 0.875rem;
    cursor: pointer;
    user-select: none;
}

.gesq-col-selector__item:hover {
    background-color: var(--bs-tertiary-bg);
}

.gesq-col-selector__item .form-check-input:disabled {
    opacity: 0.75;
}

/* ── PWA / standalone shell (phone & tablet) ───────────────── */

@media (display-mode: standalone), (display-mode: fullscreen) {
    html, body {
        /* chrome browser assente: usa tutta l’altezza safe */
        min-height: 100dvh;
    }
}

@media (max-width: 640.98px) {
    /* Touch targets minimi (~44px) su controlli header/shell */
    .gesq-theme-toggle,
    .gesq-share-btn,
    .mobile-menu-btn {
        min-width: 2.75rem;
        min-height: 2.75rem;
    }

    .user-menu__logout {
        min-height: 2.75rem;
        display: inline-flex;
        align-items: center;
        padding: 0.45rem 0.85rem;
        font-size: 0.8125rem;
    }

    .nav-search__input {
        min-height: 2.75rem;
        font-size: 1rem; /* evita zoom iOS su focus */
    }

    .mobile-card__actions .btn,
    .page-header .btn,
    .gesq-toolbar .btn {
        min-height: 2.75rem;
    }
}

/* Immagini PNG articolo (descrizione / stampa) */
.gesq-articolo-foto {
    width: 160px;
    background: var(--bs-body-bg, #fff);
}

.gesq-articolo-foto__img {
    max-width: 140px;
    max-height: 120px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Pannello PNG sotto descrizione riga documento */
.gesq-riga-articolo-foto .card {
    margin-bottom: 0 !important;
}

.gesq-riga-articolo-foto .card-header h5 {
    font-size: 0.95rem;
}

.gesq-articolo-foto-panel--compact .gesq-articolo-foto {
    width: 120px;
}

.gesq-articolo-foto-panel--compact .gesq-articolo-foto__img {
    max-width: 100px;
    max-height: 80px;
}

.gesq-articolo-foto-panel--compact .card-header {
    padding: 0.35rem 0.65rem;
}

.gesq-articolo-foto-panel--compact .card-header h5 {
    font-size: 0.85rem;
}

