/**
 * Portal vendedor — layout com sidebar (shell MyPharm)
 */

#vdApp.app-layout {
    display: flex !important;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

#vdApp .sidebar {
    width: var(--sidebar-width, 280px);
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: visible;
    transition: width var(--transition, 0.25s ease), border-color var(--transition, 0.25s ease);
}

#vdApp .sidebar.collapsed {
    width: var(--sidebar-collapsed, 76px);
    border-left: 3px solid var(--sidebar-accent-line, var(--primary, #e63946));
}

#vdApp .sidebar-toggle {
    z-index: 150;
}

#vdApp .main-content {
    flex: 1 1 auto;
    min-width: 0;
    width: calc(100% - var(--sidebar-width, 280px));
    max-width: 100%;
    min-height: 100vh;
    margin-left: var(--sidebar-width, 280px);
    overflow-x: hidden;
    transition: margin-left var(--transition, 0.25s ease), width var(--transition, 0.25s ease);
}

#vdApp .sidebar.collapsed ~ .main-content {
    width: calc(100% - var(--sidebar-collapsed, 76px));
    margin-left: var(--sidebar-collapsed, 76px);
}

#vdApp .sidebar.collapsed .nav-section-title,
#vdApp .sidebar.collapsed .user-details {
    opacity: 0;
    width: 0;
    overflow: hidden;
    position: absolute;
    pointer-events: none;
}

#vdApp .sidebar.collapsed .sidebar-nav .nav-item {
    justify-content: center;
    padding: 12px 10px;
    gap: 0;
}

#vdApp .sidebar.collapsed .sidebar-nav .nav-item span {
    opacity: 0;
    width: 0;
    overflow: hidden;
    position: absolute;
    pointer-events: none;
}

#vdApp .sidebar.collapsed .sidebar-nav .nav-item i {
    margin-right: 0;
}

#vdApp .sidebar.collapsed .sidebar-footer .user-info {
    justify-content: center;
    padding-inline: 0;
}

#vdApp .page-content.dashboard-container {
    padding: 1.25rem 1.5rem 2rem;
    max-width: 1600px;
    width: 100%;
    margin: 0;
    box-sizing: border-box;
}

#vdApp .vd-topbar-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary, #64748b);
    margin-top: 2px;
    line-height: 1.4;
}

#vdApp .topbar-right .theme-toggle {
    flex-shrink: 0;
}

#vdApp .sidebar-footer .user-info {
    cursor: pointer;
}

#vdApp .sidebar .nav-item.active,
#vdApp .sidebar.collapsed .nav-item.active,
[data-theme="light"] #vdApp .sidebar .nav-item.active,
[data-theme="dark"] #vdApp .sidebar .nav-item.active {
    background: rgba(230, 57, 70, 0.12);
    color: var(--primary, #e63946);
    box-shadow: inset 3px 0 0 var(--primary, #e63946);
}

#vdApp .sidebar .nav-item.active i {
    color: var(--primary, #e63946);
}

#vdApp .sidebar .nav-item.active:hover {
    background: rgba(230, 57, 70, 0.18);
}

#vdApp .welcome-section {
    margin-top: -0.35rem;
}

#vdApp .vd-dashboard-hero {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(460px, auto);
    align-items: start;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1.1rem;
    background:
        radial-gradient(circle at 12% 20%, rgba(230, 57, 70, 0.08), transparent 28%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.86));
    box-shadow: 0 18px 40px -32px rgba(15, 23, 42, 0.5);
}

[data-theme="dark"] #vdApp .vd-dashboard-hero {
    background:
        radial-gradient(circle at 12% 20%, rgba(230, 57, 70, 0.16), transparent 30%),
        linear-gradient(135deg, rgba(30, 34, 53, 0.92), rgba(15, 17, 23, 0.88));
    border-color: rgba(148, 163, 184, 0.14);
}

#vdApp .vd-dashboard-copy {
    min-width: 0;
    padding-top: 0.1rem;
}

