:root {
    --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

    --color-brand: #10b981;
    --color-brand-dark: #059669;
    --color-brand-light: #34d399;
    --color-brand-lighter: #6ee7b7;
    --color-brand-subtle: rgba(16, 185, 129, 0.1);
    --color-brand-border: rgba(16, 185, 129, 0.2);
    --color-brand-glow: rgba(16, 185, 129, 0.25);

    --color-accent-blue: #3b82f6;
    --color-accent-blue-dark: #2563eb;
    --color-accent-blue-subtle: rgba(59, 130, 246, 0.1);
    --color-accent-blue-border: rgba(59, 130, 246, 0.25);
    --color-accent-purple: #8b5cf6;
    --color-accent-purple-dark: #7c3aed;
    --color-accent-purple-subtle: rgba(139, 92, 246, 0.08);
    --color-accent-purple-border: rgba(139, 92, 246, 0.25);
    --color-accent-cyan: #06b6d4;
    --color-accent-cyan-subtle: rgba(6, 182, 212, 0.1);
    --color-accent-cyan-border: rgba(6, 182, 212, 0.25);
    --color-accent-amber: #f59e0b;
    --color-accent-amber-subtle: rgba(245, 158, 11, 0.1);

    --color-success: #10b981;
    --color-success-subtle: rgba(16, 185, 129, 0.1);
    --color-success-border: rgba(16, 185, 129, 0.25);
    --color-error: #f43f5e;
    --color-error-subtle: rgba(244, 63, 94, 0.1);
    --color-error-border: rgba(244, 63, 94, 0.25);
    --color-warning: #f59e0b;
    --color-warning-subtle: rgba(245, 158, 11, 0.1);
    --color-warning-border: rgba(245, 158, 11, 0.25);
    --color-info: #06b6d4;
    --color-info-subtle: rgba(6, 182, 212, 0.1);
    --color-info-border: rgba(6, 182, 212, 0.25);

    --surface-root: #09090b;
    --surface-secondary: #0c0d12;
    --surface-card: #111318;
    --surface-card-alpha: rgba(17, 19, 24, 0.65);
    --surface-elevated: #161922;
    --surface-elevated-2: #1c1f2b;
    --surface-overlay: rgba(0, 0, 0, 0.65);

    --border-primary: #1e2130;
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-hover: rgba(16, 185, 129, 0.25);
    --border-focus: rgba(16, 185, 129, 0.4);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-heading: #ffffff;

    --radius-xs: 0.25rem;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.25rem;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.5), 0 8px 16px rgba(0, 0, 0, 0.25);
    --shadow-brand: 0 4px 16px rgba(16, 185, 129, 0.25);
    --shadow-brand-hover: 0 8px 32px rgba(16, 185, 129, 0.4);
    --shadow-brand-glow: 0 0 40px rgba(16, 185, 129, 0.15);

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    --sidebar-width: 16rem;
    --topbar-height: 4rem;
}

* {
    scrollbar-color: var(--border-primary) transparent;
}

body {
    background-color: var(--surface-root);
    color: var(--text-primary);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-primary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #2a2d3a; }

.ds-glass {
    background: var(--surface-card-alpha);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.ds-glass:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-brand-glow);
}

.ds-glass-strong {
    background: rgba(17, 19, 24, 0.8);
    backdrop-filter: blur(32px) saturate(1.3);
    -webkit-backdrop-filter: blur(32px) saturate(1.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}
.ds-glass-strong:hover {
    border-color: var(--border-hover);
}

.ds-card {
    background: var(--surface-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
}
.ds-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.04);
}

.ds-card-interactive {
    background: var(--surface-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
    cursor: pointer;
}
.ds-card-interactive:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.06);
    transform: translateY(-1px);
}
.ds-card-interactive:active {
    transform: translateY(0);
}

.ds-card-flat {
    background: var(--surface-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
}

.ds-card-gradient {
    position: relative;
    background: var(--surface-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
}
.ds-card-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-brand-border), transparent);
}

