/* ==========================================================================
   Город Едет — design-system.css v1.0
   Дизайн-система в стиле Яндекс Такси / Linear
   ==========================================================================
   Подключать ПОСЛЕ style.css:
   <link rel="stylesheet" href="/static/style.css?v=90">
   <link rel="stylesheet" href="/static/design-system.css?v=1">
   ========================================================================== */

/* ==================== ТОКЕНЫ ==================== */
:root {
    /* --- Бренд (оставляем синий) --- */
    --ds-brand:            #078BFF;
    --ds-brand-hover:      #0066CC;
    --ds-brand-pressed:    #0052A3;
    --ds-brand-soft:       rgba(7, 139, 255, 0.10);
    --ds-brand-soft-2:     rgba(7, 139, 255, 0.06);

    /* --- Action (жёлтый — Яндекс-такси) --- */
    --ds-action:           #FFDB4D;
    --ds-action-hover:     #F2CB2E;
    --ds-action-pressed:   #D9B520;
    --ds-action-text:      #000000;
    --ds-action-soft:      rgba(255, 219, 77, 0.20);

    /* --- Семантика --- */
    --ds-success:          #10B981;
    --ds-success-bg:       #D1FAE5;
    --ds-success-text:     #065F46;
    --ds-danger:           #EF4444;
    --ds-danger-bg:        #FEE2E2;
    --ds-danger-text:      #991B1B;
    --ds-warning:          #F59E0B;
    --ds-warning-bg:       #FEF3C7;
    --ds-warning-text:     #92400E;
    --ds-info:             #3B82F6;
    --ds-info-bg:          #DBEAFE;
    --ds-info-text:        #1E40AF;

    /* --- Поверхности --- */
    --ds-bg:               #F7F8FA;
    --ds-bg-soft:          #F1F3F6;
    --ds-surface:          #FFFFFF;
    --ds-surface-2:        #FAFBFC;
    --ds-surface-elevated: #FFFFFF;

    /* --- Текст --- */
    --ds-text:             #0F172A;
    --ds-text-soft:        #475569;
    --ds-text-muted:       #94A3B8;
    --ds-text-on-brand:    #FFFFFF;
    --ds-text-on-action:   #000000;

    /* --- Границы --- */
    --ds-border:           #E5E7EB;
    --ds-border-strong:    #CBD5E1;
    --ds-border-focus:     #078BFF;

    /* --- Скругления --- */
    --ds-radius-xs:        8px;
    --ds-radius-sm:        12px;
    --ds-radius-md:        16px;
    --ds-radius-lg:        20px;
    --ds-radius-xl:        24px;
    --ds-radius-2xl:       28px;
    --ds-radius-pill:      999px;

    /* --- Отступы (шкала 4px) --- */
    --ds-space-1:          4px;
    --ds-space-2:          8px;
    --ds-space-3:          12px;
    --ds-space-4:          16px;
    --ds-space-5:          20px;
    --ds-space-6:          24px;
    --ds-space-7:          32px;
    --ds-space-8:          40px;
    --ds-space-9:          48px;
    --ds-space-10:         64px;

    /* --- Тени (плоские, как в Яндексе) --- */
    --ds-shadow-xs:        0 1px 2px rgba(15, 23, 42, 0.04);
    --ds-shadow-sm:        0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --ds-shadow-md:        0 4px 12px rgba(15, 23, 42, 0.08);
    --ds-shadow-lg:        0 12px 32px rgba(15, 23, 42, 0.12);
    --ds-shadow-focus:     0 0 0 4px rgba(7, 139, 255, 0.15);
    --ds-shadow-action:    0 4px 12px rgba(255, 219, 77, 0.35);

    /* --- Типографика --- */
    --ds-font-sans:        -apple-system, BlinkMacSystemFont, 'SF Pro Text',
                           'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --ds-font-mono:        'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

    --ds-fs-xs:            12px;
    --ds-fs-sm:            14px;
    --ds-fs-base:          16px;
    --ds-fs-md:            18px;
    --ds-fs-lg:            20px;
    --ds-fs-xl:            24px;
    --ds-fs-2xl:           28px;
    --ds-fs-3xl:           32px;
    --ds-fs-4xl:           40px;

    --ds-fw-regular:       400;
    --ds-fw-medium:        500;
    --ds-fw-semibold:      600;
    --ds-fw-bold:          700;
    --ds-fw-extrabold:     800;

    --ds-lh-tight:         1.2;
    --ds-lh-snug:          1.35;
    --ds-lh-normal:        1.5;
    --ds-lh-relaxed:       1.65;

    /* --- Z-index --- */
    --ds-z-base:           1;
    --ds-z-dropdown:       100;
    --ds-z-sticky:         200;
    --ds-z-overlay:        900;
    --ds-z-modal:          1000;
    --ds-z-toast:          1100;

    /* --- Анимации --- */
    --ds-dur-fast:         150ms;
    --ds-dur-base:         200ms;
    --ds-dur-slow:         300ms;
    --ds-ease:             cubic-bezier(0.4, 0, 0.2, 1);
    --ds-ease-spring:      cubic-bezier(0.34, 1.56, 0.64, 1);

    /* --- Safe area (iPhone) --- */
    --ds-safe-top:         env(safe-area-inset-top, 0px);
    --ds-safe-bottom:      env(safe-area-inset-bottom, 0px);
    --ds-safe-left:        env(safe-area-inset-left, 0px);
    --ds-safe-right:       env(safe-area-inset-right, 0px);
}

