/* Экран входа Klarfold.
   Появляется до загрузки пространства: пока человек не вошёл, показывать
   чужой или пустой интерфейс не нужно. Палитра та же, что у приложения. */

#auth-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 30, 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font: inherit;
}
#auth-screen[hidden] { display: none; }

/* Пока не решено, кто вошёл и какие у него настройки, интерфейса не видно
   (02.10.2026). Оболочка рисовала раздел сразу — пустым пространством и
   стандартным оформлением, — и до прихода данных и настроек из пространства
   на долю секунды был виден не тот вид. Индикатор — только если ждать дольше. */
body[data-booting] :is(.wallpaper, .atmosphere, .rail, .app-header, #view, .assistant-trigger) { visibility: hidden; }
body[data-booting]::after {
  content: "";
  position: fixed;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  border: 2px solid rgba(220, 234, 240, 0.22);
  border-top-color: rgba(220, 234, 240, 0.78);
  opacity: 0;
  animation: klarfold-boot-in 0.2s ease 0.6s forwards, klarfold-boot-spin 0.8s linear infinite;
}
@keyframes klarfold-boot-in { to { opacity: 1; } }
@keyframes klarfold-boot-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { body[data-booting]::after { animation: klarfold-boot-in 0.2s ease 0.6s forwards; } }

.auth-card {
  width: min(380px, 100%);
  padding: 26px 26px 22px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(41, 53, 63, 0.92);
  color: #eef3f5;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}
.auth-card h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; letter-spacing: 0.2px; }
.auth-card p.auth-lead { margin: 0 0 18px; font-size: 13px; color: rgba(238, 243, 245, 0.68); }

.auth-card label { display: block; margin-bottom: 12px; font-size: 12px; color: rgba(238, 243, 245, 0.72); }
/* Вход почтой (MAIL-SIGNUP-0111): флажок календаря — в строку с подписью, части формы пароля прячутся целиком. */
.auth-card label.auth-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.auth-card label.auth-check input { width: auto; margin: 0; }
.auth-card [data-password][hidden] { display: none; }
.auth-card input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #eef3f5;
  font: inherit;
}
.auth-card input:focus { outline: 2px solid rgba(186, 207, 205, 0.55); outline-offset: 1px; }

