/* Кабинеты и вход. Та же бумага, олива и бронза, что на основном сайте
   (css/editorial.css), но отдельным файлом: страницы кабинета не тянут
   одиннадцать стилей главной. */

:root {
    color-scheme: light;
    --bg: #f5f1e8;
    --surface: #faf7f0;
    --surface-raised: #fffdf8;
    --surface-sunk: #ece6da;
    --label: #302c24;
    --label-2: #686154;
    --label-3: #746b5b;
    --accent: #76603d;
    --accent-strong: #5f4c2f;
    --accent-soft: #76603d14;
    --olive: #343629;
    --olive-hover: #484b39;
    --separator: #4c402b30;
    --separator-soft: #4c402b1c;
    --fill: #4c402b0a;
    --fill-strong: #4c402b14;
    --ok: #4f6b3a;
    --ok-soft: #4f6b3a1a;
    --warn: #8c4d52;
    --warn-soft: #8c4d5214;
    --wait: #7a5b16;
    --wait-soft: #b58a2a24;
    --shadow: 0 1px 2px #45371d0f, 0 8px 24px #45371d12;
    --radius: 16px;
    --radius-s: 10px;
    --serif: Georgia, 'Times New Roman', serif;
    --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --gutter: max(16px, env(safe-area-inset-left));
    --top: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--label);
    font: 400 16px/1.6 var(--sans);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; color: var(--label); margin: 0; }
h2 { font-size: 22px; line-height: 1.3; letter-spacing: -.3px; }
p { margin: 0 0 12px; }
code { font-family: var(--mono); font-size: .92em; background: var(--fill-strong); padding: 1px 6px; border-radius: 6px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #76603d80; outline-offset: 2px; border-radius: 6px; }
h1:focus, h2:focus, main:focus, section:focus { outline: none; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 16px;
    background: var(--olive); color: #faf6ee; border-radius: var(--radius-s); text-decoration: none;
}
.skip-link:focus { top: 12px; }
.muted { color: var(--label-2); }
.small { font-size: 14px; }
.noscript { padding: 24px; text-align: center; }
.kicker {
    font-size: 11px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase;
    color: var(--accent); margin: 0 0 10px;
}
.lede { color: var(--label-2); font-size: 17px; max-width: 60ch; }

/* ─── Шапка ─────────────────────────────────────────────────────────── */

.cab-top {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 16px;
    min-height: var(--top);
    padding: 8px max(24px, env(safe-area-inset-right)) 8px max(24px, env(safe-area-inset-left));
    background: #f5f1e8eb;
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--separator-soft);
}
.cab-brand {
    display: inline-flex; align-items: center; gap: 10px;
    font: 400 24px/1 var(--serif); letter-spacing: -1px; color: var(--label); text-decoration: none; white-space: nowrap;
}
.cab-brand em { color: var(--accent); font-style: normal; }
.cab-brand-symbol { width: 18px; height: 26px; color: var(--accent); flex-shrink: 0; }
.cab-brand-symbol ellipse, .cab-brand-symbol path { fill: none; stroke: currentColor; stroke-width: 1.2; }
.cab-top-title { font-size: 13px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--label-3); padding-left: 16px; border-left: 1px solid var(--separator); }
.cab-top-link { margin-left: auto; font-size: 15px; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.cab-user { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.cab-user-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--label); min-height: 44px; min-width: 0; padding: 2px 8px 2px 2px; border-radius: 999px; }
.cab-user-link:hover { background: var(--fill-strong); color: var(--label); }
.cab-user-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.cab-user-text strong { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.cab-user-text small { color: var(--label-3); font-size: 12px; }

.avatar {
    width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%;
    display: inline-grid; place-items: center;
    background: var(--olive); color: #f3ead7; font: 500 13px/1 var(--sans); letter-spacing: .5px;
}

/* ─── Раскладка кабинета ────────────────────────────────────────────── */

.cab-layout {
    display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px;
    max-width: 1240px; margin: 0 auto;
    padding: 32px max(24px, env(safe-area-inset-right)) 80px max(24px, env(safe-area-inset-left));
}
.cab-nav ul { list-style: none; margin: 0; padding: 0; position: sticky; top: calc(var(--top) + 24px); display: grid; gap: 2px; }
.cab-nav a {
    display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px;
    border-radius: var(--radius-s); color: var(--label-2); text-decoration: none; font-size: 15px;
}
.cab-nav a:hover { background: var(--fill-strong); color: var(--label); }
.cab-nav a[aria-current="page"] { background: var(--surface); color: var(--label); box-shadow: inset 3px 0 0 var(--accent), var(--shadow); }
.cab-nav svg { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cab-nav a[aria-current="page"] svg { color: var(--accent); }
.nav-label { flex: 1; }
.nav-badge {
    min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
    background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; line-height: 22px; text-align: center;
}
.cab-main { min-width: 0; }
.loading { color: var(--label-2); padding: 40px 0; }

/* ─── Разделы ───────────────────────────────────────────────────────── */

.view { max-width: 900px; }
.view-narrow { max-width: 760px; }
.view-head { margin: 0 0 28px; }
.view-head h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.1; letter-spacing: -1.2px; margin-bottom: 10px; overflow-wrap: anywhere; }
.view-head .btn { margin-top: 8px; }
.view-head .meta { margin-top: 12px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--label-2); font-size: 14px; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; margin: -8px 0 8px; font-size: 15px; text-decoration: none; }