/* ==================== ТЁМНАЯ ТЕМА ==================== */
[data-theme="dark"] {
    --ds-bg:               #0A0F1C;
    --ds-bg-soft:          #131A2B;
    --ds-surface:          #131A2B;
    --ds-surface-2:        #1A2237;
    --ds-surface-elevated: #1F2940;

    --ds-text:             #F1F5F9;
    --ds-text-soft:        #94A3B8;
    --ds-text-muted:       #64748B;

    --ds-border:           #1E293B;
    --ds-border-strong:    #334155;

    --ds-brand-soft:       rgba(7, 139, 255, 0.15);
    --ds-brand-soft-2:     rgba(7, 139, 255, 0.10);

    --ds-action-soft:      rgba(255, 219, 77, 0.15);

    --ds-success-bg:       rgba(16, 185, 129, 0.15);
    --ds-success-text:     #6EE7B7;
    --ds-danger-bg:        rgba(239, 68, 68, 0.15);
    --ds-danger-text:      #FCA5A5;
    --ds-warning-bg:       rgba(245, 158, 11, 0.15);
    --ds-warning-text:     #FCD34D;
    --ds-info-bg:          rgba(59, 130, 246, 0.15);
    --ds-info-text:        #93C5FD;

    --ds-shadow-xs:        0 1px 2px rgba(0, 0, 0, 0.3);
    --ds-shadow-sm:        0 1px 3px rgba(0, 0, 0, 0.4);
    --ds-shadow-md:        0 4px 12px rgba(0, 0, 0, 0.5);
    --ds-shadow-lg:        0 12px 32px rgba(0, 0, 0, 0.6);
    --ds-shadow-focus:     0 0 0 4px rgba(7, 139, 255, 0.30);
    --ds-shadow-action:    0 4px 12px rgba(255, 219, 77, 0.25);

    color-scheme: dark;
}