#vdApp .vd-dashboard-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(230, 57, 70, 0.1);
    color: var(--primary, #e63946);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

#vdApp .vd-dashboard-copy h1 {
    margin: 0;
    color: var(--text-primary, #0f172a);
    font-size: clamp(1.45rem, 2.3vw, 2rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
}

#vdApp .vd-dashboard-copy p {
    max-width: 620px;
    margin: 0.3rem 0 0;
    color: var(--text-secondary, #64748b);
    font-size: 0.88rem;
    line-height: 1.45;
}

#vdApp .vd-period-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-self: end;
    gap: 0.45rem;
    min-width: min(100%, 520px);
}

#vdApp .vd-period-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(59, 130, 246, 0.22);
    border-radius: 0.75rem;
    background: rgba(59, 130, 246, 0.08);
    color: var(--text-primary, #0f172a);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

#vdApp .vd-period-status span {
    color: var(--text-secondary, #64748b);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

#vdApp .vd-period-status strong {
    color: var(--primary, #e63946);
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
}

#vdApp .vd-quick-range {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
}

#vdApp .vd-quick-range button {
    min-height: 30px;
    padding: 0.32rem 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 999px;
    background: var(--bg-card, #fff);
    color: var(--text-secondary, #64748b);
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

#vdApp .vd-quick-range button:hover {
    transform: translateY(-1px);
    border-color: rgba(230, 57, 70, 0.3);
    color: var(--primary, #e63946);
}

#vdApp .vd-quick-range button.is-active {
    border-color: rgba(230, 57, 70, 0.32);
    background: rgba(230, 57, 70, 0.12);
    color: var(--primary, #e63946);
}

#vdApp .vd-dashboard-filter {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}

#vdApp .vd-dashboard-filter label {
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary, #64748b);
}

#vdApp .vd-dashboard-filter input {
    min-height: 34px;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--border, #cbd5e1);
    border-radius: 0.6rem;
    background: var(--bg-card, #fff);
    color: var(--text-primary, #0f172a);
    font-size: 0.82rem;
}

#vdApp .vd-dashboard-filter button {
    min-height: 34px;
    padding: 0.35rem 0.85rem;
    border: 0;
    border-radius: 0.6rem;
    background: linear-gradient(135deg, var(--primary, #e63946), #f97316);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 22px -14px rgba(230, 57, 70, 0.85);
}

#vdApp .vd-period-hint {
    font-size: 0.72rem;
    color: var(--text-secondary, #64748b);
}

#vdApp .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

#vdApp .kpi-grid .card {
    min-height: 132px;
    border-radius: 1rem;
}

#vdApp .kpi-box {
    min-height: 100%;
    justify-content: space-between;
}

#vdApp .kpi-label {
    color: var(--text-secondary, #64748b);
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.08em;
}

#vdApp .kpi-value {
    margin-top: 0.15rem;
    color: var(--text-primary, #0f172a);
    font-size: clamp(1.45rem, 2vw, 1.85rem);
    line-height: 1.05;
    letter-spacing: -0.035em;
}

#vdApp .kpi-desc {
    margin-top: 0.35rem;
    color: var(--text-secondary, #64748b);
    font-size: 0.78rem;
    line-height: 1.35;
}

#vdApp .kpi-bg-icon {
    opacity: 0.9;
}

@media (max-width: 1180px) {
    #vdApp .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    #vdApp .sidebar {
        transform: translateX(-100%);
        width: min(280px, 85vw);
        transition: transform var(--transition, 0.2s ease);
    }

    #vdApp .sidebar.open {
        transform: translateX(0);
    }

    #vdApp .main-content,
    #vdApp .sidebar.collapsed ~ .main-content {
        width: 100%;
        margin-left: 0;
    }

    #vdApp .page-content.dashboard-container {
        padding: 1rem 1rem 1.5rem;
    }

    #vdApp .vd-dashboard-hero {
        grid-template-columns: 1fr;
        padding: 0.85rem;
    }

    #vdApp .vd-period-panel,
    #vdApp .vd-dashboard-filter {
        align-items: stretch;
        width: 100%;
    }

    #vdApp .vd-period-status,
    #vdApp .vd-quick-range {
        justify-content: flex-start;
    }

    #vdApp .vd-dashboard-filter label,
    #vdApp .vd-dashboard-filter button {
        flex: 1 1 120px;
    }

    #vdApp .kpi-grid {
        grid-template-columns: 1fr;
    }
}
