:root {
    --bg-body: #fafafa;
    --bg-surface: #ffffff;
    --bg-elevated: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.82);
    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #a1a1aa;
    --border-light: #f0f0f2;
    --border-default: #e4e4e7;
    --bg-input: #f4f4f5;
    --bg-hover: #f4f4f5;
    --bg-muted: #e4e4e7;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-subtle: #eef2ff;
    --accent-glow: rgba(79, 70, 229, 0.18);
    --chip-active: #3b82f6;
    --danger: #dc2626;
    --success: #059669;
    --overlay: rgba(9, 9, 11, 0.55);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 32px -8px rgba(0, 0, 0, 0.14), 0 4px 8px -4px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 24px 56px -12px rgba(0, 0, 0, 0.25);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --header-height: 60px;
    --ease: cubic-bezier(0.2, 0, 0, 1);
}

:root[data-theme="dark"] {
    --bg-body: #09090b;
    --bg-surface: #111113;
    --bg-elevated: #18181b;
    --bg-header: rgba(9, 9, 11, 0.78);
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border-light: #1f1f23;
    --border-default: #2e2e33;
    --bg-input: #18181b;
    --bg-hover: #1f1f23;
    --bg-muted: #27272a;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-subtle: rgba(129, 140, 248, 0.12);
    --accent-glow: rgba(129, 140, 248, 0.25);
    --danger: #f87171;
    --success: #34d399;
    --overlay: rgba(0, 0, 0, 0.7);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
    --shadow-xl: 0 24px 56px rgba(0, 0, 0, 0.65);
}

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

html {
    scrollbar-gutter: stable;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    transition: background 0.15s ease, color 0.15s ease;
    font-size: 14px;
    line-height: 1.5;
    font-feature-settings: 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

button {
    padding: 9px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.25;
    cursor: pointer;
    transition: background 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), opacity 0.15s var(--ease);
    font-family: inherit;
    color: inherit;
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--text-secondary);
}

:root[data-theme="dark"] .btn-primary {
    background: #fafafa;
    color: #09090b;
}

:root[data-theme="dark"] .btn-primary:hover:not(:disabled) {
    background: #d4d4d8;
}

.btn-primary:active:not(:disabled) {
    box-shadow: none;
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.hidden {
    display: none !important;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.98) translateY(4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.icon-btn {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    background: transparent;
    padding: 0;
    text-decoration: none;
    transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.icon-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

@media (max-width: 640px) {
    .icon-btn {
        width: 44px;
        height: 44px;
    }
}

::selection {
    background: var(--accent-glow);
}

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