/* Griglia plicometria */
.plico-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
    
}

body.modal-blur-active .container,
body.modal-blur-active .progress-modals-container {
    filter: blur(4px);
    
    pointer-events: none;
}

.plico-item {
    background: var(--bg-surface-raised);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid var(--bg-input-disabled);
    transition: all 0.3s ease;
}

.plico-item:hover {
    border-color: var(--gradient-app-start);
    background: var(--primary-bg-light);
}

.plico-item label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.9em;
}

.plico-icon {
    font-size: 1.2em;
    margin-right: 5px;
}

.plico-item input {
    width: 100%;
    text-align: center;
    font-size: 1.1em;
    font-weight: 500;
}


/* Stile per le checkbox nel display */
.plico-result-item {
    position: relative;
    transition: all 0.3s ease;
}

.plico-result-item:has(.plica-display-checkbox:not(:checked)) {
    opacity: 0.5;
    transform: scale(0.95);
}

.plica-display-checkbox {
    display: none;
}

.body-fat-display {
    animation: fadeIn 0.5s ease;
}



.plico-result-item {
    transition: all 0.2s ease;
    user-select: none;
    border: 2px solid transparent;
}

.plico-result-item.plica-selected {
    opacity: 1;
    transform: scale(1);
    border-color: var(--gradient-app-start);
    background: var(--primary-bg-light);
}

.plico-result-item.plica-deselected {
    opacity: 0.4;
    transform: scale(0.95);
    filter: grayscale(50%);
}

.plico-result-item:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px var(--shadow-lg);
    cursor: pointer;
}

/* Display ultima misurazione */
.plico-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
    
}

.plico-result-item {
    text-align: center;
    padding: 10px;
    background: var(--bg-surface-raised);
    border-radius: 8px;
     border: 1px solid var(--border-strong);
}

.plico-result-value {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--gradient-app-start);
}

.plico-result-label {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 3px;
    
}


/* Stile per le pliche personalizzate nel display */
.plico-result-item.plico-custom {
    background: linear-gradient(135deg, var(--warning-bg) 0%, var(--warning-border) 100%);
    border: 1px solid var(--warning-medium);
}


.valore-item.custom-diam{
    background-color: var(--bg-surface-sunken);
}

/* Modal storico */
.history-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-heavy);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}



.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.history-table th,
.history-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid var(--bg-input-disabled);
}

.history-table th {
    background: var(--gradient-app-start);
    color: var(--text-stable-white);
    font-weight: 600;
    position: sticky;
    top: 0;
}

.history-table tr:hover {
    background: var(--bg-surface-raised);
}

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

/* Percentuale grasso corporeo */
.body-fat-display {
    background: var(--analysis-full-bg);
    border: var(--action-btn-border);
    color: var(--text-stable-white);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin-top: 20px;
}

.body-fat-value {
    font-size: 2.5em;
    font-weight: bold;
    margin: 10px 0;
}

.body-fat-label {
    font-size: 1.1em;
    opacity: 0.9;
}

/*PROGRESSI */

/* === AGGIUNGI a main.css - Stili Modal Progressi === */

/* Modal Progressi */
.progress-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-heavy);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.progress-modal-content {
    background: var(--bg-surface);
    border-radius: 15px;
    width: 90%;
    max-width: 1200px;
    height: 98%;
    max-height: 1000px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px var(--shadow-md);
}



.progress-header h2 {
    margin: 0;
    color: var(--text-heading);
}

.progress-body {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Contenitore grafico */
.chart-container {
    background: var(--bg-surface-raised);
    border-radius: 10px;
    padding: 20px;
    height: 400px;
    position: relative;
}

#weight-update-note::placeholder{
    color: var(--text-primary);
}

/* Controlli */
.progress-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-range select {
    padding: 8px 12px;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    font-size: 1em;
}

.date-range .bt-custom-select {
    min-width: 180px;
}

.legend-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-section {
    display: contents;
}

.legend-section h4 {
    font-size: 0.75em;
    font-weight: 700;
    color: var(--gradient-app-start);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 6px 0 2px 0;
    grid-column: 1 / -1;
}

/* Wrapper interno per le voci in griglia */
.legend-section-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 4px 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px;
    cursor: pointer;
    border-radius: 4px;
}

.legend-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-medium);
    border-radius: 3px;
    background: var(--bg-surface-raised);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    position: relative;
}

.legend-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--gradient-app-start);
    font-size: 9px;
    font-weight: 700;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-item span:last-child {
    font-size: 0.82em;
    color: var(--text-primary);
    white-space: nowrap;
}

.legend-item:hover {
    background-color: var(--bg-hover);
}




/* Statistiche */
.progress-stats {
    margin-top: 20px;
}

.progress-stats h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.stat-card {
    background: var(--bg-surface-raised);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--bg-input-disabled);
}

.stat-label {
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.stat-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    font-size: 0.85em;
    color: var(--text-muted);
}

/* Footer */
.progress-footer {
    
    border-top: 1px solid var(--bg-input-disabled);
    display: flex;
    justify-content: center;
    gap: 10px;
}



/* Animazioni */
.progress-modal {
    animation: fadeIn 0.3s ease;
}

.progress-modal-content {
    animation: slideIn 0.3s ease;
}



/* === MODAL PROGRESSI SIDE-BY-SIDE === */

.progress-modals-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-heavy);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    gap: 15px;
    padding: 15px;
    box-sizing: border-box;
    animation: fadeIn 0.3s ease;
}

.progress-modals-container .progress-modal-panel {
    background: var(--bg-surface);
    border-radius: 12px;
    width: 49%;
    height: 95%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px var(--shadow-lg);
    overflow: hidden;
}

.progress-modals-container .progress-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--bg-input-disabled);
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--gradient-success-btn);
    color: var(--text-stable-white);
    flex-shrink: 0;
}

.progress-modals-container .progress-header h3 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 600;
}

.progress-modals-container .progress-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: none;
}

.comparative-report-body.dual-panel{
    scrollbar-width: none;
}

/* Toggle grafici */
.charts-toggle-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: var(--bg-surface-raised);
    border-radius: 8px;
    border: 1px solid var(--bg-input-disabled);
}

.charts-toggle-section .toggle-label {
    font-weight: 500;
    color: var(--text-primary);
}

.charts-toggle-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.charts-toggle-btn.show {
    background: var(--gradient-app-start);
    color: var(--text-stable-white);
}

.charts-toggle-btn.show:hover {
    background: var(--gradient-app-start);
}

.charts-toggle-btn.hide {
    background: var(--text-muted);
    color: var(--text-stable-white);
}

.charts-toggle-btn.hide:hover {
    background: var(--navy-light);
}

/* Container grafici nascondibile */
.charts-wrapper-collapsible {
    display: none;
}

.charts-wrapper-collapsible.visible {
    display: block;
}

/* Statistiche estese */
.stat-card-extended {
    background: var(--bg-surface-raised);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--bg-input-disabled);
}

.stat-card-extended .stat-label {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-card-extended .stat-values {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    font-size: 0.8em;
    color: var(--text-muted);
}

.stat-card-extended .stat-values div {
    padding: 2px 0;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
}

.stat-trend.up {
    background: var(--success-bg);
    color: var(--success-text);
}

.stat-trend.down {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.stat-trend.stable {
    background: var(--warning-bg);
    color: var(--warning-text);
}

/* Pulsante report comparativo */
.comparative-report-btn {
    margin: 10px auto 0 auto;
    padding: 10px 20px;
    background: var(--gradient-app);
    color: var(--text-stable-white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 300px;
}



.comparative-report-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-brand-md);
}

.comparative-report-btn:disabled {
    background: var(--border-strong);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Modal report comparativo */
#comparative-report-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    scrollbar-width: none;
    transform: translate(-50%, -50%);
    background: var(--bg-surface);
    border-radius: 12px;
    width: 97%;
    height: 92%;
    max-height: 98vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px var(--shadow-md);
    z-index: 10001;
}

.comparative-report-modal h3 {
    margin: 0 0 20px 0;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    gap: 10px;
}

.comparative-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.comparative-table th,
.comparative-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--bg-input-disabled);
}

.comparative-table th {
    background: var(--bg-surface-raised);
    font-weight: 600;
    color: var(--text-primary);
}

.comparative-table .delta-positive {
    color: var(--success);
    font-weight: 600;
}

.comparative-table .delta-negative {
    color: var(--danger);
    font-weight: 600;
}

.differences-section {
    background: var(--bg-surface-raised);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.differences-section h4 {
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.difference-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg-input-disabled);
}

.difference-row:last-child {
    border-bottom: none;
}

/* Footer con pulsante chiudi globale */
.progress-modals-header {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
}

.close-all-button{
    padding: 12px 30px;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 2px solid var(--border-medium);
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1em;
    box-shadow: 0 4px 15px var(--shadow-md);
    transition: all 0.2s;
    display: block;
}

.close-all-button:hover {
    background: var(--bg-surface-raised);
    border-color: var(--gradient-app-start);
    color: var(--gradient-app-start);
}



