/* Vietly Mini App — фирменный стиль из брендбука.
   Светлая шапка с логотипом, пастельные плитки-квадраты,
   линейные иконки. Тёмная тема подхватывается от Telegram. */

:root {
  --primary: #00695C;
  --accent: #00C896;
  --highlight: #FFC107;
  --alert: #FF6B6B;

  --bg: #F5F7FA;
  --card: #FFFFFF;
  --text: #162422;
  --muted: #7C8C8A;
  --line: #E6EBF0;
  --shadow: 0 2px 12px rgba(0, 45, 39, .06);
  --radius: 22px;

  /* Пастельные подложки плиток */
  --t-mint: #E1F6EE;
  --t-lilac: #EBE8FB;
  --t-coral: #FDE8E7;
  --t-amber: #FEF3D8;
  --t-blue: #E4F0FD;
  --t-green: #E6F6E7;
  --t-pink: #FCE9F1;
  --t-grey: #EDF1F5;

  --safe-top: max(env(safe-area-inset-top, 0px), var(--app-safe-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--app-safe-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--app-safe-left, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--app-safe-right, 0px));
}

body.dark {
  --bg: #11181B;
  --card: #1A2327;
  --text: #EAF2F0;
  --muted: #8FA2A1;
  --line: #28343A;
  --shadow: 0 2px 14px rgba(0, 0, 0, .4);

  --t-mint: #16332C;
  --t-lilac: #262340;
  --t-coral: #3A2422;
  --t-amber: #392F17;
  --t-blue: #1B2C3D;
  --t-green: #1B3020;
  --t-pink: #351F2A;
  --t-grey: #222B31;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(70px + var(--safe-bottom));
  overscroll-behavior-y: contain;
}

svg { display: block; flex: none; }

