/* Price Hunter 2.0 — токены и стили. Все цвета только через переменные из ТЗ (раздел 3). */
:root{
  --bg:#061014; --surface:#101C22; --elevated:#14252B; --deep:#0C171C; --border:#234047;
  --text:#F0F7F6; --text2:#ADBDC1; --accent:#35E784; --danger:#FF6973; --info:#66CADD; --warn:#E9B459; --ind:#A994FF;
  --accent-dim:rgba(53,231,132,.14); --danger-dim:rgba(255,105,115,.14); --warn-dim:rgba(233,180,89,.16); --info-dim:rgba(102,202,221,.14); --ind-dim:rgba(169,148,255,.16);
  --r:16px; --r-sm:12px; --tab-h:64px;
  --font:-apple-system,BlinkMacSystemFont,Inter,'Segoe UI',Roboto,sans-serif;
  --sab:env(safe-area-inset-bottom,0px); --sat:env(safe-area-inset-top,0px);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overflow:hidden;background:var(--bg);color:var(--text);font:14px/1.35 var(--font);overscroll-behavior:none}
button{font-family:inherit;color:inherit;cursor:pointer}
button:disabled{cursor:default}
.hide{display:none!important}
.num{font-variant-numeric:tabular-nums}
.up{color:var(--accent)}.down{color:var(--danger)}
.t2{color:var(--text2)}.sm{font-size:12px}.xs{font-size:12px;color:var(--text2)}
.press{transition:transform .12s,opacity .12s}.press:active{transform:scale(.98)}

/* каркас: экран = вкладки сверху, таб-бар снизу */
.app{display:flex;flex-direction:column;height:var(--tg-viewport-stable-height,100dvh)}
.view{flex:1;min-height:0;display:none;flex-direction:column}
.view.on{display:flex;animation:fade .16s ease-out}
@keyframes fade{from{opacity:0}}
.scroll{flex:1;min-height:0;overflow:auto;padding:12px 16px 16px;display:flex;flex-direction:column;gap:12px;-webkit-overflow-scrolling:touch}
@media (max-width:340px){.scroll{padding:10px 12px 12px}}
.screen-h{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 16px 0}
.screen-h h1{margin:0;font-size:22px;font-weight:600;letter-spacing:-.01em}

/* таб-бар */
.tabbar{display:flex;flex:0 0 auto;height:calc(var(--tab-h) + var(--sab));padding-bottom:var(--sab);background:var(--deep);border-top:1px solid var(--border)}
.tabbar button{flex:1;background:none;border:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;color:var(--text2);font-size:11px;font-weight:500;padding:0;min-width:0;transition:color .14s}
.tabbar button svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.tabbar button.on{color:var(--accent)}
.tabbar button span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}

/* шапка терминала */
.hdr{display:flex;align-items:center;gap:10px;padding:10px 16px 0}
.brand{display:flex;align-items:center;gap:8px;font-weight:600;font-size:15px}
.brand svg{width:22px;height:22px}
.chip{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;border-radius:999px;font-size:12px;font-weight:600;white-space:nowrap;border:1px solid var(--border);background:var(--surface);color:var(--text2)}
.chip i{width:6px;height:6px;border-radius:50%;background:currentColor;flex:0 0 auto}
.chip.live{color:var(--accent);border-color:rgba(53,231,132,.35);background:var(--accent-dim)}
.chip.live i{box-shadow:0 0 8px currentColor;animation:pulse 1.6s infinite}
.chip.off{color:var(--text2)}.chip.warn{color:var(--warn);background:var(--warn-dim);border-color:rgba(233,180,89,.35)}
@keyframes pulse{50%{opacity:.35}}
@media (prefers-reduced-motion:reduce){.chip.live i,.view.on{animation:none}}

