/* Sidebar */
.sidebar-logo { padding: var(--sp-5) var(--sp-4); display: flex; align-items: center; gap: var(--sp-3); border-bottom: 1px solid var(--border-color); }
.sidebar-logo .logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--color-primary), var(--color-accent)); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-weight: var(--fw-extrabold); color: #fff; font-size: var(--fs-lg); flex-shrink: 0; }
.sidebar-logo .logo-text { font-size: var(--fs-lg); font-weight: var(--fw-bold); color: var(--text-primary); }
.sidebar-logo .logo-text span { color: var(--color-primary-light); }
.collapsed .logo-text { display: none; }

.sidebar-nav { flex: 1; padding: var(--sp-3); overflow-y: auto; }
.nav-section { margin-bottom: var(--sp-4); }
.nav-section-title { font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; padding: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-1); }
.collapsed .nav-section-title { display: none; }
.nav-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer; transition: all var(--t-fast); font-size: var(--fs-sm); font-weight: var(--fw-medium); position: relative; }
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active { background: rgba(var(--color-primary-rgb), 0.1); color: var(--color-primary-light); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 60%; background: var(--color-primary); border-radius: 0 2px 2px 0; }

/* Profit Engine nav item — yellowish/amber accent */
.nav-profit-engine { color: #F59E0B; }
.nav-profit-engine:hover { color: #FBBF24; background: rgba(245, 158, 11, 0.08); }
.nav-profit-engine.active { color: #FBBF24; background: rgba(245, 158, 11, 0.12); }
.nav-profit-engine.active::before { background: #F59E0B; }
.nav-profit-engine svg { color: #F59E0B; }
.nav-item svg, .nav-item .nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item .nav-label { flex: 1; }
.collapsed .nav-label { display: none; }
.nav-item .nav-badge { background: var(--color-primary); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: var(--radius-full); font-weight: var(--fw-semibold); }

.sidebar-footer { padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--border-color); }
.sidebar-user-dropdown { position: relative; }
.sidebar-user { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-2); border-radius: var(--radius-sm); cursor: pointer; transition: background var(--t-fast); }
.sidebar-user:hover { background: var(--bg-card); }
.sidebar-user-info { flex: 1; overflow: hidden; }
.sidebar-user-name { font-size: 0.8rem; font-weight: var(--fw-medium); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-chevron { color: var(--text-muted); flex-shrink: 0; opacity: 0.5; transition: opacity var(--t-fast); }
.sidebar-user-chevron svg { width: 14px; height: 14px; }
.sidebar-user:hover .sidebar-user-chevron { opacity: 1; }
.sidebar-user-menu { bottom: calc(100% + 6px); top: auto; left: 0; right: 0; }
.collapsed .sidebar-user-info { display: none; }
.collapsed .sidebar-user-chevron { display: none; }

/* Topbar */
.topbar-left { display: flex; align-items: center; gap: var(--sp-3); flex: 1; }
.topbar-toggle { display: none; cursor: pointer; padding: var(--sp-2); color: var(--text-secondary); }
@media (max-width: 1024px) { .topbar-toggle { display: flex; } }
.topbar-breadcrumb { font-size: var(--fs-sm); color: var(--text-muted); }
.topbar-breadcrumb span { color: var(--text-primary); font-weight: var(--fw-medium); }
.topbar-search { position: relative; max-width: 320px; flex: 1; }
.topbar-search input { background: var(--bg-input); border-color: transparent; font-size: var(--fs-sm); padding: var(--sp-2) var(--sp-3) var(--sp-2) 36px; border-radius: var(--radius-full); }
.topbar-search input:focus { border-color: var(--color-primary); background: var(--bg-card); }
.topbar-right { display: flex; align-items: center; gap: var(--sp-3); }
.topbar-icon-btn { position: relative; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary); transition: all var(--t-fast); }
.topbar-icon-btn svg { width: 18px; height: 18px; }
.topbar-icon-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.topbar-icon-btn .notif-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; background: var(--color-danger); border-radius: 50%; border: 2px solid var(--bg-secondary); }

/* Dashboard welcome */
.welcome-banner { background: linear-gradient(135deg, var(--color-primary-dark) 0%, rgba(var(--color-primary-rgb), 0.3) 100%); border-radius: var(--radius-md); padding: var(--sp-5) var(--sp-5); margin-bottom: var(--sp-4); position: relative; overflow: hidden; }
.welcome-banner::after { content: ''; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; background: rgba(255,255,255,0.05); border-radius: 50%; pointer-events: none; }
.welcome-banner h2 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: #fff; margin-bottom: 2px; }
.welcome-banner p { color: rgba(255,255,255,0.65); font-size: var(--fs-sm); max-width: 500px; margin: 0; }

/* Kanban board */
.kanban-board { display: flex; gap: var(--sp-4); overflow-x: auto; padding-bottom: var(--sp-4); min-height: 400px; align-items: flex-start; }
.kanban-column { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md); min-width: 280px; width: 280px; flex-shrink: 0; display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.kanban-column-header { padding: var(--sp-3) var(--sp-4); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-color); }
.kanban-column-title { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.kanban-column-count { font-size: var(--fs-xs); color: var(--text-muted); background: var(--bg-input); padding: 1px 8px; border-radius: var(--radius-full); }
.kanban-column-body { padding: var(--sp-3); flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-2); min-height: 80px; }
.kanban-column-body.drag-over { background: rgba(var(--color-primary-rgb), 0.05); border: 2px dashed var(--color-primary); border-radius: var(--radius-sm); }
.kanban-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: var(--sp-3); cursor: grab; transition: all var(--t-fast); }
.kanban-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-sm); }
.kanban-card.dragging { opacity: 0.5; transform: rotate(2deg); }
.kanban-card-title { font-size: var(--fs-sm); font-weight: var(--fw-medium); margin-bottom: var(--sp-2); }
.kanban-card-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.kanban-card-tags { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.kanban-add-task { padding: var(--sp-2) var(--sp-3); text-align: center; color: var(--text-muted); font-size: var(--fs-sm); cursor: pointer; border-radius: var(--radius-sm); transition: all var(--t-fast); margin: var(--sp-2) var(--sp-3) var(--sp-3); }
.kanban-add-task:hover { background: var(--bg-card); color: var(--text-primary); }

/* Chat UI */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; height: calc(100vh - var(--topbar-height) - 48px); gap: 0; border: 1px solid var(--border-color); border-radius: var(--radius-md); overflow: hidden; }
.chat-sidebar { background: var(--bg-secondary); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; }
.chat-sidebar-header { padding: var(--sp-4); border-bottom: 1px solid var(--border-color); }
.chat-sidebar-list { flex: 1; overflow-y: auto; padding: var(--sp-2); }
.chat-session-item { padding: var(--sp-3); border-radius: var(--radius-sm); cursor: pointer; transition: background var(--t-fast); margin-bottom: var(--sp-1); }
.chat-session-item:hover { background: var(--bg-card); }
.chat-session-item.active { background: rgba(var(--color-primary-rgb), 0.1); }
.chat-session-title { font-size: var(--fs-sm); font-weight: var(--fw-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-session-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.chat-main { display: flex; flex-direction: column; background: var(--bg-primary); }
.chat-messages { flex: 1; overflow-y: auto; padding: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }
.chat-message { display: flex; gap: var(--sp-3); max-width: 80%; animation: fadeUp var(--t-normal); }
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message-bubble { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-md); font-size: var(--fs-sm); line-height: var(--lh-relaxed); }
.chat-message.assistant .chat-message-bubble { background: var(--bg-card); border: 1px solid var(--border-color); }
.chat-message.user .chat-message-bubble { background: var(--color-primary); color: #fff; }
.chat-input-area { padding: var(--sp-4); border-top: 1px solid var(--border-color); background: var(--bg-secondary); }
.chat-input-wrap { display: flex; gap: var(--sp-2); align-items: flex-end; }
.chat-input-wrap textarea { min-height: 44px; max-height: 120px; resize: none; border-radius: var(--radius-md); }
.typing-indicator { display: flex; gap: 4px; padding: var(--sp-3) var(--sp-4); }
.typing-dot { width: 8px; height: 8px; background: var(--text-muted); border-radius: 50%; animation: typingBounce 1.4s ease infinite; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* Assessment / Onboarding */
.assessment-wizard { max-width: 700px; margin: 0 auto; }
.assessment-progress { margin-bottom: var(--sp-8); }
.assessment-progress-bar { height: 4px; background: var(--bg-input); border-radius: var(--radius-full); margin-top: var(--sp-2); }
.assessment-progress-fill { height: 100%; background: linear-gradient(90deg, var(--color-primary), var(--color-accent)); border-radius: var(--radius-full); transition: width var(--t-slow); }
.assessment-step-count { font-size: var(--fs-xs); color: var(--text-muted); }
.assessment-category { font-size: var(--fs-xs); color: var(--color-primary-light); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--sp-2); }
.assessment-question { font-size: var(--fs-xl); font-weight: var(--fw-semibold); margin-bottom: var(--sp-6); line-height: var(--lh-tight); }
.assessment-help { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-4); }

/* Scale input (1-10) */
.scale-input { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.scale-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); border: 1px solid var(--border-color); background: var(--bg-input); font-weight: var(--fw-semibold); cursor: pointer; transition: all var(--t-fast); }
.scale-btn:hover { border-color: var(--color-primary); color: var(--color-primary-light); }
.scale-btn.selected { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.scale-labels { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--text-muted); }

