/* ==========================================
   CONFIGURATORE - Stili dedicati
   ========================================== */

/* --- Layout principale --- */
.cfg-container {
    padding: 0 25px 25px;
    margin: 0 auto;
    max-width: 1440px;
    background: #fff;
    box-sizing: border-box;
}

.cfg-app-container {
    padding-bottom: 80px;
    background: #f8f9fb;
    min-height: 100vh;
    max-width: 640px;
}
.cfg-app-container.cfg-app-home {
    background: #1e2e34;
}

/* --- App Header (barra superiore leggera) --- */
.cfg-app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    background: #1e2e34;
    z-index: 100;
    margin-left: -16px;
    margin-right: -16px;
}

.cfg-app-header .cfg-logo {
    height: 32px;
    width: auto;
}

.cfg-app-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* --- Bottone Debug Admin --- */
.cfg-app-debug-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s ease;
}

.cfg-app-debug-btn:hover,
.cfg-app-debug-btn.active {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.cfg-app-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s ease;
}

.cfg-app-logout:hover {
    background: rgba(255,81,0,0.2);
    color: #ff5100;
}

/* --- Bottom Navigation Bar --- */
.cfg-bottombar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 640px;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    padding: 6px 0;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    z-index: 1000;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.cfg-bottombar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    padding: 6px 4px;
    text-decoration: none;
    color: #999;
    font-size: 10px;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.cfg-bottombar-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
    transition: all 0.2s ease;
}

.cfg-bottombar-item span {
    line-height: 1;
}

.cfg-bottombar-item:hover {
    color: var(--color1);
}

.cfg-bottombar-item.active {
    color: var(--color1);
}

.cfg-bottombar-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--color1);
    border-radius: 0 0 3px 3px;
}

.cfg-bottombar-item.active svg {
    stroke-width: 2.2;
}

/* --- Bottone centrale "Configura" --- */
.cfg-bottombar-item.cfg-bottombar-center {
    position: relative;
    top: -16px;
    flex: 0 0 auto;
    background: var(--color1);
    color: #fff;
    border-radius: 14px;
    padding: 12px 18px;
    gap: 4px;
    box-shadow: 0 4px 14px rgba(255, 81, 0, 0.3);
    transition: all 0.2s ease;
}

.cfg-bottombar-item.cfg-bottombar-center svg {
    stroke: #fff;
}

.cfg-bottombar-item.cfg-bottombar-center span {
    color: #fff;
    font-size: 11px;
    font-weight: 600;
}

.cfg-bottombar-item.cfg-bottombar-center:hover {
    color: #fff;
    background: #e04800;
    transform: translateY(-2px);
}

.cfg-bottombar-item.cfg-bottombar-center.active {
    color: #fff;
}

.cfg-bottombar-item.cfg-bottombar-center.active::before {
    display: none;
}


/* --- Debug content nascosto nella pagina (visibile solo nel popup) --- */
#cfg-debug-content {
    display: none;
}

/* --- Popup Debug Admin --- */
.cfg-debug-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: flex-end;
    justify-content: center;
}

.cfg-debug-overlay.active {
    display: flex;
}

.cfg-debug-popup {
    background: #fff;
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    animation: cfg-slide-up 0.3s ease;
}

@keyframes cfg-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.cfg-debug-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.cfg-debug-popup-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--color2);
}

.cfg-debug-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.15s;
}

.cfg-debug-popup-close:hover {
    background: var(--color4);
    color: var(--color2);
}

.cfg-debug-popup-body {
    padding: 16px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.cfg-debug-popup-body h1 {
    font-size: 16px;
    margin: 0 0 12px;
}

.cfg-debug-popup-body h3 {
    font-size: 13px;
    font-weight: 600;
    color: #50649c;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #fff;
}

.cfg-debug-popup-body #table_debug {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.cfg-debug-popup-body #table_debug th {
    padding: 8px 10px;
    text-align: left;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: #50649c;
    background: var(--color4);
    border-bottom: 2px solid #fff;
}

.cfg-debug-popup-body #table_debug td {
    padding: 6px 10px;
    border-bottom: 1px solid #f3f3f3;
    color: var(--color2);
}

