:root {
    --sidebar: #1a2035;
    --sidebar-hover: rgba(255, 255, 255, .06);
    --sidebar-active: #6d6f74;
    --bg: #f4f6fb;
    --card: #ffffff;
    --border: #e8edf5;
    --text: #1a2035;
    --text-2: #5a6580;
    --text-3: #9aa3b8;
    --blue: #3b6ef8;
    --green: #22c55e;
    --amber: #f59e0b;
    --red: #ef4444;
    --purple: #8b5cf6;
    --cyan: #06b6d4;
    --r: 12px;
    --r-sm: 8px;
    --shadow: 0 2px 12px rgba(0, 0, 0, .06);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, .09);
    --sidebar-w: 250px;
    --topbar-h: 56px;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    height: 100vh;
    overflow: hidden;
    text-transform: uppercase;
}

/* ─── OVERLAY (mobile) ─── */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 99;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .3s;
}

.overlay.visible {
    opacity: 1;
}

/* ─── SIDEBAR ─── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: none;
    transition: transform .3s cubic-bezier(.4, 0, .2, 1), width .3s cubic-bezier(.4, 0, .2, 1);
    z-index: 100;
    position: relative;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

/* Collapsed sidebar */
body.sb-collapsed .sidebar {
    width: 58px;
    overflow: hidden;
}

body.sb-collapsed .sb-label,
body.sb-collapsed .sb-item span:not(.sb-icon),
body.sb-collapsed .sb-item .chev,
body.sb-collapsed .sb-brand h2,
body.sb-collapsed .sb-submenu {
    display: none;
}

body.sb-collapsed .sb-item {
    padding: 10px;
    justify-content: center;
    gap: 0;
}

body.sb-collapsed .sb-item.active {
    margin: 0 4px;
    padding: 10px;
}

body.sb-collapsed .sb-brand {
    padding: 18px 0;
    justify-content: center;
}

/* ─── BRAND ─── */
.sb-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    flex-shrink: 0;
}

.sb-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b6ef8, #06b6d4);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sb-brand h2 {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -.3px;
    white-space: nowrap;
    overflow: hidden;
}

.sb-section {
    padding: 10px 0 4px;
}

.sb-label {
    color: rgba(255, 255, 255, .3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 0 14px 5px;
    white-space: nowrap;
    overflow: hidden;
}

/* ─── NAV ITEM ─── */
.sb-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px;
    color: rgba(255, 255, 255, .55);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color .15s, background .15s;
    user-select: none;
    position: relative;
    white-space: nowrap;
    border-radius: var(--r-sm);
    margin: 0 8px;
}

.sb-item:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.sb-item.active {
    background: var(--sidebar-active);
    color: #fff;
    border-radius: var(--r-sm);
    margin: 0 8px;
    padding: 9px 10px;
}

.sb-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.sb-icon svg {
    width: 15px;
    height: 15px;
}

.sb-item .chev {
    margin-left: auto;
    font-size: 10px;
    opacity: .5;
    transition: transform .25s;
    flex-shrink: 0;
}

.sb-item.open .chev {
    transform: rotate(90deg);
    opacity: .8;
}

/* ─── SUBMENU ─── */
.sb-submenu {
    overflow: hidden;
    max-height: 0;
    transition: max-height .3s cubic-bezier(.4, 0, .2, 1);
    background: rgba(0, 0, 0, .15);
}

.sb-submenu.open {
    max-height: 400px;
}

.sb-sub-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px 7px 38px;
    color: rgba(255, 255, 255, .42);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: color .15s, background .15s;
    white-space: nowrap;
    border-radius: var(--r-sm);
    margin: 0 8px;
}

.sb-sub-item::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .25);
    flex-shrink: 0;
    transition: background .15s;
}

.sb-sub-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, .05);
}

.sb-sub-item:hover::before {
    background: var(--blue);
}

.sb-sub-item.active-sub {
    color: #93b4fd;
}

.sb-sub-item.active-sub::before {
    background: #93b4fd;
}

/* ─── MAIN ─── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ─── TOPBAR ─── */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    height: var(--topbar-h);
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

.topbar-toggle {
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}

