/* Кабинет — тёмная тема с оранжевым акцентом.
   Токены собраны так же, как в исходном приложении: фон/карточки/бордеры
   отдельно, акцент одним цветом — перекрасить всё приложение можно тремя
   строчками в :root ниже. */

:root {
  --bg-0: #0B0E11;
  --bg-1: #181A20;
  --bg-2: #232A31;
  --bg-3: #2B3139;

  --border: rgba(255, 255, 255, .075);
  --border-soft: rgba(255, 255, 255, .045);
  --border-strong: rgba(255, 255, 255, .14);

  --text-0: #EAECEF;
  --text-1: #B7BDC6;
  --text-2: #868F9C;
  --text-label: #9AA4B2;
  --text-on-accent: #0B0E11;

  /* ↓ вот эти три строки задают весь фирменный цвет */
  --accent: #F7A600;
  --accent-deep: #D68900;
  --accent-bright: #FFBE3C;

  --accent-bg: rgba(247, 166, 0, .12);
  --accent-border: rgba(247, 166, 0, .32);
  --accent-hairline: rgba(247, 166, 0, .18);

  --positive: #3DDC97;
  --positive-bg: rgba(61, 220, 151, .12);
  --danger: #F6465D;
  --danger-bg: rgba(246, 70, 93, .12);
  --warning: #F0B90B;
  --warning-bg: rgba(240, 185, 11, .12);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 22px;

  --gap: 12px;
  --pad: 16px;
  --tabbar-h: 62px;

  --ui: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display: 'Space Grotesk', var(--ui);
}

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

/* display: flex у .sheet-wrap и .tabbar перебивает штатный display:none
   атрибута hidden — без этой строки шторка висит поверх экрана невидимкой. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  /* еле заметная сетка, как на терминале биржи */
  background-image:
    linear-gradient(rgba(255, 255, 255, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .028) 1px, transparent 1px);
  background-size: 26px 26px;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a.btn { color: var(--text-0); }

.app {
  padding: var(--pad) var(--pad) 8px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  overflow-x: hidden;
}

/* --- загрузка --------------------------------------------------------- */
.boot { display: flex; justify-content: center; padding: 96px 0; }
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- шапка ------------------------------------------------------------ */
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.ava {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
  background: var(--bg-2); display: grid; place-items: center;
  font-family: var(--display); font-weight: 600; color: var(--accent);
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.head-who { min-width: 0; flex: 1; }
.head-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.head-sub { font-size: 12px; color: var(--text-2); }
.head-brand {
  margin-left: auto; flex: 0 0 auto; font-family: var(--display); font-size: 13px; font-weight: 600;
  color: var(--accent); background: var(--accent-bg); border: 1px solid var(--accent-border);
  padding: 5px 10px; border-radius: 999px;
}

/* --- карточки --------------------------------------------------------- */
.card {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--pad); margin-bottom: var(--gap);
}
.card-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-label); margin-bottom: 12px;
}
.label { font-size: 13px; color: var(--text-label); }

.balance-card {
  background:
    radial-gradient(120% 130% at 50% -20%, rgba(247, 166, 0, .14), transparent 60%),
    var(--bg-1);
  border-color: var(--accent-hairline);
  text-align: center; padding: 22px var(--pad) 18px;
}
.balance-label { font-size: 13px; color: var(--text-label); }
.balance {
  font-family: var(--display); font-size: 38px; font-weight: 600;
  letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums;
}
.balance small { font-size: 18px; color: var(--text-2); margin-left: 4px; }
.balance-split { display: flex; justify-content: center; gap: 20px; margin-top: 14px; }
.balance-split div { text-align: center; }
.balance-split b {
  display: block; font-family: var(--display); font-size: 17px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  margin-bottom: var(--gap);
  width: 100%;
}
.metric {
  min-width: 0;
  overflow: hidden;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
}
.metric b {
  display: block;
  font-family: var(--display);
  font-size: clamp(13px, 4.2vw, 18px);
  font-weight: 600;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pos { color: var(--positive); }
.neg { color: var(--danger); }

/* --- график ----------------------------------------------------------- */
.chart { width: 100%; height: 168px; display: block; }
.chart-empty {
  height: 168px; display: grid; place-items: center;
  color: var(--text-2); font-size: 13px;
}

/* --- кнопки ----------------------------------------------------------- */
.row { display: flex; gap: var(--gap); width: 100%; min-width: 0; }
.btn {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; border-radius: var(--r-md); font-weight: 600;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text-0);
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.985); }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  color: var(--text-on-accent); border-color: transparent;
}
.btn-primary:disabled { filter: grayscale(.6) brightness(.7); cursor: default; }
.btn-ghost { background: transparent; }
.btn-wide { width: 100%; max-width: 100%; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }

/* --- список операций -------------------------------------------------- */
.op { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border-soft); }
.op:first-child { border-top: 0; }
.op-ico {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-2); flex: none;
}
.op-ico svg { width: 16px; height: 16px; fill: var(--text-1); }
.op-ico.in { background: var(--positive-bg); }
.op-ico.in svg { fill: var(--positive); }
.op-ico.out { background: var(--danger-bg); }
.op-ico.out svg { fill: var(--danger); }
.op-main { flex: 1; min-width: 0; }
.op-title { font-size: 15px; }
.op-date { font-size: 12px; color: var(--text-2); }
.op-sum { font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; }
.op-status { font-size: 11px; color: var(--text-2); text-align: right; }

.empty { color: var(--text-2); font-size: 14px; text-align: center; padding: 22px 8px; }

/* --- рефералка -------------------------------------------------------- */
.reflink {
  display: flex; align-items: center; gap: 10px; background: var(--bg-0);
  border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  padding: 12px 14px; margin-bottom: var(--gap);
}
.reflink span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--text-1); }
.reflink button { color: var(--accent); font-weight: 600; font-size: 14px; }

/* --- профиль ---------------------------------------------------------- */
.prof { display: flex; align-items: center; gap: 14px; margin-bottom: var(--gap); }
.prof .ava { width: 58px; height: 58px; font-size: 22px; }
.prof-name { font-size: 19px; font-weight: 600; }
.link-card {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px 0; border-top: 1px solid var(--border-soft);
}
.link-card:first-child { border-top: 0; }
.link-card .lc-text { flex: 1; min-width: 0; }
.link-card b { display: block; font-weight: 500; }
.link-card span { font-size: 13px; color: var(--text-2); }
.link-card .chev { color: var(--text-2); font-size: 20px; }

