:root {
    --bg: #f7f5f3;
    --surface: #ffffff;
    --text: #1c1917;
    --text-secondary: #78716c;
    --text-muted: #a8a29e;
    --border: #e7e5e4;
    --header-bg: #292524;
    --header-text: #fafaf9;
    --accent: #dc2626;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --container: 1600px;
    --header-h: 56px;
}

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

[hidden] {
    display: none !important;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Модальные окна (общие) ────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 480px;
    max-height: 90dvh;
    overflow-y: auto;
}

.modal--sm { max-width: 360px; }

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal__title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.modal__form {
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal__text {
    padding: 12px 24px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal__actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 4px;
}

.modal__actions-right {
    display: flex;
    gap: 8px;
}

.modal--sm .modal__actions {
    padding: 16px 24px 24px;
}

.modal__error {
    font-size: 13px;
    color: var(--accent);
    background: rgba(220, 38, 38, 0.07);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: var(--radius);
    padding: 8px 12px;
}

/* ── Поля форм (общие) ─────────────────── */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.field__label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.req { color: var(--accent); }

.field__input {
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 12px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}

.field__input:focus {
    border-color: #a8a29e;
    box-shadow: 0 0 0 3px rgba(168, 162, 158, 0.15);
}

.field__input.is-invalid { border-color: var(--accent); }

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

/* ── Кнопки (варианты) ─────────────────── */

.btn--primary {
    background: var(--header-bg);
    color: var(--header-text);
    border-color: var(--header-bg);
}

.btn--primary:hover { background: #1c1917; border-color: #1c1917; }
.btn--primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--danger {
    background: rgba(220, 38, 38, 0.07);
    border-color: rgba(220, 38, 38, 0.2);
    color: var(--accent);
}

.btn--danger:hover {
    background: rgba(220, 38, 38, 0.13);
    border-color: rgba(220, 38, 38, 0.35);
}

.btn--danger-solid {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn--danger-solid:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.btn--danger-solid:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.modal__text {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 20px;
    line-height: 1.5;
}

.modal--sm__actions {
    justify-content: flex-end !important;
    gap: 8px;
}

.btn--restore {
    background: rgba(22, 163, 74, 0.07);
    border-color: rgba(22, 163, 74, 0.2);
    color: #15803d;
}

.btn--restore:hover {
    background: rgba(22, 163, 74, 0.13);
    border-color: rgba(22, 163, 74, 0.35);
}

/* ── Header ────────────────────────────── */

.header {
    background: var(--header-bg);
    height: var(--header-h);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header__inner {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 32px;
}

.header__auth {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header__user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.header__user-role {
    font-size: 11px;
    font-weight: 600;
    color: rgba(250, 250, 249, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.header__user-email {
    font-size: 13px;
    color: rgba(250, 250, 249, 0.8);
}

.btn--header {
    font-size: 13px;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--header-text);
}

.btn--header:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.25);
}

.header__logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--header-text);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.header__nav {
    display: flex;
    gap: 4px;
}

.header__link {
    color: rgba(250, 250, 249, 0.6);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}

.header__link:hover {
    color: var(--header-text);
    background: rgba(255, 255, 255, 0.08);
}

.header__link--active {
    color: var(--header-text);
    background: rgba(255, 255, 255, 0.1);
}

/* ── Main ──────────────────────────────── */

.main {
    padding: 28px 0 48px;
}

/* ── Utilities ─────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    white-space: nowrap;
}

.btn:hover {
    background: #fafaf9;
    border-color: #d6d3d1;
}

.btn:active {
    background: #f5f5f4;
}

.btn--icon {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 18px;
}

.btn--ghost {
    border-color: transparent;
    background: transparent;
}

.btn--ghost:hover {
    background: rgba(0, 0, 0, 0.04);
}
