/*
 * =============================================================================
 * LAYOUT STANDARD — основной каркас рабочего кабинета
 * =============================================================================
 * Единственный эталон вёрстки для текущих и будущих экранов (кроме auth-mode).
 * Менять цепочку flex/grid/overflow только осознанно и с правкой этого блока
 * и файла .cursor/rules/app-shell-layout.mdc
 *
 * DOM (public/index.html):
 *   body
 *     .app-shell
 *       aside.sidebar
 *       main.content
 *         header.topbar          — фикс по высоте; при max-width 625px скрыт (топбар = полоса сайдбара)
 *         .content-scroll        — flex:1; min-height:0; overflow:hidden (не скроллится)
 *           section#app-view-card.app-view-card.card
 *             #app-view-header   — слот шапки страницы (:empty { display:none })
 *             .app-view-main-scroll — flex:1; min-height:0; overflow-y:auto
 *               #app-view        — сюда подставляется HTML маршрута (app.js)
 *             #app-view-footer   — слот подвала (:empty { display:none })
 *
 * Прокрутка:
 *   Окно приложения не скроллится (body:not(.auth-mode) overflow:hidden).
 *   Вертикальный скролл только в .app-view-main-scroll.
 *   Онбординг (.welcome-onboarding): .app-view-main-scroll overflow:hidden;
 *   скролл в .welcome-layout-main.
 *
 * Отступы белой карточки (главное окно):
 *   --card-pad-block / --card-pad-inline — единственный источник; плавный clamp 360–535px.
 *   .app-view-card: padding-top и padding-inline; padding-bottom:0.
 *   Нижний внутренний отступ карточки: padding-bottom на .app-view-main-scroll (= --card-pad-block),
 *   чтобы поле было внутри зоны скролла.
 *
 * Сетка колонки контента: padding main.content = --content-padding.
 * Высота полосы workspace сверху: --topbar-height + --topbar-margin-bottom.
 *
 * Брейкпоинты сайдбара (синхронно с app.js SIDEBAR_*):
 *   625px — горизонтальный топбар; @media (max-width: 625px) в этом файле.
 *   1029px — узкий режим оверлея; константа SIDEBAR_AUTO_COLLAPSE_MAX_WIDTH в app.js.
 * =============================================================================
 */

:root {
  --accent: #333f64;
  --red: #fc3f1d;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #dde1ee;
  --text: #1a2035;
  --text2: #5a6380;

  /* ——— Layout tokens (главный каркас + главное окно) ——— */
  --sidebar-expanded-width: 260px;
  --sidebar-collapsed-width: 84px;
  /* Документировать вместе с @media (max-width: 625px) и SIDEBAR_TOPBAR_MAX_WIDTH в app.js */
  --sidebar-topbar-max: 625px;
  /* Совпадает с .topbar: рамка + padding + строка; выравнивание с полосой логотипа в сайдбаре */
  --topbar-height: 56px;
  --content-padding: 14px;
  --topbar-margin-bottom: 12px;
  /*
   * Главное окно (белая карточка #app-view-card): только эти переменные для внутренних полей.
   * ≥535px viewport: ~14px сверху/снизу по блоку, ~40px слева/справа.
   * 360px: ~15px блок, ~10px inline (линейная интерполяция).
   */
  --card-pad-block: clamp(14px, calc(15px - (100vw - 360px) / 175), 15px);
  --card-pad-inline: clamp(10px, calc(10px + (100vw - 360px) * (30 / 175)), 40px);
  /* Семантические алиасы — те же значения; использовать в новых компонентах страницы */
  --layout-app-card-pad-block: var(--card-pad-block);
  --layout-app-card-pad-inline: var(--card-pad-inline);

  /* ——— Typography (single scale; rem = 16px root) ——— */
  --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-weight-extralight: 200;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  --leading-none: 1;
  --leading-tight: 1.2;
  --leading-snug: 1.25;
  --leading-normal: 1.35;
  --leading-body: 1.45;
  --leading-relaxed: 1.5;

  --text-root: 1rem;     /* 16px — базовый кегль страницы */
  --text-2xs: 0.625rem;   /* 10px */
  --text-xs: 0.6875rem;  /* 11px */
  --text-sm: 0.75rem;    /* 12px */
  --text-md: 0.8125rem;  /* 13px */
  --text-base: 0.875rem; /* 14px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.375rem;  /* 22px */
  --text-3xl: 1.5rem;    /* 24px */
  /* Main app page / onboarding hero title (~22–28px) */
  --text-display: clamp(1.375rem, 2vw + 1rem, 1.75rem);
  /* Auth card title — stepped by breakpoint below */
  --text-auth-title: var(--text-3xl);

  --letter-tight: 0.00625em;
  --letter-label: 0.0375em;
  --letter-wide: 0.05em;
}

@media (max-width: 1024px) {
  :root {
    --text-auth-title: var(--text-2xl);
  }
}

@media (max-width: 768px) {
  :root {
    --text-auth-title: var(--text-xl);
  }
}

@media (max-width: 360px) {
  :root {
    --text-auth-title: var(--text-lg);
  }
}

* { box-sizing: border-box; }
html {
  height: 100%;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-root);
  line-height: var(--leading-relaxed);
  color: var(--text);
  background: var(--bg);
}
/* Рабочий кабинет: без прокрутки страницы — только область .content-scroll */
body:not(.auth-mode) {
  height: 100%;
  max-height: 100dvh;
  overflow: hidden;
}
body.auth-mode {
  min-height: 100dvh;
  height: auto;
  max-height: none;
  overflow: auto;
}
html.route-loading .topbar,
html.route-loading .app-view-card {
  visibility: hidden;
}

.app-shell {
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--sidebar-expanded-width) 1fr;
  grid-template-rows: 1fr;
  overflow: hidden;
}
.sidebar {
  background: #fff;
  color: #2b3555;
  padding: var(--content-padding) 14px 14px;
  border-right: 1px solid #e7ebf5;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* Не задавать height: 100% глобально: в колонке .app-shell (≤625px) это растягивает топбар на весь экран */
  overflow-x: hidden;
  overflow-y: auto;
  align-self: stretch;
}
@media (min-width: 626px) {
  .sidebar {
    max-height: 100dvh;
  }
}
.sidebar-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  min-height: 0;
  margin-bottom: 10px;
  padding-top: 0;
  flex-shrink: 0;
}
.sidebar-head .sidebar-control-btn {
  width: 100%;
}
.sidebar-head .brand {
  margin-bottom: 0;
  height: 44px;
  display: flex;
  align-items: flex-end;
}
.sidebar-head .brand-logo {
  transform: none;
}
.sidebar-control-btn {
  border: 0;
  background: #eef2fb;
  color: #3a4f80;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  flex-shrink: 0;
  font: inherit;
  font-size: var(--text-md);
  font-weight: var(--font-weight-medium);
}
.sidebar-control-label {
  white-space: nowrap;
}
.sidebar-control-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  fill: currentColor;
}
.sidebar-control-btn:hover {
  background: #e3e9f7;
  color: #2f4373;
}
.brand {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 14px;
}
.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 10px;
  background: #f6f8fd;
  margin-top: 0;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f3c9b1;
  color: #5a372c;
  font-weight: var(--font-weight-bold);
  font-size: var(--text-md);
  flex-shrink: 0;
}
.sidebar-user-meta {
  min-width: 0;
}
.sidebar-user-meta strong {
  display: block;
  font-size: var(--text-md);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
}
.sidebar-user-meta span {
  display: block;
  font-size: var(--text-xs);
  color: #7a86a8;
  line-height: var(--leading-snug);
  margin-top: 1px;
}
.sidebar-nav-modern {
  display: grid;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
}
.sidebar-nav-modern .menu-item {
  color: #2f3a5f;
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: var(--text-md);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  border: 1px solid transparent;
  transition: background .16s ease, border-color .16s ease, color .16s ease;
  font-weight: var(--font-weight-medium);
}
.sidebar-nav-modern .menu-item::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 0;
  background: currentColor;
  opacity: 0.82;
  flex-shrink: 0;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}
