:root {
  --teal: #087F78;
  --teal-dark: #153F3C;
  --teal-hover: #076F69;
  --mint: #E9F6F3;
  --mint-strong: #D7F0EA;
  --bg: #F8FAF9;
  --card: #FFFFFF;
  --text: #202625;
  --muted: #6F7977;
  --line: #E1E8E6;
  --mango: #FFB657;
  --mango-strong: #FFA51F;
  --coral: #E9655B;
  --incoming: #F1EAF8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background:
    radial-gradient(circle at 88% 2%, rgba(255, 182, 87, .14), transparent 20rem),
    radial-gradient(circle at 2% 12%, rgba(8, 127, 120, .09), transparent 22rem),
    var(--bg);
  color: var(--text);
  font: 16px/1.5 "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app { height: 100%; }

a { color: inherit; text-decoration: none; }

.screen {
  max-width: 680px;
  margin: 0 auto;
  padding: 22px 18px calc(20px + env(safe-area-inset-bottom));
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Шапка бренда на входных экранах */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 23px;
  letter-spacing: -.02em;
}
.brand img { width: 44px; height: 44px; border-radius: 12px; }
/* Шапка входных экранов: знак слева, выбор языка интерфейса справа. */
.top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.top .ui-lang {
  width: auto;
  flex: none;
  margin: 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 700;
  color: #42504D;
}
.brand .a { color: var(--teal); }
.brand .b { color: var(--mango-strong); }

h1 {
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -.04em;
  margin: 26px 0 10px;
}
h1 .accent { color: var(--teal); }
h2 { font-size: 19px; margin: 30px 0 12px; letter-spacing: -.02em; }
.sub { color: var(--muted); font-size: 16px; margin: 0 0 24px; }
.foot-note { color: var(--muted); font-size: 13px; margin-top: 18px; text-align: center; }

label { display: block; font-size: 14px; font-weight: 600; color: #4C5654; margin: 16px 0 7px; }

input, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 15px;
  outline: none;
}
input::placeholder { color: #A3ADAB; }
input:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(8, 127, 120, .12); }
select { appearance: none; background-image: none; }

button {
  font: inherit;
  font-weight: 800;
  border: 0;
  border-radius: 16px;
  padding: 15px 20px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: background .16s ease, transform .16s ease, color .16s ease;
}
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--teal); color: #fff; box-shadow: 0 10px 24px rgba(8, 127, 120, .18); }
button.primary:hover:not(:disabled) { background: var(--teal-hover); }
button.second { background: var(--card); color: var(--teal); border: 1px solid #BBD7D2; }
button.mango { background: var(--mango); color: #3A3023; }
button.wide { width: 100%; }
button.small { padding: 10px 14px; font-size: 14px; font-weight: 700; border-radius: 12px; }
button.link { background: none; padding: 0; color: var(--teal); font-size: 13px; font-weight: 700; }

.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.mt { margin-top: 20px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
}
.card .name { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }

/* Администрирование: таблиц нет, только плитки и карточки */
.screen.wide { max-width: 980px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.tiles .name { font-size: 26px; }
@media (max-width: 760px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.hint { color: var(--muted); font-size: 14px; margin-top: 6px; }
.error { color: var(--coral); font-size: 14px; margin-top: 14px; min-height: 20px; font-weight: 600; }
.error.ok { color: var(--teal); }

.people { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.chip {
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--mint);
  color: #3E4A48;
}
.chip.on { color: var(--teal); }
.chip .dot { color: #B7C2BF; margin-right: 6px; }
.chip.on .dot { color: var(--teal); }

/* Ссылка-приглашение */
.invite {
  display: block;
  background: var(--mint);
  border-radius: 14px;
  padding: 14px 15px;
  margin: 14px 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--teal-dark);
  word-break: break-all;
}

/* Экран разговора — шапка компактная: название + мелкие кружки в один ряд */
.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.head-main { min-width: 0; flex: 1; }
.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.head .title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.03em;
  min-width: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.head .meta { display: none; }

.faces {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 0;
  flex: none;
  max-width: 46%;
  overflow-x: auto;
  scrollbar-width: none;
}
.faces::-webkit-scrollbar { display: none; }
.face-card {
  width: 72px;
  text-align: center;
  flex: none;
}
.face-card.compact { width: 36px; }
.face-card .face-photo {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: var(--mint);
  border: 3px solid #D7E8E4;
}
.face-card.compact .face-photo {
  width: 36px;
  height: 36px;
  border-width: 2px;
}
.face-card.online .face-photo { border-color: var(--teal); }
.face-card.typing .face-photo,
.face-card.recording .face-photo {
  border-color: var(--mango);
  box-shadow: 0 0 0 3px rgba(255, 165, 31, 0.25);
}
.face-card.compact.typing .face-photo,
.face-card.compact.recording .face-photo {
  box-shadow: 0 0 0 2px rgba(255, 165, 31, 0.28);
}
.face-card.offline .face-photo { opacity: .55; border-color: #CDD8D5; }
.face-card .face-photo img,
.face-card .face-photo .initials {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.face-card .initials {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.face-card.compact .initials { font-size: 12px; }
.face-card .face-dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #B7C2BF;
  border: 2px solid #fff;
}
.face-card.compact .face-dot {
  width: 10px;
  height: 10px;
  right: 0;
  bottom: 0;
  border-width: 1.5px;
}
.face-card.online .face-dot { background: var(--teal); }
.face-card.typing .face-dot,
.face-card.recording .face-dot { background: var(--mango); }
.face-card .face-name {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.face-card .face-act {
  min-height: 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--mango);
  line-height: 1.2;
}
.face-card.compact .face-name,
.face-card.compact .face-act { display: none; }
.face-card.mine .face-name { color: var(--teal); }

.avatar-edit {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 4px 0 8px;
}
.avatar-edit .face-card { width: 72px; }
.avatar-edit-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.avatar-edit-fields input { margin: 0; }

.crop-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(18, 28, 26, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.crop-card {
  width: min(100%, 360px);
  background: var(--card);
  border-radius: 22px;
  padding: 18px 16px 16px;
  box-shadow: 0 18px 48px rgba(8, 40, 36, .22);
}
.crop-card h2 {
  margin: 0 0 6px;
  font-size: 20px;
}
.crop-card .hint { margin-bottom: 12px; }
.crop-stage {
  position: relative;
  width: 280px;
  height: 280px;
  max-width: 100%;
  margin: 0 auto 14px;
  border-radius: 50%;
  overflow: hidden;
  background: #1a2422;
  touch-action: none;
  cursor: grab;
  user-select: none;
}
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.crop-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 4px 14px;
}
.crop-zoom input[type=range] {
  flex: 1;
  margin: 0;
  accent-color: var(--teal);
}
.crop-zoom span {
  font-size: 13px;
  color: var(--muted);
  min-width: 1.2em;
  text-align: center;
}
.crop-actions {
  display: flex;
  gap: 10px;
}
.crop-actions button { flex: 1; }

.dots {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 20px;
  line-height: 1;
  color: #4C5654;
}

.menu {
  position: relative;
  margin: 12px 0 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu button {
  background: none;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
}
.menu button:hover { background: var(--mint); }
.menu .sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu .spend { padding: 12px 14px; color: var(--muted); font-size: 14px; font-weight: 600; }

/* Настройки разговора: модалка поверх ленты, закрывает только организатор */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  background: rgba(21, 63, 60, 0.45);
}
.sheet-card {
  width: min(520px, 100%);
  max-height: min(92vh, 820px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 18px 48px rgba(21, 63, 60, 0.22);
  overflow: hidden;
}
.sheet-head {
  padding: 18px 20px 10px;
  border-bottom: 1px solid var(--line);
}
.sheet-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.03em;
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sheet-body > label {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #42504D;
}
.sheet-body > button {
  background: none;
  text-align: left;
  padding: 12px 4px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
}
.sheet-body > button:hover { background: var(--mint); }
.sheet-body .sep { height: 1px; background: var(--line); margin: 8px 0; }
.sheet-body .spend { color: var(--muted); font-size: 14px; font-weight: 600; padding: 4px 0; }
.sheet-body .invite { margin: 0; }
.sheet-body .foot-note { margin: 0; }
.sheet-body .check { margin: 8px 0; }
.sheet-body select,
.sheet-body .ui-lang {
  width: 100%;
  margin: 0;
}
button.danger {
  background: none;
  text-align: left;
  padding: 14px 4px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
  color: var(--coral);
}
button.danger:hover { background: #FDEDEB; }
.sheet-body > button.danger { margin-top: 8px; }
.sheet-foot {
  padding: 12px 20px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.tape {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Карточка смысла: перевод главный, автор и оригинал — служебные */
.msg {
  background: var(--incoming);
  border-radius: 20px;
  padding: 15px 16px;
}
.msg.mine { background: var(--mint); }
.msg .who {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 7px;
}
/* Имя собеседника должно читаться сразу: язык и время рядом остаются служебными */
.msg .who .nick { font-size: 17px; font-weight: 800; color: var(--teal-dark); }
.msg .who .when { font-size: 12px; font-weight: 600; color: #65706E; white-space: nowrap; }
.msg .main { font-size: 21px; line-height: 1.35; font-weight: 600; }
.msg .orig { margin-top: 9px; color: #7A8582; font-size: 14px; }
.msg .tools { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.msg .tools .icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(8, 127, 120, 0.08);
  color: var(--teal-dark);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.msg .tools .icon-btn:hover,
.msg .tools .icon-btn.on {
  background: rgba(8, 127, 120, 0.18);
}

/* Картинка реплики: во всю ширину карточки, клик — на весь экран */
.msg .pic {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  margin-bottom: 6px;
  border-radius: 14px;
  background: #FFF;
  cursor: zoom-in;
}

.msg .pic-toggle {
  display: inline-block;
  margin: 0 0 10px;
  font-size: 13px;
}

.msg .quote {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-left: 3px solid var(--teal);
  background: rgba(8, 127, 120, 0.08);
  border-radius: 0 10px 10px 0;
  padding: 8px 10px;
  margin: 0 0 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.msg .quote-name {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-dark);
  margin-bottom: 2px;
}
.msg .quote-text {
  display: block;
  font-size: 14px;
  color: #5b6663;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg .reacts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.msg .react-chip {
  border: 1px solid rgba(21, 63, 60, 0.12);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
}
.msg .react-chip.mine {
  border-color: var(--teal);
  background: rgba(8, 127, 120, 0.12);
}
.msg .react-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.msg .react-pick button {
  border: 0;
  background: #fff;
  border-radius: 12px;
  font-size: 22px;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.msg.flash {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.reply-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(8, 127, 120, 0.1);
  border-left: 3px solid var(--teal);
}
.reply-bar .reply-body { flex: 1; min-width: 0; }
.reply-bar .reply-label { font-size: 12px; font-weight: 700; color: var(--teal-dark); }
.reply-bar .reply-preview {
  font-size: 13px;
  color: #5b6663;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 18, 16, 0.88);
  padding: 18px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: min(96vw, 920px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
  background: #111;
}
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 36px;
  line-height: 1;
  cursor: pointer;
}

.topup-card { width: min(560px, 100%); }
.topup-lead, .topup-proof-label, .topup-eta {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: #3d4a47;
}
.topup-proof-label { font-weight: 700; margin-top: 8px; }
.topup-eta { color: var(--muted); font-size: 14px; }
.topup-nets {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 8px 0 4px;
}
.topup-net {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7fbfa;
}
.topup-net-title {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .02em;
}
.topup-qr {
  width: 160px;
  height: 160px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}
.topup-addr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.topup-addr {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  word-break: break-all;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}
.icon-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 18px;
  cursor: pointer;
  color: var(--teal-dark);
}
.icon-btn:hover { background: var(--mint); }
.icon-btn.copied { background: rgba(8, 127, 120, 0.15); color: var(--teal); }
.topup-net-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #42504D;
}
.topup-net-pick select { width: 100%; }
.topup-proof-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Кнопка картинки в наборной строке: рядом со полем, того же роста */
button.pic { padding: 12px 14px; font-size: 20px; line-height: 1; }
.msg.pending .main { color: var(--muted); font-weight: 500; }

/* Флажок настройки: подпись многострочная, поэтому не по центру */
.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.check input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--teal);
  flex: none;
}
.check .hint { font-weight: 500; }

.talk-pick {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px 12px;
  margin: 14px 0 4px;
}
.talk-pick legend {
  padding: 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.talk-pick .check { margin-top: 8px; }
.talk-pick #partner-wrap { margin-top: 10px; }

.tape-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0 4px;
}
.tape-bar .seg { flex: 1; min-width: 0; }
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}
.seg-btn {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.seg-btn.on {
  background: var(--teal);
  color: #fff;
}
.side-pick { width: 100%; }
.side-pick .seg-btn { font-size: 14px; padding: 10px 12px; }

.composer {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: rgba(247, 250, 249, 0.96);
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 0 -4px;
  padding-left: 4px;
  padding-right: 4px;
  padding-bottom: 8px;
}
.composer.collapsed {
  display: none;
}
.composer-fab {
  position: sticky;
  bottom: 18px;
  align-self: flex-end;
  width: 56px;
  height: 56px;
  margin: 12px 4px 8px auto;
  border-radius: 50%;
  border: none;
  background: var(--teal);
  color: #fff;
  font-size: 22px;
  box-shadow: 0 8px 24px rgba(8, 127, 120, 0.28);
  z-index: 6;
  cursor: pointer;
}
.composer-fab.open {
  display: none;
}
.speaker-float {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  justify-content: center;
  pointer-events: none;
  margin: 0 0 8px;
  min-height: 0;
}
.speaker-float[hidden] { display: none; }
.speaker-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(8, 127, 120, 0.18);
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(21, 63, 60, 0.08);
}
.speaker-bubble .face-photo {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--mango);
  box-shadow: 0 0 0 3px rgba(255, 165, 31, 0.22);
}
.speaker-bubble .face-photo img,
.speaker-bubble .face-photo .initials {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  object-fit: cover;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
}
.speaker-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status { font-size: 14px; font-weight: 600; color: var(--muted); min-height: 20px; }
.status.bad { color: var(--coral); }
.status.warn { color: #b45309; }

.funds-low {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

/* Голосовая кнопка: главный элемент продукта */
.talk {
  width: 100%;
  padding: 19px;
  font-size: 17px;
  background: var(--teal);
  color: #fff;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.talk.recording { background: var(--mango); color: #3A3023; }
.talk.locked {
  background: #C5D2CF;
  color: #4A5B58;
  cursor: not-allowed;
}
.talk .wave { display: flex; align-items: flex-end; gap: 3px; height: 20px; }
.talk .wave i {
  width: 4px;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
  opacity: .85;
  transition: height .08s linear;
}
.talk .timer { font-variant-numeric: tabular-nums; opacity: .9; }

.talk-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 8px;
}
.talk-grip { display: none; }
.voice-queue {
  margin: 4px 0 8px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 14px;
  font-weight: 700;
}
.voice-queue[hidden] { display: none; }
.msg.full { border-left: 4px solid var(--teal); }
.full-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 2px 0 4px;
}

/* Планшет и компьютер: запись — круглая кнопка сбоку, лента и наборная строка во всю высоту */
@media (min-width: 721px) {
  .room-screen .tape,
  .room-screen .composer { padding-right: 150px; }
  .talk-side {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 128px;
    z-index: 7;
    align-items: center;
    padding: 0;
  }
  .talk-side .side-pick { flex-direction: column; border-radius: 14px; }
  .talk-side .side-pick .seg-btn { font-size: 12px; padding: 8px 6px; line-height: 1.2; }
  .talk-side .talk {
    width: 116px;
    height: 116px;
    padding: 10px;
    border-radius: 50%;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 8px 24px rgba(8, 127, 120, 0.28);
  }
  .talk-side .talk .face {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    line-height: 1.15;
  }
  .talk-side .talk .ico { font-size: 32px; line-height: 1; }
  .talk-side .talk .lbl { font-size: 11px; font-weight: 700; }
  .talk-side .talk .wave { display: none; }
  .talk-side .talk .timer { font-size: 13px; }
  .talk-side .status { font-size: 12px; line-height: 1.3; text-align: center; min-height: 0; width: 100%; }
  .talk-grip {
    display: block;
    width: 100%;
    padding: 4px 0;
    border-radius: 10px;
    background: rgba(8, 127, 120, 0.10);
    color: var(--teal);
    font-size: 14px;
    letter-spacing: 2px;
    text-align: center;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }
  .talk-grip:active { cursor: grabbing; }
  .room-screen.talk-free .tape { padding-right: 0; }
  .room-screen.talk-free .composer { padding-right: 4px; }
}
@media (min-width: 981px) {
  .talk-side { right: calc(260px + 16px); }
}

.archive-meta {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

/* Оболочка: меню слева, центр, разговоры справа */
.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 260px;
  height: 100%;
  min-height: 100%;
  background: transparent;
}
.shell-center {
  min-width: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: rgba(248, 250, 249, 0.72);
}
.shell-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  position: sticky;
  top: 0;
  z-index: 12;
}
.shell-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  background: var(--mint);
  color: var(--teal-dark);
  font-size: 18px;
  flex: none;
}
.brand-compact {
  font-size: 18px;
  gap: 8px;
}
.brand-compact img { width: 32px; height: 32px; border-radius: 9px; }
.shell-screen {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}
.shell-screen.room-screen {
  max-width: none;
  padding-top: 12px;
}

.account-section { margin-top: 28px; }
.account-section > h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.account-subhead {
  margin: 18px 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: #42504D;
}
.account-profile label { margin-top: 12px; }
.account-avatar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}
.account-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  background: var(--mint);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.account-avatar .initials {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.account-avatar-actions .hint { margin-top: 6px; }
.account-head { margin-bottom: 20px; }
.account-head h1 { margin-bottom: 6px; }
.account-identity {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  color: var(--teal-dark, #0a6b65);
  word-break: break-all;
}
.account-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--mint);
  color: var(--teal-dark, #0a6b65);
  vertical-align: middle;
}
.account-verify-hint { margin-top: 8px; }
.rail-user {
  padding: 10px 12px 8px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.rail-user-email {
  display: block;
  font-size: 13px;
  font-weight: 650;
  color: var(--teal-dark, #0a6b65);
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}
.shell-user {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 650;
  color: var(--teal-dark, #0a6b65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 6px;
}
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.account-balance .balance-value {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--teal-dark, #0a6b65);
}
.ledger-list {
  padding: 6px 0;
  display: flex;
  flex-direction: column;
}
.ledger-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.ledger-row:last-child { border-bottom: 0; }
.ledger-title { font-weight: 700; font-size: 14px; }
.ledger-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.ledger-amount {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 14px;
}
.ledger-amount.plus { color: var(--teal); }
.ledger-amount.minus { color: var(--coral); }
.ledger-amount.token-amount {
  font-size: 12px;
  font-weight: 700;
  color: #42504D;
}
.token-totals { margin-top: 10px; }

@media (max-width: 560px) {
  .account-avatar-row { align-items: flex-start; }
  .account-actions { flex-direction: column; }
  .account-actions .primary,
  .account-actions .second { width: 100%; }
}

.shell-dim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(21, 63, 60, 0.35);
  z-index: 30;
  pointer-events: none;
}
.shell-dim.is-on {
  display: block;
  pointer-events: auto;
}
.rail {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: rgba(255, 255, 255, 0.88);
  padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
}
.rail-nav { border-right: 0; }
.rail-rooms { border-left: 0; }
.rail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  min-height: 44px;
}
.brand-mark { gap: 0; }
.brand-mark img { width: 40px; height: 40px; border-radius: 11px; }
.rail-brand-text {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -.02em;
}
.rail-brand-text .a { color: var(--teal); }
.rail-brand-text .b { color: var(--mango-strong); }
.rail-title {
  font-weight: 800;
  font-size: 16px;
  flex: 1;
}
.rail-close {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  background: var(--mint);
}
.rail-menu, .rail-foot, .rail-scroll {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rail-menu { flex: 1; }
.rail-scroll {
  flex: 1;
  overflow: auto;
  gap: 8px;
  padding-right: 2px;
}
.rail-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 14px;
  background: transparent;
  color: var(--teal-dark);
  font-weight: 700;
  font-size: 14px;
}
.rail-item:hover, .rail-item.active {
  background: var(--mint);
  color: var(--teal);
}
.rail-item.rail-leave {
  color: var(--coral);
}
.rail-item.rail-leave:hover {
  background: #FCECEA;
  color: var(--coral);
}
a.rail-item { text-decoration: none; }
.rail-ico {
  width: 22px;
  text-align: center;
  flex: none;
  font-size: 16px;
}
.rail-lang .ui-lang {
  width: 100%;
  margin: 0 0 8px;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}
.rail-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 8px;
}
.room-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  text-align: left;
}
.room-chip.active {
  border-color: var(--teal);
  background: var(--mint);
}
.room-chip.ended { opacity: .72; }
.room-chip-title {
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.friend-card .friend-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.friend-card .grow { min-width: 0; flex: 1; }
.friend-card .face-card { width: 44px; }
.friend-card .face-photo {
  width: 44px;
  height: 44px;
  border-width: 2px;
}
.friend-card .initials { font-size: 14px; }

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .rail-rooms {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(300px, 88vw);
    z-index: 40;
    transform: translateX(105%);
    transition: transform .2s ease;
    box-shadow: -12px 0 32px rgba(21, 63, 60, 0.12);
    pointer-events: none;
  }
  .rail-rooms.open {
    transform: translateX(0);
    pointer-events: auto;
  }
  .rail-rooms .rail-close { display: inline-flex; align-items: center; justify-content: center; }
  .rail-nav .rail-label,
  .rail-nav .rail-brand-text,
  .rail-nav .rail-lang,
  .rail-nav .rail-user { display: none; }
  .rail-nav {
    padding: 12px 8px;
    align-items: center;
  }
  .rail-nav .rail-item {
    justify-content: center;
    padding: 12px 8px;
  }
  .rail-nav .rail-head { justify-content: center; margin-bottom: 12px; }
  .shell-bar { display: flex; }
  body.shell-drawer-open { overflow: hidden; }
}

@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .rail-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    z-index: 40;
    transform: translateX(-105%);
    transition: transform .2s ease;
    align-items: stretch;
    padding: 14px 12px;
    box-shadow: 12px 0 32px rgba(21, 63, 60, 0.12);
    pointer-events: none;
  }
  .rail-nav.open {
    transform: translateX(0);
    pointer-events: auto;
  }
  .rail-nav .rail-label,
  .rail-nav .rail-brand-text,
  .rail-nav .rail-lang,
  .rail-nav .rail-user { display: initial; }
  .rail-nav .rail-user { display: block; }
  .rail-nav .rail-item { justify-content: flex-start; padding: 11px 12px; }
  .rail-nav .rail-lang { display: block; }
  .rail-nav .rail-head { justify-content: flex-start; }
}

@media (max-width: 620px) {
  h1 { font-size: 28px; }
  .head .title { font-size: 17px; }
  .msg .main { font-size: 20px; }
}

@media (min-width: 720px) {
  .sheet { align-items: center; }
}
