:root {
    --bg: #0f1419;
    --surface: #171d26;
    --surface-2: #1e2530;
    --border: #2a3441;
    --text: #e6edf3;
    --muted: #8b98a8;
    --accent: #3b82f6;
    --ok: #22c55e;
    --warn: #f59e0b;
    --bad: #ef4444;
}

* { box-sizing: border-box; }

/* Редакторы подключения и трёхэтапный мастер плана. */
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 560px; }
.field-label-row label { margin: 0; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; width: 36px; height: 36px; padding: 7px; border-radius: 10px; color: var(--accent); }
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.editor-dialog { color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 18px; width: min(540px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); padding: 0; box-shadow: 0 24px 100px #0005; margin: auto; }
.editor-dialog::backdrop { background: #0c183975; backdrop-filter: blur(3px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.dialog-header h2 { margin: 0; font-size: 20px; }
.dialog-body { padding: 22px 24px; max-height: 65dvh; overflow-y: auto; }
.dialog-grid { display: grid; grid-template-columns: 1fr; gap: 15px; }
.dialog-grid label { display: flex; flex-direction: column; gap: 6px; margin: 0; }
.dialog-grid input, .dialog-grid select, .editor-dialog textarea { max-width: none; width: 100%; }
.dialog-grid .check-label { flex-direction: row; align-items: center; gap: 9px; }
.dialog-grid input[type=checkbox] { width: 18px; height: 18px; min-height: 18px; flex: 0 0 auto; }
.editor-dialog details { margin-top: 18px; }
.editor-dialog summary { cursor: pointer; color: var(--accent); margin-bottom: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); }
.plan-progress { margin: 26px 0 20px; }
.plan-progress ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); }
.plan-progress li { position: relative; }
.plan-progress li:not(:last-child)::after { content: ''; position: absolute; left: calc(50% + 25px); right: calc(-50% + 25px); top: 23px; height: 2px; background: var(--border); }
.plan-progress li.complete::after { background: var(--accent); }
.plan-progress button { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 9px; width: 100%; padding: 0 8px; background: transparent; border: 0; color: var(--muted); box-shadow: none; }
.step-number { display: grid; place-items: center; width: 46px; height: 46px; border: 2px solid var(--border); border-radius: 50%; background: var(--surface); font-size: 17px; font-weight: 700; }
.step-label { font-size: 13px; line-height: 1.35; text-align: center; }
.plan-progress .current { color: var(--accent); }
.plan-progress .current button { color: var(--accent); font-weight: 700; }
.plan-progress .current .step-number { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb,var(--accent) 12%,transparent); }
.plan-progress .complete .step-number { color: var(--accent); border-color: var(--accent); }
.wizard-caption { color: var(--muted); font-size: 13px; margin-top: 10px; }
.wizard-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); margin-top: 28px; padding-top: 20px; }
.plan-review { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; background: var(--surface-2); border-radius: 12px; margin-bottom: 20px; overflow-wrap: anywhere; }
.plan-review span { color: var(--muted); }
@media (max-width: 600px) {
    .icon-button { width: 44px; height: 44px; flex-basis: 44px; }
    .editor-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); border-radius: 14px; }
    .dialog-header, .dialog-body, .dialog-actions { padding-left: 16px; padding-right: 16px; }
    .dialog-body { max-height: 61dvh; }
    .dialog-actions button { flex: 1; }
    .plan-progress button { padding: 0 4px; }
    .step-label { font-size: 11px; }
    .wizard-actions { flex-direction: column-reverse; align-items: stretch; }
    .wizard-actions > div { flex: none; min-width: 0; }
    .wizard-actions .actions { justify-content: stretch; flex-wrap: wrap; }
    .wizard-actions .actions > button { flex: 1 1 120px; min-width: 0; word-break: normal; overflow-wrap: normal; }
}

/* Стили body убраны: тему и типографику задаёт MudThemeProvider.
   Переменные --bg, --surface и т.д. нужны только общим компонентам. */
