:root {
    --wizard-bg: #f4f6fb;
    --card-bg: #ffffff;
    --card-muted: #f8faff;
    --border-color: #d7dde9;
    --border-strong: #b9c3d8;
    --text-primary: #141b2d;
    --text-secondary: #5b6579;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --accent-soft: rgba(37, 99, 235, 0.14);
    --success: #0f766e;
    --warning: #d97706;
    --danger: #dc2626;
    --shadow-soft: 0 22px 45px rgba(30, 41, 59, 0.12);
    --shadow-muted: 0 10px 28px rgba(15, 23, 42, 0.08);
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 8px;
    --transition: all 0.25s ease;
    --font-body: "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(14px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.mio-wizard-container,
.mio-wizard-container * {
    box-sizing: border-box;
}

.mio-wizard-container {
    transform: scale(0.8);
    transform-origin: top center;
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 24px;
    max-width: 1000px;
    margin: 0 auto;
    background-image: linear-gradient(180deg, rgba(244, 246, 251, 0.85) 0%, rgba(255, 255, 255, 0.95) 60%, #ffffff 100%);
    position: relative;
    overflow: hidden;
    width: 100%;
}

.mio-wizard-container::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 55%),
                radial-gradient(circle at 85% 20%, rgba(14, 165, 233, 0.08), transparent 45%);
}

.mio-wizard-container > * {
    position: relative;
    z-index: 1;
}

.wizard-header h2 {
    margin: 0 0 6px;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.wizard-header .wizard-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1.00rem;
    line-height: 1.5;
    max-width: 720px;
}

.wizard-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 28px;
    position: relative;
}

/* Connectors between steps */
.wizard-progress .step-indicator {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 10px;
    background: var(--card-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    position: relative;
    transition: var(--transition);
    backdrop-filter: blur(6px);
    min-width: 0;
    max-width: 100%;
    text-align: center;
}

/* Rimuovi le linee di collegamento */
.wizard-progress .step-indicator::after {
    display: none;
}

.wizard-progress .step-number {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    transition: var(--transition);
}

.wizard-progress .step-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.25;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wizard-progress .step-indicator.active {
    border-color: var(--accent);
    background: rgba(37, 99, 235, 0.12);
    box-shadow: 0 16px 34px rgba(37, 99, 235, 0.18);
}

.wizard-progress .step-indicator.active .step-number {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    transform: scale(1.08);
}

.wizard-progress .step-indicator.active .step-title {
    color: var(--text-primary);
}

.wizard-progress .step-indicator.completed {
    border-color: var(--accent);
    background: var(--accent);
}

.wizard-progress .step-indicator.completed .step-number {
    background: #ffffff;
    border-color: #ffffff;
    color: var(--accent);
}

.wizard-progress .step-indicator.completed .step-title {
    color: #ffffff;
}

.wizard-content {
    margin-top: 14px;
}

.wizard-step {
    display: none;
    background: rgba(255, 255, 255, 0.92);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    border: 1px solid rgba(215, 221, 233, 0.65);
    box-shadow: var(--shadow-muted);
}

.wizard-step.active {
    display: block;
    animation: fadeInUp 0.35s ease;
}

.step-header h3 {
    margin: 0 0 4px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.step-header .step-description {
    margin: 0 0 20px;
    color: var(--text-secondary);
    font-size: 1.00rem;
    line-height: 1.5;
}

.medical-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.time-periods-header,
.medical-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.8fr) repeat(3, minmax(120px, 1fr));
    gap: 16px;
    align-items: stretch;
    overflow-x: auto;
}

.time-periods-header {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(99, 102, 241, 0.04));
    color: var(--text-secondary);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.time-periods-header .device-col {
    color: var(--text-primary);
}

.medical-row {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--card-bg);
    border: 1px solid transparent;
    transition: var(--transition);
    position: relative;
}

.medical-row::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(120deg, rgba(37, 99, 235, 0.06), rgba(37, 99, 235, 0.0));
    opacity: 0;
    transition: var(--transition);
    pointer-events: none;
}

.medical-row:hover::before {
    opacity: 1;
}

