/* ==========================================================================
   SyharikHost — общая дизайн-система пользовательских страниц
   Тёмная тема по умолчанию, светлая через html[data-theme="light"].
   Фирменные цвета главной: тёмно-синий фон и неоновый красный акцент.
   ========================================================================== */

:root {
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Consolas, monospace;

    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --header-h: 64px;
    --container: 1200px;
    --gutter: 24px;

    --bg: #171b30;
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-side: linear-gradient(90deg, rgba(255, 7, 58, 0.08) 0%, rgba(255, 7, 58, 0.035) 15%, transparent 30%, transparent 70%, rgba(255, 7, 58, 0.035) 85%, rgba(255, 7, 58, 0.08) 100%);
    --header-bg: rgba(22, 25, 44, 0.78);
    --surface: rgba(28, 32, 54, 0.78);
    --surface-solid: #1d2138;
    --surface-2: #242a45;
    --surface-3: #2d3453;
    --surface-hover: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);

    --text: #eef0f7;
    --text-2: #aab1c6;
    --text-3: #767f99;

    --accent: #ff073a;
    --accent-hover: #ff2b57;
    --accent-soft: rgba(255, 7, 58, 0.14);
    --accent-softer: rgba(255, 7, 58, 0.08);
    --accent-text: #ff5c7c;
    --accent-glow: 0 10px 26px rgba(255, 7, 58, 0.32);
    --on-accent: #ffffff;

    --success: #34d399;
    --success-soft: rgba(52, 211, 153, 0.14);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, 0.14);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.14);
    --info: #60a5fa;
    --info-soft: rgba(96, 165, 250, 0.14);
    --violet: #a78bfa;
    --violet-soft: rgba(167, 139, 250, 0.14);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 12px 32px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.55);
    --overlay: rgba(7, 9, 20, 0.68);
    --focus: 0 0 0 3px rgba(255, 7, 58, 0.35);

    color-scheme: dark;
}

html[data-theme="light"] {
    --bg: #eef2f8;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e6edf7 100%);
    --bg-side: linear-gradient(90deg, rgba(225, 29, 72, 0.05) 0%, rgba(225, 29, 72, 0.02) 15%, transparent 30%, transparent 70%, rgba(225, 29, 72, 0.02) 85%, rgba(225, 29, 72, 0.05) 100%);
    --header-bg: rgba(255, 255, 255, 0.82);
    --surface: rgba(255, 255, 255, 0.92);
    --surface-solid: #ffffff;
    --surface-2: #f2f5fa;
    --surface-3: #e6ebf3;
    --surface-hover: rgba(15, 23, 42, 0.04);
    --border: #e1e6ef;
    --border-strong: #cfd6e2;

    --text: #111827;
    --text-2: #4b5567;
    --text-3: #7c8699;

    --accent: #e11d48;
    --accent-hover: #be123c;
    --accent-soft: rgba(225, 29, 72, 0.1);
    --accent-softer: rgba(225, 29, 72, 0.05);
    --accent-text: #be123c;
    --accent-glow: 0 10px 22px rgba(225, 29, 72, 0.22);

    --success: #059669;
    --success-soft: #e6f7ef;
    --warning: #b45309;
    --warning-soft: #fdf4e3;
    --danger: #dc2626;
    --danger-soft: #fdecec;
    --info: #2563eb;
    --info-soft: #e9f1fe;
    --violet: #7c3aed;
    --violet-soft: #f2edfe;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 28px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 28px 80px rgba(15, 23, 42, 0.2);
    --overlay: rgba(15, 23, 42, 0.38);
    --focus: 0 0 0 3px rgba(225, 29, 72, 0.22);

    color-scheme: light;
}