/* ==================== БАЗА ==================== */
.ds-body,
body.ds-themed {
    font-family: var(--ds-font-sans);
    font-size: var(--ds-fs-base);
    line-height: var(--ds-lh-normal);
    color: var(--ds-text);
    background: var(--ds-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== ТИПОГРАФИКА ==================== */
.ds-h1 { font-size: var(--ds-fs-3xl); line-height: var(--ds-lh-tight); font-weight: var(--ds-fw-extrabold); letter-spacing: -0.02em; margin: 0; }
.ds-h2 { font-size: var(--ds-fs-2xl); line-height: var(--ds-lh-tight); font-weight: var(--ds-fw-bold);      letter-spacing: -0.015em; margin: 0; }
.ds-h3 { font-size: var(--ds-fs-xl);  line-height: var(--ds-lh-snug);  font-weight: var(--ds-fw-bold);      letter-spacing: -0.01em; margin: 0; }
.ds-h4 { font-size: var(--ds-fs-lg);  line-height: var(--ds-lh-snug);  font-weight: var(--ds-fw-semibold);  margin: 0; }
.ds-h5 { font-size: var(--ds-fs-md);  line-height: var(--ds-lh-snug);  font-weight: var(--ds-fw-semibold);  margin: 0; }

.ds-text      { font-size: var(--ds-fs-base); line-height: var(--ds-lh-normal); }
.ds-text-sm   { font-size: var(--ds-fs-sm);   line-height: var(--ds-lh-normal); }
.ds-text-xs   { font-size: var(--ds-fs-xs);   line-height: var(--ds-lh-normal); }
.ds-text-lg   { font-size: var(--ds-fs-md);   line-height: var(--ds-lh-relaxed); }

.ds-text-soft  { color: var(--ds-text-soft); }
.ds-text-muted { color: var(--ds-text-muted); }
.ds-text-brand { color: var(--ds-brand); }
.ds-text-danger { color: var(--ds-danger); }
.ds-text-success { color: var(--ds-success); }

.ds-font-mono { font-family: var(--ds-font-mono); }
.ds-font-bold { font-weight: var(--ds-fw-bold); }
.ds-font-extrabold { font-weight: var(--ds-fw-extrabold); }

.ds-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ==================== КОНТЕЙНЕР ==================== */
.ds-container {
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 var(--ds-space-5);
}
.ds-container-wide { max-width: 1100px; }

/* ==================== КНОПКИ ==================== */
.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-2);
    padding: 14px var(--ds-space-5);
    min-height: 52px;
    border: none;
    border-radius: var(--ds-radius-sm);
    font-family: inherit;
    font-size: var(--ds-fs-base);
    font-weight: var(--ds-fw-bold);
    line-height: 1.2;
    letter-spacing: -0.01em;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition:
        background var(--ds-dur-fast) var(--ds-ease),
        transform var(--ds-dur-fast) var(--ds-ease),
        box-shadow var(--ds-dur-fast) var(--ds-ease),
        color var(--ds-dur-fast) var(--ds-ease);
    white-space: nowrap;
}

.ds-btn:active:not(:disabled) { transform: scale(0.97); }

.ds-btn:disabled,
.ds-btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.ds-btn:focus-visible {
    outline: none;
    box-shadow: var(--ds-shadow-focus);
}

/* Primary — синий */
.ds-btn--primary {
    background: var(--ds-brand);
    color: var(--ds-text-on-brand);
}
.ds-btn--primary:hover:not(:disabled) {
    background: var(--ds-brand-hover);
    box-shadow: var(--ds-shadow-md);
}
.ds-btn--primary:active:not(:disabled) { background: var(--ds-brand-pressed); }

/* Action — жёлтый (главное действие) */
.ds-btn--action {
    background: var(--ds-action);
    color: var(--ds-action-text);
    font-weight: var(--ds-fw-extrabold);
}
.ds-btn--action:hover:not(:disabled) {
    background: var(--ds-action-hover);
    box-shadow: var(--ds-shadow-action);
}
.ds-btn--action:active:not(:disabled) { background: var(--ds-action-pressed); }

/* Secondary — серый */
.ds-btn--secondary {
    background: var(--ds-bg-soft);
    color: var(--ds-text);
    border: 1.5px solid var(--ds-border);
}
.ds-btn--secondary:hover:not(:disabled) {
    background: var(--ds-surface);
    border-color: var(--ds-border-strong);
}
.ds-btn--secondary:active:not(:disabled) { background: var(--ds-border); }