/* Assessment results */
.assessment-results { }
.score-ring { width: 160px; height: 160px; margin: 0 auto var(--sp-6); }
.category-scores { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.category-score-item { }
.category-score-label { font-size: var(--fs-sm); font-weight: var(--fw-medium); margin-bottom: var(--sp-1); display: flex; justify-content: space-between; }
.category-score-value { color: var(--color-primary-light); }

/* Referral section */
.referral-card { background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.1), rgba(0, 206, 201, 0.1)); border: 1px solid rgba(var(--color-primary-rgb), 0.3); }
.referral-link { display: flex; gap: var(--sp-2); }
.referral-link input { flex: 1; background: var(--bg-primary); }
.referral-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); margin-top: var(--sp-4); }
.referral-stat { text-align: center; }
.referral-stat-value { font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--color-primary-light); }
.referral-stat-label { font-size: var(--fs-xs); color: var(--text-muted); }

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-primary); padding: var(--sp-4); }
.login-card { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: var(--sp-10); text-align: center; max-width: 440px; width: 100%; }
.login-logo { margin-bottom: var(--sp-6); }
.login-logo .logo-icon { width: 56px; height: 56px; background: linear-gradient(135deg, var(--color-primary), var(--color-accent)); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-weight: var(--fw-extrabold); color: #fff; font-size: var(--fs-xl); margin: 0 auto var(--sp-4); }
.login-logo h1 { font-size: var(--fs-2xl); font-weight: var(--fw-bold); }
.login-logo h1 span { color: var(--color-primary-light); }
.login-subtitle { color: var(--text-muted); margin-bottom: var(--sp-8); font-size: var(--fs-sm); }
.google-btn { display: inline-flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-6); background: #fff; color: #333; border-radius: var(--radius-sm); font-weight: var(--fw-medium); font-size: var(--fs-md); cursor: pointer; transition: all var(--t-fast); border: 1px solid #ddd; }
.google-btn:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.google-btn svg { width: 20px; height: 20px; }
.login-footer { margin-top: var(--sp-8); font-size: var(--fs-xs); color: var(--text-muted); }

/* Onboarding Wizard */
.ob-wizard { max-width: 680px; margin: 0 auto; padding: 32px 16px; }
.ob-progress { display: flex; gap: 4px; margin-bottom: 28px; }
.ob-progress-dot { flex: 1; height: 4px; border-radius: 99px; background: var(--glass-track, var(--border-color)); transition: background 0.3s; }
.ob-progress-dot.active { background: var(--color-primary); }
.ob-progress-dot.done { background: var(--color-success); }

.ob-stage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; overflow: visible; }
.ob-stage-card { position: relative; padding: 16px 12px; border-radius: var(--radius-md); border: 2px solid var(--border-color); cursor: pointer; text-align: center; transition: all 0.2s; background: var(--bg-card); }
.ob-stage-card:hover { border-color: var(--stage-color); background: color-mix(in srgb, var(--stage-color) 5%, transparent); transform: translateY(-2px); z-index: 50; }
.ob-stage-card.selected { border-color: var(--stage-color); background: color-mix(in srgb, var(--stage-color) 12%, transparent); transform: scale(1.03); box-shadow: 0 4px 20px color-mix(in srgb, var(--stage-color) 20%, transparent); }

