/* ZENITH-GC STYLES - V7.44 (FIX LAYOUT V-ECHO.8 CTE AFFIANCATO) */

@import url('https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: 'Source Sans 3', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; height: 100%; }

/* --- PALETTE COLORI "IGNIS" --- */
:root {
    --primary: #9d0208;
    --primary-focus: #6a040f;
    --primary-gradient: linear-gradient(to right, #d00000, #9d0208);
    --primary-content: #ffffff;
    --secondary: #e85d04;
    --accent: #faa307;
    --neutral: #03071e;
    --base-100: #ffffff;
    --base-200: #f8f9fa;
    --base-300: #e9ecef;
    --text-dark: var(--neutral);
    --text-muted: #6c757d;
    --error: #d00000;
    --success: #2a9d8f;
    --gold: #ffba08;
    --gold-gradient: linear-gradient(to right, #FFD700, var(--gold));
    --silver: #adb5bd;
    --silver-gradient: linear-gradient(to right, #e9ecef, var(--silver));
    --bronze: #e59866;
    --bronze-gradient: linear-gradient(to right, #f7d7c4, var(--bronze));
    --wood: #ba926c;
    --wood-gradient: linear-gradient(to right, #dcc9b5, var(--wood));

    --border-radius: 0.5rem;
    --shadow-soft: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --transition-speed: 0.2s ease-in-out;
}

body {
    background-color: var(--base-200);
    color: var(--text-dark);
    font-size: 14px; 
    line-height: 1.6;
    height: 100%;
    overflow: hidden; 
    text-transform: uppercase; 
}

/* --- STILI GENERICI --- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background-color: var(--base-200); }
.login-page .card { border: 1px solid var(--base-300); background-color: var(--base-100); color: var(--text-dark); max-width: 400px; width: 100%;}
.login-page .label { color: var(--text-muted); }
.login-page .input { background-color: var(--base-100); border-color: var(--base-300); color: var(--text-dark); }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; } 
h2 { font-size: 1.3rem; } 
h3 { font-size: 1.15rem; } 
a { color: var(--primary); text-decoration: none; font-weight: 500; }

.app-layout { display: flex; height: 100vh; }
.main-content-wrapper {
    flex-grow: 1;
    transition: margin-left var(--transition-speed);
    margin-left: 190px; 
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto; 
    overflow-x: hidden;
}
.sidebar {
    width: 190px; 
    background-color: var(--base-100);
    height: 100vh;
    padding: 0.75rem; 
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    transition: width var(--transition-speed), transform var(--transition-speed), left var(--transition-speed);
    border-right: 1px solid var(--base-300);
    overflow: hidden;
    z-index: 1001;
    flex-shrink: 0;
}
.sidebar-header { flex-shrink: 0; font-size: 1.5rem; font-weight: 700; padding: 0.75rem;  white-space: nowrap; }
.sidebar .menu {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    margin-bottom: 0.75rem; 
}
.sidebar-profile {
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 0.75rem; 
    border-top: 1px solid var(--base-300);
}
.sidebar-profile .user-info { 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    min-width: 0; 
}
.sidebar-profile .user-info .font-bold {
    font-size: 0.8rem; 
    white-space: normal; 
    overflow-wrap: break-word; 
}
.sidebar-profile .user-info .text-xs {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.7rem; 
}
.header { background-color: rgba(255, 255, 255, 0.8); backdrop-filter: blur(8px); padding: 0 1.5rem; border-bottom: 1px solid var(--base-300); display: flex; align-items: center; height: 4rem; position: sticky; top: 0; z-index: 10; flex-shrink: 0; }
.main-content { padding: 1.5rem; flex-grow: 1; }
.sidebar.collapsed { width: 80px; } .sidebar.collapsed .sidebar-header, .sidebar.collapsed .menu span, .sidebar.collapsed .menu-title, .sidebar.collapsed .user-info div:not(.avatar), .sidebar.collapsed #logout-button span { display: none; } .sidebar.collapsed .menu a, .sidebar.collapsed #logout-button { justify-content: center; } .main-content-wrapper.sidebar-collapsed { margin-left: 80px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background-color: rgba(0,0,0,0.5); z-index: 1000; } .sidebar.mobile-visible { transform: translateX(0); box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); } .sidebar-overlay.visible { display: block; }

@media (max-width: 768px) {
    .main-content { padding: 1rem; }
    .sidebar {
        transform: translateX(-100%);
        width: 190px; 
        max-width: 80%;
        left: 0;
        height: 100dvh;
    }
    .main-content-wrapper { margin-left: 0 !important; }
    #sidebar-toggle-desktop { display: none; }
    #sidebar-toggle-mobile { display: flex; }
}
@media (min-width: 769px) { #sidebar-toggle-mobile { display: none; } .main-content-wrapper:not(.sidebar-collapsed) { margin-left: 190px; } .main-content-wrapper.sidebar-collapsed { margin-left: 80px; } }

.menu { list-style: none; padding-left: 0; } 
.menu a { color: #370617; display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem;  border-radius: var(--border-radius); font-weight: 500; transition: background-color 0.2s, color 0.2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.85rem; } 
.menu a i.material-icons { font-size: 1.2rem;  }
.menu a:hover { background-color: var(--base-200); } .menu a.active { background: var(--primary-gradient); color: var(--primary-content); box-shadow: 0 4px 6px -1px rgba(157, 2, 8, 0.3), 0 2px 4px -2px rgba(157, 2, 8, 0.2); } .menu a.active i { animation: pop-in 0.3s ease; } .menu-title { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); padding: 1rem 0.75rem 0.5rem;  font-weight: 500; white-space: nowrap; } .divider { height: 1px; background-color: var(--base-300); margin: 0.5rem 0; }
#logout-button { padding: 0.6rem 0.75rem !important; }
#logout-button i.material-icons { font-size: 1.2rem !important; }

.card { background-color: var(--base-100); border-radius: var(--border-radius); box-shadow: var(--shadow-soft); border: 1px solid var(--base-300); margin-bottom: 1.5rem; } .card-body { padding: 1.5rem; } .card-title { font-size: 1.15rem;  font-weight: 600; border-bottom: 1px solid var(--base-300); padding-bottom: 1rem; margin-bottom: 1.5rem; } .card-actions { display: flex; justify-content: flex-end; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--base-200); }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 0.4rem 0.8rem;  border-radius: var(--border-radius); font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all var(--transition-speed); } .btn:disabled { opacity: 0.5; cursor: not-allowed; } .btn-primary { background: var(--primary-gradient); color: var(--primary-content); border: none; box-shadow: var(--shadow-soft); } .btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(157, 2, 8, 0.2), 0 4px 6px -4px rgba(157, 2, 8, 0.1); } .btn-ghost { background-color: transparent; border-color: transparent; color: var(--text-muted); } .btn-ghost:hover:not(:disabled) { background-color: var(--base-200); color: var(--text-dark); }
.input, .select { width: 100%; border: 1px solid var(--base-300); background-color: var(--base-100); padding: 0.5rem 0.75rem; border-radius: var(--border-radius); transition: all var(--transition-speed); font-size: 0.9rem;  text-transform: none; } 
input[type="email"], input[type="password"] { text-transform: none; } 
.input:focus, .select:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--primary); }
.input-uppercase { text-transform: uppercase; }
.input-uppercase::placeholder { text-transform: none; }

.form-control { margin-bottom: 1rem; } .label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem; }
.table { width: 100%; border-collapse: collapse; } .table th, .table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--base-300); vertical-align: middle; } .table th { font-weight: 600; } .table tbody tr:hover { background-color: var(--base-200); }
.hidden { display: none !important; } .error { color: var(--error); font-weight: 500; } .avatar .placeholder { background-color: var(--neutral); color: var(--primary-content); width: 2.0rem;  height: 2.0rem;  display: flex; align-items: center; justify-content: center; border-radius: 9999px; font-weight: 600; font-size: 0.8rem;  flex-shrink: 0; }
.font-bold { font-weight: 700; } .text-xs { font-size: 0.75rem; } .text-slate-500 { color: #64748b; } .text-error { color: var(--error); } .text-right { text-align: right; } .grid { display: grid; } .password-container { position: relative; } .password-container input { padding-right: 2.5rem; } .toggle-password { position: absolute; top: 50%; right: 0.75rem; transform: translateY(-50%); cursor: pointer; color: var(--text-muted); user-select: none; }

/* Modal Layout & Scroll Fix */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0; top: 0; right: 0; bottom: 0;
    overflow: hidden;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    animation: modal-fade-in 0.3s ease;
    padding: 1rem;
}
.modal-content {
    background-color: var(--base-100);
    margin: 10vh auto auto auto;
    padding: 1.5rem;
    border: 1px solid var(--base-300);
    width: auto;
    max-width: calc(100% - 2rem);
    border-radius: var(--border-radius);
    position: relative;
    box-shadow: var(--shadow-soft);
    max-height: calc(100vh - 2rem - 10vh);
    overflow-y: auto;
}
@media (max-height: 600px) {
    .modal-content {
        margin-top: 2rem;
        max-height: calc(100vh - 4rem);
    }
}

.modal-close { position: absolute; top: 0.75rem; right: 1rem; border: none; background: none; font-size: 1.75rem; font-weight: 600; color: var(--text-muted); cursor: pointer; line-height: 1; z-index: 10; } .modal-close:hover { color: var(--text-dark); }
/* Gestione larghezza Modal */
#user-form-modal .modal-content,
#supplier-form-modal .modal-content,
#product-wizard-modal .modal-content {
    max-width: 800px;
}
#add-agency-modal .modal-content,
#rename-agency-modal .modal-content,
.confirmation-modal .modal-content,
.feedback-modal .modal-content {
    max-width: 450px;
}
.confirmation-modal .card-title,
.feedback-modal .card-title,
#user-modal-title,
#add-agency-modal .card-title,
#rename-agency-modal .card-title,
#supplier-modal-title,
#product-wizard-title {
    font-size: 1.15rem !important; 
}

.confirmation-modal p { margin-bottom: 1.5rem; color: var(--text-muted); } .confirmation-modal .card-actions { justify-content: space-between; padding-top: 1.5rem; border-top: 1px solid var(--base-300); }
.feedback-modal .modal-content { text-align: left; } .feedback-modal p { margin-bottom: 1.5rem; color: var(--text-muted); text-align: left; } .feedback-modal .card-actions { justify-content: flex-end; padding-top: 1.5rem; border-top: 1px solid var(--base-300); } .feedback-modal.success #feedback-icon { color: var(--success); } .feedback-modal.error #feedback-icon { color: var(--error); }
@keyframes pop-in { from { transform: scale(0.8); opacity: 0.5; } to { transform: scale(1); opacity: 1; } } @keyframes modal-fade-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* --- STILI WIZARD AREA PERSONALE --- */
.wizard-progress-bar { background-color: var(--base-200); border-radius: var(--border-radius); overflow: hidden; margin-bottom: 2rem; } .wizard-progress-bar-inner { height: 10px; background: var(--primary-gradient); width: 0%; transition: width 0.4s ease-in-out; } .wizard-step { display: none; animation: fadeIn 0.5s; } .wizard-step.active { display: block; } .wizard-step h3 { font-size: 1.15rem;  margin-bottom: 1.5rem; } .wizard-navigation { display: flex; justify-content: space-between; margin-top: 2rem; border-top: 1px solid var(--base-300); padding-top: 1.5rem; } @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } .wizard-grid-optimized { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; } .wizard-grid-optimized .span-2 { grid-column: span 2; } .wizard-grid-optimized .span-3 { grid-column: span 3; } .wizard-grid-optimized .span-4 { grid-column: span 4; } @media (max-width: 1024px) { .wizard-grid-optimized { grid-template-columns: repeat(2, 1fr); } .wizard-grid-optimized .span-3, .wizard-grid-optimized .span-4 { grid-column: span 2; } } @media (max-width: 768px) { .wizard-grid-optimized { grid-template-columns: 1fr; } .wizard-grid-optimized .span-2, .wizard-grid-optimized .span-3, .wizard-grid-optimized .span-4 { grid-column: span 1; } }
.custom-dropdown { position: relative; width: 100%; } .dropdown-display { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0.75rem; background-color: var(--base-100); border: 1px solid var(--base-300); border-radius: var(--border-radius); cursor: pointer; transition: all var(--transition-speed); user-select: none; } .dropdown-display.disabled { background-color: var(--base-200); cursor: not-allowed; color: var(--text-muted); } .dropdown-display:not(.disabled):hover { border-color: var(--primary); } .dropdown-display span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .dropdown-options { display: none; position: absolute; top: 100%; left: 0; right: 0; background-color: var(--base-100); border: 1px solid var(--base-300); border-top: none; border-radius: 0 0 var(--border-radius) var(--border-radius); max-height: 250px; overflow-y: auto; z-index: 20; box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); } .custom-dropdown.open .dropdown-options { display: block; } .custom-dropdown.open .dropdown-display { border-color: var(--primary); border-radius: var(--border-radius) var(--border-radius) 0 0; } .dropdown-search { width: 100%; padding: 0.75rem; border: none; border-bottom: 1px solid var(--base-300); outline: none; } .dropdown-options ul { list-style: none; padding: 0; margin: 0; } .dropdown-option { padding: 0.75rem 1rem; cursor: pointer; transition: background-color var(--transition-speed); } .dropdown-option:hover { background-color: var(--base-200); } .dropdown-option.selected { background-color: var(--primary); color: var(--primary-content); }

/* --- STILI DASHBOARD (index.html) --- */
.user-rank-card { background: var(--primary-gradient); color: var(--primary-content); padding: 0.75rem 1.5rem; border-radius: var(--border-radius); margin-bottom: 1.5rem; box-shadow: var(--shadow-soft); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.user-rank-card .welcome-text { font-size: 0.9rem;  font-weight: 500; }
.user-rank-card .rank-details { font-size: 0.9rem;  font-weight: 500; text-align: right; }
.user-rank-card .rank-details strong { font-size: 1.1rem;  font-weight: 700; }
.performers-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.performers-list li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background-color: var(--base-200);
    border-radius: var(--border-radius);
    border-left: 4px solid transparent;
    transition: all var(--transition-speed);
    overflow: hidden;
}
.performers-list li:hover { transform: translateX(5px); box-shadow: var(--shadow-soft); }
.performers-list .icon { font-size: 1.5rem;  }
.performers-list .agent-name { font-weight: 600; word-break: break-word; }
.performers-list .agent-agency { font-size: 0.8rem; color: var(--text-muted); }
.performers-list .volume { font-size: 1.1rem;  font-weight: 700; text-align: right; white-space: nowrap; }
.performer-ee { border-left-color: var(--secondary); } .performer-gas { border-left-color: var(--primary); } .performer-gpl { border-left-color: var(--neutral); }
.ranking-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.ranking-list .rank-item { display: grid; grid-template-columns: 40px 1fr 50px; align-items: center; padding: 0.6rem 0.5rem; border-radius: var(--border-radius); position: relative; background-color: var(--base-100); overflow: hidden; border: 1px solid var(--base-300); }
.ranking-list .rank-bar { position: absolute; top: 0; left: 0; height: 100%; background: var(--base-200); width: 0%; border-radius: var(--border-radius) 0 0 var(--border-radius); transition: width 0.5s ease-out; z-index: 1; }
.ranking-list .rank-item.rank-1 .rank-bar { background: var(--gold-gradient); } .ranking-list .rank-item.rank-2 .rank-bar { background: var(--silver-gradient); } .ranking-list .rank-item.rank-3 .rank-bar { background: var(--bronze-gradient); } .ranking-list .rank-item.rank-4 .rank-bar { background: var(--wood-gradient); }
.ranking-list .rank-item .rank-position, .ranking-list .rank-item .rank-details, .ranking-list .rank-item .rank-pdp { position: relative; z-index: 2; }
.ranking-list .rank-item.current-user { box-shadow: inset 0 0 0 1000px rgba(3, 7, 30, 0.05); border-color: var(--neutral); } .ranking-list .rank-item.current-user .text-slate-500 { color: var(--text-muted); }

/* --- STILI DASHBOARD PERSONALE (areapersonale.html) --- */
#personal-dashboard-view .summary-boxes-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));  gap: 1rem;  margin-bottom: 1.5rem; }
#personal-dashboard-view .summary-box { color: var(--primary-content); padding: 1rem 1.1rem;  border-radius: var(--border-radius); display: flex; align-items: center; gap: 0.8rem;  box-shadow: var(--shadow-soft); }
#personal-dashboard-view .summary-box .icon { font-size: 1.7rem;  opacity: 0.8; }
#personal-dashboard-view .summary-box .details { display: flex; flex-direction: column; }
#personal-dashboard-view .summary-box .title { font-size: 0.75rem;  font-weight: 500; margin-bottom: 0.25rem; text-transform: uppercase; opacity: 0.9; }
#personal-dashboard-view .summary-box .pdp-value { font-size: 1.3rem;  font-weight: 700; line-height: 1.2; }
#personal-dashboard-view .summary-box .volume-value { font-size: 0.7rem;  font-weight: 500; opacity: 0.9; margin-top: 0.2rem; }
#personal-dashboard-view .summary-energia { background: var(--secondary); } #personal-dashboard-view .summary-gas { background: var(--primary); } #personal-dashboard-view .summary-tlc { background: var(--accent); } #personal-dashboard-view .summary-gpl { background: var(--neutral); }
#personal-dashboard-view .dashboard-main-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
#personal-dashboard-view .chart-card-main .card { margin-bottom: 0; height: 100%; }
#personal-dashboard-view .chart-card-main .card-body { display: flex; flex-direction: column; height: 100%; }
#personal-dashboard-view .chart-card-main .chart-title-area { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; border-bottom: 1px solid var(--base-300); padding-bottom: 0.75rem; flex-wrap: wrap; gap: 0.5rem; }
#personal-dashboard-view .chart-card-main .chart-title-text { font-size: 1rem;  font-weight: 600; }
#personal-dashboard-view .chart-card-main .annual-turnover { font-size: 1.3rem;  font-weight: 700; color: var(--text-dark); white-space: nowrap; text-align: right; flex-shrink: 0; }
#personal-dashboard-view .chart-card-main .annual-turnover.hidden-amount { color: var(--text-muted); }
#personal-dashboard-view .chart-card-main canvas { flex-grow: 1; max-height: 300px; }
#personal-dashboard-view .dashboard-secondary-cards { display: flex; flex-direction: column; gap: 1.5rem; grid-row: span 2; }
#personal-dashboard-view .dashboard-secondary-cards .stat-card { margin-bottom: 0; }
#personal-dashboard-view .dashboard-secondary-cards .card { height: 100%; }
#personal-dashboard-view .dashboard-secondary-cards .card-body { display: flex; flex-direction: column; }
#personal-dashboard-view .dashboard-secondary-cards .distribution-list { flex-grow: 1; align-content: center; }
#personal-dashboard-view .distribution-container .card-title { margin-bottom: 1rem; }
#personal-dashboard-view .distribution-list { list-style: none; padding: 0; margin: 1rem 0 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));  gap: 1rem;  }
#personal-dashboard-view .distribution-item { text-align: center; }
#personal-dashboard-view .distribution-circle {
    --percent: 0; --color: var(--text-muted); --track-color: var(--base-200); --size: 70px; --thickness: 7px; 
    width: var(--size); height: var(--size); border-radius: 50%; margin: 0 auto 0.5rem auto;
    display: grid; place-items: center; position: relative;
    background: conic-gradient(var(--color) calc(var(--percent) * 1%), var(--track-color) 0);
}
#personal-dashboard-view .distribution-circle::before {
    content: ''; position: absolute;
    top: var(--thickness); left: var(--thickness); right: var(--thickness); bottom: var(--thickness);
    background: var(--base-100);
    border-radius: 50%;
    z-index: 1;
}
#personal-dashboard-view .distribution-circle span {
    position: relative; z-index: 2;
    font-size: 1rem;  font-weight: 600;
    color: var(--color);
}
#personal-dashboard-view .distribution-label { font-size: 0.75rem;  font-weight: 500; color: var(--text-muted); }
#personal-dashboard-view .agent-performance-section { grid-column: 1 / -1; }
#personal-dashboard-view .agent-performance-section .card-title { border-bottom: none; margin-bottom: 1rem; padding-bottom: 0; }
#personal-dashboard-view .agent-performance-table { width: 100%; border-collapse: collapse; }
#personal-dashboard-view .agent-performance-table th,
#personal-dashboard-view .agent-performance-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--base-300); vertical-align: middle; }
#personal-dashboard-view .agent-performance-table th { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; color: var(--text-muted); }
#personal-dashboard-view .agent-performance-table td { font-size: 0.85rem;  }
#personal-dashboard-view .agent-info-cell { display: flex; align-items: center; gap: 0.75rem; }
#personal-dashboard-view .agent-avatar .placeholder { width: 1.8rem; height: 1.8rem; font-size: 0.7rem;  background-color: var(--base-300); color: var(--text-muted); flex-shrink: 0; }
#personal-dashboard-view .agent-info .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#personal-dashboard-view .agent-info .role { font-size: 0.75rem; color: var(--text-muted); }
#personal-dashboard-view .agent-performance-table th.text-right,
#personal-dashboard-view .agent-performance-table td.pdp-count,
#personal-dashboard-view .agent-performance-table td.percentage,
#personal-dashboard-view .agent-performance-table td.provvigioni { text-align: right; }
#personal-dashboard-view .agent-performance-table .provvigioni.hidden-amount { color: var(--text-muted); }
#personal-dashboard-view .agent-performance-table tr.current-user-row { background-color: #fffbe6; border-left: 3px solid var(--accent); }
#personal-dashboard-view .agent-performance-table tr.current-user-row td { font-weight: 600; }
#personal-dashboard-view .agency-accordion details { margin-bottom: 0.5rem; border: 1px solid var(--base-300); border-radius: var(--border-radius); overflow: hidden; }
#personal-dashboard-view .agency-accordion summary { display: grid; grid-template-columns: auto 1fr repeat(3, max-content); align-items: center; gap: 1rem; padding: 0.75rem 1rem; font-weight: 600; background-color: var(--base-100); cursor: pointer; transition: background-color 0.2s; }
#personal-dashboard-view .agency-accordion summary:hover { background-color: var(--base-200); }
#personal-dashboard-view .agency-accordion summary .agency-name { font-weight: 700; }
#personal-dashboard-view .agency-accordion summary .total-value { text-align: right; font-weight: 600; white-space: nowrap; }
#personal-dashboard-view .agency-accordion summary .hidden-amount { color: var(--text-muted); }
#personal-dashboard-view .agency-accordion details[open] summary { border-bottom: 1px solid var(--base-300); }
#personal-dashboard-view .agency-accordion .agent-table-wrapper { padding: 0; overflow-x: auto; }
#personal-dashboard-view .agency-accordion .agent-performance-table { border-top: none; }
#personal-dashboard-view .agency-accordion .agent-performance-table th { background-color: var(--base-100); padding-top: 0.5rem; padding-bottom: 0.5rem; }
#personal-dashboard-view .agency-accordion .agent-performance-table tr:last-child td { border-bottom: none; }
#personal-dashboard-view .stat-card { background-color: var(--base-100); border-radius: var(--border-radius); padding: 1.25rem; box-shadow: var(--shadow-soft); border: 1px solid var(--base-300); display: flex; flex-direction: column; }
#personal-dashboard-view .stat-title { font-size: 0.8rem;  color: var(--text-muted); margin-bottom: 0.5rem; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
#personal-dashboard-view .stat-value { font-size: 1.3rem;  font-weight: 700; color: var(--text-dark); margin-bottom: 0.5rem; }
#personal-dashboard-view .stat-category { font-size: 0.7rem;  font-weight: 600; margin-top: 0.75rem; margin-bottom: 0.25rem; color: var(--neutral); }
#personal-dashboard-view .stat-details { font-size: 0.8rem;  color: var(--text-muted); line-height: 1.5; }
.loading-opacity { opacity: 0.4; pointer-events: none; transition: opacity 0.3s ease; }
@media (max-width: 1024px) {
    #personal-dashboard-view .dashboard-main-grid { grid-template-columns: 1fr; }
    #personal-dashboard-view .dashboard-secondary-cards { grid-row: auto; }
    #personal-dashboard-view .chart-card-main canvas { max-height: 250px; }
    #personal-dashboard-view .summary-boxes-container { grid-template-columns: repeat(2, 1fr); }
    #personal-dashboard-view .agent-performance-section { margin-top: 1.5rem; }
    #personal-dashboard-view .agency-accordion summary { grid-template-columns: auto 1fr repeat(3, max-content); gap: 0.75rem; font-size: 0.9rem; }
}
@media (max-width: 768px) {
     #personal-dashboard-view .chart-card-main canvas { max-height: 200px; }
     #personal-dashboard-view .stat-card { padding: 1rem; }
     #personal-dashboard-view .summary-boxes-container { grid-template-columns: 1fr; }
     #personal-dashboard-view .summary-box .icon { font-size: 1.7rem; } 
     #personal-dashboard-view .summary-box .pdp-value { font-size: 1.3rem; } 
     #personal-dashboard-view .chart-card-main .annual-turnover { font-size: 1.1rem; } 
     #personal-dashboard-view .distribution-list { grid-template-columns: repeat(2, 1fr); gap: 1rem;}
     #personal-dashboard-view .agency-accordion summary {
        grid-template-columns: auto 1fr repeat(3, max-content);
        gap: 0.5rem;
        padding: 0.75rem;
        font-size: 0.75rem;
        overflow-x: auto;
     }
     #personal-dashboard-view .agency-accordion summary .total-value { white-space: nowrap; }
     #personal-dashboard-view .agent-performance-table th,
     #personal-dashboard-view .agent-performance-table td { padding: 0.5rem; font-size: 0.8rem; }
     #personal-dashboard-view .agent-info-cell { gap: 0.5rem; }
     #personal-dashboard-view .agent-avatar .placeholder { width: 1.8rem; height: 1.8rem; font-size: 0.7rem; }
}
/* --- STILI PRIVACY SWITCH (Base) --- */
.privacy-switch { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 20px; }
.slider:before { position: absolute; content: ""; height: 12px; width: 12px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(14px); }