body { margin: 0; }

.shell { display: flex; min-height: 100vh; }

/* ---------------- боковая панель ---------------- */

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.brand {
    font-size: 17px;
    font-weight: 600;
    padding: 0 20px 20px;
    letter-spacing: -0.2px;
}

.brand span { color: var(--accent); }

.sidebar nav { display: flex; flex-direction: column; }

.sidebar nav a {
    padding: 9px 20px;
    color: var(--muted);
    text-decoration: none;
    border-left: 2px solid transparent;
}

.sidebar nav a:hover { color: var(--text); background: var(--surface-2); }

/* Blazor добавляет класс active совпадающим маршрутам */
.sidebar nav a.active {
    color: var(--text);
    border-left-color: var(--accent);
    background: var(--surface-2);
}

.version {
    margin-top: auto;
    padding: 16px 20px 0;
    font-size: 11px;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

/* ---------------- содержимое ---------------- */

.content { flex: 1; padding: 28px 32px; max-width: 1200px; }

h1 { font-size: 22px; font-weight: 600; margin: 0 0 20px; letter-spacing: -0.3px; }

h2 { font-size: 15px; font-weight: 600; margin: 0 0 14px; }

.hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.card.empty { border-style: dashed; }

.card.empty pre {
    background: var(--bg);
    padding: 14px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12.5px;
    margin: 12px 0 0;
}

/* ---------------- плитки ---------------- */

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left-width: 3px;
    border-radius: 8px;
    padding: 16px 18px;
}

.tile.ok { border-left-color: var(--ok); }
.tile.warn { border-left-color: var(--warn); }

.tile-value { font-size: 28px; font-weight: 600; line-height: 1.2; }

.tile-label { color: var(--text); font-size: 13px; margin-top: 2px; }

.tile-hint { color: var(--muted); font-size: 11.5px; margin-top: 6px; }

/* ---------------- таблицы ---------------- */

.table { width: 100%; border-collapse: collapse; }

.table th {
    text-align: left;
    font-weight: 500;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 0 12px 10px 0;
    border-bottom: 1px solid var(--border);
}

.table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border); }

.table tr:last-child td { border-bottom: none; }

.muted { color: var(--muted); }

.empty-note { color: var(--muted); margin: 0; }

code {
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 12.5px;
    background: var(--bg);
    padding: 2px 5px;
    border-radius: 4px;
}

/* ---------------- метки состояния ---------------- */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11.5px;
    white-space: nowrap;
}

.badge.ok { background: rgba(34, 197, 94, 0.15); color: var(--ok); }
.badge.warn { background: rgba(245, 158, 11, 0.15); color: var(--warn); }
.badge.bad { background: rgba(239, 68, 68, 0.15); color: var(--bad); }
.badge.muted-badge { background: var(--surface-2); color: var(--muted); }

td.ok { color: var(--ok); }
td.warn { color: var(--warn); }

/* ---------------- формы ---------------- */

.form-row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }

.form-row label { font-size: 12.5px; color: var(--muted); }

.form-row .hint { margin: 0; font-size: 11.5px; }

input, select, textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 8px 10px;
    font-family: inherit;
    font-size: 13.5px;
    width: 100%;
    max-width: 460px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}

button {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13.5px;
}

button:hover:not(:disabled) { border-color: var(--muted); }

button:disabled { opacity: 0.45; cursor: not-allowed; }

button.primary,
 a.button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 500;
}

