/**
 * =====================================================
 * Sosyotik Design System v3.0 — Enterprise Grade
 * Ultra-Professional SaaS / CRM / Admin Dashboard
 * Prefix: ds-
 * =====================================================
 * 
 * Inspired by: Linear, Vercel, Stripe, Clerk, Resend
 * Palette: Zinc neutrals + Indigo accent
 * Grid: 4px base unit
 * Typography: Inter + JetBrains Mono
 * =====================================================
 */

/* =====================================================
   0. DESIGN TOKENS
   ===================================================== */
:root {
    /* ── Brand / Accent ── */
    --ds-accent: #4f46e5;
    --ds-accent-hover: #4338ca;
    --ds-accent-active: #3730a3;
    --ds-accent-light: rgba(79, 70, 229, 0.06);
    --ds-accent-lighter: rgba(79, 70, 229, 0.03);
    --ds-accent-border: rgba(79, 70, 229, 0.2);
    --ds-accent-ring: rgba(79, 70, 229, 0.25);
    --ds-accent-text: #4338ca;

    /* ── Zinc Neutrals (12 steps) ── */
    --ds-black: #09090b;
    --ds-white: #ffffff;
    --ds-gray-25: #fcfcfd;
    --ds-gray-50: #fafafa;
    --ds-gray-100: #f4f4f5;
    --ds-gray-150: #ececee;
    --ds-gray-200: #e4e4e7;
    --ds-gray-300: #d4d4d8;
    --ds-gray-400: #a1a1aa;
    --ds-gray-500: #71717a;
    --ds-gray-600: #52525b;
    --ds-gray-700: #3f3f46;
    --ds-gray-800: #27272a;
    --ds-gray-900: #18181b;
    --ds-gray-950: #0f0f11;

    /* ── Semantic Colors ── */
    --ds-success: #16a34a;
    --ds-success-light: rgba(22, 163, 74, 0.06);
    --ds-success-border: rgba(22, 163, 74, 0.15);
    --ds-success-ring: rgba(22, 163, 74, 0.2);

    --ds-warning: #d97706;
    --ds-warning-light: rgba(217, 119, 6, 0.06);
    --ds-warning-border: rgba(217, 119, 6, 0.15);
    --ds-warning-ring: rgba(217, 119, 6, 0.2);

    --ds-danger: #dc2626;
    --ds-danger-light: rgba(220, 38, 38, 0.06);
    --ds-danger-border: rgba(220, 38, 38, 0.15);
    --ds-danger-ring: rgba(220, 38, 38, 0.2);

    --ds-info: #2563eb;
    --ds-info-light: rgba(37, 99, 235, 0.06);
    --ds-info-border: rgba(37, 99, 235, 0.15);
    --ds-info-ring: rgba(37, 99, 235, 0.2);

    /* ── Extended Palette ── */
    --ds-emerald: #10b981;
    --ds-emerald-dark: #059669;
    --ds-emerald-light: rgba(16, 185, 129, 0.08);
    --ds-emerald-border: rgba(16, 185, 129, 0.2);

    --ds-violet: #7c3aed;
    --ds-violet-light: rgba(139, 92, 246, 0.08);

    --ds-blue: #2563eb;
    --ds-blue-light: rgba(59, 130, 246, 0.08);

    --ds-amber: #d97706;
    --ds-amber-dark: #b45309;
    --ds-amber-light: rgba(245, 158, 11, 0.08);

    --ds-cyan: #0891b2;
    --ds-cyan-light: rgba(6, 182, 212, 0.08);

    --ds-rose: #e11d48;
    --ds-rose-light: rgba(244, 63, 94, 0.08);

    --ds-slate: #475569;
    --ds-slate-light: rgba(100, 116, 139, 0.08);

    --ds-danger-hover: #b91c1c;
    --ds-warning-dark: #92400e;

    /* ── Platform Brand Colors ── */
    --ds-brand-whatsapp: #25d366;
    --ds-brand-instagram: #e1306c;
    --ds-brand-facebook: #1877f2;
    --ds-brand-telegram: #0088cc;

    /* ── Typography ── */
    --ds-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --ds-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

    --ds-text-xs: 11px;
    --ds-text-sm: 12px;
    --ds-text-base: 13px;
    --ds-text-md: 14px;
    --ds-text-lg: 16px;
    --ds-text-xl: 18px;
    --ds-text-2xl: 20px;
    --ds-text-3xl: 24px;

    --ds-leading-tight: 1.2;
    --ds-leading-normal: 1.5;
    --ds-leading-relaxed: 1.6;

    --ds-tracking-tight: -0.02em;
    --ds-tracking-normal: 0;
    --ds-tracking-wide: 0.04em;

    /* ── Border Radius ── */
    --ds-radius-xs: 4px;
    --ds-radius-sm: 6px;
    --ds-radius: 8px;
    --ds-radius-md: 10px;
    --ds-radius-lg: 12px;
    --ds-radius-xl: 16px;
    --ds-radius-2xl: 20px;
    --ds-radius-full: 9999px;

    /* ── Shadow System (6 levels) ── */
    --ds-shadow-xs: 0 1px 2px 0 rgba(0,0,0,0.03);
    --ds-shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.04), 0 1px 3px 0 rgba(0,0,0,0.06);
    --ds-shadow: 0 2px 4px -1px rgba(0,0,0,0.04), 0 4px 6px -1px rgba(0,0,0,0.06);
    --ds-shadow-md: 0 4px 8px -2px rgba(0,0,0,0.05), 0 8px 16px -4px rgba(0,0,0,0.08);
    --ds-shadow-lg: 0 8px 16px -4px rgba(0,0,0,0.06), 0 16px 32px -8px rgba(0,0,0,0.1);
    --ds-shadow-xl: 0 16px 32px -8px rgba(0,0,0,0.08), 0 24px 48px -12px rgba(0,0,0,0.12);
    --ds-shadow-inner: inset 0 1px 2px 0 rgba(0,0,0,0.04);

    /* Ring shadow (focus) */
    --ds-ring-accent: 0 0 0 2px var(--ds-white), 0 0 0 4px var(--ds-accent-ring);
    --ds-ring-danger: 0 0 0 2px var(--ds-white), 0 0 0 4px var(--ds-danger-ring);

    /* ── Transitions ── */
    --ds-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ds-ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ds-ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ds-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ds-duration-fast: 100ms;
    --ds-duration: 150ms;
    --ds-duration-slow: 200ms;
    --ds-duration-slower: 300ms;
    --ds-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --ds-transition-slow: 250ms cubic-bezier(0.4, 0, 0.2, 1);

    /* ── Z-Index Scale ── */
    --ds-z-dropdown: 100;
    --ds-z-sticky: 200;
    --ds-z-overlay: 500;
    --ds-z-modal: 1000;
    --ds-z-toast: 1500;
    --ds-z-tooltip: 2000;

    /* ── Layout ── */
    --ds-container-max: 1200px;
    --ds-container-padding: 32px;

    /* ── Semantic Aliases ──
       Shorthand tokens used across page CSS files.
       Maps to the canonical accent & gray scale above. */
    --ds-primary: var(--ds-accent);
    --ds-primary-light: var(--ds-accent-light);
    --ds-primary-lighter: var(--ds-accent-lighter);
    --ds-primary-rgb: 79, 70, 229;
    --ds-border: var(--ds-gray-200);
}

/* ── Global Box-Sizing Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
}


/* =====================================================
   1. CONTAINER & LAYOUT
   ===================================================== */
.ds-container {
    max-width: var(--ds-container-max);
    margin: 0;
    padding: 28px var(--ds-container-padding);
}

@media (max-width: 1024px) {
    :root { --ds-container-padding: 24px; }
}

@media (max-width: 768px) {
    :root { --ds-container-padding: 16px; }
    .ds-container { padding: 20px var(--ds-container-padding); }
}

/* Grid helpers */
.ds-grid { display: grid; gap: 16px; }
.ds-grid-2 { grid-template-columns: repeat(2, 1fr); }
.ds-grid-3 { grid-template-columns: repeat(3, 1fr); }
.ds-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .ds-grid-2, .ds-grid-3, .ds-grid-4 { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
    .ds-grid-3 { grid-template-columns: repeat(2, 1fr); }
    .ds-grid-4 { grid-template-columns: repeat(2, 1fr); }
}


/* =====================================================
   2. PAGE HEADER
   ===================================================== */
.ds-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ds-page-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.ds-page-icon {
    width: 42px;
    height: 42px;
    background: var(--ds-gray-900);
    border-radius: var(--ds-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ds-white);
    font-size: 19px;
    flex-shrink: 0;
    box-shadow: var(--ds-shadow-sm);
}

.ds-page-title {
    font-size: var(--ds-text-2xl);
    font-weight: 650;
    color: var(--ds-gray-900);
    margin: 0;
    letter-spacing: var(--ds-tracking-tight);
    line-height: var(--ds-leading-tight);
}

.ds-page-desc {
    font-size: var(--ds-text-base);
    color: var(--ds-gray-500);
    margin: 3px 0 0;
    line-height: var(--ds-leading-normal);
}

.ds-page-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ds-page-header-right .ds-tabs-pill {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .ds-page-header { flex-direction: column; align-items: flex-start; }
    .ds-page-header-right { width: 100%; }
    .ds-page-header-right .ds-btn { flex: 1; justify-content: center; }
}


/* =====================================================
   3. BREADCRUMB
   ===================================================== */
.ds-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    font-size: var(--ds-text-sm);
}

.ds-breadcrumb a {
    color: var(--ds-gray-500);
    text-decoration: none;
    transition: color var(--ds-transition);
}