.cfg-debug-popup-body #table_debug tr:hover {
    background: #f9f9f9;
}

/* --- Legacy topbar (nascosta, mantenuta per compatibilita) --- */
.cfg-topbar { display: none; }
.cfg-hamburger { display: none; }
.cfg-nav-overlay { display: none; }

.cfg-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color4);
}

.cfg-header h1 {
    font-size: 22px;
    margin-bottom: 8px;
}

.cfg-header-nav {
    display: flex;
    gap: 15px;
    align-items: center;
    font-size: 13px;
}

.cfg-header-nav a {
    color: var(--color2);
    text-decoration: none;
    padding: 4px 0;
}

.cfg-header-nav a:hover {
    color: var(--color1);
}

.cfg-app-profile-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: opacity 0.2s;
}
.cfg-app-profile-link:hover {
    opacity: 0.85;
}
.cfg-saluto {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}
.cfg-app-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ff5100;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

/* --- Badge cliente selezionato --- */
.cfg-badge-cliente {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    padding: 0;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
    overflow: hidden;
}

.cfg-badge-cliente-item {
    padding: 8px 16px;
    border-right: 1px solid #a5d6a7;
}

.cfg-badge-cliente-item:last-child {
    border-right: none;
}

.cfg-badge-cliente a {
    color: #c62828;
    font-size: 11px;
}

/* --- Welcome / Intro --- */
.cfg-welcome {
    text-align: left;
    padding: 10px 0 0;
}

.cfg-welcome h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--color2);
    margin: 0 0 4px;
}

.cfg-welcome p {
    font-size: 13px;
    color: #999;
    margin: 0;
    line-height: 1.5;
}

/* --- Dashboard / Homepage --- */
.cfg-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

.cfg-dashboard-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 22px 16px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 14px;
    text-decoration: none;
    color: var(--color2);
    transition: all 0.25s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.cfg-dashboard-item:hover {
    border: 3px solid var(--color1);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.cfg-dashboard-item:hover .cfg-dashboard-icon {
    background: var(--color1);
    color: #fff;
}

.cfg-dashboard-icon {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    background: #fff3eb;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color1);
    transition: all 0.25s ease;
}

.cfg-dashboard-icon svg {
    width: 24px;
    height: 24px;
}

.cfg-dashboard-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cfg-dashboard-text strong {
    font-size: 14px;
    font-weight: 600;
}

.cfg-dashboard-text span {
    font-size: 11px;
    color: #999;
    line-height: 1.4;
}

/* --- Selezione tipologia / prodotto --- */
.cfg-grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.cfg-card {
    display: block;
    text-align: center;
    padding: 20px 15px;
    background: var(--color4);
    border-radius: 8px;
    text-decoration: none;
    color: var(--color2);
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.cfg-card:hover {
    border-color: var(--color1);
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.cfg-card img {
    width: 100%;
    max-width: 150px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.cfg-card strong {
    display: block;
    font-size: 14px;
}

/* --- Step del configuratore --- */
.cfg-step-header {
    display: inline-block;
    width: 100%;
    padding: 12px 16px;
    background: var(--color4);
    border-radius: 6px;
    margin-bottom: 5px;
    font-size: 15px;
    font-weight: 500;
    color: var(--color2);
    box-sizing: border-box;
}

.cfg-step-header.active {
    background: #e8f5e9;
    color: #2e7d32;
    cursor: pointer;
}

.cfg-step-header a {
    text-decoration: none;
    color: inherit;
}

.cfg-step-content {
    padding: 20px 0;
}
.cfg-step-content form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 20px;
}
.cfg-step-content form > input[type="hidden"] {
    display: none;
}
@media (min-width: 768px) {
    .cfg-step-content form {
        grid-template-columns: 1fr 1fr;
    }
    .cfg-step-content form > .cfg-btn-group,
    .cfg-step-content form > .cfg-step-full,
    .cfg-step-content form > br,
    .cfg-step-content form > input[type="submit"],
    .cfg-step-content form > button {
        grid-column: 1 / -1;
    }
}

/* --- Form dentro step --- */
.cfg-form-group {
    margin-bottom: 18px;
}

.cfg-form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--color2);
}

.cfg-form-group input[type="number"],
.cfg-form-group input[type="text"],
.cfg-form-group select,
.cfg-form-group textarea {
    width: 100%;
    max-width: 400px;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.cfg-form-group input:focus,
.cfg-form-group select:focus,
.cfg-form-group textarea:focus {
    border-color: var(--color1);
    outline: none;
}

/* --- Tabella riepilogo (preventivi, clienti, offerte) --- */
.cfg-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 10px;
}

.cfg-table thead tr {
    background: var(--color4);
}

.cfg-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 500;
    color: #50649c;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid #fff;
}

