/* Twipe 1.9.0: модальные окна, отложенные сообщения, перевод, ИИ-сводка, меню чата. */

.fx-modal {
  position: fixed;
  inset: 0;
  z-index: 100500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-family: inherit;
}
html.fx-modal-open #confirmSheet,
html.fx-modal-open .confirm-sheet { z-index: 100620 !important; }
html.fx-modal-open #overlayBackdrop { z-index: 100610 !important; }
.fx-modal__scrim {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 20, .42);
  opacity: 0;
  transition: opacity .18s ease;
}
.fx-modal__card {
  position: relative;
  width: 100%;
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated, #fff);
  color: var(--text, #000);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
  transform: translateY(24px);
  opacity: 0;
  transition: transform .2s var(--ease-out, ease), opacity .2s ease;
  outline: none;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.fx-modal.is-open .fx-modal__scrim { opacity: 1; }
.fx-modal.is-open .fx-modal__card { transform: none; opacity: 1; }
@media (min-width: 760px) {
  .fx-modal { align-items: center; }
  .fx-modal__card { width: 460px; border-radius: 18px; }
  .fx-modal--wide .fx-modal__card { width: 620px; }
}
.fx-modal__head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 6px 20px; }
.fx-modal__title { flex: 1; font-size: 17px; font-weight: 700; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-modal__x { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.fx-modal__x:hover { background: var(--bg-soft); color: var(--text); }
.fx-modal__body { padding: 6px 20px 18px; overflow-y: auto; overscroll-behavior: contain; }

.fx-field { display: grid; gap: 8px; margin: 12px 0; }
.fx-label { font-size: 13px; font-weight: 650; color: var(--muted); }
.fx-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  color-scheme: light dark;
}
.fx-input:focus { outline: none; border-color: var(--primary); box-shadow: var(--twim-focus); }
.fx-input--sm { height: 36px; width: auto; }
.fx-chips, .fx-langs { display: flex; flex-wrap: wrap; gap: 6px; }
.fx-chip {
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.fx-chip:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); }
.fx-chip.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.fx-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.fx-days[hidden], .fx-until[hidden] { display: none; }
.fx-day { height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.fx-day.is-on { background: color-mix(in srgb, var(--primary) 16%, var(--bg)); border-color: var(--primary); color: var(--primary); }
.fx-until { display: flex; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.fx-until small { color: var(--muted); }
.fx-quote {
  padding: 10px 12px;
  border-left: 3px solid var(--primary);
  border-radius: 4px 12px 12px 4px;
  background: var(--bg-soft);
  font-size: 14.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow: auto;
}
.fx-summary { margin: 4px 0 0; font-size: 15px; font-weight: 600; }
.fx-note { margin: 6px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.fx-note:empty { display: none; }
.fx-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.fx-actions .btn { flex: 1; min-width: 0; height: 46px; margin: 0; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; }

/* Список запланированных */
.fx-list { display: grid; gap: 10px; }
.fx-empty { display: grid; justify-items: center; gap: 4px; padding: 26px 8px; color: var(--muted); text-align: center; }
.fx-empty svg { width: 34px; height: 34px; opacity: .6; }
.fx-empty p { margin: 6px 0 0; color: var(--text); font-weight: 600; }
.fx-job { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.fx-job.is-paused { opacity: .72; }
.fx-job__when { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 650; color: var(--primary); }
.fx-job.is-paused .fx-job__when { color: var(--muted); }
.fx-job__when em { font-style: normal; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--primary) 12%, transparent); }
.fx-job__chat { margin-top: 4px; font-size: 13px; color: var(--muted); }
.fx-job__text { margin-top: 6px; font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.fx-job__err { margin-top: 6px; font-size: 13px; color: #e5484d; }
.fx-job__meta { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.fx-job__acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fx-danger { color: #e5484d !important; }

/* Полоски в чате */
.fx-schedbar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - 16px);
  margin: 0 8px 6px;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 10%, var(--bg-elevated));
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.fx-schedbar svg { color: var(--primary); flex: none; }
.fx-schedbar.hidden, .fx-sumbar.hidden { display: none; }
.fx-sumbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 6px 10px 0;
  padding: 4px 4px 4px 0;
  border-radius: 14px;
  background: linear-gradient(100deg, color-mix(in srgb, #8774e1 16%, var(--bg-elevated)), color-mix(in srgb, var(--primary) 14%, var(--bg-elevated)));
  box-shadow: 0 2px 10px var(--shadow);
}
.fx-sumbar__go { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 7px 10px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.fx-sumbar__go svg { color: #8774e1; flex: none; }
.fx-sumbar__go span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-sumbar__x { width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }

/* Сводка */
.fx-sum-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.fx-sum-head svg { color: #8774e1; }
.fx-sum { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.fx-sum li { position: relative; padding: 10px 12px 10px 30px; border-radius: 12px; background: var(--bg-soft); font-size: 15px; line-height: 1.42; word-break: break-word; }
.fx-sum li::before { content: ""; position: absolute; left: 13px; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: #8774e1; }
.fx-sum li.fx-sum__skel { height: 40px; background: linear-gradient(90deg, var(--bg-soft) 0%, color-mix(in srgb, var(--line) 70%, var(--bg-soft)) 50%, var(--bg-soft) 100%); background-size: 200% 100%; animation: fxSkel 1.1s linear infinite; }
.fx-sum li.fx-sum__skel::before { display: none; }
@keyframes fxSkel { to { background-position: -200% 0; } }

/* Перевод */
.msg-tr-row { margin-top: 2px; }
.msg-tr-note { display: inline-block; padding: 0; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--primary); opacity: .9; }
.msg-tr-note--btn { cursor: pointer; }
.msg-tr-note--btn:hover { text-decoration: underline; }
.msg.out .msg-tr-note { color: inherit; opacity: .75; }
.msg-text--tr { font-style: normal; }

/* Меню чата «⋯» */
.chat-more-btn svg { display: block; }
.fx-menu {
  position: fixed;
  z-index: 100400;
  padding: 6px;
  border-radius: 14px;
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2), 0 0 0 1px var(--glass-border, rgba(0, 0, 0, .06));
  transform-origin: top right;
  transform: scale(.96);
  opacity: 0;
  transition: transform .14s ease, opacity .14s ease;
}
.fx-menu.is-open { transform: none; opacity: 1; }
.fx-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: inherit; font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.fx-menu button:hover, .fx-menu button:focus-visible { background: var(--bg-soft); outline: none; }
.fx-menu button svg { flex: none; color: var(--muted); }

[data-theme="dark"] .fx-modal__scrim { background: rgba(0, 0, 0, .6); }
[data-theme="dark"] .fx-chip.is-on { color: #fff; }

/* Папки */
.fx-switch { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 15px; cursor: pointer; }
.fx-switch input { width: 20px; height: 20px; accent-color: var(--primary); margin: 0; }
.folder-tab-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: 1px;
}
.folder-tab--add { min-width: 40px; padding: 0 12px !important; font-size: 18px; font-weight: 500; color: var(--muted) !important; }
.folder-tab--smart::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: #8774e1;
  vertical-align: 2px;
}

/* Статусы */
.vibe-pill[data-vibe="2"] .vibe-dot { background: #e5484d !important; box-shadow: 0 0 0 3px rgba(229, 72, 77, .3) !important; }
.vibe-pill[data-vibe="3"] .vibe-dot { background: #94a3b8; box-shadow: 0 0 0 3px rgba(148, 163, 184, .4); }
.vibe-pill span:last-child { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-presence { display: grid; gap: 6px; }
.fx-pres { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.fx-pres.is-on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--bg)); }
.fx-pres__dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .22); }
.fx-pres--focus .fx-pres__dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .25); }
.fx-pres--dnd .fx-pres__dot { background: #e5484d; box-shadow: 0 0 0 3px rgba(229, 72, 77, .25); }
.fx-pres--away .fx-pres__dot { background: #94a3b8; box-shadow: 0 0 0 3px rgba(148, 163, 184, .3); }
.fx-pres__txt { display: grid; gap: 2px; }
.fx-pres__txt b { font-size: 15px; }
.fx-pres__txt small { font-size: 13px; color: var(--muted); line-height: 1.3; }
.fx-field[hidden] { display: none; }
.fx-textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.4; }
.fx-chips--col { display: grid; gap: 6px; }
.fx-chips--col .fx-chip { height: 42px; border-radius: 12px; text-align: left; padding: 0 14px; }
.fx-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fx-row2 label { display: grid; gap: 6px; }
.chat-presence--status.chat-presence--dnd .chat-presence-dot { background: #e5484d; }
.chat-presence--status.chat-presence--focus .chat-presence-dot { background: #f59e0b; }
.chat-presence--status.chat-presence--away .chat-presence-dot { background: #94a3b8; }
.peer-status-line { margin-top: 4px; font-size: 14px; font-weight: 600; color: #e5484d; }
.peer-status-line--focus { color: #d97706; }
.peer-status-line--away { color: var(--muted); }
.msg-auto { display: inline-block; padding: 1px 8px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 16%, transparent); font-size: 11.5px; font-weight: 600; color: var(--muted); }
.st-status { display: inline-flex; align-items: center; gap: 7px; margin-top: 6px; padding: 5px 10px 5px 9px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg-elevated); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; max-width: 100%; }
.st-status-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; }
.st-status--focus .st-status-dot { background: #f59e0b; }
.st-status--dnd .st-status-dot { background: #e5484d; }
.st-status--away .st-status-dot { background: #94a3b8; }
.st-status-chev { color: var(--muted); font-size: 15px; line-height: 1; }
.st-status-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-presence--status { display: inline-flex; align-items: center; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Нижняя панель */
.app-dock-inner { grid-template-columns: repeat(var(--dock-n, 4), 1fr) !important; }
.dock-btn[hidden] { display: none !important; }
.ui-icon--dock-boards {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='13' rx='2'/%3E%3Cpath d='M7 13l3-3 2 2 4-4M8 21l4-4 4 4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='13' rx='2'/%3E%3Cpath d='M7 13l3-3 2 2 4-4M8 21l4-4 4 4'/%3E%3C/svg%3E");
}
.fx-switch--row { align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fx-switch--row:last-of-type { border-bottom: 0; }
.fx-switch--row input { margin-top: 2px; }
.fx-switch--row span { display: grid; gap: 2px; }
.fx-switch--row small { color: var(--muted); font-size: 13px; }

/* Раздел «Доски» */
.sb-page {
  position: fixed;
  inset: 0;
  z-index: 99980;
  display: flex;
  flex-direction: column;
  background: var(--bg-soft, #f5f5f5);
  color: var(--text);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .18s ease, transform .18s ease;
}
.sb-page.is-open { opacity: 1; transform: none; }
html.sb-open .fx-modal { z-index: 100500; }
.sb-head { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 8px; background: var(--bg-elevated); border-bottom: 1px solid var(--line); }
.sb-head h2 { flex: 1; margin: 0; font-size: 19px; font-weight: 750; }
.sb-ib { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; }
.sb-ib:hover { background: var(--bg-soft); }
.sb-new { border-radius: 99px !important; }
.sb-tools { display: grid; gap: 10px; padding: 12px; }
.sb-folders:empty { display: none; }
.sb-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); align-content: start; gap: 12px; padding: 4px 12px calc(24px + env(safe-area-inset-bottom, 0px)); }
.sb-card { position: relative; display: flex; flex-direction: column; border-radius: 16px; background: var(--bg-elevated); box-shadow: 0 1px 3px var(--shadow), 0 0 0 1px color-mix(in srgb, var(--line) 60%, transparent); overflow: hidden; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.sb-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px var(--shadow-lg); }
.sb-card__cover { position: relative; display: grid; place-items: center; height: 96px; background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--c) 35%, transparent) 1px, transparent 0) 0 0 / 14px 14px, color-mix(in srgb, var(--c) 12%, var(--bg-elevated)); }
.sb-card__cover span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--c); color: #fff; font-size: 20px; font-weight: 750; box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 40%, transparent); }
.sb-card__cover em { position: absolute; top: 8px; left: 10px; font-style: normal; font-size: 13px; }
.sb-card__body { display: grid; gap: 3px; padding: 10px 12px 12px; min-width: 0; }
.sb-card__body b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-card__body small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-card__more { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--bg-elevated) 85%, transparent); color: var(--text); font-size: 18px; line-height: 1; cursor: pointer; }
.sb-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 8px; padding: 50px 16px; text-align: center; color: var(--muted); }
.sb-empty b { color: var(--text); font-size: 17px; }
.sb-empty p { margin: 0 0 8px; max-width: 320px; line-height: 1.4; }
.sb-empty__art { width: 88px; height: 64px; border-radius: 14px; background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--primary) 40%, transparent) 1px, transparent 0) 0 0 / 12px 12px, color-mix(in srgb, var(--primary) 10%, var(--bg-elevated)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 25%, transparent); }
html.sb-open #confirmSheet, html.sb-open .confirm-sheet { z-index: 100060 !important; }
html.sb-open #overlayBackdrop { z-index: 100050 !important; }
