/* ============================ Компоненты ============================ */

/* ---- Разделы листа ----
   .card — блок с тонкой рамкой (группы настроек, панели админки, всплывающие формы).
   На листе ленты (узкие страницы) блоки верхнего уровня и публикации — без рамок: только
   тонкая линия снизу, лист остаётся одним листом. */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.shell:not(.wide) .main > .card, .shell:not(.wide) .main > section.card, .shell:not(.wide) .main .composer.card, .shell:not(.wide) .main .tabs.card, .post.card {
  background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
}
.shell:not(.wide) .main > .banner { margin: 12px 20px 0; }
.card.pad { padding: var(--s5); }
.card-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s4) var(--s5) 0; }
.card-head h2, .card-head h3 { font-size: var(--fs-md); font-weight: 650; }
.card-body { padding: var(--s4) var(--s5) var(--s5); }
.section-title { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-xl); }
/* Шапка страницы: крупное название антиквой */
.page-head { display: flex; align-items: center; gap: var(--s2); min-height: 72px; padding: 22px 20px 14px; }
.shell.wide .main > .page-head, .settings-page > .page-head { padding: 26px 0 10px; }
.page-head h1 { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-2xl); letter-spacing: -.01em; line-height: 1.1; }
.page-head .back { width: 38px; height: 38px; margin-left: -8px; border-radius: var(--r-full); display: grid; place-items: center; background: none; border: 0; color: var(--text); transition: background var(--t-fast), transform var(--t-fast) var(--ease); }
.page-head .back:hover { background: var(--surface-2); transform: translateX(-2px); }
/* Липкая шапка ленты: название + вкладки на матовом стекле */
.sheet-head { position: sticky; top: 0; z-index: 6; background: var(--glass); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.sheet-head .page-head { min-height: 0; padding: 20px 20px 4px; }
.sheet-head .tabs { border-bottom: 0; padding: 0 8px; }

/* ---- Кнопки: чернильная «пилюля» — главное действие; контурная — второстепенное ---- */
.btn {
  --h: var(--control-h); display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h); padding: 0 18px;
  border-radius: var(--r-full); border: 1px solid transparent; font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; letter-spacing: .005em;
  background: var(--btn-bg); color: var(--btn-fg); -webkit-tap-highlight-color: transparent; user-select: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
.btn:hover { color: var(--btn-fg); background: color-mix(in srgb, var(--btn-bg) 84%, var(--accent)); }
.btn:active { transform: scale(.97); }
.btn[disabled], .btn[aria-busy="true"], .btn[aria-disabled="true"] { opacity: .38; pointer-events: none; }
.btn[aria-busy="true"] { cursor: progress; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn.secondary:hover { border-color: var(--text); color: var(--text); background: transparent; }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 86%, #000); color: #fff; }
.btn.danger.secondary { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.danger-text { color: var(--danger); }
.btn.accent { background: var(--accent); color: var(--inverse); }
.btn.sm { --h: var(--control-h-sm); padding: 0 14px; font-size: var(--fs-xs); }
.btn.lg { --h: var(--control-h-lg); padding: 0 24px; font-size: var(--fs-md); }
.btn.block { width: 100%; }
.btn.icon { width: var(--h); padding: 0; }
.iconbtn {
  width: 38px; height: 38px; border-radius: var(--r-full); display: inline-grid; place-items: center; border: 0; background: none; color: var(--muted);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease); flex: none; -webkit-tap-highlight-color: transparent;
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn:active { transform: scale(.92); }
.iconbtn[aria-pressed="true"] { color: var(--text); background: var(--surface-3); }
.iconbtn[disabled] { opacity: .38; pointer-events: none; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Поля: «листок» на листе — заливка без рамки, рамка появляется при фокусе ---- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: var(--fs-sm); color: var(--text); }
.input, .textarea, .select {
  width: 100%; min-height: var(--control-h); padding: 9px 14px; border-radius: var(--r-md); border: 1px solid transparent;
  background: var(--surface-2); color: var(--text); outline: none; font-size: var(--fs-md);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 1; }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
/* Однострочные поля и списки выбора — ровно высоты элемента управления */
.input, .select { height: var(--control-h); }
.select.sm { height: var(--control-h-sm); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; cursor: pointer; }
.select.sm { min-height: var(--control-h-sm); padding: 4px 30px 4px 12px; font-size: var(--fs-xs); font-weight: 600; width: auto; min-width: var(--field-w-sm); border-radius: var(--r-full); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; }
.input:hover, .textarea:hover, .select:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.input:focus, .textarea:focus, .select:focus { background-color: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
/* iOS увеличивает страницу при фокусе на поле с шрифтом < 16px */
@media (max-width: 759px) { .input, .textarea, .select:not(.sm) { font-size: 16px; } }
.input.with-prefix { padding-left: 30px; }
.prefix-wrap { position: relative; }
.prefix-wrap > .prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.hint { font-size: var(--fs-xs); color: var(--muted); }
.field-error { font-size: var(--fs-sm); color: var(--danger); }
.field-error:empty { display: none; }
.form { display: grid; gap: var(--s4); }
.form-actions { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 2px 0 0; }

/* Переключатель: дорожка-«шов», бегунок — бумажная пуговица */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 42px; height: 24px; border-radius: 99px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); position: relative; transition: background var(--t), box-shadow var(--t); flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(40, 30, 16, .3); transition: transform var(--t) var(--ease-out); }
.switch input:checked + .track { background: var(--accent); box-shadow: none; }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.setting-row { display: flex; align-items: center; gap: var(--s4); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.setting-row:first-child { border-top: 0; }
.setting-row .text { flex: 1; min-width: 0; }
.setting-row .text b { display: block; font-weight: 600; }

/* Сегменты и вкладки: текст + тонкая линия под выбранным (растёт из центра) */
.segmented { display: inline-flex; padding: 3px; border-radius: var(--r-full); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: none; padding: 6px 14px; border-radius: var(--r-full); font-weight: 600; font-size: var(--fs-xs); color: var(--muted); transition: color var(--t-fast), background var(--t-fast); }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(40, 30, 16, .1), 0 0 0 1px var(--line); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a {
  flex: none; border: 0; background: none; padding: 14px 12px 13px; font-weight: 600; font-size: var(--fs-sm); color: var(--muted); position: relative; white-space: nowrap;
  transition: color var(--t-fast);
}
.tabs button:hover, .tabs a:hover { color: var(--text); }
.tabs [aria-selected="true"] { color: var(--text); }
.tabs [aria-selected="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--text); animation: tab-in var(--t) var(--ease-out); }
@keyframes tab-in { from { transform: scaleX(.2); opacity: 0; } }
.shell:not(.wide) .main > .tabs { padding: 0 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: var(--control-h-sm); padding: 0 13px; border-radius: var(--r-full); background: transparent; color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; border: 1px solid var(--line-strong); transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
button.chip:hover { color: var(--text); border-color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--surface); }
button.chip { cursor: pointer; }
/* Плашка с аватаром (сообщества в профиле): круглый аватар внутри рамки с ровным отступом */
.chip.chip-ava { height: 34px; padding: 3px 14px 3px 3px; gap: 8px; color: var(--text); text-decoration: none; }
.chip.chip-ava .avatar { --size: 26px; border-radius: 50%; font-size: 10px; }
.chip.chip-ava .muted { font-weight: 500; }
a.chip:hover { color: var(--text); border-color: var(--text); background: color-mix(in srgb, var(--text) 5%, transparent); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.pill.good { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); }
.pill.warn { background: color-mix(in srgb, var(--warning) 14%, transparent); color: var(--warning); }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill.info { background: var(--accent-soft); color: var(--accent-strong); }
/* ---- Аватары и бейджи ---- */
.avatar { --size: 44px; width: var(--size); height: var(--size); border-radius: 50%; flex: none; overflow: hidden; background: var(--surface-3);
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: calc(var(--size) * .38); user-select: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sq { border-radius: 28%; }
.avatar.xs { --size: 28px; } .avatar.sm { --size: 36px; } .avatar.lg { --size: 64px; } .avatar.xl { --size: 112px; }
/* Бейдж у имени: 22px в ленте и списках, 20px в комментариях, 32px в шапке профиля и выборе бейджа. */
.ubadge { display: inline-flex; align-items: center; justify-content: center; flex: none; vertical-align: -5px; margin-left: 5px; cursor: help; }
.ubadge img { width: 22px; height: 22px; object-fit: contain; }
.ubadge.custom { height: 22px; min-width: 22px; padding: 0 7px; border-radius: var(--r-full); font-size: 12.5px; font-weight: 700; gap: 3px; line-height: 1; }
.ubadge.custom.circle { padding: 0; width: 22px; }
.comment .ubadge img { width: 20px; height: 20px; }
.comment .ubadge.custom { height: 20px; min-width: 20px; font-size: 11.5px; padding: 0 6px; }
.comment .ubadge.custom.circle { width: 20px; padding: 0; }
.ubadge.custom.square { border-radius: 7px; }
.ubadge.lg img { width: 32px; height: 32px; }
.ubadge.lg { margin-left: 8px; vertical-align: -6px; }
.ubadge[role="button"] { cursor: pointer; border-radius: var(--r-full); }
.ubadge[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.badge-upload-preview { min-height: 64px; display: flex; align-items: center; }
.badge-upload-preview img.big { width: 64px; height: 64px; object-fit: contain; border-radius: var(--r-md); background: var(--surface-2); padding: 6px; border: 1px solid var(--line); }
.badge-tip { position: fixed; z-index: var(--z-pop); width: max-content; max-width: min(280px, calc(100vw - 16px)); padding: 12px 14px;
  border-radius: var(--r-md); background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow-pop);
  display: grid; gap: 6px; font-size: var(--fs-sm); line-height: 1.4; animation: tip-in .12s ease-out; }
.badge-tip .row { display: flex; align-items: center; gap: 8px; }
.badge-tip .row .ubadge { margin: 0; }
.badge-tip p { margin: 0; }
.badge-tip .muted { color: var(--muted); }
@keyframes tip-in { from { opacity: 0; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .badge-upload-preview { min-height: 64px; display: flex; align-items: center; }
.badge-upload-preview img.big { width: 64px; height: 64px; object-fit: contain; border-radius: var(--r-md); background: var(--surface-2); padding: 6px; border: 1px solid var(--line); }
.badge-tip { animation: none; } }
.ubadge.lg.custom { height: 32px; min-width: 32px; font-size: 15px; padding: 0 11px; }
.ubadge.lg.custom.circle { width: 32px; padding: 0; }
.ubadge.lg.custom.square { border-radius: 9px; }
.name-line { display: flex; align-items: center; min-width: 0; gap: 0; }
.name-line .name { font-weight: 700; color: var(--text); }
.name-line .handle { color: var(--muted); margin-left: 6px; font-size: var(--fs-sm); }

/* ---- Всплывающие панели (ui/popover.js) ----
   Одна основа для меню действий, меню аккаунта, реакций и эмодзи, цвета и шрифта в редакторе:
   одинаковые фон, рамка, тень, скругление, отступы и появление. Меню — фиксированной ширины. */
.popover {
  position: fixed; z-index: var(--z-pop); max-width: calc(100vw - 16px); padding: var(--pop-pad); border-radius: var(--pop-r);
  background: var(--surface); box-shadow: var(--shadow-pop); animation: pop var(--t) var(--ease-out);
}
/* Меню — по ширине самого длинного пункта (не уже --pop-w, не шире 320px и экрана); пункты не
   раздвигают меню: длинный текст обрезается многоточием внутри. */
.popover.menu { width: max-content; min-width: min(var(--pop-w), calc(100vw - 16px)); max-width: min(320px, calc(100vw - 16px)); }
.popover:not(.menu) { width: var(--pop-w-lg); }
.menu-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.menu-item {
  min-width: 0; display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--pop-item-h); padding: 0 12px; border-radius: calc(var(--pop-r) - var(--pop-pad));
  border: 0; background: none; text-align: left; font-weight: 500; font-size: var(--fs-sm); color: var(--text);
}
.menu-item .icon { color: var(--muted); }
.menu-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; color: var(--text); }
.menu-item:hover .icon, .menu-item:focus-visible .icon { color: var(--text); }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-list hr { border: 0; height: 1px; background: var(--line); margin: var(--pop-pad) calc(var(--pop-pad) * -1); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
.popover[data-side="above"] { animation-name: pop-up; }
@keyframes pop-up { from { opacity: 0; transform: translateY(4px) scale(.97); } }
/* Подсказки (бейдж, графики) — те же поверхность и тень, скругление поменьше */
.badge-tip, .chart-tip { border-radius: var(--tip-r) !important; border: 0 !important; box-shadow: var(--shadow-pop) !important; }

/* ---- Модальные окна (на телефоне — нижний лист) ---- */
.modal-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--overlay); display: grid; place-items: center; padding: 16px; animation: fade var(--t); }
.modal { width: 100%; max-width: var(--panel-w); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto; overscroll-behavior: contain; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); animation: modal-in var(--t-slow) var(--ease-out); }
.modal.wide { max-width: var(--panel-w-wide); }
.modal-head { display: flex; align-items: center; gap: var(--s2); padding: 20px 16px 6px 24px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h2 { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-xl); flex: 1; letter-spacing: -.005em; }
.modal-body { padding: 6px 24px 24px; display: grid; gap: var(--s4); }
@keyframes fade { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@media (max-width: 759px) {
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal, .modal.wide { max-width: none; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; max-height: 92dvh; animation: sheet-up .32s var(--ease-out); padding-bottom: env(safe-area-inset-bottom); }
  .modal::before { content: ""; display: block; width: 36px; height: 4px; margin: 8px auto -6px; border-radius: 4px; background: var(--line-strong); }
  .modal-head { padding: 14px 12px 4px 18px; }
  .modal-body { padding: 6px 18px 18px; }
  .modal-body > .form-actions { position: sticky; bottom: 0; z-index: 2; margin: 0 -18px -18px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .modal-body > .form-actions .btn { flex: 1; }
  @keyframes sheet-up { from { transform: translateY(100%); } }
}

/* ---- Уведомления (toast): чернильная плашка снизу ---- */
.toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: var(--z-toast); display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 24px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-radius: var(--r-full); background: var(--btn-bg); color: var(--btn-fg); font-weight: 500; font-size: var(--fs-sm);
  box-shadow: var(--shadow-pop); animation: toast-in var(--t-slow) var(--ease-out); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
.toast.error { background: var(--danger); color: #fff; }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; padding: 0 0 0 8px; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 759px) { .toasts { bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); } }

/* ---- Состояния: загрузка, пусто, ошибка ---- */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-sm); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 60%, transparent), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-post { padding: 18px 20px; display: grid; gap: 12px; }
.shell:not(.wide) .main .sk-post.card { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.sk-line { height: 11px; }
.state { display: grid; justify-items: center; gap: var(--s2); padding: 56px var(--s5); text-align: center; color: var(--muted); }
.state .state-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); margin-bottom: 8px; box-shadow: inset 0 0 0 1px var(--line-strong); }
.state h3 { color: var(--text); font-family: var(--font-display); font-weight: 400; font-size: var(--fs-xl); }
.state p { max-width: 360px; font-size: var(--fs-sm); }
.state .btn { margin-top: var(--s3); }
.state.compact { padding: var(--s6) var(--s4); }
.state.compact h3 { font-size: var(--fs-lg); }
.loading-row { display: flex; justify-content: center; padding: var(--s5); color: var(--muted); }
/* Объявление: тонкая линия слева вместо цветной плашки */
.banner { display: flex; gap: var(--s3); align-items: flex-start; padding: 12px 16px; border-radius: 0 var(--r-md) var(--r-md) 0; background: var(--surface-2); color: var(--text); font-size: var(--fs-sm); border-left: 2px solid var(--text-2); }
.banner.warn { border-left-color: var(--warning); background: color-mix(in srgb, var(--warning) 7%, var(--surface)); }
.banner.bad { border-left-color: var(--danger); background: var(--danger-soft); }
.banner.good { border-left-color: var(--good); background: var(--accent-soft); }
.banner .icon { flex: none; margin-top: 1px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: var(--s2) 0; }
.or-sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: var(--track-caps); text-transform: uppercase; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
/* Вход через Google: фирменный знак, кнопка в общем стиле */
.btn.provider { background: var(--surface); color: var(--text); border-color: var(--line-strong); gap: 10px; font-size: var(--fs-md); font-weight: 600; }
.btn.provider:hover { border-color: var(--text); background: var(--surface); color: var(--text); }
.g-mark { width: 20px; height: 20px; flex: none; }

/* ---- Форматированный текст (публикации и комментарии) ---- */
.rt { overflow-wrap: anywhere; white-space: normal; line-height: 1.6; }
.rt > * + * { margin-top: .65em; }
.rt p { white-space: pre-wrap; }
.rt h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.45em; letter-spacing: -.01em; line-height: 1.25; }
.rt h3 { font-size: 1.12em; font-weight: 650; line-height: 1.35; }
.rt blockquote { margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--accent); color: var(--text-2); white-space: pre-wrap; font-family: var(--font-display); font-size: 1.04em; }
.rt pre { margin: 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); overflow-x: auto; font-family: var(--font-mono); font-size: .86em; white-space: pre; line-height: 1.55; }
.rt ul, .rt ol { margin: 0; padding-left: 1.5em; }
.rt li + li { margin-top: .2em; }
.rt li::marker { color: var(--muted); }
.rt code { font-family: var(--font-mono); font-size: .86em; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.rt pre code { padding: 0; background: none; box-shadow: none; }
.rt a { color: var(--accent-strong); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-color var(--t-fast); }
.rt a:hover { text-decoration-color: currentColor; }
.rt .spoiler { background: var(--text); color: transparent; border-radius: 4px; cursor: pointer; transition: background var(--t), color var(--t); }
.rt .spoiler.open { background: var(--surface-2); color: inherit; cursor: auto; }
.rt [data-font="poster"], .editor [data-font="poster"] { font-family: "Bebas Neue", var(--font); font-size: 1.25em; letter-spacing: .02em; }
.rt [data-font="hand"], .editor [data-font="hand"] { font-family: "Caveat", cursive; font-size: 1.3em; }
.rt [data-font="elegant"], .editor [data-font="elegant"] { font-family: "Playfair Display", Georgia, serif; font-style: italic; }

/* ---- Публикация: без рамки, на листе; действия проявляются цветом при наведении ---- */
.post { padding: 18px 20px 10px; display: grid; gap: 10px; animation: rise var(--t-slow) var(--ease-out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.post-head { display: flex; gap: var(--s3); align-items: center; min-width: 0; }
.post-head .iconbtn { margin: -6px -8px -6px 0; }
.post-meta { min-width: 0; flex: 1; }
.post-meta .sub { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-xs); flex-wrap: wrap; }
.post-meta .sub a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.post-note { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; margin-bottom: -2px; }
.post .rt { font-size: 15.5px; }
.post-actions { display: flex; align-items: center; gap: 4px; margin: 0 -10px; }
.act { display: inline-flex; align-items: center; gap: 6px; height: 36px; min-width: 36px; padding: 0 10px; border-radius: var(--r-full); border: 0; background: none; color: var(--muted); font-weight: 500; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; transition: background var(--t-fast), color var(--t-fast); }
.act:hover { background: var(--surface-2); color: var(--text); }
.act:active .icon { transform: scale(.88); }
.act .icon { transition: transform var(--t-fast) var(--ease); }
.act.like[aria-pressed="true"] { color: var(--like); }
.act.like[aria-pressed="true"] .icon { fill: currentColor; animation: like-pop .42s var(--ease-out); }
@keyframes like-pop { 0% { transform: scale(.6); } 45% { transform: scale(1.28); } 100% { transform: scale(1); } }
.act.like:hover { background: var(--like-soft); color: var(--like); }
.act.repost[aria-pressed="true"], .act.repost:hover { color: var(--repost); }
.act.repost:hover { background: var(--repost-soft); }
.act.save[aria-pressed="true"] { color: var(--text); }
.act.save[aria-pressed="true"] .icon { fill: currentColor; }
.act .views { font-weight: 500; }
.post-hidden { font-size: var(--fs-sm); }
.embed { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3) var(--s4); display: grid; gap: var(--s2); transition: border-color var(--t-fast); }
.embed:hover { border-color: var(--line-strong); }
.embed.gone { color: var(--muted); font-size: var(--fs-sm); background: var(--surface-2); }
.imgrid { display: grid; gap: 2px; border-radius: var(--r-md); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.imgrid.n1 { grid-template-columns: 1fr; }
.imgrid.n2 { grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1.1; }
.imgrid.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 3 / 2; }
.imgrid.n3 > :first-child { grid-row: span 2; }
.imgrid.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 4 / 3; }
.imgrid button { border: 0; padding: 0; background: var(--surface-2); min-height: 0; overflow: hidden; cursor: zoom-in; }
.imgrid img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow) var(--ease); }
.imgrid button:hover img { transform: scale(1.015); }
.imgrid.n1 img { max-height: 560px; object-fit: contain; background: var(--surface-2); }
/* Лента: публикации идут одна за другой, разделены линией */
.shell:not(.wide) .main .stack:has(> .post) { gap: 0; }