/* Ghost — прозрачный */
.ds-btn--ghost {
    background: transparent;
    color: var(--ds-text);
}
.ds-btn--ghost:hover:not(:disabled) {
    background: var(--ds-bg-soft);
}

/* Danger */
.ds-btn--danger {
    background: var(--ds-danger);
    color: #fff;
}
.ds-btn--danger:hover:not(:disabled) {
    background: #DC2626;
    box-shadow: var(--ds-shadow-md);
}

/* Success */
.ds-btn--success {
    background: var(--ds-success);
    color: #fff;
}
.ds-btn--success:hover:not(:disabled) {
    background: #059669;
    box-shadow: var(--ds-shadow-md);
}

/* Размеры */
.ds-btn--sm { padding: 8px 14px; min-height: 38px; font-size: var(--ds-fs-sm); border-radius: var(--ds-radius-xs); }
.ds-btn--lg { padding: 18px var(--ds-space-6); min-height: 60px; font-size: var(--ds-fs-md); border-radius: var(--ds-radius-md); }

/* Только иконка */
.ds-btn--icon {
    padding: 0;
    min-height: 44px;
    width: 44px;
    border-radius: var(--ds-radius-xs);
}
.ds-btn--icon.ds-btn--sm { width: 36px; height: 36px; min-height: 36px; }
.ds-btn--icon.ds-btn--lg { width: 56px; height: 56px; min-height: 56px; }

/* Кнопка на всю ширину */
.ds-btn--block { width: 100%; }

/* ==================== ИКОНКИ (Lucide) ==================== */
.ds-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 2;
    vertical-align: middle;
}
.ds-icon--sm { width: 16px; height: 16px; }
.ds-icon--lg { width: 24px; height: 24px; }
.ds-icon--xl { width: 32px; height: 32px; }

/* ==================== ФОРМЫ ==================== */
.ds-field {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-2);
    margin-bottom: var(--ds-space-4);
}

.ds-label {
    font-size: var(--ds-fs-sm);
    font-weight: var(--ds-fw-semibold);
    color: var(--ds-text);
    letter-spacing: -0.005em;
}

.ds-hint {
    font-size: var(--ds-fs-xs);
    color: var(--ds-text-muted);
    line-height: var(--ds-lh-normal);
}

.ds-input,
.ds-textarea,
.ds-select {
    width: 100%;
    padding: 14px var(--ds-space-4);
    min-height: 52px;
    border: 1.5px solid var(--ds-border);
    border-radius: var(--ds-radius-sm);
    background: var(--ds-surface);
    color: var(--ds-text);
    font-family: inherit;
    font-size: var(--ds-fs-base);
    font-weight: var(--ds-fw-medium);
    line-height: 1.4;
    transition:
        border-color var(--ds-dur-fast) var(--ds-ease),
        box-shadow var(--ds-dur-fast) var(--ds-ease),
        background var(--ds-dur-fast) var(--ds-ease);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.ds-input::placeholder,
.ds-textarea::placeholder {
    color: var(--ds-text-muted);
    font-weight: var(--ds-fw-regular);
}

.ds-input:hover:not(:focus),
.ds-textarea:hover:not(:focus),
.ds-select:hover:not(:focus) {
    border-color: var(--ds-border-strong);
}

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

.ds-input:disabled,
.ds-textarea:disabled,
.ds-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--ds-bg-soft);
}

.ds-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: var(--ds-lh-normal);
}

.ds-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748B' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 46px;
}

/* Поле с ошибкой */
.ds-input.is-error,
.ds-textarea.is-error,
.ds-select.is-error {
    border-color: var(--ds-danger);
}
.ds-input.is-error:focus,
.ds-textarea.is-error:focus,
.ds-select.is-error:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

.ds-error-text {
    font-size: var(--ds-fs-xs);
    color: var(--ds-danger);
    font-weight: var(--ds-fw-semibold);
}

