/* Fresh Tracker — торговый терминал свежих кошельков.
   Тёмный сине-сланцевый фон; цвет несёт смысл: зелёный — держат/растёт, красный — слили/падает,
   фиолетовый — Big Fresh, янтарный — создатель монеты. Цифры моноширинные (tabular-nums). */
:root {
  --bg: #0e1420; --panel: #141c2a; --raised: #1b2536; --line: #24304a;
  --text: #e6ebf3; --muted: #98a4b7; --faint: #6c788c;
  --up: #2bd47d; --down: #ff5c61; --big: #a78bfa; --dev: #f2b33d; --link: #7cb3ff;
  --fs: 13px; --r: 8px;
  font-family: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
}
[data-theme="light"] {
  --bg: #f3f5f9; --panel: #ffffff; --raised: #eef1f6; --line: #dde3ec;
  --text: #131a26; --muted: #5b6678; --faint: #8b95a5;
  --up: #12a35b; --down: #e5383d; --big: #7c5ce6; --dev: #b7790a; --link: #2563eb;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-size: var(--fs); line-height: 1.4; }
a { color: inherit; text-decoration: none; cursor: pointer; }
a:hover { color: var(--link); }
button, select, input { font: inherit; color: inherit; }
button { background: var(--raised); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
button.on { background: var(--text); border-color: var(--text); color: var(--bg); }
button.ghost { background: transparent; border-color: transparent; }
button.primary { background: var(--up); border-color: var(--up); color: #062014; font-weight: 600; }
select, input { background: var(--raised); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
input[type="number"] { width: 64px; }
.dim { color: var(--muted); }
.up, .c-up { color: var(--up); } .down, .c-down { color: var(--down); } .violet, .c-big { color: var(--big); }
.addr { font-variant-numeric: tabular-nums; letter-spacing: .01em; white-space: nowrap; }
.mono { white-space: nowrap; }

/* шапка */
.top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .06em; }
.brand span { color: var(--up); }
.seg { display: inline-flex; gap: 2px; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: 6px 0 0 6px; } .seg button:last-child { border-radius: 0 6px 6px 0; }
#search { width: 220px; }
.spacer { flex: 1; }
.status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dev); }
.status.ok .dot { background: var(--up); } .status.bad .dot { background: var(--down); }
.chips { display: flex; gap: 6px; padding: 8px 16px; flex-wrap: wrap; }
.chips button { border-radius: 999px; font-size: 12px; }

/* раскладка */
main { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 12px; padding: 0 16px 16px; height: calc(100vh - 110px); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-height: 0; }
.panel h2 { font-size: 14px; font-weight: 600; margin: 0; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.count { color: var(--muted); font-weight: 400; margin-left: 4px; }
.scroll { overflow: auto; flex: 1; min-height: 0; }
.tabs-mobile { display: none; }

/* таблицы */
table.grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.grid th { position: sticky; top: 0; z-index: 1; background: var(--panel); color: var(--muted); font-weight: 500; text-align: left;
  padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12px; }
.grid td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid.compact td { padding: 6px 8px; }
.grid .num { text-align: right; white-space: nowrap; }
.grid tbody tr:hover td { background: var(--raised); }
.grid tr.hot td { background: color-mix(in srgb, var(--up) 9%, transparent); }
.grid tr.new td { animation: flash 2s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--up) 22%, transparent); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .grid tr.new td { animation: none; } }
.empty { text-align: center; color: var(--muted); padding: 24px !important; }
.sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.sub.nw { white-space: nowrap; }
.sym { font-weight: 600; font-size: 14px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--raised); color: var(--muted); margin-left: 5px; vertical-align: 1px; }
.tag.dev { color: var(--dev); } .tag.batch { color: var(--link); } .tag.big { color: var(--big); }
.tag.danger { color: #fff; background: var(--down); }
.pill { font-size: 11px; padding: 0 6px; border-radius: 999px; }
.pill.green { background: color-mix(in srgb, var(--up) 18%, transparent); color: var(--up); }
.pill.violet { background: color-mix(in srgb, var(--big) 18%, transparent); color: var(--big); }
.bar { width: 64px; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--down) 55%, transparent); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--up); }
.spark { vertical-align: middle; margin-left: 8px; }
.spark polyline { fill: none; stroke-width: 1.5; }
.spark .up { stroke: var(--up); } .spark .down { stroke: var(--down); }
.star { background: none; border: none; color: var(--faint); font-size: 15px; padding: 0 2px; }
.star.on { color: var(--dev); }
.eye { opacity: .45; } .eye:hover { opacity: 1; }
.exch { color: var(--text); font-weight: 600; border-bottom: 1px dotted var(--muted); }