/* ---- Композер ---- */
.composer { padding: 18px 20px 12px; display: grid; gap: var(--s3); min-width: 0; }
.composer-foot { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 0; padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.composer-foot > .btn { margin-left: 6px; }
.modal-body > .composer { padding: 0; }
.composer-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 1 1 0; min-width: 0; margin-left: 4px; }
/* «Чипы» параметров публикации: от чьего имени, кто увидит, комментарии */
.cpick {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: var(--control-h-sm); padding: 0 10px 0 8px;
  border: 1px solid var(--line); border-radius: var(--r-full); background: none; color: var(--muted);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; transition: background var(--t), color var(--t), border-color var(--t);
}
.cpick:hover:not(:disabled), .cpick[aria-expanded="true"] { color: var(--text); background: var(--surface-2); border-color: var(--line-strong); }
.cpick:disabled { opacity: .6; cursor: default; }
.cpick-ic { display: inline-flex; }
.cpick-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cpick-chev { flex: none; width: 0; height: 0; border: 4px solid transparent; border-top: 5px solid currentColor; border-bottom: 0; opacity: .7; }
.menu-head { padding: 6px 12px 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.menu-item[role="menuitemradio"] .mi-check { flex: none; display: inline-flex; color: var(--accent-strong); visibility: hidden; }
.menu-item[role="menuitemradio"][aria-checked="true"] .mi-check { visibility: visible; }
.menu-item[role="menuitemradio"][aria-checked="true"] { color: var(--text); }
.counter { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; padding: 0 6px; }
.counter.over { color: var(--danger); font-weight: 700; }
.attachments { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.attachment { position: relative; aspect-ratio: 1; border-radius: var(--r-md); overflow: hidden; background: var(--surface-2); animation: rise var(--t) var(--ease-out); }
.attachment img { width: 100%; height: 100%; object-fit: cover; }
.attachment .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; }
.attachment .progress { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); color: #fff; }

/* ---- Поле форматированного текста ----
   Разметка фиксированная (editor/engine.js): одна строка — один элемент с data-ln. */
.editor {
  position: relative; min-height: 64px; max-height: 60vh; overflow-y: auto; outline: none; font-size: var(--fs-lg); line-height: 1.55; padding: 6px 0;
  overflow-wrap: anywhere; white-space: pre-wrap; word-break: normal; caret-color: var(--accent);
}
.editor.small { font-size: var(--fs-md); min-height: 40px; }
.editor.is-empty::before { content: attr(data-placeholder); position: absolute; color: var(--muted); pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.editor > p, .editor li, .editor h2, .editor h3, .editor blockquote, .editor pre { margin: 0; }
.editor > :is(h2, h3, ul, ol) { margin-top: .35em; }
.editor > :first-child { margin-top: 0; }
.editor h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.4em; letter-spacing: -.01em; line-height: 1.25; }
.editor h3 { font-size: 1.12em; font-weight: 650; }
.editor blockquote { padding-left: 16px; border-left: 2px solid var(--accent); color: var(--text-2); font-family: var(--font-display); }
.editor pre { padding: 0 12px; background: var(--surface-2); font-family: var(--font-mono); font-size: .86em; line-height: 1.6; white-space: pre-wrap; }
.editor pre:not(pre + pre) { padding-top: 8px; border-top-left-radius: var(--r-md); border-top-right-radius: var(--r-md); margin-top: .35em; }
.editor pre:not(:has(+ pre)) { padding-bottom: 8px; border-bottom-left-radius: var(--r-md); border-bottom-right-radius: var(--r-md); margin-bottom: .35em; }
.editor ul, .editor ol { margin: 0; padding-left: 1.5em; }
.editor li::marker { color: var(--muted); }
.editor code { font-family: var(--font-mono); font-size: .86em; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.editor a { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
.editor [data-spoiler] { background: repeating-linear-gradient(-45deg, var(--surface-3) 0 4px, var(--surface-2) 4px 8px); border-radius: 4px; }
.editor-box { display: grid; gap: 8px; background: var(--surface-2); border-radius: var(--r-md); padding: 6px 12px 10px; box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--t-fast), background var(--t-fast); }
.editor-box:focus-within { background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.editor-box .editor-tools { margin: 0 -6px; }

/* Панель форматирования: группы значков, разделённые тонкими линиями */
.editor-tools { display: grid; gap: 6px; }
.ed-bar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; animation: rise var(--t) var(--ease-out); }
.ed-group { display: flex; align-items: center; gap: 1px; }
.ed-group + .ed-group { padding-left: 4px; margin-left: 3px; border-left: 1px solid var(--line); }
.ed-group.end { margin-left: auto; border-left: 0; }
.ed-btn {
  position: relative; width: 32px; height: 32px; border-radius: var(--r-sm); border: 0; background: none; color: var(--text-2);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; transition: background var(--t-fast), color var(--t-fast);
}
.ed-btn:hover { background: var(--surface-3); color: var(--text); }
.ed-btn[aria-pressed="true"], .ed-btn[aria-expanded="true"] { background: var(--text); color: var(--surface); }
.ed-btn[disabled] { opacity: .32; pointer-events: none; }
.ed-btn.i span { font-style: italic; font-family: var(--font-display); font-weight: 400; font-size: 16px; }
.ed-btn.u span { text-decoration: underline; text-underline-offset: 3px; }
.ed-btn.s span { text-decoration: line-through; }
.ed-btn.ed-style span { font-family: var(--font-display); font-weight: 400; font-size: 15px; }
.ed-btn.ed-style.has-style::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 6px; height: 2px; border-radius: 2px; background: var(--sw); }
.ed-pop { display: grid; gap: 10px; padding: 4px; }
.ed-pop-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ed-swatch { width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0; background: var(--sw); box-shadow: 0 0 0 1px rgba(0,0,0,.1) inset; transition: transform var(--t-fast) var(--ease); }
.ed-swatch:hover { transform: scale(1.12); }
.ed-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sw); }
.ed-swatch.none { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.ed-font { height: 32px; padding: 0 12px; border-radius: var(--r-full); border: 1px solid var(--line-strong); background: none; color: var(--text); font-size: 15px; transition: border-color var(--t-fast), background var(--t-fast); }
.ed-font:hover { border-color: var(--text); }
.ed-font[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.ed-font.font-poster { font-family: "Bebas Neue", var(--font); font-size: 17px; letter-spacing: .03em; }
.ed-font.font-hand { font-family: Caveat, cursive; font-size: 19px; }
.ed-font.font-elegant { font-family: "Playfair Display", Georgia, serif; font-style: italic; }

/* ---- Комментарии: нить слева, без пузырей ---- */
.comments { display: grid; gap: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line); }
.comment { display: grid; grid-template-columns: auto 1fr; gap: 10px; animation: rise var(--t) var(--ease-out); }
.comment .bubble { min-width: 0; display: grid; gap: 2px; }
.comment .c-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: var(--fs-sm); }
.comment .c-text { font-size: var(--fs-md); }
.comment .c-actions { display: flex; align-items: center; gap: 2px; margin-left: -8px; }
.comment .c-actions .act { height: 28px; font-size: var(--fs-xs); padding: 0 8px; }
.comment.deleted .c-text, .comment.hidden .c-text { color: var(--muted); font-style: italic; }
.comment.pending { opacity: .72; }
.replies { display: grid; gap: var(--s3); margin-top: var(--s2); padding-left: 4px; border-left: 1px solid var(--line-strong); }
.replies .comment { padding-left: 12px; }
.reply-to { color: var(--accent-strong); font-weight: 600; }
.comment-form { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: end; }
.comment-form .editor, .comment-edit .editor { background: var(--surface-2); border-radius: var(--r-md); padding: 9px 12px; min-height: var(--control-h); max-height: 200px; font-size: var(--fs-md); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow var(--t-fast), background var(--t-fast); }
.comment-form .editor:focus, .comment-edit .editor:focus { background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.comment-form .editor.is-empty::before, .comment-edit .editor.is-empty::before { left: 12px; }
.comment-form .iconbtn:not([disabled]) { color: var(--accent); }

/* ---- Списки людей/сообществ ---- */
.list { display: grid; }
.list-row { display: flex; align-items: center; gap: var(--s3); padding: 12px var(--s5); border-top: 1px solid var(--line); min-width: 0; }
.list-row:first-child { border-top: 0; }
.list-row .text { min-width: 0; flex: 1; }
.list-row .text .sub { color: var(--muted); font-size: var(--fs-sm); }
a.list-row { transition: background var(--t-fast); }
a.list-row:hover { background: var(--surface-2); color: inherit; }

/* ---- Правая колонка: разделы с подписью капителью, без карточек ---- */
.aside .card { background: transparent; border: 0; border-radius: 0; }
.aside .card-head { padding: 0 2px 6px; }
.aside .card-head h3 { font-size: 11px; font-weight: 600; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--muted); }
.aside .list-row { padding: 8px 6px; border-top: 0; border-radius: var(--r-md); }
.aside a.list-row:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.aside .searchbox .input { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.legal-links { line-height: 1.8; }
.legal-links a:hover { color: var(--text); text-decoration: underline; }

/* ---- Шапка профиля/сообщества ---- */
.hero { overflow: hidden; }
/* Обложка (components/cover.js): одна пропорция для шапки профиля, сообщества и редактора профиля */
.cover {
  position: relative; width: 100%; aspect-ratio: var(--cover-aspect); background-color: var(--surface-3);
  background-image: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 16%, var(--surface-2)), var(--surface-3));
  background-size: cover; background-position: center;
}
.cover-btn {
  position: absolute; right: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 0; border-radius: var(--r-full); background: rgba(20, 16, 12, .55); color: #fff; font-size: var(--fs-xs); font-weight: 600;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background var(--t-fast);
}
.cover-btn:hover { background: rgba(20, 16, 12, .72); }
.hero-body { padding: 0 var(--s5) var(--s5); display: grid; gap: var(--s3); }
/* Аватар заходит на обложку: поднимаем строку над обложкой (у обложки своя кнопка с position). */
.hero-top { position: relative; z-index: 1; display: flex; align-items: flex-end; gap: var(--s3); margin-top: -48px; }
.hero-top { pointer-events: none; } /* пустая часть строки не перекрывает кнопку «Обложка» */
.hero-top > * { pointer-events: auto; }
.hero-top .avatar { border: 4px solid var(--surface); }
.hero-top .actions { margin-left: auto; display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: flex-end; }
.hero h1 { font-family: var(--font-display); font-weight: 400; font-size: 30px; letter-spacing: -.01em; line-height: 1.15; display: flex; align-items: center; flex-wrap: wrap; }
.hero .handle { color: var(--muted); font-weight: 500; }
.stats-row { display: flex; gap: var(--s5); flex-wrap: wrap; }
.stats-row a, .stats-row span { color: var(--muted); }
.stats-row b { color: var(--text); font-weight: 650; margin-right: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 759px) { .hero-top { margin-top: -40px; } .hero-top .avatar { --size: 88px; } }

