:root {
    --sidebar-width: 280px;
    --sidebar-bg: #001d3d;
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #003566;
    --text-muted: #64748b;
    --status-new: #10b981;
    --status-visto: #facc15;
    --status-presu: #3b82f6;
    --status-exp: #94a3b8;
}

body.dashboard-body {
    background: var(--body-bg);
    display: flex;
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
}

/* Sidebar */
.dashboard-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    padding: 30px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
}

.sidebar-header {
    padding: 0 30px 40px;
}

.company-mini-profile {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
}

.company-mini-profile img {
    width: 45px;
    height: 45px;
    background: #fff;
    border-radius: 12px;
    padding: 5px;
}

.company-mini-profile .info {
    display: flex;
    flex-direction: column;
}

.company-mini-profile .info strong {
    font-size: 0.95rem;
    font-weight: 700;
}

.company-mini-profile .info span {
    font-size: 0.75rem;
    opacity: 0.6;
}

.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
}

.sidebar-nav li {
    margin-bottom: 5px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 30px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
    border-left: 4px solid transparent;
}

.sidebar-nav li.active a, .sidebar-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--brand-red);
}

.badge-red {
    background: var(--brand-red);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 50px;
    margin-left: auto;
}

.sidebar-footer {
    padding: 20px 30px;
}

.plan-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.plan-card p {
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.progress-mini {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-mini .fill {
    height: 100%;
    background: var(--brand-red);
}

.plan-card small {
    font-size: 0.75rem;
    opacity: 0.6;
}

.btn-logout {
    width: 100%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

/* Main Content */
.dashboard-main {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 40px 50px;
}

.dashboard-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.dashboard-topbar h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--brand-blue);
}

.dashboard-topbar p {
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-btn {
    position: relative;
    background: #fff;
    border: 1px solid #e2e8f0;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.notification-btn .dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 10px;
    height: 10px;
    background: var(--brand-red);
    border-radius: 50%;
    border: 2px solid #fff;
}

.user-avatar {
    width: 45px;
    height: 45px;
    background: var(--brand-blue);
    color: #fff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

/* Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.metric-card {
    background: #fff;
    padding: 24px;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    border: 1px solid #f1f5f9;
}

.metric-info span:first-child {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.metric-info strong {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--brand-blue);
}

.trend {
    display: block;
    font-size: 0.75rem;
    margin-top: 5px;
    font-weight: 700;
    color: var(--text-muted);
}

.trend.up { color: var(--status-new); }

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.metric-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.metric-icon.purple { background: rgba(168, 85, 247, 0.1); color: #a855f7; }
.metric-icon.green { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.metric-icon.gold { background: rgba(250, 204, 21, 0.1); color: #facc15; }

/* Dashboard Row Card */
.card {
    background: #fff;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    border: 1px solid #f1f5f9;
}

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

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
}

.period-selector, .table-filters {
    display: flex;
    gap: 8px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 12px;
}

.period-selector button, .table-filters button {
    background: transparent;
    border: none;
    padding: 6px 15px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.period-selector button.active, .table-filters button.active {
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* Charts */
.canvas-wrap {
    height: 350px;
}

/* Leads Table */
.leads-table {
    width: 100%;
    border-collapse: collapse;
}

.leads-table th {
    text-align: left;
    padding: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    border-bottom: 1px solid #f1f5f9;
}

.leads-table td {
    padding: 15px;
    font-size: 0.9rem;
    border-bottom: 1px solid #f8fafc;
}

.leads-table tr:last-child td { border-bottom: none; }

.status-pill {
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.status-new { background: rgba(16, 185, 129, 0.1); color: var(--status-new); }
.status-visto { background: rgba(250, 204, 21, 0.1); color: var(--status-visto); }
.status-presu { background: rgba(59, 130, 246, 0.1); color: var(--status-presu); }

.route-cell {
    display: flex;
    flex-direction: column;
}

.route-cell span { font-size: 0.7rem; color: var(--text-muted); }

/* Billing */
.billing-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.plan-table {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.plan-row {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    border-radius: 12px;
    background: #f8fafc;
    font-weight: 700;
    font-size: 0.9rem;
}

.plan-row.active {
    border: 2px solid var(--brand-blue);
    background: rgba(0, 53, 102, 0.03);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #fff;
    border-radius: 16px;
    padding: 15px 25px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 5px solid var(--brand-red);
    transform: translateX(150%);
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 10000;
}

.toast.show {
    transform: translateX(0);
}

.toast-icon {
    width: 40px;
    height: 40px;
    background: rgba(230, 57, 70, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-red);
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 29, 61, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-card {
    background: #fff;
    width: 100%;
    max-width: 600px;
    border-radius: 24px;
    overflow: hidden;
    animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body { padding: 30px; }

.lead-summary {
    background: #f8fafc;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 30px;
}

.details-chips {
    margin-top: 15px;
    display: flex;
    gap: 8px;
}

.details-chips span {
    background: #fff;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid #e2e8f0;
}

.editor-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.editor-item label { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); display: block; margin-bottom: 5px; }
.editor-item input { width: 100%; padding: 8px; border: 1px solid #e2e8f0; border-radius: 8px; font-weight: 700; }

.total-row {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px dashed #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-row strong { font-size: 1.5rem; color: var(--brand-red); }

@media (max-width: 1024px) {
    .dashboard-sidebar { width: 80px; }
    .sidebar-header .logo, .sidebar-header .info, .sidebar-nav li a span:not(.icon), .sidebar-footer .plan-card { display: none; }
    .dashboard-main { margin-left: 80px; padding: 20px; }
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .billing-layout { grid-template-columns: 1fr; }
}