/* Layout antropometria - section principale + sidebar bottoni */
.antropo-section {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

/* Section circonferenze - prende tutto lo spazio disponibile */
.antropo-section .section {
    flex: 1;
    min-width: 0; /* Previene overflow */
    max-width: none !important; /* Rimuove il max-width inline */
}

/* Sidebar bottoni - larghezza fissa piccola */
.antropo-plico-section {
    flex: 0 0 380px; /* Non cresce, non si riduce, larghezza fissa 380px */
    background: var(--bg-surface-translucent);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 20px 40px var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.antropo-plico-section h3 {
    margin: 0 0 20px 0;
    color: var(--text-heading);
    font-size: 18px;
}

.antropo-plico-section button {
    width: 100%;
    margin-bottom: 10px;
}

.antropo-plico-section button:last-child {
    margin-bottom: 0;
}


/* Layout plicometria - section principale + sidebar peso */
.plico-section {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

/* Section plicometria - prende tutto lo spazio disponibile */
.plico-section .section {
    flex: 1;
    min-width: 0; /* Previene overflow */
    max-width: none !important; /* Rimuove il max-width inline */
}

/* Wrapper weight section - deve essere flex e piccolo */
.plico-section > div:not(.section) {
    flex: 0 0 380px; /* Larghezza fissa 380px */
}

/* Weight section - styling */
.weight-history-section {
    background: var(--bg-surface-card);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 10px var(--shadow-sm);
    gap: 10px;
    display: grid;
    min-height: 350px;
    color: var(--gradient-app-start);
    min-width: 0;
    width: 100%;
    overflow: hidden;
    
}

.weight-history-section .bia-history-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

#weight-history-table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
}

.weight-history-section h4 {
    font-size: 1em;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.weight-history-chart-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 200px;
    margin-bottom: 16px;
    overflow: hidden;
}

.weight-history-chart-wrap canvas {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
}

.weight-section {
    background: var(--bg-surface-card);
    padding: 25px;
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 4px 10px var(--shadow-sm);
    margin-top: 0px;
    min-width: 0;
}




.weight-view-toggle {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 18px;
    border: 1px solid var(--border-medium);
    border-radius: 999px;
    background: var(--bg-surface-raised);
}

.weight-view-toggle.hidden {
    display: none;
}

.weight-view-toggle__btn {
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    color: var(--text-secondary);
    background: transparent;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.weight-view-toggle__btn:hover {
    color: var(--text-primary);
    transform: translateY(-1px);
}

.weight-view-toggle__btn.active {
    color: var(--text-stable-white);
    background: var(--gradient-app);
    box-shadow: 0 6px 16px var(--shadow-sm);
}

.percentile-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.percentile-card {
    min-width: 0;
    padding: 14px;
    border-radius: 14px;
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-medium);
    text-align: center;
}

.percentile-card__label,
.percentile-card span:last-child {
    display: block;
    color: var(--text-secondary);
    font-size: 0.82em;
    font-weight: 700;
}

.percentile-card strong {
    display: block;
    margin: 6px 0;
    color: var(--text-heading);
    font-size: 1.35em;
}

.percentile-card--muted strong {
    color: var(--gradient-app-start);
}

.percentile-chart-wrap {
    width: 100%;
    min-width: 0;
    height: 310px;
    padding: 14px;
    border-radius: 18px;
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-medium);
    overflow: hidden;
}

.percentile-chart-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.percentile-reference-note {
    margin: 12px 0 0;
    color: var(--text-secondary);
    font-size: 0.82em;
    line-height: 1.4;
}

@media (max-width: 720px) {
    .percentile-summary {
        grid-template-columns: 1fr;
    }

    .percentile-chart-wrap {
        height: 280px;
    }
}



.antropo-plico-section{
    background: var(--bg-surface);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 10px var(--shadow-sm);
    border-left: 5px solid var(--gradient-app-start);
    height: fit-content;
    gap: 10px;
    display: grid;
    min-height: 350px;
    color: var(--gradient-app-start);
}



/* Stile per i bottoni hover */
.antropo-plico-section button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-md);
    transition: all 0.3s ease;
}

/* Measurements grid */
.measurements-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 24px;
    align-items: start;
}
.measurements-grid > * { min-width: 0; }

/* Grid placement */
.section--antropo.section  { grid-column: 1; grid-row: 1; }
.meas-col2-panel#col2-circ-panel  { grid-column: 2; grid-row: 1; }
.meas-row-plico-wrap       { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: 20px; }
.meas-col2-panel#col2-plico-panel { grid-column: 2; grid-row: 2; }
.fabbisogno-section        { grid-column: 1; grid-row: 3; }
.meas-col2-panel#col2-donut-panel { grid-column: 2; grid-row: 3; }

/* Col2 panels */
.meas-col2-panel {
    background: var(--bg-surface);
    border-radius: 12px;
    border: 1px solid var(--border-medium);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.meas-col2-header { display: flex; flex-direction: column; gap: 10px; }
.meas-col2-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-heading);
}
.meas-mode-tabs { display: flex; gap: 6px; }
.meas-mode-btn {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid var(--border-medium);
    background: var(--bg-surface-raised);
    color: var(--text-secondary);
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
}
.meas-mode-btn.active {
    background: var(--gradient-app);
    color: #fff;
    border-color: transparent;
}
.meas-range-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.meas-range-picker input[type="date"] {
    flex: 1;
    padding: 5px 7px;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    background: var(--bg-surface-raised);
    color: var(--text-primary);
    font-size: 0.82rem;
}
.meas-range-picker.hidden { display: none; }

/* Custom date picker (giorno/mese/anno) — mirrors cal-time-picker-panel */
.meas-date-picker-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}
.meas-date-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
    padding: 5px 10px;
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}
.meas-date-picker-btn:hover {
    border-color: var(--gradient-app-start, #667eea);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
}
.meas-date-picker-panel {
    position: fixed;
    background: var(--bg-surface-card);
    border: 1px solid var(--border-medium);
    border-radius: 14px;
    box-shadow: 0 8px 32px var(--shadow-md);
    padding: 14px;
    z-index: 300;
    min-width: 380px;
}
.meas-date-picker-panel.hidden { display: none; }
.meas-date-picker-header {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 12px;
    text-align: center;
}
.meas-date-picker-body {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.meas-date-col-wrap {
    flex: 1;
    min-width: 0;
    scrollbar-width: none;
    
}
.meas-date-col-wrap.meas-date-col-days {
    scrollbar-width: none;
    flex: 1.8;

}
.meas-date-col-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
    text-align: center;
}
.meas-date-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    max-height: 260px;
    overflow-y: auto;
}
.meas-date-months-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    max-height: 260px;
    overflow-y: auto;
}
.meas-date-years-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: none;
}
.meas-date-unit {
    background: none;
    border: none;
    padding: 5px 2px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
    transition: background 0.1s, color 0.1s;
    width: 100%;
}
.meas-date-unit:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.meas-date-unit.active {
    background: var(--gradient-app);
    color: #fff;
    font-weight: 700;
}
.meas-col2-empty {
    color: var(--text-secondary);
    font-size: 0.82rem;
    text-align: center;
    padding: 24px 10px;
}
.meas-col2-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

/* Date selector above plico/circ results */
.meas-date-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-medium);
}
.meas-date-selector label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.meas-date-select {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    background: var(--bg-surface-raised);
    color: var(--text-primary);
    font-size: 0.82rem;
    cursor: pointer;
}

/* Collapsible valutazione */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}
.apc-collapse-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 2px 6px;
    transition: transform 0.2s;
}
.apc-results-collapsed .apc-collapse-btn { transform: rotate(-90deg); }
.apc-results-collapsed .results-content { display: none; }

/* Donut legend */
.col2-donut-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
}
.col2-donut-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.col2-donut-item span {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Comparative table in col2 */
.col2-compare-table-wrap {
    overflow-x: auto;
}
.col2-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.col2-compare-table th,
.col2-compare-table td {
    padding: 5px 7px;
    text-align: right;
    border-bottom: 1px solid var(--border-medium);
    white-space: nowrap;
}
.col2-compare-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-align: right;
    line-height: 1.3;
}
.col2-compare-table td:first-child,
.col2-compare-table th:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--text-primary);
}
.col2-key-label { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col2-date-range {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.col2-delta-up   { color: #ef5350; font-weight: 600; }
.col2-delta-down { color: #42a5f5; font-weight: 600; }
.col2-delta-neutral { color: var(--text-secondary); }

/* Responsive */
@media (max-width: 960px) {
    .measurements-grid {
        grid-template-columns: 1fr;
    }
    .section--antropo.section,
    .meas-row-plico-wrap,
    .fabbisogno-section { grid-column: 1; }
    .meas-col2-panel { grid-column: 1; grid-row: unset; }
    .meas-col2-panel#col2-circ-panel  { grid-row: 2; }
    .meas-col2-panel#col2-plico-panel { grid-row: 4; }
    .meas-col2-panel#col2-donut-panel { grid-row: 6; }
}



/* === STILI ANTROPOMETRIA === */

/* Display risultati antropometria */
.antropo-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.antropo-result-item {
    text-align: center;
    padding: 12px;
    background: var(--success-bg-lightest);
    border-radius: 10px;
    border: 2px solid var(--success-border);
    transition: all 0.3s ease;
    cursor: default;
}

.antropo-result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--success-hover);
}

/* Diametri con stile diverso */
.antropo-result-item.antropo-diameter {
    background: var(--info-bg-light);
    border-color: var(--primary-border);
}

.antropo-result-item.antropo-diameter:hover {
    box-shadow: 0 4px 12px var(--primary-bg);
}

/* Misure personalizzate */
.antropo-result-item.antropo-custom {
    background: linear-gradient(135deg, var(--warning-bg) 0%, var(--warning-border) 100%);
    border: 2px solid var(--warning-medium);
}

.antropo-icon {
    font-size: 1.3em;
    margin-bottom: 5px;
}

.antropo-result-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--success);
    margin: 5px 0;
}

.antropo-diameter .antropo-result-value {
    color: var(--primary);
}