.ds-breadcrumb a:hover { color: var(--ds-gray-900); }

.ds-breadcrumb-sep {
    color: var(--ds-gray-300);
    font-size: 10px;
}

.ds-breadcrumb-current {
    color: var(--ds-gray-900);
    font-weight: 500;
}


/* =====================================================
   4. BUTTONS
   ===================================================== */
.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    font-family: var(--ds-font);
    font-size: var(--ds-text-base);
    font-weight: 500;
    line-height: 20px;
    border-radius: var(--ds-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--ds-transition);
    text-decoration: none;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
    outline: none;
    position: relative;
}

.ds-btn:focus-visible { box-shadow: var(--ds-ring-accent); }
.ds-btn i { font-size: 16px; line-height: 1; }

.ds-btn:disabled,
.ds-btn.disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* Primary — Solid dark */
.ds-btn-primary {
    background: var(--ds-gray-900);
    color: var(--ds-white);
    border-color: var(--ds-gray-900);
    box-shadow: var(--ds-shadow-xs), inset 0 1px 0 0 rgba(255,255,255,0.04);
}

.ds-btn-primary:hover {
    background: var(--ds-black);
    border-color: var(--ds-black);
    box-shadow: var(--ds-shadow-sm), inset 0 1px 0 0 rgba(255,255,255,0.04);
}

.ds-btn-primary:active {
    background: var(--ds-gray-950);
    box-shadow: var(--ds-shadow-xs);
}

/* Secondary — Soft gray */
.ds-btn-secondary {
    background: var(--ds-gray-100);
    color: var(--ds-gray-700);
    border-color: var(--ds-gray-200);
}

.ds-btn-secondary:hover {
    background: var(--ds-gray-150);
    color: var(--ds-gray-900);
    border-color: var(--ds-gray-300);
}

/* Outline — White bg, border */
.ds-btn-outline {
    background: var(--ds-white);
    color: var(--ds-gray-700);
    border-color: var(--ds-gray-300);
    box-shadow: var(--ds-shadow-xs);
}

.ds-btn-outline:hover {
    background: var(--ds-gray-50);
    border-color: var(--ds-gray-400);
    color: var(--ds-gray-900);
    box-shadow: var(--ds-shadow-sm);
}

/* Ghost — Transparent */
.ds-btn-ghost {
    background: transparent;
    color: var(--ds-gray-600);
    border-color: transparent;
}

.ds-btn-ghost:hover {
    background: var(--ds-gray-100);
    color: var(--ds-gray-900);
}

/* Accent — Indigo */
.ds-btn-accent {
    background: var(--ds-accent);
    color: var(--ds-white);
    border-color: var(--ds-accent);
    box-shadow: var(--ds-shadow-xs), inset 0 1px 0 0 rgba(255,255,255,0.12);
}

.ds-btn-accent:hover {
    background: var(--ds-accent-hover);
    border-color: var(--ds-accent-hover);
    box-shadow: 0 2px 8px var(--ds-accent-ring);
}

.ds-btn-accent:active { background: var(--ds-accent-active); }

/* Danger — Red */
.ds-btn-danger {
    background: var(--ds-danger);
    color: var(--ds-white);
    border-color: var(--ds-danger);
    box-shadow: var(--ds-shadow-xs);
}

.ds-btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    box-shadow: 0 2px 8px var(--ds-danger-ring);
}

/* Danger Outline */
.ds-btn-danger-outline {
    background: var(--ds-white);
    color: var(--ds-danger);
    border-color: var(--ds-danger-border);
    box-shadow: var(--ds-shadow-xs);
}

.ds-btn-danger-outline:hover {
    background: var(--ds-danger-light);
    border-color: rgba(220, 38, 38, 0.35);
}

/* Success */
.ds-btn-success {
    background: var(--ds-success);
    color: var(--ds-white);
    border-color: var(--ds-success);
    box-shadow: var(--ds-shadow-xs);
}

.ds-btn-success:hover {
    background: #15803d;
    border-color: #15803d;
    box-shadow: 0 2px 8px var(--ds-success-ring);
}

/* ── Button Sizes ── */
.ds-btn-xs {
    padding: 3px 8px;
    font-size: var(--ds-text-xs);
    border-radius: var(--ds-radius-xs);
    gap: 4px;
}
.ds-btn-xs i { font-size: 13px; }

.ds-btn-sm {
    padding: 5px 10px;
    font-size: var(--ds-text-sm);
    border-radius: var(--ds-radius-sm);
    gap: 5px;
}
.ds-btn-sm i { font-size: 14px; }

.ds-btn-lg {
    padding: 10px 20px;
    font-size: var(--ds-text-md);
    gap: 8px;
}

.ds-btn-xl {
    padding: 12px 24px;
    font-size: 15px;
    border-radius: var(--ds-radius-md);
    gap: 8px;
}

/* Icon-only button */
.ds-btn-icon { width: 34px; height: 34px; padding: 0; }
.ds-btn-icon.ds-btn-xs { width: 24px; height: 24px; }
.ds-btn-icon.ds-btn-sm { width: 28px; height: 28px; }
.ds-btn-icon.ds-btn-lg { width: 40px; height: 40px; }

/* Button Group */
.ds-btn-group {
    display: inline-flex;
    border-radius: var(--ds-radius);
    overflow: hidden;
    box-shadow: var(--ds-shadow-xs);
}

.ds-btn-group .ds-btn {
    border-radius: 0;
    border-right-width: 0;
    box-shadow: none;
}

.ds-btn-group .ds-btn:first-child { border-radius: var(--ds-radius) 0 0 var(--ds-radius); }
.ds-btn-group .ds-btn:last-child { border-radius: 0 var(--ds-radius) var(--ds-radius) 0; border-right-width: 1px; }

/* Loading state */
.ds-btn-loading {
    color: transparent !important;
    pointer-events: none;
}

.ds-btn-loading::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: ds-spin 0.6s linear infinite;
}

.ds-btn-primary.ds-btn-loading::after,
.ds-btn-accent.ds-btn-loading::after,
.ds-btn-danger.ds-btn-loading::after,
.ds-btn-success.ds-btn-loading::after {
    border-color: rgba(255,255,255,0.4);
    border-right-color: transparent;
}


/* =====================================================
   5. STATS ROW
   ===================================================== */
.ds-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ds-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--ds-white);
    border: 1px solid var(--ds-gray-200);
    border-radius: var(--ds-radius-lg);
    flex: 1;
    min-width: 140px;
    transition: all var(--ds-transition);
    box-shadow: var(--ds-shadow-xs);
}

.ds-stat:hover {
    border-color: var(--ds-gray-300);
    box-shadow: var(--ds-shadow-sm);
}

.ds-stat > i {
    font-size: 20px;
    color: var(--ds-gray-400);
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ds-gray-50);
    border-radius: var(--ds-radius);
}

.ds-stat-value {
    font-size: var(--ds-text-xl);
    font-weight: 700;
    color: var(--ds-gray-900);
    letter-spacing: var(--ds-tracking-tight);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.ds-stat-label {
    font-size: var(--ds-text-xs);
    color: var(--ds-gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: var(--ds-tracking-wide);
    line-height: 1;
    margin-top: 3px;
}

/* Stat trend indicator */
.ds-stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: var(--ds-text-xs);
    font-weight: 600;
    margin-left: 6px;
}

.ds-stat-trend-up { color: var(--ds-success); }
.ds-stat-trend-down { color: var(--ds-danger); }
.ds-stat-trend i { font-size: 14px; }

@media (max-width: 640px) {
    .ds-stat { min-width: calc(50% - 6px); padding: 12px 14px; }
    .ds-stat > i { width: 32px; height: 32px; font-size: 17px; }
}

/* Gradient Stats Variant */
.ds-stat-gradient {
    position: relative;
    overflow: hidden;
    border: none;
    background: var(--ds-white);
}

.ds-stat-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right,
        var(--stat-color, var(--ds-accent)) 0%,
        color-mix(in srgb, var(--stat-color, var(--ds-accent)) 40%, transparent) 50%,
        transparent 100%
    );
    opacity: 0.12;
    transition: opacity var(--ds-transition);
}

.ds-stat-gradient:hover::before {
    opacity: 0.18;
}

.ds-stat-gradient > i {
    background: color-mix(in srgb, var(--stat-color, var(--ds-accent)) 14%, transparent);
    color: var(--stat-color, var(--ds-accent));
}

.ds-stat-gradient .ds-stat-value {
    position: relative;
}

.ds-stat-gradient .ds-stat-label {
    position: relative;
}

/* Bottom accent bar */
.ds-stat-gradient::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        to right,
        var(--stat-color, var(--ds-accent)),
        transparent 80%
    );
    opacity: 0.5;
}


/* =====================================================
   6. CARDS
   ===================================================== */
.ds-card {
    background: var(--ds-white);
    border: 1px solid var(--ds-gray-200);
    border-radius: var(--ds-radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--ds-shadow-xs);
    transition: box-shadow var(--ds-transition), border-color var(--ds-transition);
}

.ds-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--ds-gray-100);
    gap: 12px;
    min-height: 52px;
}

.ds-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--ds-text-md);
    font-weight: 600;
    color: var(--ds-gray-900);
    margin: 0;
    letter-spacing: var(--ds-tracking-tight);
}

.ds-card-title i {
    color: var(--ds-gray-400);
    font-size: 18px;
}

.ds-card-body { padding: 20px; }

.ds-card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--ds-gray-100);
    background: var(--ds-gray-25);
}