/* ==================== CHECKBOX / RADIO / SWITCH ==================== */
.ds-check {
    display: inline-flex;
    align-items: flex-start;
    gap: var(--ds-space-3);
    cursor: pointer;
    user-select: none;
    font-size: var(--ds-fs-sm);
    line-height: var(--ds-lh-normal);
    color: var(--ds-text);
    font-weight: var(--ds-fw-medium);
}

.ds-check input {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--ds-brand);
    cursor: pointer;
    margin-top: 1px;
}

/* Switch (toggle) */
.ds-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-3);
    cursor: pointer;
    user-select: none;
}

.ds-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ds-switch__track {
    position: relative;
    width: 48px;
    height: 28px;
    background: var(--ds-border-strong);
    border-radius: var(--ds-radius-pill);
    transition: background var(--ds-dur-base) var(--ds-ease);
    flex-shrink: 0;
}

.ds-switch__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: left var(--ds-dur-base) var(--ds-ease-spring);
}

.ds-switch input:checked + .ds-switch__track {
    background: var(--ds-brand);
}
.ds-switch input:checked + .ds-switch__track::after {
    left: 23px;
}

.ds-switch__label {
    font-size: var(--ds-fs-sm);
    font-weight: var(--ds-fw-medium);
    color: var(--ds-text);
}

/* ==================== КАРТОЧКИ ==================== */
.ds-card {
    background: var(--ds-surface);
    border: 1.5px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    padding: var(--ds-space-5);
    transition:
        border-color var(--ds-dur-fast) var(--ds-ease),
        box-shadow var(--ds-dur-fast) var(--ds-ease);
}

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

.ds-card--flat {
    border-color: var(--ds-border);
    box-shadow: none;
}

.ds-card--interactive {
    cursor: pointer;
}
.ds-card--interactive:hover {
    border-color: var(--ds-brand);
    box-shadow: var(--ds-shadow-sm);
    transform: translateY(-1px);
}

.ds-card--brand {
    background: linear-gradient(135deg, var(--ds-brand-soft), var(--ds-brand-soft-2));
    border-color: rgba(7, 139, 255, 0.25);
}

.ds-card--action {
    background: linear-gradient(135deg, var(--ds-action-soft), rgba(255, 219, 77, 0.08));
    border-color: rgba(255, 219, 77, 0.6);
}

.ds-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ds-space-3);
    margin-bottom: var(--ds-space-4);
}

.ds-card__title {
    font-size: var(--ds-fs-lg);
    font-weight: var(--ds-fw-bold);
    color: var(--ds-text);
    letter-spacing: -0.01em;
    line-height: var(--ds-lh-snug);
    margin: 0;
}

.ds-card__body {
    font-size: var(--ds-fs-base);
    color: var(--ds-text);
    line-height: var(--ds-lh-normal);
}

.ds-card__footer {
    margin-top: var(--ds-space-4);
    padding-top: var(--ds-space-4);
    border-top: 1px solid var(--ds-border);
}

/* ==================== БЭЙДЖИ / ПИЛЛЫ ==================== */
.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--ds-radius-pill);
    font-size: var(--ds-fs-xs);
    font-weight: var(--ds-fw-bold);
    line-height: 1.3;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.ds-badge--brand   { background: var(--ds-brand-soft);   color: var(--ds-brand); }
.ds-badge--action  { background: var(--ds-action-soft);  color: #8B6914; }
.ds-badge--success { background: var(--ds-success-bg);   color: var(--ds-success-text); }
.ds-badge--danger  { background: var(--ds-danger-bg);    color: var(--ds-danger-text); }
.ds-badge--warning { background: var(--ds-warning-bg);   color: var(--ds-warning-text); }
.ds-badge--info    { background: var(--ds-info-bg);      color: var(--ds-info-text); }
.ds-badge--neutral { background: var(--ds-bg-soft);      color: var(--ds-text-soft); }

[data-theme="dark"] .ds-badge--action { color: #FCD34D; }

.ds-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--ds-space-2);
    padding: 8px 14px;
    border-radius: var(--ds-radius-pill);
    background: var(--ds-bg-soft);
    border: 1.5px solid var(--ds-border);
    font-size: var(--ds-fs-sm);
    font-weight: var(--ds-fw-semibold);
    color: var(--ds-text);
    cursor: pointer;
    transition: all var(--ds-dur-fast) var(--ds-ease);
    user-select: none;
    white-space: nowrap;
}