.sidebar-nav-modern .menu-item::after {
  content: "›";
  margin-left: auto;
  color: #9ca8c7;
  font-size: 1rem;
  line-height: var(--leading-none);
}
.sidebar-nav-modern .menu-item:hover,
.sidebar-nav-modern .menu-item[data-link]:focus-visible {
  background: #f3f6ff;
  border-color: #e3e8f7;
  color: #263256;
}

.icon-dashboard::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M4 20v2h4.586L2 28.586L3.414 30L10 23.414V28h2v-8zm20 1h2v5h-2zm-4-5h2v10h-2zm-4 2h2v8h-2z'/%3E%3Cpath fill='black' d='M28 2H4a2.002 2.002 0 0 0-2 2v12h2v-3h24.001l.001 15H16v2h12a2.003 2.003 0 0 0 2-2V4a2.002 2.002 0 0 0-2-2m-16 9H4V4h8Zm2 0V4h14v7Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M4 20v2h4.586L2 28.586L3.414 30L10 23.414V28h2v-8zm20 1h2v5h-2zm-4-5h2v10h-2zm-4 2h2v8h-2z'/%3E%3Cpath fill='black' d='M28 2H4a2.002 2.002 0 0 0-2 2v12h2v-3h24.001l.001 15H16v2h12a2.003 2.003 0 0 0 2-2V4a2.002 2.002 0 0 0-2-2m-16 9H4V4h8Zm2 0V4h14v7Z'/%3E%3C/svg%3E");
}
.icon-projects::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M23 31a1 1 0 0 1-.94-.658l-3.136-8.625l-2.005 4.677A1 1 0 0 1 16 27h-4v-2h3.34l2.74-6.394c.163-.377.549-.616.948-.606a1 1 0 0 1 .912.658l3.136 8.626l2.005-4.678A1 1 0 0 1 26 22h4v2h-3.34l-2.74 6.394A1 1 0 0 1 23 31'/%3E%3Cpath fill='black' d='M9 25H4V10h24v9h2v-9c0-1.103-.897-2-2-2h-6V4c0-1.103-.897-2-2-2h-8c-1.103 0-2 .897-2 2v4H4c-1.103 0-2 .897-2 2v15c0 1.103.897 2 2 2h5zm3-21h8v4h-8z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M23 31a1 1 0 0 1-.94-.658l-3.136-8.625l-2.005 4.677A1 1 0 0 1 16 27h-4v-2h3.34l2.74-6.394c.163-.377.549-.616.948-.606a1 1 0 0 1 .912.658l3.136 8.626l2.005-4.678A1 1 0 0 1 26 22h4v2h-3.34l-2.74 6.394A1 1 0 0 1 23 31'/%3E%3Cpath fill='black' d='M9 25H4V10h24v9h2v-9c0-1.103-.897-2-2-2h-6V4c0-1.103-.897-2-2-2h-8c-1.103 0-2 .897-2 2v4H4c-1.103 0-2 .897-2 2v15c0 1.103.897 2 2 2h5zm3-21h8v4h-8z'/%3E%3C/svg%3E");
}
.icon-plan::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='black' d='M5 2h2v2h6V2h2v2h1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1V2zm11 6H4v8h12V8z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='black' d='M5 2h2v2h6V2h2v2h1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h1V2zm11 6H4v8h12V8z'/%3E%3C/svg%3E");
}
.icon-posts::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M30 22h-6v-6h-2v6h-6v2h6v6h2v-6h6z'/%3E%3Cpath fill='black' d='M28 6c0-1.1-.9-2-2-2h-4V2h-2v2h-8V2h-2v2H6c-1.1 0-2 .9-2 2v20c0 1.1.9 2 2 2h8v-2H6V6h4v2h2V6h8v2h2V6h4v8h2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M30 22h-6v-6h-2v6h-6v2h6v6h2v-6h6z'/%3E%3Cpath fill='black' d='M28 6c0-1.1-.9-2-2-2h-4V2h-2v2h-8V2h-2v2H6c-1.1 0-2 .9-2 2v20c0 1.1.9 2 2 2h8v-2H6V6h4v2h2V6h8v2h2V6h4v8h2z'/%3E%3C/svg%3E");
}
.icon-analytics::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M4 20v2h4.586L2 28.586L3.414 30L10 23.414V28h2v-8zM30 4h-7v2h3.586L19 13.586l-4.293-4.293a1 1 0 0 0-1.414 0L8 14.586L9.414 16L14 11.414l4.293 4.293a1 1 0 0 0 1.414 0L28 7.414V11h2zM16 28h14v2H16zM2 2h2v14H2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M4 20v2h4.586L2 28.586L3.414 30L10 23.414V28h2v-8zM30 4h-7v2h3.586L19 13.586l-4.293-4.293a1 1 0 0 0-1.414 0L8 14.586L9.414 16L14 11.414l4.293 4.293a1 1 0 0 0 1.414 0L28 7.414V11h2zM16 28h14v2H16zM2 2h2v14H2z'/%3E%3C/svg%3E");
}
.icon-team::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M30 30h-2v-5a5.006 5.006 0 0 0-5-5v-2a7.008 7.008 0 0 1 7 7zm-8 0h-2v-5a5.006 5.006 0 0 0-5-5H9a5.006 5.006 0 0 0-5 5v5H2v-5a7.008 7.008 0 0 1 7-7h6a7.008 7.008 0 0 1 7 7zM20 2v2a5 5 0 0 1 0 10v2a7 7 0 0 0 0-14m-8 2a5 5 0 1 1-5 5a5 5 0 0 1 5-5m0-2a7 7 0 1 0 7 7a7 7 0 0 0-7-7'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M30 30h-2v-5a5.006 5.006 0 0 0-5-5v-2a7.008 7.008 0 0 1 7 7zm-8 0h-2v-5a5.006 5.006 0 0 0-5-5H9a5.006 5.006 0 0 0-5 5v5H2v-5a7.008 7.008 0 0 1 7-7h6a7.008 7.008 0 0 1 7 7zM20 2v2a5 5 0 0 1 0 10v2a7 7 0 0 0 0-14m-8 2a5 5 0 1 1-5 5a5 5 0 0 1 5-5m0-2a7 7 0 1 0 7 7a7 7 0 0 0-7-7'/%3E%3C/svg%3E");
}
.icon-settings::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='m31.707 19.293l-3-3a1 1 0 0 0-1.414 0L18 25.586V30h4.414l9.293-9.293a1 1 0 0 0 0-1.414M21.586 28H20v-1.586l5-5L26.586 23zM28 21.586L26.414 20L28 18.414L29.586 20zM16 22c-3.364 0-6-2.636-6-6s2.636-6 6-6s6 2.636 6 6s-2.636 6-6 6m0-10c-2.28 0-4 1.72-4 4s1.72 4 4 4s4-1.72 4-4s-1.72-4-4-4'/%3E%3Cpath fill='black' d='m27.547 12l1.733-1l-2.336-4.044a2 2 0 0 0-2.373-.894l-2.434.823a11.056 11.056 0 0 0-1.312-.758l-.503-2.52A2 2 0 0 0 18.36 2h-4.72a2 2 0 0 0-1.962 1.608l-.503 2.519c-.46.224-.906.469-1.327.753l-2.42-.818a2 2 0 0 0-2.373.894l-2.36 4.088a2 2 0 0 0 .412 2.502l1.931 1.697C5.021 15.495 5 15.745 5 16c0 .258.01.513.028.766l-1.92 1.688a2 2 0 0 0-.413 2.502l2.36 4.088a2 2 0 0 0 2.374.894l2.434-.823c.418.282.856.535 1.312.758l.503 2.519A2 2 0 0 0 13.64 30H16v-2h-2.36l-.71-3.55a9.096 9.096 0 0 1-2.695-1.572l-3.447 1.166l-2.36-4.088l2.725-2.395a8.929 8.929 0 0 1-.007-3.128l-2.719-2.39l2.361-4.087l3.427 1.16A9.027 9.027 0 0 1 12.93 7.55L13.64 4h4.721l.71 3.55a9.1 9.1 0 0 1 2.695 1.572l3.447-1.166z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='m31.707 19.293l-3-3a1 1 0 0 0-1.414 0L18 25.586V30h4.414l9.293-9.293a1 1 0 0 0 0-1.414M21.586 28H20v-1.586l5-5L26.586 23zM28 21.586L26.414 20L28 18.414L29.586 20zM16 22c-3.364 0-6-2.636-6-6s2.636-6 6-6s6 2.636 6 6s-2.636 6-6 6m0-10c-2.28 0-4 1.72-4 4s1.72 4 4 4s4-1.72 4-4s-1.72-4-4-4'/%3E%3Cpath fill='black' d='m27.547 12l1.733-1l-2.336-4.044a2 2 0 0 0-2.373-.894l-2.434.823a11.056 11.056 0 0 0-1.312-.758l-.503-2.52A2 2 0 0 0 18.36 2h-4.72a2 2 0 0 0-1.962 1.608l-.503 2.519c-.46.224-.906.469-1.327.753l-2.42-.818a2 2 0 0 0-2.373.894l-2.36 4.088a2 2 0 0 0 .412 2.502l1.931 1.697C5.021 15.495 5 15.745 5 16c0 .258.01.513.028.766l-1.92 1.688a2 2 0 0 0-.413 2.502l2.36 4.088a2 2 0 0 0 2.374.894l2.434-.823c.418.282.856.535 1.312.758l.503 2.519A2 2 0 0 0 13.64 30H16v-2h-2.36l-.71-3.55a9.096 9.096 0 0 1-2.695-1.572l-3.447 1.166l-2.36-4.088l2.725-2.395a8.929 8.929 0 0 1-.007-3.128l-2.719-2.39l2.361-4.087l3.427 1.16A9.027 9.027 0 0 1 12.93 7.55L13.64 4h4.721l.71 3.55a9.1 9.1 0 0 1 2.695 1.572l3.447-1.166z'/%3E%3C/svg%3E");
}
.icon-trash::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M12 12h2v12h-2zm6 0h2v12h-2z'/%3E%3Cpath fill='black' d='M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20zm4-26h8v2h-8z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M12 12h2v12h-2zm6 0h2v12h-2z'/%3E%3Cpath fill='black' d='M4 6v2h2v20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8h2V6zm4 22V8h16v20zm4-26h8v2h-8z'/%3E%3C/svg%3E");
}
.icon-social::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M11.947 19a4.948 4.948 0 0 1-3.499-8.446l5.106-5.105a4.948 4.948 0 0 1 6.998 6.998l-.553.552l-1.415-1.413l.557-.557a2.95 2.95 0 0 0-.004-4.166a3.02 3.02 0 0 0-4.17 0l-5.104 5.104a2.947 2.947 0 0 0 0 4.17a3.02 3.02 0 0 0 4.17 0l1.414 1.414a4.918 4.918 0 0 1-3.5 1.449'/%3E%3Cpath fill='black' d='M19.947 17a4.948 4.948 0 0 1-3.499-8.446L17.001 8l1.414 1.415l-.552.552a2.948 2.948 0 0 0 0 4.169a3.02 3.02 0 0 0 4.17 0l5.105-5.105a2.951 2.951 0 0 0 0-4.168a3.02 3.02 0 0 0-4.17 0l-1.414-1.415a4.948 4.948 0 0 1 6.998 6.998l-5.104 5.103a4.92 4.92 0 0 1-3.5 1.45'/%3E%3Cpath fill='black' d='M24 30H4a2.002 2.002 0 0 1-2-2V8a2.002 2.002 0 0 1 2-2h4v2H4v20h20V18h2v10a2.002 2.002 0 0 1-2 2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M11.947 19a4.948 4.948 0 0 1-3.499-8.446l5.106-5.105a4.948 4.948 0 0 1 6.998 6.998l-.553.552l-1.415-1.413l.557-.557a2.95 2.95 0 0 0-.004-4.166a3.02 3.02 0 0 0-4.17 0l-5.104 5.104a2.947 2.947 0 0 0 0 4.17a3.02 3.02 0 0 0 4.17 0l1.414 1.414a4.918 4.918 0 0 1-3.5 1.449'/%3E%3Cpath fill='black' d='M19.947 17a4.948 4.948 0 0 1-3.499-8.446L17.001 8l1.414 1.415l-.552.552a2.948 2.948 0 0 0 0 4.169a3.02 3.02 0 0 0 4.17 0l5.105-5.105a2.951 2.951 0 0 0 0-4.168a3.02 3.02 0 0 0-4.17 0l-1.414-1.415a4.948 4.948 0 0 1 6.998 6.998l-5.104 5.103a4.92 4.92 0 0 1-3.5 1.45'/%3E%3Cpath fill='black' d='M24 30H4a2.002 2.002 0 0 1-2-2V8a2.002 2.002 0 0 1 2-2h4v2H4v20h20V18h2v10a2.002 2.002 0 0 1-2 2'/%3E%3C/svg%3E");
}
.icon-register::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='black' d='M3 2h10l4 4v12H3V2zm9 1.5V7h3.5L12 3.5zM6 10h8v1.5H6V10zm0 3h8v1.5H6V13z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='black' d='M3 2h10l4 4v12H3V2zm9 1.5V7h3.5L12 3.5zM6 10h8v1.5H6V10zm0 3h8v1.5H6V13z'/%3E%3C/svg%3E");
}
.icon-login::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='black' d='M10 2h7v16h-7v-2h5V4h-5V2zm-1 4 1.4 1.4-1.6 1.6H3v2h5.8l1.6 1.6L9 14l-4-4 4-4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='black' d='M10 2h7v16h-7v-2h5V4h-5V2zm-1 4 1.4 1.4-1.6 1.6H3v2h5.8l1.6 1.6L9 14l-4-4 4-4z'/%3E%3C/svg%3E");
}
.icon-logout::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='black' d='M3 2h7v2H5v12h5v2H3V2zm8 4 4 4-4 4-1.4-1.4 1.6-1.6H7V9h4.2l-1.6-1.6L11 6z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='black' d='M3 2h7v2H5v12h5v2H3V2zm8 4 4 4-4 4-1.4-1.4 1.6-1.6H7V9h4.2l-1.6-1.6L11 6z'/%3E%3C/svg%3E");
}
.icon-ai::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M11 11v10h10V11Zm8 8h-6v-6h6Z'/%3E%3Cpath fill='black' d='M30 13v-2h-4V8a2 2 0 0 0-2-2h-3V2h-2v4h-6V2h-2v4H8a2 2 0 0 0-2 2v3H2v2h4v6H2v2h4v3a2 2 0 0 0 2 2h3v4h2v-4h6v4h2v-4h3a2 2 0 0 0 2-2v-3h4v-2h-4v-6Zm-6 11H8V8h16Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='black' d='M11 11v10h10V11Zm8 8h-6v-6h6Z'/%3E%3Cpath fill='black' d='M30 13v-2h-4V8a2 2 0 0 0-2-2h-3V2h-2v4h-6V2h-2v4H8a2 2 0 0 0-2 2v3H2v2h4v6H2v2h4v3a2 2 0 0 0 2 2h3v4h2v-4h6v4h2v-4h3a2 2 0 0 0 2-2v-3h4v-2h-4v-6Zm-6 11H8V8h16Z'/%3E%3C/svg%3E");
}
.sidebar-logout {
  margin-top: 6px;
  display: flex;
}