/* строка пары и цены */
.quote{display:flex;align-items:center;gap:10px;padding:8px 16px 0}
.pairbtn{display:flex;align-items:center;gap:8px;height:40px;padding:0 12px 0 10px;border-radius:var(--r-sm);background:var(--surface);border:1px solid var(--border);font-size:15px;font-weight:600;min-width:0}
.pairbtn .flag{font-size:14px;line-height:1}
.pairbtn .nm{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.pairbtn svg{width:14px;height:14px;stroke:var(--text2);fill:none;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round;flex:0 0 auto}
.price{margin-left:auto;text-align:right;min-width:0}
.price .p{font-size:28px;font-weight:600;letter-spacing:-.02em;line-height:1}
.price .c{font-size:12px;font-weight:600;margin-top:3px;display:inline-flex;align-items:center;gap:6px}
.price .c.up{color:var(--accent)}.price .c.down{color:var(--danger)}
@media (max-width:340px){.price .p{font-size:24px}}

/* сегменты (таймфрейм, периоды) */
.seg{display:flex;gap:2px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-sm);padding:3px}
.seg button{flex:1;height:32px;border:0;border-radius:9px;background:transparent;color:var(--text2);font-size:13px;font-weight:600;transition:background .14s,color .14s}
.seg button.on{background:var(--elevated);color:var(--text)}
.tfrow{display:flex;align-items:center;gap:10px;padding:10px 16px 0}
.tfrow .seg{width:190px}
.tfrow .legend{margin-left:auto;display:flex;gap:10px;font-size:12px;color:var(--text2);white-space:nowrap}
.tfrow .legend i{display:inline-block;width:10px;height:2px;border-radius:1px;vertical-align:middle;margin-right:5px}

/* график */
.chartwrap{flex:1;min-height:170px;margin:10px 16px 0;display:flex;flex-direction:column;border:1px solid var(--border);border-radius:var(--r);overflow:hidden;background:var(--deep);position:relative}
#chart{flex:1;min-height:0}#rsi{height:48px;border-top:1px solid var(--border)}
.rl{position:absolute;left:10px;bottom:34px;z-index:3;font-size:11px;color:var(--text2);pointer-events:none}
.ovl{position:absolute;z-index:3;pointer-events:none;font-size:12px;font-weight:600;font-variant-numeric:tabular-nums}
.entrylbl{left:8px;padding:2px 8px;border-radius:6px;background:var(--deep);border:1px dashed currentColor;transform:translateY(-50%)}
.tbadge{top:10px;left:10px;padding:4px 9px;border-radius:8px;border:1px solid currentColor;background:rgba(12,23,28,.92)}
.tbadge.up,.entrylbl.up{color:var(--accent)}.tbadge.down,.entrylbl.down{color:var(--danger)}.tbadge.flat{color:var(--text2)}
.chartmsg{position:absolute;inset:0;display:grid;place-items:center;color:var(--text2);font-size:13px;background:var(--deep);z-index:4}

/* карточки */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r);padding:14px}
.card h3{margin:0 0 8px;font-size:16px;font-weight:600}
.row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.badge{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;padding:4px 9px;border-radius:999px;background:var(--elevated);color:var(--text2);white-space:nowrap}
.badge.ok{background:var(--accent-dim);color:var(--accent)}.badge.bad{background:var(--danger-dim);color:var(--danger)}.badge.info{background:var(--info-dim);color:var(--info)}.badge.sub{background:var(--ind-dim);color:var(--ind)}.badge.warn{background:var(--warn-dim);color:var(--warn)}
.sec{font-size:12px;color:var(--text2);text-transform:uppercase;letter-spacing:.04em;padding:4px 2px 0}
.empty{text-align:center;padding:32px 16px;color:var(--text2)}

/* сила перекоса: пять полосок */
.meter{display:inline-flex;gap:3px;vertical-align:middle}
.meter i{width:9px;height:5px;border-radius:3px;background:var(--border)}
.meter.weak i:nth-child(-n+1){background:var(--text2)}
.meter.mid i:nth-child(-n+3){background:var(--warn)}
.meter.strong i{background:var(--accent)}