/* --- База ---------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 12px);
}

body.site {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    overflow-x: hidden;
}

body.site::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--bg-side);
    pointer-events: none;
    z-index: -1;
}

body.site.no-scroll {
    overflow: hidden;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    line-height: 1.25;
    color: var(--text);
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

h2 {
    font-size: 1.25rem;
    font-weight: 650;
}

h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

p {
    margin: 0;
}

a {
    color: var(--accent-text);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

img,
svg,
video {
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

::selection {
    background: var(--accent-soft);
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 1000;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
}

.skip-link:focus {
    top: 12px;
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

[hidden] {
    display: none !important;
}

.muted {
    color: var(--text-2);
}

.subtle {
    color: var(--text-3);
}

.mono {
    font-family: var(--mono);
    font-size: 0.92em;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.nowrap {
    white-space: nowrap;
}

.grow {
    flex: 1 1 auto;
    min-width: 0;
}

.row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.row-wrap {
    flex-wrap: wrap;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.text-right {
    text-align: right;
}

/* --- Шапка --------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 60;
    height: var(--header-h);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
}

.site-header__inner {
    height: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: flex;
    align-items: center;
    gap: 24px;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    flex: none;
    border-radius: var(--radius-sm);
}

.site-brand:hover {
    text-decoration: none;
}

.site-brand__logo {
    display: block;
    height: 34px;
    width: auto;
    filter: drop-shadow(0 0 10px rgba(255, 7, 58, 0.35));
}

html[data-theme="light"] .site-brand__logo {
    filter: drop-shadow(0 2px 6px rgba(225, 29, 72, 0.22));
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
}

.site-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    color: var(--text-2);
    font-weight: 500;
    font-size: 0.94rem;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.site-nav__link i {
    font-size: 0.95em;
    opacity: 0.85;
}

.site-nav__link:hover {
    color: var(--text);
    background: var(--surface-hover);
    text-decoration: none;
}

.site-nav__link.is-active {
    color: var(--text);
    background: var(--accent-soft);
}

.site-nav__link.is-active i {
    color: var(--accent-text);
    opacity: 1;
}

.site-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex: none;
}

.site-header--minimal .site-header__actions {
    margin-left: auto;
}

.theme-switch .theme-switch__light {
    display: none;
}

html[data-theme="light"] .theme-switch .theme-switch__dark {
    display: none;
}

html[data-theme="light"] .theme-switch .theme-switch__light {
    display: inline-block;
}

.site-header .site-burger {
    display: none;
}

/* --- Меню пользователя --------------------------------------------------- */

.user-menu {
    position: relative;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 10px 0 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.user-chip:hover,
.user-chip[aria-expanded="true"] {
    border-color: var(--border-strong);
    background: var(--surface-2);
}

.user-chip__name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.92rem;
}

.user-chip__chevron {
    font-size: 0.7rem;
    color: var(--text-3);
    transition: transform 0.15s ease;
}

.user-chip[aria-expanded="true"] .user-chip__chevron {
    transform: rotate(180deg);
}

.user-menu__panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
}

/* --- Выпадающее меню ----------------------------------------------------- */

.menu {
    z-index: 80;
    min-width: 200px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-solid);
    box-shadow: var(--shadow-lg);
    animation: menu-in 0.14s ease-out;
}

@keyframes menu-in {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.menu-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 12px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.menu-head__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.menu-head__text strong {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-head__text span:not(.badge) {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-2);
    font-size: 0.85rem;
}

.menu-head__text .badge {
    margin-top: 4px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-size: 0.93rem;
    text-align: left;
    cursor: pointer;
}

.menu-item i {
    width: 18px;
    text-align: center;
    color: var(--text-3);
}

.menu-item:hover,
.menu-item:focus-visible {
    background: var(--surface-hover);
    text-decoration: none;
}

.menu-item:focus-visible {
    box-shadow: none;
    background: var(--surface-2);
}

.menu-item--danger,
.menu-item--danger i {
    color: var(--danger);
}

.menu-item[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.menu-item .menu-item__hint {
    margin-left: auto;
    color: var(--text-3);
    font-size: 0.8rem;
}

.menu-sep {
    height: 1px;
    margin: 6px 4px;
    background: var(--border);
}

.menu-label {
    padding: 8px 10px 4px;
    color: var(--text-3);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Контекстное меню, позиционируется скриптом */
.menu.menu--floating {
    position: fixed;
    width: 240px;
}

/* --- Кнопки -------------------------------------------------------------- */

.btn {
    --btn-h: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--btn-h);
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.93rem;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn:hover {
    text-decoration: none;
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn:disabled,
.btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    color: var(--on-accent);
}

.btn-secondary {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-3);
    border-color: var(--border-strong);
}

.btn-ghost {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--surface-hover);
}

.btn-quiet {
    background: transparent;
    color: var(--text-2);
}

.btn-quiet:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: transparent;
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger);
    color: #fff;
}