.ds-btn-primary {
    background: linear-gradient(135deg, var(--color-brand), var(--color-brand-dark));
    color: white;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.625rem 1.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}
.ds-btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}
.ds-btn-primary:hover {
    box-shadow: var(--shadow-brand-hover);
    transform: translateY(-1px);
}
.ds-btn-primary:hover::before {
    opacity: 1;
}
.ds-btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-brand);
}
.ds-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ds-btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 0.625rem 1.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.ds-btn-secondary:hover {
    border-color: var(--color-brand);
    color: var(--text-primary);
    background: var(--color-brand-subtle);
}
.ds-btn-secondary:active {
    background: rgba(16, 185, 129, 0.15);
}

.ds-btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.ds-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}
.ds-btn-ghost:active {
    background: rgba(255, 255, 255, 0.1);
}

.ds-btn-danger {
    background: linear-gradient(135deg, var(--color-error), #e11d48);
    color: white;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-lg);
    padding: 0.625rem 1.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 16px rgba(244, 63, 94, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.ds-btn-danger:hover {
    box-shadow: 0 8px 32px rgba(244, 63, 94, 0.4);
    transform: translateY(-1px);
}
.ds-btn-danger:active {
    transform: translateY(0);
}

.ds-btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: var(--radius-md);
}

.ds-btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.ds-btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.ds-btn-group {
    display: inline-flex;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-primary);
}
.ds-btn-group > * {
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border-primary);
}
.ds-btn-group > *:last-child {
    border-right: none;
}

.ds-input {
    width: 100%;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}
.ds-input::placeholder {
    color: var(--text-muted);
}
.ds-input:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1), 0 0 0 1px var(--color-brand);
}
.ds-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.ds-input-error {
    border-color: var(--color-error) !important;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1) !important;
}

.ds-input-with-icon {
    position: relative;
}
.ds-input-with-icon .ds-input {
    padding-left: 2.5rem;
}
.ds-input-with-icon svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.ds-select {
    width: 100%;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 0.625rem 2rem 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
    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='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}
.ds-select:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1), 0 0 0 1px var(--color-brand);
}

.ds-textarea {
    width: 100%;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
    resize: vertical;
    min-height: 5rem;
}
.ds-textarea:focus {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1), 0 0 0 1px var(--color-brand);
}

.ds-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ds-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.ds-table thead th {
    background: var(--surface-secondary);
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
    position: sticky;
    top: 0;
    z-index: 1;
}
.ds-table thead th:first-child {
    border-top-left-radius: var(--radius-lg);
}
.ds-table thead th:last-child {
    border-top-right-radius: var(--radius-lg);
}
.ds-table tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}
.ds-table tbody tr {
    transition: background var(--transition-fast);
}
.ds-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}
.ds-table tbody tr:last-child td {
    border-bottom: none;
}

.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.1875rem 0.625rem;
    border-radius: var(--radius-full);
    line-height: 1.5;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.ds-badge-brand {
    background: var(--color-brand-subtle);
    color: var(--color-brand-light);
    border: 1px solid var(--color-brand-border);
}
.ds-badge-success {
    background: var(--color-success-subtle);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}