.antropo-custom .antropo-result-value {
    color: var(--warning);
}

.antropo-result-label {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 3px;
}

/* Indici antropometrici */
.antropo-indices {
    background: var(--gradient-app);
    color: var(--text-stable-white);
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
}

/* === RISULTATI ANTROPO-PLICO INLINE - VERSIONE SMOOTH === */

.antropo-plico-results-inline {
    animation: slideInFromTop 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 35px 40px;
    background: var(--gradient-app);
    color: var(--text-stable-white);
    border-radius: 20px 20px 0 0;
    margin: -40px -40px 25px -40px;
}
.results-header h3 {
    margin: 0;
    font-size: 1.3em;
}

.results-header small {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    transition: all 0.3s ease;
}

/* Contenuto dei risultati con transizioni */
.results-content {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Stato durante l'aggiornamento */
.results-content.updating {
    opacity: 0.6;
    transform: scale(0.98);
    pointer-events: none;
}

/* Stato dopo l'aggiornamento (flash sottile) */
.results-content.updated {
    animation: gentleFlash 0.6s ease;
}

/* Stato nascondimento */
.results-content.hiding {
    opacity: 0;
    transform: translateY(-10px);
}



/* Fade in per stato vuoto */
.fade-in {
    animation: fadeIn 0.4s ease;
}



/* Empty state migliorato */
.antropo-plico-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 1.1em;
}

.antropo-plico-empty-state p {
    margin: 0;
    line-height: 1.6;
}

/* Wrapper con transizioni */
#antropo-plico-results-wrapper {
    min-height: 200px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Indicatore di caricamento sottile */
.results-header small.updating {
    animation: pulse 1.5s ease-in-out infinite;
}



/* Transizioni per le card dei risultati */
.antropo-plico-results-inline [style*="background"] {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}



/* Transizioni per i valori numerici */
.weight-value, .bmi-value, .meal-totals [style*="font-size"] {
    transition: all 0.3s ease;
}



.indices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.index-card {
    background: rgba(255, 255, 255, 0.15);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.index-card:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.index-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 8px;
}

.index-value {
    font-size: 2em;
    font-weight: bold;
    margin: 10px 0;
}

.index-status {
    font-size: 0.85em;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
    display: inline-block;
    margin-top: 5px;
}

/* Classi di rischio per indici */
.risk-low {
    border-left: 4px solid var(--success-medium);
}

.risk-low .index-status {
    background: var(--success-active);
}

.risk-moderate {
    border-left: 4px solid var(--warning);
}

.risk-moderate .index-status {
    background: var(--warning-hover);
}

.risk-high {
    border-left: 4px solid var(--danger);
}

.risk-high .index-status {
    background: var(--danger-active);
}



/* Modal storico antropometria */
.antropo-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.antropo-history-table th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    border: 1px solid var(--border-medium);
    position: sticky;
    top: 0;
    z-index: 5;
}

.antropo-history-table td {
    padding: 8px 6px;
    text-align: center;
    border: 1px solid var(--border-medium);
}

.antropo-history-table tbody tr:hover {
    background: var(--bg-surface-raised);
}



/* Animazioni */
.antropo-result-item {
    animation: fadeIn 0.3s ease;
}



/* Comparazione misure */
.antropo-comparison {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-surface-raised);
    border-radius: 10px;
}

.comparison-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--bg-input-disabled);
}

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

.comparison-change {
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85em;
}

.change-positive {
    color: var(--success);
    background: var(--success-bg);
}

.change-negative {
    color: var(--danger);
    background: var(--danger-bg);
}

.change-neutral {
    color: var(--text-muted);
    background: var(--bg-input-disabled);
}

/* Stile per grafici antropometria (futuri) */
.antropo-chart-container {
    background: var(--bg-surface);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 10px var(--shadow-sm);
    margin-top: 20px;
}

.antropo-chart-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.antropo-chart-controls button {
    padding: 8px 16px;
    border: 1px solid var(--border-medium);
    background: var(--bg-surface);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.antropo-chart-controls button.active {
    background: var(--success);
    color: var(--text-stable-white);
    border-color: var(--success);
}

/* Integrazione con progress modal */
.antropo-progress-section {
    padding: 20px;
    background: var(--success-bg-lightest);
    border-radius: 10px;
    margin-top: 20px;
}

.antropo-progress-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

/* Badge per tipo di misura */
.measure-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
    margin-left: 5px;
}

.badge-circumference {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-diameter {
    background: var(--primary-bg);
    color: var(--primary-darker);
}

.badge-custom {
    background: var(--warning-bg);
    color: var(--warning-text);
}

/* Stati selezione misure */
.misura-selected {
    opacity: 1;
    transform: scale(1);
    border-color: var(--success);
    background: var(--success-bg-lightest);
}

.misura-deselected {
    opacity: 0.4;
    transform: scale(0.95);
    filter: grayscale(50%);
}

.antropo-result-item:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px var(--shadow-lg);
    cursor: pointer;
}

/* === SEZIONE PESO === */

.weight-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    text-align: center;
}

.weight-value {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--text-primary);
}

.weight-value.bmi-value {
    color: var(--gradient-app-start);
}

.weight-unit {
    color: var(--text-secondary);
    margin: 5px 0;
}

.weight-label {
    font-size: 0.9em;
    color: var(--text-muted);
}

.weight-actions {
    text-align: center;
    margin-top: 15px;
}

.weight-edit-container {
    text-align: center;
    margin-bottom: 20px;
}

.weight-edit-container h4 {
    color: var(--gradient-app-start);
    margin-bottom: 15px;
}

.weight-form {
    max-width: 300px;
    margin: 0 auto;
}

.weight-edit-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.bmi-preview {
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background: var(--bg-surface-raised);
    border-radius: 8px;
}

/* BIA E BIVA */

.bia-biva-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-heavy);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.bia-biva-modal-content {
    background: var(--bg-surface);
    border-radius: 15px;
    width: 90%;
    max-width: 1400px;
    height: 90%;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px var(--shadow-md);
}

.bia-biva-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--bg-input-disabled);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gradient-app);
    color: var(--text-stable-white);
    border-radius: 15px 15px 0 0;
}

.bia-biva-header h2 {
    margin: 0;
}

.bia-biva-body {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
    scrollbar-width: none;
}

.bia-biva-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid var(--border-medium);
    margin-bottom: 30px;
}

.bia-tab {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    border-radius: 10px 10px 0 0;
}

.bia-tab:hover {
    color: var(--gradient-app-start);
    background: var(--primary-bg-light);
}

.bia-tab.active {
    color: var(--gradient-app-start);
    background: var(--shadow-brand-sm);
}

.bia-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-app-start);
}

.bia-tab-content {
    display: none;
}

.bia-tab-content.active {
    display: block;
}

.bia-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.bia-input-section, .bia-results-section {
    background: var(--bg-surface-raised);
    padding: 20px;
    border-radius: 10px;
}

.bia-input-section h3, .bia-results-section h3 {
    margin-top: 0;
    color: var(--text-primary);
}

.result-card {
    background: var(--bg-surface);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--gradient-app-start);
}

.result-label {
    font-weight: 600;
    color: var(--text-primary);
}

.result-value {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--gradient-app-start);
}

.bia-history-table-section {
    margin-top: 24px;
}

.bia-history-table-section h3 {
    margin-bottom: 12px;
}

.bia-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    background: var(--bg-surface-raised);
    border-radius: 8px;
    overflow: hidden;
}

.bia-history-table th,
.bia-history-table td {
    padding: 10px 14px;
    text-align: center;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-right: 1px solid var(--border-color, rgba(255,255,255,0.08));
}

.bia-history-table th:last-child,
.bia-history-table td:last-child {
    justify-content: center;
    border-right: none;
}

.bia-history-table th {
    background: var(--bg-surface, rgba(255,255,255,0.05));
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bia-history-table tbody tr:last-child td {
    border-bottom: none;
}

.bia-history-table tbody tr:hover {
    background: var(--bg-hover, rgba(255,255,255,0.04));
}

.bia-table-actions {
    display: flex;
    gap: 6px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8em;
}




.bia-chart-section, .biva-chart-section {
    margin-top: 30px;
}

.chart-container {
    background: var(--bg-surface-raised);
    border-radius: 10px;
    padding: 20px;
    height: 400px;
}

.chart-container.large {
    height: 500px;
}

.biva-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.biva-interpretation {
    background: var(--bg-surface-raised);
    padding: 20px;
    border-radius: 10px;
}

.biva-legend {
    margin-top: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.bia-biva-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--bg-input-disabled);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}



.result-card {
    animation: slideIn 0.3s ease;
}



.bia-classification-result {
    animation: fadeIn 0.5s ease;
}

/* Stili per i grafici */
.chart-container canvas {
    max-width: 100%;
}

/* ============================================
   PATCH per misurazioni.css
   Migrazione inline styles da client-detail.html
   ============================================ */

.section--plico {
    border-left: 5px solid var(--gradient-app-start);
}

.text-center-mt20 {
    text-align: center;
    margin-top: 20px;
}

.measurement-form-container {
    background: var(--bg-surface);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 10px var(--shadow-sm);
    margin-top: 20px;
}

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

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

.measurement-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.plico-field {
    background: var(--bg-surface-raised);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid var(--bg-input-disabled);
}

.meas-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    margin-bottom: 10px;
}

.meas-icon {
    font-size: 1.2em;
    margin-right: 8px;
}

.plico-field--peso {
    background: var(--success-bg-light);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid var(--success-border);
}