.btn-danger-solid {
    background: #dc2626;
    color: #fff;
}

.btn-danger-solid:hover:not(:disabled) {
    background: #b91c1c;
}

.btn-sm {
    --btn-h: 34px;
    padding: 0 13px;
    font-size: 0.86rem;
}

.btn-lg {
    --btn-h: 48px;
    padding: 0 24px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: var(--btn-h);
    padding: 0;
}

.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-color: rgba(255, 255, 255, 0.9) rgba(255, 255, 255, 0.9) transparent transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn-secondary.is-loading::after,
.btn-ghost.is-loading::after,
.btn-quiet.is-loading::after {
    border-color: var(--text) var(--text) transparent transparent;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: none;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--text);
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.icon-btn.is-active {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.icon-btn-sm {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
}

.spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

/* --- Формы --------------------------------------------------------------- */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field + .field {
    margin-top: 14px;
}

.label,
.field > label {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-2);
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-solid);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-3);
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: var(--text-3);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.input.is-invalid,
.textarea.is-invalid {
    border-color: var(--danger);
}

.textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

.select {
    appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888fa6' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

.select-sm,
.input-sm {
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 0.9rem;
    border-radius: 10px;
}

.hint {
    font-size: 0.83rem;
    color: var(--text-3);
    line-height: 1.45;
}

.field-error {
    font-size: 0.83rem;
    color: var(--danger);
}

.input-group {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.input-group .input {
    flex: 1 1 auto;
    min-width: 0;
}

.input-affix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-affix > i {
    position: absolute;
    left: 14px;
    color: var(--text-3);
    pointer-events: none;
    font-size: 0.9rem;
}

.input-affix .input {
    padding-left: 38px;
}

.input-affix .input-affix__btn {
    position: absolute;
    right: 4px;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 0.93rem;
    line-height: 1.45;
}

.check input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Переключатель */
.switch {
    position: relative;
    display: inline-flex;
    flex: none;
    width: 44px;
    height: 26px;
}

.switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.switch__track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--surface-3);
    border: 1px solid var(--border-strong);
    transition: background-color 0.18s ease, border-color 0.18s ease;
}

.switch__track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.18s ease;
}

.switch input:checked + .switch__track {
    background: var(--accent);
    border-color: var(--accent);
}

.switch input:checked + .switch__track::after {
    transform: translateX(18px);
}

.switch input:focus-visible + .switch__track {
    box-shadow: var(--focus);
}

.switch input:disabled {
    cursor: not-allowed;
}

.switch input:disabled + .switch__track {
    opacity: 0.55;
}

/* Сегментированный выбор */
.segmented {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.segmented button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 34px;
    height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-2);
    font-size: 0.86rem;
    font-weight: 500;
    cursor: pointer;
}

.segmented button:hover {
    color: var(--text);
}

.segmented button.is-active {
    background: var(--surface-solid);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

/* Варианты-карточки (радио) */
.choice-list {
    display: grid;
    gap: 8px;
}

.choice {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.choice:hover {
    border-color: var(--border-strong);
}

.choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--surface-3);
    color: var(--text-2);
}

.choice__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.choice__text strong {
    font-size: 0.95rem;
}

.choice__text span {
    color: var(--text-3);
    font-size: 0.84rem;
    line-height: 1.4;
}

