/* ArchiFlow — визуал v13 поверх v28.1.
   Только внешний вид: логика, данные и разметка не меняются.
   Подключается одной строкой в web/dist/index.html после основного CSS.
   При следующей сборке интерфейса (Грок) этот файл и строку подключения нужно сохранить
   или перенести эти правила в исходные стили. */

:root {
  --chatbg: #19191b;
  --chatcol: 760px;
}

html, body {
  font-family: "Helvetica Neue", Helvetica, Inter, Arial, sans-serif;
  line-height: 1.45;
}

/* ---------- Чат: лента по центру, до 760px ---------- */
.app:not(.phone) .chat {
  padding-left: max(24px, calc((100% - var(--chatcol)) / 2));
  padding-right: max(24px, calc((100% - var(--chatcol)) / 2));
}

/* Ответ помощника — просто текст, без пузыря (как в v13) */
.side.chaton .ai {
  background: transparent;
  border-radius: 0;
  padding: 2px 0;
  max-width: var(--chatcol);
  line-height: 1.55;
}

/* Сообщение дизайнера — пузырь справа */
.me {
  max-width: min(560px, 85%);
  border-radius: 16px;
}

/* Квитанция «Записала» — во всю ширину колонки */
.rc.wrote {
  max-width: 560px;
  width: 100%;
}
.bubblewrap.theirs > .rc { min-width: min(420px, 100%); }

/* Поле ввода: по центру колонки, скругление 22px, золотая рамка в фокусе */
.app:not(.phone) .side.chaton .composer .inputbar {
  max-width: var(--chatcol);
  margin: 0 auto;
  border-radius: 22px;
  background: #222225;
  transition: border-color .15s;
}
.side.chaton .composer .inputbar:focus-within { border-color: var(--gold-line); }

/* ---------- Разделитель: тонкая линия + ручка, золото при наведении ---------- */
.splitter { background: transparent !important; }
.splitter::before {
  content: "";
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 1px; background: var(--line);
  transition: background .15s;
}
.splitter::after {
  content: "";
  position: absolute; top: 50%; left: 50%;
  width: 4px; height: 36px; margin: -18px 0 0 -2px;
  border-radius: 2px; background: var(--line2);
  transition: background .15s;
}
.splitter:hover::before { background: var(--gold-line); }
.splitter:hover::after { background: var(--gold); }

/* ---------- Панель проекта ---------- */
/* Шапка: имя крупно, под ним золотая строка этапа */
.app:not(.phone) .projectpane > div > .top {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 16px;
}
.projectpane > div > .top h1 { font-size: 22px; font-weight: 600; }
.projectpane .stagehint { color: var(--gold); font-size: 13px; }