.topbar-toggle:hover {
    background: var(--bg);
    color: var(--text);
}

.topbar-toggle svg {
    width: 18px;
    height: 18px;
}

.topbar-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
}

.topbar-search {
    flex: 1;
    max-width: 380px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
}

.topbar-search input {
    border: none;
    background: none;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    outline: none;
    flex: 1;
}

.topbar-search input::placeholder {
    color: var(--text-3);
}

.tb-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.tb-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    color: var(--text-2);
    font-size: 15px;
    transition: background .15s;
}

.tb-btn:hover {
    background: var(--border);
}

.tb-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    padding: 0 3px;
}

.tb-btn.plus {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

/* ─── USER DROPDOWN ─── */
.tb-user-wrap {
    position: relative;
}

.tb-user {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 10px 4px 4px;
    border-radius: 30px;
    border: 1px solid transparent;
    transition: background .15s, border-color .15s;
    user-select: none;
}

.tb-user:hover,
.tb-user.open {
    background: var(--bg);
    border-color: var(--border);
}

.tb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b6ef8, #22c55e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    position: relative;
    flex-shrink: 0;
}

.tb-avatar::after {
    content: '';
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
}

.tb-user-info h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.tb-user-info p {
    font-size: 10px;
    color: var(--text-3);
}

.tb-caret {
    color: var(--text-3);
    font-size: 10px;
    transition: transform .2s;
    margin-left: 2px;
}

.tb-user.open .tb-caret {
    transform: rotate(180deg);
}

/* Dropdown Menu */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-md);
    z-index: 200;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(.97);
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    transform-origin: top right;
}

.user-dropdown.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.ud-header {
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ud-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b6ef8, #22c55e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    position: relative;
}

.ud-avatar::after {
    content: '';
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
}

.ud-header-info h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.ud-header-info p {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 1px;
}

.ud-role-badge {
    display: inline-block;
    margin-top: 4px;
    background: #eff6ff;
    color: var(--blue);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}

.ud-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.ud-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    cursor: pointer;
    transition: background .15s, color .15s;
}

.ud-item:hover {
    background: var(--bg);
    color: var(--text);
}

.ud-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.ud-item.danger {
    color: var(--red);
}

.ud-item.danger:hover {
    background: #fff5f5;
}

/* ─── CONTENT ─── */
.content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    gap: 0;
}

.content::-webkit-scrollbar {
    width: 4px;
}

.content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.content-main {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    min-width: 0;
}

.content-main::-webkit-scrollbar {
    display: none;
}

.content-right {
    width: 268px;
    flex-shrink: 0;
    background: var(--card);
    border-left: 1px solid var(--border);
    padding: 18px 16px;
    overflow-y: auto;
}

.content-right::-webkit-scrollbar {
    display: none;
}

/* ─── STAT CARDS ─── */
.stat-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    cursor: default;
    transition: box-shadow .2s, transform .2s;
    animation: fadeUp .4s ease both;
}

.stat-card:nth-child(1) {
    animation-delay: .05s
}

.stat-card:nth-child(2) {
    animation-delay: .10s
}

.stat-card:nth-child(3) {
    animation-delay: .15s
}

.stat-card:nth-child(4) {
    animation-delay: .20s
}

.stat-card:nth-child(5) {
    animation-delay: .25s
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card.revenue-card {
    background: linear-gradient(135deg, #ef4444, #f97316);
    border-color: transparent;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    flex-shrink: 0;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat-card.revenue-card .stat-label {
    color: rgba(255, 255, 255, .75);
}

.stat-value {
    font-size: 21px;
    font-weight: 800;
    color: var(--text);
    margin: 2px 0;
    line-height: 1.1;
}

.stat-card.revenue-card .stat-value {
    color: #fff;
}

.stat-change {
    font-size: 11px;
    font-weight: 600;
    color: var(--green);
}

.stat-card.revenue-card .stat-change {
    color: rgba(255, 255, 255, .9);
}

/* ─── PANELS ─── */
.row-2 {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 12px;
    margin-bottom: 12px;
}

.row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: fadeUp .5s ease both;
    animation-delay: .3s;
}

.panel-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
}

.panel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.panel-select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    font-family: inherit;
}

