/* Без зума пальцами / двойного тапа (как в нативном приложении) */
html.crew-v2,
html.crew-v2 body {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

html.crew-v2 input,
html.crew-v2 textarea,
html.crew-v2 select {
  font-size: 16px;
}

/* Доп. полировка CrewChat — плотная вёрстка, без «пустоты» на телефоне */

@media (max-width: 899px) {
  html.crew-v2 #thread {
    display: none !important;
  }
  html.crew-v2 body.chat-open[data-main-tab="chats"] #thread {
    display: grid !important;
  }
  html.crew-v2 #noChat,
  html.crew-v2 .crew-thread-placeholder {
    display: none !important;
  }
}

html.crew-v2 .crew-shell {
  height: 100%;
  min-height: 0;
}

html.crew-v2 .crew-shell-main {
  min-height: 0;
  overflow: hidden;
}

html.crew-v2 .crew-panel {
  min-height: 0;
}

html.crew-v2 .crew-panel--scroll {
  grid-template-rows: auto minmax(0, 1fr);
}

html.crew-v2 .crew-panel-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  padding-bottom: 12px;
}

html.crew-v2 .crew-profile-card {
  margin: 0 16px 14px;
  padding: 20px 16px 16px;
  border-radius: 16px;
  background: var(--crew-surface);
  border: 1px solid var(--crew-border);
}

html.crew-v2 .crew-menu-label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 600;
}

html.crew-v2 .crew-theme-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 4px 14px 16px;
}

html.crew-v2 .crew-theme-pick button {
  min-height: 52px;
  border-radius: 12px;
  font-size: 15px;
}

html.crew-v2 {
  --crew-bg: #141210;
  --crew-bg-2: #1c1916;
  --crew-surface: #24201c;
  --crew-border: #3a342c;
  --crew-accent: #c4a574;
  --crew-accent-2: #c4a574;
  --wa: #c4a574;
  --wa-deep: #a88b5c;
  --ink: #f3efe8;
  --muted: #a3988c;
  --chat: #12100e;
  --bubble: #2a2520;
  --out: #5c4a32;
  --field: #2e2924;
  --hover: #322c26;
}

html.crew-v2[data-theme="light"] {
  --crew-bg: #f6f3ee;
  --crew-bg-2: #fffdf9;
  --crew-surface: #fffdf9;
  --crew-border: #e4ddd2;
  --crew-accent: #8a6a3b;
  --ink: #1c1814;
  --muted: #6f675e;
  --chat: #efeae3;
  --bubble: #fffdf9;
  --out: #efe2cf;
  --field: #f3eee6;
}

html.crew-v2 .crew-thread-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
}

html.crew-v2 .crew-thread-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  min-width: 0;
}

html.crew-v2 .crew-thread-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 12px 10px 56px;
  overflow: auto;
}

html.crew-v2 .crew-chip-btn--danger {
  color: #d9534f;
}

html.crew-v2 .crew-thread-tools:not(:has(button:not([hidden]))) {
  display: none;
}

html.crew-v2 .crew-list {
  gap: 0;
}

html.crew-v2 #panelChats .crew-scroll {
  padding: 0;
}

html.crew-v2 .bubble {
  border-radius: 4px 16px 16px 16px;
  padding: 8px 12px 6px;
}

html.crew-v2 .bubble.mine {
  border-radius: 16px 4px 16px 16px;
  background: var(--out);
  color: #f7f1e8;
}

html.crew-v2 .crew-icon-btn--accent {
  background: var(--crew-accent);
  color: #1c1814;
}

html.crew-v2 .crew-head h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

html.crew-v2 .crew-search {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

html.crew-v2 .crew-chat-item {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--crew-border);
  background: transparent;
  box-shadow: none;
  transform: none;
}

html.crew-v2 .crew-chat-item:active {
  transform: none;
  background: var(--hover);
}

html.crew-v2 .crew-chat-item.is-active {
  background: var(--hover);
  border-color: var(--crew-border);
}

html.crew-v2 .crew-chat-item.is-active::before {
  content: none;
}

html.crew-v2 .crew-chat-item .crew-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  box-shadow: none;
  font-size: 18px;
}

html.crew-v2 .crew-chat-top time,
html.crew-v2 .crew-chat-top time.is-fresh {
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}

html.crew-v2 .crew-chat-preview {
  margin-top: 2px;
  font-size: 15px;
}

html.crew-v2 body.hub-mode #shell,
html.crew-v2 body.hub-mode #layout,
html.crew-v2 body.hub-mode #hub,
html.crew-v2 body.hub-mode #thread {
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
}

html.crew-v2 .crew-dock {
  flex-shrink: 0;
  margin: 0 !important;
  padding: 0 4px 0 !important;
  min-height: 0;
  background: var(--crew-bg);
  border-top: 1px solid var(--crew-border);
  box-shadow: none;
}

html.crew-v2 .crew-dock button {
  padding: 6px 8px;
  background: transparent;
  border-radius: 0;
}

html.crew-v2 .crew-dock button.is-on {
  background: transparent;
  color: var(--crew-accent);
  box-shadow: none;
}

html.crew-v2 .crew-dock button.is-on::after {
  content: none;
}

html.crew-v2 .crew-composer-bar {
  margin: 0 !important;
  padding: 4px 8px 0 !important;
  background: var(--crew-bg);
  border-top: 1px solid var(--crew-border);
}

html.crew-v2 #composer.crew-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
}

html.crew-v2 .crew-composer-field {
  flex: 1 1 auto !important;
  width: auto !important;
  max-width: none;
  min-width: 0;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 0;
  border-radius: 22px;
  background: var(--field);
  overflow: hidden;
}

html.crew-v2 #messageInput {
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 16px;
  line-height: 44px;
  color: var(--ink);
}

html.crew-v2 #messageInput:focus,
html.crew-v2 #messageInput:focus-visible,
html.crew-v2 .crew-composer-field:focus-within {
  outline: none;
  box-shadow: none;
}

html.crew-v2 .crew-composer-btn,
html.crew-v2 .crew-composer-send {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 0;
  background: transparent;
  color: var(--ink);
}

html.crew-v2 .crew-composer-send {
  background: var(--crew-accent);
  color: #1c1814;
}

html.crew-v2 .settings-credit {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--crew-border);
}