.cfg-table th.text-right,
.cfg-table td.text-right {
    text-align: right;
}

.cfg-table th.text-center,
.cfg-table td.text-center {
    text-align: center;
}

.cfg-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    color: var(--color2);
}

.cfg-table tbody tr:hover {
    background: #f9f9f9;
}

.cfg-table .cfg-link {
    color: var(--color1);
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
}

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

.cfg-table .cfg-link-danger {
    color: #c62828;
}

.cfg-table .cfg-empty {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

/* --- Bottoni --- */
.cfg-btn {
    display: inline-block;
    padding: 10px 24px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: inherit;
    text-align: center;
    box-sizing: border-box;
    line-height: 1.4;
}

.cfg-btn-primary {
    background: var(--color1);
    color: #fff !important;
}

.cfg-btn-primary:hover {
    background: #e04800;
    color: #fff !important;
}

.cfg-btn-success {
    background: #2e7d32;
    color: #fff !important;
}

.cfg-btn-success:hover {
    background: #1b5e20;
    color: #fff !important;
}

.cfg-btn-dark {
    background: var(--color2);
    color: #fff !important;
}

.cfg-btn-dark:hover {
    background: #111;
    color: #fff !important;
}

.cfg-btn:disabled,
.cfg-btn-disabled {
    background: #ccc !important;
    color: #fff !important;
    cursor: not-allowed;
}

.cfg-btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.cfg-radio-group {
    display: flex;
    gap: 0;
    margin-top: 4px;
}
.cfg-radio-group label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    background: #f8f9fb;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--color2);
    transition: all 0.2s;
    margin: 0;
}
.cfg-radio-group label:first-child {
    border-radius: 6px 0 0 6px;
}
.cfg-radio-group label:last-child {
    border-radius: 0 6px 6px 0;
    border-left: none;
}
.cfg-radio-group label:hover {
    background: #eef2f7;
}
.cfg-radio-group input[type="radio"] {
    width: auto;
    margin: 0;
}
.cfg-radio-group label:has(input:checked) {
    background: #e8f5e9;
    border-color: #2e7d32;
    color: #2e7d32;
}

.cfg-btn-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* --- Pannello ricerca (clienti, preventivi) --- */
.cfg-search-box {
    padding: 0;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid #eee;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    overflow: hidden;
}

.cfg-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #ff5100 !important;
    background: #fff !important;
    border: none !important;
    cursor: pointer;
    transition: background 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

.cfg-filter-toggle:hover {
    background: #fff8f5 !important;
}

.cfg-filter-toggle::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff5100' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='4' y1='21' x2='4' y2='14'/%3E%3Cline x1='4' y1='10' x2='4' y2='3'/%3E%3Cline x1='12' y1='21' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12' y2='3'/%3E%3Cline x1='20' y1='21' x2='20' y2='16'/%3E%3Cline x1='20' y1='12' x2='20' y2='3'/%3E%3Cline x1='1' y1='14' x2='7' y2='14'/%3E%3Cline x1='9' y1='8' x2='15' y2='8'/%3E%3Cline x1='17' y1='16' x2='23' y2='16'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

.cfg-filter-toggle::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-right: 2px solid #999;
    border-bottom: 2px solid #999;
    transform: rotate(45deg);
    transition: transform 0.2s;
    margin-left: auto;
}

.cfg-filters-open .cfg-filter-toggle::after {
    transform: rotate(-135deg);
}

.cfg-filters-open .cfg-filter-toggle {
    border-bottom: 1px solid #eee;
    color: var(--color1);
}