.medical-row.selected {
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 18px 32px rgba(37, 99, 235, 0.16);
}

.medical-row.selected::before {
    opacity: 1;
    background: linear-gradient(120deg, rgba(37, 99, 235, 0.14), rgba(37, 99, 235, 0.08));
}

.device-name .device-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.00rem;
    line-height: 1.4;
}

.time-periods {
    grid-column: 2 / span 3;
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 16px;
    align-items: center;
}

.period-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

.period-checkbox input[type="radio"] {
    width: 26px;
    height: 26px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent);
}

.period-checkbox input[type="radio"]:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.35);
    outline-offset: 4px;
    border-radius: 50%;
}

.step-info {
    margin-top: 24px;
}

.info-box {
    border-radius: var(--radius-md);
    padding: 20px;
    background: rgba(15, 118, 110, 0.08);
    border: 1px solid rgba(15, 118, 110, 0.28);
    color: #0f5132;
    line-height: 1.6;
}

.info-box ul {
    margin: 12px 0 0 18px;
    padding: 0;
}

.info-box li {
    margin-bottom: 6px;
}

.medical-section {
    margin-bottom: 26px;
}

.medical-section:last-of-type {
    margin-bottom: 0;
}

.section-title {
    margin: 0 0 12px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.ausili-container {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.note-box {
    padding: 18px 20px;
    border-radius: var(--radius-md);
    font-size: 1.00rem;
    line-height: 1.6;
}

.note-box.info {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.35);
    color: #1e3a8a;
}

.ausili-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 18px;
}

.ausili-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 18px;
    padding: 20px 22px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(215, 221, 233, 0.8);
    background: rgba(255, 255, 255, 0.9);
    transition: var(--transition);
    position: relative;
}

.ausili-item::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid transparent;
    transition: var(--transition);
    pointer-events: none;
}

.ausili-item:hover {
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.12);
}

.ausili-item.selected {
    border-color: rgba(37, 99, 235, 0.55);
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.18), rgba(37, 99, 235, 0.08));
    box-shadow: 0 22px 36px rgba(15, 23, 42, 0.18);
}

.ausili-item.selected::after {
    border-color: rgba(255, 255, 255, 0.55);
}

.ausili-checkbox {
    position: relative;
    width: 44px;
    height: 44px;
}

.ausili-checkbox input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.checkbox-custom {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(37, 99, 235, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    transition: var(--transition);
    cursor: pointer;
    font-size: 1.1rem;
    color: transparent;
}

.ausili-checkbox input:checked + .checkbox-custom {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    border-color: transparent;
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.24);
}

.ausili-checkbox input:focus-visible + .checkbox-custom {
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.28);
}

.ausili-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ausili-title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
}

.ausili-description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.55;
}

.section-summary {
    margin-bottom: 14px;
}

.section-summary h5 {
    margin: 0 0 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-summary ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.power-data-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 22px;
    margin-bottom: 28px;
}

.form-section {
    background: rgba(248, 250, 255, 0.95);
    border-radius: var(--radius-md);
    border: 1px solid rgba(215, 221, 233, 0.8);
    padding: 22px 24px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.form-section h4 {
    margin: 0 0 14px;
    font-size: 1rem;
    font-weight: 700;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
}

.input-wrapper .input-unit {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-weight: 600;
}

input[type="number"],
input[type="date"],
input[type="text"],
select {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: #ffffff;
    padding: 12px 14px;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: var(--transition);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Stile specifico per il campo data */
input[type="date"] {
    min-height: 44px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 45px;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    cursor: pointer;
}

input[type="number"]:focus,
input[type="date"]:focus,
input[type="text"]:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.24);
    outline: none;
}

input.error {
    border-color: rgba(220, 38, 38, 0.75);
    background: rgba(220, 38, 38, 0.06);
}

.error-message {
    font-size: 0.75rem;
    color: #b91c1c;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.power-examples {
    margin-top: 18px;
}

.power-examples h5 {
    margin: 0 0 12px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
    gap: 12px;
}

.example-item {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.16);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.example-item strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.88rem;
}

.example-item small {
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.example-item:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(37, 99, 235, 0.12));
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: 0 12px 22px rgba(37, 99, 235, 0.18);
}