/* Card variants */
.ds-card-flat {
    border: none;
    background: var(--ds-gray-50);
    box-shadow: none;
}

.ds-card-accent {
    border-left: 3px solid var(--ds-accent);
}

.ds-card-elevated {
    border-color: transparent;
    box-shadow: var(--ds-shadow);
}

.ds-card-elevated:hover { box-shadow: var(--ds-shadow-md); }

/* Interactive (clickable) card */
.ds-card-interactive {
    cursor: pointer;
}

.ds-card-interactive:hover {
    border-color: var(--ds-gray-300);
    box-shadow: var(--ds-shadow);
    transform: translateY(-1px);
}

.ds-card-interactive:active {
    transform: translateY(0);
    box-shadow: var(--ds-shadow-sm);
}

/* Glass card */
.ds-card-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.25);
}


/* =====================================================
   7. BADGES / TAGS
   ===================================================== */
.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: var(--ds-text-xs);
    font-weight: 600;
    border-radius: var(--ds-radius-sm);
    line-height: 18px;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.ds-badge i { font-size: 12px; }

.ds-badge-default { background: var(--ds-gray-100); color: var(--ds-gray-600); }
.ds-badge-primary { background: var(--ds-gray-900); color: var(--ds-white); }
.ds-badge-accent { background: var(--ds-accent-light); color: var(--ds-accent-text); }
.ds-badge-success { background: var(--ds-success-light); color: var(--ds-success); }
.ds-badge-warning { background: var(--ds-warning-light); color: var(--ds-warning); }
.ds-badge-danger { background: var(--ds-danger-light); color: var(--ds-danger); }
.ds-badge-info { background: var(--ds-info-light); color: var(--ds-info); }

.ds-badge-pill { border-radius: var(--ds-radius-full); padding: 2px 10px; }

.ds-badge-outlined {
    background: transparent;
    border: 1px solid currentColor;
    opacity: 0.8;
}

/* Count badge */
.ds-count {
    background: var(--ds-gray-100);
    color: var(--ds-gray-500);
    padding: 2px 8px;
    border-radius: var(--ds-radius-full);
    font-size: var(--ds-text-sm);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* Dot indicator */
.ds-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.ds-dot-success { background: var(--ds-success); }
.ds-dot-warning { background: var(--ds-warning); }
.ds-dot-danger { background: var(--ds-danger); }
.ds-dot-info { background: var(--ds-info); }
.ds-dot-muted { background: var(--ds-gray-400); }
.ds-dot-accent { background: var(--ds-accent); }

.ds-dot-pulse { position: relative; }

.ds-dot-pulse::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: inherit;
    opacity: 0.3;
    animation: ds-pulse 2s ease-in-out infinite;
}

@keyframes ds-pulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(2); opacity: 0; }
}

/* Platform badge */
.ds-platform {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    font-size: var(--ds-text-xs);
    font-weight: 600;
    border-radius: var(--ds-radius-sm);
    /* Fallback for browsers that don't support color-mix */
    background: rgba(100, 116, 139, 0.08);
    background: color-mix(in srgb, var(--platform-color, #64748b) 8%, transparent);
    color: var(--platform-color, #64748b);
}

.ds-platform i { font-size: 13px; }


/* =====================================================
   8. TABLES
   ===================================================== */
.ds-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--ds-text-base);
}

.ds-table thead th {
    padding: 10px 16px;
    font-size: var(--ds-text-xs);
    font-weight: 600;
    color: var(--ds-gray-500);
    text-transform: uppercase;
    letter-spacing: var(--ds-tracking-wide);
    background: var(--ds-gray-50);
    border-bottom: 1px solid var(--ds-gray-200);
    text-align: left;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Sortable header */
.ds-table thead th.ds-sortable {
    cursor: pointer;
    user-select: none;
    transition: color var(--ds-transition);
}

.ds-table thead th.ds-sortable:hover { color: var(--ds-gray-900); }
.ds-table thead th.ds-sorted { color: var(--ds-gray-900); }

.ds-table thead th .ds-sort-icon {
    display: inline-flex;
    margin-left: 2px;
    font-size: 12px;
    opacity: 0.4;
    vertical-align: middle;
}

.ds-table thead th.ds-sorted .ds-sort-icon {
    opacity: 1;
    color: var(--ds-accent);
}

.ds-table tbody td {
    padding: 12px 16px;
    color: var(--ds-gray-700);
    border-bottom: 1px solid var(--ds-gray-100);
    vertical-align: middle;
}

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

.ds-table tbody tr {
    transition: background var(--ds-duration-fast);
}

.ds-table tbody tr:hover { background: var(--ds-gray-50); }

.ds-table tbody tr.ds-selected { background: var(--ds-accent-lighter); }

.ds-table .text-end { text-align: right; }
.ds-table .text-center { text-align: center; }

/* Compact table */
.ds-table-compact thead th { padding: 8px 12px; }
.ds-table-compact tbody td { padding: 8px 12px; font-size: var(--ds-text-sm); }

/* Striped */
.ds-table-striped tbody tr:nth-child(even) { background: var(--ds-gray-25); }
.ds-table-striped tbody tr:hover { background: var(--ds-gray-50); }

/* Responsive */
@media (max-width: 768px) {
    .ds-table thead { display: none; }

    .ds-table tbody tr {
        display: block;
        padding: 12px 16px;
        border-bottom: 1px solid var(--ds-gray-100);
    }

    .ds-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 4px 0;
        border-bottom: none;
    }

    .ds-table tbody td::before {
        content: attr(data-label);
        font-size: var(--ds-text-xs);
        font-weight: 600;
        color: var(--ds-gray-400);
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }
}


/* =====================================================
   9. FORMS
   ===================================================== */
.ds-form-group { margin-bottom: 16px; }

.ds-label {
    display: block;
    font-size: var(--ds-text-base);
    font-weight: 500;
    color: var(--ds-gray-700);
    margin-bottom: 6px;
}

.ds-label-optional {
    font-weight: 400;
    color: var(--ds-gray-400);
    margin-left: 4px;
}

.ds-hint {
    font-size: var(--ds-text-xs);
    color: var(--ds-gray-500);
    margin-top: 4px;
}

.ds-hint-error { color: var(--ds-danger); }

.ds-input,
.ds-select,
.ds-textarea {
    width: 100%;
    padding: 7px 12px;
    font-family: var(--ds-font);
    font-size: var(--ds-text-base);
    color: var(--ds-gray-900);
    background: var(--ds-white);
    border: 1px solid var(--ds-gray-300);
    border-radius: var(--ds-radius);
    transition: all var(--ds-transition);
    outline: none;
    box-shadow: var(--ds-shadow-xs);
    line-height: 20px;
    box-sizing: border-box;
}

.ds-input:hover,
.ds-select:hover,
.ds-textarea:hover {
    border-color: var(--ds-gray-400);
}

.ds-input:focus,
.ds-select:focus,
.ds-textarea:focus {
    border-color: var(--ds-accent);
    box-shadow: var(--ds-ring-accent);
}

.ds-input::placeholder { color: var(--ds-gray-400); }

.ds-textarea { resize: vertical; min-height: 80px; }

/* Error state */
.ds-input-error,
.ds-select-error,
.ds-textarea-error {
    border-color: var(--ds-danger) !important;
}

.ds-input-error:focus,
.ds-select-error:focus,
.ds-textarea-error:focus {
    box-shadow: var(--ds-ring-danger) !important;
}

/* Select */
.ds-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 36px;
    cursor: pointer;
}

.ds-select option {
    padding: 8px 12px;
    background: var(--ds-white);
    color: var(--ds-gray-900);
}

/* Input with icon */
.ds-input-icon { position: relative; }

.ds-input-icon > i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ds-gray-400);
    font-size: 16px;
    pointer-events: none;
    z-index: 1;
}

.ds-input-icon .ds-input { padding-left: 34px; }

/* Input Group — prefix/suffix with icon, text, or button */
.ds-input-group {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--ds-gray-300);
    border-radius: var(--ds-radius);
    overflow: hidden;
    background: var(--ds-white);
    box-shadow: var(--ds-shadow-xs);
    transition: all var(--ds-transition);
}

.ds-input-group:hover {
    border-color: var(--ds-gray-400);
}

.ds-input-group:focus-within {
    border-color: var(--ds-accent);
    box-shadow: var(--ds-ring-accent);
}

.ds-input-group .ds-input,
.ds-input-group .ds-select,
.ds-input-group .ds-textarea {
    border: none;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
    flex: 1;
    min-width: 0;
}

.ds-input-group .ds-input:hover,
.ds-input-group .ds-select:hover,
.ds-input-group .ds-textarea:hover,
.ds-input-group .ds-input:focus,
.ds-input-group .ds-select:focus,
.ds-input-group .ds-textarea:focus {
    border: none;
    box-shadow: none;
}

.ds-input-group-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    font-size: 14px;
    color: var(--ds-gray-400);
    background: var(--ds-gray-50);
    border: none;
    min-width: 42px;
    flex-shrink: 0;
    user-select: none;
}

.ds-input-group-text:first-child { border-right: 1px solid var(--ds-gray-200); }
.ds-input-group-text:last-child { border-left: 1px solid var(--ds-gray-200); }

.ds-input-group-text i { font-size: 16px; }

.ds-input-group .ds-btn {
    border-radius: 0;
    border: none;
    border-left: 1px solid var(--ds-gray-200);
    white-space: nowrap;
    box-shadow: none;
}

.ds-input-group .ds-btn:first-child {
    border-left: none;
    border-right: 1px solid var(--ds-gray-200);
}