.cfg-search-box form {
    display: none;
    padding: 14px 16px;
}

.cfg-search-box.cfg-filters-open form {
    display: block;
}

.cfg-search-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cfg-search-box input[type="text"] {
    padding: 10px 14px;
    width: 100%;
    max-width: 100%;
    font-size: 14px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: #f8f9fb;
    box-sizing: border-box;
    transition: border-color 0.2s, background 0.2s;
}

.cfg-search-box input[type="text"]:focus {
    border-color: var(--color1);
    background: #fff;
    outline: none;
}

.cfg-search-box select,
.cfg-search-box input[type="date"] {
    padding: 10px 12px;
    width: 100%;
    font-size: 13px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: #f8f9fb;
    box-sizing: border-box;
    transition: border-color 0.2s, background 0.2s;
}

.cfg-search-box select:focus,
.cfg-search-box input[type="date"]:focus {
    border-color: var(--color1);
    background: #fff;
    outline: none;
}

.cfg-search-box .cfg-form-group {
    margin-bottom: 0;
}

.cfg-search-box .cfg-form-group label {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
}

.cfg-search-box .cfg-btn {
    width: 100%;
    border-radius: 8px;
}

/* --- Griglia filtri --- */
.cfg-filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.cfg-filter-grid > .cfg-form-group:last-child {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
}

.cfg-filter-grid > .cfg-form-group:last-child .cfg-btn {
    flex: 1;
}

/* --- Conteggio risultati --- */
.cfg-results-count {
    font-size: 13px;
    color: #888;
    margin: 10px 0 5px;
}

/* --- Paginazione --- */
.cfg-pagination {
    display: flex;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
    align-items: center;
}

/* --- Selezione cliente (step 0) --- */
.cfg-cliente-search {
    padding: 25px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: var(--color4);
    margin: 20px 0;
}

.cfg-autocomplete-results {
    border: 1px solid #ddd;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    background: #fff;
    width: 420px;
    max-width: 100%;
    position: absolute;
    z-index: 100;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.cfg-autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    transition: background 0.15s;
}

.cfg-autocomplete-item:hover {
    background: var(--color4);
}

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

.cfg-autocomplete-empty {
    padding: 12px 14px;
    color: #999;
    font-size: 13px;
}

/* --- Nuovo cliente rapido --- */
.cfg-form-inline-box {
    margin-top: 15px;
    padding: 25px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
}

.cfg-form-inline-box h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: var(--color2);
}

.cfg-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cfg-form-grid label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
    display: block;
}

.cfg-form-grid input,
.cfg-form-grid select {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
}

/* --- Dettaglio preventivo --- */
.cfg-detail-table {
    max-width: 650px;
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
}

.cfg-detail-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.cfg-detail-table td:first-child {
    font-weight: 500;
    color: #666;
    width: 180px;
}

.cfg-detail-table td:last-child {
    color: var(--color2);
}

.cfg-detail-table .cfg-price {
    font-size: 18px;
    color: var(--color1);
    font-weight: 600;
}

/* --- Debug panel (colonna destra) --- */
.cfg-debug {
    display: inline-block;
    width: 33%;
    vertical-align: top;
    padding: 0 20px;
    box-sizing: border-box;
}

.cfg-debug h3 {
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid #fff;
    padding-bottom: 8px;
}

/* --- Sezione titolo con navigazione --- */
.cfg-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.cfg-page-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--color2);
    font-weight: 600;
}

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

/* --- Tag libero/offerta --- */
.cfg-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.cfg-tag-free {
    background: #fff3e0;
    color: #e65100;
}

.cfg-tag-linked {
    background: #e8f5e9;
    color: #2e7d32;
}

/* --- Salva preventivo (bottoni in fondo al debug) --- */
.cfg-save-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.cfg-save-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 10px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

/* --- Layout configurazione (main + sidebar) --- */
.cfg-config-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.cfg-config-layout #player_step {
    flex: 2;
    min-width: 0;
}
.cfg-config-layout #debug {
    flex: 1;
    min-width: 0;
    padding: 0 20px;
    box-sizing: border-box;
}
.cfg-riepilogo-toggle {
    display: none;
}

