/**
 * =====================================================
 * Sosyotik Design System v3.0 — Layout Module
 * Top Navigation Header + Footer
 * Mobile-First Responsive Architecture
 * =====================================================
 *
 * Inspired by: Linear, Vercel, Stripe, Notion, Clerk
 * Architecture: Fixed top-nav → content → footer
 * NO sidebar — everything is top-aligned
 * Mobile-first breakpoints: 768px, 1024px, 1200px
 *
 * Z-Index uses DS scale:
 *   Header: --ds-z-sticky (200)
 *   Dropdowns: --ds-z-overlay (500)
 *   Mobile Nav: --ds-z-modal (1000)
 *   Toast/Confirm: --ds-z-toast (1500)
 * =====================================================
 */


/* =====================================================
   0. BASE RESET & LAYOUT TOKENS
   ===================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--ds-font, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif);
    font-size: var(--ds-text-base, 13px);
    line-height: var(--ds-leading-normal, 1.5);
    color: var(--ds-gray-800, #27272a);
    background: var(--ds-gray-50, #fafafa);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

:root {
    /* ── Layout Dimensions ── */
    --ds-header-h: 56px;
    --ds-footer-h: 44px;
    --ds-content-max: 1360px;

    /* ── Header Theming ── */
    --ds-header-bg: rgba(255, 255, 255, 0.82);
    --ds-header-border: var(--ds-gray-150, #ececee);
    --ds-header-blur: 16px;

    /* ── Footer Theming ── */
    --ds-footer-bg: var(--ds-gray-25, #fcfcfd);
    --ds-footer-border: var(--ds-gray-100, #f4f4f5);
}


/* =====================================================
   1. PAGE SHELL
   ===================================================== */
.ds-layout {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.ds-layout-content {
    flex: 1 1 auto;
    padding-top: var(--ds-header-h);
}

.ds-layout-content > .content-body {
    width: 100%;
    max-width: var(--ds-content-max, 1360px);
    margin: 0 auto;
    padding: 28px 24px;
}

/* Full-width page override (chat, etc.) */
.ds-layout-content.full-width-page > .content-body {
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
}

/* Override ds-container inside new layout — center it */
.ds-layout-content .ds-container {
    max-width: var(--ds-content-max, 1360px);
    margin-left: auto;
    margin-right: auto;
}


/* =====================================================
   2. HEADER — Glassmorphic Top Nav
   ===================================================== */
.ds-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--ds-header-h);
    background: var(--ds-header-bg);
    -webkit-backdrop-filter: saturate(180%) blur(var(--ds-header-blur));
    backdrop-filter: saturate(180%) blur(var(--ds-header-blur));
    border-bottom: 1px solid var(--ds-header-border);
    z-index: var(--ds-z-sticky, 200);
    display: flex;
    align-items: center;
    transition: box-shadow var(--ds-duration, 150ms) var(--ds-ease, ease);
}

.ds-header.scrolled {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.02);
}

.ds-header-inner {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
}


/* ── Logo ── */
.ds-header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 4px;
}

.ds-header-logo-img {
    height: 26px;
    width: auto;
    object-fit: contain;
}

.ds-header-logo-mark {
    width: 30px;
    height: 30px;
    background: var(--ds-accent, #4f46e5);
    border-radius: var(--ds-radius, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.ds-header-logo-mark::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 60%);
    border-radius: inherit;
    pointer-events: none;
}

.ds-header-logo-mark img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    position: relative;
    z-index: 1;
}

