/* ============================ ТЕМЫ ============================ */
:root, :root[data-theme="light"] {
  --bg: #eef1f6; --panel: #ffffff; --fg: #0f172a; --fg-rgb: 15,23,42; --muted: #64748b; --line: #e2e8f0; --soft: #f1f5f9;
  --accent: #2563eb; --accent-rgb: 37,99,235; --accent-soft: #e8f0ff; --accent-fg: #ffffff;
  --up: #0e8f5e; --up-bg: #e3f5ec; --down: #d4343b; --down-bg: #fdeaea; --amber: #b45309; --amber-bg: #fdf1df;
  --seg-on: #0f172a; --seg-on-fg: #ffffff; --ink: #0f172a;
  --chart-bg: #ffffff; --grid: #eef1f6; --axis: #8793a6; --candle-up: #14a36b; --candle-down: #e0434b;
  --zone: rgba(37,99,235,.04); --tip-bg: #0f172a; --tip-fg: #ffffff;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px rgba(15,23,42,.05); --radius: 14px;
  --font-head: inherit; --pattern: none; --pop-shadow: 0 18px 44px rgba(15,23,42,.18);
}
:root[data-theme="dark"] {
  --bg: #0a0d14; --panel: #131824; --fg: #e7ebf3; --fg-rgb: 231,235,243; --muted: #8a94a8; --line: #232b3b; --soft: #1a2130;
  --accent: #5b9bff; --accent-rgb: 91,155,255; --accent-soft: #15284a; --accent-fg: #06142e;
  --up: #2fbf8f; --up-bg: #123329; --down: #f0616d; --down-bg: #3b1b21; --amber: #e9a23b; --amber-bg: #3a2b12;
  --seg-on: #2b3650; --seg-on-fg: #ffffff; --ink: #e7ebf3;
  --chart-bg: #0e131d; --grid: #1a2130; --axis: #6f7a90; --candle-up: #26a69a; --candle-down: #ef5350;
  --zone: rgba(91,155,255,.06); --tip-bg: #e7ebf3; --tip-fg: #0a0d14;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --pop-shadow: 0 18px 44px rgba(0,0,0,.55);
}
:root[data-theme="japan"] {
  --bg: #e9dfca; --panel: #f6efdd; --fg: #2a2420; --fg-rgb: 42,36,32; --muted: #807260; --line: #d8cbb0; --soft: #ece1c9;
  --accent: #1e3f7a; --accent-rgb: 30,63,122; --accent-soft: #e2e5ea; --accent-fg: #f6efdd;
  --up: #4a7a3f; --up-bg: #e1e8d0; --down: #c0392b; --down-bg: #f1d8cf; --amber: #a8741a; --amber-bg: #f1e2c0;
  --seg-on: #2a2420; --seg-on-fg: #f6efdd; --ink: #2a2420;
  --chart-bg: #f9f3e3; --grid: #e8dec6; --axis: #8c7e68; --candle-up: #4d8040; --candle-down: #c8382c;
  --zone: rgba(30,63,122,.05); --tip-bg: #2a2420; --tip-fg: #f6efdd;
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 4px 14px rgba(80,60,30,.10); --radius: 6px;
  --font-head: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", "Times New Roman", serif;
  --pattern: radial-gradient(rgba(42,36,32,.07) 1px, transparent 1.3px); --pop-shadow: 0 16px 36px rgba(80,60,30,.28);
}
:root[data-theme="neon"] {
  --bg: #07040f; --panel: #120a24; --fg: #ece6ff; --fg-rgb: 236,230,255; --muted: #9086b9; --line: #2b1d4f; --soft: #1b1134;
  --accent: #22d3ee; --accent-rgb: 34,211,238; --accent-soft: #0e2a3b; --accent-fg: #03121a;
  --up: #2cf5a8; --up-bg: #0e3328; --down: #ff4d8d; --down-bg: #3b1229; --amber: #ffb53d; --amber-bg: #3a2a0c;
  --seg-on: #5b2bd1; --seg-on-fg: #ffffff; --ink: #ece6ff;
  --chart-bg: #0b0618; --grid: #1b1236; --axis: #7a6fa3; --candle-up: #2cf5a8; --candle-down: #ff4d8d;
  --zone: rgba(34,211,238,.05); --tip-bg: #ece6ff; --tip-fg: #0b0618;
  --shadow: 0 0 0 1px rgba(124,58,237,.16), 0 10px 32px rgba(124,58,237,.12); --pop-shadow: 0 18px 50px rgba(124,58,237,.35);
}