.ds-badge-error {
    background: var(--color-error-subtle);
    color: var(--color-error);
    border: 1px solid var(--color-error-border);
}
.ds-badge-warning {
    background: var(--color-warning-subtle);
    color: var(--color-warning);
    border: 1px solid var(--color-warning-border);
}
.ds-badge-info {
    background: var(--color-info-subtle);
    color: var(--color-info);
    border: 1px solid var(--color-info-border);
}
.ds-badge-neutral {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(100, 116, 139, 0.15);
}
.ds-badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.ds-badge-pulse::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    animation: ds-pulse-dot 2s ease-in-out infinite;
}
@keyframes ds-pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.ds-modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--surface-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: ds-backdrop-in 0.2s ease-out;
}
@keyframes ds-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.ds-modal,
.ds-modal-content {
    background: var(--surface-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    overflow-y: auto;
    animation: ds-modal-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ds-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
}
.ds-modal-close {
    color: var(--text-muted);
    transition: color var(--transition-base);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-md);
}
.ds-modal-close:hover {
    color: var(--text-primary);
}
.ds-modal-lg {
    max-width: 48rem;
}
.ds-modal-sm {
    max-width: 24rem;
}
.ds-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.ds-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
}
.ds-modal-body {
    padding: 1.5rem;
}
.ds-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-primary);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}
@keyframes ds-modal-in {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.ds-stat-card {
    background: var(--surface-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    position: relative;
    overflow: hidden;
}
.ds-stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-brand-border), transparent);
    opacity: 0;
    transition: opacity var(--transition-base);
}
.ds-stat-card:hover {
    border-color: var(--border-hover);
}
.ds-stat-card:hover::after {
    opacity: 1;
}
.ds-stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}
.ds-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.ds-stat-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.375rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.ds-stat-change.positive { color: var(--color-success); }
.ds-stat-change.negative { color: var(--color-error); }

.ds-stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.ds-stat-icon-brand {
    background: var(--color-brand-subtle);
    color: var(--color-brand);
}
.ds-stat-icon-blue {
    background: var(--color-accent-blue-subtle);
    color: var(--color-accent-blue);
}
.ds-stat-icon-purple {
    background: var(--color-accent-purple-subtle);
    color: var(--color-accent-purple);
}
.ds-stat-icon-cyan {
    background: var(--color-accent-cyan-subtle);
    color: var(--color-accent-cyan);
}

.ds-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
}
.ds-sidebar-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}
.ds-sidebar-link.active {
    background: var(--color-brand-subtle);
    color: var(--color-brand);
}
.ds-sidebar-link.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--color-brand);
    border-radius: var(--radius-full);
}

.ds-sidebar-section {
    margin-bottom: 0.5rem;
}

.ds-toggle {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}
.ds-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}
.ds-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: var(--border-primary);
    transition: var(--transition-base);
    border-radius: 20px;
}
.ds-toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: var(--transition-base);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.ds-toggle input:checked + .ds-toggle-slider {
    background-color: var(--color-brand);
}
.ds-toggle input:checked + .ds-toggle-slider::before {
    transform: translateX(16px);
}

.ds-toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 24rem;
    pointer-events: none;
}
.ds-toast-container > * {
    pointer-events: auto;
}
.ds-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-lg);
    border-width: 1px;
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    animation: ds-toast-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}
.ds-toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: currentColor;
    opacity: 0.3;
    animation: ds-toast-progress 5s linear forwards;
}
.ds-toast-success {
    background: var(--color-success-subtle);
    border-color: var(--color-success-border);
    color: var(--color-success);
}
.ds-toast-error {
    background: var(--color-error-subtle);
    border-color: var(--color-error-border);
    color: var(--color-error);
}
.ds-toast-warning {
    background: var(--color-warning-subtle);
    border-color: var(--color-warning-border);
    color: var(--color-warning);
}
.ds-toast-info {
    background: var(--color-info-subtle);
    border-color: var(--color-info-border);
    color: var(--color-info);
}
@keyframes ds-toast-in {
    from { transform: translateX(100%) scale(0.95); opacity: 0; }
    to { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes ds-toast-out {
    from { transform: translateX(0) scale(1); opacity: 1; }
    to { transform: translateX(100%) scale(0.95); opacity: 0; }
}
@keyframes ds-toast-progress {
    from { width: 100%; }
    to { width: 0%; }
}

.ds-tooltip {
    position: relative;
}
.ds-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: var(--surface-elevated-2);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-md);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: 60;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-subtle);
}
.ds-tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

.ds-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-primary), transparent);
}

.ds-divider-brand {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-brand-border), transparent);
}

.ds-section-label {
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 1rem;
    margin-bottom: 0.5rem;
}