.section--antropo {
    border-left: 5px solid var(--success);
}

.antropo-section-title {
    color: var(--success);
    margin-bottom: 15px;
}

.antropo-field {
    background: var(--success-bg-lightest);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid var(--success-border);
}

.diam-field {
    background: var(--info-bg-light);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid var(--primary-border);
}

/* Se non esiste già in anamnesi.css */
.sintomi-modal-header--farmaci {
    background: linear-gradient(135deg, var(--navy-light) 0%, var(--navy-medium) 100%);
}

/* ============================================
   PATCH misurazioni – showMisurazioniHistory.js
                      plicometria.js
                      antropo-plico-calc.js
   Appendere in fondo a misurazioni.css
   ============================================ */

/* =============================================
   A. STORICO MISURAZIONI HISTORY MODAL (UI)
   ============================================= */

.storico-modal-header {
    top: 0;
    padding: 25px 30px;
    border-bottom: 2px solid var(--bg-surface-sunken);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gradient-app);
    color: var(--text-stable-white);
    z-index: 1;
    min-height: 110px;
    border-radius: 10px 10px 0 0;
}

.storico-modal-header h3 { margin: 0; }



.filtri-misurazioni {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px;
}

.storico-counter {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.9em;
    align-self: center;
}

.timeline-container {
    max-height: 60vh;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: none;
}

.storico-empty {
    text-align: center;
    color: var(--text-muted);
    margin: 40px 0;
}

.storico-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-storico-export {
    background: var(--success);
    padding: 10px 20px;
    border-radius: 8px;
    color: var(--text-stable-white);
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.btn-storico-export:hover { background: var(--success-dark); }

.btn-storico-chiudi {
    background: var(--text-muted);
    padding: 10px 20px;
    border-radius: 8px;
    color: var(--text-stable-white);
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.btn-storico-chiudi:hover { background: var(--navy-light); }

/* --- Formula Radio Selector (storico) --- */

.storico-formula-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    flex-wrap: wrap;
}

.storico-formula-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.storico-formula-info {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-left: 6px;
}

.formula-radio-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85em;
    border: 1px solid var(--border-medium);
    background: var(--bg-surface);
    transition: all 0.2s;
}

.formula-radio-label.active {
    background: var(--success-bg-light);
    border-color: var(--success);
    font-weight: 600;
}

.formula-radio-label input[type="radio"] { margin: 0; }

/* --- BF Badge Dynamic Colors --- */

.bf-badge-low {
    background: var(--success-bg-lightest);
    color: var(--success);
    border-color: var(--success);
}

.bf-badge-mid {
    background: var(--warning-bg-lightest);
    color: var(--warning-medium);
    border-color: var(--warning-medium);
}

.bf-badge-high {
    background: var(--danger-bg-lightest);
    color: var(--danger);
    border-color: var(--danger);
}

.bf-badge-na {
    background: var(--bg-surface-raised);
    color: var(--text-muted);
    border-color: var(--text-muted);
}

.bf-formula-sub {
    opacity: 0.7;
}

/* --- Valore item custom diam override --- */
.valore-item.custom.diam {
    background-color: var(--warning-bg-light);
}

/* --- Display toggle utility --- */
.mis-hidden { display: none !important; }

/* =============================================
   B. PLICOMETRIA
   ============================================= */

.plica-indicatore {
    margin-left: 5px;
    font-size: 0.9em;
}

.btn-plica-disabled { opacity: 0.5; }

/* --- Add Plica Button --- */
#add-plica-button {
    background: var(--add-plica-bg);
    padding: 15px;
    border-radius: 10px;
    border: 2px dashed var(--add-plica-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 100px;
}

#add-plica-button:hover {
    background: var(--add-plica-bg-hover);
    transform: scale(1.02);
}

.add-plica-content { text-align: center; color: var(--add-plica-text); }
.add-plica-icon { font-size: 3em; font-weight: 300; line-height: 1; }
.add-plica-text { font-size: 0.85em; margin-top: 5px; opacity: 0.8; }

/* ===============================
   CIRCONFERENZE (verde)
   =============================== */
#add-antropo-button-circ {
    background: var(--add-circ-bg);
    padding: 15px;
    border-radius: 10px;
    border: 2px dashed var(--add-circ-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 100px;
    color: var(--add-circ-text);
}

#add-antropo-button-circ:hover {
    background: var(--add-circ-bg-hover);
    transform: scale(1.02);
}

/* ===============================
   DIAMETRI (azzurro + bordo blu)
   =============================== */
#add-antropo-button-diam {
    background: var(--add-diam-bg);
    padding: 15px;
    border-radius: 10px;
    border: 2px dashed var(--add-diam-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 100px;
}

#add-antropo-button-diam:hover {
    background: var(--add-diam-bg-hover);
    transform: scale(1.02);
}

.add-diam-content { text-align: center; color: var(--add-diam-text); }
.add-diam-icon { font-size: 3em; font-weight: 300; line-height: 1; }
.add-diam-text { font-size: 0.85em; margin-top: 5px; opacity: 0.8; }

#add-plica-button:hover {
    background: var(--add-plica-bg-hover);
    transform: scale(1.02);
    border-color: var(--add-plica-text);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15), 0 4px 12px rgba(16, 185, 129, 0.2);
}

#add-antropo-button-circ:hover {
    background: var(--add-circ-bg-hover);
    transform: scale(1.02);
    border-color: var(--add-circ-text);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15), 0 4px 12px rgba(16, 185, 129, 0.2);
}

#add-antropo-button-diam:hover {
    background: var(--add-diam-bg-hover);
    transform: scale(1.02);
    border-color: var(--add-diam-text);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 4px 12px rgba(59, 130, 246, 0.2);
}


/* --- Formula Buttons --- */

.formula-btn {
    padding: 10px 15px;
    border: 2px solid rgba(255,255,255,0.3);
    background: transparent;
    color: rgba(255,255,255,0.8);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.formula-btn-active,
.formula-btn.active {
    background: rgba(255,255,255,0.2);
    color: var(--text-stable-white);
}

/* Formula availability colors (replace emoji indicators) */
.formula-btn.formula-available {
    border-color: #4a9eff;
    color: #4a9eff;
}
.formula-btn.formula-selected {
    background: rgba(76, 175, 80, 0.25);
    border-color: #4caf50;
    color: #4caf50;
}
.formula-btn.btn-plica-disabled {
    opacity: 1 !important;
    border-color: #ffa726 !important;
    color: #ffa726 !important;
    cursor: not-allowed;
}

.formula-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    gap: 8px;
}

/* --- Body Fat Display Area --- */

.plica-bf-section { text-align: center; }

.plica-bf-subtext {
    font-size: 0.85em;
    opacity: 0.8;
}

.formula-method-container {
    margin-top: 15px;
    padding: 15px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
}

.formula-method-label {
    font-size: 0.85em;
    margin-bottom: 10px;
    opacity: 0.9;
}

.btn-save-pref {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--text-stable-white);
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85em;
}

.btn-save-pref:hover {
    background: rgba(255,255,255,0.35);
}

.plica-ultima-data {
    text-align: center;
    margin-bottom: 15px;
}

.plica-ultima-data span {
    color: var(--text-muted);
    font-size: 0.9em;
}

.plica-empty-state {
    text-align: center;
    color: var(--text-muted);
}

.plica-error-state {
    text-align: center;
    color: var(--danger);
}

/* --- Suggestion Colors --- */

.suggestion-auto { color: #90EE90; }
.suggestion-recommended { color: #FFD700; }

/* --- Custom Plica Field --- */

.custom-plica-field {
    background: var(--warning-bg);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid var(--warning-medium);
    position: relative;
}

.custom-plica-remove {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--danger-medium);
    color: var(--text-stable-white);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 4px var(--shadow-md);
}

.custom-plica-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

.custom-plica-name-input {
    border: none;
    background: transparent;
    font-weight: 600;
    flex: 1;
    min-width: 80px;
    outline: none;
    color: inherit;
}

.custom-plica-label .pin-icon {
    font-size: 1.2em;
    margin-right: 8px;
}



/* --- Plica Notes --- */
.plica-note-box {
    margin-top: 15px;
    padding: 10px;
    background: var(--bg-surface-raised);
    border-radius: 8px;
}

/* --- Plica peso item green bg --- */
.plico-peso-bg { background: var(--success-bg-light); }

/* --- Dynamic body fat display margin override --- */
.body-fat-display-inline {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    color: var(--text-stable-white);
}

/* =============================================
   C. ANTROPO-PLICO-CALC RESULTS
   ============================================= */

.apc-container { padding: 20px; }

/* --- Section blocks --- */

.apc-section {
    background: var(--bg-surface-raised);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.apc-section-title {
    color: var(--gradient-app-start);
    margin-bottom: 20px;
    font-size: 18px;
    border-bottom: 2px solid var(--gradient-app-start);
    padding-bottom: 10px;
}

.apc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

/* --- White cards --- */

.apc-card {
    background: var(--bg-surface);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-sm);
}

.apc-card-title {
    color: var(--gradient-app-start);
    margin: 0 0 15px 0;
}

/* --- Stat rows --- */

.apc-stat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.apc-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.apc-stat-row-bordered {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-light);
}

.apc-stat-label { color: var(--text-secondary); }

/* --- Gradient sections (composizione, fabbisogno) --- */

.apc-gradient-section {
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    color: var(--text-stable-white);
}

.apc-gradient-section--composizione {
    background: var(--analysis-full-bg);
}

.apc-gradient-title {
    margin-bottom: 20px;
    font-size: 18px;
}