/* карточка сигнала над кнопкой */
.sig{margin:10px 16px 0;background:var(--surface);border:1px solid var(--border);border-radius:var(--r);padding:12px 14px;display:flex;gap:12px;align-items:center;min-height:64px}
.sig .ic{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;flex:0 0 auto;background:var(--elevated)}
.sig .ic svg{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
.sig.up .ic{background:var(--accent-dim);color:var(--accent)}.sig.down .ic{background:var(--danger-dim);color:var(--danger)}
.sig.strong{border-color:rgba(53,231,132,.45);box-shadow:0 0 0 3px rgba(53,231,132,.08)}
.sig.strong .ic{background:var(--accent-dim);color:var(--accent)}
.sig .body{flex:1;min-width:0}
.sig .t{font-size:15px;font-weight:600;line-height:1.25;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.sig .d{font-size:12px;color:var(--text2);margin-top:3px;line-height:1.4}
.sig .prog{height:3px;background:var(--elevated);border-radius:2px;margin-top:8px;overflow:hidden}.sig .prog i{display:block;height:100%;background:var(--accent);transition:width 1s linear}
.sig .acts{display:flex;flex-direction:column;gap:6px;align-items:flex-end}
.xbtn{width:32px;height:32px;border-radius:9px;border:0;background:transparent;color:var(--text2);display:grid;place-items:center}
.xbtn svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:2.2;stroke-linecap:round}

/* время сделки: чипы */
.exp{padding:10px 16px 0}
.exp .lbl{display:flex;justify-content:space-between;align-items:baseline;font-size:13px;color:var(--text2);margin-bottom:8px}
.exp .lbl b{color:var(--text);font-weight:600}
.chips{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;padding-bottom:2px}
.chips::-webkit-scrollbar{display:none}
.chips button{flex:0 0 auto;min-width:56px;height:44px;border-radius:var(--r-sm);background:var(--surface);border:1px solid var(--border);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;transition:border-color .14s,background .14s}
.chips button b{font-size:15px;font-weight:600;line-height:1}
.chips button small{font-size:12px;color:var(--text2)}
.chips button.on{border-color:var(--accent);background:var(--accent-dim)}
.chips button.on b{color:var(--accent)}
.chips button.weakx b{color:var(--text2)}

/* главная кнопка в sticky-зоне */
.ctawrap{padding:12px 16px 12px;flex:0 0 auto}
.cta{width:100%;height:54px;border:0;border-radius:var(--r);background:var(--accent);color:#06130B;font-size:16px;font-weight:700;box-shadow:0 8px 24px rgba(53,231,132,.22);transition:transform .12s,opacity .12s}
.cta:active{transform:scale(.98)}.cta:disabled{opacity:.5;box-shadow:none}

/* списки */
.list .item{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--border);min-height:56px}
.list .item:last-child{border-bottom:0}
.item .dir{width:36px;height:36px;border-radius:11px;display:grid;place-items:center;flex:0 0 auto}
.item .dir svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:2.6;stroke-linecap:round;stroke-linejoin:round}
.item .dir.up{background:var(--accent-dim);color:var(--accent)}.item .dir.down{background:var(--danger-dim);color:var(--danger)}
.item .main{flex:1;min-width:0}
.item .main .nm{font-size:15px;font-weight:600;display:flex;gap:8px;align-items:center}
.item .main .meta{font-size:12px;color:var(--text2);margin-top:2px}
.dayh{font-size:12px;color:var(--text2);text-transform:uppercase;letter-spacing:.04em;padding:8px 2px 0}
.hbar{height:6px;background:var(--elevated);border-radius:3px;overflow:hidden;margin-top:6px}.hbar i{display:block;height:100%;border-radius:3px;background:var(--accent)}
.hbar i.bad{background:var(--danger)}
table{width:100%;border-collapse:collapse;font-size:13px}
td,th{padding:8px 4px;text-align:right;border-bottom:1px solid var(--border);font-variant-numeric:tabular-nums}
th{color:var(--text2);font-weight:500}td:first-child,th:first-child{text-align:left}tr:last-child td{border-bottom:0}