/* ============================ БАЗА ============================ */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; transition: background .2s, color .2s; }
button { font-family: inherit; cursor: pointer; color: inherit; }
input, select { font-family: inherit; }
[hidden] { display: none !important; }
.up { color: var(--up); } .down { color: var(--down); }

.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; background-image: var(--pattern); background-size: 16px 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ============================ ШАПКА ============================ */
.top { position: relative; z-index: 30; flex: none; height: 60px; display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
:root[data-theme="japan"] .top { border-bottom: 3px double var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-head); font-size: 18px; letter-spacing: .2px; }
.logo { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), var(--up)); }
:root[data-theme="japan"] .logo { border-radius: 50%; background: var(--down); }
:root[data-theme="neon"] .logo { box-shadow: 0 0 14px rgba(34,211,238,.7); }

.coin-wrap, .menu-wrap { position: relative; }
.coin-btn { display: flex; align-items: center; gap: 11px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px 6px 7px; }
.coin-btn:hover { border-color: var(--accent); }
.coin-icon .ico { width: 30px; height: 30px; display: block; }
.coin-sym { font-size: 18px; display: flex; align-items: baseline; gap: 3px; }
.coin-sym i { font-style: normal; color: var(--muted); font-size: 13px; }
.chev { color: var(--muted); transition: transform .15s; }
.coin-btn.open .chev { transform: rotate(180deg); }

.pop { position: absolute; z-index: 50; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--pop-shadow); padding: 8px; }
.coin-menu { left: 0; top: calc(100% + 8px); width: 340px; }
.coin-menu input { width: 100%; border: 1px solid var(--line); background: var(--soft); color: var(--fg); border-radius: 9px;
  padding: 10px 12px; font-size: 15px; margin-bottom: 6px; }
.coin-menu input:focus { outline: none; border-color: var(--accent); }
.coin-list { max-height: min(62vh, 520px); overflow-y: auto; }
.coin-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; background: none; border: 0;
  border-radius: 9px; text-align: left; font-size: 15px; }
.coin-item:hover, .coin-item.active { background: var(--soft); }
.coin-item .ico { width: 26px; height: 26px; }
.coin-item b { flex: 1; font-weight: 650; }
.coin-item .p { font-variant-numeric: tabular-nums; font-size: 14px; }
.coin-item .c { width: 62px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; }
.empty-list { padding: 18px; color: var(--muted); font-size: 14px; text-align: center; }