/* --- V17.0: STILI STATO SWITCH (Confermato/Rifiutato) --- */
.state-switch-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 130px;
}
.state-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
    flex-shrink: 0;
}
.state-switch input { opacity: 0; width: 0; height: 0; }
.state-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--error);
    transition: .4s;
    border-radius: 20px;
}
.state-switch .slider:before {
    position: absolute;
    content: "";
    height: 12px; width: 12px;
    left: 4px; bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
.state-switch input:checked + .slider {
    background-color: var(--success);
}
.state-switch input:checked + .slider:before {
    transform: translateX(14px);
}
.state-switch input:disabled + .slider {
    cursor: not-allowed;
    opacity: 0.6;
}
.state-switch-label {
    font-size: 0.8rem; 
    font-weight: 600;
    transition: color 0.4s;
}
.state-switch-label.confermato { color: var(--success); }
.state-switch-label.rifiutato { color: var(--error); }


/* --- STILI COSTRUTTORE DI SCHEMI (V3.0) --- */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}
.schema-btn {
    justify-content: flex-start;
    font-weight: 500;
    border: 1px dashed var(--base-300);
    color: var(--text-dark);
    padding: 0.3rem 0.6rem; 
    font-size: 0.8rem; 
}
.schema-btn i.material-icons {
    margin-right: 0.5rem;
    color: var(--text-muted);
    transition: all 0.2s;
    font-size: 1.1rem; 
}
.schema-btn:hover {
    border-style: solid;
    border-color: var(--primary);
    background-color: #fff5f5;
}
.schema-btn.active {
    background: var(--primary-gradient);
    color: var(--primary-content);
    border-style: solid;
    border-color: var(--primary);
    font-weight: 600;
    box-shadow: var(--shadow-soft);
}
.schema-btn.active i.material-icons {
    color: var(--primary-content);
    transform: scale(1.1);
}
#schema-summary-container {
    font-size: 0.85rem; 
}
.schema-group {
    margin-bottom: 1.5rem;
}
.schema-group-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--base-200);
    padding-bottom: 0.25rem;
    display: block;
}
/* Stile per checkbox Step 3 (Formula Anteprima) */
#schema-builder-preview-formula .form-control {
    margin-bottom: 0;
    transition: background-color 0.2s;
}
#schema-builder-preview-formula .form-control:hover {
    background-color: var(--base-200);
}
#schema-builder-preview-formula .form-control input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
}