/* File Upload */
.ds-file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 16px;
    background: var(--ds-white);
    border: 2px dashed var(--ds-gray-300);
    border-radius: var(--ds-radius-lg);
    cursor: pointer;
    transition: all var(--ds-transition);
    text-align: center;
    position: relative;
}

.ds-file-upload:hover {
    border-color: var(--ds-accent);
    background: var(--ds-accent-lighter);
}

.ds-file-upload.ds-file-upload-drag {
    border-color: var(--ds-accent);
    background: var(--ds-accent-lighter);
    box-shadow: var(--ds-ring-accent);
}

.ds-file-upload-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.ds-file-upload-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ds-accent-light);
    color: var(--ds-accent);
    border-radius: var(--ds-radius-full);
    font-size: 20px;
    flex-shrink: 0;
}

.ds-file-upload-text {
    font-size: var(--ds-text-base);
    font-weight: 500;
    color: var(--ds-gray-700);
}

.ds-file-upload-text span {
    color: var(--ds-accent);
    font-weight: 600;
}

.ds-file-upload-hint {
    font-size: var(--ds-text-xs);
    color: var(--ds-gray-400);
}

/* Compact – single line for inline use */
.ds-file-upload-compact {
    flex-direction: row;
    padding: 10px 14px;
    gap: 12px;
}

.ds-file-upload-compact .ds-file-upload-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
}

.ds-file-upload-compact .ds-file-upload-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-align: left;
}

.ds-file-upload-compact .ds-file-upload-text {
    font-size: 13px;
}

.ds-file-upload-compact .ds-file-upload-hint {
    font-size: 11px;
}

/* File preview (shown after file selected) */
.ds-file-upload-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--ds-white);
    border: 1px solid var(--ds-gray-200);
    border-radius: var(--ds-radius-lg);
    margin-top: 8px;
}

.ds-file-upload-preview img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--ds-radius);
    border: 1px solid var(--ds-gray-200);
    flex-shrink: 0;
}

.ds-file-upload-preview-info {
    flex: 1;
    min-width: 0;
}

.ds-file-upload-preview-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ds-gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ds-file-upload-preview-size {
    font-size: 11px;
    color: var(--ds-gray-400);
}

.ds-file-upload-preview-remove {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--ds-gray-200);
    border-radius: var(--ds-radius);
    color: var(--ds-gray-400);
    cursor: pointer;
    transition: all var(--ds-transition);
    flex-shrink: 0;
    font-size: 14px;
    padding: 0;
}

.ds-file-upload-preview-remove:hover {
    background: var(--ds-danger-light);
    border-color: var(--ds-danger-border);
    color: var(--ds-danger);
}

/* Toggle / Switch */
.ds-toggle {
    position: relative;
    width: 36px;
    height: 20px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--ds-gray-300);
    border-radius: var(--ds-radius-full);
    cursor: pointer;
    transition: background var(--ds-transition);
    border: none;
    outline: none;
    flex-shrink: 0;
}

.ds-toggle::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--ds-white);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform var(--ds-transition);
    box-shadow: var(--ds-shadow-sm);
}

.ds-toggle:checked { background: var(--ds-accent); }
.ds-toggle:checked::after { transform: translateX(16px); }
.ds-toggle:focus-visible { box-shadow: var(--ds-ring-accent); }

/* Checkbox */
.ds-checkbox {
    width: 16px;
    height: 16px;
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid var(--ds-gray-300);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--ds-transition);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    background: var(--ds-white);
}

.ds-checkbox:hover { border-color: var(--ds-gray-400); }

.ds-checkbox:checked {
    background: var(--ds-accent);
    border-color: var(--ds-accent);
}

.ds-checkbox:checked::after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: solid var(--ds-white);
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
    margin-top: -1px;
}

.ds-checkbox:focus-visible { box-shadow: var(--ds-ring-accent); }

/* Radio */
.ds-radio {
    width: 16px;
    height: 16px;
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid var(--ds-gray-300);
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--ds-transition);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    background: var(--ds-white);
}

.ds-radio:hover { border-color: var(--ds-gray-400); }

.ds-radio:checked {
    border-color: var(--ds-accent);
    border-width: 5px;
}

.ds-radio:focus-visible { box-shadow: var(--ds-ring-accent); }

/* Form inline */
.ds-form-inline {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.ds-form-inline .ds-form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}


/* =====================================================
   10. FILTER BAR
   ===================================================== */
.ds-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    flex-wrap: wrap;
}

.ds-filter .ds-form-group {
    margin-bottom: 0;
    min-width: 140px;
}

.ds-filter .ds-form-group.flex-1 {
    flex: 1;
    min-width: 200px;
}

/* Filter tag (removable) */
.ds-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--ds-accent-light);
    color: var(--ds-accent-text);
    border-radius: var(--ds-radius-sm);
    font-size: var(--ds-text-xs);
    font-weight: 500;
}

.ds-filter-tag-remove {
    display: inline-flex;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--ds-transition);
}

.ds-filter-tag-remove:hover { opacity: 1; }


/* =====================================================
   11. EMPTY STATE
   ===================================================== */
.ds-empty {
    text-align: center;
    padding: 60px 20px;
}

.ds-empty-icon {
    width: 56px;
    height: 56px;
    background: var(--ds-gray-100);
    border-radius: var(--ds-radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.ds-empty-icon i { font-size: 24px; color: var(--ds-gray-400); }

.ds-empty h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--ds-gray-700);
    margin: 0 0 6px;
}

.ds-empty p {
    font-size: var(--ds-text-base);
    color: var(--ds-gray-500);
    margin: 0 0 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    line-height: var(--ds-leading-relaxed);
}

.ds-empty a {
    color: var(--ds-accent);
    text-decoration: none;
    font-weight: 500;
}

.ds-empty a:hover { text-decoration: underline; }


/* =====================================================
   12. PAGINATION
   ===================================================== */
.ds-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 20px;
    border-top: 1px solid var(--ds-gray-100);
}

.ds-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-size: var(--ds-text-base);
    font-weight: 500;
    color: var(--ds-gray-600);
    background: var(--ds-white);
    border: 1px solid var(--ds-gray-200);
    border-radius: var(--ds-radius-sm);
    text-decoration: none;
    transition: all var(--ds-transition);
    font-variant-numeric: tabular-nums;
}

.ds-page-btn:hover {
    background: var(--ds-gray-50);
    border-color: var(--ds-gray-300);
    color: var(--ds-gray-900);
}

.ds-page-btn.active {
    background: var(--ds-gray-900);
    border-color: var(--ds-gray-900);
    color: var(--ds-white);
}

.ds-page-dots { color: var(--ds-gray-400); padding: 0 2px; user-select: none; }
.ds-page-info { font-size: var(--ds-text-sm); color: var(--ds-gray-500); }


/* =====================================================
   13. TABS
   ===================================================== */
.ds-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--ds-gray-200);
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ds-tab {
    padding: 10px 16px;
    font-size: var(--ds-text-base);
    font-weight: 500;
    color: var(--ds-gray-500);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--ds-transition);
    text-decoration: none;
    white-space: nowrap;
    outline: none;
    margin-bottom: -1px;
}

.ds-tab:hover { color: var(--ds-gray-700); }

.ds-tab.active {
    color: var(--ds-gray-900);
    border-bottom-color: var(--ds-gray-900);
}

.ds-tab i { margin-right: 6px; font-size: 15px; vertical-align: -1px; }

.ds-tab .ds-tab-count {
    background: var(--ds-gray-100);
    color: var(--ds-gray-500);
    padding: 1px 6px;
    border-radius: var(--ds-radius-full);
    font-size: var(--ds-text-xs);
    font-weight: 600;
    margin-left: 6px;
}

.ds-tab.active .ds-tab-count {
    background: var(--ds-gray-900);
    color: var(--ds-white);
}

/* Pill Tabs */
.ds-tabs-pill {
    display: inline-flex;
    gap: 2px;
    background: var(--ds-gray-100);
    padding: 3px;
    border-radius: var(--ds-radius);
    margin-bottom: 20px;
}

.ds-tab-pill {
    padding: 6px 14px;
    font-size: var(--ds-text-base);
    font-weight: 500;
    color: var(--ds-gray-600);
    background: none;
    border: none;
    border-radius: var(--ds-radius-sm);
    cursor: pointer;
    transition: all var(--ds-transition);
    outline: none;
}

.ds-tab-pill:hover { color: var(--ds-gray-800); }

.ds-tab-pill.active {
    background: var(--ds-white);
    color: var(--ds-gray-900);
    box-shadow: var(--ds-shadow-sm);
}

/* Tab Panes */
.ds-tab-pane { display: none; }
.ds-tab-pane.active { display: block; }


/* =====================================================
   14. MODAL
   ===================================================== */
/* =====================================================
   14. MODAL — Ultra-Modern Compact Modal System
   =====================================================
   Usage:
     <div class="ds-modal-backdrop" id="myModal">
       <div class="ds-modal ds-modal-lg">
         <div class="ds-modal-header">
           <h3 class="ds-modal-title">Title</h3>
           <button class="ds-modal-close" onclick="closeModal('myModal')"><i class="ti ti-x"></i></button>
         </div>
         <div class="ds-modal-body">...</div>
         <div class="ds-modal-footer">...</div>
       </div>
     </div>
   Sizes: ds-modal (520px), ds-modal-sm (400px), ds-modal-lg (720px), ds-modal-xl (960px), ds-modal-full
   Form wrapper: add style="display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden"
   ===================================================== */