.calculation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 10px 22px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.01em;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.26);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #ffffff;
    box-shadow: 0 18px 36px rgba(37, 99, 235, 0.26);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-strong), #1e3a8a);
}

.btn-secondary {
    background: #ffffff;
    color: #333;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.btn[disabled],
.btn:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.btn-reset {
    background: #d7dde9;
    color: #000000;
}

.btn-reset:hover {
    background: #d7dde9;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
    gap: 14px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: rgba(37, 99, 235, 0.1);
    color: var(--text-primary);
    font-weight: 600;
}

.summary-item .label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.summary-item .value {
    font-size: 1rem;
}

.wizard-navigation {
    margin-top: 32px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.wizard-navigation .btn {
    min-width: 160px;
}

/* Navigazione Step 4 */
.wizard-navigation-step4 {
    display: none;
    margin-top: 32px;
    justify-content: space-between;
    gap: 14px;
}

.wizard-navigation-step4 .btn {
    min-width: 200px;
}

/* Step 5: nascondi completamente i pulsanti di navigazione */
.wizard-step[data-step="5"].active ~ .wizard-navigation,
.wizard-step[data-step="5"].active ~ .wizard-navigation-step4 {
    display: none;
}

.results-section {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.main-result {
    border-radius: var(--radius-lg);
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: linear-gradient(145deg, rgba(37, 99, 235, 0.12), rgba(14, 165, 233, 0.08));
    padding: 26px 28px;
}

.result-placeholder {
    text-align: center;
    color: var(--text-secondary);
    display: grid;
    gap: 10px;
    justify-items: center;
}

.placeholder-icon {
    font-size: 2rem;
}

.result-card {
    border-radius: var(--radius-lg);
    padding: 24px 26px;
    background: #ffffff;
    box-shadow: var(--shadow-muted);
    border: 1px solid rgba(215, 221, 233, 0.7);
}

.result-card.success {
    border-color: rgba(15, 118, 110, 0.32);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.result-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.result-amount {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 18px;
}

.amount-main {
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--accent-strong);
}

.amount-period {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.selections-recap {
    border-radius: var(--radius-md);
    border: 1px solid rgba(215, 221, 233, 0.8);
    background: rgba(255, 255, 255, 0.94);
    padding: 22px 24px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.selections-recap h4 {
    margin: 0 0 14px;
    font-size: 1.1rem;
    font-weight: 700;
}

.recap-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 18px;
}

.recap-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recap-section h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.recap-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--text-secondary);
}

.results-actions {
    border-top: 1px solid rgba(215, 221, 233, 0.7);
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
    gap: 14px;
}

.additional-info {
    margin-top: 28px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(215, 221, 233, 0.8);
    background: rgba(248, 250, 255, 0.92);
    padding: 24px 26px;
}

.info-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 20px;
}

.info-section h5 {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 700;
}

.info-section ul {
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
    display: grid;
    gap: 8px;
    font-size: 0.92rem;
}

.table-reference-button {
    display: flex;
    justify-content: flex-start;
}

.table-reference-button .btn {
    min-width: 200px;
}

@media (max-width: 980px) {
    .wizard-progress {
        gap: 8px;
    }
    
    .wizard-progress .step-title {
        font-size: 0.62rem;
    }

    .wizard-progress .step-indicator::after {
        display: none;
    }

    .time-periods-header,
    .medical-row {
        grid-template-columns: 1fr;
    }

    .time-periods {
        grid-column: 1 / -1;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .wizard-step {
        padding: 20px 18px;
    }

    .wizard-navigation {
        flex-direction: column;
    }

    .wizard-navigation .btn {
        width: 100%;
    }
    
    .apparecchiature-table th,
    .apparecchiature-table td {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .params-grid {
        grid-template-columns: 1fr;
    }
    
    .msg-trimestre {
        padding: 11px 15px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .mio-wizard-container {
        padding: 20px 16px;
        border-radius: var(--radius-md);
    }
    
    .wizard-header h2 {
        font-size: 1.15rem;
    }
    
    .wizard-header .wizard-subtitle {
        font-size: 1.00rem;
    }
    
    .wizard-progress .step-indicator {
        padding: 10px 8px;
        gap: 4px;
    }
    
    .wizard-progress .step-number {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
    
    .wizard-progress .step-title {
        font-size: 0.6rem;
    }
    
    .step-header h3 {
        font-size: 1rem;
    }
    
    .step-header .step-description {
        font-size: 1.00rem;
    }
    
    .device-name .device-label {
        font-size: 1.00rem;
    }
    
    .time-periods {
        grid-template-columns: 1fr;
    }
    
    .period-checkbox {
        min-height: 40px;
    }
    
    .ausili-item {
        grid-template-columns: auto 1fr;
        padding: 16px 18px;
        gap: 14px;
    }
    
    .ausili-checkbox {
        width: 40px;
        height: 40px;
    }
    
    .ausili-title {
        font-size: 0.85rem;
    }
    
    .ausili-description {
        font-size: 0.75rem;
    }
    
    .btn {
        padding: 11px 20px;
        font-size: 0.82rem;
    }
    
    .form-section {
        padding: 18px 20px;
    }
    
    .apparecchiature-table {
        font-size: 13px;
    }
    
    .apparecchiature-table th,
    .apparecchiature-table td {
        padding: 10px 12px;
    }
    
    .table-popup .popup-content {
        max-width: 95%;
        padding: 15px;
    }
}

@media (max-width: 640px) {
    .mio-wizard-container {
        padding: 18px 14px;
    }

    .wizard-header h2 {
        font-size: 1.05rem;
    }

    .wizard-progress {
        gap: 6px;
        margin: 18px 0 24px;
    }
    
    .wizard-progress .step-indicator {
        padding: 8px 6px;
    }
    
    .wizard-progress .step-number {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }
    
    .wizard-progress .step-title {
        font-size: 0.58rem;
    }

    .step-header h3 {
        font-size: 0.95rem;
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.8rem;
    }

    .actions-grid {
        grid-template-columns: 1fr;
    }
    
    .medical-row {
        padding: 10px 12px;
        gap: 12px;
    }
    
    .time-periods-header {
        padding: 10px 12px;
        font-size: 0.65rem;
    }
    
    .ausili-item {
        padding: 14px 16px;
    }
    
    .note-box {
        padding: 14px 16px;
        font-size: 0.78rem;
    }
    
    .info-box {
        padding: 16px;
        font-size: 0.8rem;
    }
    
    .form-section h4 {
        font-size: 0.92rem;
    }
    
    input[type="number"],
    input[type="date"],
    input[type="text"],
    select {
        padding: 10px 12px;
        font-size: 0.82rem;
    }
    
    .apparecchiature-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: -14px;
        margin-right: -14px;
        padding: 0 14px;
        margin-bottom: 35px; /* Spazio per l'indicatore scroll */
    }
    
    .apparecchiature-table {
        min-width: 600px;
        font-size: 13px;
    }
    
    .apparecchiature-table th,
    .apparecchiature-table td {
        padding: 10px 12px;
        font-size: 12px;
        white-space: nowrap;
    }
    
    .calculation-params {
        overflow-x: auto;
        margin-left: -14px;
        margin-right: -14px;
        padding: 0 14px;
        margin-bottom: 35px; /* Spazio per l'indicatore scroll */
    }
    
    .calculation-params .apparecchiature-table {
        min-width: 500px;
    }
    
    .msg-trimestre {
        margin-top: 12px;
        padding: 10px 14px;
        font-size: 12px;
    }
    
    .tabella-codici {
        font-size: 12px;
    }
    
    .tabella-codici th,
    .tabella-codici td {
        padding: 8px 12px;
    }
    
    .calculation-actions {
        flex-direction: column;
    }
    
    .calculation-actions .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .mio-wizard-container {
        padding: 16px 12px;
        box-shadow: var(--shadow-muted);
    }
    
    .wizard-header h2 {
        font-size: 0.95rem;
        margin-bottom: 4px;
    }
    
    .wizard-header .wizard-subtitle {
        font-size: 0.68rem;
    }
    
    .wizard-progress {
        gap: 5px;
        margin: 16px 0 20px;
    }
    
    .wizard-progress .step-indicator {
        padding: 6px 4px;
        gap: 3px;
    }
    
    .wizard-progress .step-number {
        width: 24px;
        height: 24px;
        font-size: 0.65rem;
    }
    
    .wizard-progress .step-title {
        font-size: 0.55rem;
    }
    
    .wizard-step {
        padding: 16px 12px;
    }
    
    .step-header h3 {
        font-size: 0.88rem;
    }
    
    .step-header .step-description {
        font-size: 0.7rem;
    }
    
    .medical-grid {
        gap: 8px;
    }
    
    .medical-row {
        padding: 8px 10px;
    }
    
    .device-name .device-label {
        font-size: 1.00rem;
    }
    
    .period-checkbox input[type="radio"] {
        width: 22px;
        height: 22px;
    }
    
    .ausili-grid {
        gap: 12px;
    }
    
    .ausili-item {
        padding: 12px 14px;
        gap: 12px;
    }
    
    .ausili-checkbox {
        width: 36px;
        height: 36px;
    }
    
    .ausili-title {
        font-size: 0.8rem;
    }
    
    .ausili-description {
        font-size: 0.72rem;
    }
    
    .btn {
        padding: 9px 16px;
        font-size: 0.78rem;
    }
    
    .form-section {
        padding: 16px 18px;
    }
    
    .form-section h4 {
        font-size: 0.88rem;
        margin-bottom: 12px;
    }
    
    .power-data-section {
        gap: 16px;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .example-item {
        padding: 12px 14px;
    }
    
    .note-box,
    .info-box {
        padding: 12px 14px;
        font-size: 0.75rem;
    }
    
    .table-popup .close-popup {
        font-size: 28px;
        top: 5px;
        right: 10px;
    }
    
    /* Tabelle ancora più compatte su schermi molto piccoli */
    .apparecchiature-table-container,
    .calculation-params {
        margin-left: -12px;
        margin-right: -12px;
        padding: 0 12px;
        margin-bottom: 40px;
    }
    
    .apparecchiature-table {
        min-width: 500px;
    }
    
    .apparecchiature-table th,
    .apparecchiature-table td {
        padding: 8px 10px;
        font-size: 11px;
    }
    
    .calculation-params .apparecchiature-table {
        min-width: 450px;
    }
    
    .calculation-params h4 {
        font-size: 0.85rem;
        margin-bottom: 12px;
    }
    
    .msg-trimestre {
        margin-top: 12px;
        padding: 10px 14px;
        font-size: 11px;
        line-height: 1.5;
    }
    
    .result-amount {
        flex-direction: column;
        gap: 4px;
    }
    
    .amount-main {
        font-size: 1.6rem;
    }
    
    .amount-period {
        font-size: 0.85rem;
    }
}

/* Tabella apparecchiature Step 5 */
.apparecchiature-table-container {
    margin-top: 30px;
    margin-bottom: 30px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.apparecchiature-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
    min-width: 500px; /* Previene che diventi troppo stretta */
}

.apparecchiature-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid var(--border-color);
}

.apparecchiature-table th {
    padding: 18px 24px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.apparecchiature-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: all 0.15s ease;
}

.apparecchiature-table tbody tr:hover {
    background-color: #f8f9fb;
    transform: scale(1.002);
}

.apparecchiature-table tbody tr:last-child {
    border-bottom: none;
}

.apparecchiature-table td {
    padding: 16px 24px;
    color: var(--text-primary);
    font-size: 14px;
    vertical-align: middle;
}

.apparecchiature-table td:first-child {
    font-weight: 700;
    color: var(--accent);
    font-size: 15px;
}

.apparecchiature-table td:nth-child(2) {
    color: var(--text-secondary);
}

.apparecchiature-table td:last-child {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

/* Parametri di calcolo */
.calculation-params {
    margin-top: 30px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Assicura che la tabella dentro calculation-params sia scrollabile */
.calculation-params .apparecchiature-table {
    min-width: 500px;
}

/* Messaggio trimestre */
.msg-trimestre {
    margin-top: 15px;
    padding: 12px 16px;
    background: #f0f9ff;
    border-left: 4px solid #2563eb;
    color: #000000;
    font-size: 13px;
    border-radius: var(--radius-sm);
    line-height: 1.6;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: 15px;
    padding: 20px;
    background: var(--card-muted);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.param-item {
    padding: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.param-item strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

/* Popup Tabella */
.table-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.table-popup .popup-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: auto;
}

.table-popup .close-popup {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 36px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    z-index: 10000;
    transition: color 0.2s ease;
}

.table-popup .close-popup:hover {
    color: var(--danger);
}

.table-popup img {
    display: block;
    margin: 0 auto;
}

/* Tabella Codici nel Popup */
.tabella-codici {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #333;
    background: white;
    font-size: 14px;
}

.tabella-codici thead {
    background: #e5e5e5;
}

.tabella-codici th {
    padding: 14px 20px;
    text-align: left;
    font-weight: 600;
    color: #000;
    border: 1px solid #333;
    vertical-align: middle;
}

.tabella-codici td {
    padding: 12px 20px;
    border: 1px solid #333;
    vertical-align: middle;
}

.tabella-codici .fascia-header td {
    padding: 0;
    border: none;
    height: 2px;
}

.tabella-codici .fascia-label {
    background: #f0f0f0;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
}

.tabella-codici .fascia-label strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
}

.tabella-codici tbody tr:hover {
    background-color: #f8f9fa;
}

/* ===== MOBILE OPTIMIZATIONS ===== */

/* Migliora l'area touch per elementi interattivi */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        padding: 12px 24px;
    }
    
    .period-checkbox input[type="radio"] {
        min-width: 44px;
        min-height: 44px;
    }
    
    .ausili-checkbox {
        min-width: 44px;
        min-height: 44px;
    }
    
    .wizard-progress .step-indicator {
        min-height: 48px;
    }
}

/* Smooth scrolling per tutto il documento */
html {
    scroll-behavior: smooth;
}

/* Ottimizza le performance di scrolling su mobile */
.medical-grid,
.ausili-container,
.apparecchiature-table-container {
    -webkit-overflow-scrolling: touch;
}

/* Previeni lo zoom su input su iOS */
@media screen and (max-width: 768px) {
    input[type="number"],
    input[type="date"],
    input[type="text"],
    select {
        font-size: 16px; /* Previene lo zoom automatico su iOS */
    }
}

/* Migliora la leggibilità su schermi piccoli */
@media (max-width: 480px) {
    body {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
}

/* Aggiunge spazio per le dita su mobile */
@media (max-width: 640px) {
    .medical-row,
    .ausili-item,
    .example-item {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.1);
    }
}

/* Tabella scrollabile orizzontalmente su mobile */
@media (max-width: 768px) {
    .apparecchiature-table-container,
    .calculation-params {
        position: relative;
    }
    
    .apparecchiature-table-container::before,
    .calculation-params::before {
        content: '← Scorri →';
        position: absolute;
        left: 50%;
        bottom: -25px;
        transform: translateX(-50%);
        background: rgba(37, 99, 235, 0.85);
        color: white;
        padding: 4px 12px;
        border-radius: 12px;
        font-size: 10px;
        font-weight: 600;
        pointer-events: none;
        z-index: 10;
        animation: fadeInOut 4s ease-in-out;
        white-space: nowrap;
    }
    
    @keyframes fadeInOut {
        0%, 100% { opacity: 0; }
        15%, 85% { opacity: 1; }
    }
}

/* Ottimizza il popup per mobile */
@media (max-width: 640px) {
    .table-popup .popup-content {
        border-radius: var(--radius-md);
        max-height: 95vh;
    }
    
    .table-popup img {
        max-width: 100%;
        height: auto;
    }
}

/* Gestione migliore dei risultati su mobile */
@media (max-width: 640px) {
    .result-amount {
        flex-direction: column;
        gap: 4px;
        align-items: flex-start;
    }
    
    .amount-main {
        font-size: 1.8rem;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .results-actions {
        flex-direction: column;
        align-items: stretch;
    }
}



