/* Телефон v14 (phone.js): смесь эскизов A + B + C. Поверх mobile.css (поля, цели касания, правка листа над клавиатурой);
   нижняя панель, экраны «Документы», «Профиль», редактор, мастер и чат ✦ ИИ — здесь. Только переменные оформления сайта. */
@media (max-width: 899px) {
  body.phone {
    --ph-tabs: calc(66px + env(safe-area-inset-bottom, 0px));
    --mobile-dock-space: var(--ph-tabs);
    --ph-top: calc(58px + env(safe-area-inset-top, 0px));
    --ph-gut: 16px;
    --ph-card: var(--panel);
    --ph-r: 18px;
    --ph-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 18px -10px rgba(16, 24, 40, .18);
  }
  /* редактор: прокручивается страница (лист окошком сверху, поля ниже); прокрутка — у html, иначе «липкие» вкладки полей не держатся */
  html.ph-scroll { height: auto; min-height: 100%; overflow-x: hidden; overflow-y: auto; }
  html.ph-scroll body { height: auto; min-height: 100%; overflow: visible; }

  /* — что видно на каком экране — */
  body.phone #nav, body.phone #lp-scrim, body.phone .mobile-back, body.phone #mobile-scrim { display: none !important; }
  body.phone:not([data-ph-screen="list"]) #left { display: none !important; }
  body.phone:not([data-ph-tab="docs"]) #editor, body.phone[data-ph-screen="home"] #editor, body.phone[data-ph-screen="list"] #editor { display: none !important; }
  body.phone:not([data-ph-screen="editor"]) #right { display: none !important; }
  body.phone[data-ph-tab="docs"] #page-host, body.phone[data-ph-screen="menu"] #page-host { display: none !important; }
  body.phone .ph-screen[hidden], body.phone .ph-bar[hidden], body.phone #ph-dl[hidden], body.phone #ph-done[hidden], body.phone #ph-lawask[hidden], body.phone #ph-prev[hidden] { display: none !important; }

  /* — нижняя панель (A): пять вкладок, ✦ ИИ — круглая синяя посередине — */
  body.phone #mobile-dock.ph-tabs {
    position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; display: block; max-width: none; margin: 0; gap: 0;
    padding: 0 max(6px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(6px, env(safe-area-inset-left, 0px));
    background: color-mix(in srgb, var(--panel) 92%, transparent); border-top: 1px solid var(--line);
    -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px); box-shadow: none; pointer-events: auto;
  }
  body.phone #mobile-dock .mdk-cap {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; height: 66px; padding: 0; margin: 0; border: 0; border-radius: 0;
    background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; overflow: visible;
  }
  body.phone #mobile-dock .mdk-cap button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; min-width: 0; min-height: 0; height: 62px;
    padding: 0 0 8px; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: 0; box-shadow: none;
  }
  body.phone #mobile-dock .mdk-cap button > svg { width: 26px; height: 26px; filter: grayscale(1); opacity: .55; transition: filter .2s, opacity .2s, transform .2s; }
  body.phone #mobile-dock .mdk-cap button[aria-current="page"] { color: var(--sel); }
  body.phone #mobile-dock .mdk-cap button[aria-current="page"] > svg { filter: none; opacity: 1; transform: translateY(-1px); }
  body.phone #mobile-dock .mdk-cap span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
  body.phone #mobile-dock .ph-ai i {
    position: absolute; top: -20px; left: 50%; display: grid; place-items: center; width: 56px; height: 56px; margin-left: -28px; border-radius: 50%;
    background: linear-gradient(145deg, color-mix(in srgb, var(--sel) 80%, #7c5cff), var(--sel)); color: #fff;
    box-shadow: 0 8px 22px -6px color-mix(in srgb, var(--sel) 70%, transparent), 0 0 0 4px var(--panel);
  }
  body.phone #mobile-dock .ph-ai i svg { width: 28px; height: 28px; }
  body.phone #mobile-dock .ph-ai[aria-current="page"] i { box-shadow: 0 8px 22px -6px color-mix(in srgb, var(--sel) 70%, transparent), 0 0 0 4px var(--panel), 0 0 0 6px color-mix(in srgb, var(--sel) 35%, transparent); }
  body.phone.pf-miss #mobile-dock [data-mobile-tab="profile"]::after { content: '!'; position: absolute; top: 4px; left: calc(50% + 6px); display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
    background: #e5484d; color: #fff; font-size: 11px; font-weight: 800; line-height: 1; box-shadow: 0 0 0 2px var(--panel); }
  body.phone.ph-wiz-on #mobile-dock, body.phone.mobile-text-edit #mobile-dock { display: none; }

  /* — общие детали экранов — */
  body.phone .ph-screen {
    position: fixed; z-index: 20; inset: 0 0 var(--ph-tabs) 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: calc(14px + env(safe-area-inset-top, 0px)) var(--ph-gut) 28px; background: var(--canvas);
  }
  .ph-h { padding: 6px 2px 14px; }
  .ph-h h1 { margin: 0; font-size: 32px; line-height: 1.12; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
  .ph-h p { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
  .ph-card { padding: 16px; border-radius: var(--ph-r); background: var(--ph-card); box-shadow: var(--ph-shadow); }
  .ph-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 18px; border-radius: 16px; border: 1px solid var(--line);
    background: var(--panel); color: var(--text); font-size: 16px; font-weight: 650; }
  .ph-btn.pri { border-color: transparent; background: var(--sel); color: #fff; box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--sel) 80%, transparent); }
  .ph-btn:disabled { opacity: .45; }
  .ph-btn svg { width: 20px; height: 20px; flex: none; }
  .ph-link { min-height: 44px; border: 0; background: none; color: var(--sel); font-size: 15px; font-weight: 600; }
  .ph-empty { margin: 4px 2px 0; font-size: 14px; color: var(--muted); }
  .ph-search { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 14px; border-radius: 14px; background: var(--ph-card); box-shadow: var(--ph-shadow); color: var(--muted); }
  .ph-search svg { width: 20px; height: 20px; flex: none; }
  .ph-search input { flex: 1; min-width: 0; min-height: 0 !important; height: 48px; border: 0; background: none; outline: none; color: var(--text); }
  .ph-search input::placeholder { color: var(--muted); }

  /* — «Документы» (A) — */
  .ph-home-in { display: grid; gap: 16px; padding-top: 16px; }
  .ph-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .ph-quick button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 104px; padding: 12px 6px; border: 0; border-radius: var(--ph-r);
    background: var(--ph-card); box-shadow: var(--ph-shadow); color: var(--text); font-size: 14.5px; }
  .ph-quick button span svg { width: 38px; height: 38px; }
  .ph-quick b { font-weight: 650; }
  .ph-allkinds { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-top: -6px; padding: 0 14px; border: 0; border-radius: 14px; background: none; color: var(--sel); font-size: 15px; font-weight: 600; }
  .ph-allkinds span { flex: 1; text-align: left; }
  .ph-allkinds > svg:last-child { width: 18px; height: 18px; }
  .ph-sec h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 2px 10px; font-size: 20px; font-weight: 750; color: var(--text); }
  .ph-sec h2 small { margin-right: auto; font-size: 14px; font-weight: 600; color: var(--muted); }
  .ph-sec h2 button { display: inline-flex; align-items: center; gap: 2px; min-height: 36px; padding: 0 2px; border: 0; background: none; color: var(--sel); font-size: 14.5px; font-weight: 600; }
  .ph-sec h2 button svg { width: 16px; height: 16px; }
  .ph-docs { display: grid; gap: 10px; }
  .ph-doc { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 84px; padding: 10px 12px 10px 10px; border: 0; border-radius: var(--ph-r); background: var(--ph-card);
    box-shadow: var(--ph-shadow); color: var(--text); text-align: left; }
  .ph-doc > svg:last-child { width: 18px; height: 18px; flex: none; color: var(--muted); }
  .ph-doc-t { display: grid; gap: 3px; flex: 1; min-width: 0; }
  .ph-doc-t b { font-size: 16px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ph-doc-t small { font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .ph-doc-t em { display: inline-flex; align-items: center; gap: 5px; font-style: normal; font-size: 13px; color: var(--muted); }
  .ph-doc-t em svg { width: 15px; height: 15px; }
  .ph-thumb { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 52px; height: 66px; padding: 7px 7px 0; border-radius: 6px;
    background: #fff; box-shadow: 0 0 0 1px rgba(16, 24, 40, .08), 0 4px 10px -6px rgba(16, 24, 40, .35); }
  .ph-thumb img { width: 20px; height: 20px; object-fit: contain; }
  .ph-thumb i { display: block; width: 100%; height: 2.5px; border-radius: 2px; background: #d9dde5; }
  .ph-thumb i:nth-child(2) { width: 70%; background: #9aa3b2; }
  .ph-thumb i:last-child { width: 55%; }
  .ph-aicard { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 78px; padding: 12px 16px; border: 0; border-radius: var(--ph-r); color: var(--text); text-align: left;
    background: linear-gradient(135deg, color-mix(in srgb, var(--sel) 14%, var(--panel)), color-mix(in srgb, #7c5cff 12%, var(--panel))); box-shadow: var(--ph-shadow); }
  .ph-aicard-ic { display: grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 16px; background: var(--panel); }
  .ph-aicard > span:nth-child(2) { display: grid; gap: 2px; flex: 1; }
  .ph-aicard b { font-size: 16.5px; font-weight: 700; color: var(--sel); }
  .ph-aicard small { font-size: 14px; color: var(--muted); }
  .ph-aicard > svg:last-child { width: 20px; height: 20px; color: var(--sel); }

  /* — «Все документы»: прежний список на весь экран — */
  body.phone[data-ph-screen="list"] #left {
    display: flex !important; flex-direction: column; position: fixed; z-index: 20; inset: 0 0 var(--ph-tabs) 0; width: auto; max-width: none; margin: 0; border-radius: 0;
    padding-top: env(safe-area-inset-top, 0px); background: var(--canvas); box-shadow: none; transform: none;
  }
  body.phone[data-ph-screen="list"] #left #left-sec { display: none; }
  body.phone[data-ph-screen="list"] #left #layers { display: block; }

  /* — редактор (A): лист окошком сверху, поля ниже, «Скачать» закреплена — */
  body.phone .ph-bar { position: fixed; z-index: 40; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px; height: var(--ph-top);
    padding: env(safe-area-inset-top, 0px) 8px 0; background: color-mix(in srgb, var(--canvas) 90%, transparent);
    -webkit-backdrop-filter: saturate(1.5) blur(16px); backdrop-filter: saturate(1.5) blur(16px); }
  .ph-back { display: inline-flex; align-items: center; gap: 2px; min-width: 44px; min-height: 44px; padding: 0 8px; border: 0; border-radius: 12px; background: none; color: var(--sel); font-size: 16px; font-weight: 600; }
  .ph-back svg { width: 24px; height: 24px; flex: none; }
  .ph-more { min-width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: none; color: var(--sel); }
  .ph-more svg { width: 26px; height: 26px; }
  .ph-bt { display: grid; flex: 1; min-width: 0; text-align: center; }
  .ph-bt b { font-size: 17px; font-weight: 700; color: var(--text); }
  .ph-bt small { display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ph-bt small svg { width: 15px; height: 15px; color: #1f9d55; }
  body.phone[data-ph-screen="done"] .ph-bt small { color: #1f9d55; font-weight: 600; }

  body.phone[data-ph-screen="editor"] #editor {
    position: relative; inset: auto; display: block; height: auto; margin: calc(var(--ph-top) + 4px) var(--ph-gut) 0; padding: 0; border: 0; border-radius: var(--ph-r);
    background: color-mix(in srgb, var(--text) 5%, var(--canvas)); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden;
  }
  body.phone[data-ph-screen="editor"] #editor :is(.ed-bar, .ed-zoom, .ed-warn, .ed-fmt) { display: none !important; }
  body.phone[data-ph-screen="editor"] #editor .ed-scroll { height: clamp(300px, 44vh, 380px); overflow: hidden !important; padding: 14px 0; pointer-events: none; display: flex; justify-content: center; }
  body.phone[data-ph-screen="editor"] #editor .ed-sizer { margin: 0 auto; }
  #ph-prev { position: absolute; inset: 0; z-index: 3; display: flex; align-items: flex-end; justify-content: center; padding: 0 0 12px; border: 0; border-radius: inherit; background: none; min-height: 0; }
  .ph-prev-tip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 14px; border-radius: 999px; background: color-mix(in srgb, var(--text) 78%, transparent); color: var(--canvas);
    font-size: 13.5px; font-weight: 600; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .ph-prev-tip svg { width: 16px; height: 16px; }
  body.phone[data-ph-screen="editor"] #right {
    display: block !important; position: static; inset: auto; width: auto; height: auto; max-height: none; margin: 14px var(--ph-gut) 0; padding: 0 0 calc(var(--ph-tabs) + 96px);
    border: 0; border-radius: 0; background: none; box-shadow: none; transform: none; overflow: visible;
  }
  body.phone[data-ph-screen="editor"] #right .mobile-sheet-head { display: none; }
  body.phone[data-ph-screen="editor"] #right #props { overflow: visible; max-height: none; padding: 0; }
  body.phone[data-ph-screen="editor"] #right .pp-tabs { position: sticky; z-index: 6; top: calc(var(--ph-top) + 4px); display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; margin: 0 0 14px; padding: 4px;
    border-radius: 14px; background: var(--input); box-shadow: 0 6px 16px -12px rgba(16, 24, 40, .4); }
  body.phone[data-ph-screen="editor"] #right .pp-tab { flex-direction: row; justify-content: center; min-height: 40px; padding: 0 4px; border-radius: 10px; font-size: 13.5px; font-weight: 650; color: var(--muted); }
  body.phone[data-ph-screen="editor"] #right .pp-tab svg { display: none; }
  body.phone[data-ph-screen="editor"] #right .pp-tab.on { background: var(--panel); color: var(--sel); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
  body.phone .ph-has-mic { position: relative; }
  body.phone .ph-has-mic > :is(input, textarea) { padding-right: 52px !important; }
  body.phone .ph-fmic.voice-btn { position: absolute; right: 6px; bottom: 6px; width: 40px; height: 40px; min-width: 40px; min-height: 40px; border-radius: 12px; }
  body.phone .pp-fc.ph-has-mic .ph-fmic.voice-btn { bottom: 10px; right: 10px; }
  #ph-dl { position: fixed; z-index: 45; left: var(--ph-gut); right: var(--ph-gut); bottom: calc(var(--ph-tabs) + 10px); display: flex; gap: 2px; border-radius: 18px;
    box-shadow: 0 12px 28px -12px color-mix(in srgb, var(--sel) 70%, transparent); }
  #ph-dl button { min-height: 58px; border: 0; background: var(--sel); color: #fff; }
  .ph-dl-main { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 18px 4px 4px 18px; font-size: 17px; font-weight: 700; }
  .ph-dl-main svg { width: 22px; height: 22px; }
  .ph-dl-main span { display: grid; text-align: left; line-height: 1.15; }
  .ph-dl-main small { font-size: 12.5px; font-weight: 600; opacity: .8; }
  .ph-dl-more { width: 60px; border-radius: 4px 18px 18px 4px; }
  .ph-dl-more svg { width: 22px; height: 22px; }
  body.phone.mobile-text-edit #ph-dl, body.phone.ai-open #ph-dl { display: none; }

  /* — «Лист» и «Документ готов» (C): лист по ширине — */
  body.phone:is([data-ph-screen="sheet"], [data-ph-screen="done"]) #editor { top: var(--ph-top); bottom: var(--ph-tabs); left: 0; right: 0; border-radius: 0; }
  body.phone:is([data-ph-screen="sheet"], [data-ph-screen="done"]) #editor .ed-bar { display: none !important; }
  body.phone[data-ph-screen="done"] #editor { bottom: calc(var(--ph-tabs) + 178px); }
  body.phone[data-ph-screen="done"] #editor .ed-zoom { display: none !important; }
  #ph-done { position: fixed; z-index: 45; left: 0; right: 0; bottom: var(--ph-tabs); display: grid; gap: 10px; padding: 12px var(--ph-gut) 6px; background: var(--canvas);
    border-top: 1px solid var(--line); }
  #ph-done > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  #ph-done .ph-btn svg { width: 20px; height: 20px; }

  /* — «Профиль» — */
  .ph-who { display: flex; align-items: center; gap: 14px; }
  .ph-who-av { display: grid; place-items: center; width: 60px; height: 60px; flex: none; border-radius: 50%; overflow: hidden; background: var(--input); }
  .ph-who-av img { width: 100%; height: 100%; object-fit: cover; }
  .ph-who > span:last-child { display: grid; gap: 2px; min-width: 0; }
  .ph-who b { font-size: 19px; font-weight: 700; }
  .ph-who small { font-size: 14.5px; color: var(--muted); }
  .ph-guest { display: grid; gap: 10px; }
  .ph-guest b { font-size: 18px; }
  .ph-guest p { margin: 0; font-size: 14.5px; color: var(--muted); }
  .ph-guest .dc-btn, .ph-wz-gate .dc-btn { min-height: 50px; justify-content: center; border-radius: 14px; font-size: 16px; }
  .ph-list { display: grid; margin-top: 16px; border-radius: var(--ph-r); background: var(--ph-card); box-shadow: var(--ph-shadow); overflow: hidden; }
  .ph-row { display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); text-align: left; }
  .ph-row:last-child { border-bottom: 0; }
  .ph-row > svg:first-child { width: 28px; height: 28px; flex: none; }
  .ph-row > span { display: grid; gap: 2px; flex: 1; min-width: 0; }
  .ph-row b { font-size: 16px; font-weight: 600; }
  .ph-row small { font-size: 13.5px; color: var(--muted); }
  .ph-row > svg:last-child { width: 18px; height: 18px; color: var(--muted); flex: none; }
  .ph-bang { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #e5484d; color: #fff; font-style: normal; font-weight: 800; font-size: 13px; }
  .ph-out { width: 100%; min-height: 54px; margin-top: 16px; border: 0; border-radius: var(--ph-r); background: var(--ph-card); box-shadow: var(--ph-shadow); color: #e5484d; font-size: 16px; font-weight: 650; }

  /* — разделы из «Профиля» и закон: полоса «‹ Профиль» / «‹ Библиотека» сверху — */
  body.phone .ph-bar-lite { height: calc(52px + env(safe-area-inset-top, 0px)); }
  body.phone:is([data-ph-tab="profile"]:not([data-ph-screen="menu"]), [data-ph-screen="law"]) #page-host { padding-top: calc(56px + env(safe-area-inset-top, 0px)); }
  body.phone #page-host { bottom: 0; padding-bottom: calc(var(--ph-tabs) + 16px); }
  #ph-lawask { position: fixed; z-index: 45; left: var(--ph-gut); right: var(--ph-gut); bottom: calc(var(--ph-tabs) + 10px); display: flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 54px; border: 0; border-radius: 18px; background: var(--sel); color: #fff; font-size: 16px; font-weight: 700; box-shadow: 0 12px 28px -12px color-mix(in srgb, var(--sel) 70%, transparent); }
  #ph-lawask svg { width: 20px; height: 20px; }

  /* — «Законы»: библиотека; вкладки раздела не нужны — их заменила нижняя панель — */
  body.phone .lw-tabs { display: none !important; }
  body.phone[data-ph-screen="law"] :is(.lw-top, .lws-bar) { display: none; }   /* «‹ Библиотека» и «Спросить ИИ-юриста» — свои */
  body.phone[data-ph-screen="law"] .lws-desk { padding-bottom: 90px; }
  body.phone[data-ph-screen="tree"] .lw-tt h1 { font-size: 32px; font-weight: 800; letter-spacing: -.02em; }

  /* — ✦ ИИ (B): чат на весь экран, «Что сделаем?», поле с большим микрофоном — */
  body.phone[data-ph-tab="ai"] #page-host { padding: var(--ph-top) 0 0; overflow: hidden; display: flex; flex-direction: column; }
  body.phone[data-ph-tab="ai"] .lw { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  body.phone[data-ph-tab="ai"] .lw-top { display: none; }
  body.phone[data-ph-tab="ai"] .lw-main { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  body.phone[data-ph-tab="ai"] .lwc { display: flex !important; flex-direction: column; flex: 1; min-height: 0; margin: 0; border: 0; border-radius: 0; background: var(--canvas); box-shadow: none; overflow: hidden; }
  body.phone[data-ph-tab="ai"] .lwc-h { display: none; }
  body.phone[data-ph-tab="ai"] .lwc-feed { flex: 1; min-height: 0; overflow-y: auto; padding: 8px var(--ph-gut) 12px; overscroll-behavior: contain; }
  body.phone[data-ph-tab="ai"] .lwc-foot { position: static; flex: none; margin: 0; padding: 8px var(--ph-gut) calc(var(--ph-tabs) + 10px); border: 0; border-radius: 0; background: var(--canvas); box-shadow: none; }
  body.phone[data-ph-tab="ai"] .lwc-foot::after { display: none; }
  .ph-ai-brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding-left: 8px; }
  .ph-ai-brand img { width: 34px; height: 32px; object-fit: contain; }
  .ph-ai-brand div { display: grid; line-height: 1.15; }
  .ph-ai-brand b { font-size: 17px; font-weight: 750; }
  .ph-ai-brand small { font-size: 12.5px; color: var(--muted); }
  .ph-ai-new { min-width: 44px; min-height: 44px; border: 0; border-radius: 12px; background: none; color: var(--sel); }
  .ph-ai-new svg { width: 22px; height: 22px; }
  .ph-ava { display: grid; place-items: center; width: 40px; height: 40px; min-width: 40px; min-height: 40px; margin: 0 4px; padding: 0; border: 0; border-radius: 50%; overflow: hidden; background: var(--input); }
  .ph-ava img { width: 100%; height: 100%; object-fit: cover; }
  .ph-hello { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; padding: 12px 0 4px; text-align: center; }
  .ph-hero { position: relative; display: grid; place-items: center; width: 132px; height: 132px; margin: auto 0 18px; border-radius: 40px;
    background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--sel) 20%, var(--panel)), color-mix(in srgb, #7c5cff 14%, var(--canvas))); box-shadow: var(--ph-shadow); }
  .ph-hero > svg { width: 76px; height: 76px; }
  .ph-hero i { position: absolute; right: 14px; top: 12px; }
  .ph-hero i svg { width: 36px; height: 36px; }
  .ph-hello h2 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
  .ph-hello > p { margin: 6px 0 0; font-size: 15.5px; color: var(--muted); }
  .ph-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin-top: auto; padding-top: 26px; }
  .ph-chips button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 92px; padding: 10px 6px; border: 0; border-radius: var(--ph-r);
    background: var(--ph-card); box-shadow: var(--ph-shadow); color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.2; }
  .ph-chips button svg { width: 28px; height: 28px; }
  body.phone[data-ph-tab="ai"] .lwc-form { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 26px; background: var(--ph-card); box-shadow: var(--ph-shadow); border: 1px solid var(--line); }
  body.phone[data-ph-tab="ai"] .lwc-form .lwc-req { flex: 1; min-height: 44px !important; padding: 11px 0; border: 0; background: none; box-shadow: none; }
  body.phone[data-ph-tab="ai"] .lwc-form .voice-btn { width: 48px; height: 48px; min-width: 48px; border-radius: 50%; background: var(--sel); color: #fff !important; }
  body.phone[data-ph-tab="ai"] .lwc-form .voice-btn.on { background: #e5484d; }
  body.phone[data-ph-tab="ai"] .lwc-form .voice-btn svg { width: 22px; height: 22px; }
  body.phone[data-ph-tab="ai"] .lwc-form .lwc-send { width: 48px; height: 48px; min-width: 48px; border-radius: 50%; }
  body.phone[data-ph-tab="ai"] .lwc-form:has(.lwc-req:placeholder-shown) .lwc-send { display: none; }
  body.phone[data-ph-tab="ai"] .lwc-quota, body.phone[data-ph-tab="ai"] .lwc-kb { font-size: 12.5px; }

  /* — мастер нового документа (C) — */
  body.phone #ph-wiz { position: fixed; z-index: 70; inset: 0; display: flex; flex-direction: column; background: var(--canvas); padding-top: env(safe-area-inset-top, 0px); }
  body.phone #ph-wiz[hidden] { display: none; }
  .ph-wz-top { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; height: 56px; padding: 0 4px; }
  .ph-wz-top b { text-align: center; font-size: 17px; font-weight: 700; color: var(--text); }
  .ph-wz-prog { padding: 0 var(--ph-gut); }
  .ph-wz-prog small { font-size: 13.5px; font-weight: 600; color: var(--muted); }
  .ph-wz-prog div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
  .ph-wz-prog i { height: 6px; border-radius: 3px; background: var(--input); }
  .ph-wz-prog i.on { background: var(--sel); }
  .ph-wz-h { margin: 16px var(--ph-gut) 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
  .ph-wz-sub { margin: 4px var(--ph-gut) 0; font-size: 15px; color: var(--muted); }
  .ph-wz-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px var(--ph-gut) 20px; display: grid; align-content: start; gap: 14px; }
  .ph-wz-foot { display: grid; gap: 10px; padding: 10px var(--ph-gut) calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--canvas); }
  .ph-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .ph-kinds button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 132px; padding: 14px 8px; border: 2px solid transparent; border-radius: 20px;
    background: var(--ph-card); box-shadow: var(--ph-shadow); color: var(--text); }
  .ph-kinds button.on { border-color: var(--sel); background: color-mix(in srgb, var(--sel) 7%, var(--panel)); }
  .ph-kinds svg { width: 48px; height: 48px; }
  .ph-kinds b { font-size: 16.5px; font-weight: 700; }
  .ph-kinds small { font-size: 13px; color: var(--muted); }
  .ph-bodies { display: grid; gap: 10px; }
  .ph-bd { border-radius: var(--ph-r); background: var(--ph-card); box-shadow: var(--ph-shadow); border: 2px solid transparent; overflow: hidden; }
  .ph-bd.on { border-color: var(--sel); }
  .ph-bd-h { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 66px; padding: 10px 14px; border: 0; background: none; color: var(--text); text-align: left; }
  .ph-bd-h img { width: 40px; height: 40px; object-fit: contain; flex: none; }
  .ph-bd-h > span { display: grid; gap: 2px; flex: 1; min-width: 0; }
  .ph-bd-h b { font-size: 15.5px; font-weight: 650; }
  .ph-bd-h small { font-size: 13px; color: var(--muted); }
  .ph-radio { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); }
  .on > .ph-radio, .ph-bd.on .ph-bd-h .ph-radio { border: 7px solid var(--sel); }
  .ph-tpls { display: grid; padding: 0 10px 10px; gap: 6px; }
  .ph-tpls button { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 10px; border: 0; border-radius: 12px; background: var(--input); color: var(--text); font-size: 15px; text-align: left; }
  .ph-tpls button.on { background: color-mix(in srgb, var(--sel) 12%, var(--panel)); }
  .ph-wz-text { border-radius: var(--ph-r); background: var(--ph-card); box-shadow: var(--ph-shadow); padding: 4px; }
  .ph-wz-ta { display: block; width: 100%; min-height: 190px !important; padding: 12px; border: 0; border-radius: 14px; background: none; color: var(--text); line-height: 1.5; resize: none; outline: none; }
  .ph-wz-mic { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 58px; border-radius: 16px; background: color-mix(in srgb, var(--sel) 12%, var(--panel)); color: var(--sel); font-size: 16.5px; font-weight: 700; position: relative; }
  .ph-wz-mic .voice-btn.ph-bigmic { position: static; width: 44px; height: 44px; min-width: 44px; border-radius: 50%; background: var(--sel); color: #fff !important; }
  .ph-wz-mic .voice-btn.ph-bigmic.on { background: #e5484d; }
  .ph-wz-mic .voice-btn.ph-bigmic::after { content: ''; position: absolute; inset: 0; border-radius: 16px; }   /* вся плашка — кнопка */
  .ph-wz-hint { display: flex; align-items: center; justify-content: center; gap: 8px; margin: -2px 0 0; font-size: 14px; color: var(--muted); }
  .ph-wz-hint svg { width: 16px; height: 16px; color: #7c5cff; }
  .ph-wz-gate { display: grid; gap: 10px; }
  .ph-wz-code { display: flex; gap: 8px; }
  .ph-wz-code input { flex: 1; min-width: 0; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--input); }
  .ph-wz-err { margin: 0; font-size: 14px; color: #c2410c; }
  /* v16: код не принят — причина и «Сменить код» / «Убрать код»; гость с кодом или гостевым доступом — строка доступа карточкой */
  .ph-wz-gate > p { margin: 0; font-size: 15px; color: var(--muted); }
  .ph-wz-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .ai-acc.ph-wz-acc { padding: 10px 10px 10px 14px; border-radius: var(--ph-r); background: var(--ph-card); box-shadow: var(--ph-shadow); font-size: 14.5px; }
  .ai-acc.ph-wz-acc.low { background: var(--aip-warn-bg); }
  body.phone[data-ph-tab="ai"] .lwc-acc .ai-acc { background: var(--ph-card); box-shadow: var(--ph-shadow); }
  body.phone[data-ph-tab="ai"] .lwc-acc .ai-acc.low { background: var(--aip-warn-bg); }
  .ph-wz-bad p { margin: 0; font-size: 15px; }
  .ph-wz-live { padding: 16px; }
  .ph-wz-foot .ph-btn svg { width: 18px; height: 18px; }

  /* — карточка ожидания и ответы ИИ на узком экране — */
  body.phone .aiw-h { font-size: 15.5px; }
  body.phone .aiw-stop { min-height: 38px; padding: 0 12px; font-size: 14px; }
  body.phone #toast { top: calc(var(--ph-top) + 6px); bottom: auto; }   /* подсказки — сверху: внизу кнопки «Скачать» и поле ввода */
  body.phone .pf-offer { bottom: calc(var(--ph-tabs) + 8px); }
  /* «Первые шаги» экскурсии — над нижней панелью и круглой ✦ ИИ */
  body.phone .tour-st { bottom: calc(var(--ph-tabs) + 28px); }
  body.phone[data-ph-screen="editor"] .tour-st { bottom: calc(var(--ph-tabs) + 78px); }   /* над «Скачать» */
  body.phone[data-ph-screen="law"] .tour-st { bottom: calc(var(--ph-tabs) + 74px); }      /* над «Спросить ИИ-юриста» */
  body.phone[data-ph-screen="done"] .tour-st { bottom: calc(var(--ph-tabs) + 186px); }
  body.phone[data-ph-tab="ai"] .tour-st { bottom: calc(var(--ph-tabs) + 82px); }          /* над полем вопроса */
  body.phone .tour-st-card { max-height: calc(100dvh - var(--ph-tabs) - 60px); }
}