.note { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.note + .note { margin-top: 8px; }

/* --- шторка ----------------------------------------------------------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; }
.sheet-veil { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); }
.sheet {
  position: relative; width: 100%; max-width: 560px; margin: 0 auto;
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 10px var(--pad) calc(var(--pad) + env(safe-area-inset-bottom, 0px));
  animation: up .22s ease; max-height: 88vh; overflow: auto;
}
@keyframes up { from { transform: translateY(18px); opacity: .4; } }
.sheet-grip { width: 38px; height: 4px; border-radius: 4px; background: var(--bg-3); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 4px; font-size: 20px; font-family: var(--display); font-weight: 600; }
.sheet .note { margin-bottom: 14px; }

.field {
  display: flex; align-items: center; gap: 8px; background: var(--bg-0);
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 0 14px;
  margin-bottom: 10px;
}
.field:focus-within { border-color: var(--accent-border); }
.field input {
  flex: 1; height: 52px; background: none; border: 0; outline: none; color: var(--text-0);
  font-family: var(--display); font-size: 22px; font-weight: 600; min-width: 0;
}
.field input::placeholder { color: var(--text-2); font-weight: 400; }
/* стрелки-крутилки у number сбивают вид суммы */
.field input[type=number] { appearance: textfield; -moz-appearance: textfield; }
.field input::-webkit-outer-spin-button,
.field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field b { color: var(--text-2); font-size: 15px; }

.ok { text-align: center; padding: 8px 0 6px; }
.ok-check {
  width: 64px; height: 64px; margin: 4px auto 12px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--positive-bg); color: var(--positive);
  animation: okPop .35s ease;
}
.ok-check svg { width: 32px; height: 32px; }
@keyframes okPop { from { transform: scale(.6); opacity: 0; } }
.ok-title { font-family: var(--display); font-size: 22px; font-weight: 600; }
.ok-sub { font-size: 14px; color: var(--text-2); margin: 4px 0 10px; }
.ok-sum {
  font-family: var(--display); font-size: 36px; font-weight: 600;
  letter-spacing: -.02em; color: var(--positive); margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.ok-sum small { font-size: 18px; color: var(--text-2); margin-left: 4px; }

.mir {
  text-align: left; border-radius: 16px; padding: 16px 18px 14px; margin-bottom: 16px;
  background:
    radial-gradient(120% 140% at 100% -10%, rgba(255,255,255,.16), transparent 50%),
    linear-gradient(135deg, #0b6b3a 0%, #148c4a 48%, #0a4f2c 100%);
  color: #fff; box-shadow: 0 10px 28px rgba(10, 70, 40, .35);
}
.mir-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.mir-chip {
  width: 34px; height: 24px; border-radius: 5px;
  background: linear-gradient(180deg, #e8d48a, #c4a24a 55%, #8c6b22);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.mir-logo {
  font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: .12em;
  opacity: .95;
}
.mir-num {
  font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: .12em;
  font-variant-numeric: tabular-nums;
}
.mir-bot { margin-top: 10px; font-size: 12px; opacity: .8; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px); transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--border-strong); color: var(--text-0);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 60;
  animation: up .2s ease;
}

/* --- таббар ----------------------------------------------------------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(11, 14, 17, .92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-2); font-size: 10px; line-height: 1.15; text-align: center;
}
.tab svg { width: 22px; height: 22px; fill: currentColor; }
.tab.on { color: var(--accent); }

/* --- лента сделок ----------------------------------------------------- */
.sec { margin-bottom: var(--gap); }
.sec-h { display: flex; align-items: baseline; margin-bottom: 10px; }
.sec-h h2 {
  font-family: var(--display); font-size: 17px; font-weight: 600;
  letter-spacing: -.2px; display: flex; align-items: center; gap: 8px;
  margin: 0; color: var(--text-0);
}
.live-tag {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: middle;
  font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .8px;
}
.pulse {
  display: inline-block; flex: none; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .4; transform: scale(.85); }
}

.feed-card { padding-top: 6px; padding-bottom: 6px; }
.trade {
  display: flex; align-items: center; gap: 12px; padding: 11px 0;
  animation: tkIn .34s ease both;
}
.trade + .trade { border-top: 1px solid var(--border-soft); }
.trade-tap { cursor: pointer; border-radius: 12px; margin: 0 -6px; padding-left: 6px; padding-right: 6px; }
.trade-tap:active { background: rgba(255, 255, 255, .05); }
.trade-new { animation: tkIn .34s ease both, tradeFlash 1.2s ease; }
@keyframes tkIn { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: none; } }
@keyframes tradeFlash { from { background: var(--positive-bg); } to { background: transparent; } }

.t-ic {
  width: 40px; height: 40px; border-radius: var(--r-md); flex: none;
  display: grid; place-items: center; position: relative;
  background: var(--bg-2); font-family: var(--display); font-size: 15px;
  font-weight: 600; color: var(--text-1);
}
.t-ic-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  padding: 6px; background: var(--bg-2); border-radius: inherit;
}
.t-main { flex: 1; min-width: 0; }
.t-pair { font-size: 14px; font-weight: 600; }
.t-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.t-right { margin-left: auto; text-align: right; }
.t-amt {
  font-family: var(--display); font-size: 14px; font-weight: 600;
  color: var(--positive); font-variant-numeric: tabular-nums;
}
.t-amt.neg { color: var(--danger); }
.t-time { font-size: 11px; color: var(--text-2); margin-top: 2px; }