.panel-body {
    padding: 14px 16px;
}

/* Funnel */
.funnel-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px 14px;
}

.funnel-chart {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.funnel-stage {
    display: flex;
    align-items: center;
    gap: 10px;
}

.funnel-label {
    width: 90px;
    text-align: right;
}

.funnel-label-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.funnel-label-count {
    font-size: 10px;
    color: var(--text-3);
}

.funnel-bar-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.funnel-bar {
    height: 32px;
    border-radius: 6px;
    transition: width .8s cubic-bezier(.34, 1.3, .64, 1);
    min-width: 28px;
}

.funnel-val {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}

.chart-wrap {
    position: relative;
    height: 210px;
}

/* Right Sidebar */
.rs-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

.reminder-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}

.reminder-item:last-of-type {
    border-bottom: none;
}

.reminder-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.reminder-body h4 {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
}

.reminder-body p {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 1px;
}

.view-link {
    color: var(--blue);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    display: inline-block;
}

.view-link:hover {
    text-decoration: underline;
}

.rs-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 12px 0;
}

.qa-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    margin-bottom: 7px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background .15s, transform .1s;
    background: var(--bg);
    color: var(--text);
}

.qa-btn:hover {
    background: var(--border);
    transform: translateX(2px);
}

.qa-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.donut-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.donut-container {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.donut-container canvas {
    width: 100px !important;
    height: 100px !important;
}

.source-legend .s-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}

.source-legend .s-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.source-legend .s-label {
    font-size: 11px;
    color: var(--text-2);
    flex: 1;
}

.source-legend .s-pct {
    font-size: 11px;
    font-weight: 700;
    color: var(--text);
}

/* Activity / Tasks / Customers */
.act-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.act-ic {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.act-body {
    flex: 1;
    min-width: 0;
}

.act-body h4 {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.act-body p {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 1px;
}

.act-time {
    font-size: 11px;
    color: var(--text-3);
    white-space: nowrap;
    margin-left: auto;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.task-ic {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
}

.task-body {
    flex: 1;
    min-width: 0;
}

.task-body h4 {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
}

.task-body p {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 1px;
}

.task-date {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    align-self: center;
}

.task-date.today {
    background: #fef2f2;
    color: var(--red);
}

.task-date.tomorrow {
    background: #fffbeb;
    color: var(--amber);
}

.task-date.future {
    background: #eff6ff;
    color: var(--blue);
}

.cust-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

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

.cust-logo {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.cust-name {
    flex: 1;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
}

.cust-revenue {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.live {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--green);
}

.live::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: pulse 1.4s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1)
    }

    50% {
        opacity: .4;
        transform: scale(.75)
    }
}

/* ─── MOBILE ─── */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        width: 240px !important;
        z-index: 100;
        box-shadow: var(--shadow-md);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    body.sb-collapsed .sidebar {
        width: 240px !important;
    }

    body.sb-collapsed .sb-label,
    body.sb-collapsed .sb-item span:not(.sb-icon),
    body.sb-collapsed .sb-item .chev,
    body.sb-collapsed .sb-brand h2,
    body.sb-collapsed .sb-submenu {
        display: revert;
    }

    body.sb-collapsed .sb-item {
        padding: 9px 14px;
        justify-content: flex-start;
        gap: 9px;
    }

    body.sb-collapsed .sb-item.active {
        margin: 0 8px;
        padding: 9px 10px;
    }

    body.sb-collapsed .sb-brand {
        padding: 20px 14px 16px;
        justify-content: flex-start;
    }

    .overlay {
        display: block;
    }

    .content-right {
        display: none;
    }

    .stat-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card:nth-child(5) {
        grid-column: span 2;
    }

    .row-2 {
        grid-template-columns: 1fr;
    }

    .row-3 {
        grid-template-columns: 1fr;
    }

    .topbar-search {
        display: none;
    }
}

@media (max-width: 480px) {
    .stat-row {
        grid-template-columns: 1fr 1fr;
    }

    .tb-user-info {
        display: none;
    }

    .tb-caret {
        display: none;
    }
}