/* --- ADMIN - EDITOR REGOLE TLC --- */
#product-form-commissioni-fields-container .table {
    margin-top: 0.5rem;
}
#product-form-commissioni-fields-container .table th,
#product-form-commissioni-fields-container .table td {
    vertical-align: middle;
    padding: 0.5rem;
}
#product-form-commissioni-fields-container .table .input {
    font-size: 0.85rem; 
    padding: 0.4rem 0.6rem;
    margin-bottom: 0;
}
#product-form-commissioni-fields-container .table .btn {
    padding: 0.25rem 0.5rem;
}
#product-form-commissioni-fields-container .table .btn .material-icons {
    font-size: 1.0rem; 
}

/* --- ADMIN - PRODUCT LIST & WIZARD --- */
#product-list-table .btn .material-icons {
    font-size: 1.0rem; 
}
#product-list-table .product-status-toggle {
    transform: scale(0.8);
}
.tabs-navigation {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}
.tabs-navigation .tab {
    padding: 0.6rem 1rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    position: relative;
    bottom: -1px;
}
.tabs-navigation .tab:hover {
    background-color: var(--base-200);
    color: var(--text-dark);
}
.tabs-navigation .tab.active {
    color: var(--primary);
    background-color: var(--base-100);
    border-color: var(--base-300);
    border-bottom: 1px solid var(--base-100);
    font-weight: 600;
}
#product-commission-roles-tabs {
    background-color: var(--base-200);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--base-300);
}
#product-commission-roles-tabs .tab {
    font-size: 0.8rem; 
    padding: 0.5rem 0.8rem;
    border-radius: var(--border-radius);
    bottom: 0;
}
#product-commission-roles-tabs .tab.active {
    background-color: var(--base-100);
    color: var(--primary);
    border: 1px solid var(--base-300);
    box-shadow: var(--shadow-soft);
}
#product-form-commissioni-fields-container {
    padding: 1.5rem;
    border: 1px solid var(--base-300);
    border-radius: var(--border-radius);
}