.ds-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.5);
    backdrop-filter: blur(8px) saturate(1.2);
    -webkit-backdrop-filter: blur(8px) saturate(1.2);
    z-index: var(--ds-z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    overscroll-behavior: contain;
}

.ds-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ds-modal {
    width: 100%;
    max-width: 520px;
    max-height: calc(100dvh - 32px);
    background: var(--ds-white);
    border-radius: 16px;
    box-shadow:
        0 0 0 1px rgba(9, 9, 11, 0.04),
        0 8px 40px -8px rgba(9, 9, 11, 0.2),
        0 24px 56px -16px rgba(9, 9, 11, 0.14);
    display: flex;
    flex-direction: column;
    transform: scale(0.97) translateY(6px);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s ease;
    outline: none;
    contain: layout;
}

.ds-modal-backdrop.active .ds-modal {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Size Variants */
.ds-modal-sm { max-width: 400px; }
.ds-modal-lg { max-width: 720px; }
.ds-modal-xl { max-width: 960px; }
.ds-modal-full { max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); }

/* Header */
.ds-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--ds-gray-100);
    flex-shrink: 0;
    min-height: 52px;
}

.ds-modal-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ds-gray-900);
    margin: 0;
    line-height: 1.35;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ds-modal-title i {
    font-size: 18px;
    color: var(--ds-primary);
    flex-shrink: 0;
}

.ds-modal-desc {
    font-size: 12px;
    color: var(--ds-gray-500);
    margin: 2px 0 0;
    line-height: 1.4;
}

/* Close button */
.ds-modal-close {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--ds-gray-400);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.ds-modal-close:hover {
    background: var(--ds-gray-100);
    color: var(--ds-gray-700);
}

.ds-modal-close:active {
    transform: scale(0.92);
}

.ds-modal-close i {
    font-size: 18px;
}

/* Body — scrollable area */
.ds-modal-body {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--ds-gray-200) transparent;
}

.ds-modal-body::-webkit-scrollbar { width: 5px; }
.ds-modal-body::-webkit-scrollbar-track { background: transparent; }
.ds-modal-body::-webkit-scrollbar-thumb {
    background: var(--ds-gray-200);
    border-radius: 10px;
}
.ds-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--ds-gray-300);
}

/* Footer */
.ds-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid var(--ds-gray-100);
    flex-shrink: 0;
    background: var(--ds-gray-50);
    border-radius: 0 0 16px 16px;
}

/* Footer secondary action alignment */
.ds-modal-footer-start {
    margin-right: auto;
}

/* Form wrapper inside modal — maintains flex layout */
.ds-modal-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .ds-modal-backdrop { padding: 8px; }
    .ds-modal {
        max-width: 100%;
        max-height: calc(100dvh - 16px);
        border-radius: 14px;
    }
    .ds-modal-lg,
    .ds-modal-xl,
    .ds-modal-full { max-width: 100%; }
    .ds-modal-header { padding: 12px 14px; }
    .ds-modal-body { padding: 14px; }
    .ds-modal-footer { padding: 10px 14px; }
}


/* =====================================================
   15. ACCORDION
   ===================================================== */
.ds-accordion {
    border: 1px solid var(--ds-gray-200);
    border-radius: var(--ds-radius-lg);
    overflow: hidden;
}

.ds-accordion-item { border-bottom: 1px solid var(--ds-gray-100); }
.ds-accordion-item:last-child { border-bottom: none; }

.ds-accordion-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    font-size: var(--ds-text-md);
    font-weight: 500;
    color: var(--ds-gray-800);
    background: var(--ds-white);
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background var(--ds-transition);
    outline: none;
}

.ds-accordion-trigger:hover { background: var(--ds-gray-50); }

.ds-accordion-trigger i.chevron {
    font-size: 16px;
    color: var(--ds-gray-400);
    transition: transform var(--ds-transition-slow);
    flex-shrink: 0;
}

.ds-accordion-item.open .ds-accordion-trigger i.chevron {
    transform: rotate(180deg);
}

.ds-accordion-content {
    padding: 0 16px 16px;
    font-size: var(--ds-text-base);
    color: var(--ds-gray-600);
    line-height: var(--ds-leading-relaxed);
    display: none;
}

.ds-accordion-item.open .ds-accordion-content { display: block; }


/* =====================================================
   16. ALERTS
   ===================================================== */
.ds-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--ds-radius);
    font-size: var(--ds-text-base);
    line-height: var(--ds-leading-normal);
    margin-bottom: 16px;
}

.ds-alert > i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.ds-alert-info { background: var(--ds-info-light); color: var(--ds-info); border: 1px solid var(--ds-info-border); }
.ds-alert-success { background: var(--ds-success-light); color: var(--ds-success); border: 1px solid var(--ds-success-border); }
.ds-alert-warning { background: var(--ds-warning-light); color: var(--ds-warning); border: 1px solid var(--ds-warning-border); }
.ds-alert-danger { background: var(--ds-danger-light); color: var(--ds-danger); border: 1px solid var(--ds-danger-border); }

.ds-alert-dismiss {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    padding: 0;
    font-size: 16px;
    transition: opacity var(--ds-transition);
}

.ds-alert-dismiss:hover { opacity: 1; }


/* =====================================================
   17. DROPDOWN
   ===================================================== */
.ds-dropdown { position: relative; display: inline-block; }

.ds-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 200px;
    background: var(--ds-white);
    border: 1px solid var(--ds-gray-200);
    border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-shadow-lg);
    padding: 4px;
    z-index: var(--ds-z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px) scale(0.98);
    transition: all var(--ds-transition);
}

.ds-dropdown.open .ds-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.ds-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    font-size: var(--ds-text-base);
    color: var(--ds-gray-700);
    background: none;
    border: none;
    border-radius: var(--ds-radius-sm);
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: background var(--ds-transition);
}

.ds-dropdown-item:hover { background: var(--ds-gray-50); color: var(--ds-gray-900); }
.ds-dropdown-item i { font-size: 16px; color: var(--ds-gray-500); }
.ds-dropdown-item:hover i { color: var(--ds-gray-700); }
.ds-dropdown-item.danger { color: var(--ds-danger); }
.ds-dropdown-item.danger i { color: var(--ds-danger); }

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

.ds-dropdown-label {
    padding: 6px 12px 4px;
    font-size: var(--ds-text-xs);
    font-weight: 600;
    color: var(--ds-gray-400);
    text-transform: uppercase;
    letter-spacing: var(--ds-tracking-wide);
}


/* =====================================================
   17b. DRAWER — Sidebar Panel Component
   Professional side-panel drawer for forms, detail views,
   settings, etc. Slides from left or right.
   Sizes: sm(380px) default(520px) lg(680px) xl(860px) full
   ===================================================== */

/* Backdrop */
.ds-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: var(--ds-z-modal);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ds-drawer-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Drawer panel */
.ds-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 520px;
    max-width: 100%;
    background: var(--ds-white);
    display: flex;
    flex-direction: column;
    z-index: calc(var(--ds-z-modal) + 1);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
}

/* Right side (default) */
.ds-drawer {
    right: 0;
    transform: translateX(100%);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.08), -2px 0 8px rgba(0, 0, 0, 0.04);
    border-left: 1px solid var(--ds-gray-100);
}

.ds-drawer-backdrop.active .ds-drawer {
    transform: translateX(0);
}

/* Left side variant */
.ds-drawer-left .ds-drawer {
    right: auto;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.08), 2px 0 8px rgba(0, 0, 0, 0.04);
    border-left: none;
    border-right: 1px solid var(--ds-gray-100);
}

.ds-drawer-left.active .ds-drawer {
    transform: translateX(0);
}

/* Size variants */
.ds-drawer-sm .ds-drawer { width: 380px; }
.ds-drawer-lg .ds-drawer { width: 680px; }
.ds-drawer-xl .ds-drawer { width: 860px; }
.ds-drawer-full .ds-drawer { width: 100%; }

/* Header */
.ds-drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--ds-gray-100);
    flex-shrink: 0;
    background: var(--ds-white);
}

.ds-drawer-header-content {
    flex: 1;
    min-width: 0;
}

.ds-drawer-title {
    font-size: var(--ds-text-lg);
    font-weight: 700;
    color: var(--ds-gray-900);
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.3;
}

.ds-drawer-title i {
    font-size: 20px;
    color: var(--ds-accent);
    flex-shrink: 0;
}

.ds-drawer-desc {
    font-size: var(--ds-text-sm);
    color: var(--ds-gray-500);
    margin-top: 4px;
    line-height: 1.5;
}

.ds-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: var(--ds-radius-sm);
    border: 1px solid var(--ds-gray-200);
    background: var(--ds-white);
    color: var(--ds-gray-400);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--ds-transition);
    flex-shrink: 0;
    margin-top: 2px;
}

.ds-drawer-close:hover {
    background: var(--ds-gray-50);
    color: var(--ds-gray-700);
    border-color: var(--ds-gray-300);
}

.ds-drawer-close i {
    font-size: 16px;
}

/* Body */
.ds-drawer-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Custom scrollbar for drawer body */
.ds-drawer-body::-webkit-scrollbar { width: 5px; }
.ds-drawer-body::-webkit-scrollbar-track { background: transparent; }
.ds-drawer-body::-webkit-scrollbar-thumb {
    background: var(--ds-gray-200);
    border-radius: 10px;
}
.ds-drawer-body::-webkit-scrollbar-thumb:hover { background: var(--ds-gray-300); }

/* Footer */
.ds-drawer-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--ds-gray-100);
    flex-shrink: 0;
    background: var(--ds-gray-50);
}

