/* Paper Trader — мини-приложение. Цвета фона и текста берутся из темы Telegram. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #eef0f4);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #14161c);
  --hint: var(--tg-theme-hint-color, #8a8f9c);
  --line: color-mix(in srgb, var(--hint) 22%, transparent);
  --soft: color-mix(in srgb, var(--hint) 12%, transparent);
  --ink: #3d4bd6;            /* действия */
  --ink-soft: color-mix(in srgb, #3d4bd6 12%, transparent);
  --up: #11a36a;
  --down: #e5484d;
  --up-soft: color-mix(in srgb, #11a36a 13%, transparent);
  --down-soft: color-mix(in srgb, #e5484d 13%, transparent);
  --halal: #0f7b63;
  --halal-soft: color-mix(in srgb, #0f7b63 12%, transparent);
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 11px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 var(--font); }
body { min-height: 100vh; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: var(--text); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--hint); }
[hidden] { display: none !important; }

#tabs { padding: 14px 14px 110px; max-width: 560px; margin: 0 auto; }
.tab { display: flex; flex-direction: column; gap: 12px; }

/* ---------- плавающая панель вкладок ---------- */
#tabbar {
  position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; width: min(92vw, 420px);
  padding: 6px; border-radius: 26px; z-index: 20;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 8px 28px rgba(20, 22, 40, .14), 0 0 0 1px var(--line);
}
#tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 6px; border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--hint); }
#tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#tabbar button.on { color: var(--ink); background: var(--ink-soft); }
#tabbar .dot { position: absolute; top: 6px; right: calc(50% - 18px); width: 8px; height: 8px; border-radius: 50%; background: var(--down); }

/* ---------- карточки и списки ---------- */
.card { background: color-mix(in srgb, var(--card) 88%, transparent); border-radius: var(--r-lg); padding: 16px;
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); }
.overlay .card, .sheet .card { background: var(--card); backdrop-filter: none; -webkit-backdrop-filter: none; }
.card h2 { margin: 0 0 10px; font-size: 16px; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; }
.card h2 .link { font-size: 14px; font-weight: 500; color: var(--ink); }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t2 { font-size: 13px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; }
button.row { width: 100%; text-align: left; }
.empty { text-align: center; color: var(--hint); padding: 18px 8px; }
.empty b { display: block; color: var(--text); margin-bottom: 4px; }

/* значок актива: буквы на цветном круге */
.ico { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff; letter-spacing: -.02em; }
.ico.sm { width: 34px; height: 34px; font-size: 11px; }
.ico.lg { width: 54px; height: 54px; font-size: 16px; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--soft); color: var(--hint); white-space: nowrap; }
.pill.up { background: var(--up-soft); color: var(--up); }
.pill.down { background: var(--down-soft); color: var(--down); }
.pill.halal { background: var(--halal-soft); color: var(--halal); }
.pill.ink { background: var(--ink-soft); color: var(--ink); }

/* ---------- главная ---------- */
.top { display: flex; align-items: center; gap: 10px; padding: 2px 2px 4px; }
.me-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; border-radius: 14px; padding: 2px; }
.top .who span.ok { color: var(--up); display: inline-flex; align-items: center; gap: 4px; }
.chk { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -2px; }
.pill .chk { margin-right: 2px; }
.pill.acc { padding: 6px 8px 6px 12px; font-size: 13px; background: var(--card); color: var(--text); gap: 6px;
  box-shadow: 0 0 0 1px var(--line); }