.ds-pill:hover {
    border-color: var(--ds-border-strong);
}

.ds-pill.is-active {
    background: var(--ds-brand);
    border-color: var(--ds-brand);
    color: var(--ds-text-on-brand);
}

.ds-pill--action.is-active {
    background: var(--ds-action);
    border-color: var(--ds-action);
    color: var(--ds-action-text);
}

/* ==================== АВАТАР ==================== */
.ds-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ds-brand);
    color: #fff;
    font-weight: var(--ds-fw-bold);
    font-size: var(--ds-fs-base);
    flex-shrink: 0;
    overflow: hidden;
}
.ds-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ds-avatar--sm { width: 32px; height: 32px; font-size: var(--ds-fs-sm); }
.ds-avatar--lg { width: 56px; height: 56px; font-size: var(--ds-fs-lg); }
.ds-avatar--xl { width: 72px; height: 72px; font-size: var(--ds-fs-xl); }

/* ==================== SKELETON (загрузка) ==================== */
.ds-skeleton {
    background: linear-gradient(
        90deg,
        var(--ds-bg-soft) 0%,
        var(--ds-border) 50%,
        var(--ds-bg-soft) 100%
    );
    background-size: 200% 100%;
    animation: ds-shimmer 1.4s ease-in-out infinite;
    border-radius: var(--ds-radius-xs);
}

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

.ds-skeleton--text  { height: 14px; margin-bottom: 8px; width: 100%; }
.ds-skeleton--title { height: 22px; margin-bottom: 12px; width: 60%; }
.ds-skeleton--avatar { width: 40px; height: 40px; border-radius: 50%; }
.ds-skeleton--btn   { height: 52px; width: 100%; border-radius: var(--ds-radius-sm); }
.ds-skeleton--card  { height: 120px; width: 100%; border-radius: var(--ds-radius-lg); }
.ds-skeleton--img   { height: 160px; width: 100%; border-radius: var(--ds-radius-md); }

.ds-skeleton-list { display: flex; flex-direction: column; gap: var(--ds-space-3); }
.ds-skeleton-card {
    padding: var(--ds-space-4);
    background: var(--ds-surface);
    border: 1.5px solid var(--ds-border);
    border-radius: var(--ds-radius-lg);
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
}

/* ==================== EMPTY STATE ==================== */
.ds-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--ds-space-3);
    padding: var(--ds-space-8) var(--ds-space-5);
    text-align: center;
}

.ds-empty__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: var(--ds-radius-xl);
    background: var(--ds-bg-soft);
    color: var(--ds-text-muted);
    margin-bottom: var(--ds-space-2);
}

.ds-empty__icon .ds-icon,
.ds-empty__icon svg {
    width: 32px;
    height: 32px;
    stroke-width: 1.75;
}

.ds-empty__title {
    font-size: var(--ds-fs-lg);
    font-weight: var(--ds-fw-bold);
    color: var(--ds-text);
    margin: 0;
    letter-spacing: -0.01em;
}

.ds-empty__text {
    font-size: var(--ds-fs-sm);
    color: var(--ds-text-muted);
    line-height: var(--ds-lh-relaxed);
    max-width: 320px;
    margin: 0;
}

.ds-empty__action {
    margin-top: var(--ds-space-2);
}