.content {
  padding: var(--content-padding);
  background: #f6f8fc;
}
/* Колонка контента: шапка (.topbar) фиксирована по высоте, скролл только в .content-scroll */
body:not(.auth-mode) .content {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/*
 * Внешняя колонка не скроллится: скролл только внутри карточки (.app-view-main-scroll)
 * или внутри онбординга (.welcome-layout-main).
 */
.content-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.app-view-card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.app-view-header,
.app-view-footer {
  flex: 0 0 auto;
  flex-shrink: 0;
}
.app-view-header:empty,
.app-view-footer:empty {
  display: none;
}
.app-view-main-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
  /* См. LAYOUT STANDARD: нижний инсет карточки только здесь (внутри скролла) */
  padding-bottom: var(--layout-app-card-pad-block);
}
/* Онбординг: шапка и футер карточки фиксированы по смыслу макета — скролл только в середине */
.app-view-main-scroll:has(.welcome-onboarding) {
  overflow: hidden;
}
#app-view {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}
#app-view:has(.welcome-onboarding) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.topbar {
  flex: 0 0 auto;
  flex-shrink: 0;
  margin-bottom: var(--topbar-margin-bottom);
  border: 1px solid #e6eaf4;
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: var(--topbar-height);
  box-sizing: border-box;
}
.topbar .topbar-workspace {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
  max-width: 100%;
}
/*
 * Ширина ≥626px: workspace в топбаре контента. В сайдбаре / оверлее дубликат не показываем.
 * Полоса логотипа = --topbar-height + --topbar-margin-bottom (как у sidebar-state-1),
 * чтобы верх 1-го пункта меню совпадал с верхним краем #app-view.card.
 */