/* ---- Аналитика ---- */
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); }
.tile { padding: var(--s4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 4px; }
.tile .k { letter-spacing: .01em; }
.tile .k { font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.tile .v { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 400; letter-spacing: -.01em; font-variant-numeric: tabular-nums lining-nums; }
.tile .d { font-size: var(--fs-xs); font-weight: 700; }
.tile .d.up { color: var(--good); } .tile .d.down { color: var(--danger); }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: .12; }
.chart .hair { stroke: var(--line-strong); stroke-width: 1; }
.chart-tip { position: absolute; pointer-events: none; z-index: 2; min-width: 130px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); font-size: var(--fs-xs); }
.chart-tip .t { color: var(--muted); margin-bottom: 4px; }
.chart-tip .r { display: flex; align-items: center; gap: 6px; }
.chart-tip .r b { font-size: var(--fs-sm); color: var(--text); font-variant-numeric: tabular-nums; }
.chart-tip .key { width: 12px; height: 2px; border-radius: 2px; }
.legend { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }

/* ---- Таблицы ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-weight: 600; font-size: 11px; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; align-items: center; gap: var(--s2); justify-content: flex-end; padding: var(--s3) var(--s4); }

/* ---- Просмотр фото и кадрирование ---- */
.lightbox { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(0,0,0,.9); display: grid; place-items: center; animation: fade var(--t); }
.lightbox img { max-width: 94vw; max-height: 90vh; object-fit: contain; border-radius: 6px; }
.lightbox .close { position: absolute; top: 16px; right: 16px; color: #fff; background: rgba(255,255,255,.12); }
.cropper { position: relative; width: 100%; overflow: hidden; border-radius: var(--r-md); background: #111; touch-action: none; cursor: grab; user-select: none; }
.cropper img { position: absolute; top: 0; left: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.cropper .frame { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.85); }
.cropper.round .frame { border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.45), inset 0 0 0 2px rgba(255,255,255,.85); }
input[type="range"] { width: 100%; accent-color: var(--accent); }

/* ---- Поиск ---- */
.searchbox { position: relative; }
.searchbox .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.searchbox .input { padding-left: 42px; border-radius: var(--r-full); }

/* ---- Прочее ---- */
.divider { height: 1px; background: var(--line); }
.kbd { font-family: var(--font-mono); font-size: 12px; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.qr { word-break: break-all; font-family: var(--font-mono); font-size: 13px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); }
.dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .6; display: inline-block; }

