/* Оформление мини-приложения.
 *
 * Тема берётся у Telegram: значения themeParams подставляются в переменные
 * скриптом при загрузке и заново на событии themeChanged. Значения ниже —
 * запасные: они действуют, пока Telegram не прислал свои, и подхватывают
 * системную тему через prefers-color-scheme.
 *
 * Внешних шрифтов нет намеренно. Макет рисовался с JetBrains Mono, но за
 * шрифтом пришлось бы ходить на сторонний домен, а он в CSP не разрешён:
 * ради начертания открывать интерфейсу выход наружу неразумно. Системная
 * моноширинная гарнитура даёт тот же эффект и грузится мгновенно.
 */

:root {
  color-scheme: light dark;

  --bg: #f6f6f4;
  --card: #ffffff;
  --section: #f1f1ef;
  --text: #18181b;
  --hint: rgba(24, 24, 27, 0.55);
  --line: rgba(24, 24, 27, 0.10);
  --field: #fbfbfa;
  --accent: #7b57e0;
  --accent-soft: rgba(123, 87, 224, 0.12);
  --on-accent: #ffffff;
  --danger: #c02626;

  /* Цвета папок Telegram: красный, оранжевый, фиолетовый, зелёный, бирюзовый,
   * синий, розовый — в порядке номеров, которые приходят в поле color. */
  --folder-0: #e5484d;
  --folder-1: #f76b15;
  --folder-2: #8e4ec6;
  --folder-3: #30a46c;
  --folder-4: #12a594;
  --folder-5: #0090ff;
  --folder-6: #d6409f;

  --radius: 18px;
  --radius-sm: 11px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171a;
    --card: #1f1f23;
    --section: #26262b;
    --text: #f2f2f5;
    --hint: rgba(242, 242, 245, 0.55);
    --line: rgba(242, 242, 245, 0.12);
    --field: #26262b;
    --accent: #a78bfa;
    --accent-soft: rgba(167, 139, 250, 0.16);
    --on-accent: #1f1140;
    --danger: #ff6b6b;
  }
}

* { box-sizing: border-box; }

/* Скрытое обязано быть скрытым.
 *
 * Экраны и шторки — flex-контейнеры, а правило класса перебивает display:none
 * из стилей браузера для [hidden]. Без этой строки все экраны показываются
 * разом, и переключение между ними не работает вовсе. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  padding: 22px 16px calc(28px + env(safe-area-inset-bottom));
}

a { color: var(--accent); text-decoration: none; }
a:active { opacity: .7; }

.mono { font-family: var(--mono); }

/* --- каркас экрана --- */

.screen {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.brand .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.brand-text {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--hint);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 22px 24px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 18px 40px -30px rgba(0, 0, 0, .35);
}

.card.center { text-align: center; }

h1 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.012em;
}

h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.hint {
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--hint);
}

.footnote {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--hint);
}

.error {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--danger);
}

.toast {
  margin: 12px 0 0;
  min-height: 18px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

/* --- поля и кнопки --- */

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 14px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.field:focus-within { border-color: var(--accent); }

.field-prefix {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--hint);
}

.field input,
.field textarea {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: .04em;
}

button {
  font: inherit;
  cursor: pointer;
}

button.primary {
  margin-top: 18px;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 600;
}

button.primary:disabled { opacity: .55; cursor: default; }

button.ghost, button.danger {
  height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

button.danger { border-color: var(--danger); color: var(--danger); }

.icon-button {
  flex: none;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--hint);
}

.icon-button:hover { background: var(--accent-soft); color: var(--accent); }

/* --- ячейки кода --- */

.cells { display: flex; gap: 8px; }

.cells input {
  flex: 1;
  min-width: 0;
  height: 58px;
  text-align: center;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: 0;
  color: var(--text);
  caret-color: var(--accent);
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 600;
}