/* --- Riepilogo sidebar (colonna destra agente) --- */
.cfg-riepilogo-title {
    font-size: 13px;
    font-weight: 600;
    color: #50649c;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    margin-bottom: 12px;
    border-bottom: 2px solid #fff;
}
.cfg-riepilogo-section {
    margin-bottom: 16px;
}
.cfg-riepilogo-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #7c92a7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #f1f5fa;
}
.cfg-riepilogo-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    font-size: 12px;
}
.cfg-riepilogo-row span:first-child {
    color: #7c92a7;
}
.cfg-riepilogo-row span:last-child {
    font-weight: 600;
    color: #333;
    text-align: right;
}
.cfg-riepilogo-prezzo {
    background: linear-gradient(135deg, var(--color6) 0%, #1a2e35 100%);
    border-radius: 6px;
    padding: 14px 16px;
    margin-top: 16px;
    text-align: center;
}
.cfg-riepilogo-prezzo-label {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.cfg-riepilogo-prezzo-value {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .cfg-app-container {
        padding: 0 16px 80px;
    }
    .cfg-app-header {
        padding: 10px 16px;
        margin-bottom: 12px;
    }
    .cfg-app-header .cfg-logo {
        height: 28px;
    }
    .cfg-saluto {
        font-size: 13px;
    }
    .cfg-bottombar-item svg {
        width: 20px;
        height: 20px;
    }
    .cfg-bottombar-item span {
        font-size: 9px;
    }
    .cfg-dashboard-grid {
        grid-template-columns: 1fr;
    }
    .cfg-grid-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .cfg-form-grid {
        grid-template-columns: 1fr;
    }
    .cfg-filter-grid {
        grid-template-columns: 1fr;
    }
    /* Layout configurazione mobile */
    .cfg-config-layout {
        flex-direction: column;
    }
    .cfg-config-layout .cfg-riepilogo-toggle {
        order: 1;
    }
    .cfg-config-layout #debug {
        order: 2;
        display: none;
        width: 100%;
        padding: 0;
    }
    .cfg-config-layout #debug.cfg-riepilogo-open {
        display: block;
    }
    .cfg-config-layout #player_step {
        order: 3;
        width: 100%;
    }
    .cfg-riepilogo-toggle {
        display: block;
        width: 100%;
        padding: 10px 16px;
        font-size: 14px;
        font-weight: 600;
        color: #fff;
        background: var(--color6);
        border: 1px solid var(--color6);
        border-radius: 6px;
        cursor: pointer;
        text-align: center;
        margin-bottom: 12px;
    }
    .cfg-riepilogo-toggle::after {
        content: ' ▼';
        font-size: 10px;
    }
    .cfg-riepilogo-toggle.open::after {
        content: ' ▲';
    }
    /* Badge cliente mobile */
    .cfg-badge-cliente {
        flex-direction: column;
    }
    .cfg-badge-cliente-item {
        border-right: none;
        border-bottom: 1px solid #a5d6a7;
        width: 100%;
        box-sizing: border-box;
    }
    .cfg-badge-cliente-item:last-child {
        border-bottom: none;
    }
    .cfg-page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .cfg-btn-group {
        flex-direction: column;
    }
    .cfg-btn {
        width: 100%;
    }
    /* Tabelle responsive: ogni riga diventa una card */
    .cfg-table thead {
        display: none;
    }
    .cfg-table tbody tr {
        display: block;
        background: #fff;
        border: 1px solid #eee;
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 12px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }
    .cfg-table tbody tr:hover {
        background: #fff;
    }
    .cfg-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid #f5f5f5;
        font-size: 13px;
    }
    .cfg-table td:last-child {
        border-bottom: none;
        padding-top: 10px;
        justify-content: center;
    }
    .cfg-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 11px;
        text-transform: uppercase;
        color: #50649c;
        letter-spacing: 0.3px;
        margin-right: 12px;
        flex-shrink: 0;
    }
    .cfg-table td.text-right,
    .cfg-table td.text-center {
        text-align: right;
    }
    .cfg-table .cfg-empty {
        display: block;
    }
}