/* ============================ Настройки ============================ */
/* Двухколоночный экран: список разделов + содержимое. На телефоне — список → раздел. */
.settings-page { width: 100%; max-width: calc(var(--side-w) + 20px + var(--content-w)); display: grid; gap: var(--s4); }
.settings { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-nav {
  position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; scrollbar-width: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; padding: 4px 18px 8px 0;
  border-right: 1px solid var(--line);
}
.settings-me { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md); color: var(--text); }
.settings-me:hover { background: var(--surface-2); color: var(--text); }
.settings-me .text { flex: 1; min-width: 0; }
.settings-me .sub { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-me > .icon { color: var(--muted); }
.settings-group-title { padding: 18px 12px 6px; font-size: 11px; font-weight: 600; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--muted); }
.settings-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.settings-link { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--r-md); color: var(--text-2); transition: background var(--t-fast), color var(--t-fast); }
.settings-link:hover { background: var(--surface-2); color: var(--text); }
.settings-link[aria-current="page"] { color: var(--text); }
.settings-link[aria-current="page"] .text b { font-weight: 650; }
.settings-link[aria-current="page"]::before { content: ""; position: absolute; left: -2px; top: 50%; width: 6px; height: 6px; background: var(--accent); transform: translateY(-50%) rotate(45deg); border-radius: 1px; }
.settings-link .text { flex: 1; min-width: 0; display: grid; }
.settings-link .text b { font-weight: 550; line-height: 1.3; }
.settings-link .sub { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-link .chev { color: var(--muted); opacity: 0; transition: opacity var(--t-fast); }
.settings-link:hover .chev, .settings-link[aria-current="page"] .chev { opacity: 1; }
/* Цветные плитки иконок — семантические токены, по одному тону на раздел. */
[data-tone] { --tone: var(--text-2); }
[data-tone="accent"] { --tone: var(--accent); }
[data-tone="info"] { --tone: var(--series-1); }
[data-tone="good"] { --tone: var(--good); }
[data-tone="like"] { --tone: var(--like); }
[data-tone="warn"] { --tone: var(--warning); }
[data-tone="danger"] { --tone: var(--danger); }
/* Иконки разделов — спокойные, без цветных плашек; цвет остаётся только у опасных действий. */
.sl-ic, .srow-ic {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2);
}
.sl-ic { width: 22px; background: none; color: inherit; }
[data-tone="danger"].srow-ic, .srow.danger .srow-ic { background: var(--danger-soft); color: var(--danger); }
.settings-body { display: grid; gap: 20px; min-width: 0; max-width: var(--content-w); grid-template-columns: minmax(0, 1fr); }
.settings-head { display: flex; align-items: center; gap: var(--s3); min-height: 40px; }
.settings-head h1 { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-2xl); letter-spacing: -.01em; line-height: 1.1; }
.settings-head .back { display: none; width: 38px; height: 38px; margin-left: -8px; border-radius: var(--r-full); place-items: center; background: none; border: 0; color: var(--text); }