.apc-formula-badge {
    background: rgba(255,255,255,0.2);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7em;
    margin-left: 10px;
    white-space: nowrap;
}

.apc-overlay-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.apc-overlay-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.apc-overlay-grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.apc-overlay-card {
    background: rgba(255,255,255,0.2);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.apc-overlay-card-sm {
    background: rgba(255,255,255,0.15);
    padding: 10px;
    border-radius: 5px;
}

.apc-stat-small { font-size: 0.9em; opacity: 0.9; }
.apc-stat-xsmall { font-size: 0.85em; opacity: 0.9; }
.apc-stat-big { font-size: 2em; font-weight: bold; margin: 5px 0; }
.apc-stat-sub { font-size: 1.2em; }
.apc-stat-sub-sm { font-size: 1em; }
.apc-stat-mid { font-size: 1.1em; font-weight: bold; }

/* --- Dividers --- */

.apc-divider {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.3);
}

.apc-flex-around {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

/* --- Warnings --- */

.apc-warning-yellow {
    background: var(--warning-bg);
    color: var(--warning-text);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    border: 1px solid var(--warning-medium);
}

.apc-warning-red {
    background: var(--danger-bg);
    color: var(--danger-text);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    border: 1px solid var(--danger-border);
}

/* --- Summary panel items --- */

.apc-summary-item {
    padding: 10px;
    background: var(--bg-surface-raised);
    border-radius: 5px;
    margin-bottom: 10px;
}

.apc-summary-comp {
    padding: 10px;
    background: var(--primary-bg);
    border-radius: 5px;
    margin-bottom: 10px;
}

.apc-summary-comp h5 {
    margin: 0 0 10px 0;
    color: var(--primary);
}

.apc-summary-comp-body { font-size: 0.9em; }

.apc-summary-warning {
    padding: 10px;
    background: var(--warning-bg);
    border-radius: 5px;
    color: var(--warning-text);
}

.apc-auto-sub {
    color: rgba(255,255,255,0.8);
}

/* --- Additional utilities --- */

.radio-no-margin { margin: 0; }

.formula-suggestion {
    margin-top: 8px;
    font-size: 0.8em;
    opacity: 0.9;
    min-height: 20px;
}

.plica-result-item {
    position: relative;
    cursor: pointer;
}

.plica-save-area { margin-top: 10px; }

.apc-stat-bold { font-weight: bold; }

/* --- Macro section title --- */
.apc-macro-title { margin-bottom: 15px; }

.apc-divider-top {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.3);
}

/* =============================================
   PATCH-ANTROPO.CSS — Migrazione inline styles
   da antropometria.js
   ============================================= */

/* === ADD BUTTON (+) === */
.antropo-add-btn {
    background: var(--info-bg-light);
    padding: 15px;
    border-radius: 10px;
    border: 2px dashed var(--primary-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 100px;
}

.antropo-add-btn:hover {
    background: linear-gradient(135deg, var(--success-lighter) 0%, var(--success-light) 100%);
    transform: scale(1.02);
}

.antropo-add-btn-content {
    text-align: center;
    color: var(--success-medium);
}

.antropo-add-btn-icon {
    font-size: 3em;
    font-weight: 300;
    line-height: 1;
}

.antropo-add-btn-label {
    font-size: 0.85em;
    margin-top: 5px;
    opacity: 0.8;
}

/* === CUSTOM MEASUREMENT FIELD === */
.custom-antropo-field {
    padding: 15px;
    border-radius: 10px;
    border: 2px solid;
    position: relative;
}

.custom-antropo-field--circ {
    background: var(--success-bg-lightest);
    border-color: var(--success-border);
}

.custom-antropo-field--diam {
    background: var(--info-bg-lightest);
    border-color: var(--primary-border);
}

.custom-antropo-field--legacy {
    background: var(--warning-bg);
    border-color: var(--warning-medium);
}

.custom-antropo-remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--danger-medium);
    color: var(--text-stable-white);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 4px var(--shadow-md);
}

.custom-antropo-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

.custom-antropo-name-input{
        border: none;
    background: transparent;
    font-weight: 600;
    flex: 1;
    min-width: 80px;
    outline: none;
    color: inherit;
}

.custom-antropo-label-icon {
    font-size: 1.2em;
    margin-right: 8px;
}

.custom-antropo-name-input {
    border: none;
    background: transparent;
    font-weight: 600;
    flex: 1;
    outline: none;
    color: inherit;
}

/* === DISPLAY: EMPTY / ERROR MESSAGES === */
.antropo-empty-msg {
    text-align: center;
    color: var(--text-muted);
}

.antropo-error-msg {
    text-align: center;
    color: var(--danger);
}

/* === LAST MEASUREMENT DATE === */
.antropo-date-info {
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 0.9em;
}

/* === RESULT ITEM (clickable wrapper) === */
.antropo-result-clickable {
    position: relative;
    cursor: pointer;
}

.plico-result-item-clickable {
    position: relative;
    cursor: pointer;
}

/* === ANALYSIS PANEL === */
.antropo-analysis-panel {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    color: var(--analysis-text);
    text-align: center;
}

.antropo-analysis-panel--default {
    background: var(--analysis-default-bg);
}

.antropo-analysis-panel--few {
    background: var(--analysis-few-bg);
}

.antropo-analysis-panel--some {
    background: var(--analysis-some-bg);
}

.antropo-analysis-panel--many {
    background: var(--analysis-many-bg);
}

.antropo-analysis-panel--full {
    background: var(--analysis-full-bg);
}

.antropo-analysis-label {
    font-size: 0.9em;
    opacity: 0.9;
}

.antropo-analysis-value {
    font-size: 2em;
    font-weight: bold;
    margin: 10px 0;
}

.antropo-analysis-subtitle {
    font-size: 0.85em;
    opacity: 0.8;
}

.antropo-analysis-indices {
    margin-top: 15px;
}

.antropo-analysis-save-area {
    margin-top: 10px;
}

.antropo-analysis-save-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--text-stable-white);
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85em;
}

.antropo-analysis-save-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* === DYNAMIC INDICES ROW === */
.antropo-indices-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.antropo-index-item {
    text-align: center;
}

.antropo-index-label {
    font-size: 0.8em;
    opacity: 0.9;
}

.antropo-index-value {
    font-size: 1.3em;
    font-weight: bold;
}

/* === NOTES === */
.antropo-notes {
    margin-top: 15px;
    padding: 10px;
    background: var(--bg-surface-raised);
    border-radius: 8px;
}

/* =============================================
   PATCH-PROGRESS.CSS — Migrazione inline styles
   da progress.js
   ============================================= */

/* === PLICHE PERSONALIZZATE TITLE === */
.pliche-custom-title {
    color: var(--warning-medium);
}

/* === BIA MODAL: HEADER ACTIONS === */
.bia-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === BIA FORM: CALCULATED FIELD LABEL === */
.bia-calculated-hint {
    color: var(--gradient-app-start);
    font-weight: normal;
}

/* === BIA FORM: READONLY INPUT === */
.bia-readonly-input {
    background-color: var(--bg-surface-raised);
    font-weight: bold;
}

/* === BIA CLASSIFICATION RESULT === */
.bia-classification-card {
    margin-top: 20px;
    padding: 15px;
    background: var(--gradient-app);
    color: var(--text-stable-white);
    border-radius: 10px;
}

.bia-classification-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.bia-classification-label {
    opacity: 0.9;
}

.bia-classification-value {
    font-size: 1.2em;
    font-weight: bold;
}

.bia-classification-bmr {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.bia-classification-bmr-value {
    font-size: 1.1em;
}

/* === INTERPRETATION PANEL (static parts) === */
.interp-icon {
    font-size: 1.5em;
    margin-right: 10px;
}

.interp-text {
    color: var(--text-heading);
}

/* === STATISTICS: EMPTY / HINT === */
.stats-empty-msg {
    color: var(--text-muted);
    text-align: center;
}

.stats-hint {
    color: var(--text-muted);

}

/* === REPORT: INSUFFICIENT DATA === */
.report-insufficient {
    color: var(--text-muted);
    text-align: center;
}

/* Layout a due colonne BF / VF */
.bf-vf-columns {
    display: flex;
    gap: 20px;
    width: 100%;
}

.plica-bf-section,
.plica-vf-section {
    flex: 1;
    min-width: 0;
}

.plica-vf-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Scala visuale VF */
.vf-scale-bar {
    display: flex;
    width: 100%;
    max-width: 220px;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 12px;
}

.vf-scale-segment {
    flex: 1;
    font-size: 0;
}

.vf-scale-normal { background: var(--success); }
.vf-scale-borderline { background: var(--warning-medium); }
.vf-scale-high { background: var(--danger); }

.vf-scale-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 220px;
    margin-top: 4px;
    font-size: 0.65em;
    color: var(--text-stable-white);
}

/* Classificazione VF */
.vf-class-badge {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
}

.vf-class-badge.vf-normal { background: var(--success-bg); color: var(--success-text); }
.vf-class-badge.vf-borderline { background: var(--warning-bg); color: var(--warning-text); }
.vf-class-badge.vf-high { background: var(--danger-bg); color: var(--danger-text); }

.vf-method-sub {
    font-size: 0.75em;
    color: var(--text-stable-white);
}

.vf-hint {
    color: var(--text-stable-white);
    font-size: 0.8em;
}

/* Colore valore VF in base a classe */
#calculated-visceral-fat.vf-normal { color: var(--success); }
#calculated-visceral-fat.vf-borderline { color: var(--warning); }
#calculated-visceral-fat.vf-high { color: var(--danger); }