.cells input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.row-between {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

/* --- шаги --- */

.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.steps i {
  width: 22px;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
}

.steps i.wide { width: 80px; }
.steps i.on { background: var(--accent); }

/* --- экран аккаунта --- */

.identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 56px;
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(160deg, #b79dff, #7b57e0);
  color: #fff;
  font-size: 20px;
  font-weight: 600;
}

.identity-text { min-width: 0; flex: 1; }

.identity-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-username {
  margin-top: 2px;
  font-size: 13px;
  color: var(--accent);
}

/* Три точки прижаты к верху блока имени, чтобы стоять на одной высоте с ним. */
.menu-anchor { position: relative; align-self: flex-start; }

.menu {
  position: absolute;
  top: 34px;
  right: 0;
  z-index: 10;
  min-width: 190px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .4);
}

.menu button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  text-align: left;
}

.menu button:hover { background: var(--section); }

.rows {
  margin-top: 22px;
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 8px 12px;
  background: var(--card);
  font-size: 13px;
}

.row-label { color: var(--hint); }

.row-value {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.row-value .mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- шторка --- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .45);
}

.sheet-body {
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sheet-body.narrow { max-width: 340px; align-self: center; }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.confirm-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* --- строка аккаунта в списке ---
 *
 * Каждый аккаунт — отдельная карточка на подложке, а не строка общего
 * списка: так несколько аккаунтов не сливаются в один блок. */

.account-item {
  padding: 14px 14px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.account-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-title { flex: 1; min-width: 0; }

.account-title .name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-title .sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--hint);
}

/* Кнопки стоят в одну строку и делят её поровну — их суммарная ширина
 * всегда равна ширине карточки, одна кнопка растягивается на всю ширину. */
.account-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.account-actions button {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.account-actions button.accent { border-color: var(--accent); color: var(--accent); }

/* --- поля токена MCP --- */

.mcp-hint { margin-bottom: 16px; }

.field-label {
  margin: 14px 0 6px;
  font-size: 12px;
  color: var(--hint);
}

.mcp-hint + .field-label { margin-top: 0; }

.field.mono-field input {
  letter-spacing: 0;
  text-overflow: ellipsis;
}

.field.mono-field .icon-button { flex: none; }


.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
}

/* --- заставка --- */

.spinner {
  width: 26px;
  height: 26px;
  margin: 4px auto 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- кнопка «Отмена» на шагах входа --- */

button.wide {
  width: 100%;
  margin-top: 10px;
  height: 46px;
}

/* --- переходы с экрана аккаунта --- */

.nav-list {
  margin-top: 16px;
  display: grid;
  /* minmax(0, 1fr): иначе длинная подсказка раздвигает колонку за рамку. */
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 12px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  text-align: left;
  transition: border-color .15s ease, background-color .15s ease, transform .1s ease;
}

.nav-item:hover { border-color: var(--accent); }
.nav-item:active { transform: scale(.985); background: var(--section); }

.nav-icon {
  flex: none;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.nav-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.005em;
}

.nav-hint {
  margin-top: 1px;
  font-size: 12px;
  color: var(--hint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-chevron { flex: none; color: var(--hint); }

/* --- страницы с длинными списками --- */

/* Экраны со списками тянутся на всю высоту окна: когда список короткий,
 * панель сохранения всё равно стоит у нижнего края, а не посреди экрана. */
#screen-folders, #screen-exclusions {
  min-height: calc(100vh - 50px - env(safe-area-inset-bottom));
}

#screen-folders .action-bar, #screen-exclusions .action-bar { margin-top: auto; }

.page-head h1 { margin-bottom: 6px; }
.page-head .hint { margin: 0; }

.search-row { display: flex; gap: 8px; }
.search-row .field.search { flex: 1; min-width: 0; }

.field.search { height: 44px; color: var(--hint); }

.filter-button {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--hint);
  transition: border-color .15s ease, color .15s ease;
}

.filter-button:hover, .filter-button.active { border-color: var(--accent); color: var(--accent); }

.filter-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}

.filter-summary {
  margin: -10px 2px 0;
  font-size: 11.5px;
  color: var(--hint);
}