.ds-drawer-footer-start {
    margin-right: auto;
}

/* Form variant — wraps body + footer for flex scroll */
.ds-drawer-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.ds-drawer-form .ds-drawer-body {
    flex: 1;
}

/* Divider inside drawer body */
.ds-drawer-divider {
    height: 1px;
    background: var(--ds-gray-100);
    margin: 20px 0;
}

/* Section inside drawer body */
.ds-drawer-section {
    margin-bottom: 24px;
}

.ds-drawer-section:last-child {
    margin-bottom: 0;
}

.ds-drawer-section-title {
    font-size: var(--ds-text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--ds-tracking-wide);
    color: var(--ds-gray-400);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ds-drawer-section-title i {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 640px) {
    .ds-drawer { width: 100% !important; }
    .ds-drawer-header { padding: 16px 20px; }
    .ds-drawer-body { padding: 20px; }
    .ds-drawer-footer { padding: 14px 20px; }
}


/* =====================================================
   18. HELP SLIDER (Side Panel)
   ===================================================== */
.ds-slider-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: var(--ds-z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--ds-transition-slow);
}

.ds-slider-backdrop.active { opacity: 1; visibility: visible; }

.ds-slider {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100%;
    height: 100vh;
    background: var(--ds-white);
    box-shadow: var(--ds-shadow-xl);
    transform: translateX(100%);
    transition: transform var(--ds-transition-slow);
    display: flex;
    flex-direction: column;
    z-index: calc(var(--ds-z-modal) + 1);
}

.ds-slider-backdrop.active .ds-slider { transform: translateX(0); }

.ds-slider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ds-gray-100);
    flex-shrink: 0;
}

.ds-slider-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--ds-text-lg);
    font-weight: 600;
    color: var(--ds-gray-900);
}

.ds-slider-title i { font-size: 20px; color: var(--ds-gray-500); }

.ds-slider-body { flex: 1; padding: 20px; overflow-y: auto; }

.ds-slider-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--ds-gray-100);
    flex-shrink: 0;
}

@media (max-width: 480px) { .ds-slider { width: 100%; } }


/* =====================================================
   19. TOAST NOTIFICATIONS
   Toast container, toast, and animation styles are defined
   in ds-layout.css (layout module) to avoid duplication.
   Only component-level toast utilities belong here.
   ===================================================== */


/* =====================================================
   20. PROGRESS BAR & STEPS
   ===================================================== */
.ds-progress {
    width: 100%;
    height: 6px;
    background: var(--ds-gray-100);
    border-radius: var(--ds-radius-full);
    overflow: hidden;
}

.ds-progress-bar {
    height: 100%;
    background: var(--ds-accent);
    border-radius: var(--ds-radius-full);
    transition: width 0.5s var(--ds-ease);
}

.ds-progress-bar-success { background: var(--ds-success); }
.ds-progress-bar-warning { background: var(--ds-warning); }
.ds-progress-bar-danger { background: var(--ds-danger); }

/* Indeterminate */
.ds-progress-indeterminate .ds-progress-bar {
    width: 30%;
    animation: ds-progress-indeterminate 1.5s var(--ds-ease) infinite;
}

@keyframes ds-progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* Steps / Stepper */
.ds-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
}

.ds-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--ds-text-base);
    color: var(--ds-gray-400);
    font-weight: 500;
    white-space: nowrap;
}

.ds-step-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--ds-gray-300);
    font-size: var(--ds-text-sm);
    font-weight: 600;
    flex-shrink: 0;
    transition: all var(--ds-transition);
}

.ds-step.active { color: var(--ds-accent-text); }

.ds-step.active .ds-step-number {
    background: var(--ds-accent);
    border-color: var(--ds-accent);
    color: var(--ds-white);
}

.ds-step.completed { color: var(--ds-success); }

.ds-step.completed .ds-step-number {
    background: var(--ds-success);
    border-color: var(--ds-success);
    color: var(--ds-white);
}

.ds-step-line {
    flex: 1;
    height: 2px;
    background: var(--ds-gray-200);
    margin: 0 12px;
    min-width: 24px;
}

.ds-step-line.completed { background: var(--ds-success); }


/* =====================================================
   21. SKELETON LOADING
   ===================================================== */
.ds-skeleton {
    background: linear-gradient(90deg, var(--ds-gray-100) 25%, var(--ds-gray-150) 37%, var(--ds-gray-100) 63%);
    background-size: 400% 100%;
    animation: ds-shimmer 1.5s ease infinite;
    border-radius: var(--ds-radius);
}

.ds-skeleton-text { height: 14px; margin-bottom: 8px; border-radius: var(--ds-radius-xs); }
.ds-skeleton-text:last-child { width: 60%; }
.ds-skeleton-avatar { width: 36px; height: 36px; border-radius: 50%; }
.ds-skeleton-btn { width: 80px; height: 34px; border-radius: var(--ds-radius); }
.ds-skeleton-card { height: 120px; border-radius: var(--ds-radius-lg); }

@keyframes ds-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}


/* =====================================================
   22. TOOLTIP (CSS-only)
   ===================================================== */
[data-tooltip] { position: relative; }

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 5px 10px;
    background: var(--ds-gray-900);
    color: var(--ds-white);
    font-size: var(--ds-text-xs);
    font-weight: 500;
    border-radius: var(--ds-radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--ds-transition);
    pointer-events: none;
    z-index: var(--ds-z-tooltip);
    line-height: 1.3;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--ds-gray-900);
    opacity: 0;
    visibility: hidden;
    transition: all var(--ds-transition);
    pointer-events: none;
    z-index: var(--ds-z-tooltip);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

[data-tooltip]:hover::before { transform: translateX(-50%) translateY(0); }


/* =====================================================
   23. KBD (Keyboard Shortcut)
   ===================================================== */
.ds-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-family: var(--ds-font);
    font-size: 11px;
    font-weight: 500;
    color: var(--ds-gray-600);
    background: var(--ds-gray-50);
    border: 1px solid var(--ds-gray-200);
    border-bottom-width: 2px;
    border-radius: var(--ds-radius-xs);
    line-height: 1;
}


/* =====================================================
   24. CODE BLOCK
   ===================================================== */
.ds-code {
    font-family: var(--ds-mono);
    font-size: var(--ds-text-sm);
    color: var(--ds-accent-text);
    background: var(--ds-accent-light);
    padding: 2px 6px;
    border-radius: var(--ds-radius-xs);
}

.ds-code-block {
    font-family: var(--ds-mono);
    font-size: var(--ds-text-sm);
    color: var(--ds-gray-200);
    background: var(--ds-gray-900);
    padding: 16px 20px;
    border-radius: var(--ds-radius-lg);
    overflow-x: auto;
    line-height: var(--ds-leading-relaxed);
    margin-bottom: 16px;
}

.ds-code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--ds-gray-800);
    border-radius: var(--ds-radius-lg) var(--ds-radius-lg) 0 0;
    font-size: var(--ds-text-xs);
    color: var(--ds-gray-400);
    font-weight: 500;
}

.ds-code-block-header + .ds-code-block {
    border-radius: 0 0 var(--ds-radius-lg) var(--ds-radius-lg);
}


/* =====================================================
   25. AVATAR & AVATAR GROUP
   ===================================================== */
.ds-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--ds-gray-200);
    flex-shrink: 0;
    border: 2px solid var(--ds-white);
}

.ds-avatar-xs { width: 20px; height: 20px; }
.ds-avatar-sm { width: 24px; height: 24px; }
.ds-avatar-md { width: 36px; height: 36px; }
.ds-avatar-lg { width: 40px; height: 40px; }
.ds-avatar-xl { width: 48px; height: 48px; }
.ds-avatar-2xl { width: 64px; height: 64px; }

.ds-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ds-accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ds-accent);
    font-size: var(--ds-text-sm);
    font-weight: 600;
    flex-shrink: 0;
}

/* Avatar group (stacked) */
.ds-avatar-group { display: flex; }

.ds-avatar-group .ds-avatar {
    margin-left: -8px;
    box-shadow: 0 0 0 2px var(--ds-white);
}

.ds-avatar-group .ds-avatar:first-child { margin-left: 0; }

.ds-avatar-group-count {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ds-gray-100);
    border: 2px solid var(--ds-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--ds-text-xs);
    font-weight: 600;
    color: var(--ds-gray-600);
    margin-left: -8px;
}


/* =====================================================
   26. COMMAND PALETTE HINT
   ===================================================== */
.ds-search-command {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--ds-gray-50);
    border: 1px solid var(--ds-gray-200);
    border-radius: var(--ds-radius);
    color: var(--ds-gray-400);
    font-size: var(--ds-text-base);
    cursor: pointer;
    transition: all var(--ds-transition);
    min-width: 220px;
}

.ds-search-command:hover {
    border-color: var(--ds-gray-300);
    background: var(--ds-white);
}

.ds-search-command i { font-size: 16px; }
.ds-search-command span { flex: 1; }
.ds-search-command .ds-kbd { margin-left: auto; }


/* =====================================================
   27. DIVIDER
   ===================================================== */
.ds-divider {
    height: 1px;
    background: var(--ds-gray-200);
    margin: 20px 0;
    border: none;
}

.ds-divider-sm { margin: 12px 0; }
.ds-divider-lg { margin: 32px 0; }

.ds-divider-label {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--ds-gray-400);
    font-size: var(--ds-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--ds-tracking-wide);
    margin: 20px 0;
}

.ds-divider-label::before,
.ds-divider-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ds-gray-200);
}