/* профиль */
.prof{display:flex;align-items:center;gap:12px}
.ava{width:48px;height:48px;border-radius:50%;background:var(--elevated);border:1px solid var(--border);display:grid;place-items:center;font-weight:700;font-size:18px;color:var(--accent);flex:0 0 auto;overflow:hidden}
.ava img{width:100%;height:100%;object-fit:cover}
.kpi{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
@media (max-width:340px){.kpi{grid-template-columns:repeat(2,minmax(0,1fr))}}
.kpi .card{padding:12px;text-align:left}
.kpi .k{font-size:12px;color:var(--text2)}
.kpi .v{font-size:22px;font-weight:600;margin-top:4px;letter-spacing:-.01em}
.limitbar{height:8px;background:var(--elevated);border-radius:4px;overflow:hidden;margin-top:10px}.limitbar i{display:block;height:100%;background:var(--accent);border-radius:4px}
.menu{display:flex;flex-direction:column}
.menu button{display:flex;align-items:center;gap:12px;width:100%;background:none;border:0;border-bottom:1px solid var(--border);padding:0;height:52px;font-size:15px;font-weight:500;text-align:left}
.menu button:last-child{border-bottom:0}
.menu button svg{width:20px;height:20px;stroke:var(--text2);fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.menu button .r{margin-left:auto;color:var(--text2);font-size:13px;display:flex;align-items:center;gap:6px}

/* bottom sheet, тост */
.sheet{position:fixed;inset:0;z-index:25}
.sheet-bg{position:absolute;inset:0;background:rgba(0,0,0,.6)}
.sheet-body{position:absolute;left:0;right:0;bottom:0;background:var(--elevated);border-radius:24px 24px 0 0;padding:8px 16px calc(16px + var(--sab));max-height:82vh;overflow:auto;animation:upin .24s ease-out;display:flex;flex-direction:column;gap:10px}
@keyframes upin{from{transform:translateY(40px);opacity:0}}
.handle{width:36px;height:4px;border-radius:2px;background:var(--border);margin:4px auto 6px}
.sheet-h{display:flex;justify-content:space-between;align-items:center;font-weight:600;font-size:16px}
.sheet-h .xbtn{margin-right:-8px}
.sheet input{width:100%;height:44px;background:var(--deep);border:1px solid var(--border);color:var(--text);border-radius:var(--r-sm);padding:0 12px;font-size:15px;outline:none}
.sheet input:focus{border-color:var(--info)}
.prow{display:flex;align-items:center;gap:10px;padding:0 4px;height:52px;border-bottom:1px solid var(--border);width:100%;background:none;border-left:0;border-right:0;border-top:0;text-align:left}
.prow:last-child{border-bottom:0}
.prow .nm{font-weight:600;font-size:15px;flex:1;display:flex;align-items:center;gap:8px;min-width:0}
.prow .st{font-size:12px;color:var(--text2);white-space:nowrap}
.prow .pr{font-size:14px;color:var(--text);min-width:64px;text-align:right}
.prow .ac{font-size:13px;color:var(--text2);min-width:40px;text-align:right}
.prow.on .nm{color:var(--accent)}
.prow.on::after{content:'';width:8px;height:8px;border-radius:50%;background:var(--accent);flex:0 0 auto}
.prow.soon{opacity:.55}
.toast{position:fixed;left:16px;right:16px;top:calc(12px + var(--sat));background:var(--elevated);border:1px solid var(--border);border-radius:var(--r-sm);padding:12px 14px;font-size:14px;z-index:40;box-shadow:0 10px 30px rgba(0,0,0,.4)}
.grid10{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px}
.grid10 button{height:52px;border-radius:var(--r-sm);background:var(--deep);border:1px solid var(--border);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px}
.grid10 button b{font-size:15px}.grid10 button small{font-size:12px;color:var(--text2)}
.grid10 button.on{border-color:var(--accent);background:var(--accent-dim)}.grid10 button.on b{color:var(--accent)}

/* --- шаг 2: лист выбора пары --- */
.sheet .seg{flex:0 0 auto}
.prow .star{width:40px;height:40px;border:0;background:none;display:grid;place-items:center;color:var(--text2);flex:0 0 auto;margin-right:-6px}
.prow .star svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linejoin:round}
.prow .star.on{color:var(--warn)}.prow .star.on svg{fill:currentColor}
.prow .chk{width:20px;height:20px;border-radius:50%;background:var(--accent);display:grid;place-items:center;flex:0 0 auto}
.prow .chk svg{width:12px;height:12px;stroke:#06130B;fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.prow.on{background:var(--accent-dim);border-radius:var(--r-sm);padding-left:10px;padding-right:6px;margin:0 -6px;width:auto}
.prow.on::after{content:none}
.prow .nm .st{display:block;font-weight:500;margin-top:1px}
.prow .right{text-align:right;min-width:72px}
.prow .right .pr{display:block;min-width:0}
.prow .right .ac{display:block;min-width:0;margin-top:1px}
.sheet .empty{padding:24px 16px}
.sheet-body{touch-action:pan-y}

/* --- шаг 2: карточка сигнала --- */
.modal{position:fixed;inset:0;z-index:30}
.modal-bg{position:absolute;inset:0;background:rgba(0,0,0,.62)}
.modal-body{position:absolute;left:0;right:0;bottom:0;max-height:92%;background:var(--elevated);border-radius:24px 24px 0 0;display:flex;flex-direction:column;animation:upin .24s ease-out;touch-action:pan-y}
.modal-h{display:flex;align-items:center;justify-content:space-between;padding:4px 16px 0}
.modal-h .ttl{font-size:16px;font-weight:600}.modal-h .ttl span{color:var(--text2);font-weight:500}
.modal-c{overflow:auto;padding:12px 16px calc(16px + var(--sab));display:flex;flex-direction:column;gap:12px}
.plate{border-radius:var(--r);padding:20px 16px;display:flex;align-items:center;gap:16px;border:1px solid var(--border);background:var(--surface)}
.plate .arr{width:64px;height:64px;border-radius:18px;display:grid;place-items:center;flex:0 0 auto}
.plate .arr svg{width:34px;height:34px;stroke:#06130B;fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.plate.up{border-color:rgba(53,231,132,.45);box-shadow:0 0 0 4px rgba(53,231,132,.08)}.plate.up .arr{background:var(--accent)}
.plate.down{border-color:rgba(255,105,115,.45);box-shadow:0 0 0 4px rgba(255,105,115,.08)}.plate.down .arr{background:var(--danger)}
.plate .dir{font-size:32px;font-weight:700;letter-spacing:-.01em;line-height:1}
.plate.up .dir{color:var(--accent)}.plate.down .dir{color:var(--danger)}
.plate .sub{font-size:13px;color:var(--text2);margin-top:6px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.tiles{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
@media (max-width:340px){.tiles{grid-template-columns:repeat(2,minmax(0,1fr))}}
.tile{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-sm);padding:10px 12px;min-width:0}
.tile .k{font-size:12px;color:var(--text2)}
.tile .v{font-size:17px;font-weight:600;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tile .v.info{color:var(--info)}
details.acc{background:var(--surface);border:1px solid var(--border);border-radius:var(--r);padding:0 14px}
details.acc summary{list-style:none;display:flex;align-items:center;justify-content:space-between;height:48px;font-weight:600;cursor:pointer}
details.acc summary::-webkit-details-marker{display:none}
details.acc summary svg{width:18px;height:18px;stroke:var(--text2);fill:none;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round;transition:transform .16s}
details.acc[open] summary svg{transform:rotate(180deg)}
details.acc .acc-b{padding:0 0 14px;display:flex;flex-direction:column;gap:10px}
.kv{display:flex;justify-content:space-between;gap:12px;font-size:14px}
.kv span:first-child{color:var(--text2)}
.why{font-size:13px;color:var(--text2);line-height:1.45;border-top:1px solid var(--border);padding-top:10px}
.why b{color:var(--text);font-weight:600}
.resline{display:flex;align-items:center;justify-content:space-between;gap:10px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r);padding:12px 14px}
.resline .prog{flex:1;height:4px;background:var(--elevated);border-radius:2px;overflow:hidden}.resline .prog i{display:block;height:100%;background:var(--info);transition:width 1s linear}
.btn2{height:52px;border-radius:var(--r);border:1px solid var(--border);background:var(--surface);color:var(--text);font-size:15px;font-weight:600}
.btns{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.skel{background:linear-gradient(90deg,var(--surface) 25%,var(--deep) 50%,var(--surface) 75%);background-size:200% 100%;animation:sh 1.2s infinite;border-radius:var(--r)}
@keyframes sh{to{background-position:-200% 0}}
@media (prefers-reduced-motion:reduce){.skel{animation:none}}
.state{display:flex;flex-direction:column;align-items:center;gap:10px;padding:28px 16px;text-align:center}
.state .ic{width:56px;height:56px;border-radius:18px;display:grid;place-items:center;background:var(--surface);border:1px solid var(--border)}
.state .ic svg{width:26px;height:26px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.state .ic.warn{color:var(--warn)}.state .ic.bad{color:var(--danger)}.state .ic.info{color:var(--info)}
.state h4{margin:0;font-size:17px;font-weight:600}.state p{margin:0;color:var(--text2);font-size:13px;line-height:1.45;max-width:30ch}
.spin{width:26px;height:26px;border-radius:50%;border:3px solid var(--border);border-top-color:var(--accent);animation:rot .8s linear infinite}
@keyframes rot{to{transform:rotate(360deg)}}