@media (min-width: 626px) {
  .app-shell:not(.sidebar-narrow-overlay) .sidebar > .sidebar-user,
  .app-shell.sidebar-narrow-overlay .sidebar > .sidebar-user {
    display: none;
  }
  /*
   * Кнопка сворачивания в .sidebar-head: на широких экранах «расплющиваем» head,
   * чтобы порядок был логотип → меню → кнопка внизу (margin-top: auto у кнопки).
   */
  .app-shell.sidebar-state-0:not(.sidebar-narrow-overlay) .sidebar-head,
  .app-shell.sidebar-state-1:not(.sidebar-narrow-overlay) .sidebar-head {
    display: contents;
  }
  /* При display:contents у .sidebar-head .brand не является прямым потомком .sidebar — только .sidebar-head .brand */
  .app-shell.sidebar-state-0:not(.sidebar-narrow-overlay) .sidebar-head .brand {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: var(--topbar-height);
    height: var(--topbar-height);
    margin-bottom: var(--topbar-margin-bottom);
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
    order: 0;
    width: auto;
  }
  .app-shell.sidebar-state-0:not(.sidebar-narrow-overlay) .sidebar-head .brand .brand-logo {
    width: 44px;
    height: 44px;
  }
  .app-shell.sidebar-state-0:not(.sidebar-narrow-overlay) .sidebar .sidebar-user {
    order: 1;
  }
  .app-shell.sidebar-state-0:not(.sidebar-narrow-overlay) .sidebar .sidebar-nav-modern {
    order: 2;
  }
  .app-shell.sidebar-state-0:not(.sidebar-narrow-overlay) .sidebar-head .sidebar-control-btn {
    order: 3;
    margin-top: auto;
    width: 100%;
    flex-shrink: 0;
  }
  .app-shell.sidebar-state-1:not(.sidebar-narrow-overlay) .sidebar-head .brand {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--topbar-height);
    height: var(--topbar-height);
    margin-bottom: var(--topbar-margin-bottom);
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
    order: 0;
    width: 100%;
  }
  .app-shell.sidebar-state-1:not(.sidebar-narrow-overlay) .sidebar .sidebar-nav-modern {
    order: 2;
  }
  .app-shell.sidebar-state-1:not(.sidebar-narrow-overlay) .sidebar-head .sidebar-control-btn {
    order: 3;
    margin-top: auto;
    width: 100%;
    flex-shrink: 0;
  }
  /* Оверлей (626px+): логотип слева, та же кнопка закрытия справа */
  .app-shell.sidebar-narrow-overlay .sidebar > .sidebar-head {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: var(--topbar-height);
    height: auto;
    margin-bottom: var(--topbar-margin-bottom);
    padding-top: 0;
    padding-bottom: 0;
    box-sizing: border-box;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-head .brand {
    flex: 0 0 auto;
    width: auto;
    height: auto;
    min-height: 0;
    margin-bottom: 0;
    justify-content: flex-start;
    align-items: center;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-head .brand-logo {
    width: 48px;
    height: 48px;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-head .sidebar-control-btn {
    flex: 0 0 auto;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    height: 44px;
    padding: 0;
    margin-top: 0;
    margin-left: auto;
    justify-content: center;
    border-radius: 10px;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-head .sidebar-control-btn svg {
    width: 20px;
    height: 20px;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-head .sidebar-control-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}

.app-shell.sidebar-state-1 {
  grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}
/* Узкий сайдбар: та же вертикальная сетка, что у .content — padding сверху → полоса как топбар → отступ 12px → навигация (как #app-view.card) */
.app-shell.sidebar-state-1 .sidebar {
  padding: var(--content-padding) 8px 12px;
}
.app-shell.sidebar-state-1 .sidebar > .sidebar-user {
  display: none;
}
.app-shell.sidebar-state-1 .sidebar-head {
  flex-shrink: 0;
  justify-content: center;
  align-items: center;
  min-height: var(--topbar-height);
  height: var(--topbar-height);
  margin-bottom: var(--topbar-margin-bottom);
  padding-top: 0;
  padding-bottom: 0;
  box-sizing: border-box;
}
.app-shell.sidebar-state-1 .sidebar-head .brand {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin-bottom: 0;
  justify-content: center;
  align-items: center;
  align-self: stretch;
}
.app-shell.sidebar-state-1 .brand-logo {
  width: 36px;
  height: 36px;
  max-width: 100%;
  object-fit: contain;
}
.app-shell.sidebar-state-1 .sidebar-control-btn {
  position: relative;
  width: 32px;
  min-height: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  gap: 0;
}
.app-shell.sidebar-state-1 .sidebar-control-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.app-shell.sidebar-state-1 .sidebar-nav-modern {
  gap: 8px;
}
.app-shell.sidebar-state-1 .sidebar-nav-modern .menu-item {
  padding: 10px 8px;
  justify-content: center;
  gap: 0;
  font-size: 0;
}
.app-shell.sidebar-state-1 .sidebar-nav-modern .menu-item::after {
  display: none;
}

/* Узкий экран: развёрнутая панель — оверлей; клик по фону или Esc закрывает */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 250;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(26, 32, 53, 0.38);
  cursor: pointer;
}
body.sidebar-drawer-open {
  overflow: hidden;
}
.app-shell.sidebar-narrow-overlay {
  grid-template-columns: 1fr;
}
.app-shell.sidebar-narrow-overlay .sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(var(--sidebar-expanded-width), 92vw);
  z-index: 300;
  box-shadow: 8px 0 40px rgba(26, 32, 53, 0.16);
  min-height: 100vh;
  min-height: 100dvh;
}
.app-shell.sidebar-narrow-overlay .content {
  grid-column: 1;
  width: 100%;
  max-width: 100%;
  min-height: 0;
}

/* ——— Сайдбар как топбар (узкие экраны) ——— */
@media (max-width: 625px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
    grid-template-columns: unset !important;
  }
  .app-shell.sidebar-state-0,
  .app-shell.sidebar-state-1 {
    grid-template-columns: unset !important;
  }
  .sidebar {
    width: 100%;
    height: auto;
    max-height: none;
    min-height: 0;
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    align-content: center;
    gap: 8px 10px;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid #e7ebf5;
    position: relative;
    z-index: 20;
  }
  .sidebar-head {
    margin-bottom: 0;
    padding-top: 0;
    min-height: 0;
    flex: 0 0 auto;
    width: auto;
    align-items: center;
    order: 1;
  }
  .sidebar-head .brand {
    height: auto;
    align-items: center;
  }
  .brand {
    margin-bottom: 0;
    height: auto;
    width: auto;
  }
  .brand-logo {
    width: 36px;
    height: 36px;
  }
  .sidebar-user {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
    padding: 6px 10px;
    order: 2;
  }
  .sidebar-user-meta strong,
  .sidebar-user-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* Меню в гамбургере: в топбаре скрыто; по клику — панель выезжает справа */
  .app-shell.sidebar-state-1 .sidebar-nav-modern {
    display: none !important;
  }
  .sidebar-head .sidebar-control-btn {
    min-width: 44px;
    width: 44px;
    min-height: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
  }
  .sidebar-head .sidebar-control-btn svg {
    width: 20px;
    height: 20px;
  }
  .app-shell.sidebar-state-1 .sidebar > .sidebar-user {
    display: none;
  }
  /*
   * Свернутый топбар: глобальные правила state-1 задают .sidebar-head .brand { width: 100% } —
   * в горизонтальном топбаре это ломает строку и вертикальное выравнивание с кнопкой меню.
   * Одна строка, логотип слева и кнопка справа, по центру по вертикали (как .topbar).
   */
  .app-shell.sidebar-state-1 .sidebar {
    flex-wrap: nowrap;
    align-items: center;
    align-content: center;
    gap: 10px;
    padding: 8px 12px;
    min-height: var(--topbar-height);
    box-sizing: border-box;
  }
  .app-shell.sidebar-state-1 .sidebar-head {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 0;
    height: auto;
    margin-bottom: 0;
  }
  .app-shell.sidebar-state-1 .sidebar-head .brand {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
    height: auto;
    min-height: 0;
    margin-bottom: 0;
    justify-content: flex-start;
    align-items: center;
    align-self: center;
  }
  .app-shell.sidebar-state-1 .sidebar-head .sidebar-control-btn {
    flex: 0 0 auto;
    margin-left: auto;
  }
  .sidebar-control-label:empty {
    display: none;
  }
  .content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  /* Дублирующий топбар контента: на широких экранах; при сайдбаре-топбаре не нужен */
  .content .topbar {
    display: none;
  }
  /* Оверлей: выдвижная панель справа (не на весь экран) */
  @keyframes sidebar-slide-from-right {
    from {
      transform: translateX(100%);
    }
    to {
      transform: translateX(0);
    }
  }
  .app-shell.sidebar-narrow-overlay .sidebar {
    position: fixed;
    left: auto;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(300px, 90vw);
    max-width: var(--sidebar-expanded-width);
    height: 100%;
    min-height: 100dvh;
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: stretch;
    align-content: flex-start;
    padding: 12px;
    z-index: 300;
    border-left: 1px solid #e7ebf5;
    border-radius: 14px 0 0 14px;
    box-shadow: -12px 0 48px rgba(26, 32, 53, 0.2);
    animation: sidebar-slide-from-right 0.3s ease forwards;
  }
  @media (prefers-reduced-motion: reduce) {
    .app-shell.sidebar-narrow-overlay .sidebar {
      animation: none;
    }
  }
  /*
   * Оверлей ≤625px: шапка — логотип слева, кнопка закрытия справа (та же иконка, что на широких).
   */
  .app-shell.sidebar-narrow-overlay .sidebar-head {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    order: 1;
    margin-bottom: 10px;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-head .brand {
    flex: 0 1 auto;
    min-width: 0;
    justify-content: flex-start;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-head .brand-logo {
    width: 42px;
    height: 42px;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-head .sidebar-control-btn {
    flex: 0 0 auto;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    height: 44px;
    margin-left: auto;
    margin-top: 0;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-user {
    display: flex;
    order: 2;
    flex: 0 0 auto;
    flex-basis: auto;
    padding: 5px 8px;
    margin-bottom: 8px;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-nav-modern {
    display: grid;
    order: 3;
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
    mask-image: none;
    gap: 4px;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-nav-modern .menu-item {
    font-size: var(--text-md);
    white-space: normal;
    padding: 10px 12px;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-nav-modern .menu-item::after {
    display: block;
  }
  .app-shell.sidebar-narrow-overlay .sidebar-control-label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }
}

.card {
  background: #fff;
  border: 1px solid #e6eaf4;
  border-radius: 12px;
  padding: var(--card-pad-block) var(--card-pad-inline);
  min-height: 0;
}
/*
 * Рамка карточки: верх/бока — как у .card; низ — внутри .app-view-main-scroll (в зоне скролла),
 * иначе после рефакторинга контент прилипал к нижнему краю области прокрутки.
 */
.app-view-card.card {
  padding-top: var(--layout-app-card-pad-block);
  padding-right: var(--layout-app-card-pad-inline);
  padding-bottom: 0;
  padding-left: var(--layout-app-card-pad-inline);
}
.muted { color: var(--text2); }
.ok { color: #1b8f45; font-weight: var(--font-weight-semibold); }
.offer-open .welcome-onboarding { filter: blur(4px); pointer-events: none; }

.field { display: grid; gap: 6px; margin-bottom: 12px; max-width: 420px; }
.field input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}
.field-error {
  margin: 4px 0 0;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  min-height: 0;
}
.field-error:empty { display: none; }
.btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  margin-right: 8px;
}
.btn.secondary {
  background: #fff;
  color: var(--accent);
}
.stack { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* Auth screen style (based on provided reference). */
.auth-mode .app-shell {
  display: block;
  min-height: 100vh;
  height: auto;
  max-height: none;
  overflow: visible;
}
.auth-mode .sidebar { display: none; }
.auth-mode .topbar { display: none; }
.auth-mode .content {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: visible;
}
.auth-mode .content-scroll {
  flex: 0 1 auto;
  overflow: visible;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-mode .app-view-card.card {
  background: transparent;
  border: 0;
  box-shadow: none;
  min-height: auto;
  padding: 0;
  flex: 0 1 auto;
  overflow: visible;
}
.auth-mode .app-view-main-scroll {
  overflow: visible;
  flex: 0 1 auto;
  min-height: 0;
  padding-bottom: 0;
}
.auth-shell {
  width: 520px;
  max-width: calc(100% - 32px);
  padding: 10px;
  background: #fff;
  border: 1px solid #e9edf5;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(51, 63, 100, 0.13);
}
.auth-shell-inner {
  border: 0;
  border-radius: 10px;
  padding: 30px 36px 24px;
}
.auth-logo {
  width: 170px;
  margin: 0 auto 14px;
}
.auth-logo-img {
  display: block;
  width: 100%;
  height: auto;
}
.auth-title {
  text-align: center;
  margin: 0 0 18px;
  font-size: var(--text-auth-title);
  font-weight: var(--font-weight-extrabold);
  line-height: var(--leading-tight);
  color: #1a2035;
}
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.auth-link-btn {
  border: 0;
  background: transparent;
  color: #4b5a86;
  font-size: var(--text-sm);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 0;
}
.auth-link-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.auth-password-wrap {
  position: relative;
}
.auth-password-wrap .auth-input {
  padding-right: 46px;
}
.auth-eye-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #9ea8c4;
  font-size: var(--text-xl);
  cursor: pointer;
  line-height: var(--leading-none);
}
.form-group .auth-label {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-bold);
  color: #5a6380;
  text-transform: uppercase;
  letter-spacing: var(--letter-label);
}
.form-group .auth-input {
  width: 100%;
  background: #f4f6fb;
  border: 1.5px solid #dde1ee;
  border-radius: 6px;
  padding: 11px 14px;
  font-size: var(--text-base);
  font-weight: var(--font-weight-normal);
  color: #1a2035;
  margin-top: 0;
  margin-bottom: 0;
  outline: none;
}
.form-group .auth-input:focus {
  border-color: #333f64;
  box-shadow: 0 0 0 3px rgba(51, 63, 100, 0.1);
  background: #fff;
}
.form-group .auth-input.has-error,
.field input.has-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
  background: #fff5f5 !important;
}
.auth-extras {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: -2px;
}
.auth-remember { display: flex; align-items: center; gap: 6px; }
.auth-remember {
  font-size: var(--text-sm);
  color: #5a6380;
  user-select: none;
}
.auth-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #333f64;
}
.auth-forgot-link {
  font-size: var(--text-sm);
  color: #333f64;
  text-decoration: none;
  white-space: nowrap;
}
.auth-forgot-link:hover { color: #fc3f1d; }
.auth-main-btn {
  width: 100%;
  border: 0;
  border-radius: 5px;
  padding: 14px 20px;
  color: #fff;
  font-weight: var(--font-weight-extralight);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--letter-wide);
  background: linear-gradient(180deg, #6f86c0 0%, #4e659e 50%, #334979 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 0 rgba(31, 43, 73, 0.18);
  cursor: pointer;
  margin-top: 15px;
}

@media (min-width: 769px) {
  .auth-main-btn {
    padding-top: 19px;
    padding-bottom: 19px;
  }
}
.auth-main-btn:hover {
  background: linear-gradient(180deg, #7b91c8 0%, #5870a8 50%, #3b5283 100%);
}
.auth-main-btn:active {
  background: linear-gradient(180deg, #324878 0%, #4e659e 100%);
}
.auth-main-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  filter: grayscale(.15);
}
.btn-full { width: 100%; }
.oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: #9aa0b8;
  font-size: var(--text-sm);
  text-align: center;
}
.oauth-divider::before,
.oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #d6dcec;
}
.oauth-buttons {
  display: flex;
  gap: 8px;
}
.oauth-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #d5dbeb;
  border-radius: 5px;
  padding: 10px 8px;
  text-decoration: none;
  color: #1a2035;
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  background: #f4f6fb;
  transition: background .15s, border-color .15s;
}
.oauth-btn-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  flex-shrink: 0;
}
.oauth-btn-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}
.oauth-btn:hover { background: #fff; border-color: #333f64; }
.auth-switch {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e7eaf3;
  font-size: var(--text-md);
  color: #64748b;
  text-align: center !important;
}
.auth-switch a {
  color: rgb(51, 63, 100);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
}

.auth-toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 5000;
  max-width: min(92vw, 420px);
  padding: 12px 14px;
  background: #333f64;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(24, 34, 64, 0.28);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease;
}
.auth-toast.show {
  opacity: 1;
  transform: translateY(0);
}
.auth-toast.auth-toast--error {
  background: #b91c1c;
  box-shadow: 0 8px 24px rgba(127, 29, 29, 0.35);
}

.welcome-onboarding {
  max-width: none;
  margin: 0;
}
.welcome-layout {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.welcome-layout-header {
  flex: 0 0 auto;
}
.welcome-layout-header h2 {
  /* ~browser default h2 top margin (was removed with margin:0 during typography pass) */
  margin: 0.83em 0 0;
  font-size: var(--text-display);
  font-weight: var(--font-weight-extrabold);
  line-height: var(--leading-tight);
  color: #1f2b4a;
}
.welcome-layout-header > p {
  margin: 8px 0 0;
  font-size: var(--text-base);
  line-height: var(--leading-body);
  max-width: 760px;
}
.welcome-layout-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: var(--layout-app-card-pad-inline);
}
.welcome-layout-footer {
  flex: 0 0 auto;
  margin-top: 12px;
}
.page-hero h2 {
  margin: 0;
  font-size: var(--text-display);
  font-weight: var(--font-weight-extrabold);
  line-height: var(--leading-tight);
  color: #1f2b4a;
}
.page-hero p {
  margin: 8px 0 0;
  color: #7b88ab;
  font-size: var(--text-base);
  line-height: var(--leading-body);
  max-width: 42rem;
}
.welcome-step-block {
  margin: 16px 0;
}
.welcome-step-block h3 {
  margin: 0 0 8px;
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-normal);
  color: #1f2b4a;
}
.welcome-step-block p {
  margin: 0;
  max-width: 760px;
  font-size: var(--text-base);
  line-height: var(--leading-body);
}
.welcome-social-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.social-card {
  min-height: 220px;
  border: 1px solid #d4e2f6;
  border-radius: 6px;
  background: #fff;
  position: relative;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  color: #1f2b4a;
  overflow: hidden;
}
.social-card::after {
  content: none;
}
.social-card-media {
  min-height: 130px;
  position: relative;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  color: #fff;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.social-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(14, 24, 45, 0.08) 0%, rgba(10, 17, 33, 0.58) 100%);
  pointer-events: none;
}
.social-card-media > * {
  position: relative;
  z-index: 1;
}
.social-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.92);
  padding: 1px;
  overflow: hidden;
}
.social-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.social-card strong {
  font-size: var(--text-base);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
}
.social-head-status {
  margin-top: 8px;
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: var(--letter-tight);
}
.social-status-available {
  color: #23b26b;
}
.social-status-unavailable {
  color: #98a2b8;
  cursor: help;
}
.social-card-body {
  margin-top: 0;
  background: #fff;
  border-top: 1px solid #e8edf8;
  padding: 9px 10px 12px;
}
.social-card-body p {
  margin: 8px 0 14px;
  font-size: var(--text-md);
  color: #384767;
  line-height: var(--leading-normal);
}
.social-connect-btn {
  width: 100%;
  margin-top: 0;
  padding-top: 11px;
  padding-bottom: 11px;
  font-size: var(--text-2xs);
}
.social-card-telegram .social-card-media { background-image: url("/assets/social-bg-telegram.png"); }
.social-card-vk .social-card-media { background-image: url("/assets/social-bg-vk.png"); }
.social-card-ok .social-card-media { background-image: url("/assets/social-bg-ok.png"); }
.social-card-tenchat .social-card-media { background-image: url("/assets/social-bg-tenchat.png"); }
.social-card-dzen .social-card-media { background-image: url("/assets/social-bg-dzen.png"); }
.social-card-max .social-card-media { background-image: url("/assets/social-bg-max.png"); }
.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.welcome-actions .auth-main-btn {
  width: auto;
  margin-top: 0;
}
.btn-tone-light {
  border: 0;
  color: #2e406c;
  background: linear-gradient(0deg, rgb(207, 214, 231), rgb(243, 244, 249));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 1px 0 rgba(31, 43, 73, 0.12);
}
.btn-tone-light:hover {
  background: linear-gradient(0deg, rgb(243, 244, 249), rgb(207, 214, 231));
}
.btn-tone-light:active {
  background: linear-gradient(0deg, rgb(207, 214, 231), rgb(243, 244, 249));
}
.btn-tone-blue {
  border: 0;
  color: #fff;
  background: linear-gradient(0deg, rgb(41, 51, 80), rgb(112, 130, 182));
}
.btn-tone-blue:hover {
  background: linear-gradient(0deg, rgb(112, 130, 182), rgb(41, 51, 80));
}
.btn-tone-blue:active {
  background: linear-gradient(0deg, rgb(41, 51, 80), rgb(112, 130, 182));
}
.btn-tone-red {
  border: 0;
  color: #fff;
  background: linear-gradient(0deg, rgb(166, 26, 1), rgb(253, 101, 74));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 0 rgba(88, 22, 22, 0.15);
}
.btn-tone-red:hover {
  background: linear-gradient(0deg, rgb(253, 101, 74), rgb(166, 26, 1));
}
.btn-tone-red:active {
  background: linear-gradient(0deg, rgb(166, 26, 1), rgb(253, 101, 74));
}

