/* Оболочка Mini App: экраны и нижний таб-бар (2026-08-08). */

#root {
  min-height: 100dvh;
  /* Ключевое: на десктопе окно Mini App растягивают, и без ограничения
     ширины карточки превращались в полосы через весь экран. Колонка держит
     «телефонный» формат и центрируется. */
  max-width: var(--app-width); margin: 0 auto;
  padding: 14px 14px calc(84px + env(safe-area-inset-bottom, 0px));
  padding-top: max(14px, env(safe-area-inset-top, 0px));
  display: flex; flex-direction: column; gap: 12px;
}

/* ---------- шапка пользователя ---------- */
.userbar { display: flex; align-items: center; gap: 11px; }
.userbar .name { font-weight: 600; line-height: 1.15; }
.userbar .nick { color: var(--muted); font-size: 13px; }

.logo {
  margin-left: auto; font-weight: 800; letter-spacing: .04em; font-size: 13px;
  color: var(--accent-2); text-transform: uppercase;
}

/* ---------- баланс ---------- */
.balance { background: linear-gradient(160deg, var(--surface-2), var(--surface)); }
.balance .sum { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.balance .cap { color: var(--muted); font-size: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  padding: 5px 11px; border-radius: 999px; font-size: 12px;
  background: var(--accent-dim); color: var(--accent-2);
}

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }

/* ---------- метрики ---------- */
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.metric {
  text-align: center; padding: 14px 10px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.metric .ic {
  width: 34px; height: 34px; border-radius: 50%; display: grid;
  place-items: center; font-size: 16px; background: var(--accent-dim);
}
.metric .v { font-size: 22px; font-weight: 700; line-height: 1.1; }
.metric .k {
  color: var(--muted); font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2);
}

/* ---------- список сделок ---------- */
.deal {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px;
  width: 100%; text-align: left; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px;
}
.deal:active { transform: scale(.99); }
.deal .top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.deal .sub { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.deal .amt { font-weight: 600; }

.unread {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}

/* ---------- профиль ---------- */
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 8px 0 4px; }
.ava-wrap { position: relative; display: inline-block; margin-bottom: 12px; }
.rating {
  position: absolute; left: 50%; bottom: -11px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--accent-2);
  font-weight: 700; font-size: 13px;
  border: 2px solid var(--bg);
}
.review { border-bottom: 1px solid var(--line); padding: 10px 0; }
.review:last-child { border-bottom: none; }

/* ---------- FAQ ---------- */
.acc { border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden; }
.acc + .acc { margin-top: 8px; }
.acc summary {
  padding: 13px 14px; font-weight: 600; cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 8px;
}
.acc summary::-webkit-details-marker { display: none; }
.acc summary::before { content: "▸"; color: var(--accent-2); transition: transform .15s; }
.acc[open] summary::before { transform: rotate(90deg); }
.acc .body { padding: 0 14px 14px; color: var(--muted); font-size: 14px;
  white-space: pre-wrap; }

.linkrow {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text); text-decoration: none;
}
.linkrow + .linkrow { margin-top: 8px; }
.linkrow::after { content: "↗"; margin-left: auto; color: var(--accent-2); }

/* ---------- мастер создания сделки ---------- */
.steps { display: flex; gap: 6px; margin-bottom: 4px; }
.steps i {
  flex: 1; height: 3px; border-radius: 2px; background: var(--line);
}
.steps i.on { background: var(--accent); }

.found { display: flex; gap: 11px; align-items: center; }
.rep { display: flex; gap: 14px; margin-top: 8px; font-size: 13px; }
.rep b { display: block; font-size: 15px; }

.choice {
  width: 100%; text-align: left; padding: 13px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); margin-bottom: 8px;
}
.choice.on { border-color: var(--accent); background: var(--accent-dim); }
.choice .t { font-weight: 600; }
.choice .d { color: var(--muted); font-size: 13px; margin-top: 2px; }

.summary-row { display: flex; justify-content: space-between; padding: 5px 0;
  font-size: 14px; }
.summary-row.total { border-top: 1px solid var(--line); margin-top: 6px;
  padding-top: 10px; font-weight: 700; }

.err { color: var(--danger); font-size: 13px; margin-top: 6px; }

/* ---------- таб-бар ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: rgba(13, 9, 22, .94); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
/* Панель повторяет ширину колонки: иначе на широком окне четыре кнопки
   разъезжаются по краям экрана и теряют связь с содержимым. */
#tabbar .inner {
  max-width: var(--app-width); margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 6px 8px 7px;
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 7px 4px 6px; background: none; border: 1px solid transparent;
  border-radius: 14px; color: var(--dim); font-size: 11px; font-weight: 500;
  position: relative; transition: background .15s, color .15s, border-color .15s;
}
.tab svg { width: 20px; height: 20px; display: block; }
/* Выбранный раздел «в рамке» — как на образце: подложка, контур и подсветка */
.tab.on {
  color: #fff; background: var(--accent-dim);
  border-color: rgba(169, 123, 255, .45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}
.tab.on svg { color: var(--accent-2); }
.tab .dot {
  position: absolute; top: 5px; right: calc(50% - 19px);
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  border: 2px solid #0D0916;
}