/* ==================== TOAST ==================== */
.ds-toast-container {
    position: fixed;
    top: calc(var(--ds-space-4) + var(--ds-safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--ds-z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-2);
    pointer-events: none;
    width: 100%;
    max-width: 480px;
    padding: 0 var(--ds-space-4);
}

.ds-toast {
    display: flex;
    align-items: center;
    gap: var(--ds-space-3);
    padding: 14px var(--ds-space-4);
    background: var(--ds-text);
    color: var(--ds-bg);
    border-radius: var(--ds-radius-md);
    box-shadow: var(--ds-shadow-lg);
    font-size: var(--ds-fs-sm);
    font-weight: var(--ds-fw-semibold);
    line-height: 1.4;
    pointer-events: auto;
    animation: ds-toast-in var(--ds-dur-slow) var(--ds-ease-spring);
}

.ds-toast--success { background: var(--ds-success); color: #fff; }
.ds-toast--error   { background: var(--ds-danger);  color: #fff; }
.ds-toast--warning { background: var(--ds-warning); color: #fff; }
.ds-toast--info    { background: var(--ds-brand);   color: #fff; }

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

.ds-toast.is-leaving {
    animation: ds-toast-out var(--ds-dur-base) var(--ds-ease) forwards;
}

@keyframes ds-toast-out {
    to { opacity: 0; transform: translateY(-16px) scale(0.96); }
}

/* ==================== MODAL ==================== */
.ds-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--ds-z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--ds-space-4);
    animation: ds-fade-in var(--ds-dur-base) var(--ds-ease);
}

.ds-modal-backdrop.is-open { display: flex; }

@keyframes ds-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ds-modal {
    background: var(--ds-surface);
    border-radius: var(--ds-radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--ds-shadow-lg);
    animation: ds-modal-in var(--ds-dur-slow) var(--ds-ease-spring);
}

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

.ds-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-3);
    padding: var(--ds-space-5);
    border-bottom: 1.5px solid var(--ds-border);
    flex-shrink: 0;
}

.ds-modal__title {
    font-size: var(--ds-fs-lg);
    font-weight: var(--ds-fw-bold);
    letter-spacing: -0.01em;
    margin: 0;
}

.ds-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--ds-radius-xs);
    color: var(--ds-text-soft);
    cursor: pointer;
    transition: background var(--ds-dur-fast);
}
.ds-modal__close:hover { background: var(--ds-bg-soft); }

.ds-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: var(--ds-space-5);
    font-size: var(--ds-fs-base);
    line-height: var(--ds-lh-normal);
    color: var(--ds-text);
}

.ds-modal__footer {
    display: flex;
    gap: var(--ds-space-3);
    padding: var(--ds-space-4) var(--ds-space-5);
    border-top: 1.5px solid var(--ds-border);
    flex-shrink: 0;
    background: var(--ds-surface-2);
}
.ds-modal__footer .ds-btn { flex: 1; }

/* ==================== SPINNER ==================== */
.ds-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--ds-border);
    border-top-color: var(--ds-brand);
    border-radius: 50%;
    animation: ds-spin 0.7s linear infinite;
    flex-shrink: 0;
}
.ds-spinner--lg { width: 32px; height: 32px; border-width: 3px; }
.ds-spinner--sm { width: 14px; height: 14px; border-width: 2px; }

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

/* ==================== TABS ==================== */
.ds-tabs {
    display: flex;
    gap: var(--ds-space-2);
    padding: var(--ds-space-1);
    background: var(--ds-bg-soft);
    border-radius: var(--ds-radius-md);
    margin-bottom: var(--ds-space-5);
}