.section { margin: 36px 0; }
.section > h2, .section-head { margin-bottom: 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }

.panel {
    background: var(--surface); border: 1px solid var(--separator-soft); border-radius: var(--radius);
    padding: 24px; margin: 0 0 20px; box-shadow: var(--shadow);
}
.panel > h2 { margin-bottom: 14px; }
.panel-accent { background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--surface); border-color: #76603d40; }
.panel > :last-child { margin-bottom: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 12px; }
.stat {
    display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; min-height: 104px;
    background: var(--surface); border: 1px solid var(--separator-soft); border-radius: var(--radius);
    color: var(--label-2); text-decoration: none; box-shadow: var(--shadow);
    transition: border-color .15s ease, transform .15s ease;
}
.stat:hover { border-color: var(--accent); color: var(--label-2); }
.stat strong { font: 400 36px/1 var(--serif); color: var(--label); letter-spacing: -1px; }
.stat span { font-size: 14px; }
.stat-accent strong { color: var(--accent); }
.stat-warn strong { color: var(--warn); }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cards-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.card {
    display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; height: 100%;
    background: var(--surface); border: 1px solid var(--separator-soft); border-radius: var(--radius);
    color: var(--label); box-shadow: var(--shadow);
}
.card-link { text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease; }
.card-link:hover { color: var(--label); border-color: #76603d66; box-shadow: 0 2px 4px #45371d14, 0 12px 32px #45371d1a; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { font: 400 20px/1.3 var(--serif); letter-spacing: -.2px; overflow-wrap: anywhere; }
.card-title a { color: inherit; text-decoration: none; }
.card-title a:hover { text-decoration: underline; }
.card-excerpt { color: var(--label-2); font-size: 15px; }
.card p { margin: 0; }
.kind { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.quote { font: italic 400 16px/1.6 var(--serif); color: var(--label); }

.badge {
    display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px;
    font-size: 13px; font-weight: 500; white-space: nowrap;
}
.badge-todo { background: var(--fill-strong); color: var(--label-2); }
.badge-draft { background: var(--fill-strong); color: var(--label); }
.badge-wait { background: var(--wait-soft); color: var(--wait); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.due { font-size: 14px; color: var(--label-2); }
.due-late { color: var(--warn); font-weight: 500; }

.person { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.person-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.person-text strong { font-weight: 500; overflow-wrap: anywhere; }
.person-text small { color: var(--label-3); font-size: 13px; overflow-wrap: anywhere; }
.person-link { text-decoration: none; color: var(--label); display: inline-flex; min-height: 44px; align-items: center; }

.meter-line { display: grid; gap: 6px; font-size: 14px; color: var(--label-2); }
.bar { display: block; height: 6px; border-radius: 999px; background: var(--fill-strong); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

.filters { display: flex; gap: 8px; margin: 0 0 20px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters a {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
    border: 1px solid var(--separator); border-radius: 999px; color: var(--label-2);
    text-decoration: none; font-size: 15px; white-space: nowrap; flex-shrink: 0;
}
.filters a:hover { border-color: var(--accent); color: var(--label); }
.filters a[aria-current="true"] { background: var(--olive); border-color: var(--olive); color: #faf6ee; }
.filters .count { font-size: 12px; opacity: .75; }

.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--separator-soft); flex-wrap: wrap; }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.row select { width: auto; min-width: 170px; }

.facts { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 10px 24px; margin: 0; }
.facts dt { color: var(--label-2); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.prose { font: 400 18px/1.75 var(--serif); margin: 0 0 20px; }
.prose p { margin: 0 0 14px; white-space: pre-wrap; }
.answer {
    white-space: pre-wrap; overflow-wrap: anywhere; font: 400 17px/1.75 var(--serif);
    background: var(--surface-raised); border: 1px solid var(--separator-soft); border-radius: var(--radius-s);
    padding: 18px 20px; margin: 0 0 14px;
}
.notice { background: var(--accent-soft); border-radius: var(--radius-s); padding: 12px 16px; font-size: 15px; }
.notice-warn { background: var(--warn-soft); color: var(--warn); }
.empty { padding: 32px 24px; text-align: center; color: var(--label-2); border: 1px dashed var(--separator); border-radius: var(--radius); }
.empty p { margin: 0 0 12px; }
.empty > :last-child { margin-bottom: 0; }
.disclosure { margin: 0 0 16px; }
.disclosure summary { cursor: pointer; color: var(--accent); min-height: 44px; display: flex; align-items: center; gap: 8px; list-style: none; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::before { content: ''; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; }
.disclosure[open] summary::before { transform: rotate(45deg); }
.next-link { text-align: right; }

/* Переписка */
.messages { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.message { max-width: 88%; padding: 12px 16px; border-radius: 16px 16px 16px 4px; background: var(--surface-raised); border: 1px solid var(--separator-soft); }
.message-mine { justify-self: end; border-radius: 16px 16px 4px 16px; background: var(--accent-soft); border-color: #76603d2e; }
.message-meta { display: flex; gap: 10px; align-items: baseline; font-size: 13px; color: var(--label-3); margin: 0 0 4px; flex-wrap: wrap; }
.message-meta strong { color: var(--label); font-weight: 500; }
.message-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Ссылки для пароля и добавление людей */
.link-box { display: grid; gap: 10px; padding: 16px; margin: 0 0 16px; border: 1px dashed #76603d80; border-radius: var(--radius-s); background: var(--accent-soft); }
.link-box p { margin: 0; font-size: 15px; }
.link-input { font-family: var(--mono) !important; font-size: 14px !important; }
.row-extra { flex-basis: 100%; }
.row-extra:empty { display: none; }
.add-person[open] summary { margin-bottom: 8px; }

/* Группы */
.group-card { gap: 12px; }
.invite { display: grid; gap: 6px; padding: 14px 16px; border: 1px dashed #76603d66; border-radius: var(--radius-s); background: var(--surface-raised); }
.invite-label { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--label-3); }
.invite-code { font: 500 22px/1.2 var(--mono); letter-spacing: 2px; background: none; padding: 0; color: var(--label); user-select: all; overflow-wrap: anywhere; }

/* ─── Формы ─────────────────────────────────────────────────────────── */

/* minmax(0, …): колонка не растягивается по самому длинному пункту в <select>
   — WebKit меряет минимальную ширину списка по самому длинному варианту. */
.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.form > .btn { justify-self: start; }
.material-link { margin: 0 0 24px; }
.form > h2 { margin-bottom: 0; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.field > label, .field-row > label, .choice legend { font-size: 14px; font-weight: 500; color: var(--label); }
.field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field-hint { font-size: 13px; color: var(--label-3); line-height: 1.45; }
.field-hint-ok { color: var(--ok); }
.field-hint-error { color: var(--warn); }
.optional { font-weight: 400; color: var(--label-3); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
    width: 100%; min-width: 0; max-width: 100%; min-height: 48px; padding: 11px 14px;
    font: 400 16px/1.4 var(--sans); color: var(--label);
    background: var(--surface-raised); border: 1px solid var(--separator); border-radius: var(--radius-s);
    transition: border-color .15s ease, box-shadow .15s ease;
    -webkit-appearance: none; appearance: none;
}
/* Содержимое поля не выходит за его рамку: WebKit рисует текст длинного
   пункта списка и части поля даты поверх границ, и страница становилась
   шире экрана, хотя сами поля в неё помещались. */
input:not([type=checkbox]):not([type=radio]), select { overflow: hidden; }
select {
    padding-right: 40px; cursor: pointer; text-overflow: ellipsis; white-space: nowrap;
    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 d='M1 1l5 5 5-5' fill='none' stroke='%2376603d' stroke-width='1.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
textarea { line-height: 1.65; resize: vertical; min-height: 120px; }
input:hover, select:hover, textarea:hover { border-color: #4c402b55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #76603d2e; }
[aria-invalid="true"] { border-color: var(--warn) !important; box-shadow: 0 0 0 3px #8c4d5220 !important; }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
input[type=date] { min-width: 0; }
.choice { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.choice legend { margin-bottom: 8px; padding: 0; }
.choice label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.inline-form > h2 { width: 100%; }
.inline-form .field { flex: 1 1 220px; }
.toolbar { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; margin: 0 0 12px; }

.form-status { min-height: 0; margin: 0; font-size: 15px; }
.form-status:empty { display: none; }
.form-status-ok { color: var(--ok); }
.form-status-error { color: var(--warn); }

.password { position: relative; }
.password input { padding-right: 96px; }
.password-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    min-height: 40px; min-width: 84px; padding: 0 12px; border: 0; border-radius: 8px;
    background: none; color: var(--accent); font: 500 14px/1 var(--sans); cursor: pointer;
}
.password-toggle:hover { background: var(--fill-strong); }
meter { width: 100%; height: 6px; margin-top: 2px; }
meter::-webkit-meter-bar { background: var(--fill-strong); border: 0; border-radius: 999px; height: 6px; }
meter::-webkit-meter-optimum-value { background: var(--ok); border-radius: 999px; }
meter::-webkit-meter-suboptimum-value { background: var(--wait); border-radius: 999px; }
meter::-webkit-meter-even-less-good-value { background: var(--warn); border-radius: 999px; }

/* ─── Кнопки ────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 0 22px; border-radius: 12px; border: 1px solid transparent;
    font: 500 16px/1.2 var(--sans); text-decoration: none; cursor: pointer; text-align: center;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { cursor: progress; }
.btn-primary { background: var(--olive); color: #faf6ee; border-color: var(--olive); }
.btn-primary:hover { background: var(--olive-hover); color: #fff; }
.btn-secondary { background: var(--surface-raised); color: var(--label); border-color: var(--separator); }
.btn-secondary:hover { border-color: var(--accent); color: var(--label); }
.btn-ghost { background: none; color: var(--accent); padding: 0 12px; }
.btn-ghost:hover { background: var(--fill-strong); color: var(--accent-strong); }
.btn-danger { background: none; color: var(--warn); border-color: #8c4d5255; }
.btn-danger:hover { background: var(--warn-soft); color: var(--warn); }
.btn-danger-text { color: var(--warn); }
.btn-small { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-wide { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions-wrap { gap: 6px; }
.link-btn {
    background: none; border: 0; padding: 0; min-height: 44px; color: var(--accent);
    font: inherit; font-size: 15px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--accent-strong); }

.toast {
    position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
    z-index: 40; max-width: min(520px, calc(100vw - 32px)); padding: 12px 20px; border-radius: 14px;
    background: var(--olive); color: #faf6ee; font-size: 15px; box-shadow: 0 12px 32px #302c2440;
    animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

.demo-banner {
    margin: 0 0 20px; padding: 12px 16px; font-size: 14px; line-height: 1.5;
    border: 1px dashed #76603d80; border-radius: var(--radius-s); background: var(--accent-soft); color: var(--label-2);
}
.demo-banner strong { color: var(--label); }

/* ─── Вход ──────────────────────────────────────────────────────────── */

.auth {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 64px; align-items: start;
    max-width: 1160px; margin: 0 auto;
    padding: 56px max(24px, env(safe-area-inset-right)) 80px max(24px, env(safe-area-inset-left));
}
.auth-intro { padding-top: 24px; }
.auth-intro h1 { font-size: clamp(34px, 4.4vw, 54px); line-height: 1.08; letter-spacing: -1.6px; margin: 0 0 20px; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 32px; display: grid; gap: 14px; max-width: 52ch; }
.auth-points li { position: relative; padding-left: 28px; color: var(--label-2); }
.auth-points li::before { content: ''; position: absolute; left: 0; top: .72em; width: 16px; height: 1px; background: var(--accent); }
.auth-photo { margin: 0; aspect-ratio: 1.6; border-radius: 80px 4px 4px 4px; overflow: hidden; background: var(--surface-sunk); max-width: 560px; }
.auth-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auth-card {
    background: var(--surface); border: 1px solid var(--separator-soft); border-radius: 24px;
    padding: 28px; box-shadow: 0 2px 6px #45371d0f, 0 24px 60px #45371d1c;
}
.auth-card:focus { outline: none; }
.auth-form { display: grid; gap: 16px; }
.auth-form h2 { font-size: 26px; }
.auth-switch { text-align: center; color: var(--label-2); font-size: 15px; margin: 0; }
.auth-fine { font-size: 13px; color: var(--label-3); margin: 0; text-align: center; }
.auth-done { text-align: left; }

.segmented {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; margin: 0 0 22px;
    background: var(--fill-strong); border-radius: 12px;
}
.segmented [role=tab] {
    min-height: 40px; border: 0; border-radius: 9px; background: none; cursor: pointer;
    font: 500 15px/1 var(--sans); color: var(--label-2);
}
.segmented-single { grid-template-columns: 1fr; }
.segmented [aria-selected="true"] { background: var(--surface-raised); color: var(--label); box-shadow: 0 1px 3px #45371d24; }

.demo-login { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--separator-soft); display: grid; gap: 10px; }
.demo-login h2 { font-size: 19px; }
.demo-login p { margin: 0; font-size: 14px; }
.demo-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.demo-buttons .btn { padding: 0 8px; font-size: 15px; }
.demo-login .link-btn { justify-self: start; font-size: 14px; }

/* ─── Телефон ───────────────────────────────────────────────────────── */

@media (max-width: 1000px) {
    .cab-top-title { display: none; }
    .cab-layout { grid-template-columns: 190px minmax(0, 1fr); gap: 24px; }
}

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; max-width: 560px; }
    .auth-intro { padding-top: 0; }
    .auth-intro h1 { font-size: clamp(28px, 7.4vw, 38px); margin-bottom: 12px; }
    .auth-intro .lede { font-size: 16px; }
    .auth-points, .auth-photo { display: none; }
}

@media (max-width: 760px) {
    :root { --top: 56px; }
    .cab-top { padding: 6px max(16px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left)); gap: 10px; }
    .cab-brand { font-size: 21px; }
    .cab-user-text, .cab-logout { display: none; }
    .cab-user-link { padding: 2px; }

    .cab-layout { display: block; padding: 20px max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
    .cab-nav {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        background: #faf7f0ee; -webkit-backdrop-filter: saturate(1.5) blur(18px); backdrop-filter: saturate(1.5) blur(18px);
        border-top: 1px solid var(--separator-soft);
        padding: 4px max(6px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    }
    .cab-nav ul { position: static; display: flex; gap: 0; }
    .cab-nav li { flex: 1 1 0; min-width: 0; }
    .cab-nav .nav-secondary { display: none; }
    .cab-nav a {
        position: relative; flex-direction: column; justify-content: center; gap: 2px;
        min-height: 54px; padding: 6px 2px; font-size: 11px; line-height: 1.1; text-align: center; border-radius: 10px;
    }
    .cab-nav a[aria-current="page"] { background: none; box-shadow: none; color: var(--accent); }
    .cab-nav svg { width: 24px; height: 24px; }
    .nav-label { flex: none; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; line-height: 18px; font-size: 11px; padding: 0 5px; }

    .view-head { margin-bottom: 20px; }
    .view-head h1 { font-size: clamp(28px, 8vw, 34px); letter-spacing: -.8px; }
    .panel { padding: 18px; border-radius: 14px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { min-height: 88px; padding: 14px 16px; }
    .stat strong { font-size: 30px; }
    .card { padding: 16px; }
    .cards-grid { grid-template-columns: 1fr; }
    .toolbar { grid-template-columns: minmax(0, 1fr); }
    .facts { grid-template-columns: 1fr; gap: 2px; }
    .facts dd { margin-bottom: 10px; }
    .prose { font-size: 17px; }
    .actions .btn { flex: 1 1 auto; }
    .actions-wrap .btn { flex: 0 1 auto; }
    .form > .btn { justify-self: stretch; }
    .message { max-width: 94%; }
    .row select { width: 100%; }
    .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }

    .auth { padding: 16px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); }
    .auth-card { padding: 20px; border-radius: 20px; }
    .demo-buttons { grid-template-columns: 1fr; }
}

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