.price-block { display: flex; flex-direction: column; line-height: 1.15; min-width: 110px; }
.price { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chg { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
:root[data-theme="neon"] .price { text-shadow: 0 0 12px rgba(34,211,238,.45); }

.seg { display: flex; gap: 3px; background: var(--soft); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.seg button { flex: 1; background: none; border: 0; color: var(--muted); padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.seg button:hover { color: var(--fg); }
.seg button.active { background: var(--seg-on); color: var(--seg-on-fg); }
:root[data-theme="neon"] .seg button.active { box-shadow: 0 0 14px rgba(124,58,237,.6); }
.mode { margin: 0 auto; }
.mode button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 20px; font-size: 14px; }
body.mode-ai .mode button.active { background: var(--accent); color: var(--accent-fg); }

.top-right { display: flex; align-items: center; gap: 8px; }
.round { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--fg); }
.round:hover { border-color: var(--accent); color: var(--accent); }
.lang { display: flex; gap: 4px; }
.lang button { background: var(--panel); border: 1px solid var(--line); color: var(--muted); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 700; }
.lang button.active { background: var(--seg-on); border-color: var(--seg-on); color: var(--seg-on-fg); }

.theme-menu { right: 0; top: calc(100% + 8px); width: 210px; }
.theme-title { padding: 6px 8px 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.theme-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border: 1px solid transparent; border-radius: 10px; background: none; font-size: 14.5px; font-weight: 600; text-align: left; }
.theme-opt:hover { background: var(--soft); }
.theme-opt.active { border-color: var(--accent); background: var(--accent-soft); }
.sw { display: flex; width: 46px; height: 26px; border-radius: 7px; overflow: hidden; border: 1px solid rgba(128,128,128,.35); flex: none; }
.sw i { flex: 1; }
.sw-light i:nth-child(1) { background: #fff; } .sw-light i:nth-child(2) { background: #2563eb; } .sw-light i:nth-child(3) { background: #14a36b; }
.sw-dark i:nth-child(1) { background: #0e131d; } .sw-dark i:nth-child(2) { background: #5b9bff; } .sw-dark i:nth-child(3) { background: #26a69a; }
.sw-japan i:nth-child(1) { background: #f6efdd; } .sw-japan i:nth-child(2) { background: #1e3f7a; } .sw-japan i:nth-child(3) { background: #c0392b; }
.sw-neon i:nth-child(1) { background: #0b0618; } .sw-neon i:nth-child(2) { background: #22d3ee; } .sw-neon i:nth-child(3) { background: #ff4d8d; }

.ico { border-radius: 50%; flex: none; object-fit: cover; }
.ico.fallback { display: inline-flex; align-items: center; justify-content: center; background: var(--soft); color: var(--fg); font-weight: 700; font-size: 12px; }
.coin-icon .ico.fallback { width: 30px; height: 30px; font-size: 14px; }

/* ============================ РАСКЛАДКА ============================ */
.main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
.center { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; padding: 12px 0 12px 12px; }
.side { display: flex; flex-direction: column; gap: 12px; min-height: 0; padding: 12px; }

.chart-card { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.chart-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.tf { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tf::-webkit-scrollbar { display: none; }
.tf button { flex: none; background: none; border: 0; color: var(--muted); padding: 5px 9px; border-radius: 7px; font-size: 12.5px; font-weight: 700; }
.tf button:hover { background: var(--soft); color: var(--fg); }
.tf button.active { background: var(--accent-soft); color: var(--accent); }
.tf .tf-auto { border: 1px dashed var(--line); margin-right: 6px; }
.tf .tf-auto.active { border-style: solid; border-color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--ink); }
.legend i.dash { border-top-style: dashed; }
.legend i.blue { border-color: var(--accent); }
.legend i.band { height: 9px; border: 0; background: rgba(var(--fg-rgb), .14); border-radius: 2px; }
.legend i.band.blue { background: rgba(var(--accent-rgb), .22); }
.chart-wrap { position: relative; flex: 1; min-height: 240px; background: var(--chart-bg); }
#chart { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
.chart-msg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 4; text-align: center; max-width: 80%;
  color: var(--muted); font-size: 15px; pointer-events: none; }
.chart-msg.err { color: var(--down); }

.details { flex: 0 0 36%; min-height: 160px; max-height: 58%; overflow-y: auto; padding: 16px 18px 20px; }
.details h4 { margin: 0 0 8px; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; font-family: var(--font-head); }
.block { margin-bottom: 18px; }
.block:last-child { margin-bottom: 0; }

/* статистика */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: calc(var(--radius) - 2px); padding: 12px 14px; background: var(--soft); }
.stat b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 12px; }
.stat .bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 8px; overflow: hidden; }
.stat .bar i { display: block; height: 100%; background: var(--fg); }
.stat.tp b { color: var(--up); } .stat.tp .bar i { background: var(--up); }
.stat.sl b { color: var(--down); } .stat.sl .bar i { background: var(--down); }
.stat.lq b { color: var(--amber); } .stat.lq .bar i { background: var(--amber); }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 24px; margin-top: 14px; font-size: 14px; }
.meta div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding: 7px 0; }
.meta span { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 12px 0 0; }

.banner { border-radius: 10px; padding: 10px 14px; font-size: 14px; line-height: 1.45; margin-bottom: 14px; }
.banner.err { background: var(--down-bg); color: var(--down); }
.banner.stale { background: var(--amber-bg); color: var(--amber); display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.btn { background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 9px; padding: 8px 14px; font-size: 13px; font-weight: 700; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--panel); color: var(--fg); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }

/* мнение ИИ */
.ai-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.badge.bullish { background: var(--up-bg); color: var(--up); }
.badge.bearish { background: var(--down-bg); color: var(--down); }
.badge.neutral { background: var(--soft); color: var(--muted); }
.pill { padding: 5px 10px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 600; }
.ai-top .sp { flex: 1; }
.summary { font-size: 15.5px; line-height: 1.55; margin: 0 0 12px; }
.targets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.target { border: 1px solid var(--line); border-radius: calc(var(--radius) - 2px); padding: 10px 12px; background: var(--soft); }
.target small { color: var(--muted); font-size: 12px; display: block; }
.target b { font-size: 17px; font-variant-numeric: tabular-nums; }
.target em { font-style: normal; font-size: 13px; font-weight: 600; margin-left: 6px; }
.target.base { border-color: var(--accent); background: var(--accent-soft); }

.action { border: 1px solid var(--accent); border-radius: calc(var(--radius) - 2px); padding: 14px 16px; background: var(--panel); }
.action-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.act { padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; background: var(--accent); color: var(--accent-fg); }
.act.wait { background: var(--amber); color: #fff; } .act.flip { background: var(--down); color: #fff; } .act.go { background: var(--up); color: #fff; }
.action-title b { font-size: 16px; font-family: var(--font-head); }
.action ol { margin: 0 0 10px; padding-left: 20px; font-size: 14.5px; line-height: 1.55; }
.action li { margin-bottom: 4px; }
.plan { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13.5px; background: var(--soft); border-radius: 10px; padding: 10px 12px; }
.plan span { color: var(--muted); }
.plan b { font-variant-numeric: tabular-nums; }
.action .btn { margin-top: 12px; width: 100%; padding: 10px; font-size: 14px; }

.logic { display: flex; flex-direction: column; gap: 8px; }
.logic-item { display: grid; grid-template-columns: 26px 1fr; gap: 10px; font-size: 14px; line-height: 1.45; }
.logic-item .ar { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.ar.up { background: var(--up-bg); color: var(--up); } .ar.down { background: var(--down-bg); color: var(--down); }
.ar.neutral { background: var(--soft); color: var(--muted); }
.logic-item b { font-weight: 650; }
.logic-item span { color: var(--muted); }

.chips-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-d { font-size: 12.5px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--soft); }
.chip-d b { color: var(--fg); }

.news { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.plate { flex: 0 0 270px; display: flex; flex-direction: column; gap: 7px; padding: 13px; border: 1px solid var(--line); border-radius: calc(var(--radius) - 2px);
  color: inherit; text-decoration: none; background: var(--soft); transition: border-color .15s, transform .15s; }
a.plate:hover { border-color: var(--accent); transform: translateY(-1px); }
.plate-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.plate-title { font-weight: 650; font-size: 14px; line-height: 1.4; }
.plate-note { font-size: 13px; line-height: 1.45; color: var(--muted); }
.tag { flex: none; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.tag.up { background: var(--up-bg); color: var(--up); } .tag.down { background: var(--down-bg); color: var(--down); }
.tag.neutral { background: var(--panel); color: var(--muted); }
ul.plain { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.55; }
.foot { margin: 14px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.loading { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 15px; padding: 10px 0; }
.spin { width: 18px; height: 18px; border: 2.5px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ============================ ПРАВАЯ КОЛОНКА ============================ */
.settings { flex: 1 1 52%; min-height: 0; overflow-y: auto; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.sec { margin: 4px 0 -2px; font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-family: var(--font-head); }
.sec:first-child { margin-top: 0; }
:root[data-theme="japan"] .sec::before { content: ""; display: inline-block; width: 7px; height: 7px; background: var(--down); border-radius: 50%; margin-right: 8px; vertical-align: 1px; }

.side-seg button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 6px; }
.side-seg b { font-size: 15px; }
.side-seg small { font-size: 11px; font-weight: 500; opacity: .85; }
.side-seg button.active[data-side="long"] { background: var(--up); color: #fff; }
.side-seg button.active[data-side="short"] { background: var(--down); color: #fff; }
:root[data-theme="neon"] .side-seg button.active { color: #07040f; box-shadow: 0 0 14px currentColor; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field-head { display: flex; align-items: center; justify-content: space-between; }
.field-head label, .lbl, label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
label { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-head label { display: block; }
.num { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.num input { width: 74px; text-align: right; }
.range { width: 100%; accent-color: var(--accent); margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 label[hidden] { display: none; }
input[type=number], select { width: 100%; background: var(--soft); border: 1px solid var(--line); color: var(--fg); padding: 9px 10px; border-radius: 9px;
  font-size: 15px; font-variant-numeric: tabular-nums; }
input[type=number]:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15); }
.lv small { font-size: 11.5px; font-weight: 700; min-height: 14px; }
.lv-stop small { color: var(--down); } .lv-take small { color: var(--up); }
.lv-stop input:focus { border-color: var(--down); box-shadow: 0 0 0 3px rgba(var(--fg-rgb), .06); }
.lv-take input:focus { border-color: var(--up); box-shadow: 0 0 0 3px rgba(var(--fg-rgb), .06); }
.link { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--accent); font-size: 13px; font-weight: 700; margin-top: -4px; }
.link:hover { text-decoration: underline; }
.custom { display: grid; grid-template-columns: 90px 1fr; gap: 8px; }
.hint-s { margin: -4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.hint-s:empty { display: none; }
.warn { margin: 0; font-size: 13px; line-height: 1.45; color: var(--amber); }
.warn:empty { display: none; }
.warn.err { color: var(--down); }

.ai-apply { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: calc(var(--radius) - 2px); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ai-apply .ttl { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--accent); }
.ai-apply .vals { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.ai-apply .vals span { color: var(--muted); }
.ai-apply .vals b { font-variant-numeric: tabular-nums; }
.ai-apply .btn { padding: 10px; font-size: 14px; }
.ai-apply .btn.done { background: var(--up); color: #fff; }
.ai-apply small { font-size: 11.5px; color: var(--muted); line-height: 1.35; }

/* чат */
.chat { flex: 1 1 48%; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.chat-head { flex: none; display: flex; align-items: center; gap: 9px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-family: var(--font-head); }
.ava { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; flex: none; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 92%; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 1.5; padding: 10px 13px; border-radius: 14px; }
.msg.bot { align-self: flex-start; background: var(--soft); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-fg); border-bottom-right-radius: 4px; }
.msg.err { background: var(--down-bg); border-color: transparent; color: var(--down); }
.typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 13px 14px; background: var(--soft); border: 1px solid var(--line); border-radius: 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: bl 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes bl { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chips { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 8px; }
.chips:empty { display: none; }
.chips button { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.chips button:hover { border-color: var(--accent); color: var(--accent); }
.composer { flex: none; display: flex; gap: 8px; padding: 0 14px; }
.composer input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; font-size: 15px; background: var(--soft); color: var(--fg); }
.composer input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .15); }
.composer button { flex: none; width: 44px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-fg); display: flex; align-items: center; justify-content: center; }
.composer button:disabled { opacity: .4; cursor: default; }
.note { flex: none; margin: 8px 16px 10px; font-size: 11px; line-height: 1.45; color: var(--muted); }

/* ============================ УЗКИЕ ЭКРАНЫ ============================ */
@media (max-width: 1180px) { .main { grid-template-columns: minmax(0, 1fr) 340px; } .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .brand b { display: none; } }
@media (max-width: 900px) {
  .app { height: auto; min-height: 100dvh; }
  .top { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 10px; }
  .brand { display: none; }
  .mode { order: 5; width: 100%; margin: 0; }
  .mode button { flex: 1; padding: 9px 8px; }
  .top-right { margin-left: auto; }
  .main { display: flex; flex-direction: column; }
  .center { padding: 12px 12px 0; }
  .side { padding: 12px; }
  .chart-card { flex: none; }
  .chart-wrap { height: 52vh; min-height: 300px; flex: none; }
  .chart-bar { flex-direction: column; align-items: stretch; gap: 6px; }
  .legend { justify-content: flex-start; }
  .details { flex: none; max-height: none; overflow: visible; }
  .settings { overflow: visible; flex: none; }
  .chat { height: 70vh; flex: none; }
  .coin-menu { position: fixed; left: 10px; right: 10px; top: 120px; width: auto; }
  .targets { grid-template-columns: 1fr; }
  .plate { flex-basis: 240px; }
}