/* Карточки — одна колонка, одна под другой */
.app:not(.phone) .projectpane .grid2 {
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.projectpane .box {
  border-radius: 16px;
  padding: 16px 18px;
}
.projectpane .box h3 { font-size: 15px; margin-bottom: 10px; }
.projectpane .kv { grid-template-columns: 120px minmax(0, 1fr); }
.projectpane .kv .kvl, .projectpane .kv .kvv { padding: 8px 0; }

/* Помещения — плитки по две в ряд */
.projectpane .roomtiles { grid-template-columns: 1fr 1fr; gap: 10px; }
.projectpane .rm { min-height: 58px; border-radius: 12px; }

/* ---------- Список проектов: длинные имена с многоточием ---------- */
.sitem .pname > span,
.sitem .pname > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* ---------- Полосы прокрутки: тонкие, тёмные ---------- */
* { scrollbar-width: thin; scrollbar-color: #3a3a3e transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #3a3a3e; border-radius: 3px; }
*:hover::-webkit-scrollbar-thumb { background: #55555a; }

/* ---------- Поле ввода растёт под текст (до ~40% высоты), дальше прокрутка внутри ---------- */
.side.chaton .composer.barline { height: auto; min-height: var(--bar); padding-top: 12px; padding-bottom: 12px; }
.inputbar { height: auto !important; min-height: 48px; align-items: flex-end; padding-top: 6px; padding-bottom: 6px; }
.inputbar .mic { margin-bottom: 7px; }
.inputbar .msgbox {
  flex: 1; min-width: 0;
  resize: none; border: 0; outline: none;
  background: transparent; color: var(--text);
  font: inherit; font-size: 14px; line-height: 1.45;
  padding: 7px 0; margin: 0;
  field-sizing: content;
  min-height: calc(1.45em + 14px);
  max-height: 40vh;
  overflow-y: auto;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.inputbar .msgbox::placeholder { color: var(--dim); }

/* ---------- Диалоги: вкладки, меню «⋯», правка названия ---------- */
.dialogmenu { width: 360px; }
.dialogmenu .dtabs { display: flex; gap: 4px; padding: 2px 2px 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.dialogmenu .dtabs button { display: inline-block; width: auto; padding: 4px 10px; border-radius: 12px; font-size: 12px; color: var(--muted); }
.dialogmenu .dtabs button.on { color: var(--text); background: var(--gold-soft); }
.dialogmenu .drowwrap { display: grid; grid-template-columns: minmax(0, 1fr) 30px; align-items: center; border-radius: 8px; }
.dialogmenu .drowwrap.open { background: #f2f0ec0a; }
.dialogmenu .dmore { width: 30px; height: 30px; padding: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); opacity: 0; transition: opacity .12s; }
.dialogmenu .drowwrap:hover .dmore, .dialogmenu .drowwrap.open .dmore, .dialogmenu .dmore:focus-visible { opacity: 1; }
@media (hover: none) { .dialogmenu .dmore { opacity: 1; } }
.dialogmenu .dacts { grid-column: 1 / -1; padding: 2px 4px 6px 24px; }
.dialogmenu .dacts button { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 13px; }
.dialogmenu .dacts button.dz { color: var(--conf); background: transparent; }
.dialogmenu .dacts button.dz:hover { background: var(--conf-soft); }
.dialogmenu .dedit { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; padding: 8px 6px; }
.dialogmenu .dedit small { color: var(--muted); font-size: 11px; }
.dialogmenu .dedit input { background: #2a2a2d; border: 1px solid var(--gold-line); border-radius: 8px; padding: 8px 10px; color: var(--text); outline: none; }
.dialogmenu .deditbtns { display: flex; gap: 6px; }
.dialogmenu .deditbtns button { width: auto; display: inline-block; padding: 6px 12px; border-radius: 14px; font-size: 12px; border: 1px solid var(--line2); }
.dialogmenu .deditbtns button.ok { background: var(--gold); color: #1c1c1e; border-color: var(--gold); }
.dialogmenu .derr { color: var(--conf); padding: 4px 10px; }

/* ---------- Меню проекта: «Удалить» было оранжевым без текста ---------- */
.menu button.danger {
  height: auto; border-radius: 8px; padding: 8px 10px; font-weight: 400;
  background: transparent; color: var(--conf) !important;
  display: flex; align-items: center; gap: 8px;
}
.menu button.danger:hover { background: var(--conf-soft); }

/* ---------- Экран «Настройки проекта» ---------- */
.afset {
  position: fixed; z-index: 40; overflow-y: auto; overscroll-behavior: contain;
  background: var(--center); border-left: 1px solid var(--line);
  padding: 18px 22px 40px; box-sizing: border-box; color: var(--text);
}
.afset-head { position: sticky; top: -18px; z-index: 2; background: var(--center); padding: 4px 0 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.afset-back { color: var(--muted); font-size: 13px; padding: 4px 0; }
.afset-back:hover { color: var(--gold); }
.afset-head h2 { font-size: 20px; font-weight: 600; margin: 6px 0 2px; }
.afset-name { color: var(--gold); font-size: 13px; }
.afset-hint { margin: 14px 0 6px; padding: 10px 12px; border: 1px dashed var(--gold-line); border-radius: 12px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.afset section { background: var(--card); border-radius: 16px; padding: 14px 16px 6px; margin-top: 12px; }
.afset h3 { font-size: 15px; font-weight: 600; margin: 0 0 8px; }
.afset-f { display: grid; grid-template-columns: 130px minmax(0, 1fr); column-gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); border-radius: 6px; transition: background .4s; }
.afset h3 + .afset-f { border-top: 0; }
.afset-f.flash { background: var(--gold-soft); }
.afset-l { color: var(--muted); font-size: 13px; }
.afset-f input, .afset-f select {
  width: 100%; min-width: 0; height: 34px; box-sizing: border-box;
  background: #242426; color: var(--text); color-scheme: dark;
  border: 1px solid var(--line2); border-radius: 8px; padding: 0 10px; font: inherit; font-size: 13.5px; outline: none;
}
.afset-f input:focus, .afset-f select:focus { border-color: var(--gold-line); }
.afset-src { grid-column: 2; color: var(--dim); font-size: 11.5px; margin-top: 4px; line-height: 1.35; }
.afset-sug { grid-column: 2; justify-self: start; margin-top: 5px; font-size: 12px; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; text-align: left; }
@media (max-width: 520px) { .afset-f { grid-template-columns: 1fr; row-gap: 4px; } .afset-src, .afset-sug { grid-column: 1; } }
.afset-toast {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 60;
  background: #323237; color: var(--text); border: 1px solid var(--line2); border-radius: 12px;
  padding: 9px 14px; font-size: 13px; box-shadow: 0 10px 30px #0000008c; max-width: min(560px, 90vw);
  transition: opacity .5s;
}
.afset-toast.bad { border-color: var(--conf); }
.afset-toast.out { opacity: 0; }

/* ---------- Разделы проекта: Галерея · Документы · Задачи · Деньги · Комплектация ---------- */
.afgnav { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.afgnav button, .afg-pnav button { padding: 5px 9px; border-radius: 15px; font-size: 13px; color: var(--muted); }
.afgnav button:hover, .afg-pnav button:hover { color: var(--text); background: #f2f0ec0a; }
.afgnav button.on, .afg-pnav button.on { color: var(--text); background: var(--gold-soft); outline: 1px solid var(--gold-line); }
.afgnav i, .afg-pnav i { font-style: normal; font-size: 11px; color: var(--gold); margin-left: 2px; }
.afg-pnav { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.afg { position: fixed; z-index: 40; background: var(--center); overflow-y: auto; padding: 18px 22px 24px; box-sizing: border-box; }
.afg-head { position: sticky; top: -18px; z-index: 2; background: var(--center); padding: 4px 0 12px; border-bottom: 1px solid var(--line); }
.afg-name { font-size: 20px; font-weight: 600; padding-top: 4px; }
.afg-tools { display: flex; gap: 8px; margin: 14px 0 10px; }
.afg-q { flex: 1; min-width: 0; height: 38px; border: 1px solid var(--line2); border-radius: 12px; background: transparent; color: var(--text); padding: 0 12px; outline: none; font: inherit; }
.afg-q:focus { border-color: var(--gold-line); }
.afg-stage { height: 38px; border: 1px solid var(--line2); border-radius: 12px; background: #242426; color: var(--text); padding: 0 10px; color-scheme: dark; }
.afg-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.afg-f { border: 1px solid var(--line2); border-radius: 14px; padding: 4px 11px; font-size: 12px; color: var(--muted); }
.afg-f.on { color: var(--text); border-color: var(--gold-line); background: var(--gold-soft); }
.afg-day { background: var(--card); border-radius: 16px; padding: 12px 14px 14px; margin-top: 12px; }
.afg-day h3 { font-size: 14px; font-weight: 600; margin: 0 0 10px; display: flex; }
.afg-day h3 small { margin-left: auto; color: var(--dim); font-weight: 400; font-size: 12px; }
.afg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.afg-tile { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: #323236; padding: 0; }
.afg-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.afg-tile:hover img { transform: scale(1.04); }
.afg-tile em { position: absolute; left: 6px; right: 6px; bottom: 6px; font-style: normal; font-size: 10.5px; color: #fff; background: rgba(0,0,0,.5); padding: 1px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.afg-ai { position: absolute; right: 6px; top: 6px; font-size: 10px; font-weight: 700; color: #1c1c1e; background: var(--gold); padding: 1px 6px; border-radius: 6px; }
.afg-file { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 8px 22px; color: var(--muted); font-size: 11px; text-align: center; }
.afg-file b { font-size: 14px; color: var(--text); }
.afg-file span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.afg-empty { color: var(--muted); padding: 16px 2px; }
.afg-hint { margin-top: 14px; border: 1px dashed var(--gold-line); border-radius: 14px; padding: 10px 14px; color: var(--muted); font-size: 12.5px; }
.afg-view { position: fixed; inset: 0; z-index: 60; background: rgba(12,12,13,.94); display: grid; grid-template-columns: 64px minmax(0,1fr) 64px; grid-template-rows: 48px minmax(0,1fr) auto; }
.afg-vtop { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; color: var(--muted); font-size: 13px; }
.afg-x { width: 36px; height: 36px; border-radius: 18px; color: var(--text); font-size: 16px; }
.afg-x:hover { background: #f2f0ec14; }
.afg-prev, .afg-next { font-size: 40px; color: var(--muted); }
.afg-prev:hover, .afg-next:hover { color: var(--gold); }
.afg-vmain { display: flex; align-items: center; justify-content: center; min-height: 0; }
.afg-vmain img, .afg-vmain video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.afg-vmain iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; background: #fff; }
.afg-vfile { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--muted); }
.afg-vfile b { font-size: 28px; color: var(--text); }
.afg-vbar { grid-column: 1 / -1; display: flex; align-items: flex-start; gap: 16px; padding: 12px 24px 18px; }
.afg-vbar div { flex: 1; min-width: 0; }
.afg-vbar b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.afg-vbar small { color: var(--muted); font-size: 12px; }
.afg-vbar p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.afg-btn { flex: none; background: var(--gold); color: #1c1c1e; font-weight: 600; font-size: 13px; padding: 8px 16px; border-radius: 16px; text-decoration: none; }

.afp-row { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.afg-day h3 + .afp-row { border-top: 0; }
.afp-ic { width: 34px; height: 34px; border-radius: 9px; background: #323236; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--muted); }
.afp-t { min-width: 0; } .afp-t div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .afp-t small { color: var(--dim); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.afp-r { display: flex; gap: 6px; align-items: center; }
.afp-btn { border: 1px solid var(--line2); border-radius: 14px; padding: 4px 11px; font-size: 12px; color: var(--text); text-decoration: none; white-space: nowrap; }
.afp-btn:hover { border-color: var(--gold-line); color: var(--gold); }
.afp-note { color: var(--muted); font-size: 12.5px; margin: 4px 0 2px; }
.afp-st { font-size: 11px; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.afp-st.ok { background: rgba(143,176,138,.14); color: var(--ok); } .afp-st.y { background: var(--check-soft); color: var(--check); }
.afp-task { display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.afg-day h3 + .afp-task { border-top: 0; }
.afp-cb { width: 18px; height: 18px; border: 1.5px solid var(--line2); border-radius: 50%; margin-top: 2px; padding: 0; }
.afp-cb:hover { border-color: var(--gold); } .afp-cb.on { background: var(--gold); border-color: var(--gold); }
.afp-task small { color: var(--dim); font-size: 12px; } .afp-task.done .tt { color: var(--dim); text-decoration: line-through; }
.afp-kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.afp-kpi div { background: var(--card); border-radius: 14px; padding: 12px 14px; } .afp-kpi small { color: var(--muted); font-size: 12px; } .afp-kpi b { display: block; font-size: 18px; font-weight: 600; margin-top: 2px; }
.afp-bar { height: 10px; border-radius: 5px; background: #323236; overflow: hidden; } .afp-bar span { display: block; height: 100%; background: var(--gold); }
.afp-sum { margin-top: 14px; color: var(--muted); font-size: 13px; }
.afp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.afp-table th { text-align: left; color: var(--dim); font-weight: 400; font-size: 12px; padding: 4px 6px 6px; border-bottom: 1px solid var(--line); }
.afp-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; } .afp-table tr:last-child td { border-bottom: 0; }
.afp-table td b { font-weight: 500; } .afp-table td small { display: block; color: var(--dim); font-size: 11.5px; }
.afp-table .n { text-align: right; white-space: nowrap; }
.afp-dec { padding: 10px 0; border-top: 1px solid var(--line); } .afg-day h3 + .afp-dec { border-top: 0; }
.afp-dtop { display: flex; gap: 8px; align-items: center; } .afp-dtop small { color: var(--dim); font-size: 12px; }
.afp-dtext { margin-top: 4px; } .afp-was { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; text-decoration: line-through; }
.afg-tools .afp-btn { height: 38px; display: inline-flex; align-items: center; border-radius: 12px; }
.afg-day h3 .afp-btn { font-size: 11.5px; padding: 2px 10px; margin-left: auto; font-weight: 400; }
.afg-day h3 small + .afp-btn { margin-left: 8px; }

/* «← Все проекты» над названием проекта (pages-v13.js) */
.afback { display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; margin: 0 0 4px; font-size: 12.5px; color: var(--muted); background: transparent; border: 0; cursor: pointer; }
.afback:hover { color: var(--gold); }
.afg-head .afback { margin-bottom: 2px; }
.phonetabs .afback { margin: 0 0 0 auto; padding: 0 4px; height: 32px; border: 0 !important; }

/* FF&E · ArchiFlow AR */
.afar-bar { margin: 14px 0 2px; flex-wrap: wrap; }
.afar-bar .afar-main { border-color: var(--gold-line); color: var(--gold); }
.afar-room { margin-left: 8px; border: 1px solid var(--gold-line); border-radius: 9px; padding: 0 7px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; color: var(--gold); line-height: 17px; }
.afar-room:hover { background: var(--gold); color: #1c1c1e; }
.afar-sum b { color: var(--text); font-weight: 600; }
.afar-it { display: grid; grid-template-columns: 56px minmax(0,1fr); gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.afg-day h3 + .afar-it { border-top: 0; }
.afar-it.off { opacity: .55; }
.afar-ph { width: 56px; height: 56px; border-radius: 10px; background: #323236; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--dim); font-size: 10px; font-weight: 700; }
.afar-ph a, .afar-ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.afar-t { min-width: 0; } .afar-t > div:first-child { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } .afar-t b { font-weight: 500; }
.afar-t small { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; } .afar-t small.afar-p { color: var(--muted); } .afar-p b { color: var(--text); }
.afar-c { color: var(--muted); font-size: 12.5px; font-style: italic; margin: 4px 0 0; }
.afar-t .afp-r { margin-top: 6px; flex-wrap: wrap; }
.afp-st.no { background: var(--conf-soft); color: var(--conf); }
.afar-modal { position: fixed; inset: 0; z-index: 70; background: rgba(12,12,13,.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.afar-box { position: relative; width: min(340px, 100%); background: var(--center); border: 1px solid var(--line2); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.afar-box h3 { font-size: 15px; font-weight: 600; margin: 0; padding-right: 36px; }
.afar-box .afg-x { position: absolute; top: 10px; right: 10px; }
.afar-qr { width: 100%; aspect-ratio: 1; border-radius: 10px; background: #fff; image-rendering: pixelated; }
.afar-link { width: 100%; height: 34px; border: 1px solid var(--line2); border-radius: 8px; background: transparent; color: var(--muted); padding: 0 10px; font: inherit; font-size: 12px; outline: none; }
.afar-box .afp-r { justify-content: flex-end; }

/* ---------- Галерея: «⋯» на плитке и в просмотре, закреплено, архив, корзина ---------- */
.afg-cell { position: relative; min-width: 0; }
.afg-cell .afg-tile { width: 100%; display: block; }
.afg-cell.trashed .afg-tile img, .afg-cell.trashed .afg-file { opacity: .55; }
.afg-more { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; border-radius: 14px; padding: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(20,20,22,.72); color: #fff; font-size: 16px; line-height: 1; opacity: 0; transition: opacity .12s; z-index: 1; }
.afg-cell:hover .afg-more, .afg-more:focus-visible { opacity: 1; }
.afg-more:hover { background: rgba(20,20,22,.9); color: var(--gold); }
@media (hover: none) { .afg-more { opacity: 1; } }
.afg-pin { position: absolute; left: 6px; top: 6px; width: 20px; height: 20px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--gold); color: #1c1c1e; }
.afg-f.aux { border-style: dashed; }
.afg-menu { position: fixed; z-index: 75; min-width: 210px; max-width: min(280px, 92vw); background: #2a2a2d; border: 1px solid var(--line2); border-radius: 12px; padding: 5px; box-shadow: 0 12px 32px #0000008c; display: flex; flex-direction: column; }
.afg-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--text); }
.afg-menu button:hover, .afg-menu button:focus-visible { background: #f2f0ec12; }
.afg-menu button.dz { color: var(--conf); }
.afg-menu button.dz:hover { background: var(--conf-soft); }
.afg-mnote { padding: 6px 10px 7px; font-size: 11.5px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 3px; }
.afg-vacts { display: flex; align-items: center; gap: 6px; }
.afg-vacts i { font-style: normal; font-size: 12px; color: var(--muted); }
.afg-vpin { width: 22px; height: 22px; border-radius: 11px; display: inline-flex !important; align-items: center; justify-content: center; background: var(--gold); color: #1c1c1e !important; }
.afg-vmore { width: 36px; height: 36px; border-radius: 18px; color: var(--text); font-size: 18px; }
.afg-vmore:hover { background: #f2f0ec14; color: var(--gold); }
.afg-modal .afp-note { margin: 0; }
.afg-modal .afp-r { flex-wrap: wrap; }
.afg-btn.afg-danger { background: var(--conf); color: #fff; border: 0; }
.afg-plist { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.afg-plist button { text-align: left; padding: 9px 11px; border: 1px solid var(--line2); border-radius: 10px; color: var(--text); }
.afg-plist button:hover { border-color: var(--gold-line); }
.afg-plist small { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; }
.afg-toast { z-index: 80; }
/* --- Обзор (pages-v13.js): короткая сводка, не больше 3 строк в блоке --- */
.afo { max-width: 860px; container-type: inline-size; }
.afo-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 14px; font-size: 13px; }
.afo-stage { color: var(--gold); background: var(--gold-soft); outline: 1px solid var(--gold-line); border-radius: 14px; padding: 3px 10px; }
.afo-step { color: var(--muted); }
.afo-where { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.afo-empty { color: var(--muted); margin-top: 16px; }
.afo-box h3 { align-items: center; }
.afo-more { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--gold); padding: 0 2px; }
.afo-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 0; border-top: 1px solid var(--line); color: var(--text); font-size: 13.5px; }
.afg-day h3 + .afo-row { border-top: 0; padding-top: 2px; }
.afo-row:hover .afo-t { color: var(--gold); }
.afo-t { flex: 1; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
@container (max-width: 360px) { .afo-kpi b { font-size: 15px; } }
@container (min-width: 620px) { .afo-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.afo-t em { font-style: normal; color: var(--muted); }
.afo-row small { flex: none; color: var(--dim); font-size: 12px; }
.afo-dot { flex: none; width: 7px; height: 7px; border-radius: 4px; background: var(--dim); }
.afo-dot.red { background: var(--conf); } .afo-dot.amber { background: var(--check); } .afo-dot.gold { background: var(--gold); } .afo-dot.ok { background: var(--ok); }
.afo-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.afo-kpi { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; text-align: left; background: var(--card); border-radius: 14px; padding: 11px 13px; color: var(--text); }
.afo-kpi:hover { outline: 1px solid var(--gold-line); }
.afo-kpi small { color: var(--muted); font-size: 12px; }
.afo-kpi b { font-size: 17px; font-weight: 600; margin-top: 2px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.afo-kpi > span { color: var(--dim); font-size: 12px; margin-top: 2px; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.afo-red { color: var(--conf); }
.afo-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.afo-strip button { border: 1px solid var(--line); border-radius: 14px; padding: 4px 11px; font-size: 12.5px; color: var(--muted); }
.afo-strip button:hover { border-color: var(--gold-line); color: var(--text); }
.afo-strip b { color: var(--text); font-weight: 600; }

/* --- Дашборд проекта (pages-v13.js, 18.11.2026; вместо «Обзора»): строка «о проекте», до 4 карточек, «Сегодня и скоро»,
   «Ждёт клиента», «Последние события». Спокойно: тёмные карточки, один бежевый акцент, красный — только просрочка,
   цифры одной ширины. На узкой панели и телефоне карточки — по две, блоки — в столбик. --- */
.afdb { container-type: inline-size; width: 100%; max-width: 1040px; box-sizing: border-box; display: flex; flex-direction: column; gap: 14px; padding-top: 10px; font-variant-numeric: tabular-nums; }
.afdb-meta { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.afdb-meta i { font-style: normal; color: var(--dim); margin: 0 7px; }
.afdb-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.afdb-card { display: flex; flex-direction: column; align-items: stretch; min-width: 0; text-align: left; background: var(--card); border: 1px solid transparent; border-radius: 14px; padding: 14px 16px 15px; color: var(--text); transition: border-color .15s, background .15s; }
.afdb-card[data-go] { cursor: pointer; }
.afdb-card[data-go]:hover, .afdb-card[data-go]:focus-visible { border-color: var(--gold-line); outline: none; }
.afdb-kl { color: var(--muted); font-size: 12.5px; }
.afdb-kv { font-size: 27px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.afdb-kv small { font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--muted); margin-left: 5px; }
.afdb-bar { display: block; height: 3px; margin-top: 11px; background: rgba(255, 255, 255, .07); border-radius: 2px; overflow: hidden; }
.afdb-bar i { display: block; height: 100%; background: var(--gold); border-radius: 2px; }
.afdb-ks { margin-top: 8px; color: var(--muted); font-size: 12.5px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.afdb-red, .afdb-ks em.afdb-red { font-style: normal; color: var(--conf); }
.afdb-two, .afdb-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.afdb-sec { background: var(--card); border-radius: 14px; padding: 14px 16px 6px; min-width: 0; }
.afdb-sec h3 { font-size: 14.5px; font-weight: 600; margin: 0 0 4px; }
.afdb-row { display: flex; align-items: center; gap: 14px; width: calc(100% + 16px); margin: 0 -8px; padding: 10px 8px; text-align: left; color: var(--text); border-top: 1px solid var(--line); border-radius: 0; cursor: default; }
.afdb-sec h3 + .afdb-row { border-top-color: transparent; }
.afdb-row[data-go] { cursor: pointer; }
.afdb-row[data-go]:hover, .afdb-row[data-go]:focus-visible { background: rgba(255, 255, 255, .04); border-radius: 8px; outline: none; }
.afdb-rt { flex: 1; min-width: 0; }
.afdb-rt b { display: block; font-weight: 400; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.afdb-rt small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.afdb-rw { flex: none; color: var(--muted); font-size: 12.5px; text-align: right; white-space: nowrap; }
.afdb-rw.afdb-red { color: var(--conf); }
.afdb-feed { align-items: flex-start; gap: 10px; }
.afdb-fw { flex: none; width: 48px; color: var(--dim); font-size: 12px; padding-top: 2px; white-space: nowrap; }
.afdb-ft { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.afdb-more { display: block; width: 100%; text-align: left; padding: 10px 0 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
button.afdb-more:hover { color: var(--gold); }
.afdb .af-es { margin-top: 26px; }
@container (min-width: 560px) {
  .afdb-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
  .afdb-kpis[data-n="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .afdb-kpis[data-n="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .afdb-kv { font-size: 30px; }
}
@container (min-width: 640px) {
  .afdb-two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; align-items: start; }
  .afdb-col { gap: 12px; }
}
@container (max-width: 330px) { .afdb-kv { font-size: 23px; } .afdb-kv small { font-size: 12.5px; } .afdb-card { padding: 12px 13px 13px; } }
/* Документы → Договоры: шаблоны и предпросмотр (pages-v13.js) */
.afc-kindh { color: var(--dim); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; margin: 12px 0 2px; }
.afg-day h3 + .afc-kindh { margin-top: 0; }
.afc-row { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 4px 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.afc-kindh + .afc-row { border-top: 0; }
.afc-t { min-width: 0; }
.afc-title { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.afc-t small { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; line-height: 1.35; }
.afc-badge { font-size: 10.5px; font-weight: 600; letter-spacing: .03em; border: 1px solid var(--line2); color: var(--muted); border-radius: 9px; padding: 0 7px; line-height: 17px; white-space: nowrap; }
.afc-badge.mine { border-color: var(--gold-line); color: var(--gold); }
.afc-badge.def { color: var(--dim); }
.afc-use { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.afc-use input { accent-color: var(--gold); }
.afc-row.on .afc-use { color: var(--text); }
.afc-main { border-color: var(--gold-line); color: var(--gold); }
.afc-menu { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.afc-kind { font-size: 12px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.afc-kind select { background: transparent; color: var(--text); border: 1px solid var(--line2); border-radius: 10px; padding: 2px 6px; font: inherit; font-size: 12px; }
.afc-del:hover { border-color: var(--conf); color: var(--conf); }
.afc-row .afp-r { grid-column: 2; flex-wrap: wrap; justify-content: flex-start; margin-top: 4px; }
.afc-modal { position: fixed; inset: 0; z-index: 70; background: rgba(12,12,13,.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.afc-box { position: relative; width: min(860px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--center); border: 1px solid var(--line2); border-radius: 18px; overflow: hidden; }
.afc-box > .afg-x { position: absolute; top: 10px; right: 10px; z-index: 2; }
.afc-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.afc-head h3 { font-size: 16px; font-weight: 600; margin: 0 0 4px; padding-right: 40px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.afc-head > small { color: var(--muted); font-size: 12px; }
.afc-legend { display: flex; gap: 8px; margin: 8px 0 0; font-size: 11.5px; }
.afc-misslist { margin-top: 10px; padding: 9px 12px; border: 1px dashed var(--conf); border-radius: 12px; font-size: 12.5px; color: var(--muted); }
.afc-misslist b { color: var(--text); font-weight: 500; }
.afc-misslist p { margin: 3px 0 0; }
.afc-misslist.ok { border-color: var(--gold-line); }
.afc-dl { margin-top: 10px; justify-content: flex-start; }
.afc-doc { overflow: auto; padding: 18px 28px 28px; background: #f7f5f0; color: #1d1c1a; font-family: "Times New Roman", Georgia, serif; font-size: 13.5px; line-height: 1.5; }
.afc-doc p { margin: 0 0 6px; white-space: pre-wrap; }
.afc-doc p.b { font-weight: 700; }
.afc-doc p.c { text-align: center; }
.afc-tr { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); border: 1px solid #c9c4b8; border-top: 0; }
.afc-doc p + .afc-tr, .afc-tr:first-child { border-top: 1px solid #c9c4b8; }
.afc-td { padding: 4px 8px; border-left: 1px solid #c9c4b8; min-height: 22px; }
.afc-td:first-child { border-left: 0; }
.afc-v { background: #f3e2a9; color: inherit; border-radius: 3px; padding: 0 2px; }
.afc-v[data-src="default"] { background: #e3e7ef; }
.afc-miss { background: #f6d5cf; color: #8a2a1b; border-radius: 3px; padding: 0 4px; font-family: "Helvetica Neue", Arial, sans-serif; font-size: 11.5px; white-space: nowrap; }
.afc-legend .afc-v, .afc-legend .afc-miss { font-size: 11.5px; padding: 1px 6px; color: #1d1c1a; }
.afc-legend .afc-miss { color: #8a2a1b; }
.afc-unk { border-bottom: 1px dashed #b07b00; }

/* Настройки проекта → «Мои реквизиты (для всех проектов)» */
.afset-reqnote { margin: -4px 0 6px; }
.afset-terms { grid-column: 1; margin: 8px 0 10px; }
.afset-termbox { padding-bottom: 6px; }

/* settings: back to this project */
.afset-backs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.afset-toproj { color: var(--gold); font-size: 13.5px; padding: 2px 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.afset-toproj:hover { text-decoration: underline; }
.afset-backs .afset-back { color: var(--muted); font-size: 13px; }

/* ---------- Личный кабинет: «Тариф» и «Площадка» (account-v13.js) ---------- */
.account [data-owner-controls="1"].afplat-hidden { display: none; }
.afplan-card h3, .afplat h3 { margin: 0; }
.afplan-title { font-size: 15px; color: var(--text); }
.afplan-line { color: var(--muted); font-size: 13px; }
.afplan-bar { height: 8px; border-radius: 4px; background: #3a3a3e; overflow: hidden; }
.afplan-bar > i { display: block; height: 100%; border-radius: 4px; background: var(--gold); transition: width .3s; }
.afplan-bar.warn > i { background: var(--check); }
.afplan-bar.full > i { background: var(--conf); }
.afplan-msg { margin: 0; font-size: 13px; color: var(--conf); }
.afplan-msg.warn { color: var(--check); }
.afplan-feat { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text); }
.afplan-feat li::before { content: "·"; color: var(--gold); margin-right: 6px; }
.afplan-feat li.off { color: var(--muted); }
.afplat-only { font-size: 12px; font-weight: 400; color: var(--muted); }
.afplat-body { display: flex; flex-direction: column; gap: 14px; }
.afplat-sec { display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.afplat-sec + .afplat-sec { border-top: 1px solid var(--line); padding-top: 12px; }
.afplat h4 { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: none; }
.afplat-reg { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.afplat-switch { position: relative; width: 42px; height: 24px; flex: none; border-radius: 12px; border: 1px solid var(--line2); background: #26262a; padding: 0; cursor: pointer; }
.afplat-switch > i { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: left .15s, background .15s; }
.afplat-switch.on { background: var(--gold-soft); border-color: var(--gold-line); }
.afplat-switch.on > i { left: 20px; background: var(--gold); }
.afplat-capin { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.afplat-capin label { max-width: 160px; }
.afplat-mini { height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line2); background: transparent; color: var(--text); font-size: 12px; cursor: pointer; white-space: nowrap; }
.afplat-mini:hover { border-color: var(--gold-line); }
.afplat-capin .afplat-mini { height: 36px; }
.afplat-scroll { overflow-x: auto; }
.afplat-users { width: 100%; border-collapse: collapse; font-size: 13px; }
.afplat-users th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--muted); padding: 4px 8px 6px 0; border-bottom: 1px solid var(--line); }
.afplat-users td { padding: 8px 8px 8px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.afplat-users td small { display: block; color: var(--muted); font-size: 11.5px; }
.afplat-users .num { text-align: right; font-variant-numeric: tabular-nums; }
.accbox .afplat-users select { height: 30px; font-size: 13px; }
.afplat-own { color: var(--gold); }
.afplat-trial { margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.afplat-trial .afplat-mini { height: 24px; padding: 0 9px; font-size: 11.5px; }
.afplat-pct { font-variant-numeric: tabular-nums; }
.afplat-pct.warn { color: var(--check); }
.afplat-pct.full { color: var(--conf); }
/* «Площадка» → Пользователи: карточка на пользователя (узкая колонка кабинета) */
.afplat-ulist { display: flex; flex-direction: column; }
.afplat-u { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.afplat-u:first-child { border-top: 1px solid var(--line); }
.afplat-uhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.afplat-who { min-width: 0; }
.afplat-who b { display: block; overflow-wrap: anywhere; }
.afplat-who small { display: block; color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.accbox .afplat-uhead label.afplat-ffe { padding: 2px 0 0; flex: none; }
.afplat-uplan { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 12.5px; }
.accbox .afplat-uplan select { height: 30px; font-size: 13px; }
.afplat-uplan .afplat-trial { margin: 0; }
.afplat-proj { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.afplat-uai { display: flex; flex-direction: column; gap: 1px; font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }
.afplat-lim { font-size: 13px; margin-bottom: 1px; }
.afplat-dim, .afplat-k { color: var(--muted); }
.afplat-plans { display: flex; flex-direction: column; gap: 10px; }
.afplat-note { margin: 0; font-size: 12.5px; color: var(--check); background: var(--check-soft); border-radius: 8px; padding: 7px 10px; }
.afplat-plan { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; padding-top: 10px; border-top: 1px dashed var(--line); }
.afplat-plan > label:not(.afplat-chk) { flex: 1 1 120px; min-width: 0; }
.afplat-ph { flex: 0 0 100%; font-size: 12.5px; color: var(--gold); }
.accbox .afplat-plan input:not([type="checkbox"]) { height: 32px; font-size: 13px; min-width: 0; }
.accbox label.afplat-chk { flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: var(--text); padding-bottom: 8px; white-space: nowrap; }
.accbox .afplat-chk input { appearance: auto; -webkit-appearance: checkbox; height: 16px; width: 16px; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; accent-color: var(--gold); }
/* «Площадка» → Обновления с GitHub (account-v13.js, server/autoupdate.js) */
.afplat > .afupd { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 2px; }
.afupd h4 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.afupd-state { font-size: 11.5px; font-weight: 500; padding: 2px 9px; border-radius: 10px; border: 1px solid var(--line2); color: var(--muted); }
.afupd-state.on { color: var(--gold); border-color: var(--gold-line); background: var(--gold-soft); }
.afupd-src { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; }
.afupd-key { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.afupd-key label { flex: 1 1 240px; min-width: 0; }
.afupd-key .afplat-mini { height: 36px; }
.afupd-btns { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.afupd-st { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 14px; margin: 0; font-size: 13px; }
.afupd-st dt { color: var(--muted); }
.afupd-st dd { margin: 0; min-width: 0; overflow-wrap: anywhere; line-height: 1.45; }
.afupd-st code { font-size: 12px; color: var(--gold); }
.afupd-res { font-weight: 600; }
.afupd-res.good { color: var(--gold); }
.afupd-res.warn, .afupd-warn { color: var(--check); }
.afupd-res.bad { color: var(--conf); }
.afupd-detail { display: block; font-size: 11.5px; margin-top: 2px; }
.afupd-check { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.afupd-check .afplat-mini[disabled] { opacity: .55; cursor: default; }
.afupd-help { line-height: 1.45; }
@media (max-width: 520px) { .afupd-st { grid-template-columns: minmax(0, 1fr); gap: 2px; } .afupd-st dd { margin-bottom: 6px; } }

/* Dialogs (Маршрут и др.): clear frame, always fits the screen, scrolls inside */
.modal { z-index: 90; background: rgba(0,0,0,.66); padding: 24px 16px; overflow-y: auto; }
.dialog { max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow-y: auto; overscroll-behavior: contain;
  background: #2a2a2e; border: 1px solid #f2f0ec2e; border-radius: 16px; box-shadow: 0 0 0 1px #00000066, 0 24px 60px #000000a6; }
.dialog > .sheethead { position: sticky; top: -16px; z-index: 2; margin: -16px -16px 8px; padding: 14px 16px 10px; background: #2a2a2e; border-bottom: 1px solid var(--line2); border-radius: 16px 16px 0 0; }
.dialog > .sheethead .x { margin-left: auto; width: 32px; height: 32px; border-radius: 16px; font-size: 20px; }
.dialog > .sheethead .x:hover { background: #f2f0ec14; }
@media (max-width: 700px) { .modal { padding: 8px; } .dialog { max-height: calc(100dvh - 16px); } }

/* ---------- Общий экран «Настройки» (appsettings-v13.js): вкладки сверху ---------- */
html.afapp-on .stagebody[data-screen="settings"] { display: none !important; }
.afapp { flex: 1 1 0%; min-height: 0; overflow-y: auto; padding: 0 0 32px; color: var(--text); }
.afapp-head { position: sticky; top: 0; z-index: 2; background: var(--center); padding: 0 0 12px; }
.afapp-head h2, .afset-head h2 { font-size: 22px; font-weight: 600; margin: 0 0 12px; }
.afapp-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.afapp-tabs button { padding: 6px 13px; border-radius: 16px; font-size: 13px; color: var(--muted); border: 1px solid var(--line2); background: transparent; white-space: nowrap; }
.afapp-tabs button:hover { color: var(--text); border-color: var(--gold-line); }
.afapp-tabs button.on { color: var(--text); background: var(--card2); border-color: var(--gold-line); box-shadow: inset 0 0 0 1px var(--gold-line); }
.afapp-tabs button i { font-style: normal; color: var(--gold); margin-left: 4px; }
.afapp-body { max-width: 980px; }
.afapp-th { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; margin: 10px 0 12px; }
.afapp-th > div { flex: 1 1 240px; min-width: 0; }
.afapp-th h3 { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.afapp-th p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.afapp-card { background: var(--card); border-radius: 16px; padding: 14px 16px 12px; margin-top: 12px; }
.afapp-card h4 { font-size: 14.5px; font-weight: 600; margin: 0 0 3px; }
.afapp-why { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; line-height: 1.45; }
.afapp-card .afapp-why + .afset-f, .afapp-card h4 + .afset-f, .afapp-card > .afset-f:first-child { border-top: 0; }
.afapp-card.soon { opacity: .62; }
.afapp-now { color: var(--text); font-size: 13px; margin: 2px 0 6px; }
.afapp-now.dim, .afapp-foot { color: var(--dim); font-size: 12.5px; }
.afapp-foot { margin: 14px 2px 0; }
.afapp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0 2px; }
.afapp-btn { background: var(--gold); color: #1c1c1e; font-weight: 600; font-size: 13px; padding: 8px 16px; border-radius: 16px; border: 0; white-space: nowrap; }
.afapp-btn:hover { filter: brightness(1.08); }
.afapp-btn[disabled] { background: #3a3a3e; color: var(--dim); cursor: default; filter: none; }
.afapp-btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line2); font-weight: 500; }
.afapp-btn.ghost:hover { border-color: var(--gold-line); color: var(--gold); }
.afapp-link { color: var(--gold); font-size: 13px; padding: 2px 0; background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.afapp-link.sm { font-size: 12px; }
.afapp-link.dim { color: var(--dim); }
.afapp-dirty { color: var(--check); font-size: 12px; }
.afapp-more { margin-top: 4px; }
.afapp-more > summary { cursor: pointer; color: var(--gold); font-size: 13px; padding: 4px 0; list-style: none; }
.afapp-more > summary::-webkit-details-marker { display: none; }
.afapp-more > summary::before { content: '›'; display: inline-block; margin-right: 6px; transition: transform .15s; }
.afapp-more[open] > summary::before { transform: rotate(90deg); }
.afapp-morebody { padding-top: 4px; }
.afapp-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; }
.afapp-chips i { font-style: normal; color: var(--dim); }
.afapp-chip { border: 1px solid var(--line2); border-radius: 14px; padding: 3px 10px; font-size: 12.5px; color: var(--text); white-space: nowrap; }
.afapp-chip.on { border-color: var(--gold-line); background: var(--gold-soft); }
.afapp-grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 14px; }
.afapp-check { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; font-size: 13.5px; cursor: pointer; }
.afapp-check input { margin-top: 3px; accent-color: var(--gold); flex: none; }
.afapp-check small { display: block; color: var(--dim); font-size: 11.5px; }
.afapp-switch { display: flex; align-items: center; gap: 10px; padding: 6px 0 8px; font-size: 13.5px; cursor: pointer; }
.afapp-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.afapp-switch span { width: 36px; height: 20px; border-radius: 10px; background: #46464b; position: relative; flex: none; transition: background .15s; }
.afapp-switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: left .15s; }
.afapp-switch input:checked + span { background: var(--gold); }
.afapp-switch input:checked + span::after { left: 18px; background: #1c1c1e; }
.afapp-switch input:focus-visible + span { outline: 2px solid var(--gold-line); outline-offset: 2px; }
.afapp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 13px; color: var(--muted); }
.afapp-tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.afapp-tcard { background: var(--card); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; border: 1px solid transparent; min-width: 0; }
.afapp-tcard.mine { border-color: var(--gold-line); }
.afapp-tcard > b { font-size: 14.5px; font-weight: 600; }
.afapp-tcard > small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.afapp-cur { margin: 6px 0 2px; font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.afapp-cur.mine { color: var(--gold); }
.afapp-tbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.afapp-tbtns button.afp-btn, .afapp-tbtns a.afp-btn { background: transparent; }
.afapp-sel { height: 32px; border-radius: 8px; background: #242426; color: var(--text); border: 1px solid var(--line2); padding: 0 8px; font: inherit; font-size: 12.5px; color-scheme: dark; max-width: 100%; }
.afapp-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.afapp-add input, .afapp-code input { flex: 1 1 160px; min-width: 0; height: 32px; border-radius: 8px; background: #242426; color: var(--text); border: 1px solid var(--line2); padding: 0 10px; font: inherit; font-size: 13px; outline: none; }
.afapp-add input:focus { border-color: var(--gold-line); }
.afapp-code { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 8px; }
.app.phone .afapp { margin: 0 -12px; padding-left: 4px; padding-right: 4px; }
/* «Профиль студии»: логотип и фото — файлами (appsettings-v13.js). Плитка тёмная, как страница клиента по ссылке. */
.afapp-img { display: flex; align-items: center; gap: 12px; min-width: 0; }
.afapp-imgtile { position: relative; flex: none; width: 84px; height: 84px; padding: 8px; border-radius: 14px; border: 1px dashed var(--line2); background: #1c1c1e; color: var(--dim); font: inherit; font-size: 11px; line-height: 1.3; text-align: center; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.afapp-imgtile.has { border-style: solid; border-color: var(--line); }
.afapp-imgtile img { width: 100%; height: 100%; object-fit: contain; display: block; }
.afapp-imgtile.photo { border-radius: 50%; }
.afapp-imgtile.photo.has { padding: 0; }
.afapp-imgtile.photo img { object-fit: cover; }
.afapp-imgtile:hover, .afapp-imgtile:focus-visible { border-color: var(--gold-line); color: var(--muted); outline: none; }
.afapp-imgtile.over { border: 1px dashed var(--gold); background: var(--gold-soft); box-shadow: 0 0 0 3px var(--gold-soft); color: var(--text); }
.afapp-imgtile[disabled] { cursor: progress; }
.afapp-imgtile[disabled] img { opacity: .45; }
.afapp-imgbar { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 4px; border-radius: 2px; background: rgba(242, 240, 236, .16); overflow: hidden; }
.afapp-imgtile.photo .afapp-imgbar { left: 16px; right: 16px; bottom: 16px; }
.afapp-imgbar b { display: block; height: 100%; width: 0; background: var(--gold); transition: width .15s; }
.afapp-imgbtns { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.afapp-imgbtns .afapp-btn { padding: 6px 14px; }
.afset-f .afapp-imgerr { color: var(--conf); font-size: 12px; }
.afapp-pthumb { width: 28px; height: 28px; object-fit: contain; border-radius: 7px; background: #1c1c1e; border: 1px solid var(--line); vertical-align: middle; margin-right: 10px; }
@media (max-width: 520px) { .afapp-head h2, .afset-head h2 { font-size: 20px; } .afapp-tabs button { padding: 5px 11px; } }

/* Настройки проекта (settings-v13.js) — те же вкладки */
.afset-head .afapp-tabs { margin-top: 2px; }
.afset-head h2 { margin: 6px 0 12px; }
.afset .afapp-th { margin-top: 14px; }
.afset-body { max-width: 980px; }

/* Левая панель: «Проверить» виден только когда есть что проверить (rail-v13.js ставит hidden) */
.rail .ritem[hidden], .phonetabs button[hidden] { display: none !important; }

/* Картинки помощника в чате (genimg-v13.js): ссылка-файл ответа становится миниатюрой. */
.msgfiles.afgen-row { gap: 8px; }
.msgfiles a.msgfile.afgen { display: block; padding: 0; max-width: min(360px, 100%); width: 360px; border-radius: 12px; overflow: hidden; font-size: 0; line-height: 0; color: transparent; background: #323236; border: 1px solid var(--line2); }
.msgfiles a.msgfile.afgen .afgen-img { display: block; width: 100%; height: auto; min-height: 120px; object-fit: cover; }
.msgfiles.afgen-row a.msgfile.afgen:only-child { width: 420px; max-width: min(420px, 100%); }
@media (max-width: 640px) { .msgfiles a.msgfile.afgen, .msgfiles.afgen-row a.msgfile.afgen:only-child { width: 100%; } }

/* ---------- Пустые разделы (pages-v13.js, 15.11.2026): что здесь появится + фраза для помощника ---------- */
.afg-es { margin-top: 14px; background: var(--card); border-radius: 14px; padding: 14px 16px; }
.afg-es p { margin: 0; }
.afg-es-what { color: var(--text); font-size: 13.5px; line-height: 1.45; }
.afg-es-say { margin-top: 8px !important; color: var(--gold); font-size: 13px; line-height: 1.45; }
.afg-es-say span { color: var(--muted); }
.afg-day .afg-es { margin-top: 0; padding: 0; background: transparent; }
.afg-tools-empty { justify-content: flex-start; }
.afg-adds { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.afg-adds small { color: var(--muted); font-size: 12px; margin-right: 2px; }
.afo-miss { cursor: default; }
.afo-row.afo-miss:hover .afo-t { color: var(--text); }
.afo-miss-more { margin-left: auto; padding-left: 10px; flex: none; white-space: nowrap; color: var(--dim); font-weight: 400; font-size: 12px; }

/* Переименование руками в разделах проекта (pages-v13.js, server/rename.js): нажатие на название — поле на месте. */
.afren-name { cursor: text; border-radius: 4px; }
.afren-name:hover { text-decoration: underline dotted; text-decoration-color: var(--dim); text-underline-offset: 3px; }
.afren-in {
  display: block; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box;
  height: 32px; margin: -3px 0; padding: 0 8px;
  border: 1px solid var(--gold-line); border-radius: 7px; background: #242426;
  color: var(--text); font: inherit; font-weight: 500;
}
.afren-in:focus { outline: none; border-color: var(--gold); }
.afe-li:focus-visible { outline: 1px solid var(--gold-line); outline-offset: 2px; }
.afe-li .afren-in { margin: 0 0 3px; }
.afp-task .tt .afren-in { margin: -2px 0 2px; }
.afg-vbar .afren-in { margin: 0 0 4px; }
/* телефон: 16px — iPhone не увеличивает страницу при фокусе */
.app.phone ~ .afg .afren-in, .afg-view .afren-in { font-size: 16px; }
@media (max-width: 700px) { .afren-in { height: 38px; font-size: 16px; } }