/* Badge VF nello storico */
.risultato-badge-vf {
    font-size: 0.82em;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.risultato-badge-vf.vf-normal { background: var(--success-bg); color: var(--success-text); }
.risultato-badge-vf.vf-borderline { background: var(--warning-bg); color: var(--warning-text); }
.risultato-badge-vf.vf-high { background: var(--danger-bg); color: var(--danger-text); }

/* Warning messaggio mancanza dati */
.suggestion-missing {
    color: var(--warning-dark);
    font-size: 0.85em;
}

/* ===== Storico Misurazioni Modal (ex addMisurazioniHistoryStyles) ===== */

.history-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay-heavy);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

.history-content {
    background: var(--bg-surface);
    border-radius: 16px;
    max-height: 95vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px var(--shadow-lg);
}

/* Filtri */
.filtro-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-medium);
    background: var(--bg-surface);
    color: var(--text-primary);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.filtro-btn:hover {
    border-color: var(--gradient-app-start);
    background: var(--primary-bg-light);
}

.filtro-btn.active {
    background: var(--gradient-app-start);
    color: var(--text-stable-white);
    border-color: var(--gradient-app-start);
}

/* Timeline */
.gruppo-data {
    margin-bottom: 20px;
    border-left: 3px solid var(--gradient-app-start);
    padding-left: 15px;
}

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

.data-label {
    font-weight: 600;
    font-size: 1.1em;
    color: var(--text-primary);
}

.badge-completo {
    background: var(--success-bg-light);
    color: var(--success-dark);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    margin-left: 10px;
}

.data-icons {
    font-size: 1.2em;
}

/* Cards */
.cards-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-misurazione {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-misurazione:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-md);
}

.card-plicometria {
    border: 1px solid var(--violet-light);
}

.card-plicometria .card-header {
    background: var(--gradient-success-btn);
}

.card-antropometria {
    border: 1px solid var(--primary-border);
}

.card-antropometria .card-header {
    background: var(--gradient-app);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    color: var(--text-stable-white);
}

.card-tipo {
    font-weight: 600;
    font-size: 0.9em;
}

.card-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    background: transparent;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--bg-active-inverse);
}

.btn-icon.btn-danger:hover {
    background: var(--danger-active);
}

.card-body {
    padding: 12px 15px;
    background: var(--bg-surface);
}

/* Valori */
.valori-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.valore-item {
    border: 1px solid var(--success);
    background: var(--success-bg-lightest);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85em;
    display: flex;
    gap: 5px;
    align-items: center;
}

.valore-item.custom {
    background: var(--warning-bg-light);
    border: 1px solid var(--warning-light);
}

.valore-item.diam {
    background: var(--primary-bg);
    border: 1px solid var(--primary-border);
}

.valore-label {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.valore-num {
    font-weight: 600;
    color: var(--text-primary);
}

.sezione-misure {
    margin-bottom: 10px;
}

.sezione-label {
    font-size: 0.75em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 5px;
}

/* Risultati */
.risultati-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
}

.risultato-badge {
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.9em;
}

.risultato-info {
    color: var(--text-secondary);
    font-size: 0.85em;
}

.note-text {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--warning-bg-lightest);
    border-radius: 8px;
    font-size: 0.85em;
    color: var(--text-secondary);
    font-style: italic;
    border: 1px solid var(--warning-medium);
}

/* Scrollbar custom */
.timeline-container::-webkit-scrollbar {
    width: 6px;
}

.timeline-container::-webkit-scrollbar-track {
    background: var(--bg-surface-sunken);
    border-radius: 3px;
}

.timeline-container::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}

.timeline-container::-webkit-scrollbar-thumb:hover {
    background: var(--border-dark);
}

.chart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 280px;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.chart-empty-icon {
    font-size: 3em;
    margin-bottom: 12px;
    opacity: 0.5;
}

.chart-empty-state h4 {
    margin: 0 0 8px;
    color: var(--text-secondary);
    font-size: 1.1em;
}

.chart-empty-state p {
    margin: 0;
    font-size: 0.9em;
    max-width: 300px;
    line-height: 1.5;
}

/* Tab switcher — nascosto di default */
.progress-mobile-tab-switcher {
    display: none;
}

.modal-close.progress{
    display: none;
}

.valutazione-export-modal-content {
  max-width: 560px;
  width: 96%;
}

.valutazione-export-title {
  color: var(--text-stable-white);
  margin: 0;
  font-size: 1.2rem;
}

.valutazione-export-subtitle {
  color: rgba(255, 255, 255, 0.75);
  margin: 4px 0 0;
  font-size: 0.85rem;
}

.valutazione-export-close {
  background: none;
  border: none;
  color: var(--text-stable-white);
  font-size: 1.4rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.valutazione-export-close:hover {
  opacity: 1;
}

.valutazione-export-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.valutazione-export-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.valutazione-export-section-title {
  font-weight: 600;
  color: var(--text-heading);
  margin: 0;
  font-size: 0.95rem;
}

.valutazione-export-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.valutazione-export-loading {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
}

.valutazione-export-radio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-surface-card);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.valutazione-export-radio-row:hover {
  border-color: var(--brand);
  background: var(--brand-bg);
}

.valutazione-export-radio-row input[type="radio"] {
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.valutazione-export-radio-label {
  font-size: 0.88rem;
  color: var(--text-primary);
  cursor: pointer;
}

.valutazione-export-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
  padding: 8px 0;
}

.valutazione-export-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-medium);
  background: var(--bg-surface-raised);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-radius: 0 0 20px 20px;
}



@media (max-width: 1300px) {

    .modal-close.progress{
        display: block;
    }

    .close-all-button{
        display: none;
    }

    .progress-modals-container .progress-header{
        justify-content: space-between;
    }

    .progress-modals-container {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        gap: 8px;
    }
    .progress-modals-container .progress-modal-panel {
        width: 100%;
        height: calc(100% - 100px); /* sottrai altezza header + tab switcher */
        border-radius: 12px;
    }

    .progress-modals-container .progress-modal-panel.panel-hidden {
        display: none;
    }

    .progress-mobile-tab-switcher {
        display: flex;
        gap: 0;
        border-radius: 10px;
        overflow: hidden;
        border: 1px solid var(--border-medium);
        margin-bottom: 10px;
        flex-shrink: 0;
    }

    .progress-mobile-tab {
        flex: 1;
        padding: 12px;
        border: none;
        background: var(--bg-surface-raised);
        color: var(--text-secondary);
        font-weight: 600;
        font-size: 0.95em;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .progress-mobile-tab.active {
        background: var(--gradient-success-btn);
        color: var(--text-stable-white);
    }

    .progress-modals-header {
        flex-shrink: 0;
    }

    .comparative-report-body.dual-panel{
        grid-template-columns: unset;
    }
}


@media (max-width: 800px) {

    .bia-grid{
        grid-template-columns: unset;
    }

    .biva-grid{
        grid-template-columns: unset;
    }

    .biva-chart-section{
        order: 2;
    }
    
}

@media (max-width: 700px) {
    .report-summary {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .summary-item {
        padding: 8px 6px;
    }

    .summary-label {
        font-size: 0.65em;
    }

    .summary-value {
        font-size: 1em;
    }

    .comparative-report-modal {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
    }

    .comparative-report-body.dual-panel {
        grid-template-columns: 1fr;
    }

    /* Nasconde colonne meno importanti */
    .comparative-table th:nth-child(6),
    .comparative-table td:nth-child(6),
    .comparative-table th:nth-child(7),
    .comparative-table td:nth-child(7),
    .comparative-table th:nth-child(8),
    .comparative-table td:nth-child(8) {
        display: none;
    }

    .comparative-table {
        font-size: 0.78em;
    }

    .comparative-table th,
    .comparative-table td {
        padding: 8px 4px;
    }

    .comparative-table th:first-child,
    .comparative-table td.metric-name {
        padding-left: 8px;
    }
}



/* Responsive: stack su mobile */
@media (max-width: 600px) {
    .bf-vf-columns {
        flex-direction: column;
    }

    .formula-buttons-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .apc-flex-around{
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .results-header{
        display: block;
    }

    .apc-stat-row-bordered,
    .apc-stat-row{
        flex-direction: column;
    }

    .apc-grid{
        grid-template-columns: unset;
    }

}

@media (max-width: 480px) {
    /* Nasconde anche trend */
    .comparative-table th:nth-child(9),
    .comparative-table td:nth-child(9) {
        display: none;
    }
}

/* NOTE: .legend-color background values are chart-specific
   color mappings. Kept as inline.
   interpretation.color is dynamic. Kept as inline.
   stat.color on .stat-label is dynamic. Kept as inline. */

/* =============================================
   Progress modal redesign
   ============================================= */

.progress-redesign-shell {
    position: fixed;
    inset: 0;
    z-index: 10030;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--gradient-app-start) 12%, transparent) 0%, transparent 34%),
        radial-gradient(circle at top right, color-mix(in srgb, var(--gradient-app-end, var(--gradient-app-start)) 10%, transparent) 0%, transparent 30%),
        var(--overlay-heavy);
    backdrop-filter: blur(14px);
}

.progress-redesign-modal {
    width: min(1480px, 100%);
    max-height: min(92vh, 1080px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid var(--border-medium);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--bg-surface-raised) 60%, transparent) 0%, transparent 24%),
        var(--bg-surface);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

.progress-redesign-shell .pr-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-medium);
    background: linear-gradient(180deg, color-mix(in srgb, var(--text-primary) 3%, transparent) 0%, transparent 100%);
}