/* Группа настроек: подпись над карточкой, строки внутри. */
.sgroup { display: grid; gap: 8px; scroll-margin-top: 84px; }
.sgroup-title { padding: 0 4px; font-size: 11px; font-weight: 600; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--muted); }
.sgroup-card { overflow: hidden; }
.sgroup-pad { padding: var(--s4); }
.sgroup-foot { margin-top: -12px; padding: 0 4px; font-size: var(--fs-xs); color: var(--muted); }
.srow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 16px; border-top: 1px solid var(--line); min-width: 0; }
.srow:first-child { border-top: 0; }
.srow > .text { flex: 1 1 220px; min-width: 0; display: grid; gap: 2px; }
.srow > .text b { font-weight: 600; }
.srow .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; font-size: var(--fs-sm); color: var(--muted); }
.srow-end { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.srow.clickable { cursor: pointer; transition: background var(--t-fast); }
.srow.clickable:hover { background: var(--surface-2); }
.srow.danger > .text b { color: var(--danger); }
.srow-actions { justify-content: flex-end; }
.srow-foot { padding: 0 16px 14px; font-size: var(--fs-xs); color: var(--muted); }
.sgroup-list .list-row { padding: 14px 16px; }
.btn.danger-text { color: var(--danger); }
.srow .select.sm { min-width: var(--field-w-sm); }

/* Профиль: обложка + аватар как в шапке профиля — результат виден сразу. */
.pe { overflow: hidden; }
.pe { max-width: var(--main-w); }
/* На телефоне — во всю ширину, как шапка профиля: обложка совпадает и по размеру */
@media (max-width: 759px) { .pe { margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; } }
.pe .hero-body { padding-top: 0; }
.pe-avatar { position: relative; padding: 0; border: 0; background: none; border-radius: 50%; }
.pe-cam {
  position: absolute; right: 2px; bottom: 2px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--btn-bg); color: var(--btn-fg); border: 3px solid var(--surface); transition: transform var(--t-fast);
}
.pe-avatar:hover .pe-cam { transform: scale(1.08); }
.pe-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); flex-wrap: wrap; }
.pe-history { margin-right: auto; }
.pe-history summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); padding: 6px 0; }
.pe-history summary:hover { color: var(--text); }
.pe-history[open] { flex-basis: 100%; order: 5; }
.pe-hlist { display: grid; gap: 4px; margin-top: 6px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); }
.pe-hrow { display: flex; justify-content: space-between; gap: 12px; font-size: var(--fs-sm); }

