:root {
  --bg: var(--tg-theme-bg-color, #f9f9f7);
  --card: var(--tg-theme-secondary-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #0b0b0b);
  --muted: var(--tg-theme-hint-color, #898781);
  --accent: var(--tg-theme-button-color, #2a78d6);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --line: rgba(127, 127, 127, 0.18);
  --good: #0ca30c;
  --bad: #d03b3b;
  --warn: #c98500;
  --series-1: #2a78d6;
  --series-2: #eb6834;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 4px; }
.brand { font-weight: 700; font-size: 17px; }
.brand span { color: var(--accent); }
.pill { font-size: 11px; padding: 3px 8px; border-radius: 10px; background: var(--card); color: var(--muted); }
.pill.test { background: #fab21933; color: var(--warn); }
.pill.real { background: #0ca30c22; color: var(--good); }
main { padding: 8px 16px 16px; max-width: 760px; margin: 0 auto; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs button { flex: 1; border: 0; background: none; color: var(--muted); padding: 8px 0 9px; font-size: 11px; }
.tabs button i { display: block; font-style: normal; font-size: 17px; line-height: 20px; }
.tabs button.on { color: var(--accent); }
.card { background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.card h3 small { font-weight: 400; color: var(--muted); }
.hero { font-size: 28px; font-weight: 700; }
.sub { color: var(--muted); font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
.stat { background: var(--card); border-radius: 12px; padding: 10px 12px; }
.stat .v { font-size: 17px; font-weight: 650; }
.stat .l { font-size: 11px; color: var(--muted); }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.list .item { padding: 11px 0; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
.sym { font-weight: 650; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 8px; background: var(--line);
  color: var(--text); margin-left: 6px; font-weight: 500; }
.tag.good { background: #0ca30c22; color: var(--good); }
.tag.bad { background: #d03b3b22; color: var(--bad); }
.tag.warn { background: #fab21933; color: var(--warn); }
.tag.acc { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.mono { font-variant-numeric: tabular-nums; }
.btn { border: 0; background: var(--accent); color: var(--accent-text); padding: 10px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.btn.ghost { background: var(--line); color: var(--text); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.full { width: 100%; }
.seg { display: flex; background: var(--line); border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: none; color: var(--text); padding: 6px 0; border-radius: 8px; font-size: 13px; }
.seg button.on { background: var(--card); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.field { padding: 10px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field label { display: block; font-weight: 550; }
.field .help { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.field input[type=text], .field input[type=number], .field select, .field textarea, input.inp {
  width: 100%; padding: 9px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); font-size: 15px; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 14px; transition: .2s; }
.switch span:before { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span:before { transform: translateX(18px); }
.warnbox { background: #fab2191f; color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 13px;
  margin-bottom: 12px; }
.chart { position: relative; height: 200px; }
.chart.tall { height: 240px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.toast { position: fixed; z-index: 40; left: 16px; right: 16px; bottom: 80px; background: #222; color: #fff; padding: 11px 14px;
  border-radius: 10px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 20; font-size: 13px; }
.toast.show { opacity: 1; }
table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.t th { text-align: left; color: var(--muted); font-weight: 500; padding: 5px 4px; border-bottom: 1px solid var(--line); }
table.t td { padding: 6px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.t td.r, table.t th.r { text-align: right; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 4px; }
.bar > div { height: 100%; background: var(--series-1); border-radius: 3px; }
.more { text-align: center; margin-top: 8px; }

/* ---- график сделки ---- */
.item[data-open] { cursor: pointer; }
.ci { font-size: 12px; margin-left: 5px; opacity: .75; }
body.sheet-open { overflow: hidden; }
.sheet { position: fixed; inset: 0; z-index: 30; background: #101419; color: #ced6df; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #252e38; flex: none; }
.sheet-close { border: 1px solid #35404e; background: #192029; color: #e3eaf2; border-radius: 8px; width: 34px; height: 34px; font-size: 15px; }
.sheet-title { font-weight: 650; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-chart { position: relative; height: 58vh; min-height: 300px; }
.sheet-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #8fa0b3; padding: 20px; text-align: center; }
.sheet-info { padding: 12px 16px 28px; font-size: 13.5px; }
.sheet-info .sym { color: #f0f4f8; }
.sheet-info .tag { background: #253040; color: #ced6df; }
.sheet-info .btn.ghost { background: #192029; color: #e3eaf2; border: 1px solid #35404e; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid #1f2731; }
.kv span:first-child { color: #8fa0b3; flex: none; }
.kv span:last-child { text-align: right; }
.hypo { background: #192029; border: 1px solid #35404e; border-radius: 10px; padding: 12px; margin-top: 14px; line-height: 1.55; }
.hypo-t { font-weight: 650; color: #f5c96a; margin-bottom: 4px; }
.sheet .hint { color: #8fa0b3; font-size: 12px; }
.sheet .pos { color: #48cfae; } .sheet .neg { color: #ed7080; }
.t.wf th.r, .t.wf td.r { white-space: nowrap; }
.t.wf td:first-child { font-size: 12px; }