/* =====================================================
   28. UTILITY CLASSES
   ===================================================== */
.ds-text-muted { color: var(--ds-gray-500); }
.ds-text-xs { font-size: var(--ds-text-xs); }
.ds-text-sm { font-size: var(--ds-text-sm); }
.ds-text-base { font-size: var(--ds-text-base); }
.ds-text-md { font-size: var(--ds-text-md); }
.ds-text-lg { font-size: var(--ds-text-lg); }
.ds-text-center { text-align: center; }
.ds-text-right { text-align: right; }
.ds-text-bold { font-weight: 600; }
.ds-text-semibold { font-weight: 500; }
.ds-text-mono { font-family: var(--ds-mono); }
.ds-text-accent { color: var(--ds-accent-text); }
.ds-text-success { color: var(--ds-success); }
.ds-text-warning { color: var(--ds-warning); }
.ds-text-danger { color: var(--ds-danger); }

/* Spacing (4px grid) */
.ds-mt-0 { margin-top: 0; }
.ds-mt-4 { margin-top: 4px; }
.ds-mt-8 { margin-top: 8px; }
.ds-mt-12 { margin-top: 12px; }
.ds-mt-16 { margin-top: 16px; }
.ds-mt-24 { margin-top: 24px; }
.ds-mt-32 { margin-top: 32px; }
.ds-mb-0 { margin-bottom: 0; }
.ds-mb-4 { margin-bottom: 4px; }
.ds-mb-8 { margin-bottom: 8px; }
.ds-mb-12 { margin-bottom: 12px; }
.ds-mb-16 { margin-bottom: 16px; }
.ds-mb-24 { margin-bottom: 24px; }
.ds-mb-32 { margin-bottom: 32px; }
.ds-ml-4 { margin-left: 4px; }
.ds-ml-8 { margin-left: 8px; }
.ds-p-0 { padding: 0; }
.ds-pt-0 { padding-top: 0; }
.ds-p-8 { padding: 8px; }
.ds-p-12 { padding: 12px; }
.ds-p-16 { padding: 16px; }
.ds-p-20 { padding: 20px; }

/* Flexbox */
.ds-flex { display: flex; }
.ds-flex-center { display: flex; align-items: center; }
.ds-flex-between { display: flex; align-items: center; justify-content: space-between; }
.ds-flex-wrap { flex-wrap: wrap; }
.ds-flex-col { flex-direction: column; }
.ds-flex-1 { flex: 1; }
.ds-items-start { align-items: flex-start; }
.ds-items-center { align-items: center; }
.ds-items-end { align-items: flex-end; }
.ds-justify-center { justify-content: center; }
.ds-justify-end { justify-content: flex-end; }
.ds-justify-between { justify-content: space-between; }
.ds-gap-4 { gap: 4px; }
.ds-gap-6 { gap: 6px; }
.ds-gap-8 { gap: 8px; }
.ds-gap-12 { gap: 12px; }
.ds-gap-16 { gap: 16px; }
.ds-gap-20 { gap: 20px; }
.ds-gap-24 { gap: 24px; }

/* Layout */
.ds-w-full { width: 100%; }
.ds-min-w-0 { min-width: 0; }
.ds-overflow-hidden { overflow: hidden; }
.ds-relative { position: relative; }

/* Display */
.ds-hidden { display: none; }
.ds-block { display: block; }
.ds-inline-flex { display: inline-flex; }

/* Truncate */
.ds-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ds-line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ds-line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Border */
.ds-border { border: 1px solid var(--ds-gray-200); }
.ds-border-t { border-top: 1px solid var(--ds-gray-200); }
.ds-border-b { border-bottom: 1px solid var(--ds-gray-200); }
.ds-rounded { border-radius: var(--ds-radius); }
.ds-rounded-lg { border-radius: var(--ds-radius-lg); }
.ds-rounded-full { border-radius: var(--ds-radius-full); }

/* Shadow */
.ds-shadow-sm { box-shadow: var(--ds-shadow-sm); }
.ds-shadow { box-shadow: var(--ds-shadow); }
.ds-shadow-md { box-shadow: var(--ds-shadow-md); }
.ds-shadow-lg { box-shadow: var(--ds-shadow-lg); }
.ds-shadow-none { box-shadow: none; }

/* Bootstrap Compatibility Aliases — for migrated pages */
.text-center { text-align: center; }
.text-end, .text-right { text-align: right; }
.text-start, .text-left { text-align: left; }
.text-muted { color: var(--ds-gray-500); }
.text-danger { color: var(--ds-danger); }
.text-success { color: var(--ds-success); }
.text-warning { color: var(--ds-warning); }
.text-primary { color: var(--ds-accent); }
.text-info { color: var(--ds-info); }
.small { font-size: var(--ds-text-sm); }


/* =====================================================
   29. ANIMATIONS
   ===================================================== */
@keyframes ds-spin { to { transform: rotate(360deg); } }
@keyframes ds-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ds-slide-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ds-slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ds-scale-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

.ds-animate-fade-in { animation: ds-fade-in 0.2s var(--ds-ease); }
.ds-animate-slide-up { animation: ds-slide-up 0.3s var(--ds-ease-out); }
.ds-animate-slide-down { animation: ds-slide-down 0.3s var(--ds-ease-out); }
.ds-animate-scale-in { animation: ds-scale-in 0.2s var(--ds-ease-out); }


/* =====================================================
   30. BUTTON RIPPLE EFFECT
   ===================================================== */
.ds-btn-ripple {
    position: relative;
    overflow: hidden;
}

.ds-btn-ripple .ds-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0);
    animation: ds-ripple-anim 0.6s ease-out;
    pointer-events: none;
}

@keyframes ds-ripple-anim {
    to { transform: scale(4); opacity: 0; }
}


/* =====================================================
   31. GRADIENT TEXT
   ===================================================== */
.ds-gradient-text {
    background: linear-gradient(135deg, var(--ds-accent) 0%, #7c3aed 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ds-gradient-text-subtle {
    background: linear-gradient(135deg, var(--ds-gray-900) 0%, var(--ds-gray-600) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ds-gradient-text-accent {
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* =====================================================
   32. SCROLL PROGRESS BAR
   ===================================================== */
.ds-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--ds-accent), #7c3aed);
    z-index: 9999;
    transition: width 50ms linear;
    border-radius: 0 2px 2px 0;
}


/* =====================================================
   33. NOTIFICATION DROPDOWN
   ===================================================== */
.ds-notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 480px;
    background: var(--ds-white);
    border: 1px solid var(--ds-gray-200);
    border-radius: var(--ds-radius-xl);
    box-shadow: var(--ds-shadow-xl);
    z-index: var(--ds-z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.98);
    transition: all var(--ds-transition-slow);
    display: flex;
    flex-direction: column;
}

.ds-dropdown.open .ds-notification-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

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

.ds-notification-header h4 {
    font-size: var(--ds-text-md);
    font-weight: 600;
    color: var(--ds-gray-900);
    margin: 0;
}

.ds-notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.ds-notification-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: var(--ds-radius);
    cursor: pointer;
    transition: background var(--ds-transition);
}

.ds-notification-item:hover { background: var(--ds-gray-50); }

.ds-notification-item.unread {
    background: var(--ds-accent-lighter);
}

.ds-notification-item.unread:hover {
    background: var(--ds-accent-light);
}

.ds-notification-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--ds-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

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

.ds-notification-content { flex: 1; min-width: 0; }

.ds-notification-content p {
    font-size: var(--ds-text-base);
    color: var(--ds-gray-700);
    margin: 0;
    line-height: 1.4;
}

.ds-notification-content p strong { color: var(--ds-gray-900); }

.ds-notification-time {
    font-size: var(--ds-text-xs);
    color: var(--ds-gray-400);
    margin-top: 2px;
}

.ds-notification-unread-dot {
    width: 8px;
    height: 8px;
    background: var(--ds-accent);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 6px;
}

.ds-notification-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--ds-gray-100);
    text-align: center;
    flex-shrink: 0;
}

.ds-notification-footer a {
    font-size: var(--ds-text-sm);
    font-weight: 500;
    color: var(--ds-accent);
    text-decoration: none;
}

.ds-notification-footer a:hover { text-decoration: underline; }

/* Notification bell badge */
.ds-bell-wrapper { position: relative; }

.ds-bell-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: var(--ds-danger);
    color: var(--ds-white);
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--ds-white);
    line-height: 1;
}


/* =====================================================
   34. COMMAND PALETTE (⌘K)
   ===================================================== */
.ds-cmdk-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: calc(var(--ds-z-modal) + 10);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    visibility: hidden;
    transition: all var(--ds-duration-slow);
}

.ds-cmdk-backdrop.active { opacity: 1; visibility: visible; }

.ds-cmdk {
    width: 100%;
    max-width: 580px;
    background: var(--ds-white);
    border-radius: var(--ds-radius-xl);
    box-shadow: var(--ds-shadow-xl), 0 0 0 1px rgba(0,0,0,0.05);
    overflow: hidden;
    transform: scale(0.96) translateY(-8px);
    opacity: 0;
    transition: all var(--ds-duration-slow) var(--ds-ease-out);
}

.ds-cmdk-backdrop.active .ds-cmdk {
    transform: scale(1) translateY(0);
    opacity: 1;
}

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

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

.ds-cmdk-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: var(--ds-font);
    color: var(--ds-gray-900);
    background: transparent;
}

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

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

.ds-cmdk-group-label {
    padding: 8px 8px 4px;
    font-size: var(--ds-text-xs);
    font-weight: 600;
    color: var(--ds-gray-400);
    text-transform: uppercase;
    letter-spacing: var(--ds-tracking-wide);
}