/* --- чекбоксы фильтра --- */

.check-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font-size: 14px;
  text-align: left;
  transition: border-color .15s ease, background-color .15s ease;
}

.check-row:hover { border-color: var(--accent); }
.check-row.on { border-color: var(--accent); background: var(--accent-soft); }

.check-row .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-box {
  flex: none;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--on-accent);
  transition: background-color .15s ease, border-color .15s ease;
}

.check-row.on .check-box { background: var(--accent); border-color: var(--accent); }
.check-box svg { opacity: 0; transform: scale(.6); transition: opacity .15s ease, transform .15s ease; }
.check-row.on .check-box svg { opacity: 1; transform: none; }

.filter-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}

.filter-actions button { margin: 0; height: 48px; width: 100%; }

/* --- пара «отправитель в чате» на экране исключений --- */

.chat-line {
  margin: 10px 0 0 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--hint);
}

.chat-line > span:first-child { flex: none; white-space: nowrap; }

.chat-line .avatar.tiny {
  flex: none;
  width: 22px;
  height: 22px;
  font-size: 9px;
  overflow: hidden;
  position: relative;
}

.chat-line .avatar.tiny img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-line .chat-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 600;
}

.chat-line a { flex: none; font-family: var(--mono); font-size: 11.5px; }

.move-button.whole-chat {
  display: block;
  margin: 10px 0 0 56px;
  height: 30px;
  font-size: 12px;
}

/* --- ошибка сохранения у нижней панели --- */

.action-error {
  grid-column: 1 / -1;
  margin: 0 0 2px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 10%, var(--card));
  font-size: 13px;
  animation: rise .2s ease both;
}
.field.search input { font-family: inherit; letter-spacing: 0; font-size: 15px; }
.field.search input::-webkit-search-cancel-button { display: none; }

.entity-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Нижняя панель прилипает к краю экрана: кнопки сохранения доступны, как бы
 * далеко ни пролистан список. Градиент прячет уходящие под неё карточки. */
.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin: 0 -16px calc(-28px - env(safe-area-inset-bottom));
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 34%);
}

.action-bar button { margin: 0; height: 50px; }
.action-bar button.ghost { width: 100%; background: var(--card); }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 6px 2px 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--hint);
}

.section-title + .entity-list { margin-bottom: 22px; }

.empty-note {
  padding: 18px 16px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  font-size: 13px;
  color: var(--hint);
  text-align: center;
}

/* --- карточка сущности --- */

.entity {
  padding: 14px 14px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color .2s ease, box-shadow .2s ease;
  animation: rise .28s ease both;
}

/* Изменённая, но не сохранённая сущность подсвечена: видно, что уйдёт в
 * Telegram по кнопке «Сохранить». */
.entity.changed {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.entity-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar.small {
  width: 44px;
  height: 44px;
  font-size: 15px;
  overflow: hidden;
  position: relative;
}

.avatar.small img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .25s ease;
}

.avatar.small img.loaded { opacity: 1; }