.progress-redesign-shell .pr-modal__title {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.progress-redesign-shell .pr-modal__icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--gradient-app-start) 14%, var(--bg-surface-raised));
    border: 1px solid color-mix(in srgb, var(--gradient-app-start) 34%, var(--border-medium));
    color: var(--gradient-app-start);
    flex-shrink: 0;
}

.progress-redesign-shell .pr-modal__icon svg {
    width: 18px;
    height: 18px;
}

.progress-redesign-shell .pr-modal__title h2 {
    margin: 0;
    font-size: 1.08rem;
    line-height: 1.1;
    color: var(--text-heading);
}

.progress-redesign-shell .pr-modal__title .sub {
    margin-top: 4px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.progress-redesign-shell .pr-modal__head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.progress-redesign-shell .icon-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border-medium);
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.progress-redesign-shell .icon-btn:hover {
    background: var(--bg-surface-raised);
    border-color: var(--border-strong);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.progress-redesign-shell .icon-btn.active {
    background: color-mix(in srgb, var(--gradient-app-start) 12%, var(--bg-surface-raised));
    border-color: color-mix(in srgb, var(--gradient-app-start) 40%, var(--border-medium));
    color: var(--text-primary);
}

.progress-redesign-shell .icon-btn--label {
    min-width: auto;
    padding-inline: 14px;
}

.progress-redesign-shell .progress-close-btn {
    font-size: 1.15rem;
    line-height: 1;
}

.progress-redesign-shell .pr-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 24px 0;
    border-bottom: 1px solid var(--border-medium);
}

.progress-redesign-shell .pr-tab {
    position: relative;
    border: 0;
    background: transparent;
    padding: 12px 16px;
    border-radius: 10px 10px 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.16s ease, background-color 0.16s ease;
}

.progress-redesign-shell .pr-tab:hover {
    color: var(--text-primary);
    background: color-mix(in srgb, var(--bg-surface-raised) 60%, transparent);
}

.progress-redesign-shell .pr-tab.active {
    color: var(--text-primary);
}

.progress-redesign-shell .pr-tab.active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 2px;
    border-radius: 999px 999px 0 0;
    background: var(--gradient-app-start);
}

.progress-redesign-shell .pr-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-medium);
}

.progress-redesign-shell .pr-segment,
.progress-redesign-shell .pr-range-pills {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border-medium);
    border-radius: 11px;
    background: var(--bg-surface-raised);
}

.progress-redesign-shell .pr-segment button,
.progress-redesign-shell .pr-range-pills button {
    border: 0;
    border-radius: 8px;
    padding: 8px 12px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.progress-redesign-shell .pr-segment button.active,
.progress-redesign-shell .pr-range-pills button.active {
    color: var(--text-primary);
    background: var(--bg-surface);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gradient-app-start) 18%, var(--border-medium));
}

.progress-redesign-shell .pr-range-pills button.is-disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.progress-redesign-shell .pr-spacer {
    flex: 1 1 auto;
}


.progress-redesign-shell .progress-compare-hint {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.progress-redesign-shell .pr-main {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    min-height: 0;
    flex: 1 1 auto;
}

.progress-redesign-shell .pr-side {
    padding: 20px;
    border-right: 1px solid var(--border-medium);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--bg-surface-raised) 72%, transparent) 0%, transparent 100%),
        var(--bg-surface);
    overflow-y: auto;
    scrollbar-width: none;
}

.progress-redesign-shell .pr-content {
    padding: 20px 24px 24px;
    overflow-y: auto;
    scrollbar-width: none;
}

.progress-redesign-shell .pr-search {
    margin-bottom: 14px;
}

.progress-redesign-shell .pr-search input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border-medium);
    border-radius: 11px;
    background: var(--bg-surface-raised);
    color: var(--text-primary);
    font-size: 0.86rem;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.progress-redesign-shell .pr-search input:focus {
    border-color: color-mix(in srgb, var(--gradient-app-start) 40%, var(--border-medium));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--gradient-app-start) 10%, transparent);
}

.progress-redesign-shell .pr-search input::placeholder {
    color: var(--text-secondary);
}

.progress-redesign-shell .pr-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border-medium);
    border-radius: 11px;
    background: var(--bg-surface-raised);
}

.progress-redesign-shell .pr-summary__count {
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 700;
}

.progress-redesign-shell .pr-summary__count em {
    font-style: normal;
    color: var(--gradient-app-start);
}

.progress-redesign-shell .pr-summary__clear {
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.progress-redesign-shell .pr-summary__clear:disabled {
    opacity: 0.42;
    cursor: default;
}

.progress-redesign-shell .pr-cat {
    margin-bottom: 8px;
    border-radius: 12px;
}

.progress-redesign-shell .pr-cat__head {
    width: 100%;
    border: 0;
    padding: 10px 12px;
    border-radius: 11px;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.16s ease;
}

.progress-redesign-shell .pr-cat__head:hover {
    background: color-mix(in srgb, var(--bg-surface-raised) 72%, transparent);
}

.progress-redesign-shell .pr-cat__chev {
    width: 14px;
    color: var(--text-secondary);
    transition: transform 0.18s ease;
}

.progress-redesign-shell .pr-cat.open .pr-cat__chev {
    transform: rotate(90deg);
}

.progress-redesign-shell .pr-cat__title {
    flex: 1 1 auto;
    color: var(--text-secondary);
    font-size: 0.77rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.progress-redesign-shell .pr-cat__count {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--bg-surface-raised);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
}

.progress-redesign-shell .pr-cat__items {
    display: none;
    padding: 4px 0 8px;
}

.progress-redesign-shell .pr-cat.open .pr-cat__items {
    display: block;
}

.progress-redesign-shell .pr-metric {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.16s ease, transform 0.16s ease;
}

.progress-redesign-shell .pr-metric:hover {
    background: color-mix(in srgb, var(--bg-surface-raised) 75%, transparent);
    transform: translateX(2px);
}

.progress-redesign-shell .pr-metric input {
    display: none;
}

.progress-redesign-shell .pr-metric__color {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    flex-shrink: 0;
    background: var(--c, var(--text-secondary));
    opacity: 0.38;
    transition: opacity 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.progress-redesign-shell .pr-metric.on .pr-metric__color {
    opacity: 1;
    transform: scale(1.18);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--c, var(--gradient-app-start)) 16%, transparent);
}

.progress-redesign-shell .pr-metric__name {
    flex: 1 1 auto;
    color: var(--text-secondary);
    font-size: 0.86rem;
    transition: color 0.16s ease;
}

.progress-redesign-shell .pr-metric.on .pr-metric__name {
    color: var(--text-primary);
    font-weight: 600;
}

.progress-redesign-shell .progress-sidebar-empty,
.progress-redesign-shell .progress-kpi-empty,
.progress-redesign-shell .progress-insight-empty {
    padding: 16px;
    border: 1px dashed var(--border-medium);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-surface-raised) 72%, transparent);
    color: var(--text-secondary);
    font-size: 0.86rem;
    
}

.progress-redesign-shell .pr-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.progress-redesign-shell .pr-kpi {
    position: relative;
    overflow: hidden;
    padding: 15px 16px;
    border-radius: 16px;
    border: 1px solid var(--border-medium);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--bg-surface-raised) 68%, transparent) 0%, transparent 100%),
        var(--bg-surface);
}

.progress-redesign-shell .pr-kpi::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: var(--c, var(--gradient-app-start));
}

.progress-redesign-shell .pr-kpi__label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.progress-redesign-shell .pr-kpi__label .dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--c, var(--gradient-app-start));
}

.progress-redesign-shell .pr-kpi__val {
    color: var(--text-primary);
    font-size: 1.48rem;
    font-weight: 700;
    line-height: 1;
}

.progress-redesign-shell .pr-kpi__delta {
    margin-top: 8px;
    font-size: 0.77rem;
    font-weight: 600;
}

.progress-redesign-shell .pr-kpi__delta.up {
    color: var(--warning);
}

.progress-redesign-shell .pr-kpi__delta.down {
    color: var(--success);
}

.progress-redesign-shell .pr-kpi__spark {
    margin-top: 12px;
}

.progress-redesign-shell .progress-kpi-spark {
    width: 100%;
    height: 30px;
    display: block;
}

.progress-redesign-shell .pr-compare {
    display: grid;
    grid-template-columns: minmax(190px, 0.95fr) auto auto minmax(240px, 1fr);
    align-items: center;
    gap: 10px;
    
    padding: 12px 16px;
    border: 1px solid var(--border-medium);
    border-radius: 14px;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--bg-surface-raised) 72%, transparent) 0%, transparent 100%),
        var(--bg-surface);
    margin-bottom: 10px;
    margin-top: -10px;
}

.progress-redesign-shell .pr-compare__main {
    min-width: 0;
}

.progress-redesign-shell .pr-compare__title,
.progress-redesign-shell .pr-compare__date .label {
    color: var(--text-secondary);
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.progress-redesign-shell .pr-compare__date {
    padding: 8px 12px;
    border: 1px solid var(--border-medium);
    border-radius: 10px;
    background: var(--bg-surface-raised);
    color: var(--text-primary);
    min-width: 104px;
}

.progress-redesign-shell .pr-compare__date > div:last-child,
.progress-redesign-shell #progress-compare-from,
.progress-redesign-shell #progress-compare-to {
    margin-top: 3px;
    font-size: 0.9rem;
    font-weight: 600;
}

.progress-redesign-shell #progress-compare-from,
.progress-redesign-shell #progress-compare-to {
    width: 132px;
    min-height: 30px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    color-scheme: dark;
    padding: 0;
}