/* Full-viewport slide-up panel (соцсети, мастера подключения) */
.app-fullsheet {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}
.app-fullsheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 50, 0.35);
  pointer-events: auto;
}
.app-fullsheet-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  max-height: 100%;
  background: var(--bg);
  box-shadow: 0 -12px 48px rgba(26, 32, 53, 0.14);
  pointer-events: auto;
  animation: app-fullsheet-rise 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes app-fullsheet-rise {
  from {
    transform: translateY(100%);
    opacity: 0.96;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.app-fullsheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px var(--layout-app-card-pad-x, 18px);
  min-height: var(--topbar-height);
  box-sizing: border-box;
  border: 1px solid #e6eaf4;
  border-bottom: 1px solid #e6eaf4;
  border-radius: 0;
  background: #fff;
  box-shadow: 0 1px 0 rgba(26, 32, 53, 0.04);
}
.app-fullsheet-head-titles {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}
.app-fullsheet-head-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.app-fullsheet-head-logo {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: block;
  object-fit: contain;
}
.app-fullsheet-head h2 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
  color: var(--text);
}
.dzen-channel-label-row {
  margin-bottom: 12px !important;
}
.dzen-channel-label-k {
  color: #384767;
}
.app-fullsheet-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #384767;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.app-fullsheet-close:hover {
  background: rgba(56, 71, 103, 0.08);
}
.app-fullsheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px var(--layout-app-card-pad-x, 18px) 24px;
  -webkit-overflow-scrolling: touch;
  background: var(--bg);
}
.app-fullsheet-body.app-fullsheet-body--dzen {
  display: flex;
  flex-direction: column;
  /* Как у .auth-shell-inner по вертикали: больше воздуха сверху/снизу */
  padding: clamp(22px, 4vw, 30px) var(--layout-app-card-pad-inline, 18px) clamp(26px, 5vw, 36px);
}
.app-fullsheet-body--dzen #dzen-fullsheet-steps {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#dzen-fullsheet-steps.dzen-steps-layout-center {
  justify-content: center;
  align-items: center;
}
/* Дзен-мастер: белая карточка на фоне --bg (как главное окно кабинета) */
.dzen-wizard-card.card {
  width: 100%;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
  box-shadow: 0 8px 32px rgba(51, 63, 100, 0.1);
  border: 1px solid #e6eaf4;
  border-radius: 12px;
  padding: clamp(22px, 4vw, 30px) var(--card-pad-inline) clamp(24px, 4vw, 32px);
}
.dzen-wizard-card h3 {
  margin: 0 0 8px;
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-normal);
  color: var(--text);
}
.dzen-wizard-card .muted {
  margin: 0 0 12px;
  max-width: 760px;
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--text2);
}
.dzen-wizard-card .dzen-step-instr strong {
  color: var(--text);
  font-weight: var(--font-weight-bold, 700);
}
.dzen-wizard-card blockquote.dzen-meta-sample {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-left: 3px solid #c5d0e8;
  background: #fafbff;
  border-radius: 0 8px 8px 0;
  box-sizing: border-box;
}
.dzen-wizard-card blockquote.dzen-meta-sample code {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
  color: #1f2b4a;
  white-space: pre-wrap;
}
/* Интервалы между полями: блоки формы в .auth-form (gap: 12px), внутри — .form-group (gap: 6px). */
.dzen-prof-inline-hint {
  margin: -4px 0 8px !important;
  font-size: var(--text-md);
  line-height: var(--leading-body);
}
.dzen-hint-example {
  font-size: var(--text-md);
  margin-top: 0 !important;
}
.dzen-hint-example a {
  color: #2d4a8c;
  word-break: break-all;
}
.dzen-inline-channel-link {
  color: #2d4a8c;
  font-weight: var(--font-weight-semibold, 600);
  word-break: break-all;
}
body.app-fullsheet-open {
  overflow: hidden;
}
.dzen-url-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 14px;
}
.dzen-url-row code {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #dce2f0;
  background: #fafbff;
  font-size: 13px;
  word-break: break-all;
  color: #1f2b4a;
}
.dzen-copy-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 16px;
  padding: 10px 12px;
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid #dce2f0;
  background: #fafbff;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