.ds-fade-in {
    animation: ds-fade-in 0.4s ease-out both;
}
@keyframes ds-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ds-fade-in-up {
    animation: ds-fade-in-up 0.5s ease-out both;
}
@keyframes ds-fade-in-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.ds-fade-in-down {
    animation: ds-fade-in-down 0.5s ease-out both;
}
@keyframes ds-fade-in-down {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

.ds-fade-in-left {
    animation: ds-fade-in-left 0.5s ease-out both;
}
@keyframes ds-fade-in-left {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

.ds-fade-in-right {
    animation: ds-fade-in-right 0.5s ease-out both;
}
@keyframes ds-fade-in-right {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

.ds-scale-in {
    animation: ds-scale-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes ds-scale-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.ds-stagger > *:nth-child(1) { animation-delay: 0ms; }
.ds-stagger > *:nth-child(2) { animation-delay: 50ms; }
.ds-stagger > *:nth-child(3) { animation-delay: 100ms; }
.ds-stagger > *:nth-child(4) { animation-delay: 150ms; }
.ds-stagger > *:nth-child(5) { animation-delay: 200ms; }
.ds-stagger > *:nth-child(6) { animation-delay: 250ms; }
.ds-stagger > *:nth-child(7) { animation-delay: 300ms; }
.ds-stagger > *:nth-child(8) { animation-delay: 350ms; }
.ds-stagger > *:nth-child(9) { animation-delay: 400ms; }
.ds-stagger > *:nth-child(10) { animation-delay: 450ms; }

.ds-btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
    color: transparent !important;
}
.ds-btn-loading > * {
    visibility: hidden;
}
.ds-btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: ds-spin 0.6s linear infinite;
}
@keyframes ds-spin {
    to { transform: rotate(360deg); }
}

.ds-skeleton {
    background: linear-gradient(90deg, var(--surface-secondary) 25%, var(--surface-elevated) 50%, var(--surface-secondary) 75%);
    background-size: 200% 100%;
    animation: ds-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}
@keyframes ds-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.ds-skeleton-text {
    height: 0.875rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--surface-secondary) 25%, var(--surface-elevated) 50%, var(--surface-secondary) 75%);
    background-size: 200% 100%;
    animation: ds-shimmer 1.5s ease-in-out infinite;
}
.ds-skeleton-text-sm {
    height: 0.625rem;
}
.ds-skeleton-text-lg {
    height: 1.25rem;
}

.ds-skeleton-circle {
    border-radius: 50%;
    background: linear-gradient(90deg, var(--surface-secondary) 25%, var(--surface-elevated) 50%, var(--surface-secondary) 75%);
    background-size: 200% 100%;
    animation: ds-shimmer 1.5s ease-in-out infinite;
}

.ds-skeleton-card {
    background: var(--surface-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ds-progress {
    width: 100%;
    height: 4px;
    background: var(--surface-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.ds-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-brand), var(--color-brand-light));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}
.ds-progress-bar-animated {
    position: relative;
    overflow: hidden;
}
.ds-progress-bar-animated::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: ds-progress-shine 2s ease-in-out infinite;
}
@keyframes ds-progress-shine {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

.ds-progress-indeterminate .ds-progress-bar {
    width: 30% !important;
    animation: ds-progress-indeterminate 1.5s ease-in-out infinite;
}
@keyframes ds-progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

.ds-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--color-brand-subtle);
    color: var(--color-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    border: 2px solid var(--border-primary);
}
.ds-avatar-sm {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.625rem;
}
.ds-avatar-lg {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.875rem;
}
.ds-avatar-xl {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
}
.ds-avatar-online {
    position: relative;
}
.ds-avatar-online::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background: var(--color-success);
    border: 2px solid var(--surface-card);
    border-radius: 50%;
}

.ds-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--surface-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
    transition: all var(--transition-fast);
}
.ds-chip-closeable {
    cursor: pointer;
}
.ds-chip-closeable:hover {
    border-color: var(--color-error);
    background: var(--color-error-subtle);
}

.ds-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}
.ds-empty-state-icon {
    width: 3rem;
    height: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    opacity: 0.6;
}
.ds-empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}
.ds-empty-state-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 24rem;
}