.pill.acc.halal { color: var(--halal); }
.pill.acc svg { width: 14px; height: 14px; fill: none; stroke: var(--hint); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
/* камень тарифа */
.gem { display: inline-block; width: 10px; height: 10px; border-radius: 2px; transform: rotate(45deg); flex: none;
  background: linear-gradient(135deg, var(--g1), var(--g2)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.gem, .badge, .prog { --g1: #6b78ff; --g2: #2f3bb8; }
.bronze { --g1: #e09a5f; --g2: #8a4a1c; }
.silver { --g1: #eef1f5; --g2: #8b95a3; }
.gold { --g1: #ffd970; --g2: #b8861b; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--ink-soft); flex: none;
  display: grid; place-items: center; font-weight: 700; color: var(--ink); }
.avatar.xl { width: 88px; height: 88px; font-size: 34px; }
.top .who { flex: 1; min-width: 0; }
.top .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .who span { font-size: 13px; color: var(--hint); }

/* «бумажный чек» с балансом — главный характерный элемент */
.ticket { position: relative; background: var(--card); border-radius: var(--r-lg); padding: 22px 18px 18px;
  text-align: center; overflow: hidden; }
.ticket, .badge {
  -webkit-mask: radial-gradient(circle 11px at 0 62%, #0000 97%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 11px at 100% 62%, #0000 97%, #000) right / 51% 100% no-repeat;
          mask: radial-gradient(circle 11px at 0 62%, #0000 97%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 11px at 100% 62%, #0000 97%, #000) right / 51% 100% no-repeat; }
.ticket .perf { position: absolute; left: 18px; right: 18px; top: calc(62% + 10px);
  border-top: 2px dashed var(--line); }
.ticket .label { color: var(--hint); font-size: 14px; }
.ticket .big { font-size: 46px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin: 4px 0 6px; }
.ticket .big small { font-size: 28px; font-weight: 600; }
.ticket .big .cur { font-size: 28px; color: var(--hint); font-weight: 500; margin-left: 4px; }
.ticket .delta { display: flex; justify-content: center; gap: 8px; align-items: center; font-size: 14px; font-weight: 600; }
.ticket .stub { display: flex; justify-content: space-around; margin-top: 30px; font-size: 13px; color: var(--hint); }
.ticket .stub b { display: block; color: var(--text); font-size: 15px; }
.ticket.halal .label::after { content: " · ☪"; color: var(--halal); }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.act { background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: var(--r-md); padding: 12px 4px 10px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.act svg { width: 26px; height: 26px; fill: none; stroke: var(--text); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.act:active, .row:active, .tile:active { transform: scale(.98); }

.bars { display: flex; gap: 4px; height: 96px; position: relative; }
.bars::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.bars span { flex: 1; position: relative; }
.bars i { position: absolute; left: 0; right: 0; bottom: 50%; border-radius: 4px; background: var(--soft); }
.bars i.u { background: var(--up); }
.bars i.d { background: var(--down); bottom: auto; top: 50%; }
.bars-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--hint); margin-top: 6px; }

/* ---------- торговля ---------- */
.search { position: sticky; top: 0; z-index: 5; padding: 4px 0 2px; margin: 0 -6px; padding-inline: 6px; border-radius: 0 0 18px 18px;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.search label { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 14px; padding: 0 12px; }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--hint); stroke-width: 2; }
.search input { flex: 1; border: 0; background: none; padding: 12px 0; outline: none; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 0; font-size: 13px; font-weight: 600; }
.tile .ch { font-size: 12px; font-weight: 600; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px 7px 7px; border-radius: 999px;
  background: var(--soft); font-weight: 600; font-size: 14px; }
.chip .ico { width: 22px; height: 22px; font-size: 8px; }
.seg { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -2px 6px; padding: 0 2px; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: none; padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--hint); background: var(--soft); }
.seg button.on { background: var(--text); color: var(--card); }
.note { font-size: 13px; color: var(--hint); padding: 2px 4px; }
.note.halal { color: var(--halal); }

/* ---------- экраны поверх вкладок ---------- */
.overlay { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto;
  padding: 14px 14px 120px; animation: slidein .22s ease-out; }
.overlay > .inner { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
@keyframes slidein { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); font-weight: 600; padding: 4px 0; }
.back svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.2; }

.ihead { display: flex; flex-direction: column; gap: 8px; padding: 0 2px; }
.ihead .name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 18px; font-weight: 700; }
.ihead .price { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.chart { height: 300px; border-radius: var(--r-md); overflow: hidden; position: relative; }
.chart canvas { display: block; }
.tfs { display: flex; gap: 4px; background: var(--soft); border-radius: 14px; padding: 4px; }
.tfs button { flex: 1; padding: 7px 0; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--hint); }
.tfs button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv span:first-child { color: var(--hint); }
.kv span:last-child { font-weight: 600; text-align: right; }

.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent); }
.dock .inner { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; }
.btn { flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 15px 16px;
  border-radius: 18px; font-weight: 700; font-size: 16px; background: var(--ink); color: #fff; }
.btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.btn.long { background: var(--up); } .btn.short { background: var(--down); }
.btn.ghost { background: var(--soft); color: var(--text); }
.btn.halal { background: var(--halal); }
.btn[disabled] { opacity: .45; }
.btn.sm { flex: none; padding: 10px 14px; font-size: 14px; border-radius: 13px; }

/* ---------- нижние листы (ордер, позиция) ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(10, 12, 20, .45); animation: fade .18s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92vh; overflow-y: auto;
  background: var(--card); border-radius: 24px 24px 0 0; padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  animation: up .24s cubic-bezier(.2, .8, .2, 1); }
.sheet .inner { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.sheet .grip { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 4px; }
.sheet h3 { margin: 0; font-size: 18px; }
@keyframes up { from { transform: translateY(40%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } }
.side { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--soft); padding: 4px; border-radius: 14px; }
.side button { padding: 9px; border-radius: 11px; font-weight: 700; color: var(--hint); }
.side button.on.l { background: var(--up); color: #fff; } .side button.on.s { background: var(--down); color: #fff; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--hint); display: flex; justify-content: space-between; }
.field .box { display: flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 14px; padding: 0 14px; }
.field input { flex: 1; min-width: 0; border: 0; background: none; padding: 13px 0; font-size: 17px; font-weight: 600; outline: none; }
.field .suffix { color: var(--hint); font-weight: 600; }
.field .calc { font-size: 13px; font-weight: 600; white-space: nowrap; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick.money { display: grid; grid-template-columns: repeat(3, 1fr); }
.quick button { flex: 1; min-width: 44px; padding: 8px 0; border-radius: 11px; background: var(--soft); font-weight: 600; font-size: 14px; }
.quick button.on { background: var(--ink); color: #fff; }

.result { text-align: center; padding: 8px 0 4px; }
.result .roe { font-size: 52px; font-weight: 700; letter-spacing: -.03em; }
.result .sum { font-size: 22px; font-weight: 700; }

/* ---------- чат ---------- */
.chat-head { padding: 2px 2px 0; }
.chat-head h1 { margin: 0; font-size: 22px; }
.msgs { display: flex; flex-direction: column; gap: 6px; padding-bottom: 76px; }
.msg { max-width: 82%; padding: 9px 12px 6px; border-radius: 18px; background: var(--card); align-self: flex-start;
  white-space: pre-wrap; word-wrap: break-word; }
.msg.me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
.msg.them { border-bottom-left-radius: 6px; }
.msg time { display: block; text-align: right; font-size: 11px; opacity: .65; margin-top: 2px; }
.msg img { display: block; max-width: 100%; border-radius: 12px; margin: 2px 0 4px; }
.msg .tag { font-size: 12px; font-weight: 600; opacity: .75; }
.day { align-self: center; font-size: 12px; color: var(--hint); padding: 6px 0; }
.composer { position: fixed; left: 0; right: 0; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 15; padding: 0 14px; }
.composer .inner { max-width: 560px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; background: var(--card);
  border-radius: 22px; padding: 6px; box-shadow: 0 4px 18px rgba(20, 22, 40, .1), 0 0 0 1px var(--line); }
.composer textarea { flex: 1; border: 0; background: none; resize: none; max-height: 120px; padding: 9px 6px; outline: none; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.send { background: var(--ink); color: #fff; }
.attach-preview { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--hint); padding: 0 6px 4px; }
.attach-preview img { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; }

/* ---------- прочее ---------- */
#toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translate(-50%, -140%);
  z-index: 60; max-width: 90vw; padding: 11px 16px; border-radius: 14px; background: var(--text); color: var(--card);
  font-weight: 600; font-size: 14px; transition: transform .25s ease; text-align: center; }
#toast.show { transform: translate(-50%, 0); }
#toast.bad { background: var(--down); color: #fff; }
.skeleton { background: linear-gradient(90deg, var(--soft), color-mix(in srgb, var(--hint) 20%, transparent), var(--soft));
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; min-height: 18px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.rules { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.halal-card { border: 1.5px solid var(--halal-soft); }
.halal-card h2 { color: var(--halal); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }


/* ---------- фон: у каждой вкладки свой ---------- */
#app { position: relative; z-index: 1; }
#bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#bg i { position: absolute; inset: 0; opacity: 0; transition: opacity .45s ease;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 28%, transparent 78%);
          mask-image: linear-gradient(to bottom, #000 0, #000 28%, transparent 78%); }
body[data-tab="home"] #bg .b-home, body[data-tab="trade"] #bg .b-trade,
body[data-tab="income"] #bg .b-income, body[data-tab="chat"] #bg .b-chat { opacity: 1; }
:root {
  --pat-home: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='36'%3E%3Cg fill='none' stroke='%233d4bd6' stroke-width='1'%3E%3Cpath stroke-opacity='.2' d='M0 18C30 0 60 0 90 18s60 18 90 0'/%3E%3Cpath stroke-opacity='.13' d='M0 18c30 18 60 18 90 0s60-18 90 0'/%3E%3C/g%3E%3C/svg%3E");
  --pat-income: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Cg fill='none' stroke='%230f7b63' stroke-opacity='.22' stroke-width='1'%3E%3Cpath d='M20 20h16v16H20z'/%3E%3Cpath d='M28 16.7 39.3 28 28 39.3 16.7 28z'/%3E%3Cpath d='M0 0l16.7 16.7M56 0 39.3 16.7M0 56l16.7-16.7M56 56 39.3 39.3' stroke-opacity='.12'/%3E%3C/g%3E%3C/svg%3E");
  --pat-chat: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='132' height='132'%3E%3Cg fill='none' stroke='%237c5cff' stroke-opacity='.2' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 18h26a5 5 0 0 1 5 5v12a5 5 0 0 1-5 5H26l-7 6v-6h-5a5 5 0 0 1-5-5V23a5 5 0 0 1 5-5z'/%3E%3Ccircle cx='98' cy='30' r='11'/%3E%3Cpath d='M98 23v14M94.5 26.5c0-1.4 1.6-2.2 3.5-2.2s3.5.8 3.5 2.2c0 3-7 1.6-7 4.6 0 1.3 1.6 2.2 3.5 2.2s3.5-.9 3.5-2.3'/%3E%3Cpath d='M18 112l14-14 9 9 16-18M48 89h9v9'/%3E%3Cpath d='M92 96v20M100 88v28M108 100v16'/%3E%3Cpath d='M70 62l2.6 5.3 5.8.8-4.2 4.1 1 5.8-5.2-2.7-5.2 2.7 1-5.8-4.2-4.1 5.8-.8z'/%3E%3C/g%3E%3C/svg%3E");
  --pat-chart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='170' viewBox='0 0 420 170'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%2311a36a' stop-opacity='.22'/%3E%3Cstop offset='1' stop-color='%2311a36a' stop-opacity='0'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M0 150 40 132 70 140 110 104 140 116 180 80 210 94 250 60 280 72 320 34 350 46 420 10V170H0z' fill='url(%23g)'/%3E%3Cpath d='M0 150 40 132 70 140 110 104 140 116 180 80 210 94 250 60 280 72 320 34 350 46 420 10' fill='none' stroke='%2311a36a' stroke-opacity='.45' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
  --grid: color-mix(in srgb, var(--hint) 16%, transparent);
  --grid2: color-mix(in srgb, var(--hint) 7%, transparent);
}
[data-scheme="dark"] {
  --pat-home: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='36'%3E%3Cg fill='none' stroke='%238f9bff' stroke-width='1'%3E%3Cpath stroke-opacity='.2' d='M0 18C30 0 60 0 90 18s60 18 90 0'/%3E%3Cpath stroke-opacity='.12' d='M0 18c30 18 60 18 90 0s60-18 90 0'/%3E%3C/g%3E%3C/svg%3E");
  --pat-income: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Cg fill='none' stroke='%2343c9a0' stroke-opacity='.2' stroke-width='1'%3E%3Cpath d='M20 20h16v16H20z'/%3E%3Cpath d='M28 16.7 39.3 28 28 39.3 16.7 28z'/%3E%3Cpath d='M0 0l16.7 16.7M56 0 39.3 16.7M0 56l16.7-16.7M56 56 39.3 39.3' stroke-opacity='.1'/%3E%3C/g%3E%3C/svg%3E");
}
.b-home { background: radial-gradient(120% 60% at 15% -5%, color-mix(in srgb, var(--ink) 26%, transparent), transparent 70%),
  radial-gradient(80% 45% at 100% 0, color-mix(in srgb, #7c5cff 18%, transparent), transparent 70%), var(--pat-home); }
.b-trade { background: var(--pat-chart) right 0 top 70px / min(100%, 520px) auto no-repeat,
  linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 48px 48px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 48px 48px,
  linear-gradient(var(--grid2) 1px, transparent 1px) 0 0 / 12px 12px, linear-gradient(90deg, var(--grid2) 1px, transparent 1px) 0 0 / 12px 12px; }
.b-income { background: radial-gradient(110% 55% at 50% -10%, color-mix(in srgb, var(--halal) 24%, transparent), transparent 70%), var(--pat-income); }
.b-chat { background: radial-gradient(90% 50% at 90% -5%, color-mix(in srgb, #7c5cff 20%, transparent), transparent 70%),
  radial-gradient(70% 40% at 0 10%, color-mix(in srgb, var(--ink) 14%, transparent), transparent 70%), var(--pat-chat); }

/* ---------- тепловая карта ---------- */
.heat { position: relative; height: 300px; border-radius: 14px; overflow: hidden; background: var(--card);
  --hm-up: #0e9a60; --hm-down: #d8383f; --hm-zero: #5b6372; }
.heat.full { height: calc(100vh - 220px); min-height: 380px; }
.ht { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; overflow: hidden; text-align: center; line-height: 1.12; padding: 2px; border: 1.5px solid var(--card); border-radius: 7px; }
.ht b { font-size: var(--fs); font-weight: 700; letter-spacing: -.01em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.ht span { font-size: max(10px, calc(var(--fs) * .62)); font-weight: 600; opacity: .94; }
.ht small { font-size: max(10px, calc(var(--fs) * .46)); opacity: .78; margin-top: 3px; }
.ht.na { color: var(--hint); }
.ht:active { filter: brightness(1.12); }
.heat-legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--hint); margin: 10px 2px 2px; }
.heat-legend i { flex: 1; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #d8383f, #5b6372, #0e9a60); }
.heat-card .note { padding: 2px 2px 0; font-size: 12px; }

/* ---------- профиль ---------- */
.phead { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 8px 0 6px; }
.phead h1 { margin: 6px 0 0; font-size: 22px; }
.phead .muted { font-size: 14px; }
.phead .pill, .phead .btn { margin-top: 6px; }
.pgroup { background: var(--card); border-radius: var(--r-lg); padding: 4px 0; }
.prow { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 14px; text-align: left; }
.prow + .prow { box-shadow: inset 0 1px 0 var(--line); }
.pic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.pic svg { width: 19px; height: 19px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.prow .pl { flex: 1; font-weight: 500; }
.prow .pv { color: var(--ink); font-weight: 500; display: inline-flex; align-items: center; gap: 7px; }
.chev { width: 16px; height: 16px; fill: none; stroke: var(--hint); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.fine { font-size: 12px; color: var(--hint); padding: 0 6px; margin: 2px 0; }
.plist { display: flex; flex-direction: column; }
.opt { display: flex; align-items: center; gap: 10px; padding: 13px 4px; text-align: left; font-size: 16px; }
.opt + .opt { border-top: 1px solid var(--line); }
.opt i { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--line); flex: none; margin-left: auto; }
.opt span + i { margin-left: 10px; }
.opt.on i { box-shadow: inset 0 0 0 6px var(--ink); }
.prose p { margin: 0 0 10px; line-height: 1.5; }
.prose p:last-child { margin: 0; }
.prose a { color: var(--ink); }
.faq details + details { border-top: 1px solid var(--line); }
.faq summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; font-weight: 600; cursor: pointer; }
.faq summary::-webkit-details-marker { display: none; }
.faq details[open] .chev { transform: rotate(90deg); }
.faq details p { margin: 0 0 12px; color: var(--hint); line-height: 1.5; }
.news img { display: block; width: calc(100% + 32px); margin: -16px -16px 12px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.news time { display: block; font-size: 12px; margin-top: 8px; }

/* ---------- тарифы: тёмный лист ---------- */
.sheet.dark { background: #15182b; color: #fff; --line: rgba(255,255,255,.14); }
.sheet.dark .grip { background: rgba(255,255,255,.25); }
.badge { align-self: center; display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; padding: 12px 34px;
  border-radius: 18px; font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: #fff;
  background: linear-gradient(160deg, var(--g1), var(--g2)); text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.badge.silver { color: #2b313c; text-shadow: none; }
.badge .gem { width: 16px; height: 16px; background: rgba(255,255,255,.9); }
.tsub { text-align: center; font-size: 19px; font-weight: 700; margin: 4px 12px; line-height: 1.3; }
.tseg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: rgba(255,255,255,.09); }
.tseg button { padding: 8px 0; border-radius: 11px; font-weight: 700; color: rgba(255,255,255,.7); }
.tseg button.on { background: rgba(255,255,255,.18); color: #fff; }
.tcard { background: #fff; color: #14161c; border-radius: 18px; overflow: hidden; }
.tc-in { padding: 14px 16px; }
.tc-in b, .benefits > b { font-size: 17px; }
.tc-in p { margin: 4px 0 12px; color: #4a4f5c; }
.tc-foot { background: #262a40; color: #fff; text-align: center; padding: 11px; font-weight: 700; font-size: 14px; }
.prog { position: relative; height: 26px; border-radius: 13px; background: #eceef2; display: flex; justify-content: space-between;
  align-items: center; padding: 0 10px; font-size: 12px; font-weight: 600; color: #8a8f9c; overflow: hidden; }
.prog i { position: absolute; left: 0; top: 0; bottom: 0; min-width: 26px; border-radius: 13px; background: linear-gradient(90deg, var(--g1), var(--g2)); }
.prog span { position: relative; }
.prog span:first-of-type { color: #fff; mix-blend-mode: normal; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.benefits { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ben { display: flex; gap: 10px; align-items: baseline; }
.ben s { color: #8a8f9c; }
.bi { width: 18px; flex: none; text-align: center; font-weight: 700; color: #6b7280; }
.tnote { font-size: 13px; color: rgba(255,255,255,.6); margin: 0 4px; }
.sheet.dark h4 { margin: 8px 2px 0; font-size: 17px; }
.accs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.accopt { border-radius: 16px; padding: 12px; background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); font-size: 13px; }
.accopt > div { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.accopt.on { box-shadow: inset 0 0 0 2px #8f9bff; }
.accopt.halal.on { box-shadow: inset 0 0 0 2px #43c9a0; }
.accopt ul { margin: 8px 0 0; padding-left: 16px; color: rgba(255,255,255,.72); display: flex; flex-direction: column; gap: 4px; }
.cur-tag { align-self: flex-start; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.14); }
.btn.ghost.light { background: rgba(255,255,255,.12); color: #fff; }
@media (max-width: 360px) { .accs { grid-template-columns: 1fr; } .badge { font-size: 26px; } }

/* ---------- доход: новый фон — шёлковые волны изумруда и золота ---------- */
:root { --pat-income2: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='160'%3E%3Cpath d='M0 30 C80 12 160 48 240 30 S400 12 480 30' fill='none' stroke='%230f7b63' stroke-opacity='0.22' stroke-width='1.2'/%3E%3Cpath d='M0 52 C80 30 160 74 240 52 S400 30 480 52' fill='none' stroke='%230f7b63' stroke-opacity='0.16' stroke-width='1.2'/%3E%3Cpath d='M0 74 C80 58 160 90 240 74 S400 58 480 74' fill='none' stroke='%23c9a23a' stroke-opacity='0.2' stroke-width='1.2'/%3E%3Cpath d='M0 96 C80 72 160 120 240 96 S400 72 480 96' fill='none' stroke='%230f7b63' stroke-opacity='0.14' stroke-width='1.2'/%3E%3Cpath d='M0 118 C80 100 160 136 240 118 S400 100 480 118' fill='none' stroke='%23c9a23a' stroke-opacity='0.18' stroke-width='1.2'/%3E%3Cpath d='M0 140 C80 120 160 160 240 140 S400 120 480 140' fill='none' stroke='%230f7b63' stroke-opacity='0.12' stroke-width='1.2'/%3E%3C/svg%3E"); --pat-tk: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='24'%3E%3Cg fill='none' stroke='%23fff' stroke-width='.8'%3E%3Cpath stroke-opacity='.16' d='M0 12C20 0 40 0 60 12s40 12 60 0'/%3E%3Cpath stroke-opacity='.1' d='M0 12c20 12 40 12 60 0s40-12 60 0'/%3E%3C/g%3E%3C/svg%3E"); }
[data-scheme="dark"] { --pat-income2: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='480' height='160'%3E%3Cpath d='M0 30 C80 12 160 48 240 30 S400 12 480 30' fill='none' stroke='%2343c9a0' stroke-opacity='0.22' stroke-width='1.2'/%3E%3Cpath d='M0 52 C80 30 160 74 240 52 S400 30 480 52' fill='none' stroke='%2343c9a0' stroke-opacity='0.16' stroke-width='1.2'/%3E%3Cpath d='M0 74 C80 58 160 90 240 74 S400 58 480 74' fill='none' stroke='%23e9c46a' stroke-opacity='0.2' stroke-width='1.2'/%3E%3Cpath d='M0 96 C80 72 160 120 240 96 S400 72 480 96' fill='none' stroke='%2343c9a0' stroke-opacity='0.14' stroke-width='1.2'/%3E%3Cpath d='M0 118 C80 100 160 136 240 118 S400 100 480 118' fill='none' stroke='%23e9c46a' stroke-opacity='0.18' stroke-width='1.2'/%3E%3Cpath d='M0 140 C80 120 160 160 240 140 S400 120 480 140' fill='none' stroke='%2343c9a0' stroke-opacity='0.12' stroke-width='1.2'/%3E%3C/svg%3E"); }
body[data-tab="income"] #bg .b-income { background:
  radial-gradient(70% 45% at 85% -5%, color-mix(in srgb, #e9c46a 30%, transparent), transparent 70%),
  radial-gradient(90% 50% at 0 0, color-mix(in srgb, var(--halal) 26%, transparent), transparent 70%),
  var(--pat-income2) center top / 480px 160px repeat; }

/* ---------- баланс: палитры ---------- */
.ticket, .swatch { --tk-bg: var(--card); --tk-fg: var(--text); --tk-mute: var(--hint); --tk-line: var(--line); }
.t-ink { --tk-bg: var(--pat-tk), radial-gradient(110% 90% at 0 0, #6470ff 0, transparent 55%), linear-gradient(150deg, #2b37b8, #111750);
  --tk-fg: #fff; --tk-mute: rgba(255,255,255,.66); --tk-line: rgba(255,255,255,.3); }
.t-emerald { --tk-bg: var(--pat-tk), radial-gradient(90% 80% at 100% 0, rgba(242,201,107,.42), transparent 60%), linear-gradient(150deg, #11906f, #04342b);
  --tk-fg: #fff; --tk-mute: rgba(255,255,255,.7); --tk-line: rgba(255,255,255,.3); }
.t-graphite { --tk-bg: var(--pat-tk), radial-gradient(90% 80% at 0 0, rgba(255,255,255,.12), transparent 60%), linear-gradient(150deg, #40454f, #111317);
  --tk-fg: #f3f4f6; --tk-mute: rgba(243,244,246,.6); --tk-line: rgba(255,255,255,.22); }
.t-sunset { --tk-bg: var(--pat-tk), linear-gradient(135deg, #ff9b63 0%, #e2457c 52%, #5b2a86 100%);
  --tk-fg: #fff; --tk-mute: rgba(255,255,255,.75); --tk-line: rgba(255,255,255,.35); }
.t-gold { --tk-bg: var(--pat-tk), radial-gradient(90% 80% at 100% 0, rgba(233,196,106,.38), transparent 60%), linear-gradient(150deg, #2c2619, #0e0c08);
  --tk-fg: #f6dc8f; --tk-mute: rgba(246,220,143,.62); --tk-line: rgba(246,220,143,.3); }
.ticket { background: var(--tk-bg); color: var(--tk-fg); }
.ticket .label, .ticket .stub, .ticket .big .cur { color: var(--tk-mute); }
.ticket .stub b { color: var(--tk-fg); }
.ticket .perf { border-top-color: var(--tk-line); }
.ticket:not(.t-paper) .muted { color: var(--tk-mute); }
.ticket:not(.t-paper) .pill { background: rgba(255,255,255,.16); color: var(--tk-fg); }
.ticket:not(.t-paper) .up { color: #7ff0bd; } .ticket:not(.t-paper) .down { color: #ffb1b3; }
.ticket.t-sunset .up, .ticket.t-sunset .down { color: #fff; }
.theme-btn { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--tk-fg) 10%, transparent); }
.theme-btn svg { width: 19px; height: 19px; fill: none; stroke: var(--tk-mute); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.swatch { background: var(--tk-bg); color: var(--tk-fg); border-radius: 18px; padding: 16px 14px 12px; text-align: left; min-height: 92px;
  display: flex; flex-direction: column; justify-content: space-between; box-shadow: inset 0 0 0 1px var(--line); }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }
.swatch .sw-num { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.swatch .sw-name { font-size: 13px; color: var(--tk-mute); font-weight: 600; }

/* кнопки на главной — спокойные нейтральные */
.act { color: var(--text); }
.act svg { width: 42px; height: 42px; padding: 9px; border-radius: 50%; stroke: color-mix(in srgb, var(--text) 72%, var(--hint));
  background: color-mix(in srgb, var(--hint) 13%, transparent); }

/* ---------- тарифы: VIP и кнопка повышения ---------- */
.vip { --g1: #8b5cf6; --g2: #1e1036; }
.badge.vip { color: #f5d27a; }
.tseg { grid-template-columns: repeat(5, 1fr); }
.tseg button { font-size: 14px; }
.btn.up-btn { background: linear-gradient(135deg, var(--g1), var(--g2)); color: #fff; }
.btn.up-btn.silver { color: #2b313c; }
.btn.up-btn.vip { color: #f5d27a; }

/* ---------- режим текстов ---------- */
#edit-bar { position: fixed; left: 10px; right: 10px; top: 8px; z-index: 60; display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 10px 14px; border-radius: 16px; background: #1d1f2b; color: #fff; font-size: 13px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
#edit-bar span { flex: 1; }
#edit-bar button { background: #fff; color: #1d1f2b; border-radius: 10px; padding: 7px 12px; font-weight: 700; }
body.editing #app, body.editing .overlay > .inner { padding-top: 60px; }
body.editing :is(h1, h2, h3, .t1, .t2, .label, .note, .kv span, .act, .btn, .pill, .prow .pl, li, p, .tab-l) {
  outline: 1px dashed color-mix(in srgb, var(--ink) 45%, transparent); outline-offset: 2px; -webkit-user-select: none; user-select: none; }
textarea.area { width: 100%; border-radius: 14px; padding: 12px; background: var(--soft); color: var(--text); font: inherit; resize: vertical; border: 0; }
.ink-t { color: var(--ink); }

/* ---------- страницы с картинками ---------- */
.pimgs { display: flex; flex-direction: column; gap: 10px; }
.pimgs figure { position: relative; margin: 0; }
.pimgs img { display: block; width: 100%; border-radius: var(--r-lg); }
.img-x { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 15px; }
label.prow { cursor: pointer; }

/* ---------- карточка сделки и верификация ---------- */
.tcardimg img { display: block; width: 100%; border-radius: 16px; }
.result.verified .vbig .chk { width: 74px; height: 74px; color: var(--up); stroke-width: 1.6; }
.result.verified .sum { margin-top: 8px; }
.prog.lo span:first-of-type { color: #4a4f5c; text-shadow: none; }

/* ---------- арабский и иврит: зеркальные стрелки ---------- */
[dir="rtl"] .chev, [dir="rtl"] .pill.acc svg, [dir="rtl"] .back svg { transform: scaleX(-1); }
[dir="rtl"] .faq details[open] .chev { transform: scaleX(-1) rotate(90deg); }
[dir="rtl"] .me-btn, [dir="rtl"] .prow, [dir="rtl"] .opt, [dir="rtl"] .swatch { text-align: right; }
[dir="rtl"] .ticket .big { direction: ltr; }
[dir="rtl"] .heat-legend { direction: ltr; }

/* ---------- автоновости ---------- */
.news.auto h3 { margin: 10px 0 6px; font-size: 17px; line-height: 1.3; }
.news.auto p { margin: 0 0 10px; line-height: 1.45; }
.news.auto .src { color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; }
.pill.mk-crypto { background: color-mix(in srgb, #f7931a 18%, transparent); color: #c56a00; }
.pill.mk-stock { background: color-mix(in srgb, var(--ink) 15%, transparent); color: var(--ink); }
.pill.mk-forex { background: color-mix(in srgb, #0ea5e9 16%, transparent); color: #0284c7; }
.pill.mk-metal { background: color-mix(in srgb, #d4a017 20%, transparent); color: #9a7209; }
.pill.mk-commodity { background: color-mix(in srgb, #64748b 18%, transparent); color: #475569; }
.news.auto .src-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.news.auto .src-row time { margin: 0; }