.dzen-copy-field:hover,
.dzen-copy-field:focus-visible {
  border-color: #2d4a8c;
  box-shadow: 0 0 0 3px rgba(45, 74, 140, 0.1);
  outline: none;
}
.dzen-copy-field__text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  word-break: break-all;
  color: #1f2b4a;
  line-height: 1.35;
}
.dzen-copy-field__trail {
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.dzen-copy-field__tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  padding: 5px 10px;
  border-radius: 6px;
  background: #1f2937;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 2;
}
.dzen-copy-field__tooltip.is-visible {
  opacity: 1;
}
.dzen-copy-field__icons {
  position: relative;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: #3d4f6f;
}
.dzen-copy-field__icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: block;
  transition: opacity 0.2s ease;
}
.dzen-copy-field__icon--check {
  opacity: 0;
}
.dzen-copy-field.is-copied .dzen-copy-field__icon--copy {
  opacity: 0;
}
.dzen-copy-field.is-copied .dzen-copy-field__icon--check {
  opacity: 1;
}
.dzen-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.dzen-logo-dropzone {
  position: relative;
  display: block;
  cursor: pointer;
  margin: 6px 0 0;
  padding: 16px 14px;
  border-radius: 10px;
  border: 2px dashed #b8c6df;
  background: #fafbff;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
  outline: none;
}
.dzen-logo-dropzone:hover,
.dzen-logo-dropzone:focus-visible {
  border-color: #2d4a8c;
  background: #f0f4fc;
  box-shadow: 0 0 0 3px rgba(45, 74, 140, 0.12);
}
.dzen-logo-dropzone--drag {
  border-color: #2d4a8c;
  background: #e8eef9;
}
.dzen-logo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  margin-bottom: 8px;
}
.dzen-logo-preview--has-img {
  margin-bottom: 0;
}
.dzen-logo-preview-frame {
  position: relative;
  display: inline-block;
  line-height: 0;
  border-radius: 8px;
  background: #fafbff;
  box-shadow: inset 0 0 0 1px rgba(220, 226, 240, 0.9);
}
.dzen-logo-preview-frame img {
  display: block;
  border-radius: 8px;
  object-fit: contain;
  max-width: 96px;
  max-height: 96px;
  border: 1px solid #dce2f0;
  background: transparent;
}
.dzen-logo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.62);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.88;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.dzen-logo-remove:hover,
.dzen-logo-remove:focus-visible {
  background: rgba(15, 23, 42, 0.85);
}
@media (hover: hover) and (pointer: fine) {
  .dzen-logo-remove {
    opacity: 0;
  }
  .dzen-logo-preview-frame:hover .dzen-logo-remove,
  .dzen-logo-remove:focus-visible {
    opacity: 1;
  }
}
.dzen-logo-preview--empty {
  min-height: 56px;
}
.dzen-logo-dropzone-hint {
  margin: 0 !important;
  text-align: center;
}
.dzen-logo-dropzone:has(.dzen-logo-preview--has-img) {
  padding-top: 12px;
  padding-bottom: 12px;
}
/* Кнопки мастера: на всю ширину карточки; две в ряд — по 50 % (исключения — отдельные ряды вроде .dzen-url-row). */
.dzen-wizard-card .dzen-flow-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  width: 100%;
  gap: 10px;
  margin-top: 0;
  box-sizing: border-box;
}
.dzen-wizard-card .dzen-flow-actions .auth-main-btn {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}
.dzen-wizard-card .dzen-flow-actions > .auth-main-btn:only-child {
  flex: 1 1 100%;
}