.choice.is-selected,
.choice:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-softer);
}

.choice.is-selected .choice__icon,
.choice:has(input:checked) .choice__icon {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.choice:has(input:focus-visible) {
    box-shadow: var(--focus);
}

.choice:has(input:disabled) {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Карточки, уведомления, бейджи ---------------------------------------- */

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.card-body {
    padding: 22px;
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 22px 0;
}

.card-head p {
    margin-top: 4px;
    color: var(--text-2);
    font-size: 0.9rem;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 0.92rem;
    line-height: 1.45;
    background: var(--surface-2);
}

.alert > i {
    margin-top: 2px;
}

.alert-success {
    background: var(--success-soft);
    color: var(--success);
    border-color: color-mix(in srgb, var(--success) 25%, transparent);
}

.alert-error,
.alert-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

.alert-warning {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: color-mix(in srgb, var(--warning) 25%, transparent);
}

.alert-info {
    background: var(--info-soft);
    color: var(--info);
    border-color: color-mix(in srgb, var(--info) 25%, transparent);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1;
}

.badge-accent {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-info {
    background: var(--info-soft);
    color: var(--info);
}

.badge-violet {
    background: var(--violet-soft);
    color: var(--violet);
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex: none;
}

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent-text);
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.link-btn:disabled {
    color: var(--text-3);
    text-decoration: none;
    cursor: default;
}

.kbd {
    display: inline-block;
    min-width: 20px;
    padding: 1px 6px;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 5px;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-2);
    text-align: center;
}

/* --- Аватар -------------------------------------------------------------- */

.avatar {
    --size: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #ff073a, #ff6b35);
    color: #fff;
    font-weight: 700;
    font-size: calc(var(--size) * 0.42);
    line-height: 1;
    user-select: none;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-xs {
    --size: 22px;
}

.avatar-sm {
    --size: 30px;
}

.avatar-md {
    --size: 42px;
}

.avatar-lg {
    --size: 64px;
}

.avatar-xl {
    --size: 96px;
}

/* --- Страница и раскладка ------------------------------------------------ */

.site-main {
    flex: 1 0 auto;
    width: 100%;
}

.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.container-narrow {
    max-width: 880px;
}

.page {
    padding-top: 32px;
    padding-bottom: 48px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.page-head p {
    margin-top: 6px;
    color: var(--text-2);
}

.page-head__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-2);
}

.empty-state__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 6px;
    border-radius: 20px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 1.6rem;
}

.empty-state h3 {
    color: var(--text);
}

.empty-state p {
    max-width: 420px;
    font-size: 0.93rem;
}

.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, var(--surface-hover), transparent);
    animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
    to {
        transform: translateX(100%);
    }
}

/* --- Подвал -------------------------------------------------------------- */

.site-footer {
    flex: none;
    margin-top: auto;
    border-top: 1px solid var(--border);
    color: var(--text-3);
    font-size: 0.86rem;
}

.site-footer__inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 18px var(--gutter) calc(18px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.site-footer a {
    color: var(--text-2);
}

.site-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
}

/* --- Диалоги ------------------------------------------------------------- */

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--overlay);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: fade-in 0.15s ease-out;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

.dialog {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 520px;
    max-height: min(88vh, 760px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--surface-solid);
    box-shadow: var(--shadow-lg);
    animation: dialog-in 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
    overflow: hidden;
}

.dialog-lg {
    max-width: 640px;
}

.dialog-sm {
    max-width: 400px;
}

@keyframes dialog-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
}

.dialog__head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 22px 6px;
    flex: none;
}

.dialog__head h2 {
    font-size: 1.12rem;
}

.dialog__head p {
    margin-top: 4px;
    color: var(--text-2);
    font-size: 0.9rem;
    word-break: break-word;
}

.dialog__head .icon-btn {
    margin: -6px -8px 0 auto;
}

.dialog__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px 22px;
    overflow-y: auto;
}

.dialog__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 22px 20px;
    flex: none;
}

.dialog__foot .dialog__foot-left {
    margin-right: auto;
}