/* путь капы в списке монет: вход ↗ ATH → сейчас */
.cap-path { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.cap-path .arr { color: var(--faint); }
.cap-path .ath { color: var(--text); }
.state { font-weight: 600; }
.s-up { color: var(--up); } .s-down, .s-dead { color: var(--down); } .s-flat { color: var(--muted); }

/* группы связанных кошельков */
.gbadge { display: inline-block; font-size: 11px; font-weight: 700; color: var(--g); background: color-mix(in srgb, var(--g) 16%, transparent);
  padding: 1px 6px; border-radius: 999px; margin-left: 5px; cursor: pointer; white-space: nowrap; }
.gbadges { margin-top: 4px; display: flex; gap: 3px; justify-content: flex-end; flex-wrap: wrap; }
.gbadges .gbadge { margin-left: 0; cursor: default; }
.groups { margin-bottom: 8px; }
.glist { display: flex; flex-direction: column; gap: 6px; }
.grp { display: flex; gap: 10px; align-items: flex-start; text-align: left; background: var(--raised); border: 1px solid var(--line);
  border-left: 4px solid var(--g); border-radius: 6px; padding: 8px 10px; }
.grp.on { border-color: var(--g); background: color-mix(in srgb, var(--g) 12%, var(--raised)); color: var(--text); }
.grp .gname { color: var(--g); font-weight: 700; white-space: nowrap; }
.grp .sub { display: block; }
.reset { font-size: 12px; font-weight: 400; color: var(--link); margin-left: 8px; }

/* статус кошелька */
.st { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.st-ok { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.st-bad { color: var(--down); background: color-mix(in srgb, var(--down) 14%, transparent); }

/* карточка монеты */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(780px, 100vw); background: var(--panel); border-left: 1px solid var(--line);
  overflow: auto; z-index: 20; padding: 16px 18px; box-shadow: -12px 0 32px rgba(0, 0, 0, .35); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-head > div:first-child { flex: 1; min-width: 0; }
.title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.big-sym { font-size: 22px; font-weight: 700; margin-right: 4px; }
.ca { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-shrink: 0; }
.btn { border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; font-size: 12px; }

/* вердикт — главное в карточке */
.verdict { border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; background: var(--raised); border-left: 4px solid var(--faint); }
.v-up { border-left-color: var(--up); } .v-down, .v-dead { border-left-color: var(--down); }
.v-title { font-size: 19px; font-weight: 700; margin-bottom: 12px; }
.v-up .v-title { color: var(--up); } .v-down .v-title, .v-dead .v-title { color: var(--down); }
.v-path { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.v-path > div { display: flex; flex-direction: column; gap: 2px; }
.v-k { font-size: 12px; color: var(--muted); }
.v-path b { font-size: 17px; }
.v-path .v-ath { color: var(--text); }
.v-path .v-now { font-size: 20px; }
.v-arrow { color: var(--faint); font-size: 18px; padding-bottom: 2px; }
.v-x { font-size: 12px; color: var(--muted); }

.fresh-sum { margin-bottom: 14px; }
.fresh-sum p { margin: 0 0 8px; font-size: 14px; max-width: 70ch; }
.sitbar { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--down) 55%, transparent); overflow: hidden; }
.sitbar i { display: block; height: 100%; background: var(--up); }
.sitlegend { display: flex; justify-content: space-between; font-size: 12px; margin-top: 4px; font-weight: 600; }

.chart-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 12px; }
.chart { height: 280px; margin-bottom: 16px; }
.drawer h3, .modal-box h3 { font-size: 14px; font-weight: 600; margin: 16px 0 6px; }

/* аналитика */
details.analysis { margin: 4px 0 12px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; }
details.analysis summary { cursor: pointer; font-weight: 600; font-size: 14px; }
details.analysis p { margin: 8px 0; max-width: 75ch; }
details.analysis h4 { font-size: 13px; margin: 12px 0 4px; }
.style-organic { color: var(--up); } .style-farm { color: var(--down); } .style-mixed { color: var(--dev); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); }
.facts b { color: var(--text); }
ul.smart { margin: 4px 0; padding-left: 18px; }
.modal.wide .modal-box { width: min(1000px, 100%); }
.an-controls { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 8px 0 12px; }
.an-f { display: inline-flex !important; gap: 4px; align-items: center; margin: 0 !important; font-size: 12px; color: var(--muted); }
.an-sum { font-size: 14px; }
.an-group td { color: var(--muted); font-size: 12px; font-weight: 600; padding-top: 12px !important; border-bottom: none !important; }
.an-bar { width: 56px; margin-left: auto; }
.an-list { max-height: 420px; }