.dzen-wizard-card.dzen-profile-screen .dzen-profile-logo-wrap {
  margin: 12px 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  border-radius: 8px;
  border: 1px dashed #c8d4ea;
  background: #fafbff;
  padding: 12px;
  box-sizing: border-box;
}
.dzen-wizard-card.dzen-profile-screen .dzen-profile-logo-wrap--empty {
  text-align: center;
  font-size: var(--text-md);
  padding: 16px 12px;
}
.dzen-profile-logo {
  max-width: 100%;
  max-height: 120px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}
.dzen-profile-fetch-hint {
  font-size: var(--text-md);
  margin-bottom: 8px !important;
  color: #9a6b2a !important;
}
.dzen-channel-label-block {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.dzen-channel-label-text {
  flex: 1 1 auto;
  min-width: 0;
}
.dzen-channel-logo-thumb {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #dce2f0;
  background: #f4f7fc;
}
.dzen-channel-logo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dzen-channel-desc-preview {
  margin: 6px 0 0 !important;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
}

.dzen-status-err-detail {
  display: inline-block;
  margin-top: 8px;
  font-size: var(--text-md);
  color: #5c6b8a;
  max-width: 100%;
  word-break: break-word;
}

.offer-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: rgba(20, 30, 50, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.offer-modal {
  width: min(700px, 100%);
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e4e8f2;
  box-shadow: 0 14px 36px rgba(20, 30, 50, 0.25);
  padding: 18px;
}
.offer-modal h3 {
  margin: 0 0 10px;
  font-size: var(--text-lg);
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-normal);
  color: #1f2b4a;
}
.offer-scroll {
  max-height: 260px;
  overflow: auto;
  border: 1px solid #dce2f0;
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0 12px;
  background: #fafbff;
  font-size: var(--text-md);
  line-height: var(--leading-body);
}
.offer-doc-slider {
  overflow: hidden;
}
.offer-doc-track {
  display: flex;
  width: 200%;
  transform: translateX(0);
  transition: transform .25s ease;
}
.offer-doc-track.show-policy {
  transform: translateX(-50%);
}
.offer-doc-pane {
  width: 50%;
  padding-right: 6px;
}
.offer-check {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  color: #384767;
  font-size: var(--text-md);
}
.offer-check input {
  margin-top: 0;
}
.offer-reject-btn {
  display: block;
  margin: 8px auto 0;
}

@media (max-width: 420px) {
  .oauth-buttons { justify-content: center; }
  .oauth-btn { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; gap: 0; }
  .oauth-btn > span:not(.oauth-btn-icon) { display: none; }
  .welcome-social-grid { grid-template-columns: repeat(1, minmax(120px, 1fr)); }
}

/* Breakpoints requested: 1400 / 1024 / 768 / 360 */
@media (max-width: 1400px) {
  .auth-shell { width: 500px; }
}

@media (max-width: 1024px) {
  .auth-mode .content { padding: 24px 14px; }
  .auth-shell { width: 470px; max-width: calc(100% - 24px); }
  .auth-logo { width: 154px; }
  .auth-title { margin-bottom: 16px; }
}

@media (max-width: 768px) {
  .auth-mode .content { padding: 16px 10px; }
  .auth-shell { width: 100%; max-width: 520px; padding: 8px; border-radius: 12px; }
  .auth-shell-inner { padding: 24px 36px 18px; border-radius: 8px; }
  .auth-logo { width: 138px; margin-bottom: 12px; }
  .auth-main-btn { margin-top: 10px; }
  .welcome-layout-header h2 {
    margin: 0;
  }
  .welcome-layout-main {
    padding-right: 0;
  }
  .welcome-social-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}

@media (max-width: 420px) {
  .auth-mode .content { padding: 10px; }
  .auth-shell { width: calc(100vw - 20px); max-width: none; }
}

@media (max-width: 360px) {
  .auth-mode .content { padding: 10px; }
  .auth-shell { width: calc(100vw - 20px); max-width: none; padding: 6px; }
  .auth-shell-inner { padding: 14px 36px 12px; }
  .auth-logo { width: 120px; margin-bottom: 10px; }
  .auth-title { margin-bottom: 12px; }
  .form-group .auth-input { padding: 9px 10px; font-size: var(--text-md); }
  .auth-switch { font-size: var(--text-sm); margin-top: 12px; }
  .auth-toast { top: 8px; right: 8px; left: 8px; max-width: none; }
}