/* Бейдж у имени: предпросмотр + выбор одного. */
.badge-preview { display: grid; gap: 8px; padding: 14px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.badge-preview .sub { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.badge-preview-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.badge-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.badge-opt {
  display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 12px; text-align: left; color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.badge-opt:hover { border-color: var(--line-strong); }
.badge-opt[aria-busy="true"] { opacity: .6; }
.badge-opt .mark { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); }
.badge-opt .mark .ubadge { margin: 0; }
.badge-opt .text { flex: 1; min-width: 0; display: grid; }
.badge-opt .text b { font-size: var(--fs-sm); }
.badge-opt .sub { font-size: var(--fs-xs); color: var(--muted); }
.badge-opt .check {
  width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 1.5px solid var(--line-strong); color: transparent; transition: all var(--t-fast);
}
.badge-opt[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.badge-opt[aria-checked="true"] .check { background: var(--accent); border-color: var(--accent); color: var(--inverse); }

/* Оформление: миниатюры тем. Цвета миниатюр фиксированы — это образцы, а не текущая тема. */
.theme-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.theme-opt { display: grid; gap: 10px; padding: 0; border: 0; background: none; text-align: left; color: var(--text); }
.theme-mock {
  display: flex; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--r-md); border: 1px solid var(--line);
  outline: 2px solid transparent; outline-offset: 3px; transition: outline-color var(--t-fast);
}
.theme-opt:hover .theme-mock { outline-color: var(--line-strong); }
.theme-opt[aria-checked="true"] .theme-mock { outline-color: var(--accent); }
.theme-mock .half { flex: 1; overflow: hidden; display: flex; }
.theme-mock .half .mock { flex: none; width: 200%; }
.theme-mock .half.dark .mock { margin-left: -100%; }
.mock { flex: 1; display: flex; gap: 6%; padding: 9%; background: var(--m-bg); }
.theme-mock.light, .theme-mock .light { --m-bg: #f4f0e8; --m-surface: #fffdf8; --m-line: #e2d9cb; --m-accent: #17684f; }
.theme-mock.dark, .theme-mock .dark { --m-bg: #12100e; --m-surface: #1f1b17; --m-line: #3d362f; --m-accent: #6cc7a3; }
.theme-mock.oled { --m-bg: #000000; --m-surface: #000000; --m-line: #332d27; --m-accent: #6cc7a3; }
.theme-mock.oled .mock-nav, .theme-mock.oled .mock-post { box-shadow: inset 0 0 0 1px #2a2520; }
.theme-desc { display: block; font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }
.mock-nav { width: 22%; border-radius: 6px; background: var(--m-surface); }
.mock-main { flex: 1; display: grid; gap: 8%; align-content: start; }
.mock-post { display: grid; gap: 5px; padding: 9%; border-radius: 6px; background: var(--m-surface); }
.mock-post i { width: 12px; height: 12px; border-radius: 50%; background: var(--m-accent); }
.mock-post b { height: 4px; width: 90%; border-radius: 2px; background: var(--m-line); }
.mock-post b.s { width: 58%; }
.theme-label { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 600; }
.theme-label .radio { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid var(--line-strong); transition: all var(--t-fast); }
.theme-opt[aria-checked="true"] .radio { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }

@media (max-width: 759px) {
  .settings { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .settings[data-view="list"] .settings-body { display: none; }
  .settings[data-view="detail"] .settings-nav { display: none; }
  .settings-page:has(.settings[data-view="detail"]) > .page-head { display: none; }
  .settings-nav { position: static; padding: 0; border-right: 0; max-height: none; }
  .settings-link[aria-current="page"]::before { display: none; }
  .settings-link { padding: 11px 10px; }
  .settings-link .chev { opacity: 1; }
  .settings[data-view="list"] .settings-link[aria-current="page"] { background: none; }
  .settings-head { padding-top: var(--s2); }
  .settings-head h1 { font-size: var(--fs-2xl); }
  .settings-head .back { display: grid; }
  .settings-body { gap: 16px; }
  .sgroup-foot { margin-top: -8px; }
  .srow { padding: 13px 14px; gap: 10px 12px; }
  .srow > .text { flex-basis: 0; }
  .srow:has(.select) .srow-end { width: 100%; padding-left: 46px; }
  .srow:has(.select) .select { width: 100%; }
  .pe-history { flex-basis: 100%; }
  .theme-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .theme-label { font-size: var(--fs-xs); gap: 6px; }
}

/* ======================= Статистика профиля ======================= */
/* Не «панель аналитики», а короткий рассказ: итог фразой → показатели → график → детали. */
.ps { container-type: inline-size; display: grid; gap: 14px; }
.ps-top { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.ps-note { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.ps-note:hover { color: var(--accent-strong); }
.ps-body-wrap { transition: opacity var(--t); }
.ps-body-wrap.loading { opacity: .55; pointer-events: none; }
.ps-body { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.ps-dim { color: var(--muted); }

.ps-hero {
  position: relative; display: grid; gap: 10px; padding: 24px 24px 22px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-xl);
  background:
    radial-gradient(110% 120% at 100% 0%, color-mix(in srgb, var(--series-1) 11%, transparent), transparent 55%),
    var(--surface);
}
.ps-eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ps-headline { font-family: var(--font-display); font-weight: 400; font-size: 32px; line-height: 1.15; letter-spacing: -.01em; max-width: 22ch; text-wrap: balance; }
.ps-headline em { font-style: normal; color: var(--series-1); white-space: nowrap; }
.ps-heroline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: var(--fs-sm); color: var(--text-2); }
.ps-delta {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--text-2);
}
.ps-delta.up { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.ps-delta.down { background: var(--danger-soft); color: var(--danger); }
.ps-delta i { font-style: normal; }

.ps-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ps-metric {
  --c: var(--accent); position: relative; display: grid; gap: 4px; justify-items: start; min-width: 0; padding: 14px 14px 10px;
  text-align: left; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.ps-metric:hover { border-color: var(--line-strong); }
.ps-metric:active { transform: scale(.985); }
.ps-metric[aria-selected="true"] { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 16%, transparent); }
.ps-metric .k { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); }
.ps-key { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.ps-metric .v { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ps-spark { width: 100%; height: 30px; margin-top: 4px; overflow: visible; }
.ps-spark path { stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.ps-metric[aria-selected="false"] .ps-spark path { opacity: .45; }

.ps-card { display: grid; gap: 12px; padding: 18px 18px 14px; }
.ps-card-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.ps-card-head h3 { font-size: var(--fs-lg); }
.ps-card-head .btn.sm { --h: 30px; margin: -4px -6px -4px 0; }
.ps-legend { display: flex; flex-wrap: wrap; margin-top: -6px; gap: 4px 14px; font-size: var(--fs-xs); color: var(--muted); }
.ps-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ps-legend i.solid { width: 14px; height: 3px; border-radius: 2px; }
.ps-legend i.dash { width: 14px; border-top: 2px dashed var(--muted); opacity: .8; }
.ps-plot { position: relative; }
.ps-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.ps-grid { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 2 4; }
.ps-grid.zero { stroke: var(--line-strong); stroke-dasharray: none; }
.ps-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.ps-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ps-prev { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .7; }
.ps-hair { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.ps-tip {
  position: absolute; top: 0; transform: translateX(-50%); z-index: 2; pointer-events: none; display: grid; gap: 2px;
  min-width: 112px; padding: 8px 12px; border-radius: var(--r-md); background: var(--btn-bg); color: var(--btn-fg);
  font-size: var(--fs-xs); box-shadow: var(--shadow-pop); white-space: nowrap;
}
.ps-tip .d, .ps-tip .p { opacity: .7; }
.ps-tip .v { display: flex; align-items: center; gap: 6px; }
.ps-tip .v b { font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.ps-tip .v i { width: 8px; height: 8px; border-radius: 50%; }

.ps-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ps-small { align-content: start; }
.ps-small .ps-card-head { color: var(--muted); }
.ps-small .ps-card-head h3 { font-size: var(--fs-md); color: var(--text); }
.ps-big { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ps-big b { font-family: var(--font-display); font-weight: 400; font-size: 34px; line-height: 1; }
.ps-big span { color: var(--muted); }
.ps-balance { display: flex; gap: 3px; height: 10px; }
.ps-balance span { border-radius: var(--r-full); }
.ps-balance .in { background: var(--repost); }
.ps-balance .out { flex: 1; background: color-mix(in srgb, var(--danger) 55%, transparent); }
.ps-balance-legend { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); color: var(--text-2); }
.ps-balance-legend i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; }
.ps-balance-legend i.in { background: var(--repost); }
.ps-balance-legend i.out { background: color-mix(in srgb, var(--danger) 55%, transparent); }
.ps-small > p { font-size: var(--fs-sm); }
.ps-rhythm { display: flex; align-items: center; gap: 14px; }
.ps-ringbox { position: relative; width: 64px; height: 64px; flex: none; }
.ps-ring { width: 64px; height: 64px; }
.ps-ring circle { fill: none; stroke-width: 7; }
.ps-ring .track { stroke: var(--surface-3); }
.ps-ring .fill { stroke: var(--accent); stroke-linecap: round; }
.ps-ringbox > b { position: absolute; inset: 0; display: grid; place-items: center; font-size: var(--fs-lg); font-weight: 800; }
.ps-rhythm .ps-dim { font-size: var(--fs-sm); }
.ps-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.ps-facts > div { display: grid; gap: 2px; }
.ps-facts span { font-size: var(--fs-xs); }
.stats-page { width: 100%; max-width: var(--content-w); }

/* Календарь публикаций (components/postCalendar.js) */
.pc-views button { padding: 6px 12px; }
.pc-nav { display: flex; align-items: center; gap: 4px; margin-top: -4px; }
.pc-title { font-size: var(--fs-md); font-weight: 700; min-width: 0; text-align: center; padding: 0 4px; }
.pc-next svg { transform: scaleX(-1); }
.iconbtn:disabled { opacity: .35; pointer-events: none; }
.pc-summary { font-size: var(--fs-sm); margin-top: -6px; min-height: 1.4em; }
.pc-body { transition: opacity var(--t); min-height: 120px; }
.pc-body.loading { opacity: .55; }
.pc-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.pc-wd { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: center; padding-bottom: 2px; }
.pc-cell {
  --heat: 0; position: relative; aspect-ratio: 1 / .82; min-height: 40px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--series-1) calc(var(--heat) * 34%), var(--surface)); color: var(--text);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 6px 7px; text-align: left;
  font-variant-numeric: tabular-nums; transition: border-color var(--t-fast), transform var(--t-fast);
}
.pc-cell:hover:not(:disabled) { border-color: var(--line-strong); }
.pc-cell:active:not(:disabled) { transform: scale(.97); }
.pc-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pc-cell.out { opacity: .45; }
.pc-cell:disabled { opacity: .3; cursor: default; }
.pc-cell.today { border-color: var(--series-1); box-shadow: inset 0 0 0 1px var(--series-1); }
.pc-num { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.pc-cell.has .pc-num { color: var(--text); }
.pc-count { align-self: flex-end; min-width: 20px; padding: 0 6px; border-radius: var(--r-full); background: var(--surface); font-size: 12px; line-height: 20px; text-align: center; box-shadow: 0 0 0 1px var(--line); }
.pc-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 8px; }
.pc-sday { display: grid; justify-items: center; gap: 1px; padding: 6px 2px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--text-2); font-variant-numeric: tabular-nums; }
.pc-sday span { font-size: 11px; color: var(--muted); }
.pc-sday i { font-style: normal; font-size: 12px; color: var(--muted); }
.pc-sday.has { background: color-mix(in srgb, var(--series-1) 12%, var(--surface)); }
.pc-sday.has i { color: var(--series-1); font-weight: 700; }
.pc-sday.today { border-color: var(--series-1); }
.pc-sday:disabled { opacity: .35; }
.pc-list { display: grid; }
.pc-dayhead { margin: 12px 0 2px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pc-dayhead:first-child { margin-top: 0; }
.pc-dayhead button { border: 0; background: none; padding: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.pc-dayhead button:hover { color: var(--accent-strong); }
.pc-post { display: flex; gap: 12px; align-items: flex-start; padding: 10px 4px; border-top: 1px solid var(--line); color: var(--text); min-width: 0; }
.pc-dayhead + .pc-post, .pc-list > .pc-post:first-child { border-top: 0; }
.pc-post:hover { background: var(--surface-2); border-radius: var(--r-sm); }
.pc-time { flex: none; width: 44px; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.pc-post-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.pc-text { font-size: var(--fs-sm); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.pc-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pc-tags:empty { display: none; }
.pc-tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--r-full); background: var(--surface-2); font-size: 11.5px; font-weight: 600; color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-tag.bad { background: var(--danger-soft); color: var(--danger); }
.pc-tag .icon.xs { width: 12px; height: 12px; }
.pc-nums { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.pc-nums span { display: inline-flex; align-items: center; gap: 4px; }
.pc-nums .icon.xs { width: 13px; height: 13px; }
.pc-thumb { flex: none; width: 56px; height: 56px; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-2); }
.pc-empty { padding: 24px 0; text-align: center; color: var(--muted); font-size: var(--fs-sm); }
.pc-more { justify-self: center; margin-top: 8px; }
.pc-body > .pc-more { display: flex; margin: 8px auto 0; }
.pc-body > .pc-more[hidden] { display: none; }

@container (max-width: 640px) {
  .ps-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-pair { grid-template-columns: minmax(0, 1fr); }
  .ps-hero { padding: 20px 18px 18px; border-radius: var(--r-lg); }
  .ps-headline { font-size: 26px; }
}
@container (max-width: 520px) {
  .pc .ps-card-head .spacer { display: none; }
  .pc-views { width: 100%; }
  .pc-views button { flex: 1; }
  .pc-cell { aspect-ratio: auto; min-height: 44px; padding: 4px 5px; }
  .pc-count { min-width: 16px; padding: 0 4px; font-size: 11px; line-height: 16px; }
  .pc-thumb { width: 44px; height: 44px; }
}
@container (max-width: 400px) {
  .ps-periods { width: 100%; }
  .ps-periods button { flex: 1; padding: 7px 8px; }
  .ps-metric .v { font-size: var(--fs-xl); }
  .ps-card { padding: 16px 14px 12px; }
}

/* ============================ Поддержка ============================ */
.support-page { width: 100%; max-width: var(--content-w); display: grid; gap: var(--s4); }
.support-lead { color: var(--muted); font-size: var(--fs-sm); margin-top: -6px; padding: 0 4px; }
.ticket-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); color: var(--text); min-width: 0; }
.ticket-row:first-child { border-top: 0; }
.ticket-row:hover { background: var(--surface-2); color: var(--text); }
.ticket-row > .text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ticket-row > .icon { color: var(--muted); }
.ticket-row .sub { font-size: var(--fs-sm); color: var(--muted); }
.ticket-row.closed b { color: var(--text-2); font-weight: 600; }
.ticket-row.unread b { font-weight: 800; }
.ticket-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: var(--fs-xs); color: var(--muted); }
.ticket-meta span + span::before { content: "·"; margin-right: 10px; opacity: .7; }
.dot-new { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--like); }
.cat-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.cat-opt { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); text-align: left; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.cat-opt:hover { border-color: var(--line-strong); }
.cat-opt[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--text); }
.cat-opt[aria-checked="true"] .icon { color: var(--accent-strong); }

/* Переписка */
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 40px); max-height: 860px; min-height: 480px; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.chat-head .text { flex: 1; min-width: 0; }
.chat-head h1 { font-size: var(--fs-lg); font-weight: 700; }
.chat-head .back, .sup-back { width: 38px; height: 38px; flex: none; border-radius: var(--r-full); display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; background: var(--bg); }
.chat-log { display: grid; gap: 4px; }
.chat-day { justify-self: center; margin: 10px 0 6px; padding: 3px 10px; border-radius: var(--r-full); background: var(--surface-2); color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.chat-sys { justify-self: center; display: flex; gap: 8px; align-items: baseline; max-width: 90%; margin: 6px 0; font-size: var(--fs-xs); color: var(--muted); text-align: center; }
.chat-sys time { opacity: .7; }
.chat-msg { display: flex; gap: 8px; align-items: flex-end; max-width: min(78%, 560px); margin-top: 8px; }
.chat-msg.cont { margin-top: 0; }
.chat-msg.own { justify-self: end; flex-direction: row-reverse; }
.chat-ava { width: 36px; flex: none; }
.chat-staff-ava { background: var(--accent-soft) !important; color: var(--accent-strong); }
.chat-col { display: grid; gap: 3px; min-width: 0; }
.chat-msg.own .chat-col { justify-items: end; }
.chat-who { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); padding: 0 12px; }
.chat-bubble { padding: 9px 13px 6px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.chat-msg.other .chat-bubble { border-bottom-left-radius: 6px; }
.chat-msg.own .chat-bubble { background: var(--btn-bg); color: var(--btn-fg); border-color: transparent; border-bottom-right-radius: 6px; }
.chat-msg.cont.other .chat-bubble { border-top-left-radius: 6px; }
.chat-msg.cont.own .chat-bubble { border-top-right-radius: 6px; }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.chat-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 2px; font-size: 11px; opacity: .6; }
.chat-hint { justify-self: center; margin-top: 12px; padding: 8px 14px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--text-2); font-size: var(--fs-sm); text-align: center; }
.chat-foot { position: relative; display: grid; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-closed { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--muted); }
.chat-compose { display: flex; align-items: flex-end; gap: 8px; }
.chat-input {
  flex: 1; min-height: var(--control-h); max-height: 220px; resize: none; padding: 10px 14px; border-radius: calc(var(--control-h) / 2); line-height: 1.4;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); outline: none;
}
.chat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.chat-send { --h: var(--control-h); width: var(--control-h); padding: 0; flex: none; border-radius: 14px; }
.chat-send .icon { stroke-width: 2.4; }
.chat-compose .iconbtn { width: var(--control-h); height: var(--control-h); flex: none; }

/* Админка: очередь + переписка + карточка пользователя */
.tab-count { margin-left: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--like); color: #fff; font-size: 11px; display: inline-grid; place-items: center; }
.tab-count:empty { display: none; }
.sup-layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); gap: 16px; align-items: start; }
.sup-queue { position: sticky; top: 20px; display: flex; flex-direction: column; max-height: calc(100vh - 40px); overflow: hidden; }
.sup-filters { display: grid; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); }
.sup-seg { display: flex; flex-wrap: wrap; border-radius: var(--r-md); }
.sup-seg button { flex: 1 1 auto; border-radius: 10px; padding: 6px 8px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.sup-count { font-size: 11px; font-weight: 800; color: var(--accent-strong); }
.sup-count:empty { display: none; }
.sup-search { min-height: var(--control-h); }
.sup-filters .select.sm { flex: 1; min-width: 0; }
.sup-list { overflow-y: auto; }
.sup-row { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-top: 1px solid var(--line); color: var(--text); min-width: 0; }
.sup-row:first-child { border-top: 0; }
.sup-row:hover { background: var(--surface-2); color: var(--text); }
.sup-row.on { background: var(--accent-soft); }
.sup-row .text { flex: 1; min-width: 0; display: grid; gap: 3px; }
.sup-row .sub { font-size: var(--fs-sm); color: var(--muted); }
.sup-row.unread b { font-weight: 800; }
.sup-row .dot-new { position: absolute; top: 16px; right: 12px; }
.sup-row-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.sup-row-top b { flex: 1; }
.sup-row-top time { flex: none; font-size: var(--fs-xs); color: var(--muted); }
.sup-row.unread .sup-row-top time { margin-right: 14px; }
.sup-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: var(--fs-xs); color: var(--muted); min-width: 0; }
.sup-pane { min-height: 560px; display: flex; flex-direction: column; overflow: hidden; }
.sup-pane > .state { margin: auto; }
.sup-loading { padding: 12px; }
.sup-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sup-head .text { flex: 1 1 260px; min-width: 0; display: grid; gap: 4px; }
.sup-head h2 { font-size: var(--fs-lg); }
.sup-back { display: none; }
.sup-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sup-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 250px; min-height: 0; }
.sup-chat { display: flex; flex-direction: column; min-width: 0; height: calc(100vh - 150px); max-height: 820px; min-height: 480px; }
.sup-foot-row { display: flex; align-items: center; gap: 8px; }
.sup-foot-row .hint { flex: 1; }
.sup-info { border-left: 1px solid var(--line); padding: 16px; display: grid; gap: 14px; align-content: start; font-size: var(--fs-sm); overflow-y: auto; }
.sup-info .text { min-width: 0; }
.sup-info .sub { color: var(--muted); font-size: var(--fs-xs); }
.sup-facts { display: grid; gap: 4px; color: var(--muted); }
.sup-facts b { color: var(--text); font-weight: 600; }
.sup-other { display: grid; gap: 2px; }
.sup-other-title { font-size: var(--fs-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.sup-other a { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin: 0 -8px; border-radius: var(--r-sm); min-width: 0; }
.sup-other a:hover { background: var(--surface-2); }
.sup-other a span:first-child { flex: 1; min-width: 0; }

/* Быстрые ответы: панель над полем ввода */
.qr-panel {
  position: absolute; left: 12px; right: 12px; bottom: calc(100% - 4px); z-index: 5; display: grid; gap: 8px; padding: 10px;
  max-height: min(420px, 60vh); background: var(--surface); border-radius: var(--pop-r); box-shadow: var(--shadow-pop);
  grid-template-rows: auto auto minmax(0, 1fr) auto; animation: pop var(--t) var(--ease);
}
.qr-top { display: flex; gap: 6px; }
.qr-top .input { min-height: var(--control-h); }
.qr-cats { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.qr-cats .chip { flex: none; height: 28px; }
.qr-list { overflow-y: auto; display: grid; gap: 2px; align-content: start; }
.qr-item { display: grid; gap: 2px; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none; text-align: left; color: var(--text); }
.qr-item:hover, .qr-item:focus-visible { background: var(--surface-2); }
.qr-title { display: flex; align-items: baseline; gap: 8px; }
.qr-title b { font-size: var(--fs-sm); }
.qr-cat { font-size: var(--fs-xs); color: var(--muted); }
.qr-body { font-size: var(--fs-xs); color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qr-manage { font-size: var(--fs-xs); font-weight: 600; color: var(--accent-strong); justify-self: end; }

/* Раздел «Быстрые ответы» */
.tpl-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-top: 1px solid var(--line); }
.tpl-row:first-child { border-top: 0; }
.tpl-row .text { flex: 1; min-width: 0; display: grid; gap: 4px; }
.tpl-body { white-space: pre-wrap; color: var(--text-2); font-size: var(--fs-sm); }
.tpl-row .sub { font-size: var(--fs-xs); color: var(--muted); }

/* Карточка пользователя в админке: редактор аккаунта */
.acc-editor { gap: var(--s3); background: var(--surface-2); border-color: var(--line); }
.acc-editor h3 { font-size: var(--fs-md); }
.acc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); align-items: start; }
.acc-check { gap: 8px; align-self: end; min-height: var(--control-h); cursor: pointer; font-weight: 600; font-size: var(--fs-sm); }
.acc-editor .input, .acc-editor .textarea { background: var(--surface); }

@media (max-width: 1339px) {
  .sup-body { grid-template-columns: minmax(0, 1fr); }
  .sup-info { border-left: 0; border-top: 1px solid var(--line); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}
@media (max-width: 1179px) {
}
@media (max-width: 959px) {
  .sup-layout { grid-template-columns: minmax(0, 1fr); }
  .sup-layout[data-view="list"] .sup-pane { display: none; }
  .sup-layout[data-view="detail"] .sup-queue { display: none; }
  .sup-queue { position: static; max-height: none; }
  .sup-back { display: grid; }
}
@media (max-width: 759px) {
  .chat-card { height: calc(100vh - 150px - env(safe-area-inset-bottom)); max-height: none; min-height: 380px; border-radius: var(--r-md); }
  .chat-msg { max-width: 88%; }
  .chat-scroll { padding: 12px 10px; }
  .chat-head, .chat-foot { padding: 10px 12px; }
  .sup-chat { height: calc(100vh - 230px); }
  .acc-grid { grid-template-columns: minmax(0, 1fr); }
  .sup-foot-row .hint { display: none; }
}

/* ======================= Адаптивность: общие правила ======================= */
.theme-label { align-items: flex-start; }
.theme-label .radio { margin-top: 2px; }
.table-wrap { -webkit-overflow-scrolling: touch; }
.filters > * { min-width: 0; }
.filters .input { width: var(--field-w); }
.filters .input.short { width: var(--field-w-sm); }
.filters .select { width: var(--field-w-sm); }
.input.tiny-field { width: var(--field-w-xs); }
.input.short-field { width: var(--field-w-sm); }
.select.inline { width: var(--field-w-sm); }
img, video { height: auto; }
.imgrid img { height: 100%; }

/* Телефон: лист во весь экран, поля по краям — 16px */
@media (max-width: 759px) {
  .post { padding: 14px 16px 8px; }
  .post-actions { margin: 0 -8px; justify-content: space-between; }
  .post-actions .act { padding: 0 8px; }
  .composer { padding: 14px 16px 10px; }
  .card.pad { padding: var(--s4); }
  .card-head { padding: var(--s4) var(--s4) 0; }
  .card-body { padding: var(--s3) var(--s4) var(--s4); }
  .list-row { padding: 12px var(--s4); }
  .shell:not(.wide) .main > .banner { margin: 10px 16px 0; }
  .page-head { min-height: 0; padding: 16px 16px 10px; }
  .shell.wide .main > .page-head, .settings-page > .page-head { padding: 16px 0 6px; }
  .page-head h1 { font-size: var(--fs-xl); }
  .sheet-head { top: calc(54px + env(safe-area-inset-top)); }
  .sheet-head .page-head { display: none; } /* на телефоне название — в верхней панели */
  .sheet-head .tabs { padding: 0 4px; }
  .tabs button, .tabs a { padding: 12px 12px 11px; }
  .hero h1 { font-size: var(--fs-xl); }
  .hero-body { padding: 0 var(--s4) var(--s4); }
  .hero-top .actions .btn { --h: 34px; padding: 0 14px; }
  .stats-row { gap: var(--s4); font-size: var(--fs-sm); }
  .form-actions { justify-content: stretch; }
  .form-actions > .btn { flex: 1 1 auto; }
  .comment-form { gap: 8px; }
  .composer-opts { order: 3; flex-basis: 100%; margin: 6px -4px 0; padding: 0 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .composer-opts::-webkit-scrollbar { display: none; }
  .composer-opts .cpick { flex: none; }
  .composer-foot > .counter { margin-left: auto; }
  .ed-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
  .ed-bar::-webkit-scrollbar { display: none; }
  .ed-group, .ed-btn { flex: none; }
  .ed-btn { width: 38px; height: 38px; }
  .ed-group.end { margin-left: 4px; border-left: 1px solid var(--line); padding-left: 6px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .tile .v { font-size: var(--fs-xl); }
  .state { padding: 40px var(--s4); }
}
@media (max-width: 340px) { .topbar .brand b { display: none; } .btn { padding: 0 14px; } .tabbar .fab { width: 46px; } }
/* Сенсорные экраны: крупнее цели нажатия */
@media (hover: none) {
  .act { min-height: 40px; }
  .iconbtn { width: 42px; height: 42px; }
}

/* Вход и способы входа */
.auth-box { gap: 16px; padding: 28px; border-radius: var(--r-xl); box-shadow: 0 30px 60px -40px rgba(40, 30, 16, .35); }
.provider-ic { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.provider-ic .g-mark { width: 18px; height: 18px; }
@media (max-width: 759px) { .auth-box { padding: 22px 18px; } }
/* Планшет: список разделов настроек уже, без подписей — содержимому больше места */
@media (min-width: 760px) and (max-width: 1023px) {
  .settings { gap: 16px; }
  .settings-link .sub, .settings-me .sub { display: none; }
  .settings-link { padding: 9px 8px; }
}
/* Приветствие для гостя на главной — титульный лист */
.intro { gap: 12px; padding: 40px 24px 32px; }
.intro h1 { font-family: var(--font-display); font-weight: 400; font-size: 44px; letter-spacing: -.015em; line-height: 1.05; }
.intro p { max-width: 40ch; color: var(--text-2); font-size: var(--fs-lg); }
.intro .row { margin-top: 8px; }
@media (max-width: 759px) { .intro { padding: 28px 16px 24px; } .intro h1 { font-size: 34px; } }

/* ===== Язык: флажки и переключатель RU · EN · UA (ui/lang.js) ===== */
.flag {
  width: 18px; height: 18px; flex: none; border-radius: 50%; overflow: hidden; display: block;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 14%, transparent), inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.lang-switch {
  --pad: 3px; position: relative; isolation: isolate; display: inline-grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: var(--pad); border-radius: var(--r-full); background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.lang-thumb {
  position: absolute; z-index: -1; top: var(--pad); bottom: var(--pad); left: var(--pad); width: calc((100% - var(--pad) * 2) / 3);
  border-radius: var(--r-full); background: var(--surface);
  box-shadow: 0 1px 2px rgba(40, 30, 16, .12), 0 0 0 1px var(--line-strong);
  transform: translateX(calc(var(--i, 0) * 100%)); transition: transform var(--t) var(--ease-out);
}
.lang-opt {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: var(--control-h-sm); padding: 0 12px;
  border: 0; border-radius: var(--r-full); background: none; color: var(--muted);
  font: 650 var(--fs-xs) / 1 var(--font); letter-spacing: .08em; cursor: pointer;
  transition: color var(--t-fast); -webkit-tap-highlight-color: transparent;
}
.lang-opt .flag { width: 16px; height: 16px; filter: saturate(.55); opacity: .8; transition: filter var(--t-fast), opacity var(--t-fast), transform var(--t) var(--ease); }
.lang-opt:hover { color: var(--text); }
.lang-opt:hover .flag { filter: none; opacity: 1; }
.lang-opt[aria-checked="true"] { color: var(--text); }
.lang-opt[aria-checked="true"] .flag { filter: none; opacity: 1; }
.lang-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lang-opt:active .flag { transform: scale(.88); }
.lang-switch.switching .lang-opt { pointer-events: none; }
.lang-switch.sm .lang-opt { padding: 0 8px; gap: 6px; }
.lang-switch.lg { display: grid; width: 100%; max-width: 420px; }
.lang-switch.lg .lang-opt { height: var(--control-h); font-size: var(--fs-sm); gap: 9px; }
.lang-switch.lg .lang-opt .flag { width: 20px; height: 20px; }
/* Список языков на всплывающей панели (меню аккаунта, флажок на рельсе) */
.lang-list .menu-item .flag { width: 20px; height: 20px; }
.lang-list .lang-code { font-size: var(--fs-xs); font-weight: 650; letter-spacing: .08em; color: var(--muted); }
.lang-list .menu-item[aria-checked="true"] { background: var(--accent-soft); }
.lang-list .menu-item[aria-checked="true"] .lang-code { color: var(--accent-strong); }
.menu-item > .flag { width: 18px; height: 18px; }
/* Низ боковой панели: переключатель на широком экране, флажок — на рельсе планшета */
.nav-lang { display: flex; justify-content: center; padding: 14px 4px 0; margin-top: 10px; border-top: 1px solid var(--line); }
.nav-lang .lang-switch { width: 100%; }
.nav-lang .lang-btn { display: none; }
.lang-btn .flag { width: 22px; height: 22px; }
@media (max-width: 1199px) {
  .nav-lang { padding: 10px 0 0; border-top: 0; }
  .nav-lang .lang-switch { display: none; }
  .nav-lang .lang-btn { display: inline-grid; }
  /* Панель раскрыта поверх страницы — снова полный переключатель языка */
  html.nav-open .nav-lang { padding: 14px 4px 0; border-top: 1px solid var(--line); }
  html.nav-open .nav-lang .lang-switch { display: inline-grid; }
  html.nav-open .nav-lang .lang-btn { display: none; }
}
@media (min-width: 1200px) {
  html.nav-rail .nav-lang { padding: 10px 0 0; border-top: 0; }
  html.nav-rail .nav-lang .lang-switch { display: none; }
  html.nav-rail .nav-lang .lang-btn { display: inline-grid; }
}
/* Вход и регистрация */
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; }

/* ===== Правовые документы (privacy / terms / recommendations, pages/legal.js) ===== */
.legal-page { min-height: 100vh; min-height: 100dvh; padding: max(28px, env(safe-area-inset-top)) 16px max(40px, env(safe-area-inset-bottom)); }
.legal {
  max-width: 760px; margin: 0 auto; padding: 36px 44px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  color: var(--text-2); font-size: var(--fs-md); line-height: 1.65; animation: sheet-in var(--t-slow) var(--ease-out) both;
}
.legal-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 26px; font-size: var(--fs-sm); font-weight: 600; }
.legal-nav a { color: var(--muted); }
.legal-nav a:first-child { color: var(--text); margin-right: auto; }
.legal-nav a:hover { color: var(--accent-strong); }
.legal h1 { font-family: var(--font-display); font-weight: 400; font-size: var(--fs-3xl); line-height: 1.12; letter-spacing: -.01em; color: var(--text); }
.legal-meta { margin: 10px 0 8px; color: var(--muted); font-size: var(--fs-sm); }
.legal h2 {
  position: relative; margin: 34px 0 10px; padding-left: 18px; font-size: var(--fs-lg); font-weight: 700; line-height: 1.35; color: var(--text);
}
.legal h2::before {
  content: ""; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; background: var(--accent); border-radius: 1.5px; transform: rotate(45deg);
}
.legal h3 { margin: 20px 0 6px; font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.legal p, .legal ul, .legal ol { margin: 0 0 10px; }
.legal ul, .legal ol { padding-left: 22px; }
.legal li { margin: 4px 0; }
.legal li::marker { color: var(--muted); }
.legal a { color: var(--accent-strong); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.legal .legal-nav a { color: var(--muted); text-decoration: none; }
.legal .legal-nav a:first-child { color: var(--text); }
.legal .legal-nav a:hover { color: var(--accent-strong); }
.legal b, .legal strong { color: var(--text); font-weight: 650; }
.legal-table { width: 100%; margin: 6px 0 14px; border-collapse: collapse; font-size: var(--fs-sm); line-height: 1.5; display: block; overflow-x: auto; }
.legal-table th, .legal-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; min-width: 140px; }
.legal-table th { color: var(--text); font-weight: 700; background: var(--surface-2); }
.legal-table tr:last-child td { border-bottom: 0; }
.legal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); }
@media (max-width: 759px) {
  .legal-page { padding: 0 0 max(24px, env(safe-area-inset-bottom)); background: var(--surface); }
  .legal { padding: max(20px, env(safe-area-inset-top)) 16px 20px; border: 0; border-radius: 0; font-size: var(--fs-md); }
  .legal h1 { font-size: var(--fs-2xl); }
}
@media print {
  .legal-foot, .legal-nav { display: none; }
  .legal { border: 0; padding: 0; max-width: none; }
}

/* ===== Админка → Нагрузка: полоса заполнения ===== */
.meter { display: block; height: 6px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--t) var(--ease-out); }
.meter.warn > i { background: var(--warning); }
.meter.bad > i { background: var(--danger); }
.tile .meter { margin-top: 2px; }
.meter-cell { display: grid; gap: 5px; min-width: 160px; }