.ob-tooltip { display: none; position: absolute; left: 50%; transform: translateX(-50%); top: calc(100% + 8px); width: 260px; padding: 12px 14px; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); font-size: 0.78rem; line-height: 1.5; color: var(--text-secondary); text-align: left; z-index: 999; pointer-events: none; }
.ob-stage-card:hover .ob-tooltip { display: block; }

.ob-input-row { margin-bottom: 16px; }
.ob-input-row label { display: block; font-size: 0.9rem; color: var(--text-primary); margin-bottom: 6px; font-weight: 500; }
.ob-input-row input, .ob-input-row select { width: 100%; }

.ob-toggle-group { display: flex; gap: 8px; }
.ob-toggle { padding: 8px 24px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); background: var(--bg-input); cursor: pointer; font-weight: 600; font-size: 0.85rem; color: var(--text-secondary); transition: all 0.15s; }
.ob-toggle:hover { border-color: var(--color-primary); }
.ob-toggle.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.ob-report-stat { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; }
.ob-stat-val { font-weight: 700; color: var(--text-primary); }

/* Growth Report Card */
.growth-report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.gr-stat-box { text-align: center; padding: 10px 8px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--gr-color, var(--color-primary)) 6%, transparent); border: 1px solid color-mix(in srgb, var(--gr-color, var(--color-primary)) 14%, transparent); }
.gr-stat-box-dark { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1); }
.gr-stat-highlight-dark { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18); }
.gr-stat-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 4px; }
.gr-stat-value { font-size: 1.05rem; font-weight: 900; color: var(--text-primary); line-height: 1.3; }
.gr-stat-big { font-size: 1.8rem; font-weight: 900; color: var(--gr-color, var(--color-primary)); line-height: 1; }
.gr-stat-mid { font-size: 1.15rem; font-weight: 800; color: var(--text-primary); }
.gr-stat-sub { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); margin-top: 2px; }
.gr-arrow { color: var(--text-muted); font-weight: 400; font-size: 0.9em; }
.gr-stat-highlight { background: color-mix(in srgb, var(--gr-color) 8%, transparent); border: 1px solid color-mix(in srgb, var(--gr-color) 20%, transparent); }

@media (max-width: 640px) {
    .chat-layout { grid-template-columns: 1fr; }
    .chat-sidebar { display: none; }
    .kanban-board { padding: 0; }
    .kanban-column { min-width: 260px; }
    .ob-stage-grid { grid-template-columns: repeat(2, 1fr); }
    .ob-tooltip { width: 200px; font-size: 0.72rem; }
    .growth-report-grid { grid-template-columns: repeat(2, 1fr); }
}