/* окна */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 30; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto; }
.modal[hidden], .drawer[hidden] { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; width: min(640px, 100%); }
.modal-box label { display: block; margin: 6px 0; }
.modal-foot { margin-top: 16px; display: flex; gap: 8px; }
.hidden-item { padding: 4px 0; border-bottom: 1px solid var(--line); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(30px); background: var(--raised); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 8px; opacity: 0; transition: .2s; z-index: 40; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }

.login-page { display: flex; align-items: center; justify-content: center; }
.login-box { display: flex; flex-direction: column; gap: 10px; width: 280px; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.login-box h1 { font-size: 18px; letter-spacing: .06em; margin: 0 0 6px; }
.login-box h1 span { color: var(--up); }
.err { color: var(--down); min-height: 1em; }

@media (max-width: 900px) {
  main { grid-template-columns: minmax(0, 1fr); height: auto; }
  main[data-tab="coins"] #feed-panel, main[data-tab="feed"] #coins-panel { display: none; }
  .tabs-mobile { display: flex; gap: 6px; padding: 0 16px 8px; }
  #search { width: 100%; order: 10; }
  .grid td:nth-child(7), .grid th:nth-child(7) { display: none; }
  .v-path { gap: 10px; }
  .card-head { flex-wrap: wrap; }
  .card-head > div:first-child { flex-basis: 100%; }
  .card-actions { flex-wrap: wrap; justify-content: flex-start; padding-right: 36px; }
  .card-actions [data-close] { position: absolute; top: 10px; right: 10px; }
}

.an-tabs { margin: 4px 0 8px; }
.an-row { cursor: pointer; }
.an-row:hover td { background: var(--raised); }
.an-row.on td { background: color-mix(in srgb, var(--link) 16%, transparent); }
.an-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 10px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.st-form input[type=number] { width: 64px; }
svg.equity { width: 100%; height: 120px; display: block; margin: 8px 0; }
svg.equity polyline { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
svg.equity polyline.pos { stroke: var(--up); } svg.equity polyline.neg { stroke: var(--down); }
svg.equity .zero { stroke: var(--line); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }

.v-sleep { border-left-color: var(--faint); } .v-sleep .v-title { color: var(--muted); font-size: 16px; }
.v-life { margin: -8px 0 10px; }

.paper { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin: 10px 0; background: var(--raised); }
.paper.off { opacity: .6; }
.paper-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.paper-actions { margin-left: auto; display: inline-flex; gap: 4px; }
.paper p { margin: 6px 0; }
.an-list.short { max-height: 260px; }

.an-row.few td { opacity: .45; }
.an-row.off td { text-decoration: line-through; opacity: .6; }
.an-row .ex { padding: 0 6px; font-size: 13px; opacity: .5; }
.an-row:hover .ex, .an-row.off .ex { opacity: 1; }
.chip.neg { border-color: var(--down); color: var(--down); }
.small { font-size: 11px; }

#update-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 100; background: var(--raised);
  border: 1px solid var(--link); border-radius: var(--r); padding: 8px 12px; display: flex; gap: 10px; align-items: center; }

/* страница аналитики */
.pages { margin-left: 8px; }
body.on-analytics #main, body.on-analytics #presets, body.on-analytics #mtabs,
body.on-analytics #windows, body.on-analytics #sort, body.on-analytics #search { display: none; }
.an-page { padding: 0 16px 32px; }
.an-page[hidden] { display: none; }
.an-page-box { max-width: 1200px; margin: 0 auto; }
.an-page h1 { font-size: 20px; font-weight: 600; margin: 14px 0 4px; }
.an-page h3 { font-size: 14px; font-weight: 600; margin: 18px 0 6px; }
.an-bar-top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 6px 0 2px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.an-page .an-list { max-height: 560px; }
.an-page.loading .an-page-box { opacity: .55; pointer-events: none; transition: opacity .15s; }
.an-page.loading::after { content: "считаю…"; position: fixed; top: 64px; right: 16px; z-index: 6; background: var(--raised);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; font-size: 12px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .an-page.loading .an-page-box { transition: none; } }
.an-page .an-tabs { display: flex; max-width: 100%; overflow-x: auto; }
@media (max-width: 760px) { .an-page-box > table.grid { display: block; overflow-x: auto; } }

/* профиль фреша в карточке */
.tag.prof.winner { color: var(--up); border-color: color-mix(in srgb, var(--up) 45%, transparent); }
.tag.prof.loser { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); }
.tag.prof.warmed { color: var(--dev); border-color: color-mix(in srgb, var(--dev) 45%, transparent); }