.skel {
  position: relative; overflow: hidden; background: var(--bg-2); border-radius: 6px;
}
.skel:after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.05) 50%, transparent);
  animation: skelSweep 1.25s ease-in-out infinite;
}
@keyframes skelSweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.td-top { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.td-pair { font-size: 16px; font-weight: 600; }
.td-status {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 4px;
  font-size: 11px; font-weight: 600; color: var(--positive);
  background: var(--positive-bg); border-radius: 99px; padding: 3px 9px;
}
.td-profit {
  font-family: var(--display); font-size: 32px; font-weight: 600;
  color: var(--positive); letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.td-profit.neg { color: var(--danger); }
.td-profit-l { font-size: 12px; color: var(--text-label); margin: 2px 0 16px; }
.td-route {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--border-soft); border-radius: 12px; overflow: hidden; margin-bottom: 12px;
}
.td-leg {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-0); padding: 12px 14px;
}
.l-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  border-radius: 6px; padding: 3px 7px; flex: none; text-transform: uppercase;
}
.l-buy { color: var(--positive); background: var(--positive-bg); }
.l-sell { color: var(--warning); background: var(--warning-bg); }
.l-venue { font-size: 14px; font-weight: 500; }
.l-px {
  margin-left: auto; font-family: var(--display); font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.td-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--border-soft); border-radius: 12px; overflow: hidden; margin-bottom: 12px;
}
.td-cell { background: var(--bg-0); padding: 11px 13px; }
.td-cell .c-l { font-size: 11px; color: var(--text-2); }
.td-cell .c-v {
  font-family: var(--display); font-size: 14px; font-weight: 600;
  color: var(--text-0); margin-top: 3px; font-variant-numeric: tabular-nums;
}
.td-oid {
  font-family: var(--display); font-size: 11px; color: var(--text-2);
  margin-bottom: 4px; word-break: break-all; font-variant-numeric: tabular-nums;
}

/* --- торговый бот ----------------------------------------------------- */
.how { display: flex; flex-direction: column; gap: 12px; }
.how-step { display: flex; gap: 12px; align-items: flex-start; }
.how-step span {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--display); font-weight: 600; font-size: 13px;
  color: var(--text-on-accent); background: var(--accent);
}
.how-step p { margin: 4px 0 0; font-size: 14px; color: var(--text-1); line-height: 1.45; }

.arb {
  margin: 14px 0 8px; padding: 14px 12px 12px;
  background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--r-lg);
}
.arb-row { display: flex; align-items: stretch; gap: 8px; }
.arb-ex {
  flex: 1; min-width: 0; text-align: center; padding: 12px 8px;
  background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--r-md);
}
.arb-ex-name { font-size: 12px; color: var(--text-2); letter-spacing: .04em; text-transform: uppercase; }
.arb-coin { font-family: var(--display); font-weight: 600; margin: 6px 0 2px; font-size: 15px; }
.arb-px { font-family: var(--display); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.arb-tag {
  margin-top: 8px; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 4px 8px;
}
.arb-tag.buy { color: var(--positive); background: var(--positive-bg); }
.arb-tag.sell { color: var(--warning); background: var(--warning-bg); }
.arb-mid {
  flex: none; width: 72px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; text-align: center;
}
.arb-bot {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; color: var(--text-on-accent);
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  border-radius: 999px; padding: 4px 8px;
}
.arb-arrows { font-size: 18px; line-height: 1.1; color: var(--accent); }
.arb-same { font-size: 10px; color: var(--text-2); }
.arb-profit {
  margin-top: 12px; text-align: center; font-size: 14px; color: var(--text-1);
  background: var(--positive-bg); border-radius: var(--r-md); padding: 10px 12px;
}
.arb-profit b { color: var(--positive); font-family: var(--display); font-size: 16px; }