.progress-redesign-shell .pr-compare__arrow {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 700;
}

.progress-redesign-shell .pr-compare__meta {
    margin-top: 4px;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.3;
}

.progress-redesign-shell .progress-compare-hint {
    justify-self: end;
    max-width: 420px;
}

.progress-redesign-shell .progress-compare-hint,
.progress-redesign-shell .progress-compare-lock-note {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--bg-surface-raised);
    border-radius: 8px;
    color: var(--text-secondary);
    border-left: 3px solid var(--warning, #f59e0b);
    font-size: 0.82em;
    font-weight: 600;
}

.progress-redesign-shell .progress-compare-lock-note {
    grid-column: 1 / -1;
}

.progress-redesign-shell .progress-tab-pane {
    display: none;
}

.progress-redesign-shell .progress-tab-pane.active {
    display: block;
}

.progress-redesign-shell .progress-chart-surface {
    display: grid;
    gap: 14px;
}

.progress-redesign-shell .progress-chart-surface.is-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.progress-redesign-shell .progress-chart-surface.is-overlay {
    grid-template-columns: minmax(0, 1fr);
}

.progress-redesign-shell .progress-chart-card,
.progress-redesign-shell .chart-container.progress-chart-card {
    min-height: 360px;
    height: 360px;
    padding: 0;
    border-radius: 18px;
    border: 1px solid var(--border-medium);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--bg-surface-raised) 68%, transparent) 0%, transparent 100%),
        var(--bg-surface);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.progress-redesign-shell .progress-chart-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid color-mix(in srgb, var(--border-medium) 85%, transparent);
}

.progress-redesign-shell .progress-chart-card__title-wrap {
    min-width: 0;
}

.progress-redesign-shell .progress-chart-card__title {
    color: var(--text-primary);
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.2;
}

.progress-redesign-shell .progress-chart-card__meta {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.progress-redesign-shell .progress-chart-card__legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

.progress-redesign-shell .progress-chart-card__legend-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1;
}

.progress-redesign-shell .progress-chart-card__legend-swatch {
    width: 12px;
    height: 3px;
    border-radius: 999px;
    background: var(--legend, var(--gradient-app-start));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--legend, var(--gradient-app-start)) 16%, transparent);
}

.progress-redesign-shell .progress-chart-card__body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    padding: 12px 16px 14px;
}

.progress-redesign-shell .progress-chart-card canvas,
.progress-redesign-shell .chart-container.progress-chart-card canvas {
    display: block;
    min-width: 100% !important;
    width: 100% !important;
    height: 100% !important;
}

.progress-redesign-shell .progress-insight-grid {
    margin-top: 18px;
}

.progress-redesign-shell .progress-insight-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.progress-redesign-shell .progress-insight-card {
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border-medium);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--bg-surface-raised) 70%, transparent) 0%, transparent 100%),
        var(--bg-surface);
    position: relative;
    overflow: hidden;
}

.progress-redesign-shell .progress-insight-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--metric-color, var(--gradient-app-start));
}

.progress-redesign-shell .progress-insight-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.progress-redesign-shell .progress-insight-card__title {
    color: var(--text-primary);
    font-size: 0.98rem;
    font-weight: 700;
}

.progress-redesign-shell .progress-insight-card__trend {
    color: var(--metric-color, var(--gradient-app-start));
    font-size: 1rem;
}

.progress-redesign-shell .progress-insight-card__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.progress-redesign-shell .progress-insight-card__grid div {
    padding: 10px 11px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg-surface-raised) 78%, transparent);
    border: 1px solid color-mix(in srgb, var(--border-medium) 86%, transparent);
}

.progress-redesign-shell .progress-insight-card__grid span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-redesign-shell .progress-insight-card__grid strong {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.2;
}

@media (max-width: 1280px) {
    .progress-redesign-shell .pr-main {
        grid-template-columns: 290px minmax(0, 1fr);
    }

    .progress-redesign-shell .pr-kpi-row,
    .progress-redesign-shell .progress-insight-cards,
    .progress-redesign-shell .progress-chart-surface.is-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1080px) {
    .progress-redesign-shell {
        padding: 14px;
    }

    .progress-redesign-shell .progress-redesign-modal {
        max-height: 96vh;
    }

    .progress-redesign-shell .pr-main {
        grid-template-columns: minmax(0, 1fr);
    }

    .progress-redesign-shell .pr-side {
        display: grid;
        grid-template-columns: 140px 1fr;
        grid-template-rows: auto auto;
        align-items: start;
        gap: 0 12px;
        max-height: 180px;
        padding: 10px 16px;
        overflow: hidden;
        border-right: 0;
        border-bottom: 1px solid var(--border-medium);
    }

    .progress-redesign-shell .pr-search {
        grid-column: 1;
        grid-row: 1;
        margin-bottom: 6px;
    }

    .progress-redesign-shell .pr-search input {
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    .progress-redesign-shell .pr-summary {
        grid-column: 1;
        grid-row: 2;
        margin-bottom: 0;
        align-self: start;
        padding: 5px 8px;
    }

    .progress-redesign-shell #progress-sidebar-groups {
        grid-column: 2;
        grid-row: 1 / 3;
        display: flex;
        flex-direction: row;
        gap: 4px;
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: none;
        height: 100%;
    }

    .progress-redesign-shell #progress-sidebar-groups .pr-cat {
        flex: 1 1 0;
        min-width: 0;
        margin-bottom: 0;
        overflow: hidden;
    }

    .progress-redesign-shell #progress-sidebar-groups .pr-cat__items {
        display: block !important;
        padding: 0;
        overflow-y: auto;
        max-height: 136px;
        scrollbar-width: none;
    }

    .progress-redesign-shell #progress-sidebar-groups .pr-cat__head {
        padding: 3px 8px;
        pointer-events: none;
        cursor: default;
    }

    .progress-redesign-shell #progress-sidebar-groups .pr-cat__chev {
        display: none;
    }

    .progress-redesign-shell #progress-sidebar-groups .pr-cat__title {
        font-size: 0.66rem;
        letter-spacing: 0.03em;
    }

    .progress-redesign-shell #progress-sidebar-groups .pr-cat__count {
        font-size: 0.62rem;
        padding: 1px 5px;
    }

    .progress-redesign-shell #progress-sidebar-groups .pr-metric {
        padding: 3px 8px;
        gap: 6px;
        border-radius: 6px;
    }

    .progress-redesign-shell #progress-sidebar-groups .pr-metric:hover {
        transform: none;
    }

    .progress-redesign-shell #progress-sidebar-groups .pr-metric__name {
        font-size: 0.74rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .progress-redesign-shell #progress-sidebar-groups .pr-metric__color {
        width: 7px;
        height: 7px;
    }

    .progress-redesign-shell .pr-kpi-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .progress-redesign-shell .pr-compare {
        grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr);
    }
}

@media (max-width: 780px) {
    .progress-redesign-shell {
        padding: 0;
        align-items: flex-start;
    }

    .progress-redesign-shell .progress-redesign-modal {
        width: 100%;
        max-height: 100svh;
        border-radius: 0;
    }

    .progress-redesign-shell .pr-modal__head,
    .progress-redesign-shell .pr-controls,
    .progress-redesign-shell .pr-content,
    .progress-redesign-shell .pr-side,
    .progress-redesign-shell .pr-compare,
    .progress-redesign-shell .pr-tabs {
        padding-left: 16px;
        padding-right: 16px;
    }

    .progress-redesign-shell .pr-tabs {
    
        scrollbar-width: none;
    }

    .progress-redesign-shell .pr-tabs::-webkit-scrollbar {
        display: none;
    }

    .progress-redesign-shell .pr-kpi-row,
    .progress-redesign-shell .progress-insight-cards,
    .progress-redesign-shell .progress-chart-surface.is-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .progress-redesign-shell .pr-compare {
        grid-template-columns: 1fr 1fr;
        align-items: stretch;
    }

    .progress-redesign-shell .pr-compare__main,
    .progress-redesign-shell .progress-compare-hint {
        grid-column: 1 / -1;
    }

    .progress-redesign-shell .pr-compare__arrow {
        display: none;
    }

    .progress-redesign-shell .progress-compare-hint {
        justify-self: start;
        text-align: left;
        max-width: none;
    }

    .progress-redesign-shell .progress-chart-card,
    .progress-redesign-shell .chart-container.progress-chart-card {
        min-height: 320px;
        height: 320px;
    }

    .progress-redesign-shell .progress-chart-card__head {
        flex-direction: column;
        align-items: stretch;
    }

    .progress-redesign-shell .progress-chart-card__legend {
        justify-content: flex-start;
    }
}

@media (max-width: 560px) {
    .progress-redesign-shell .pr-modal__head {
        flex-direction: column;
        align-items: stretch;
    }

    .progress-redesign-shell .pr-modal__head-actions,
    .progress-redesign-shell .pr-controls {
        width: 100%;
    }

    .progress-redesign-shell .pr-controls {
        gap: 10px;
    }

    .progress-redesign-shell .pr-spacer {
        display: none;
    }

    .progress-redesign-shell .pr-segment,
    .progress-redesign-shell .pr-range-pills {
        width: 100%;
        justify-content: space-between;
        overflow-x: auto;
    }

    .progress-redesign-shell .pr-segment button,
    .progress-redesign-shell .pr-range-pills button {
        flex: 1 0 auto;
        white-space: nowrap;
    }

    .progress-redesign-shell .progress-insight-card__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}


   