.ds-header-logo-text {
    font-size: 15px;
    font-weight: 650;
    color: var(--ds-gray-900, #18181b);
    letter-spacing: -0.3px;
    display: none;
}


/* ── Separator ── */
.ds-header-sep {
    width: 1px;
    height: 20px;
    background: var(--ds-gray-200, #e4e4e7);
    margin: 0 6px;
    flex-shrink: 0;
    display: none;
}


/* ── Workspace / Tenant Selector ── */
.ds-header-workspace {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: var(--ds-radius, 8px);
    cursor: pointer;
    transition: background var(--ds-duration-fast, 100ms);
    flex-shrink: 0;
    border: none;
    background: none;
    font-family: inherit;
}

.ds-header-workspace:hover {
    background: var(--ds-gray-100, #f4f4f5);
}

.ds-header-workspace-name {
    font-size: 13px;
    font-weight: 550;
    color: var(--ds-gray-700, #3f3f46);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ds-header-workspace-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--ds-radius-xs, 4px);
    background: var(--ds-accent-light, rgba(79, 70, 229, 0.06));
    color: var(--ds-accent, #4f46e5);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.ds-header-workspace-chevron {
    font-size: 14px;
    color: var(--ds-gray-400, #a1a1aa);
    transition: transform var(--ds-duration, 150ms);
}

/* ── Workspace Wrapper (dropdown container) ── */
.ds-header-workspace-wrap {
    position: relative;
    display: none;
}

.ds-header-workspace-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: auto;
    width: 260px;
}


/* ── Live Visitor Stats (header) ── */
.ds-header-live {
    display: none;
    align-items: center;
    gap: 2px;
}

.ds-header-live-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--ds-radius, 8px);
    font-size: 13px;
    font-weight: 600;
    color: var(--ds-gray-500, #71717a);
    text-decoration: none;
    transition: all var(--ds-duration-fast, 100ms);
    position: relative;
}

.ds-header-live-item:hover {
    background: var(--ds-gray-100, #f4f4f5);
    color: var(--ds-gray-700, #3f3f46);
}

.ds-header-live-item i {
    font-size: 16px;
}

.ds-header-live-count {
    font-variant-numeric: tabular-nums;
    min-width: 12px;
    text-align: center;
}

/* Live dot indicator */
.ds-header-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ds-gray-300, #d4d4d8);
    flex-shrink: 0;
    transition: background 0.3s;
}

.ds-header-live-dot.pulse {
    animation: dsLivePulse 2s infinite;
}

.ds-header-live-dot--web.pulse {
    background: #10b981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
}

.ds-header-live-dot--land.pulse {
    background: #8b5cf6;
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.5);
}

@keyframes dsLivePulse {
    0% { box-shadow: 0 0 0 0 currentColor; }
    50% { box-shadow: 0 0 0 4px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* Active state: has visitors */
.ds-header-live-item.has-visitors {
    color: var(--ds-gray-800, #27272a);
}

.ds-header-live-item.has-visitors i {
    color: var(--ds-accent, #4f46e5);
}

.ds-header-live-item.has-visitors .ds-header-live-count {
    color: var(--ds-gray-900, #18181b);
}

/* ── Nav More Wrapper (dropdown container) ── */
.ds-header-nav-more-wrap {
    position: relative;
}

.ds-header-nav-more-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    background: var(--ds-white, #fff);
    border: 1px solid var(--ds-gray-200, #e4e4e7);
    border-radius: var(--ds-radius-lg, 12px);
    box-shadow: var(--ds-shadow-lg, 0 8px 16px -4px rgba(0,0,0,0.06), 0 16px 32px -8px rgba(0,0,0,0.1));
    padding: 6px;
    z-index: var(--ds-z-overlay, 500);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-4px) scale(0.98);
    transition: all var(--ds-duration, 150ms) cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.ds-header-nav-more-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

.ds-header-nav-more-group {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ds-gray-400, #a1a1aa);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ds-header-nav-more-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ds-gray-600, #52525b);
    text-decoration: none;
    border-radius: var(--ds-radius, 8px);
    transition: all var(--ds-duration-fast, 100ms);
}

.ds-header-nav-more-item i {
    font-size: 17px;
    color: var(--ds-gray-400, #a1a1aa);
    flex-shrink: 0;
}

.ds-header-nav-more-item:hover {
    background: var(--ds-gray-50, #fafafa);
    color: var(--ds-gray-900, #18181b);
}

.ds-header-nav-more-item:hover i {
    color: var(--ds-accent, #4f46e5);
}

.ds-header-nav-more-item.active {
    background: var(--ds-accent-light, rgba(79, 70, 229, 0.06));
    color: var(--ds-accent, #4f46e5);
}

.ds-header-nav-more-item.active i {
    color: var(--ds-accent, #4f46e5);
}

.ds-header-nav-more-item .ds-header-nav-menu-badge {
    margin-left: auto;
}


/* ── Mega Menu ── */
.ds-mega-trigger-wrap {
    position: relative;
}

.ds-mega-trigger {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

.ds-mega-trigger-chevron {
    font-size: 12px !important;
    color: var(--ds-gray-400, #a1a1aa);
    transition: transform var(--ds-duration, 150ms);
    margin-left: -2px;
}

.ds-mega-trigger.active .ds-mega-trigger-chevron {
    transform: rotate(180deg);
}

.ds-mega-trigger.active {
    color: var(--ds-accent, #4f46e5);
    background: var(--ds-accent-light, rgba(79, 70, 229, 0.06));
}

/* Mega overlay */
.ds-mega-overlay {
    position: fixed;
    inset: 0;
    top: var(--ds-header-h);
    background: rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: calc(var(--ds-z-sticky, 200) - 1);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--ds-duration, 150ms), visibility var(--ds-duration, 150ms);
}

.ds-mega-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mega menu — compact dropdown with tabs */
.ds-mega-menu {
    position: fixed;
    top: var(--ds-header-h);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    z-index: var(--ds-z-sticky, 200);
    width: 580px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - var(--ds-header-h) - 40px);
    background: var(--ds-white, #fff);
    border: 1px solid var(--ds-gray-200, #e4e4e7);
    border-radius: var(--ds-radius-lg, 12px);
    box-shadow:
        0 8px 24px -4px rgba(0, 0, 0, 0.08),
        0 20px 48px -8px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 180ms cubic-bezier(0.16, 1, 0.3, 1),
        visibility 180ms,
        transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    display: flex;
    overflow: hidden;
}

.ds-mega-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* ── Tab Sidebar ── */
.ds-mega-tabs {
    width: 160px;
    flex-shrink: 0;
    background: var(--ds-gray-50, #fafafa);
    border-right: 1px solid var(--ds-gray-100, #f4f4f5);
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.ds-mega-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: none;
    background: none;
    border-radius: var(--ds-radius-sm, 6px);
    cursor: pointer;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ds-gray-500, #71717a);
    text-align: left;
    transition: all 100ms ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.ds-mega-tab:hover {
    background: var(--ds-gray-100, #f4f4f5);
    color: var(--ds-gray-700, #3f3f46);
}

.ds-mega-tab.active {
    background: var(--ds-white, #fff);
    color: var(--ds-gray-900, #18181b);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
}

.ds-mega-tab-dot {
    width: 7px;
    height: 7px;
    border-radius: var(--ds-radius-full, 9999px);
    background: var(--tab-color, var(--ds-gray-300));
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 100ms;
}

.ds-mega-tab.active .ds-mega-tab-dot {
    opacity: 1;
}

.ds-mega-tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tab sidebar footer — quick icons */
.ds-mega-tabs-footer {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--ds-gray-150, #ececee);
    display: flex;
    justify-content: center;
    gap: 4px;
}

.ds-mega-tabs-link {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ds-radius-sm, 6px);
    color: var(--ds-gray-400, #a1a1aa);
    font-size: 16px;
    text-decoration: none;
    transition: all 100ms;
}

.ds-mega-tabs-link:hover {
    color: var(--ds-gray-700, #3f3f46);
    background: var(--ds-gray-100, #f4f4f5);
}

/* ── Tab Panels ── */
.ds-mega-panels {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ds-mega-panel {
    display: none;
    padding: 12px;
}

.ds-mega-panel.active {
    display: block;
}

.ds-mega-panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
}

/* ── Menu Items ── */
.ds-mega-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--ds-radius, 8px);
    text-decoration: none;
    transition: background 100ms ease;
}

.ds-mega-item:hover {
    background: var(--ds-gray-50, #fafafa);
}

.ds-mega-item.active {
    background: var(--ds-accent-light, rgba(79, 70, 229, 0.06));
}

.ds-mega-item-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--ds-radius-sm, 6px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    transition: transform 100ms ease;
}

.ds-mega-item:hover .ds-mega-item-icon {
    transform: scale(1.06);
}

.ds-mega-item-label {
    font-size: 12.5px;
    font-weight: 520;
    color: var(--ds-gray-700, #3f3f46);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.ds-mega-item.active .ds-mega-item-label {
    color: var(--ds-accent, #4f46e5);
    font-weight: 600;
}


/* ── Primary Navigation ── */
.ds-header-nav {
    display: none;
    align-items: center;
    gap: 1px;
    margin: 0 8px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.ds-header-nav::-webkit-scrollbar {
    display: none;
}

.ds-header-nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: var(--ds-text-base, 13px);
    font-weight: 500;
    color: var(--ds-gray-500, #71717a);
    text-decoration: none;
    border-radius: var(--ds-radius-sm, 6px);
    transition: color var(--ds-duration-fast, 100ms), background var(--ds-duration-fast, 100ms);
    white-space: nowrap;
    position: relative;
    flex-shrink: 0;
}

.ds-header-nav-item i {
    font-size: 17px;
    flex-shrink: 0;
}

.ds-header-nav-item:hover {
    color: var(--ds-gray-800, #27272a);
    background: var(--ds-gray-100, #f4f4f5);
}

.ds-header-nav-item.active {
    color: var(--ds-gray-900, #18181b);
    font-weight: 600;
}

.ds-header-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 8px;
    right: 8px;
    height: 2px;
    background: var(--ds-accent, #4f46e5);
    border-radius: 2px 2px 0 0;
}

/* Nav badge (unread count) */
.ds-header-nav-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 0 5px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    border-radius: var(--ds-radius-full, 9999px);
    background: var(--ds-danger, #dc2626);
    color: #fff;
    line-height: 1;
}

/* Menu badge (from DB) */
.ds-header-nav-menu-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 0 6px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    border-radius: var(--ds-radius-full, 9999px);
    line-height: 1;
}

.ds-header-nav-menu-badge.primary { background: var(--ds-accent-light); color: var(--ds-accent); }
.ds-header-nav-menu-badge.success { background: var(--ds-success-light); color: var(--ds-success); }
.ds-header-nav-menu-badge.warning { background: var(--ds-warning-light); color: var(--ds-warning); }
.ds-header-nav-menu-badge.danger  { background: var(--ds-danger-light);  color: var(--ds-danger);  }
.ds-header-nav-menu-badge.info    { background: var(--ds-info-light);    color: var(--ds-info);    }

/* ── Nav Overflow Dropdown ── */
.ds-header-nav-more {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: var(--ds-text-base, 13px);
    font-weight: 500;
    color: var(--ds-gray-500, #71717a);
    border: none;
    background: none;
    border-radius: var(--ds-radius-sm, 6px);
    cursor: pointer;
    transition: color var(--ds-duration-fast, 100ms), background var(--ds-duration-fast, 100ms);
    font-family: inherit;
}

.ds-header-nav-more:hover {
    color: var(--ds-gray-800, #27272a);
    background: var(--ds-gray-100, #f4f4f5);
}


/* ── Right Actions ── */
.ds-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
}

/* Search trigger button */
.ds-header-search-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--ds-radius, 8px);
    font-size: 18px;
    color: var(--ds-gray-500, #71717a);
    cursor: pointer;
    transition: all var(--ds-duration-fast, 100ms);
    font-family: inherit;
}

.ds-header-search-btn:hover {
    color: var(--ds-gray-800, #27272a);
    background: var(--ds-gray-100, #f4f4f5);
}

.ds-header-search-btn-text,
.ds-header-search-kbd {
    display: none;
}

/* Icon buttons */
.ds-header-icon-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--ds-gray-500, #71717a);
    border-radius: var(--ds-radius, 8px);
    cursor: pointer;
    transition: color var(--ds-duration-fast, 100ms), background var(--ds-duration-fast, 100ms);
    position: relative;
    font-size: 18px;
    text-decoration: none;
}

.ds-header-icon-btn:hover {
    color: var(--ds-gray-800, #27272a);
    background: var(--ds-gray-100, #f4f4f5);
}

.ds-header-badge-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    background: var(--ds-danger, #dc2626);
    border-radius: 50%;
    border: 2px solid var(--ds-white, #fff);
}

/* Separator between action groups */
.ds-header-actions-sep {
    width: 1px;
    height: 20px;
    background: var(--ds-gray-200, #e4e4e7);
    margin: 0 4px;
    display: none;
}


/* ── User Profile Button ── */
.ds-header-profile {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px;
    border-radius: var(--ds-radius, 8px);
    cursor: pointer;
    transition: background var(--ds-duration-fast, 100ms);
    position: relative;
    border: none;
    background: none;
    font-family: inherit;
}

.ds-header-profile:hover {
    background: var(--ds-gray-100, #f4f4f5);
}

.ds-header-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ds-gray-150, #ececee);
    flex-shrink: 0;
}

.ds-header-avatar-fallback {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--ds-accent-light, rgba(79, 70, 229, 0.06));
    color: var(--ds-accent, #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.ds-header-profile-info {
    display: none;
    flex-direction: column;
    min-width: 0;
}

.ds-header-profile-name {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ds-gray-800, #27272a);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
}

.ds-header-profile-role {
    font-size: 11px;
    color: var(--ds-gray-400, #a1a1aa);
    line-height: 1.2;
}

.ds-header-profile-chevron {
    font-size: 14px;
    color: var(--ds-gray-400, #a1a1aa);
    display: none;
}


/* ── Profile Dropdown ── */
.ds-header-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 280px;
    background: var(--ds-white, #fff);
    border: 1px solid var(--ds-gray-200, #e4e4e7);
    border-radius: var(--ds-radius-lg, 12px);
    box-shadow: var(--ds-shadow-lg, 0 8px 16px -4px rgba(0,0,0,0.06), 0 16px 32px -8px rgba(0,0,0,0.1));
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px) scale(0.98);
    transition: all var(--ds-duration, 150ms) cubic-bezier(0.16, 1, 0.3, 1);
    z-index: var(--ds-z-overlay, 500);
    padding: 6px;
    pointer-events: none;
}

.ds-header-profile.open .ds-header-dropdown,
.ds-header-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.ds-header-dropdown-header {
    padding: 12px;
    border-bottom: 1px solid var(--ds-gray-100, #f4f4f5);
    margin-bottom: 4px;
}

.ds-header-dropdown-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ds-gray-900, #18181b);
}

.ds-header-dropdown-email {
    font-size: 12px;
    color: var(--ds-gray-400, #a1a1aa);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* AI Balance card */
.ds-header-dropdown-balance {
    margin: 4px 0;
    padding: 12px;
    background: linear-gradient(135deg, var(--ds-accent-light, rgba(79,70,229,0.06)) 0%, rgba(79, 70, 229, 0.02) 100%);
    border: 1px solid var(--ds-accent-border, rgba(79, 70, 229, 0.12));
    border-radius: var(--ds-radius, 8px);
}

.ds-header-dropdown-balance-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--ds-gray-500, #71717a);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ds-header-dropdown-balance-label i {
    color: var(--ds-accent, #4f46e5);
    font-size: 14px;
}

.ds-header-dropdown-balance-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--ds-gray-900, #18181b);
    margin-top: 4px;
    letter-spacing: -0.5px;
}

.ds-header-dropdown-balance-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ds-accent, #4f46e5);
    text-decoration: none;
    transition: opacity var(--ds-duration-fast, 100ms);
}

.ds-header-dropdown-balance-action:hover {
    opacity: 0.8;
}

/* Dropdown items */
.ds-header-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ds-gray-600, #52525b);
    text-decoration: none;
    border-radius: var(--ds-radius, 8px);
    transition: background var(--ds-duration-fast, 100ms), color var(--ds-duration-fast, 100ms);
}

.ds-header-dropdown-item i {
    font-size: 16px;
    color: var(--ds-gray-400, #a1a1aa);
    flex-shrink: 0;
}

.ds-header-dropdown-item:hover {
    background: var(--ds-gray-50, #fafafa);
    color: var(--ds-gray-900, #18181b);
}

.ds-header-dropdown-item:hover i {
    color: var(--ds-gray-600, #52525b);
}

.ds-header-dropdown-item.danger {
    color: var(--ds-danger, #dc2626);
}

.ds-header-dropdown-item.danger i {
    color: var(--ds-danger, #dc2626);
}

.ds-header-dropdown-item.danger:hover {
    background: var(--ds-danger-light, rgba(220, 38, 38, 0.06));
}

.ds-header-dropdown-divider {
    height: 1px;
    background: var(--ds-gray-100, #f4f4f5);
    margin: 4px 0;
}


/* ── Notification Dropdown ── */
.ds-header-notif {
    position: relative;
}

.ds-header-notif-dropdown {
    position: fixed;
    top: var(--ds-header-h);
    right: 0;
    left: 0;
    width: auto;
    background: var(--ds-white, #fff);
    border-bottom: 1px solid var(--ds-gray-200, #e4e4e7);
    box-shadow: var(--ds-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--ds-duration-slow, 200ms) cubic-bezier(0.16, 1, 0.3, 1);
    z-index: var(--ds-z-overlay, 500);
    pointer-events: none;
    overflow: hidden;
}

.ds-header-notif.open .ds-header-notif-dropdown,
.ds-header-notif-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.ds-header-notif-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--ds-gray-100, #f4f4f5);
}

.ds-header-notif-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ds-gray-900, #18181b);
}

.ds-header-notif-mark-btn {
    font-size: 12px;
    font-weight: 500;
    color: var(--ds-accent, #4f46e5);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    transition: opacity var(--ds-duration-fast, 100ms);
}

.ds-header-notif-mark-btn:hover {
    opacity: 0.7;
}

.ds-header-notif-list {
    max-height: 320px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ds-header-notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ds-gray-50, #fafafa);
    transition: background var(--ds-duration-fast, 100ms);
    cursor: pointer;
}

.ds-header-notif-item:hover {
    background: var(--ds-gray-50, #fafafa);
}

.ds-header-notif-item.unread {
    background: var(--ds-accent-lighter, rgba(79, 70, 229, 0.03));
}

.ds-header-notif-dot {
    width: 6px;
    height: 6px;
    background: var(--ds-accent, #4f46e5);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.ds-header-notif-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--ds-radius, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.ds-header-notif-icon.success { background: var(--ds-success-light); color: var(--ds-success); }
.ds-header-notif-icon.warning { background: var(--ds-warning-light); color: var(--ds-warning); }
.ds-header-notif-icon.info    { background: var(--ds-info-light);    color: var(--ds-info);    }
.ds-header-notif-icon.danger  { background: var(--ds-danger-light);  color: var(--ds-danger);  }

.ds-header-notif-body {
    flex: 1;
    min-width: 0;
}

.ds-header-notif-body p {
    font-size: 13px;
    color: var(--ds-gray-700, #3f3f46);
    line-height: 1.45;
    margin: 0;
}

.ds-header-notif-body p strong {
    font-weight: 600;
    color: var(--ds-gray-900, #18181b);
}

.ds-header-notif-time {
    font-size: 11px;
    color: var(--ds-gray-400, #a1a1aa);
    margin-top: 3px;
}

.ds-header-notif-footer {
    padding: 10px 16px;
    text-align: center;
    border-top: 1px solid var(--ds-gray-100, #f4f4f5);
}

.ds-header-notif-footer a {
    font-size: 12px;
    font-weight: 600;
    color: var(--ds-accent, #4f46e5);
    text-decoration: none;
    transition: opacity var(--ds-duration-fast, 100ms);
}

.ds-header-notif-footer a:hover {
    opacity: 0.7;
}

.ds-header-notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--ds-gray-400, #a1a1aa);
    font-size: 13px;
}

.ds-header-notif-empty i {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* ── Dynamic Notification Rows (AJAX) ── */
.ds-hdr-notif-row {
    display: flex;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--ds-gray-50, #fafafa);
    transition: background var(--ds-duration-fast, 100ms);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.ds-hdr-notif-row:hover {
    background: var(--ds-gray-50, #fafafa);
}
.ds-hdr-notif-row.unread {
    background: var(--ds-accent-lighter, rgba(79, 70, 229, 0.04));
}
.ds-hdr-notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.ds-hdr-notif-body {
    flex: 1;
    min-width: 0;
}
.ds-hdr-notif-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--ds-gray-800, #27272a);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ds-hdr-notif-row.unread .ds-hdr-notif-title {
    font-weight: 600;
    color: var(--ds-gray-900, #18181b);
}
.ds-hdr-notif-time {
    font-size: 11px;
    color: var(--ds-gray-400, #a1a1aa);
    margin-top: 2px;
}
.ds-header-notif-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--ds-accent, #4f46e5);
}


/* =====================================================
   3. MOBILE NAVIGATION
   ===================================================== */

/* Hamburger */
.ds-header-mobile-btn {
    display: flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--ds-gray-600, #52525b);
    border-radius: var(--ds-radius, 8px);
    cursor: pointer;
    font-size: 20px;
    transition: background var(--ds-duration-fast, 100ms);
    flex-shrink: 0;
    margin-right: 4px;
}

.ds-header-mobile-btn:hover {
    background: var(--ds-gray-100, #f4f4f5);
}

/* Mobile Overlay */
.ds-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: var(--ds-z-modal, 1000);
    opacity: 0;
    transition: opacity var(--ds-duration-slower, 300ms);
}

.ds-mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Nav Panel */
.ds-mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: var(--ds-white, #fff);
    z-index: calc(var(--ds-z-modal, 1000) + 1);
    transform: translateX(-100%);
    transition: transform var(--ds-duration-slower, 300ms) cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.ds-mobile-nav.active {
    display: block;
    transform: translateX(0);
}

.ds-mobile-nav-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--ds-gray-100, #f4f4f5);
    position: sticky;
    top: 0;
    background: var(--ds-white, #fff);
    z-index: 1;
}

.ds-mobile-nav-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--ds-gray-100, #f4f4f5);
    color: var(--ds-gray-600, #52525b);
    border-radius: var(--ds-radius, 8px);
    cursor: pointer;
    font-size: 16px;
}

.ds-mobile-nav-close:hover {
    background: var(--ds-gray-200, #e4e4e7);
}

.ds-mobile-nav-body {
    padding: 8px 4px;
}

.ds-mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--ds-gray-600, #52525b);
    text-decoration: none;
    border-radius: var(--ds-radius, 8px);
    transition: background var(--ds-duration-fast, 100ms), color var(--ds-duration-fast, 100ms);
}

.ds-mobile-nav-link i {
    font-size: 18px;
    color: var(--ds-gray-400, #a1a1aa);
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.ds-mobile-nav-link:hover,
.ds-mobile-nav-link.active {
    background: var(--ds-accent-light, rgba(79, 70, 229, 0.06));
    color: var(--ds-accent, #4f46e5);
}

.ds-mobile-nav-link.active i {
    color: var(--ds-accent, #4f46e5);
}

.ds-mobile-nav-link .ds-header-nav-menu-badge {
    margin-left: auto;
}

.ds-mobile-nav-divider {
    height: 1px;
    background: var(--ds-gray-100, #f4f4f5);
    margin: 8px 12px;
}

/* ── Mobile Nav: Compact Colorful List ── */
.ds-mobile-nav-group-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--ds-gray-400, #a1a1aa);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 16px 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ds-mobile-nav-group-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ds-mobile-nav-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    margin: 0 4px;
    border-radius: var(--ds-radius, 8px);
    text-decoration: none;
    transition: background 100ms ease;
    -webkit-tap-highlight-color: transparent;
}

.ds-mobile-nav-card:hover {
    background: var(--card-bg, rgba(79, 70, 229, 0.05));
}

.ds-mobile-nav-card:active {
    background: var(--card-bg, rgba(79, 70, 229, 0.1));
}

.ds-mobile-nav-card.active {
    background: var(--card-bg, rgba(79, 70, 229, 0.07));
}

.ds-mobile-nav-card-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    background: var(--card-bg, rgba(79, 70, 229, 0.08));
    color: var(--card-color, #4f46e5);
}

.ds-mobile-nav-card-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ds-gray-700, #3f3f46);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ds-mobile-nav-card.active .ds-mobile-nav-card-label {
    color: var(--card-color, #4f46e5);
    font-weight: 600;
}

.ds-mobile-nav-card-arrow {
    font-size: 14px;
    color: var(--ds-gray-300, #d4d4d8);
    flex-shrink: 0;
    margin-left: auto;
}

.ds-mobile-nav-card.active .ds-mobile-nav-card-arrow {
    color: var(--card-color, #4f46e5);
    opacity: 0.5;
}

.ds-mobile-nav-card .ds-header-nav-menu-badge {
    flex-shrink: 0;
    font-size: 9px;
    margin-left: auto;
}

.ds-mobile-nav-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--ds-gray-100, #f4f4f5);
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    bottom: 0;
    background: var(--ds-white, #fff);
}

.ds-mobile-nav-footer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ds-gray-150, #ececee);
    flex-shrink: 0;
}

.ds-mobile-nav-footer-info {
    flex: 1;
    min-width: 0;
}

.ds-mobile-nav-footer-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ds-gray-800, #27272a);
}

.ds-mobile-nav-footer-role {
    font-size: 11px;
    color: var(--ds-gray-400, #a1a1aa);
}

/* Mobile nav balance card */
.ds-mobile-nav-balance {
    margin: 8px 12px;
    padding: 12px;
    background: linear-gradient(135deg, var(--ds-accent-light) 0%, rgba(79, 70, 229, 0.02) 100%);
    border: 1px solid var(--ds-accent-border, rgba(79, 70, 229, 0.12));
    border-radius: var(--ds-radius, 8px);
}

.ds-mobile-nav-balance-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--ds-gray-500);
    display: flex;
    align-items: center;
    gap: 5px;
}

.ds-mobile-nav-balance-label i {
    color: var(--ds-accent);
    font-size: 14px;
}

.ds-mobile-nav-balance-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--ds-gray-900);
    margin-top: 2px;
    letter-spacing: -0.5px;
}

.ds-mobile-nav-balance-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ds-accent);
    text-decoration: none;
}


/* =====================================================
   4. SUBSCRIPTION BANNER
   ===================================================== */
.ds-subscription-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
    flex-wrap: wrap;
}

.ds-subscription-banner.warning {
    background: linear-gradient(90deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.ds-subscription-banner.danger {
    background: linear-gradient(90deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

.ds-subscription-banner-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ds-subscription-banner-content i {
    font-size: 18px;
    flex-shrink: 0;
}

.ds-subscription-banner-btn {
    background: var(--ds-gray-900, #18181b);
    color: #fff;
    padding: 6px 16px;
    border-radius: var(--ds-radius-sm, 6px);
    font-weight: 600;
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--ds-duration, 150ms);
    flex-shrink: 0;
}

.ds-subscription-banner-btn:hover {
    background: var(--ds-gray-700, #3f3f46);
    color: #fff;
}


/* =====================================================
   5. FOOTER
   ===================================================== */
.ds-footer {
    background: var(--ds-footer-bg);
    border-top: 1px solid var(--ds-footer-border);
    padding: 0 12px;
    flex-shrink: 0;
}

.ds-footer-inner {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    min-height: var(--ds-footer-h);
    padding: 8px 0;
}

.ds-footer-left {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--ds-gray-400, #a1a1aa);
    flex-wrap: wrap;
}

.ds-footer-links {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11.5px;
}

.ds-footer-links a {
    color: var(--ds-gray-500, #71717a);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--ds-duration-fast, 100ms);
}

.ds-footer-links a:hover {
    color: var(--ds-gray-700, #3f3f46);
}

.ds-footer-left a {
    color: var(--ds-gray-500, #71717a);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--ds-duration-fast, 100ms);
}

.ds-footer-left a:hover {
    color: var(--ds-gray-700, #3f3f46);
}

.ds-footer-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--ds-gray-300, #d4d4d8);
    flex-shrink: 0;
}

.ds-footer-right {
    display: none;
    align-items: center;
    gap: 12px;
}

.ds-footer-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--ds-gray-500, #71717a);
}

.ds-footer-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ds-success, #16a34a);
    animation: ds-pulse-dot 2s infinite;
}

@keyframes ds-pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ds-footer-version {
    font-size: 11px;
    color: var(--ds-gray-400, #a1a1aa);
    font-family: var(--ds-mono, monospace);
    letter-spacing: 0.2px;
}


/* =====================================================
   6. COMMAND PALETTE (Cmd+K)
   ===================================================== */
.ds-cmdk-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: var(--ds-z-modal, 1000);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}

.ds-cmdk-overlay.active {
    display: flex;
}

.ds-cmdk-dialog {
    width: 92%;
    max-width: 520px;
    background: var(--ds-white, #fff);
    border: 1px solid var(--ds-gray-200, #e4e4e7);
    border-radius: var(--ds-radius-xl, 16px);
    box-shadow: var(--ds-shadow-xl);
    overflow: hidden;
    animation: ds-cmdk-in var(--ds-duration-slow, 200ms) var(--ds-ease-out, ease-out);
}

@keyframes ds-cmdk-in {
    from { opacity: 0; transform: scale(0.96) translateY(-8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.ds-cmdk-input-wrap {
    padding: 12px 16px;
    border-bottom: 1px solid var(--ds-gray-100, #f4f4f5);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ds-cmdk-input-wrap i {
    font-size: 18px;
    color: var(--ds-gray-400, #a1a1aa);
    flex-shrink: 0;
}

.ds-cmdk-input {
    flex: 1;
    border: none;
    padding: 0;
    font-size: 15px;
    font-family: inherit;
    color: var(--ds-gray-900, #18181b);
    background: transparent;
    outline: none;
}

.ds-cmdk-input::placeholder {
    color: var(--ds-gray-400, #a1a1aa);
}

.ds-cmdk-kbd {
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    padding: 2px 6px;
    background: var(--ds-gray-100, #f4f4f5);
    border: 1px solid var(--ds-gray-200, #e4e4e7);
    border-radius: var(--ds-radius-xs, 4px);
    color: var(--ds-gray-400, #a1a1aa);
    line-height: 1;
}

.ds-cmdk-list {
    padding: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.ds-cmdk-group-title {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ds-gray-400, #a1a1aa);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ds-cmdk-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ds-gray-600, #52525b);
    text-decoration: none;
    border-radius: var(--ds-radius, 8px);
    cursor: pointer;
    transition: background var(--ds-duration-fast, 100ms);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.ds-cmdk-item i {
    font-size: 16px;
    color: var(--ds-gray-400, #a1a1aa);
    flex-shrink: 0;
}

.ds-cmdk-item:hover {
    background: var(--ds-gray-50, #fafafa);
    color: var(--ds-gray-900, #18181b);
}

.ds-cmdk-item:hover i {
    color: var(--ds-gray-600, #52525b);
}


/* =====================================================
   7. TOAST SYSTEM
   ===================================================== */
.ds-toast-container {
    position: fixed;
    top: calc(var(--ds-header-h) + 12px);
    right: 12px;
    z-index: var(--ds-z-toast, 1500);
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: calc(100vw - 24px);
}

.ds-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--ds-white, #fff);
    border-radius: var(--ds-radius-lg, 12px);
    box-shadow: var(--ds-shadow-lg), 0 0 0 1px rgba(0,0,0,0.04);
    min-width: 260px;
    max-width: 380px;
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: all var(--ds-duration-slower, 300ms) var(--ds-ease, ease);
}

.ds-toast.show {
    transform: translateX(0);
    opacity: 1;
}

.ds-toast i:first-child {
    font-size: 20px;
    flex-shrink: 0;
}

.ds-toast-message {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--ds-gray-700, #3f3f46);
    line-height: 1.4;
}

.ds-toast-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--ds-gray-400, #a1a1aa);
    border-radius: var(--ds-radius-sm, 6px);
    transition: all var(--ds-duration-fast, 100ms);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ds-toast-close:hover {
    background: var(--ds-gray-100, #f4f4f5);
    color: var(--ds-gray-700, #3f3f46);
}

.ds-toast-close i { font-size: 14px; }

.ds-toast-success { border-left: 3px solid var(--ds-success, #16a34a); }
.ds-toast-success i:first-child { color: var(--ds-success); }
.ds-toast-error   { border-left: 3px solid var(--ds-danger, #dc2626); }
.ds-toast-error i:first-child   { color: var(--ds-danger); }
.ds-toast-warning { border-left: 3px solid var(--ds-warning, #d97706); }
.ds-toast-warning i:first-child { color: var(--ds-warning); }
.ds-toast-info    { border-left: 3px solid var(--ds-info, #2563eb); }
.ds-toast-info i:first-child    { color: var(--ds-info); }


/* =====================================================
   8. CONFIRM MODAL
   ===================================================== */
.ds-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--ds-z-toast, 1500);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all var(--ds-duration-slow, 200ms);
    padding: 16px;
}

.ds-confirm-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ds-confirm-dialog {
    background: var(--ds-white, #fff);
    border-radius: var(--ds-radius-xl, 16px);
    padding: 28px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    transform: scale(0.92);
    transition: transform var(--ds-duration-slow, 200ms) var(--ds-ease, ease);
    box-shadow: var(--ds-shadow-xl);
}

.ds-confirm-overlay.show .ds-confirm-dialog {
    transform: scale(1);
}

.ds-confirm-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ds-danger-light, rgba(220, 38, 38, 0.06));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.ds-confirm-icon i {
    font-size: 24px;
    color: var(--ds-danger, #dc2626);
}

.ds-confirm-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--ds-gray-900, #18181b);
    margin-bottom: 8px;
}

.ds-confirm-message {
    font-size: 13.5px;
    color: var(--ds-gray-500, #71717a);
    line-height: 1.5;
    margin-bottom: 20px;
}

.ds-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.ds-confirm-btn {
    padding: 8px 20px;
    border-radius: var(--ds-radius, 8px);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--ds-duration-fast, 100ms);
    font-family: inherit;
}

.ds-confirm-btn.cancel {
    background: var(--ds-gray-100, #f4f4f5);
    color: var(--ds-gray-700, #3f3f46);
}

.ds-confirm-btn.cancel:hover {
    background: var(--ds-gray-200, #e4e4e7);
}

.ds-confirm-btn.confirm {
    background: var(--ds-accent, #4f46e5);
    color: #fff;
}

.ds-confirm-btn.confirm:hover {
    background: var(--ds-accent-hover, #4338ca);
}

.ds-confirm-btn.confirm.danger {
    background: var(--ds-danger, #dc2626);
}

.ds-confirm-btn.confirm.danger:hover {
    background: var(--ds-danger-hover, #b91c1c);
}


/* =====================================================
   9. RESPONSIVE — Mobile First
   ===================================================== */

/* ── Tablet (>=768px) ── */
@media (min-width: 768px) {
    .ds-header-inner {
        padding: 0 20px;
    }

    .ds-header-mobile-btn {
        display: none;
    }

    .ds-header-logo-text {
        display: block;
    }

    .ds-header-sep {
        display: block;
    }

    .ds-header-live {
        display: flex;
    }

    .ds-header-nav {
        display: flex;
    }

    .ds-header-nav .ds-mega-trigger {
        display: flex;
    }

    .ds-header-actions-sep {
        display: block;
    }

    .ds-header-search-btn {
        width: auto;
        min-width: 42px;
        height: 34px;
        padding: 0 10px;
        gap: 6px;
        background: var(--ds-gray-100, #f4f4f5);
        border: 1px solid var(--ds-gray-200, #e4e4e7);
        font-size: 12px;
        color: var(--ds-gray-400, #a1a1aa);
    }

    .ds-header-search-btn:hover {
        background: var(--ds-gray-50, #fafafa);
        border-color: var(--ds-gray-300, #d4d4d8);
    }

    .ds-header-search-btn i {
        font-size: 15px;
    }

    /* Notification dropdown becomes absolute on tablet */
    .ds-header-notif-dropdown {
        position: absolute;
        top: calc(100% + 8px);
        right: -8px;
        left: auto;
        width: 360px;
        border: 1px solid var(--ds-gray-200, #e4e4e7);
        border-bottom: 1px solid var(--ds-gray-200, #e4e4e7);
        border-radius: var(--ds-radius-lg, 12px);
    }

    .ds-footer {
        padding: 0 20px;
    }

    .ds-footer-inner {
        justify-content: space-between;
    }

    .ds-footer-right {
        display: flex;
    }

    .ds-toast-container {
        right: 20px;
        max-width: 420px;
    }

    .ds-subscription-banner {
        padding: 10px 20px;
    }

    .ds-layout-content > .content-body {
        padding: 32px 32px;
    }
}


/* ── Desktop (>=1024px) ── */
@media (min-width: 1024px) {
    .ds-header-inner {
        padding: 0 24px;
    }

    .ds-header-nav-item span {
        display: inline;
    }

    .ds-header-search-btn-text {
        display: inline;
    }

    .ds-header-search-btn {
        min-width: 200px;
    }

    .ds-header-search-kbd {
        display: inline-block;
        font-size: 10px;
        font-weight: 600;
        font-family: inherit;
        padding: 2px 5px;
        background: var(--ds-white, #fff);
        border: 1px solid var(--ds-gray-200, #e4e4e7);
        border-radius: var(--ds-radius-xs, 4px);
        color: var(--ds-gray-400, #a1a1aa);
        line-height: 1;
    }

    .ds-header-profile-info {
        display: flex;
    }

    .ds-header-profile-chevron {
        display: block;
    }

    .ds-header-profile {
        padding: 4px 8px 4px 4px;
    }

    .ds-footer {
        padding: 0 24px;
    }

    .ds-toast-container {
        top: calc(var(--ds-header-h) + 16px);
        right: 24px;
    }

    .ds-layout-content > .content-body {
        padding: 32px 40px;
    }
}


/* ── Large (>=1200px) ── */
@media (min-width: 1200px) {
    .ds-header-nav-item {
        padding: 6px 12px;
    }
}


/* ── Small Mobile (<=480px) ── */
@media (max-width: 480px) {
    .ds-header-logo-mark {
        width: 28px;
        height: 28px;
    }

    .ds-footer-inner {
        justify-content: center;
    }

    .ds-footer-left {
        font-size: 11px;
        justify-content: center;
        width: 100%;
    }

    .ds-footer-links {
        font-size: 11px;
        justify-content: center;
        width: 100%;
    }

    .ds-subscription-banner {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .ds-layout-content > .content-body {
        padding: 20px 16px;
    }
}

/* ── Mega Menu Mobile (<768px) ── */
@media (max-width: 767px) {
    .ds-mega-menu {
        left: 12px;
        right: 12px;
        width: auto;
        transform: translateX(0) translateY(-6px);
        flex-direction: column;
        max-height: calc(100vh - var(--ds-header-h) - 24px);
    }

    .ds-mega-menu.active {
        transform: translateX(0) translateY(0);
    }

    .ds-mega-tabs {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: none;
        border-bottom: 1px solid var(--ds-gray-100, #f4f4f5);
        padding: 6px 6px;
        gap: 2px;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .ds-mega-tabs::-webkit-scrollbar { display: none; }

    .ds-mega-tab {
        flex-shrink: 0;
        padding: 6px 10px;
        font-size: 11.5px;
    }

    .ds-mega-tabs-footer {
        margin-top: 0;
        margin-left: auto;
        padding-top: 0;
        padding-left: 8px;
        border-top: none;
        border-left: 1px solid var(--ds-gray-150, #ececee);
    }

    .ds-mega-panel-grid {
        grid-template-columns: 1fr;
    }
}


/* =====================================================
   10. UTILITIES
   ===================================================== */

/* Hide nav item text on tablet, show only icon */
@media (min-width: 768px) and (max-width: 1023px) {
    .ds-header-nav-item span {
        display: none;
    }

    .ds-header-nav-item {
        padding: 6px 8px;
    }

    .ds-header-nav-item.active::after {
        left: 4px;
        right: 4px;
    }

    /* Mega trigger: keep label visible on tablet */
    .ds-mega-trigger span {
        display: inline;
    }

    .ds-mega-trigger-chevron {
        display: inline-block;
    }
}

/* Visually hidden but accessible */
.ds-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