.ds-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid;
    font-size: 0.875rem;
}
.ds-alert-success {
    background: var(--color-success-subtle);
    border-color: var(--color-success-border);
    color: var(--color-success);
}
.ds-alert-error {
    background: var(--color-error-subtle);
    border-color: var(--color-error-border);
    color: var(--color-error);
}
.ds-alert-warning {
    background: var(--color-warning-subtle);
    border-color: var(--color-warning-border);
    color: var(--color-warning);
}
.ds-alert-info {
    background: var(--color-info-subtle);
    border-color: var(--color-info-border);
    color: var(--color-info);
}

.ds-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.375rem;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 0 var(--border-primary);
    line-height: 1.4;
}

.ds-code {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    background: var(--surface-secondary);
    color: var(--color-brand-light);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.ds-dot-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ds-dot-online {
    background: var(--color-success);
    box-shadow: 0 0 6px var(--color-success);
}
.ds-dot-offline {
    background: var(--text-muted);
}
.ds-dot-warning {
    background: var(--color-warning);
    box-shadow: 0 0 6px var(--color-warning);
}
.ds-dot-error {
    background: var(--color-error);
    box-shadow: 0 0 6px var(--color-error);
}
.ds-dot-pulsing {
    animation: ds-dot-pulse 2s ease-in-out infinite;
}
@keyframes ds-dot-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.ds-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 700;
    background: var(--color-brand);
    color: white;
    line-height: 1;
}
.ds-count-badge-error {
    background: var(--color-error);
}

.ds-gradient-text {
    background: linear-gradient(135deg, var(--color-brand-light), var(--color-accent-cyan));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ds-gradient-border {
    position: relative;
    border: none !important;
}
.ds-gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--color-brand-border), transparent, var(--color-accent-blue-border));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.ds-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: -1px;
}
.ds-tab {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font-sans);
}
.ds-tab:hover {
    color: var(--text-primary);
}
.ds-tab.active {
    color: var(--color-brand);
    border-bottom-color: var(--color-brand);
}

.ds-dropdown {
    background: var(--surface-card);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    min-width: 10rem;
    animation: ds-dropdown-in 0.15s ease-out;
    z-index: 40;
}
.ds-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-sans);
}
.ds-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}
.ds-dropdown-item-danger {
    color: var(--color-error);
}
.ds-dropdown-item-danger:hover {
    background: var(--color-error-subtle);
}
.ds-dropdown-divider {
    height: 1px;
    background: var(--border-primary);
    margin: 0.25rem 0;
}
@keyframes ds-dropdown-in {
    from { opacity: 0; transform: scale(0.95) translateY(-4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.ds-tag-input {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.375rem;
    background: var(--surface-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    min-height: 2.5rem;
    align-items: center;
    transition: border-color var(--transition-fast);
}
.ds-tag-input:focus-within {
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}
.ds-tag-input input {
    flex: 1;
    min-width: 4rem;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.875rem;
    padding: 0.25rem 0.375rem;
    font-family: var(--font-sans);
}

.ds-number-ticker {
    font-variant-numeric: tabular-nums;
    transition: all var(--transition-base);
}

@media (max-width: 767px) {
    .ds-stat-card {
        padding: 1rem;
    }
    .ds-stat-value {
        font-size: 1.25rem;
    }
    .ds-modal {
        max-width: calc(100vw - 2rem);
        margin: 0 1rem;
    }
    .ds-modal-header {
        padding: 1rem 1.25rem;
    }
    .ds-modal-body {
        padding: 1.25rem;
    }
    .ds-modal-footer {
        padding: 0.75rem 1.25rem;
    }
    .ds-table thead th {
        padding: 0.5rem 0.75rem;
        font-size: 0.625rem;
    }
    .ds-table tbody td {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
    .ds-btn-primary,
    .ds-btn-secondary,
    .ds-btn-ghost,
    .ds-btn-danger {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
    .ds-input,
    .ds-select,
    .ds-textarea {
        font-size: 1rem;
    }
    .ds-toast {
        font-size: 0.8125rem;
        padding: 0.625rem 0.75rem;
    }
    .ds-toast-container {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
    .ds-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