.ds-cmdk-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--ds-radius);
    cursor: pointer;
    transition: background var(--ds-duration-fast);
    font-size: var(--ds-text-md);
    color: var(--ds-gray-700);
}

.ds-cmdk-item:hover,
.ds-cmdk-item.active {
    background: var(--ds-gray-50);
    color: var(--ds-gray-900);
}

.ds-cmdk-item i {
    font-size: 16px;
    color: var(--ds-gray-400);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

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

.ds-cmdk-shortcut {
    margin-left: auto;
    display: flex;
    gap: 3px;
}

.ds-cmdk-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--ds-gray-400);
    font-size: var(--ds-text-base);
}

.ds-cmdk-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--ds-gray-100);
    font-size: var(--ds-text-xs);
    color: var(--ds-gray-400);
}

.ds-cmdk-footer span {
    display: flex;
    align-items: center;
    gap: 6px;
}


/* =====================================================
   35. CONTEXT MENU (Right-Click)
   ===================================================== */
.ds-context-menu {
    position: fixed;
    min-width: 200px;
    background: var(--ds-white);
    border: 1px solid var(--ds-gray-200);
    border-radius: var(--ds-radius-lg);
    box-shadow: var(--ds-shadow-lg);
    padding: 4px;
    z-index: calc(var(--ds-z-modal) + 2);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.96);
    transition: all var(--ds-duration-fast);
}

.ds-context-menu.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}


/* =====================================================
   36. INLINE EDIT
   ===================================================== */
.ds-inline-edit {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    margin: -2px -6px;
    border-radius: var(--ds-radius-sm);
    cursor: text;
    transition: background var(--ds-transition);
    border: 1px solid transparent;
    min-width: 40px;
}

.ds-inline-edit:hover {
    background: var(--ds-gray-50);
    border-color: var(--ds-gray-200);
}

.ds-inline-edit .ds-inline-edit-icon {
    font-size: 12px;
    color: var(--ds-gray-400);
    opacity: 0;
    transition: opacity var(--ds-transition);
}

.ds-inline-edit:hover .ds-inline-edit-icon { opacity: 1; }

.ds-inline-edit-input {
    border: 1px solid var(--ds-accent);
    border-radius: var(--ds-radius-sm);
    padding: 2px 6px;
    margin: -3px -7px;
    font-size: inherit;
    font-family: var(--ds-font);
    color: var(--ds-gray-900);
    outline: none;
    box-shadow: var(--ds-ring-accent);
    background: var(--ds-white);
    min-width: 100px;
}


/* =====================================================
   37. MULTI-SELECT TOOLBAR
   ===================================================== */
.ds-bulk-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: var(--ds-gray-900);
    color: var(--ds-white);
    border-radius: var(--ds-radius-lg);
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    visibility: hidden;
    z-index: var(--ds-z-overlay);
    box-shadow: var(--ds-shadow-xl);
    transition: all var(--ds-transition-slow) var(--ds-ease-out);
    white-space: nowrap;
}

.ds-bulk-toolbar.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.ds-bulk-toolbar-count {
    font-size: var(--ds-text-sm);
    font-weight: 600;
    color: var(--ds-accent-ring);
    background: rgba(255,255,255,0.1);
    padding: 4px 10px;
    border-radius: var(--ds-radius-sm);
}

.ds-bulk-toolbar .ds-btn {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.15);
    color: var(--ds-white);
}

.ds-bulk-toolbar .ds-btn:hover {
    background: rgba(255,255,255,0.2);
}

.ds-bulk-toolbar .ds-btn-danger {
    background: var(--ds-danger);
    border-color: var(--ds-danger);
}

.ds-bulk-toolbar-close {
    background: none;
    border: none;
    color: var(--ds-gray-400);
    cursor: pointer;
    padding: 4px;
    margin-left: 4px;
    display: flex;
    transition: color var(--ds-transition);
}

.ds-bulk-toolbar-close:hover { color: var(--ds-white); }


/* =====================================================
   38. CIRCULAR PROGRESS (SVG)
   ===================================================== */
.ds-circular-progress {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ds-circular-progress svg {
    transform: rotate(-90deg);
}

.ds-circular-progress-bg {
    fill: none;
    stroke: var(--ds-gray-100);
    stroke-width: 6;
}

.ds-circular-progress-bar {
    fill: none;
    stroke: var(--ds-accent);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s var(--ds-ease);
}

.ds-circular-progress-bar.success { stroke: var(--ds-success); }
.ds-circular-progress-bar.danger { stroke: var(--ds-danger); }
.ds-circular-progress-bar.warning { stroke: var(--ds-warning); }

.ds-circular-progress-value {
    position: absolute;
    font-size: var(--ds-text-sm);
    font-weight: 700;
    color: var(--ds-gray-900);
    font-variant-numeric: tabular-nums;
}


/* =====================================================
   39. GRADIENT MESH BACKGROUND
   ===================================================== */
.ds-mesh-bg {
    position: relative;
}

.ds-mesh-bg::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(79,70,229,0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.ds-mesh-bg::after {
    content: '';
    position: absolute;
    top: 60px;
    left: -80px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(6,182,212,0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.ds-mesh-bg > *:not(.ds-modal-backdrop):not(.ds-slider-backdrop):not(.ds-drawer-backdrop):not(.ds-context-menu):not(.ds-mega-overlay):not(.ds-mega-menu) { position: relative; z-index: 1; }


/* =====================================================
   40. CONFETTI
   ===================================================== */
.ds-confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.ds-confetti-piece {
    position: absolute;
    width: 8px;
    height: 8px;
    opacity: 0;
    animation: ds-confetti-fall 1.2s var(--ds-ease) forwards;
}

@keyframes ds-confetti-fall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translateY(100vh) rotate(720deg) scale(0.3); }
}


/* =====================================================
   41. SPOTLIGHT / FOCUS MODE
   ===================================================== */
.ds-spotlight-overlay {
    position: fixed;
    inset: 0;
    background: rgba(9, 9, 11, 0.7);
    z-index: calc(var(--ds-z-modal) - 1);
    opacity: 0;
    visibility: hidden;
    transition: all var(--ds-transition-slow);
}

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

.ds-spotlight-target {
    position: relative;
    z-index: var(--ds-z-modal);
    box-shadow: 0 0 0 4px var(--ds-white), 0 0 0 6px var(--ds-accent), var(--ds-shadow-xl);
    border-radius: var(--ds-radius-lg);
}


/* =====================================================
   42. ONBOARDING TOOLTIP
   ===================================================== */
.ds-onboarding-tip {
    position: absolute;
    background: var(--ds-gray-900);
    color: var(--ds-white);
    border-radius: var(--ds-radius-lg);
    padding: 16px 20px;
    max-width: 300px;
    box-shadow: var(--ds-shadow-xl);
    z-index: var(--ds-z-modal);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all var(--ds-transition-slow);
    pointer-events: none;
}

.ds-onboarding-tip.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.ds-onboarding-tip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 24px;
    width: 16px;
    height: 16px;
    background: var(--ds-gray-900);
    transform: rotate(45deg);
    border-radius: 2px;
}

.ds-onboarding-tip-title {
    font-size: var(--ds-text-md);
    font-weight: 600;
    margin: 0 0 4px;
}

.ds-onboarding-tip-text {
    font-size: var(--ds-text-base);
    color: var(--ds-gray-400);
    margin: 0 0 12px;
    line-height: 1.5;
}

.ds-onboarding-tip-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ds-onboarding-tip-dots {
    display: flex;
    gap: 4px;
}

.ds-onboarding-tip-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
}

.ds-onboarding-tip-dots span.active { background: var(--ds-white); }

.ds-onboarding-tip .ds-btn-sm {
    background: var(--ds-accent);
    border-color: var(--ds-accent);
    color: var(--ds-white);
    font-size: var(--ds-text-xs);
}


/* =====================================================
   43. SPARKLINE (Mini CSS Chart)
   ===================================================== */
.ds-sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 24px;
}

.ds-sparkline-bar {
    width: 3px;
    background: var(--ds-accent);
    border-radius: 2px;
    transition: height 0.3s var(--ds-ease);
    opacity: 0.6;
}

.ds-sparkline-bar:last-child { opacity: 1; }

.ds-sparkline-success .ds-sparkline-bar { background: var(--ds-success); }
.ds-sparkline-danger .ds-sparkline-bar { background: var(--ds-danger); }


/* =====================================================
   44. TRUNCATE WITH EXPAND
   ===================================================== */
.ds-expandable {
    position: relative;
}

.ds-expandable-content {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
    transition: all var(--ds-transition);
}

.ds-expandable.expanded .ds-expandable-content {
    -webkit-line-clamp: unset;
    line-clamp: unset;
    display: block;
}

.ds-expandable-toggle {
    font-size: var(--ds-text-sm);
    font-weight: 500;
    color: var(--ds-accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    transition: color var(--ds-transition);
}

.ds-expandable-toggle:hover { color: var(--ds-accent-hover); }


/* =====================================================
   45. ANIMATED COUNTER
   ===================================================== */
.ds-counter[data-target] {
    font-variant-numeric: tabular-nums;
}


/* =====================================================
   46. SECTION SEPARATOR (demo only)
   ===================================================== */
.ds-section { margin-bottom: 48px; }

.ds-section-title {
    font-size: var(--ds-text-xs);
    font-weight: 700;
    color: var(--ds-gray-400);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ds-gray-100);
}