.auth-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.auth-actions button {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(186, 207, 205, 0.92);
  color: #1d2830;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.auth-actions button.secondary { background: transparent; color: #eef3f5; font-weight: 500; }
.auth-actions button[disabled] { opacity: 0.6; cursor: default; }

.auth-message { margin: 14px 0 0; font-size: 12px; min-height: 16px; color: #f0b7ae; }
.auth-message.ok { color: rgba(238, 243, 245, 0.72); }

@media (prefers-color-scheme: light) {
  #auth-screen { background: rgba(233, 238, 241, 0.78); }
  .auth-card { background: rgba(252, 253, 253, 0.96); color: #26333c; border-color: rgba(38, 51, 60, 0.12); }
  .auth-card p.auth-lead, .auth-card label { color: rgba(38, 51, 60, 0.66); }
  .auth-card p.auth-consent { color: rgba(38, 51, 60, 0.6); }
  .auth-card input { background: rgba(38, 51, 60, 0.05); border-color: rgba(38, 51, 60, 0.16); color: #26333c; }
  .auth-actions button { background: #425c6c; color: #f4f7f8; border-color: transparent; }
  .auth-actions button.secondary { background: transparent; color: #26333c; }
  .auth-message.ok { color: rgba(38, 51, 60, 0.66); }
}

/* Шаг подтверждения адреса (01.10.2026): та же карточка входа. Сообщение —
   своим классом `auth-note` с тем же видом, что `auth-message`: на экране
   входа `.auth-message` одна, по ней её находят проверки. */
.auth-card .auth-lead b { font-weight: 600; color: inherit; overflow-wrap: anywhere; }
.auth-card input[name="code"] {
  letter-spacing: 0.32em;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.auth-card input[name="code"]::placeholder { letter-spacing: 0.32em; color: rgba(238, 243, 245, 0.32); }
.auth-card[data-step="confirm"] .auth-actions button { padding-left: 8px; padding-right: 8px; white-space: nowrap; }
.auth-note { margin: 14px 0 0; font-size: 12px; min-height: 16px; color: #f0b7ae; overflow-wrap: anywhere; }
.auth-note.ok { color: rgba(238, 243, 245, 0.72); }
.auth-card p.auth-consent { margin: 14px 0 0; font-size: 12px; line-height: 1.4; color: rgba(238, 243, 245, 0.6); }
.auth-consent a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.auth-quiet {
  display: block;
  margin: 12px auto 0;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: rgba(238, 243, 245, 0.72);
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.auth-quiet:hover { color: #eef3f5; }

@media (prefers-color-scheme: light) {
  .auth-card input[name="code"]::placeholder { color: rgba(38, 51, 60, 0.32); }
  .auth-note.ok { color: rgba(38, 51, 60, 0.66); }
  .auth-quiet { color: rgba(38, 51, 60, 0.66); }
  .auth-quiet:hover { color: #26333c; }
}

/* Вход через провайдеров. Кнопки появляются, только если ключи заданы на
   сервере: иначе человек нажимает и попадает в ошибку. */
.auth-providers { margin-top: 16px; display: grid; gap: 8px; }
.auth-providers[hidden] { display: none; }
.auth-or {
  text-align: center;
  font-size: 12px;
  color: rgba(238, 243, 245, 0.5);
}
.auth-provider {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: #eef3f5;
  font: inherit;
  cursor: pointer;
}
.auth-provider:hover { background: rgba(255, 255, 255, 0.12); }
.auth-provider[hidden] { display: none; }

/* План 8.2: язык экрана входа (до входа — язык браузера; после — язык пространства). */
.auth-langs { display: flex; justify-content: center; gap: 4px; margin-top: 16px; }
.auth-langs button { padding: 4px 9px; border-radius: 8px; border: 0; background: none; color: rgba(238, 243, 245, 0.55); font: inherit; font-size: 12px; cursor: pointer; }
.auth-langs button:hover { color: #eef3f5; }
.auth-langs button[aria-pressed="true"] { color: #eef3f5; background: rgba(255, 255, 255, 0.1); }

@media (prefers-color-scheme: light) {
  .auth-or { color: rgba(38, 51, 60, 0.55); }
  .auth-provider { background: rgba(38, 51, 60, 0.06); border-color: rgba(38, 51, 60, 0.16); color: #26333c; }
  .auth-provider:hover { background: rgba(38, 51, 60, 0.1); }
  .auth-langs button { color: rgba(38, 51, 60, 0.55); }
  .auth-langs button:hover, .auth-langs button[aria-pressed="true"] { color: #26333c; }
  .auth-langs button[aria-pressed="true"] { background: rgba(38, 51, 60, 0.08); }
}

/* Подключения почты и календарей в настройках. */
.kf-connections { display: grid; gap: 10px; }
.kf-conn-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.kf-conn-note { margin: 0; font-size: 12px; opacity: 0.72; }
.kf-conn-error { display: block; margin-top: 4px; font-size: 12px; color: #c4706a; }
/* Расхождения: тот же материал, что и у подключений, но с заметной рамкой —
   это не список, а вопрос, на который человеку нужно ответить. */
.kf-conflicts {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(196, 112, 106, 0.38);
  border-radius: var(--r-card, 14px);
}
.kf-conflicts h3 { margin: 0; font-size: 13px; }
/* Список того, что переносится: человек видит состав до согласия. */
.import-list { margin: 10px 0 14px; padding-left: 18px; font-size: 13px; line-height: 1.7; }
.import-list b { font-weight: 600; }
.kf-conn-form { display: grid; gap: 12px; min-width: min(360px, 78vw); }
.kf-conn-form h2 { margin: 0; font-size: 16px; }
.kf-conn-form label { display: block; font-size: 12px; opacity: 0.75; }
.kf-conn-form input {
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(128, 144, 156, 0.35);
  background: transparent;
  color: inherit;
  font: inherit;
}
.kf-conn-message { margin: 0; min-height: 16px; font-size: 12px; opacity: 0.8; }
.kf-conn-buttons { display: flex; gap: 8px; }

/* Выбор календарей и списков задач. */
.kf-pick { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.kf-pick input { width: auto; margin: 0; }

/* Отметка работы без связи (APP-OFFLINE).

   Внизу по центру, поверх интерфейса, но не перехватывая нажатия: плавающий
   элемент, который ловит клики, уже один раз ломал работу — так пропала
   кнопка «Выйти» в QA-057. */
#offline-mark {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 55;
  max-width: min(520px, calc(100vw - 32px));
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(196, 112, 106, 0.45);
  background: rgba(41, 53, 63, 0.92);
  color: #f0e4e2;
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  pointer-events: none;
}
#offline-mark[hidden] { display: none; }
/* «Обновляется…» (план 9.1, часть 3): тот же вид, что у отметки без связи, спокойнее по цвету. */
#refresh-mark {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 55;
  max-width: min(520px, calc(100vw - 32px));
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(120, 150, 170, 0.45);
  background: rgba(41, 53, 63, 0.92);
  color: #e3edf2;
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  pointer-events: none;
}
#refresh-mark[hidden] { display: none; }

@media (prefers-color-scheme: light) {
  #offline-mark { background: rgba(252, 253, 253, 0.96); color: #7d3a33; }
  #refresh-mark { background: rgba(252, 253, 253, 0.96); color: #2f4a5a; }
}

/* Организация, команды, люди и план (ORG-UI).

   Тот же материал, что у подключений: это соседние разделы настроек, и
   разный вид у одинаковых по смыслу строк читался бы как разный смысл. */
.kf-group { display: grid; gap: 8px; margin-top: 14px; }
.kf-group h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.6;
}
/* Текущий план выделяется рамкой, а не цветом заливки: заливка спорила бы с
   выбранной владельцем прозрачностью поверхностей. */
.kf-conn.kf-current {
  border: 1px solid rgba(66, 92, 108, 0.42);
  border-radius: var(--r-card, 14px);
  padding: 10px 12px;
}
.kf-role {
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid rgba(128, 144, 156, 0.35);
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12.5px;
}
.kf-conn-form select {
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid rgba(128, 144, 156, 0.35);
  background: transparent;
  color: inherit;
  font: inherit;
}
/* Окно состава команды бывает длинным: оно прокручивается, а не вылезает
   за край экрана — на 760 px это уже заметно. */
.kf-conn-form { max-height: min(70vh, 640px); overflow-y: auto; }

@media (max-width: 480px) {
  .kf-conn-buttons { flex-wrap: wrap; justify-content: flex-end; }
}

/* Длинный адрес в строке настроек («Адрес … не подтверждён») не раздвигает
   страницу на узком экране: колонка текста сжимается, адрес переносится. */
.kf-connections > *, .kf-group > *, .setting-row > div { min-width: 0; }
.kf-conn h2 { overflow-wrap: anywhere; }
@media (max-width: 600px) { .setting-row.kf-conn, .setting-row.lang-row { flex-wrap: wrap; } }
/* План 8.2: три языка — кнопки целиком, на узком экране — строкой ниже. */
.lang-row .tabs { flex: none; }

.kf-conn-form .kf-conn-check{display:flex;align-items:flex-start;gap:8px}
.kf-conn-form .kf-conn-check input{width:16px;height:16px;flex:0 0 16px;margin:2px 0 0}

.kf-mailbox-form { width: min(540px, 76vw); min-width: 0; padding: 2px; }
.kf-mailbox-form fieldset { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-card, 14px); }
.kf-mailbox-form fieldset fieldset { padding: 0; border: 0; }
.kf-mailbox-form fieldset[hidden] { display: none; }
.kf-mailbox-form legend, .kf-mailbox-form summary { font-size: 13px; font-weight: 600; }
.kf-mailbox-form summary { cursor: pointer; }
.kf-mailbox-form details > div { margin-top: 12px; }
.kf-mailbox-form .kf-conn-message:empty { display: none; }
.kf-mailbox-form .kf-conn-buttons { position: sticky; bottom: 0; padding-top: 8px; background: color-mix(in srgb, var(--panel) 88%, Canvas); }
.kf-mailbox-grid, .kf-mailbox-form .kf-mailbox-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kf-mailbox-steps { margin: 0; padding-inline-start: 20px; font-size: 13px; line-height: 1.45; }
.kf-mailbox-steps li + li { margin-top: 3px; }
@media (max-width: 480px) {
  .kf-mailbox-grid, .kf-mailbox-form .kf-mailbox-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Обратная связь как в My Ai (SUPPORT-20261101). */
.modal.support-modal { width: min(560px, calc(100vw - 16px)); max-height: min(92vh, 860px); padding: 0; overflow: hidden; }
.support-modal #modal-content { display: flex; flex-direction: column; max-height: min(92vh, 860px); }
.support-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; flex: none; }
.support-head h2 { margin: 0; font-size: 17px; font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.support-round { width: 44px; height: 44px; flex: none; border-radius: 22px; }
.support-send { min-height: 44px; padding: 0 14px; flex: none; border-radius: 22px; border: 1px solid var(--line); background: var(--accent); color: #14191d; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.support-send:disabled { background: transparent; color: var(--text); opacity: .45; cursor: default; }
.support-body { display: flex; flex-direction: column; gap: 14px; padding: 0 16px 20px; overflow-y: auto; min-height: 0; }
.support-body > * { flex-shrink: 0; }
.support-card { border-radius: 18px; background: rgba(127,127,127,.12); }
.support-choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 12px 16px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.support-choice span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.support-choice svg:last-child:not(.support-glyph) { width: 16px; height: 16px; flex: none; }
.support-group { padding: 14px 16px 4px; border-top: 1px solid rgba(127,127,127,.25); font-size: 12px; font-weight: 600; opacity: .7; }
.support-glyph { width: 22px; height: 22px; flex: none; opacity: .75; }
.support-text { display: block; width: 100%; height: 200px; padding: 14px 16px; border: 0; border-radius: 18px; background: rgba(127,127,127,.12); color: inherit; font: inherit; font-size: 16px; line-height: 1.4; resize: vertical; }
.support-problem { margin: 0; font-size: 13px; color: #ff9a9e; }
.support-problem:empty { display: none; }
.support-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; min-height: 56px; font-size: 15px; }
.support-switch > span { min-width: 0; }
.support-report { display: grid; gap: 10px; padding: 14px 16px; }
.support-report p, .support-report small { margin: 0; font-size: 13px; opacity: .8; }
.support-report .support-switch { padding: 0; min-height: 0; font-size: 13px; }
.support-field { display: grid; gap: 4px; font-size: 12px; }
.support-field input { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid rgba(127,127,127,.3); border-radius: 12px; background: transparent; color: inherit; font: inherit; font-size: 15px; }
.support-files-head { display: flex; justify-content: space-between; font-size: 13px; opacity: .8; }
.support-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.support-thumb, .support-add { position: relative; display: block; aspect-ratio: 1; border-radius: 16px; background: rgba(127,127,127,.12); }
.support-thumb.is-small { width: 56px; }
.support-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 16px; display: block; }
.support-thumb button { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; padding: 5px; border: 0; border-radius: 13px; background: #616161; color: #fff; cursor: pointer; }
.support-add { border: 1px solid rgba(127,127,127,.3); color: inherit; cursor: pointer; display: grid; place-items: center; }
.support-add svg { width: 26px; height: 26px; }
.support-note { margin: 0; font-size: 13px; opacity: .7; }
.support-history-row, .support-thread-row, .support-entry { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 16px; border: 0; background: transparent; color: inherit; font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.support-history-row { background: rgba(127,127,127,.12); border-radius: 18px; }
.support-history-row > span:first-of-type, .support-entry > span:first-of-type { flex: 1; min-width: 0; }
.support-history-row svg:last-child, .support-thread-row svg:last-child { width: 14px; height: 14px; flex: none; opacity: .6; }
.support-entry [data-small] { width: 14px; height: 14px; flex: none; opacity: .6; display: inline-flex; }
.support-entries { border-radius: 14px; overflow: hidden; background: rgba(127,127,127,.1); }
.support-entry + .support-entry, .support-thread-row + .support-thread-row { border-top: 1px solid rgba(127,127,127,.2); }
.support-badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: #14191d; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.support-thread-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.support-thread-text strong { font-weight: 400; overflow-wrap: anywhere; }
.support-thread-text small { font-size: 13px; opacity: .65; }
.support-dot { width: 9px; height: 9px; border-radius: 5px; background: var(--accent); flex: none; }
.support-bubbles { display: flex; flex-direction: column; gap: 10px; }
.support-bubble { align-self: flex-start; max-width: 85%; padding: 10px 14px; border-radius: 16px; background: rgba(127,127,127,.14); }
.support-bubble.is-mine { align-self: flex-end; background: var(--accent); color: #14191d; }
.support-bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.4; }
.support-bubble time { display: block; margin-top: 6px; font-size: 12px; opacity: .65; }
.support-bubble-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.support-bubble-files img { display: block; max-width: 200px; max-height: 200px; border-radius: 10px; }
.support-composer { display: flex; align-items: flex-end; gap: 8px; }
.support-composer textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 160px; padding: 11px 14px; border: 0; border-radius: 20px; background: rgba(127,127,127,.12); color: inherit; font: inherit; font-size: 15px; resize: vertical; }

/* Страница приглашения (SERVER-TEAM, веб). Карточка та же, что у входа; длинное название не раздвигает её. */
#auth-screen { overflow-y: auto; }
.invite-card { max-height: none; margin: auto; }
.invite-card form { margin: 0; }
.invite-card h1 { overflow-wrap: anywhere; }
.invite-card input[readonly] { opacity: 0.72; cursor: default; }
.invite-head { margin-bottom: 16px; }
.invite-tile { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-bottom: 12px; border-radius: 11px; background: #5f7a8b; color: #fff; font-size: 17px; font-weight: 600; }
.invite-what { margin: 2px 0 8px; font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
.invite-detail { margin: 2px 0 0; font-size: 13px; color: rgba(238, 243, 245, 0.72); overflow-wrap: anywhere; }
.invite-small { margin: 14px 0 0; font-size: 12px; color: rgba(238, 243, 245, 0.62); }
.invite-warning { margin: 0 0 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(240, 183, 174, 0.42); background: rgba(240, 183, 174, 0.1); font-size: 13px; overflow-wrap: anywhere; }
.invite-warning p { margin: 4px 0 0; }
.invite-card .auth-actions { flex-wrap: wrap; }
.invite-card .auth-consent { margin-top: 10px; }
@media (prefers-color-scheme: light) {
  .invite-detail { color: rgba(38, 51, 60, 0.74); }
  .invite-small { color: rgba(38, 51, 60, 0.66); }
  .invite-card p.auth-consent, .invite-card .auth-note.ok { color: rgba(38, 51, 60, 0.66); }
}