/* ------------------------------------------------------------ шапка */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar__back {
  border: 0; background: var(--bg); color: var(--text);
  width: 34px; height: 34px; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.topbar__back[hidden] { display: none; }

.topbar__brand { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.logo {
  font-weight: 800; letter-spacing: -.5px; color: var(--primary);
  display: inline-flex; align-items: flex-start; line-height: 1;
}
body.dark .logo { color: #FFFFFF; }
.logo__leaf { margin-right: 1px; transform: translateY(-3px); }
.topbar__title {
  font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__rate {
  background: var(--t-mint); color: var(--primary);
  border-radius: 20px; padding: 7px 12px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
}
body.dark .topbar__rate { color: var(--accent); }

/* ------------------------------------------------------------ экран */
main { padding: 16px; max-width: 640px; margin: 0 auto; }

.hero {
  display: flex; align-items: center; gap: 13px; margin-bottom: 16px;
}
.bot-ava { border-radius: 50%; flex: none; display: block; }
.hero > div:nth-child(2) { min-width: 0; }
.city-chip {
  margin-left: auto; align-self: flex-start; flex: none;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line, #dfe5da);
  background: var(--card, #fff); color: var(--primary, #1c654c);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.city-chip svg { flex: none; }
.city-chip { max-width: 42%; }
.city-chip span { overflow: hidden; text-overflow: ellipsis; }
.hero__sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Кружок с инициалом — на экране профиля */
.hero__ava {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  background: linear-gradient(145deg, var(--accent), var(--primary));
  color: #fff; font-weight: 700; font-size: 19px;
  display: flex; align-items: center; justify-content: center;
}

.chat-hello { text-align: center; padding: 6px 0 14px; }
.chat-hello .bot-ava { margin: 0 auto 8px; }
.chat-hello__name { font-weight: 700; font-size: 15px; }
.hero__hi { font-weight: 700; font-size: 18px; letter-spacing: -.2px; }
.hero__sub { color: var(--muted); font-size: 13.5px; }

.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 13px 15px; margin-bottom: 18px;
  box-shadow: var(--shadow); color: var(--muted);
}
.searchbar input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 15px; color: var(--text); min-width: 0;
}
.searchbar input::placeholder { color: var(--muted); }

/* ------------------------------------------------------------ плитки */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.tile {
  border: 0; cursor: pointer; font-family: inherit; color: var(--text);
  aspect-ratio: 1 / 1;                 /* закруглённый квадрат, как в макете */
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; align-items: flex-start;
  justify-content: space-between; text-align: left;
  transition: transform .13s ease;
}
.tile:active { transform: scale(.96); }
.tile__ico {
  width: 46px; height: 46px; border-radius: 15px;
  background: rgba(255, 255, 255, .72);
  display: flex; align-items: center; justify-content: center;
}
/* Фото бота вместо иконки — подложка не нужна */
.tile__ico--photo { background: none; }
body.dark .tile__ico { background: rgba(255, 255, 255, .1); }
.tile__name { display: block; font-weight: 700; font-size: 14.5px; letter-spacing: -.1px; }
.tile__hint { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-top: 3px; }
.tile__text { width: 100%; }

.t-mint  { background: var(--t-mint);  } .t-mint  .tile__ico { color: #00A97B; }
.t-lilac { background: var(--t-lilac); } .t-lilac .tile__ico { color: #6E5BD6; }
.t-coral { background: var(--t-coral); } .t-coral .tile__ico { color: #E4584F; }
.t-amber { background: var(--t-amber); } .t-amber .tile__ico { color: #D79A00; }
.t-blue  { background: var(--t-blue);  } .t-blue  .tile__ico { color: #2C7BD1; }
.t-green { background: var(--t-green); } .t-green .tile__ico { color: #2E9B4E; }
.t-pink  { background: var(--t-pink);  } .t-pink  .tile__ico { color: #D4568B; }
.t-grey  { background: var(--t-grey);  } .t-grey  .tile__ico { color: #5E7080; }

/* ------------------------------------------------------------ списки */
.section-title {
  font-weight: 700; font-size: 12.5px; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted); margin: 22px 2px 10px;
}
.list {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 15px 16px; border: 0; background: none; cursor: pointer;
  border-bottom: 1px solid var(--line); text-align: left;
  color: var(--text); font-family: inherit; font-size: 15px;
}
.row:last-child { border-bottom: 0; }
.row:active { background: var(--t-mint); }
.row__ico { color: var(--primary); }
body.dark .row__ico { color: var(--accent); }
.row__body { flex: 1; min-width: 0; }
.row__title { display: block; font-weight: 600; }
.row__sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.row__arrow { color: var(--muted); }
.row__badge {
  background: var(--highlight); color: #493600; font-size: 11px; font-weight: 800;
  border-radius: 20px; padding: 3px 8px;
}

/* ------------------------------------------------------------ статья */
.article {
  background: var(--card); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); line-height: 1.62;
}
.article h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.3px; }
.article .crumbs { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.article i { color: var(--muted); font-size: 13.5px; }

.actionbar { display: flex; gap: 10px; margin-top: 14px; }
.btn {
  flex: 1; border: 0; border-radius: 16px; padding: 14px;
  font-size: 14.5px; font-weight: 650; cursor: pointer; font-family: inherit;
  background: var(--card); color: var(--text); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--accent { background: var(--accent); color: #05261F; }
.btn:active { opacity: .85; }
.btn--fav.is-on { background: var(--highlight); color: #493600; }

/* ------------------------------------------------------------ чат */
.chat { display: flex; flex-direction: column; gap: 11px; padding-bottom: 8px; }
.msg {
  max-width: 86%; padding: 13px 15px; border-radius: 19px;
  white-space: pre-wrap; word-wrap: break-word;
}
.msg--me { align-self: flex-end; background: var(--accent); color: #05261F; border-bottom-right-radius: 6px; }
.msg--bot { align-self: flex-start; background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.msg__links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.chip {
  border: 1px solid var(--accent); background: transparent; color: var(--primary);
  border-radius: 20px; padding: 7px 13px; font-size: 12.5px; cursor: pointer;
  font-family: inherit; display: inline-flex; align-items: center; gap: 6px;
}
body.dark .chip { color: var(--accent); }

.composer {
  position: fixed; left: 0; right: 0; bottom: calc(62px + var(--safe-bottom));
  display: flex; gap: 9px; padding: 10px 14px;
  background: var(--bg); border-top: 1px solid var(--line);
  max-width: 640px; margin: 0 auto;
}
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 14px; font: inherit; background: var(--card); color: var(--text);
  max-height: 96px; outline: 0;
}
.composer button {
  border: 0; background: var(--primary); color: #fff; border-radius: 16px;
  width: 48px; cursor: pointer; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.has-composer { padding-bottom: 132px; }

/* ------------------------------------------------------------ переводчик */
.tr-card {
  background: var(--card); border-radius: var(--radius);
  padding: 17px; box-shadow: var(--shadow);
}
.tr-card + .tr-card { margin-top: 12px; }
.tr-card textarea {
  width: 100%; border: 0; outline: 0; resize: none; background: transparent;
  font: inherit; color: var(--text); min-height: 76px;
}
.tr-out { font-size: 20px; font-weight: 700; color: var(--primary); line-height: 1.4; }
body.dark .tr-out { color: var(--accent); }
.tr-pron {
  color: var(--muted); font-size: 14px; margin-top: 8px;
  display: flex; align-items: center; gap: 7px;
}
.tr-note {
  margin-top: 12px; padding: 11px 13px; font-size: 13px;
  background: var(--t-amber); border-radius: 13px; color: var(--text);
}
.tr-big {
  position: fixed; inset: 0; z-index: 60; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 30px;
  font-size: 30px; font-weight: 700; text-align: center; line-height: 1.35;
}

/* ------------------------------------------------------------ чек-лист */
.check {
  display: flex; align-items: flex-start; gap: 13px; width: 100%;
  padding: 14px 16px; border: 0; background: none; cursor: pointer;
  border-bottom: 1px solid var(--line); text-align: left;
  color: var(--text); font-family: inherit; font-size: 14.5px; line-height: 1.45;
}
.check:last-child { border-bottom: 0; }
.check__box {
  width: 23px; height: 23px; border-radius: 8px; flex: none; margin-top: 1px;
  border: 2px solid var(--line); display: flex; align-items: center;
  justify-content: center; color: #fff;
}
.check.is-done .check__box { background: var(--accent); border-color: var(--accent); }
.check.is-done .check__text { color: var(--muted); text-decoration: line-through; }

.progress { height: 8px; background: var(--line); border-radius: 20px; overflow: hidden; margin: 11px 0 5px; }
.progress__fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width .3s; }

/* ------------------------------------------------------------ прочее */
.money-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.money-row:last-child { border-bottom: 0; }
.money-row b { color: var(--primary); }
body.dark .money-row b { color: var(--accent); }
.cur { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cur-flag { flex: none; border-radius: 4px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.cur__text { display: flex; flex-direction: column; min-width: 0; }
.cur__code { font-weight: 600; }
.cur__code i { font-style: normal; color: var(--muted, #7b8d71); margin-left: 2px; }
.cur__name { font-size: 12px; color: var(--muted, #7b8d71); }

.conv { display: flex; gap: 10px; margin-top: 12px; }
.conv input, .conv select {
  border: 1px solid var(--line); border-radius: 14px; padding: 13px;
  font: inherit; background: var(--bg); color: var(--text); outline: 0; min-width: 0;
}
.conv input { flex: 1; }

.ad {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  cursor: pointer; font-family: inherit; color: var(--text);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 14px 16px; margin-top: 16px; box-shadow: var(--shadow);
}
.ad__ico { color: var(--highlight); }
.ad__label { font-size: 10px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); }
.ad__title { font-weight: 700; margin: 2px 0; }
.ad__body { font-size: 13px; color: var(--muted); }

.ad--free { border-style: dashed; border-color: var(--accent); background: var(--t-mint); }
.ad--free .ad__title { color: var(--primary); }
body.dark .ad--free .ad__title { color: var(--accent); }

/* Баннер-картинка: 3:1 на телефоне (960×320), 4:1 на широком экране (1200×300). */
.ad--banner { position: relative; display: block; padding: 0; overflow: hidden; border: 0; }
.ad--banner picture, .ad--banner img { display: block; width: 100%; }
.ad--banner img { aspect-ratio: 3 / 1; object-fit: cover; background: var(--t-grey); }
@media (min-width: 700px) {
  .ad--banner img { aspect-ratio: 4 / 1; }
}
.ad__tag {
  position: absolute; top: 8px; left: 8px; padding: 2px 7px; border-radius: 8px;
  background: rgba(0, 0, 0, .45); color: #fff; font-size: 10px; letter-spacing: .5px; text-transform: uppercase;
}

/* Загрузка баннеров в панели управления */
.banner-slots { display: grid; gap: 12px; margin-bottom: 14px; }
@media (min-width: 700px) { .banner-slots { grid-template-columns: 3fr 4fr; } }
.banner-slot { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 12px; }
.banner-slot__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.banner-slot__head span { font-size: 12px; color: var(--muted); }
.banner-slot__preview {
  width: 100%; border-radius: 12px; overflow: hidden; background: var(--t-grey);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12.5px; text-align: center;
}
.banner-slot__preview--mobile { aspect-ratio: 3 / 1; }
.banner-slot__preview--desktop { aspect-ratio: 4 / 1; }
.banner-slot__preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-slot__actions { display: flex; gap: 8px; margin-top: 8px; }
.banner-slot__actions .btn:first-child { flex: 1; justify-content: center; }
.banner-slot__warn { font-size: 12px; color: #C77700; margin-top: 6px; }
.banner-slot__warn:empty { display: none; }

.promo-head { display: flex; align-items: flex-start; gap: 13px; }
.promo-head__ico {
  width: 46px; height: 46px; border-radius: 15px; flex: none;
  background: var(--t-amber); color: #D79A00;
  display: flex; align-items: center; justify-content: center;
}

.empty { text-align: center; color: var(--muted); padding: 48px 26px; line-height: 1.6; }
.empty__ico { color: var(--line); display: flex; justify-content: center; margin-bottom: 14px; }
.empty b { color: var(--text); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 20px; padding: 9px 15px; font-size: 13px; white-space: nowrap;
  cursor: pointer; font-family: inherit; flex: none;
}
.chips button.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ------------------------------------------------------------ табы */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
.tab {
  flex: 1; border: 0; background: none; cursor: pointer; font-family: inherit;
  padding: 10px 2px 9px; font-size: 10.5px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.tab.is-active { color: var(--primary); font-weight: 700; }
body.dark .tab.is-active { color: var(--accent); }

/* ------------------------------------------------------------ служебное */
.loader { display: flex; gap: 7px; justify-content: center; padding: 60px 0; }
.loader__dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--accent);
  animation: bounce 1.3s infinite ease-in-out;
}
.loader__dot:nth-child(2) { animation-delay: .17s; }
.loader__dot:nth-child(3) { animation-delay: .34s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

/* ------------------------------------------------------------ главная как на постере */
body.on-home .topbar { display: none; }
.home-hero {
  display: block; width: 100%; aspect-ratio: 800 / 352; object-fit: cover;
  border-radius: 22px; margin-bottom: 14px;
  box-shadow: 0 10px 26px rgba(0, 60, 52, .18);
}
.home-hi { margin: 0 2px 14px; }
.home-hi b { font-size: 18px; letter-spacing: -.2px; }
.home-hi span { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.ptiles {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
}
.ptile {
  position: relative; appearance: none; border: 1px solid rgba(255, 255, 255, .8);
  cursor: pointer; text-align: center; font-family: inherit;
  color: #102C48; border-radius: 18px; padding: 10px 5px; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .25), transparent 65%), var(--tile-bg);
  box-shadow: 0 3px 8px rgba(0, 50, 45, .05);
  transition: transform .13s ease;
}
.ptile:active { transform: scale(.97); }
.ptile:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
body.dark .ptile:focus-visible { outline-color: var(--accent); }
/* Оригинал постера отображается как спрайт. Точные окна не захватывают
   подписи и края карточек, в отличие от старых PNG-вырезок. Маска смягчает
   только внешний край подложки; сам значок остаётся чётким. */
.ptile__icon { display: block; width: 64px; height: 64px; flex: none; }
.ptile__art {
  display: block; width: 88px; height: 88px;
  background-image: var(--menu-sprite); background-repeat: no-repeat;
  background-size: 1254px 1254px; background-position: var(--icon-x) var(--icon-y);
  transform: scale(.72727273); transform-origin: top left;
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle closest-side, #000 93%, transparent 100%);
  mask-image: radial-gradient(circle closest-side, #000 93%, transparent 100%);
}
.ptile__name {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 2.6em; font-weight: 700; font-size: 12px; line-height: 1.3;
  overflow-wrap: anywhere;
}
.ptile__hint, .ptile__arrow { display: none; }
@media (max-width: 350px) {
  .ptile { padding-inline: 4px; }
  .ptile__name { font-size: 11px; }
}
@media (min-width: 380px) {
  .ptile__name { font-size: 13px; }
  .ptile { padding: 12px 7px; }
}
@media (min-width: 580px) {
  .ptiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .ptile { align-items: flex-start; text-align: left; padding: 12px 12px 30px; gap: 6px; }
  .ptile__icon { width: 72px; height: 72px; }
  .ptile__art { transform: scale(.81818182); }
  .ptile__name { justify-content: flex-start; font-size: 14px; }
  .ptile__hint { display: block; font-size: 11.5px; line-height: 1.4; color: #456075; }
  .ptile__arrow { display: block; position: absolute; right: 12px; bottom: 10px; color: var(--tile-accent); }
}
@media (prefers-reduced-motion: reduce) {
  .ptile { transition: none; }
}
.features {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-top: 14px;
  background: var(--card); border-radius: 20px; padding: 15px 16px; box-shadow: var(--shadow);
}
.feature { display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.feature svg { color: var(--primary); }
body.dark .feature svg { color: var(--accent); }

/* ------------------------------------------------------------ шапка: логотип */
.tabbar[hidden] { display: none; }
.brand-logo { display: none; align-items: center; }
.topbar__brand.is-home { align-items: center; }
.topbar__brand.is-home .brand-logo { display: flex; }
.topbar__brand.is-home .topbar__title { display: none; }
.topbar__brand:not(.is-home) .topbar__title {
  font-size: 16.5px; font-weight: 700; color: var(--text); letter-spacing: -.2px;
}
.logo-slot { display: inline-flex; align-items: center; }
.logo-img { display: block; width: auto; max-width: 62vw; object-fit: contain; }
body.dark .logo-img { background: #F5F7FA; border-radius: 10px; padding: 3px 8px; box-sizing: content-box; }
.wordmark {
  font-family: "Nunito", "Arial Rounded MT Bold", "Segoe UI", system-ui, sans-serif;
  font-weight: 900; color: #0B5D55; letter-spacing: -.02em; line-height: 1;
  display: inline-flex; align-items: flex-end; padding-top: .42em;
}
body.dark .wordmark { color: #fff; }
.wordmark__i { position: relative; display: inline-block; }
.wordmark__leaves {
  position: absolute; left: 50%; bottom: 74%;
  width: .92em; height: .64em; transform: translateX(-36%);
}

/* ------------------------------------------------------------ первый вход */
.onb { text-align: center; padding: 8px 4px 20px; }
.onb .bot-ava { margin: 0 auto 12px; }
.onb__title { font-size: 21px; margin: 0 0 6px; letter-spacing: -.3px; }
.onb__text { color: var(--muted); margin: 0 0 18px; }
.city-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
.city {
  border: 1.5px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 16px; padding: 14px; font: inherit; font-weight: 600; cursor: pointer;
}
.city.is-active { border-color: var(--primary); background: var(--t-mint); color: var(--primary); }
body.dark .city.is-active { color: var(--accent); border-color: var(--accent); }
.agree {
  display: flex; gap: 11px; align-items: flex-start; text-align: left;
  margin: 18px 0 14px; font-size: 13.5px; line-height: 1.5; cursor: pointer;
}
.agree input { width: 20px; height: 20px; flex: none; margin-top: 1px; accent-color: var(--primary); }
.linkish {
  border: 0; background: none; padding: 0; font: inherit; cursor: pointer;
  color: var(--primary); text-decoration: underline; text-underline-offset: 2px;
}
body.dark .linkish { color: var(--accent); }
.city-line {
  display: flex; align-items: center; gap: 7px; margin: 0 2px 12px;
  color: var(--muted); font-size: 13.5px;
}
.city-line span { color: var(--text); font-weight: 600; }
.city-line button {
  margin-left: auto; border: 0; background: var(--t-mint); color: var(--primary);
  border-radius: 20px; padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.sheet {
  position: fixed; inset: 0; z-index: 80; background: rgba(10, 20, 18, .5);
  display: flex; align-items: flex-end;
}
.sheet__panel {
  position: relative; width: 100%; max-height: 88vh; overflow-y: auto;
  background: var(--bg); border-radius: 22px 22px 0 0; padding: 16px 16px calc(24px + var(--safe-bottom));
}
.sheet__close {
  position: sticky; top: 0; float: right; z-index: 2; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--card); color: var(--text); box-shadow: var(--shadow); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.legal h3 { font-size: 15.5px; margin: 18px 0 6px; }
.legal ul { padding-left: 20px; margin: 6px 0; }
.legal li { margin: 5px 0; }

/* ------------------------------------------------------------ панель: общее */
.staff-entry {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 2px;
  padding: 15px 16px; border: 0; border-radius: var(--radius); cursor: pointer; font-family: inherit;
  background: linear-gradient(135deg, var(--primary), #00836F); color: #fff; text-align: left;
  box-shadow: 0 6px 18px rgba(0, 105, 92, .25);
}
.staff-entry .row__sub, .staff-entry .row__arrow { color: rgba(255, 255, 255, .8); }
.staff-entry__ico {
  width: 42px; height: 42px; border-radius: 13px; flex: none; background: rgba(255, 255, 255, .16);
  display: flex; align-items: center; justify-content: center;
}
.staff-head { display: flex; align-items: center; gap: 13px; }
.staff-head__ico {
  width: 46px; height: 46px; border-radius: 15px; flex: none;
  background: var(--t-mint); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
body.dark .staff-head__ico { color: var(--accent); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--card); border-radius: 18px; padding: 14px 15px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px;
}
.stat b { font-size: 22px; letter-spacing: -.5px; color: var(--primary); }
body.dark .stat b { color: var(--accent); }
.stat span { font-size: 12px; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  border-radius: 20px; padding: 3px 9px; font-size: 11px; font-weight: 700;
  background: var(--t-grey); color: var(--muted); white-space: nowrap;
}
.badge--owner, .badge--pending { background: var(--t-amber); color: #8A6100; }
.badge--mod { background: var(--t-blue); color: #1F63AD; }
.badge--partner, .badge--active { background: var(--t-mint); color: #00805D; }
.badge--ban, .badge--rejected { background: var(--t-coral); color: #C0392B; }
.badge--hidden { background: var(--t-grey); color: var(--muted); }
.badge--archived { background: var(--t-lilac); color: #5B4BB7; }

/* Лимит бесплатных объявлений */
.quota {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 2px 12px;
  font-size: 13px; color: var(--muted);
}
.quota b { color: var(--text); }
.quota__bar { flex: 1 1 100%; height: 6px; border-radius: 3px; background: var(--t-grey); overflow: hidden; }
.quota__bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.quota--full .quota__bar i { background: var(--alert); }
.quota--full .linkish { margin-left: auto; }
.limit-card { text-align: center; }
.limit-card__num { font-size: 40px; font-weight: 800; color: var(--alert); line-height: 1.1; margin-bottom: 6px; }
.limit-card__num span { font-size: 20px; color: var(--muted); font-weight: 600; }
body.dark .badge--archived { color: #B8AEFF; }
.row--archived .thumb, .row--archived .row__title { opacity: .6; }
.archive-card { margin: 14px 0 4px; border: 1px dashed #9D8FE0; background: var(--t-lilac); }
.archive-card b { display: flex; align-items: center; gap: 6px; }
.row__badge--soft { background: var(--t-mint); color: var(--primary); }

.uava {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--t-blue); color: #2C7BD1; font-weight: 700;
}
.uava--lg { width: 52px; height: 52px; font-size: 20px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin-top: 14px; font-size: 13.5px; }
.kv span { color: var(--muted); }
.kv b { text-align: right; font-weight: 600; overflow-wrap: anywhere; }

.seg {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  background: var(--card); border-radius: 16px; padding: 4px; box-shadow: var(--shadow);
}
.seg button {
  border: 0; background: none; font-family: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--muted); padding: 10px 2px; border-radius: 12px; cursor: pointer;
}
.seg button.is-active { background: var(--primary); color: #fff; }

/* ------------------------------------------------------------ формы */
.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--muted); padding-left: 2px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px;
  font: inherit; color: var(--text); background: var(--card); outline: 0;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field-row { display: flex; gap: 10px; }
.radio input { width: 18px; height: 18px; flex: none; accent-color: var(--primary); }
.toggle-row { position: relative; cursor: pointer; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.form-toggle { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.switch {
  width: 46px; height: 28px; border-radius: 20px; background: var(--line);
  position: relative; flex: none; transition: background .2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s;
}
.toggle-row input:checked + .switch { background: var(--accent); }
.toggle-row input:checked + .switch::after { transform: translateX(18px); }

.btn--wide { width: 100%; flex: none; }
.btn--small { flex: none; padding: 14px 16px; }
.btn--danger { background: var(--t-coral); color: #C0392B; box-shadow: none; }
.btn:disabled { opacity: .45; cursor: default; }

/* ------------------------------------------------------------ фото и объявления */
.photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--t-grey); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo__del {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; padding: 0;
  border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.photo--add {
  border: 1.5px dashed var(--accent); background: var(--t-mint); color: var(--primary);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.photo--busy { display: flex; align-items: center; justify-content: center; }
.photo--busy::after {
  content: ""; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--accent); border-top-color: transparent; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.thumb {
  width: 52px; height: 52px; border-radius: 12px; overflow: hidden; flex: none;
  background: var(--t-grey); color: var(--muted); display: flex; align-items: center; justify-content: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.listing-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

.lgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.lcard {
  border: 0; padding: 0; text-align: left; cursor: pointer; font-family: inherit; color: var(--text);
  background: var(--card); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.lcard__photo {
  aspect-ratio: 4 / 3; background: var(--t-grey); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.lcard__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lcard__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.lcard__price { font-weight: 800; color: var(--primary); font-size: 14px; }
body.dark .lcard__price { color: var(--accent); }
.lcard__title {
  font-weight: 600; font-size: 13px; line-height: 1.35; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.lcard__meta { font-size: 11.5px; color: var(--muted); }
.gallery {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 -16px 14px; padding: 0 16px; scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: none; width: 86%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 18px; scroll-snap-align: center; }
.gallery img:only-child { width: 100%; }
.gallery img { cursor: zoom-in; }

/* Стрелки и счётчик поверх галереи — без них на компьютере ленту не пролистать. */
.gallery-wrap { position: relative; }
.gallery__nav {
  position: absolute; top: calc(50% - 7px); transform: translateY(-50%); z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  background: rgba(255, 255, 255, .92); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  display: flex; align-items: center; justify-content: center;
}
.gallery__nav[hidden] { display: none; }
.gallery__nav--prev { left: 6px; }
.gallery__nav--next { right: 6px; }
.gallery__count {
  position: absolute; right: 12px; bottom: 26px; z-index: 2; pointer-events: none;
  padding: 3px 9px; border-radius: 10px; background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 12px; font-weight: 600;
}

/* Полноэкранный просмотр фото */
body.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .94); }
.viewer__strip {
  display: flex; width: 100%; height: 100%; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain;
}
.viewer__strip::-webkit-scrollbar { display: none; }
.viewer__slide {
  flex: none; width: 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
  padding: calc(56px + var(--safe-top)) 12px calc(48px + var(--safe-bottom));
}
.viewer__slide img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.viewer__close, .viewer__nav {
  position: absolute; z-index: 2; border: 0; cursor: pointer; padding: 0; color: #fff;
  background: rgba(255, 255, 255, .16); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.viewer__close { top: calc(12px + var(--safe-top)); right: 12px; width: 42px; height: 42px; }
.viewer__nav { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; }
.viewer__nav[hidden] { display: none; }
.viewer__nav--prev { left: 12px; }
.viewer__nav--next { right: 12px; }
.viewer__count {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--safe-bottom));
  color: #fff; font-size: 14px; font-weight: 600; opacity: .85;
}
@media (hover: none) {
  /* На телефоне листают пальцем — боковые стрелки просмотра только мешают. */
  .viewer__nav { display: none; }
}
.lprice { font-size: 22px; font-weight: 800; color: var(--primary); letter-spacing: -.4px; }
body.dark .lprice { color: var(--accent); }
.specs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
.specs span { display: inline-flex; align-items: center; gap: 5px; }

/* ------------------------------------------------------------ курсы обмена */
.rates { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-top: 12px; font-size: 14px; }
.rates__head, .rates__row { display: grid; grid-template-columns: 1fr 1.3fr 1.3fr; gap: 8px; padding: 9px 12px; }
.rates__head { background: var(--bg); color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.rates__row + .rates__row { border-top: 1px solid var(--line); }
.rates__row span, .rates__head span:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.exch + .exch { margin-top: 10px; }
.exch__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.exch { cursor: pointer; }
.delivery-badge {
  display: inline-flex; align-items: center; gap: 8px; margin: 10px 0 2px;
  padding: 5px 12px 5px 6px; border-radius: 14px; background: #E3FDEC; color: #0F5C3A;
}
.delivery-badge .delivery-ico { flex: none; width: 64px; height: auto; display: block; }
/* В карточке обменника значок стоит под «Написать» — компактно, в правой колонке. */
.exch__side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.exch__side .delivery-badge { margin: 0; padding: 3px 8px 3px 4px; gap: 5px; border-radius: 10px; }
.exch__side .delivery-ico { width: 40px; }
.exch__side .delivery-badge b { font-size: 11.5px; }
.exch__side .delivery-badge small { font-size: 10.5px; }
.place-delivery { display: flex; justify-content: flex-end; margin: 8px 0 12px; }
.place-delivery .delivery-badge { margin: 0; padding: 3px 10px 3px 4px; gap: 6px; border-radius: 10px; }
.place-delivery .delivery-ico { width: 44px; }
.place-delivery .delivery-badge b { font-size: 12px; }
.place-delivery .delivery-badge small { font-size: 11px; }
.delivery-badge span { display: flex; flex-direction: column; line-height: 1.2; }
.delivery-badge b { font-size: 13px; }
.delivery-badge small { font-size: 11.5px; color: #3F7A5B; }
body.dark .delivery-badge { background: rgba(46, 155, 78, .18); color: #BFF0CF; }
body.dark .delivery-badge small { color: #8FD3A8; }
.money-row[hidden] { display: none !important; }
.exch__rating { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.exch__more { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--primary); }
.rate-edit { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-top: 12px; }
.rate-edit__head, .rate-edit__row { display: grid; grid-template-columns: 64px 1fr 1fr; gap: 8px; align-items: center; padding: 8px 14px; }
.rate-edit__head { font-size: 11.5px; color: var(--muted); font-weight: 600; padding-top: 12px; }
.rate-edit__row + .rate-edit__row { border-top: 1px solid var(--line); }
.rate-edit__row input {
  width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  font: inherit; text-align: right; background: var(--bg); color: var(--text); outline: 0;
  font-variant-numeric: tabular-nums;
}
.rate-edit__row input:focus { border-color: var(--accent); }

/* ------------------------------------------------------------ обращения, логотип */
.fb { background: var(--card); border-radius: 18px; padding: 14px 15px; box-shadow: var(--shadow); }
.fb + .fb { margin-top: 10px; }
.fb__meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.fb__text { white-space: pre-wrap; overflow-wrap: anywhere; }
.fb textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 10px;
  font: inherit; background: var(--bg); color: var(--text); min-height: 80px; outline: 0;
}
.logo-preview { display: flex; align-items: center; justify-content: center; min-height: 70px; margin-bottom: 10px; }

/* ------------------------------------------------------------ карта мест */
.places-map-wrap { position: relative; margin-bottom: 6px; }
.places-map {
  height: 280px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  background: var(--t-grey); z-index: 0;
}
.map-style-toggle {
  appearance: none; border: 0; cursor: pointer; font: 600 13px/1 inherit; font-family: inherit;
  padding: 8px 11px; border-radius: 10px; background: #fff; color: #102C48;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .25);
}
.map-style-toggle:active { transform: scale(.96); }
.places-map__legend { font-size: 12px; color: var(--muted); margin: 6px 4px 0; }
.places-map__error { display: flex; height: 100%; align-items: center; justify-content: center; color: var(--muted); }
.place-mini-map { height: 170px; border-radius: 14px; overflow: hidden; margin: 12px 0; z-index: 0; }
.place-pin { background: none; border: 0; }
.place-pin__dot {
  display: block; width: 20px; height: 20px; margin: 4px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.place-pin__rating {
  position: absolute; left: 22px; top: 2px; white-space: nowrap; padding: 1px 6px; border-radius: 10px;
  background: #fff; color: #7A5A00; font-size: 11px; font-weight: 700; box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.place-popup { font-family: inherit; font-size: 13px; line-height: 1.4; }
.place-popup__cat, .place-popup__count { color: #6b7b7a; font-size: 12px; }
.place-popup .btn { margin-top: 8px; width: 100%; justify-content: center; }
.stars { letter-spacing: 1px; white-space: nowrap; }
.stars i { font-style: normal; color: #D5DBE0; }
.stars i.on { color: #F5B301; }
.stars i.half { background: linear-gradient(90deg, #F5B301 50%, #D5DBE0 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.row__rating { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.place-rating { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; font-size: 14px; color: var(--muted); }
.review-form { margin-bottom: 12px; }
.star-input { display: flex; gap: 4px; margin: 8px 0; }
.star-input button {
  border: 0; background: none; cursor: pointer; font-size: 32px; line-height: 1; padding: 0 2px; color: #D5DBE0;
}
.star-input button.on { color: #F5B301; }
.review-form textarea { width: 100%; }
.reviews { display: flex; flex-direction: column; gap: 10px; }
.review { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px; }
.review--hidden { opacity: .55; }
.review__head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.review__date { margin-left: auto; font-size: 12px; color: var(--muted); }
.review__text { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.review__photos { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; }
.review__photos img {
  width: 72px; height: 72px; flex: none; object-fit: cover; border-radius: 10px; cursor: zoom-in;
  background: var(--t-grey);
}
.photos--small { grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 0; }
.photos--small .photo { border-radius: 10px; }
.review__actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; font-size: 12px; }
body.dark .leaflet-container { filter: brightness(.85) contrast(1.05); }

/* ------------------------------------------------------------ галочка */
.vbadge { display: inline-block; vertical-align: -0.18em; flex: none; }
.verified-line {
  display: flex; align-items: center; gap: 6px; margin: 6px 0 4px;
  font-size: 13px; font-weight: 600; color: #0B63D6;
}
body.dark .verified-line { color: #5FB0FF; }
.verify-card__head { display: flex; align-items: center; gap: 12px; }

/* Автор в карточке ленты и на странице объявления */
.lcard__author {
  display: flex; align-items: center; gap: 4px; margin-top: 5px; min-width: 0;
  font-size: 12px; color: var(--muted);
}
.lcard__author.is-verified { color: #0B63D6; font-weight: 600; }
body.dark .lcard__author.is-verified { color: #5FB0FF; }
.lcard__author-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.author-line {
  display: flex; align-items: center; gap: 10px; margin: 12px 0 6px; padding: 10px 12px;
  background: var(--t-grey); border-radius: 14px;
}
.author-line__ava {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, var(--accent), var(--primary)); color: #fff; font-weight: 700;
}
.author-line__body { display: flex; flex-direction: column; min-width: 0; }
.author-line__name { font-weight: 700; font-size: 14.5px; overflow-wrap: anywhere; }
.author-line__sub { font-size: 12px; color: var(--muted); }
.author-line__sub.is-verified { color: #0B63D6; font-weight: 600; }
body.dark .author-line__sub.is-verified { color: #5FB0FF; }
.verify-card__head .vbadge { vertical-align: middle; }

/* ------------------------------------------------------------ доска объявлений */
.field__hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.map-btn { margin-top: 12px; justify-content: center; }
.tr-note--warn { background: var(--t-amber); border-color: #F2C94C; }
.board-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.board-actions .btn { justify-content: center; }

/* ------------------------------------------------------------ сообщения */
@media (max-width: 899px) { .tab--extra { display: none; } }
.tab { position: relative; }
.tab__badge {
  position: absolute; top: 5px; left: calc(50% + 5px); min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 9px; background: #E4584F; color: #fff; font-size: 10px; font-weight: 700; line-height: 17px;
}
.chat-topic { font-weight: 500; color: var(--muted); }
.chat-when { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.chat-listing {
  display: flex; gap: 10px; align-items: center; width: 100%; border: 0; cursor: pointer;
  text-align: left; font: inherit; color: var(--text); margin-bottom: 10px;
}
.chat-listing:disabled { cursor: default; opacity: .7; }
.chat-notice {
  display: flex; gap: 6px; align-items: flex-start; margin: 0 2px 12px;
  font-size: 12px; line-height: 1.4; color: var(--muted);
}
.chat-notice svg { flex: none; margin-top: 1px; }
.chat-telegram { margin: 0 0 10px; }
.review-locked { display: flex; gap: 8px; align-items: flex-start; }
.review-locked svg { flex: none; margin-top: 2px; }
.review-ask {
  display: flex; flex-direction: column; gap: 6px; margin: 12px auto 4px; max-width: 420px;
  padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
  text-align: center; font-size: 14px;
}
.review-ask span { color: var(--muted); font-size: 13px; }
.exch-start {
  display: flex; flex-direction: column; gap: 10px; margin: 6px auto; max-width: 440px;
  padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
}
.exch-start__sides { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.exch-start__sides button {
  appearance: none; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  border-radius: 12px; padding: 9px 6px; font: inherit; font-size: 13px; cursor: pointer;
}
.exch-start__sides button.is-active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.chat-input[hidden] { display: none; }
/* Экран заявки обменнику: короткие подтверждения вместо ленты сообщений. */
.orders-sent { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.orders-sent__row {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px;
  background: var(--t-mint); color: #0F5C3A; font-size: 13px;
}
.orders-sent__row span { flex: 1; overflow-wrap: anywhere; }
.orders-sent__row time { color: #3F7A5B; font-size: 11.5px; }
/* Обмены валют в админке */
.order-row__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; font-size: 12px; }
.order-row__none { color: var(--muted); font-size: 12px; }
.order-row__review { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; }
.order-row__review[hidden] { display: none; }
.order-row__text { width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.badge--done { background: var(--t-mint); color: #0F5C3A; }
.badge--active { background: var(--t-blue); color: #14568F; }
.exch-start__label { font-size: 12.5px; color: var(--muted); margin: -2px 0 -4px; }
.exch-start__row { display: grid; grid-template-columns: 1fr 96px; gap: 8px; }
.exch-start__row input, .exch-start__row select {
  width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
  font: inherit; font-size: 16px; background: var(--bg); color: var(--text);
}
.exch-start__calc { font-size: 14px; font-weight: 600; color: var(--primary); }
.exch-start__hint { text-align: center; font-size: 12px; color: var(--muted); }
.review-ask .btn { margin-top: 6px; }
.chat { display: flex; flex-direction: column; gap: 6px; padding-bottom: 76px; }
.chat--admin { padding-bottom: 12px; }
.chat-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 10px; }
.bubble {
  max-width: 82%; align-self: flex-start; background: var(--card); color: var(--text); box-shadow: var(--shadow);
  border-radius: 16px 16px 16px 4px; padding: 8px 12px; font-size: 14.5px; line-height: 1.4;
  overflow-wrap: anywhere; min-width: 0;
}
.bubble__text { white-space: pre-wrap; }
.bubble--mine { align-self: flex-end; background: var(--primary); color: #fff; border-radius: 16px 16px 4px 16px; }
.bubble time { display: block; font-size: 10.5px; opacity: .65; margin-top: 2px; text-align: right; white-space: normal; }
.bubble__who { display: block; font-size: 11.5px; font-weight: 700; opacity: .8; margin-bottom: 1px; white-space: normal; }
.chat-input {
  position: fixed; left: 0; right: 0; z-index: 25; bottom: calc(62px + var(--safe-bottom));
  display: flex; gap: 8px; align-items: flex-end; padding: 8px 12px;
  background: var(--card); border-top: 1px solid var(--line);
}
body.desktop-client .chat-input { position: sticky; bottom: 0; margin: 0 -4px; border-radius: 16px; border: 1px solid var(--line); }
.chat-input textarea {
  flex: 1; resize: none; border: 1px solid var(--line); border-radius: 18px; padding: 9px 14px;
  font: inherit; font-size: 14.5px; line-height: 1.35; background: var(--card); color: var(--text); max-height: 120px;
}
.chat-input .btn { flex: none; width: 42px; height: 42px; padding: 0; border-radius: 50%; justify-content: center; }

/* ------------------------------------------------------------ разговорник */
.phrases { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.phrases__head, .phrases__row {
  display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 10px; padding: 10px 14px; align-items: start;
}
.phrases__head {
  background: var(--t-mint); color: var(--primary);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
}
body.dark .phrases__head { color: var(--accent); }
.phrases__row {
  width: 100%; border: 0; border-top: 1px solid var(--line); background: none; cursor: pointer;
  text-align: left; font: inherit; font-size: 13.5px; line-height: 1.35; color: var(--text);
}
.phrases__row:active { background: var(--t-mint); }
.phrases__row .vi { font-weight: 700; color: var(--primary); overflow-wrap: anywhere; }
body.dark .phrases__row .vi { color: var(--accent); }
.phrases__row .pr { color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.phrases__row .ru { overflow-wrap: anywhere; }
.phrases__note { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.tr-big small { display: block; margin-top: 14px; font-size: 18px; font-weight: 500; opacity: .8; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-bottom));
  transform: translateX(-50%); z-index: 70;
  background: rgba(16, 32, 30, .94); color: #fff;
  padding: 12px 18px; border-radius: 22px; font-size: 13.5px;
  max-width: 88%; text-align: center;
}

/* Развёрнутое окно Telegram и общие элементы адаптивной оболочки. */
.desktop-nav-brand, .desktop-nav-caption, .desktop-nav-footer { display: none; }
.home-intro, .home-welcome { display: contents; }
.window-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  flex: none; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text); padding: 10px 12px;
  font: inherit; font-size: 13px; cursor: pointer;
}
.window-btn[hidden] { display: none; }
body.desktop-client.on-home .topbar { display: flex; }
.translate-label { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-bottom: 10px; }
.translate-placeholder { display: none; }
.translate-result { margin-top: 12px; min-width: 0; }
.translate-source { min-width: 0; }
:where(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 579px) {
  .window-btn span { display: none; }
}

/* Широкое окно: боковая навигация и рабочая область вместо телефонной колонки.
   Порог зависит от фактической ширины, поэтому уменьшение окна и масштаб
   браузера автоматически возвращают компактную раскладку без прокрутки вбок. */
@media (min-width: 900px) {
  body {
    --sidebar-width: 0px;
    padding: 0 var(--safe-right) 0 calc(var(--sidebar-width) + var(--safe-left));
  }
  body.app-ready { --sidebar-width: 216px; }
  main { max-width: 1280px; padding: 28px 32px 40px; min-width: 0; }
  body:not(.app-ready) main { max-width: 760px; }
  .topbar, body.on-home .topbar {
    display: flex; min-height: calc(76px + var(--safe-top));
    padding: calc(16px + var(--safe-top)) 32px 16px; gap: 14px;
  }
  .topbar__back { width: 40px; height: 40px; }
  .topbar__brand.is-home { align-items: flex-start; }
  body.app-ready .topbar__brand .brand-logo { display: none; }
  body.app-ready .topbar__brand .topbar__title {
    display: block; color: var(--text); font-size: 21px; font-weight: 700; letter-spacing: -.3px;
  }
  .tabbar {
    top: 0; right: auto; bottom: 0; width: calc(var(--sidebar-width) + var(--safe-left));
    padding: calc(28px + var(--safe-top)) 16px calc(24px + var(--safe-bottom)) calc(16px + var(--safe-left));
    flex-direction: column; align-items: stretch; gap: 6px;
    border-top: 0; border-right: 1px solid var(--line); overflow-y: auto;
  }
  .desktop-nav-brand { display: flex; flex-direction: column; gap: 9px; padding: 0 12px 28px; }
  .desktop-nav-brand > span:last-child { color: var(--muted); font-size: 11px; }
  .desktop-nav-caption { display: block; padding: 0 14px 8px; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
  .desktop-nav-footer { display: block; margin-top: auto; padding: 32px 14px 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
  .tab {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    min-height: 48px; border-radius: 13px; padding: 12px 14px; font-size: 14px; text-align: left;
  }
  .tab.is-active { background: var(--t-mint); }
  .home-intro {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    align-items: center; gap: 28px; margin-bottom: 28px;
  }
  .home-welcome { display: block; grid-column: 1; grid-row: 1; min-width: 0; }
  .home-hero { grid-column: 2; grid-row: 1; margin: 0; border-radius: 22px; box-shadow: var(--shadow); }
  .home-hi { margin: 0 0 20px; }
  .home-hi b { display: block; font-size: clamp(22px, 2vw, 30px); line-height: 1.2; letter-spacing: -.7px; }
  .home-hi span { font-size: 14px; line-height: 1.6; margin-top: 12px; max-width: 38ch; }
  .home-welcome .searchbar { margin: 0; padding: 14px; }
  .ptiles { gap: 14px; }
  .ptile { padding: 16px 16px 30px; gap: 7px; border-radius: 20px; }
  .ptile__icon { width: 64px; height: 64px; }
  .ptile__art { transform: scale(.72727273); }
  .ptile__name { font-size: 15px; min-height: 2.6em; }
  .ptile__hint { font-size: 12px; line-height: 1.45; }
  .features { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; padding: 20px; margin-top: 20px; }
  .feature { font-size: 12px; }
  .feature + .feature { border-left: 1px solid var(--line); padding-left: 16px; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .tile { aspect-ratio: auto; min-height: 150px; padding: 22px; gap: 22px; }
  .tile__name { font-size: 16px; }
  .lgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .lcard__body { padding: 16px; }
  .lcard__title { font-size: 15px; }
  .lcard__price { font-size: 17px; }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .section-title { margin-top: 28px; }
  .row { padding: 18px 22px; }
  .row__sub { font-size: 13.5px; }
  .article { max-width: 900px; margin-inline: auto; padding: 30px; font-size: 16px; }
  .article h1 { font-size: 28px; margin-bottom: 12px; }
  .article + .actionbar { max-width: 900px; margin-inline: auto; }
  .chat { max-width: 850px; margin-inline: auto; gap: 16px; }
  .msg { max-width: 78%; padding: 16px 20px; line-height: 1.65; }
  .composer {
    left: calc(var(--sidebar-width) + var(--safe-left) + 32px); right: calc(32px + var(--safe-right));
    bottom: calc(20px + var(--safe-bottom)); max-width: 850px; padding: 14px;
    border: 1px solid var(--line); background: var(--card); border-radius: 20px; box-shadow: var(--shadow);
  }
  .has-composer { padding-bottom: calc(150px + var(--safe-bottom)); }
  .screen-translate { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
  .translate-source .tr-card, .translate-result .tr-card { min-height: 300px; padding: 24px; }
  .translate-source textarea { min-height: 228px; font-size: 18px; line-height: 1.6; resize: vertical; }
  .translate-label { font-size: 13px; }
  .translate-result { margin: 0; }
  .translate-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
    min-height: 300px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted);
  }
  .form { max-width: 900px; margin-inline: auto; gap: 18px; }
  .field label { font-size: 14px; }
  .field-row { gap: 18px; }
  .chips { flex-wrap: wrap; overflow: visible; gap: 10px; }
  .sheet { align-items: center; justify-content: center; padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom)); }
  .sheet__panel { max-width: 760px; max-height: calc(100dvh - 48px - var(--safe-top) - var(--safe-bottom)); border-radius: 24px; padding: 24px; }
  .gallery { margin-inline: 0; padding-inline: 0; gap: 16px; }
  .gallery img { width: calc((100% - 16px) / 2); }
  .gallery img:only-child { max-height: 540px; object-fit: contain; background: var(--card); }
  .toast { left: calc(50% + var(--sidebar-width) / 2); bottom: calc(28px + var(--safe-bottom)); max-width: min(600px, 70%); }
  .onb { padding: 20px 0; }
  .city-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1440px) {
  .ptiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .lgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (hover: hover) and (pointer: fine) {
  .tab:hover, .row:hover { background: var(--t-mint); }
  .ptile:hover { box-shadow: 0 6px 18px rgba(0, 50, 45, .12); }
  .window-btn:hover { background: var(--bg); }
}

/* Assistant and translator controls share the existing responsive layout. */
#chatMessages { display: flex; flex-direction: column; gap: 14px; }
.ai-subtitle, .ai-source, .tr-counter, .tr-status { font-size: 12px; color: var(--muted); }
.ai-subtitle { margin-top: 8px; }
.ai-source { margin-top: 12px; white-space: normal; }
.ai-toolbar { display: flex; justify-content: flex-end; }
.ai-examples { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-examples[hidden] { display: none; }
.ai-error { color: var(--alert); }
.tr-direction { width: 100%; min-width: 0; padding: 10px 12px; margin: 0 0 20px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.tr-counter { text-align: right; margin-top: 8px; }
.tr-status { text-align: center; }
.tr-out { white-space: pre-wrap; overflow-wrap: anywhere; }
.composer button:disabled, .btn:disabled, .chip:disabled { opacity: .5; cursor: default; }
.translate-source .actionbar, .translate-result .actionbar { flex-wrap: wrap; }
.tr-big { border: 0; font-family: inherit; width: 100%; overflow: auto; }

#chatMessages .msg--bot { white-space: normal; }
.msg__text { white-space: pre-wrap; }