.ds-tab {
    flex: 1;
    padding: 10px var(--ds-space-4);
    background: transparent;
    border: none;
    border-radius: var(--ds-radius-xs);
    font-family: inherit;
    font-size: var(--ds-fs-sm);
    font-weight: var(--ds-fw-semibold);
    color: var(--ds-text-soft);
    cursor: pointer;
    transition: all var(--ds-dur-fast) var(--ds-ease);
    text-align: center;
    user-select: none;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ds-tab:hover:not(.is-active) {
    color: var(--ds-text);
}

.ds-tab.is-active {
    background: var(--ds-surface);
    color: var(--ds-text);
    font-weight: var(--ds-fw-bold);
    box-shadow: var(--ds-shadow-xs);
}

/* ==================== РАЗДЕЛИТЕЛЬ ==================== */
.ds-divider {
    height: 1px;
    background: var(--ds-border);
    border: none;
    margin: var(--ds-space-4) 0;
}

/* ==================== УТИЛИТЫ ==================== */
/* Flex */
.ds-flex      { display: flex; }
.ds-flex-col  { display: flex; flex-direction: column; }
.ds-flex-wrap { flex-wrap: wrap; }
.ds-items-center     { align-items: center; }
.ds-items-start      { align-items: flex-start; }
.ds-items-end        { align-items: flex-end; }
.ds-justify-center   { justify-content: center; }
.ds-justify-between  { justify-content: space-between; }
.ds-justify-end      { justify-content: flex-end; }
.ds-flex-1           { flex: 1; }
.ds-gap-1 { gap: var(--ds-space-1); }
.ds-gap-2 { gap: var(--ds-space-2); }
.ds-gap-3 { gap: var(--ds-space-3); }
.ds-gap-4 { gap: var(--ds-space-4); }
.ds-gap-5 { gap: var(--ds-space-5); }
.ds-gap-6 { gap: var(--ds-space-6); }

/* Отступы */
.ds-mt-0 { margin-top: 0 !important; }
.ds-mt-1 { margin-top: var(--ds-space-1) !important; }
.ds-mt-2 { margin-top: var(--ds-space-2) !important; }
.ds-mt-3 { margin-top: var(--ds-space-3) !important; }
.ds-mt-4 { margin-top: var(--ds-space-4) !important; }
.ds-mt-5 { margin-top: var(--ds-space-5) !important; }
.ds-mt-6 { margin-top: var(--ds-space-6) !important; }
.ds-mb-0 { margin-bottom: 0 !important; }
.ds-mb-1 { margin-bottom: var(--ds-space-1) !important; }
.ds-mb-2 { margin-bottom: var(--ds-space-2) !important; }
.ds-mb-3 { margin-bottom: var(--ds-space-3) !important; }
.ds-mb-4 { margin-bottom: var(--ds-space-4) !important; }
.ds-mb-5 { margin-bottom: var(--ds-space-5) !important; }
.ds-mb-6 { margin-bottom: var(--ds-space-6) !important; }

/* Текст */
.ds-text-center { text-align: center; }
.ds-text-left   { text-align: left; }
.ds-text-right  { text-align: right; }

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

/* ==================== АДАПТИВ ==================== */
/* Одинаковая видимая рамка при навигации с клавиатуры. */
:where(a[href], button, [tabindex]):focus-visible {
    outline: 2px solid var(--ds-border-focus);
    outline-offset: 3px;
}

@media (max-width: 480px) {
    .ds-h1 { font-size: var(--ds-fs-2xl); }
    .ds-h2 { font-size: var(--ds-fs-xl); }
    .ds-h3 { font-size: var(--ds-fs-lg); }

    .ds-btn { padding: 13px var(--ds-space-4); min-height: 50px; font-size: 15px; }
    .ds-btn--lg { padding: 16px var(--ds-space-5); min-height: 56px; font-size: var(--ds-fs-base); }

    .ds-card { padding: var(--ds-space-4); border-radius: var(--ds-radius-md); }
    .ds-modal { border-radius: var(--ds-radius-lg); max-width: 100%; }
    .ds-container { padding: 0 var(--ds-space-4); }
}

/* ==================== ПРЕДПОЧТЕНИЕ МЕНЬШЕ АНИМАЦИЙ ==================== */
@media (prefers-reduced-motion: reduce) {
    .ds-skeleton,
    .ds-spinner,
    .ds-toast,
    .ds-modal,
    .ds-btn,
    .ds-card,
    .ds-input,
    .ds-textarea,
    .ds-select {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==================== ВЫСОКИЙ КОНТРАСТ ==================== */
@media (prefers-contrast: high) {
    :root {
        --ds-border: #000;
        --ds-border-strong: #000;
    }
    [data-theme="dark"] {
        --ds-border: #fff;
        --ds-border-strong: #fff;
    }
}