.avatar.tone-0 { background: linear-gradient(160deg, #ff8a80, #e5484d); }
.avatar.tone-1 { background: linear-gradient(160deg, #ffb74d, #f76b15); }
.avatar.tone-2 { background: linear-gradient(160deg, #b79dff, #7b57e0); }
.avatar.tone-3 { background: linear-gradient(160deg, #7ee2a8, #30a46c); }
.avatar.tone-4 { background: linear-gradient(160deg, #6ee7d8, #12a594); }
.avatar.tone-5 { background: linear-gradient(160deg, #7cc4ff, #0090ff); }
.avatar.tone-6 { background: linear-gradient(160deg, #f59ad3, #d6409f); }

.entity-text { flex: 1; min-width: 0; }

.entity-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-meta {
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 12px;
}

.type-badge {
  flex: none;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--section);
  color: var(--hint);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: lowercase;
}

.type-badge.bot { color: var(--folder-5); }
.type-badge.channel { color: var(--folder-2); }
.type-badge.chat { color: var(--folder-3); }

.entity-link {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
}

.entity-link.none { color: var(--hint); }

.entity-date {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--hint);
}

.entity-date b { font-weight: 600; color: var(--text); }

/* Вся область папок — одна кнопка: папки меняются в модальном окне. */
.folder-area {
  margin-top: 10px;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: border-color .15s ease, background-color .15s ease;
}

.folder-area:hover { border-color: var(--accent); }

/* Во время сохранения список не принимает правок. */
.entity-list.locked { opacity: .6; pointer-events: none; transition: opacity .2s ease; }
.folder-area:active { background: var(--section); }

.folder-area .plain {
  padding: 3px 2px;
  font-size: 12.5px;
  color: var(--hint);
}

.chip {
  --chip: var(--accent);
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--chip) 16%, transparent);
  color: color-mix(in srgb, var(--chip) 82%, var(--text));
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip.c0, .dot-chip.c0 { --chip: var(--folder-0); }
.chip.c1, .dot-chip.c1 { --chip: var(--folder-1); }
.chip.c2, .dot-chip.c2 { --chip: var(--folder-2); }
.chip.c3, .dot-chip.c3 { --chip: var(--folder-3); }
.chip.c4, .dot-chip.c4 { --chip: var(--folder-4); }
.chip.c5, .dot-chip.c5 { --chip: var(--folder-5); }
.chip.c6, .dot-chip.c6 { --chip: var(--folder-6); }

/* --- строки папок в модальных окнах --- */

button.add-folder {
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.folder-rows {
  margin: 14px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.folder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font-size: 14px;
  text-align: left;
  animation: rise .2s ease both;
}

.folder-row:hover { border-color: var(--accent); }

.folder-row .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-row .action {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--hint);
}

.folder-row.removable:hover .action { color: var(--danger); }

.dot-chip {
  --chip: var(--hint);
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--chip);
}

.dot-chip.none { background: transparent; border: 2px solid var(--line); }

.shared-mark {
  flex: none;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--section);
  color: var(--hint);
  font-family: var(--mono);
  font-size: 10px;
}

/* --- строки экрана исключений --- */

.entity.compact { padding: 12px; }

.move-button {
  flex: none;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

.move-button.exclude:hover { border-color: var(--danger); color: var(--danger); }
.move-button.restore:hover { border-color: var(--accent); color: var(--accent); }
.move-button:active { background: var(--section); }

/* --- загрузка длинных списков --- */

.loader-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 2px 0 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--hint);
}

.loader-note .pulse {
  display: inline-flex;
  gap: 4px;
}

.loader-note .pulse i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}

.loader-note .pulse i:nth-child(2) { animation-delay: .15s; }
.loader-note .pulse i:nth-child(3) { animation-delay: .3s; }

.skeleton {
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.skeleton .row-sk { display: flex; align-items: center; gap: 12px; }

.sk {
  position: relative;
  overflow: hidden;
  background: var(--section);
  border-radius: 7px;
}

/* Блик проходит по заглушкам слева направо: видно, что экран жив и данные
 * вот-вот придут. */
.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: shimmer 1.35s ease-in-out infinite;
}

@media (prefers-color-scheme: dark) {
  .sk::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
  }
}

.sk.circle { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.sk.line { height: 12px; }
.sk.w40 { width: 40%; }
.sk.w55 { width: 55%; }
.sk.w70 { width: 70%; }
.sk.chips { height: 30px; margin-top: 12px; border-radius: 10px; }
.sk + .sk.line { margin-top: 8px; }

.skeleton:nth-child(2) .sk::after { animation-delay: .12s; }
.skeleton:nth-child(3) .sk::after { animation-delay: .24s; }
.skeleton:nth-child(4) .sk::after { animation-delay: .36s; }

@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 3s; }
  .sk::after, .loader-note .pulse i { animation: none; }
  .entity, .folder-row { animation: none; }
}