/* --- ADMIN - PRODUCT FILTERS & WIZARD FIELDSET --- */
#product-list-filter-container .form-control {
    margin-bottom: 0.5rem;
}
@media (max-width: 768px) {
    #product-list-filter-container {
        grid-template-columns: 1fr;
    }
}

/* --- INIZIO FIX V-Echo.8 (Layout Modal Prodotto) --- */
#product-form-anagrafica-fields fieldset {
    border: 1px solid var(--base-300);
    padding: 0.75rem 1rem 1rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}
#product-form-anagrafica-fields fieldset legend {
    font-size: 0.8rem; 
    font-weight: 600;
    padding: 0 0.5rem;
    margin-left: 0.25rem;
    width: auto;
}
#product-form-anagrafica-fields fieldset .form-control {
    margin-bottom: 0.5rem;
}
#product-form-anagrafica-fields fieldset .form-control[style*="flex-direction: row"] {
    margin-bottom: 0;
}
#product-form-anagrafica-fields fieldset div[style*="display: flex"] {
    gap: 0.5rem 1rem;
}
#product-form-anagrafica-fields fieldset div.grid {
    gap: 0.5rem 1rem;
}
/* Nuove classi per layout CTE */
.cte-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}
.cte-price-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: flex-end;
    gap: 1rem;
}
.cte-price-radios {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
/* Responsive per i campi CTE */
@media (max-width: 768px) {
    .cte-grid {
        grid-template-columns: 1fr;
    }
    .cte-price-grid {
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 0.5rem;
    }
    .cte-price-grid .form-control {
        margin-bottom: 0.5rem;
    }
}
/* --- FINE FIX V-Echo.8 --- */

#product-form-anagrafica-fields .no-limit-btn {
    color: var(--primary);
    font-weight: 600;
}
#product-form-anagrafica-fields .no-limit-btn:hover {
    background-color: transparent;
    text-decoration: underline;
}

/* --- V17.0: ACCORDION ANNI (Richiesta) --- */
.year-accordion details {
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--base-100);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--base-300);
    margin-bottom: 1.5rem;
}
.year-accordion summary {
    font-size: 1.1rem; 
    font-weight: 600;
    padding: 1.5rem;
    cursor: pointer;
}
.year-accordion .card-body {
    padding: 0 1.5rem 1.5rem 1.5rem;
}
.year-accordion .card-body details {
    background-color: var(--base-100);
    border: 1px solid var(--base-300);
    box-shadow: none;
}
.year-accordion .card-body summary {
    font-size: 0.9rem; 
    font-weight: 500;
    padding: 0.75rem;
}

/* --- SOLUZIONE V2.3: Stile per campi readonly --- */
.input.readonly-field {
    background-color: var(--base-200);
    color: var(--text-muted);
    cursor: not-allowed;
}