a.button.primary { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

button.primary:hover:not(:disabled),
a.button.primary:hover { background: #2f6fd8; }

.alert {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
}

.alert.ok { background: rgba(34, 197, 94, 0.12); color: var(--ok); }
.alert.bad { background: rgba(239, 68, 68, 0.12); color: var(--bad); }

a { color: var(--accent); }
/* ------------------------------------------------------------ ход работы
   Полоса прогресса обязательна: копирование крупной базы идёт десятки минут,
   и без неё интерфейс неотличим от зависшего. */
.progress-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.progress-row:last-child { border-bottom: none; }

.progress-head {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
}

.progress-head > span:nth-child(2) {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-track {
    margin: 8px 0 6px;
    height: 6px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.fill-run  { background: var(--accent); }
.fill-ok   { background: var(--ok); }
.fill-bad  { background: var(--bad); }

.progress-foot {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.card-head h2 { margin-bottom: 0; }

/* Ссылка-скачивание. Это главное действие на странице установки: покупатель
   приходит именно за файлом агента, поэтому кнопка должна быть заметнее
   обычного текста ссылки, но оставаться в той же цветовой гамме, что и
   остальные действия. */
.download {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
}

.download:hover {
    filter: brightness(1.08);
}

.download:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Таблица соответствия версий. Читается построчно: у пользователя перед
   глазами именно строки, и колонки, повёрнутые на бок, заставляют
   возвращаться к началу на каждой строке. */
table.matrix {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 20px;
    font-size: 13px;
}

table.matrix th,
table.matrix td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line, #e3e8ef);
    vertical-align: top;
}

table.matrix th {
    font-weight: 600;
    color: var(--muted, #5b6b7f);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

table.matrix td:first-child {
    white-space: nowrap;
}

table.matrix code {
    background: rgba(59, 130, 246, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--muted);
    cursor: pointer;
}

/* Ошибка показывается строкой под заданием, а не заменяет его: иначе из
   истории исчезает само задание, и разбираться в инциденте не с чем. */
.error-cell {
    color: var(--bad);
    font-size: 12.5px;
    white-space: pre-wrap;
}

.row-bad td { background: rgba(239, 68, 68, 0.05); }

.manifest-cell {
    padding-top: 0;
    border-bottom: 1px solid var(--line);
}

.entry-chip {
    display: inline-flex;
    gap: 6px;
    margin: 0 8px 4px 0;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 12px;
}

.hint.bad { color: var(--bad); }
/* ------------------------------------------------- страница установки агента
   Команды показываются в блоках с кнопкой копирования: инструкцию
   переносят на узел копированием, и набирать её руками означало бы
   опечатки в адресе — после которых агент молча не зарегистрируется. */

.lead {
    max-width: 70ch;
    color: var(--muted);
    margin-bottom: 22px;
}

.way {
    margin-bottom: 34px;
}

.way-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
}

.way-head h3 {
    margin: 0;
    font-size: 16px;
}

.way-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    display: inline-block;
    align-self: center;
}

.way-note {
    color: var(--muted);
    font-size: 12.5px;
}

.steps {
    list-style: none;
    counter-reset: step;
    padding: 0;
    margin: 0;
}

.steps > li {
    counter-increment: step;
    margin-bottom: 20px;
}

.step-title {
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

.code {
    position: relative;
    background: rgba(148, 163, 184, 0.09);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 8px;
}

.code pre {
    margin: 0;
    padding-right: 52px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12.5px;
    line-height: 1.55;
}

.copy {
    position: absolute;
    top: 8px;
    right: 8px;

    /* Размер задан не по вкусу, а по общему правилу: button, .button-link и
       .download получают min-height 42px, и это сделано ради сенсорных
       экранов. Бороться с ним не стоит — значок просто делается квадратом
       того же размера, иначе кнопка выходит узкой и высокой. */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;

    /* Рамки в покое нет. У надписи «Копировать» она была приглашением нажать,
       у значка своего смысла не несёт, а на странице их двадцать, и двадцать
       одинаковых квадратов только шумят в блоках кода. Рамка и фон
       появляются при наведении — там они и нужны. */
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    opacity: .55;
    cursor: pointer;
    transition: opacity .15s ease, background-color .15s ease;
}

.copy:hover,
.copy:focus-visible {
    opacity: 1;
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

.copy.copied { opacity: 1; background: transparent; border-color: transparent; color: var(--ok); }
.copy svg { display: block; }

.notes {
    margin: 8px 0 0;
    padding-left: 20px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.notes code {
    background: rgba(148, 163, 184, 0.12);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
}

.notes li { margin-bottom: 6px; }

.alert.warn {
    background: rgba(234, 179, 8, 0.12);
    color: #d9a406;
}
/* Выбор дней недели: горизонтальная лента переключателей.
   Подпись внутри рамки, а не рядом с ней: иначе при переносе на узком
   экране подпись и переключатель разъезжаются по разным строкам. */
.day-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.day-picker .day {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--line, #2a3346);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text, #e6ebf5);
    font-size: 13px;
}

.day-picker .day input { margin: 0; }
/* Единые семантические цвета для обоих кабинетов и страницы входа. */
:root, :root[data-theme="light"] {
    color-scheme: light;
    --bg: #f4f6fa; --surface: #ffffff; --surface-2: #edf2f8;
    --border: #dce3ed; --text: #17243b; --muted: #54647c;
    --accent: #2459d3; --ok: #137348; --warn: #946000; --bad: #c1323c;
    --accent-soft: #eaf0ff; --shadow: 0 3px 16px rgba(24,40,72,.035);
    --line: var(--border); --ink: var(--text);
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #101722; --surface: #182231; --surface-2: #222e40;
    --border: #344257; --text: #edf2fa; --muted: #a8b6cb;
    --accent: #9abaff; --ok: #72dbad; --warn: #f2c86c; --bad: #ff9ca4;
    --accent-soft: #263b60; --shadow: none;
}

/* Заголовки и линии таблиц MudBlazor в тёмной теме.
   Без этого <thead> остаётся белым: MudBlazor берёт Surface,
   но таблица внутри MudPaper может наследовать светлый фон. */
:root[data-theme="dark"] .mud-table-head .mud-table-cell,
:root[data-theme="dark"] .mud-table-root thead .mud-table-cell {
    background-color: var(--mud-palette-surface-dark, #2d2d3f);
    color: var(--mud-palette-text-primary, #edf2fa);
}
:root[data-theme="dark"] .mud-table-row:hover .mud-table-cell {
    background-color: rgba(255, 255, 255, 0.04);
}
:root[data-theme="dark"] .mud-table-cell,
:root[data-theme="dark"] .mud-table-root .mud-table-cell {
    border-color: var(--mud-palette-lines-default, rgba(255,255,255,0.12));
}
:root[data-theme="dark"] .mud-table-sort-label:hover {
    color: var(--mud-palette-text-primary);
}
html { scroll-behavior: smooth; }
/* body, button и a стилизует MudBlazor; здесь только reset для legacy-компонентов */
a { text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
.button-link, .download { min-height: 42px; border-radius: 8px; }

/* Плавный переход при смене темы */
.mud-appbar, .mud-drawer, .mud-main-content, .mud-paper, .mud-table,
.mud-nav-link, .mud-typography, .mud-input, .mud-button-root {
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* Кнопка переключения темы — лёгкая анимация иконки */
.theme-toggle {
    transition: transform 0.3s ease, background-color 0.2s ease;
}
.theme-toggle:hover {
    transform: rotate(20deg);
}

/* Кнопка копирования внутри блоков команд: позиционируется
   в правом верхнем углу блока. Обёртка MudTooltip перехватывает
   absolute, поэтому она делается статической, а блок кода
   разворачивается на всю ширину контейнера. */
.mud-paper:has(.copy-button) { position: relative; width: 100%; }
.mud-paper:has(.copy-button) > .mud-tooltip-wrapper { position: static; }
.copy-button {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 1;
}
.button-link { display: inline-flex; align-items: center; padding: 8px 16px; border: 1px solid var(--border); text-decoration: none; color: var(--text); background: var(--surface); }
/* Focus outline для legacy-компонентов; MudBlazor задаёт свой.
   Синюю рамку 3px убрали: на MudBlazor-формах она дублирует фокус MudSelect. */
.form-row :focus-visible, .dialog-grid :focus-visible, .field-label-row :focus-visible { outline: none; }
/* FocusOnNavigate временно фокусирует заголовок после перехода. Он не входит в порядок Tab. */
.content h1[tabindex="-1"]:focus, .form-section-title[tabindex="-1"]:focus { outline: none; }
/* Стили input/select/textarea задаёт MudBlazor; ниже — только для legacy-компонентов */
.form-row input, .form-row select, .form-row textarea,
.field-label-row input, .field-label-row select, .field-label-row textarea,
.dialog-grid input, .dialog-grid select, .dialog-grid textarea,
.editor-dialog textarea { background: var(--surface); padding: 10px 12px; min-height: 44px; }
.form-row input[type="checkbox"], .form-row input[type="radio"],
.dialog-grid input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; flex: 0 0 auto; accent-color: #2459d3; }
.shell { min-height: 100vh; }
.sidebar { width: 244px; padding: 30px 16px 20px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 0; padding: 0 8px; font-size: 23px; font-weight: 750; color: var(--text); text-decoration: none; letter-spacing: -.8px; }
.brand .brand-mark { display: inline-grid; place-items: center; width: 34px; height: 38px; border-radius: 10px; margin-right: 10px; color: #fff; background: #2459d3; font-size: 21px; }
.workspace-label { color: var(--muted); font-size: 12px; padding: 9px 8px 25px; }
.nav-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 650; padding: 16px 12px 8px; }
.sidebar nav { gap: 4px; }
.sidebar nav a { padding: 10px 12px; border: 0; border-radius: 8px; font-weight: 500; }
.sidebar nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 650; }
.version { margin-top: auto; padding: 24px 8px 0; border: 0; font-size: 11px; }
.workspace { min-width: 0; flex: 1; }
.topbar { min-height: 80px; padding: 16px 36px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.context-label { color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.topbar form { margin: 0; }
.theme-switch { display: inline-flex; background: var(--bg); padding: 3px; border: 1px solid var(--border); border-radius: 9px; gap: 2px; }
.theme-switch button { min-height: 32px; padding: 4px 10px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12px; border-radius: 6px; }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow); }
.quiet { background: transparent; }
.content { width: 100%; max-width: 1440px; padding: 36px; margin: 0 auto; min-width: 0; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-header h1 { margin: 5px 0 6px; }
.page-header .lead { margin: 0; }
.page-header > a, .page-header > button { flex-shrink: 0; }
.eyebrow { font-size: 10px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted); font-weight: 700; }
h1 { font-size: clamp(24px, 2.3vw, 32px); line-height: 1.25; letter-spacing: -.8px; font-weight: 700; }
h2 { font-size: 17px; line-height: 1.4; font-weight: 650; }
.card { padding: 24px; border-radius: 12px; box-shadow: var(--shadow); margin-bottom: 24px; min-width: 0; }
.card-head { flex-wrap: wrap; margin-bottom: 20px; align-items: center; }
.card-head a { font-size: 13px; }
.tiles { gap: 18px; margin-bottom: 26px; }
.tile { border-radius: 12px; padding: 22px; box-shadow: var(--shadow); }
.tile.bad { border-left-color: var(--bad); }
.tile-value { font-size: 30px; letter-spacing: -.8px; }
.tile-label { margin-top: 8px; }
.tile-hint { font-size: 12px; }
.onboarding { display: flex; align-items: center; justify-content: space-between; gap: 24px; background: var(--accent-soft); }
.onboarding h2 { margin: 8px 0; }
.onboarding p { color: var(--muted); margin-bottom: 0; }
.actions, .row, .toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.row { align-items: end; }
.row > label { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 200px; }
.toolbar { margin: 20px 0; align-items: end; gap: 18px; }
.toolbar label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; }
.toolbar .search-field { flex: 1; }
.toolbar input { max-width: 100%; }
.admin-forms { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 24px; align-items: start; }
.admin-forms input, .admin-forms select { max-width: none; }
.form-row label { font-size: 13px; font-weight: 550; color: var(--text); }
.form-row .hint { font-size: 12px; }
.table-scroll { width: 100%; overflow-x: auto; border-radius: 8px; }
table, .table { border-collapse: collapse; width: 100%; font-size: 13px; }
table th, .table th { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .3px; text-transform: none; white-space: nowrap; }
table td, .table td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table td { overflow-wrap: anywhere; }
table td .actions { flex-wrap: nowrap; }
table td button { font-size: 12px; min-height: 36px; white-space: nowrap; padding: 6px 10px; }
tbody tr:hover { background: var(--surface-2); }
table tr:last-child td { border-bottom: 0; }
.badge { padding: 4px 9px; font-size: 12px; font-weight: 550; }
.empty-note { padding: 16px 0; }
.alert, .error, .notice { padding: 14px 18px; margin: 16px 0; border-radius: 8px; border: 1px solid var(--border); }
.alert.bad, .error { background: color-mix(in srgb, var(--bad) 9%, var(--surface)); color: var(--bad); }
.alert.ok, .notice { background: color-mix(in srgb, var(--ok) 9%, var(--surface)); color: var(--ok); }
.alert.warn { background: color-mix(in srgb, var(--warn) 10%, var(--surface)); color: var(--warn); }
.alert button { margin-left: 12px; }
details > summary { cursor: pointer; font-weight: 650; font-size: 16px; }
details[open] > summary { margin-bottom: 22px; }
.destination-block { border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin: 20px 0; }
.destination-block legend { font-weight: 600; padding: 0 8px; }
.plan-editor { border-top: 3px solid var(--accent); }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; padding: 12px 18px; background: var(--surface); }
.skip-link:focus { top: 12px; }
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 2px solid var(--bad); padding: 16px; z-index: 1000; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 440px); padding: 36px; }
.login-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.login-card .brand { padding: 0; margin-bottom: 0; }
.theme-toggle-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px; border: none;
    background: transparent; color: var(--muted); cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
.theme-toggle-btn:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle-btn svg { flex-shrink: 0; width: 20px; height: 20px; }
.login-card label { display: block; margin: 16px 0 6px; }
.login-card input { max-width: none; }
.login-card button[type="submit"] { width: 100%; margin: 24px 0 18px; }
.login-card .theme-switch { margin-top: 12px; }
@media (max-width: 1100px) {
    .sidebar { width: 218px; }
    .content { padding: 26px; }
    .tiles { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .onboarding { align-items: start; flex-direction: column; }
    .admin-forms { grid-template-columns: 1fr; gap: 0; }
}
/* Меню и карточки адаптируются к телефону, а не уменьшают desktop-макет. */
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mobile-menu-toggle { display: none; }
.tile, .form-row, .card, .page-header > div { min-width: 0; }
.content { overflow-wrap: anywhere; }
@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--border); overflow: visible; }
    .sidebar .brand { padding: 0; font-size: 21px; }
    .workspace-label, .version { display: none; }
    .mobile-menu-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 12px; }
    .mobile-menu-toggle span { font-size: 20px; line-height: 1; }
    .sidebar nav { display: none; }
    .sidebar nav.mobile-open { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding-top: 16px; }
    .sidebar nav a { display: flex; align-items: center; min-height: 44px; font-size: 14px; padding: 10px 12px; }
    .nav-label { grid-column: 1 / -1; display: block; }
    .topbar { padding: 10px 16px; min-height: 64px; }
    .context-label { display: none; }
    .topbar-actions { width: 100%; justify-content: space-between; gap: 8px; }
    .theme-switch button { min-height: 38px; }
    .content { padding: 24px 20px; }
    .page-header { align-items: start; flex-direction: column; gap: 16px; }
    .card { padding: 20px; }
    .row > label { min-width: 100%; }
    input, select, textarea { max-width: 100%; min-width: 0; }
    /* На узком экране места справа нет, и кнопка уходит в правый верхний угол
       над текстом. Размер кнопки и отступ заданы вместе: при кнопке 42px со
       старым отступом она наезжала бы на первую строку команды. */
    .copy { width: 30px; height: 30px; min-height: 30px; top: 6px; right: 6px; }
    .code pre { padding-right: 0; padding-top: 41px; }
}
@media (max-width: 600px) {
    .content { padding: 22px 14px; }
    .content h1 { font-size: 25px; line-height: 1.25; }
    .page-header { margin-bottom: 20px; }
    .page-header > button, .page-header > a { width: 100%; justify-content: center; text-align: center; }
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .tile { padding: 14px 12px; }
    .tile-value { font-size: 23px; line-height: 1.25; }
    .tile-label, .tile-hint { font-size: 12px; }
    .card { padding: 16px; margin-bottom: 16px; }
    .card-head { align-items: start; gap: 8px; margin-bottom: 14px; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar > label { width: 100%; }
    input, select, textarea { font-size: 16px; width: 100%; }
    button, .button-link, .download { min-height: 44px; }
    .theme-switch button { min-height: 40px; padding: 5px 9px; }
    .actions { align-items: stretch; }
    .actions > button, .actions > a { flex: 1 1 140px; text-align: center; justify-content: center; }
    .onboarding { gap: 16px; }
    .onboarding .actions { width: 100%; }
    .destination-block { min-width: 0; padding: 12px; margin-inline: 0; }
    .destination-block legend { max-width: 100%; }
    .day-picker { gap: 6px; }
    .day-picker .day { min-height: 44px; }
    .progress-head { flex-wrap: wrap; }
    .progress-foot { flex-wrap: wrap; gap: 5px; }
    .login-page { padding: 16px; }
    .login-card { padding: 24px; }
    .table-scroll:has(.mobile-cards) { overflow: visible; border-radius: 0; }
    table.mobile-cards, .mobile-cards tbody { display: block; width: 100%; }
    .mobile-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .mobile-cards tbody > tr { display: block; border: 1px solid var(--border); border-radius: 10px; margin: 0 0 14px; overflow: hidden; background: var(--surface); }
    .mobile-cards tbody > tr:last-child { margin-bottom: 0; }
    .mobile-cards td { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: start; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--border); width: 100%; white-space: normal; }
    .mobile-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 500; }
    .mobile-cards td:first-child { background: var(--surface-2); }
    .mobile-cards td:last-child { border-bottom: 0; }
    .mobile-cards td:not([data-label]) { display: block; }
    .mobile-cards td:not([data-label])::before { display: none; }
    .mobile-cards td .actions { flex-wrap: wrap; min-width: 0; }
    .mobile-cards td button { min-height: 44px; white-space: normal; }
    .mobile-cards td > * { min-width: 0; }
    .mobile-cards td .muted { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }

.form-row > label > input, .form-row > label > select { display: block; margin-top: 6px; }
.form-section-title { font-size: 15px; margin: 26px 0 18px; padding-bottom: 10px; border-bottom: 1px solid var(--border); color: var(--accent); }
/* ---------------- страницы, открытые до входа ---------------- */

/* Регистрация и подтверждение по ссылке. Бокового меню здесь нет намеренно:
   кабинета у человека ещё нет, и его ссылки вели бы туда, куда без входа не
   пустят. Ширина ограничена так же, как у карточки входа, иначе форма
   растягивалась бы на весь экран и поля растянулись бы нечитаемо широко. */
.open-page { min-height: 100dvh; display: flex; flex-direction: column; }
.open-topbar {
  min-height: 68px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.open-topbar .brand { padding: 0; font-size: 19px; }
.open-topbar .brand-mark { width: 30px; height: 34px; font-size: 18px; border-radius: 9px; margin-right: 8px; }
.open-content {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 32px 24px 56px;
  min-width: 0;
}
.open-content .page-header { display: block; margin-bottom: 20px; }