.dialog__error {
    margin-top: 12px;
}

/* --- Уведомления --------------------------------------------------------- */

.toast-stack {
    position: fixed;
    top: calc(var(--header-h) + 12px);
    right: 16px;
    z-index: 400;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    pointer-events: none;
    max-width: min(420px, calc(100vw - 32px));
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-solid);
    box-shadow: var(--shadow-lg);
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.45;
    pointer-events: auto;
    animation: toast-in 0.2s ease-out;
    word-break: break-word;
}

.toast.is-leaving {
    animation: toast-out 0.18s ease-in forwards;
}

.toast > i {
    margin-top: 2px;
}

.toast-success > i {
    color: var(--success);
}

.toast-error > i {
    color: var(--danger);
}

.toast-info > i {
    color: var(--info);
}

.toast-warning > i {
    color: var(--warning);
}

.toast__action {
    margin-left: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent-text);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(16px);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateX(16px);
    }
}

/* --- Прогресс ------------------------------------------------------------ */

.progress {
    height: 6px;
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), #ff6b35);
    transition: width 0.2s ease;
}

.progress.is-done .progress__bar {
    background: var(--success);
}

.progress.is-error .progress__bar {
    background: var(--danger);
}

/* --- Страницы ошибок ----------------------------------------------------- */

.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px var(--gutter) 60px;
}

.error-card {
    width: 100%;
    max-width: 520px;
    padding: 36px 32px 30px;
    text-align: center;
}

.error-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
    border-radius: 20px;
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 1.6rem;
}

.error-card.tone-warning .error-card__icon {
    background: var(--warning-soft);
    color: var(--warning);
}

.error-card__code {
    font-size: 3.6rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--accent), #ff6b35);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.error-card h1 {
    margin-top: 6px;
    font-size: 1.4rem;
}

.error-card__message {
    margin-top: 10px;
    color: var(--text-2);
    line-height: 1.55;
}

.error-card__extra {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    color: var(--text-2);
    font-size: 0.9rem;
}

.error-owner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 600;
}

.error-card__actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

/* --- Окно cookie --------------------------------------------------------- */

body.has-cookie-banner .assist-launcher {
    bottom: calc(96px + env(safe-area-inset-bottom));
}

/* --- Адаптив ------------------------------------------------------------- */

@media (max-width: 960px) {
    :root {
        --gutter: 18px;
    }

    .site-header__inner {
        gap: 12px;
    }

    .site-header .site-burger {
        display: inline-flex;
    }

    .site-nav {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        z-index: 59;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 10px var(--gutter) 16px;
        background: var(--surface-solid);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        transform: translateY(-8px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
    }

    .site-nav.is-open {
        transform: none;
        opacity: 1;
        visibility: visible;
        transition: opacity 0.15s ease, transform 0.15s ease;
    }

    .site-nav__link {
        height: 46px;
        border-radius: var(--radius);
        font-size: 1rem;
    }

    .user-chip__name {
        display: none;
    }

    .user-chip {
        padding-right: 8px;
    }
}

@media (max-width: 640px) {
    :root {
        --gutter: 16px;
        --header-h: 58px;
    }

    body.site {
        font-size: 15px;
    }

    h1 {
        font-size: 1.45rem;
    }

    .site-brand__logo {
        height: 28px;
    }

    .hide-xs {
        display: none !important;
    }

    .page {
        padding-top: 22px;
    }

    .dialog-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .dialog {
        max-width: none;
        max-height: 92vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        padding-bottom: env(safe-area-inset-bottom);
        animation: sheet-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
    }

    .dialog__foot .btn {
        flex: 1 1 auto;
    }

    .user-menu__panel {
        position: fixed;
        top: calc(var(--header-h) + 6px);
        right: 10px;
        left: 10px;
        width: auto;
    }

    .toast-stack {
        left: 16px;
        right: 16px;
        max-width: none;
        align-items: stretch;
    }
}

@keyframes sheet-in {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
